PageSourceSearch

https://www.praes.pl/application/assets/storefront/chunk-basket_initializer.C_ksKFe.js

js praes.pl collected 2026-10-08 17:42:24 UTC 394,514 bytes, 3,569 lines download raw bytes

1import{b as O,J as m,aP as S,c as U,l as K,bX as y,s as C,i as de,t as js,aN as ls,c0 as ue,c1 as ke,c2 as tt,h as Ft,c3 as Qs,c4 as kt,c5 as $t,a as z,c6 as Ys,aO as Mt,bO as ge,bQ as Ce,L as cs,aw as ie,c7 as Tt,bP as Ie,v,bq as ht,b_ as Js,c8 as ds,bN as H,T as J,e as ae,b8 as hs,c9 as Re,aM as ps,ca as Pt,cb as Xs,cc as Ct,cd as It,ce as Zs,N as ei,M as ti,H as si,p as ii,D as ai,r as ni,C as ri}from"./storefrontApp.DHj_rTVq.min.js";import{B as q}from"./chunk-basket_updated_handler.i-LQoyu.js";import{g as B,f as Ot}from"./chunk-vendor-lodash.CWHFt7Z.js";import{d as k,m as A,e as D,B as ve,a as us,c as oi,k as ms,O as wt,S as li,h as ci}from"./chunk-vendor-rxjs.Dp7kflo.js";import{w as ye,g as ce,s as be,c as fe,i as di}from"./chunk-index.esm.nYUWi4A.js";import{F as Lt,B as hi,P as pi,D as ui,C as Ze,S as mi,a as _i,I as gi,H as yi,b as bi}from"./chunk-basket_mapper.DtWlpEG.js";import{S as L}from"./chunk-storefront_settings_constants.DIF02Gz.js";import{A as fi}from"./chunk-authentication_events.V_eZaX3.js";import{U as Si}from"./chunk-user_events.DVe_9j8.js";import{U as _e,$ as r,b as P,d as I,f as g,w as d,e as p,t as u,a as ee,c as $e,B as _s,h as gs,J as we,T as Ai,g as j,q as vi}from"./chunk-vendor-lit.NvY0u02.js";import{M as ki}from"./chunk-modal_constants.RvL-5Lb.js";import{S as pt}from"./chunk-storefront_event_handler.BBKelLe.js";import{t as l}from"./chunk-translations_directive.DFKTlKG.js";import{o as $}from"./chunk-observable_directive.eGckMWP.js";import{B as Ve}from"./chunk-backdrop_constants.5bk4eBT.js";import{P as $i}from"./chunk-price_mapper.C8-oiM4.js";import{S as f}from"./chunk-storefront_base_lit_element.BDgKmPq.js";import{o as M}from"./chunk-observe_when_directive.DWgxaey.js";import{I as Pi}from"./chunk-input_stepper_constants.CxAeeF7.js";import{B as ne,a as Ci,G as Ii}from"./chunk-inpost_pay_button_constants.RkLheTG.js";import{S as Nt}from"./chunk-subscription_controller.pXrelaM.js";import{F as Pe}from"./chunk-form_state_constants.Gcz9tYH.js";import{P as wi}from"./chunk-product_stock_changed_handler.Cxrl8lM.js";import{a as ys}from"./chunk-control_connector_constants.CepOMss.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-phoenix.cdKS79L.js";import"./chunk-address_mapper.CYefj1h.js";import"./chunk-loyalty_points_mapper.CnpZkby.js";import"./chunk-bundle_item_mapper.CM3KA-S.js";import"./chunk-producer_mapper.CZr9NoY.js";import"./chunk-product_events_constants.BHFu5GP.js";class Ei extends O{#e;#t;#s;#a;#n;#r;constructor({basketProductsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o}){super(),this.#e=e,this.#s=t,this.#a=i,this.#t=s,this.#n=a,this.#r=o,this._setupEventListeners()}_setupEventListeners(){new q(this.#o,this.#t)}#o=({body:e})=>{const t=e?.products.list||[];this._setProducts(t)};_setProducts(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}async remove(e){const{response:t}=this.#s.removeProduct(e.actions.remove);try{const{data:i}=await t;this.eventBus.emit(new m(S.itemRemovedFromBasket,e)),this.#a.emitUpdateBasketEvent(i)}catch(i){this._handleUnexpectedError(i)}}async update(e,t){const{response:i}=this.#s.updateProduct(e.actions.changeQuantity,t);try{const{data:s}=await i;this.#a.emitUpdateBasketEvent(s)}catch(s){this._handleUnexpectedError(s)}}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}const Bi=({storeName:n="BasketProductsListStore"}={})=>U({name:n},ye());class xi{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}const Ee={isValid:!0,validationMessage:""},Fi={sum:{currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""},discountedSum:{currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""}
1,position:0,count:0,...Ee},Mi=({storeName:n="BasketProductsSummaryStore"}={})=>U({name:n},K(Fi));class Ti{#e;#t;constructor(e){this.#e=e,this.#t=new Lt}setSum(e){this.#e.update(y("sum",this.#t.toDTO(e)))}getSum(){return this.#t.toModel(this.#e.getValue().sum)}selectSum$(){return this.#e.pipe(C(e=>this.#t.toModel(e.sum)))}setDiscountedSum(e){this.#e.update(y("discountedSum",this.#t.toDTO(e)))}getDiscountedSum(){return this.#t.toModel(this.#e.getValue().discountedSum)}selectDiscountedSum$(){return this.#e.pipe(C(e=>this.#t.toModel(e.discountedSum)))}setCount(e){this.#e.update(y("count",e))}getCount(){return this.#e.getValue().count}selectCount$(){return this.#e.pipe(C(e=>e.count))}setPosition(e){this.#e.update(y("position",e))}getPosition(){return this.#e.getValue().position}selectPosition$(){return this.#e.pipe(C(e=>e.position))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}class Oi extends O{#e;#t;constructor({basketProductsSummaryRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t),this.eventBus.on("invalidSection.basketItems",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})})}#s=({body:e})=>{const t=e?.products.sum,i=e?.products.positions,s=e?.products.count,a=e?.products.discountedSum;t&&this._setSum(t),s!==void 0&&this._setCount(s),i!==void 0&&this._setPosition(i),a&&this._setDiscountedSum(a),e?.invalidSections.basketItems||this.#e.setSectionValidation({isValid:!0,validationMessage:""})};_setSum(e){this.#e.setSum(e)}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}_setDiscountedSum(e){this.#e.setDiscountedSum(e)}getDiscountedSum(){return this.#e.getDiscountedSum()}selectDiscountedSum$(){return this.#e.selectDiscountedSum$().pipe(k((e,t)=>B(e,t)))}_setCount(e){this.#e.setCount(e)}getCount(){return this.#e.getCount()}selectCount$(){return this.#e.selectCount$()}_setPosition(e){this.#e.setPosition(e)}getPositions(){return this.#e.getPosition()}selectPositions$(){return this.#e.selectPosition$()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$().pipe(k((e,t)=>B(e,t)))}}class Li extends de{constructor({basketProductsListService:e,basketProductsSummaryService:t}){super(),this.moduleName="basketProductsApi",this.#e=e,this.#t=t}#e;#t;get(){return this.#e.get()}select$(){return this.#e.select$()}remove(e){this.#e.remove(e)}update(e,t){this.#e.update(e,t)}getBasketCount(){return this.#t.getCount()}selectBasketCount$(){return this.#t.selectCount$()}getBasketPositions(){return this.#t.getPositions()}selectBasketPositions$(){return this.#t.selectPositions$()}getSum(){return this.#t.getSum()}selectSum$(){return this.#t.selectSum$()}getDiscountedSum(){return this.#t.getDiscountedSum()}selectDiscountedSum$(){return this.#t.selectDiscountedSum$()}getSectionValidation(){return this.#t.getSectionValidation()}selectSectionValidation$(){return this.#t.selectSectionValidation$()}}class Ni extends js{constructor({httpApi:e}){super(e),this.moduleName=ls.httpApi,this._basketRequestQueue=Promise.resolve()}addItem({basketId:e,variantId:t,quantity:i,variantOptions:s,basketTrackingParams:a,isExchangedWithLoyaltyPoints:o=!1,bundleItems:c=[]}){return this._processBasket({method:"post",url:`/api/basket/${e}/item/${t}${a||""}`,data:{quantity:i,options:s,isExchangedWithLoyaltyPoints:o,bundledItems:c}})}updateProduct(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{quantity:t}})}removeProduct(e){return this._processBasket({method:e.method,url:`/${e.href}`})}createBasket(){return this._processBasket({method:"post",url:"/api/basket/"})}queueCreateBasket(){return this._processBasket({method:"post",url:"/api/basket/queue"})}getBasket(e){return this._processBasket({method:"get",url:`/api/basket/${e??""}`})}cleanBasket(e){return this._processBasket({method:e.method,url:`/${e.href}`})}
1addCoupon(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{code:t}})}removeCoupon(e){return this._processBasket({method:e.method,url:`/${e.href}`})}addGiftCard(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{giftCardCode:t}})}removeGiftCard(e){return this._processBasket({method:e.method,url:`/${e.href}`})}setShipping(e){return this._processBasket({method:e.method,url:`/${e.href}`})}setCountry(e,t){return this._processBasket({method:e.method,url:`/${e.href}/${t}`})}setPayment(e){return this._processBasket({method:e.method,url:`/${e.href}`})}setPaymentData(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:t})}setAddress(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:t})}changePickupPoint(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{...t}})}setComment(e,t){return this._processBasket({method:e.method,url:`/${e.href}`,data:{comment:t}})}changeAdditionalField(e,t,i){return this._processBasket({method:e.method,url:`/${e.href}`,data:{[t]:i}})}uploadVariantFile(e,t,i){return this._processBasket({method:"post",url:`/api/basket/${e}/product-option-file/${t}`,data:i,headers:{"Content-Type":"application/octet-stream","X-Uploaded-File-Name":encodeURI(i.name)}})}uploadAdditionalFieldFile(e,t){return this._processBasket({method:"post",url:`/${e.href}`,data:t,headers:{"Content-Type":"application/octet-stream","X-Uploaded-File-Name":encodeURI(t.name)}})}queueOrder(e){return this._processBasket({method:e.method,url:`/${e.href}`})}getQueueStatus(e){return this._processBasket({method:"get",url:`${e}`})}getCreateBasketQueueStatus(e){return this._processBasket({method:"get",url:`${e}`})}placeOrder(e){return this._processBasket({method:e.method,url:`/${e.href}`})}_processBasket(e){let t=null,i=!1;const s=()=>
1{if(i)return Promise.reject(new Error("Request canceled"));const o=setTimeout(()=>{this.eventBus.emit(new m(S.changeState,ue.longProcessing))},200);try{const{response:c,cancelRequest:h}=this.fetch(e);return t=h,c.then(b=>(clearTimeout(o),this.eventBus.emit(new m(S.changeState,ue.idle)),b)).catch(b=>{throw clearTimeout(o),this.eventBus.emit(new m(S.changeState,ue.idle)),b})}catch(c){return this.eventBus.emit(new m(S.changeState,ue.idle)),Promise.reject(c)}},a=this._basketRequestQueue.then(s,s);return this._basketRequestQueue=a.then(()=>{},()=>{}),{response:a,cancelRequest:()=>{t?t():i=!0}}}}const Vi={_links:{},id:"",comment:"",countries:[],isVatEu:!1,hasPromoCode:!1,promoCode:null,delivery:null,discounts:{list:[],sum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zł",netValue:0,netValueFormatted:"0,00 zł",taxValue:0,taxValueFormatted:"0,00 zł",tax:0,taxFormatted:"0,00 zł"}},additionalFields:{selectFields:[],descriptionFields:[],inputFields:[],fileFields:[],hiddenFields:[],checkboxFields:[]},taxes:{list:[],sum:{value:0,valueFormatted:"0,00 zł"}},payments:[],shippings:[],billingAddress:null,shippingAddress:null,sum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zł",netValue:0,netValueFormatted:"0,00 zł",taxValue:0,taxValueFormatted:"0,00 zł",tax:0,taxFormatted:"0,00 zł"},sumWithoutPaymentAndShipping:{currency:"",grossValue:0,grossValueFormatted:"0,00 zł",netValue:0,netValueFormatted:"0,00 zł",taxValue:0,taxValueFormatted:"0,00 zł",tax:0,taxFormatted:"0,00 zł"},loyaltyPointsAwarded:null,hasItemsExchangedWithLoyaltyPoints:!1,loyaltyPointsCost:null,loyaltyPointsExchangePrice:null,items:{list:[],count:0,positions:0,sum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zł",netValue:0,netValueFormatted:"0,00 zł",taxValue:0,taxValueFormatted:"0,00 zł",tax:0,taxFormatted:"0,00 zł"},discountedSum:{currency:"",grossValue:0,grossValueFormatted:"0,00 zł",netValue:0,netValueFormatted:"0,00 zł",taxValue:0,taxValueFormatted:"0,00 zł",tax:0,taxFormatted:"0,00 zł"}},invalidSections:{}};class Ri extends O{#e;#t=new hi;#s;#a;#n;#r;#o;#i;#l;constructor({basketHttpApi:e,flashMessengerApi:t,settingsApi:i,storeFactoryApi:s,translationsApi:a,basketUpdaterRepository:o}){super(),this.#e=e,this.#s=t,this.#a=i,this.#n=s,this.#r=a,this.#o=o,this._setupLocalStore(),this._setupBasket(),this._setupEvents(),this._isRememberCreateBasketQueueEnabled()&&this._setupSessionStore()}_isRememberCreateBasketQueueEnabled(){return this.#a.isFeatureEnabled("dev_remember_create_basket_queue")}_isBasketExpired(){const e=this.#i?.get("basketUpdateTimestamp"),t=Date.now();if(e){const i=parseInt(e,10),s=1440*1e3;return t-i>s}return!1}_hasBasket(){return this.#i?.has("basketId")===!0}_setupLocalStore(){this.#i=this.#n.getStore(ke),this.#i||(this.#i=this.#n.createStore("local",ke))}_setupSessionStore(){this.#l=this.#n.getStore(tt),this.#l||(this.#l=this.#n.createStore("session",tt))}_setupBasket(){if(this._isBasketExpired()){const e=this.#i?.get("basketId");e&&this.getCurrentBasket(e,!0)}else if(this._hasBasket()){const e=this.#i?.get("basketId");this.getCurrentBasket(e)}}_setupEvents(){this.eventBus.on(S.unexpectedError,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(fi.loggedOut,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(S.orderPlaced,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(Si.hasBasket,async({body:e})=>{if(!e)return;const t=this.#a.isFeatureEnabled("dev_basket_merging"),i=this._hasBasket();t||!i?(this.#i?.set("basketId",e),await this.getCurrentBasket(e,!0)):this.refreshBasket()})}async addItem({variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,isExchangedWithLoyaltyPoints:a,bundleItems:o,showAddedModal:c,showFlashMessage:h}){const _=this.#i?.get("basketId");if(_)try{const{response:b}=this.#e.addItem({basketId:_,variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,isExchangedWithLoyaltyPoints:a,bundleItems:o}),{data:w}=await b;this.emitUpdateBasketEvent(w);const F=this.#t.toModel(w.basket),x=w.addedItem;c=c===void 0?!0:c;const N=F.products.list?.find(se=>se.id===x?.itemId);return x&&x.addedQuantity>0&&(h&&this.#s.addFlashMessage({type:"success",content:this.#r.translate("Added to cart")}),this.eventBus.emit(new m(S.itemAddedToBasket,{addedItem:x,product:N,basket:F,showAddedModal:c}))),F}catch(b){return console.error(b),b.response.status===Ft.notFound?(c=c===void 0?!0:c,this.#i?.remove("basketId"),this.addItem({variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,bundleItems:o,showAddedModal:c})):null}else return await this.createBasket()?this.addItem({variantId:e,quantity:t,variantOptions:i,basketTrackingParams:s,isExchangedWithLoyaltyPoints:a,bundleItems:o,showAddedModal:c,showFlashMessage:h}):(this._handleUnexpectedError("Basket not created"),null)}
1async uploadVariantFile(e,t){const i=this.#i?.get("basketId");if(i)try{const{response:s}=this.#e.uploadVariantFile(i,e,t),{data:a}=await s;return a}catch(s){return console.error(s),null}else return await this.createBasket()?this.uploadVariantFile(e,t):(this._handleUnexpectedError("Basket not created"),null)}async createBasket(){try{if(this.#a.isFeatureEnabled("create_basket_queue")){if(this._isRememberCreateBasketQueueEnabled()){const e=this._getRememberedCreateBasketCheckStatusUrl();if(e)return this._getQueueStatus(e)}return this._queueCreateBasket()}else return this._createBasket()}catch(e){return console.error(e),!1}}async _createBasket(){const{response:e}=this.#e.createBasket(),{data:t}=await e;return this.#i?.set("basketId",t.basket.id),!0}async _queueCreateBasket(){const{response:e}=this.#e.queueCreateBasket(),{data:t}=await e;if(t._links.checkStatus)if(this._isRememberCreateBasketQueueEnabled()){const i=this._setCreateBasketCheckStatusUrl(t._links.checkStatus.href);if(i)return this._getQueueStatus(i);console.error("Create basket queue returned invalid check status URL.")}else return this._getQueueStatus(t._links.checkStatus.href);return!1}async _getQueueStatus(e){try{for(;;){const{response:t}=this.#e.getCreateBasketQueueStatus(e),{data:i}=await t;switch(i.status){case"done":return this.#o.setIsCreateBasketInProgress(!1),this._removeCreateBasketCheckStatusUrl(),i.basket_id?(this.#i?.set("basketId",i.basket_id),!0):(console.error("Basket creation queue finished with 'done' status but without 'basket_id'."),!1);case"pending":this.#o.setIsCreateBasketInProgress(!0),await new Promise(s=>setTimeout(s,1e3));continue;case"error":return this.#o.setIsCreateBasketInProgress(!1),this._removeCreateBasketCheckStatusUrl(),!1;default:return this.#o.setIsCreateBasketInProgress(!1),this._removeCreateBasketCheckStatusUrl(),console.error(`Unknown basket creation queue status: "${i.status}"`),!1}}}catch(t){return this._removeCreateBasketCheckStatusUrl(),this.#o.setIsCreateBasketInProgress(!1),this._handleUnexpectedError(t),!1}}_normalizeCreateBasketCheckStatusUrl(e){try{const t=new URL(e,window.location.origin),i=t.origin===window.location.origin,s=Ys.test(t.pathname),a=t.hash!=="";return!i||!s||a?null:`${t.pathname}${t.search}`}catch{return null}}_isCreateBasketCheckStatusUrlExpired(e){if(!e)return!0;const t=parseInt(e,10);return Number.isNaN(t)?!0:Date.now()-t>Qs}_getRememberedCreateBasketCheckStatusUrl(){const e=this.#l?.get(kt),t=this.#l?.get($t);if(!e||this._isCreateBasketCheckStatusUrlExpired(t))return this._removeCreateBasketCheckStatusUrl(),null;const i=this._normalizeCreateBasketCheckStatusUrl(e);return i||(this._removeCreateBasketCheckStatusUrl(),null)}_setCreateBasketCheckStatusUrl(e){const t=this._normalizeCreateBasketCheckStatusUrl(e);return t?(this._isRememberCreateBasketQueueEnabled()&&(this.#l?.set(kt,t),this.#l?.set($t,String(Date.now()))),t):(this._removeCreateBasketCheckStatusUrl(),null)}_removeCreateBasketCheckStatusUrl(){this._isRememberCreateBasketQueueEnabled()&&(this.#l?.remove(kt),this.#l?.remove($t))}selectIsCreateInProgress$(){return this.#o.selectIsCreateInProgress$()}async getBasket(e){try{const{response:t}=this.#e.getBasket(e),{data:i}=await t;return this.#t.toModel(i.basket)}catch(t){return console.error(t),null}}async getCurrentBasket(e,t=!1){if(this.#i?.has("basket")&&!t){const i=this.#i.getObject("basket"),s=this.#a.getSkinSettings().currency,a=!!i?.sum?.currency&&i?.sum?.currency!==s;if(i&&!a)return this.emitUpdateBasketEvent({basket:i,flashMessages:[]}),this.#t.toModel(i)}try{const{response:i}=this.#e.getBasket(e),{data:s}=await i;return this.emitUpdateBasketEvent(s),this.#t.toModel(s.basket)}catch(i){return console.error(i),this._clearBasket(),null}}async refreshBasket(){const e=this.#i?.get("basketId");if(e)return this.getCurrentBasket(e,!0);{await this.createBasket();const t=this.#i?.get("basketId");return this.getCurrentBasket(t)}}_clearBasket(){this.#i?.remove("basketId"),this.#i?.remove("basket"),this.#i?.remove("basketUpdateTimestamp"),this.#i?.remove("shippingChosenByUser"),this.#i?.remove("paymentChosenByUser"),this._removeCreateBasketCheckStatusUrl(),this.eventBus.emit(new m(S.basketUpdated,this.#t.toModel(Vi)))}emitUpdateBasketEvent(e){const t=e.flashMessages?.filter(s=>!s.showInBasketOnly)||[],i=e.flashMessages?.filter(s=>s.showInBasketOnly)||[];this.#s.addFlashMessages(t.map(s=>({type:s.isError?z.error:z.success,content:s.message}))),this.#a.getPageSettings().controller==="basket"&&this.#s.addFlashMessages(i.map(s=>({type:s.isError?z.error:z.success,content:s.message}))),this.#i?.set("basketUpdateTimestamp",String(Date.now())),this.#i?.setObject("basket",e.basket),this.eventBus.emit(new m(S.basketUpdated,this.#t.toModel(e.basket)))}_handleUnexpectedError(e){console.error(e),this.#s.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class Di extends de{constructor({basketUpdaterService:e}){super(),this.moduleName=Mt.api,this.#e=e}#e;emitUpdateBasketEvent(e){this.#e.emitUpdateBasketEvent(e)}
1async getBasket(e){return this.#e.getBasket(e)}async getCurrentBasket(e,t=!1){return this.#e.getCurrentBasket(e,t)}async addItem(e){return this.#e.addItem(e)}async uploadVariantFile(e,t){return this.#e.uploadVariantFile(e,t)}async refreshBasket(){return this.#e.refreshBasket()}selectIsBasketCreateInProgress$(){return this.#e.selectIsCreateInProgress$()}}const Ui=({storeName:n="BasketPromotionsListStore"}={})=>U({name:n},ye());class Gi extends O{#e;#t;#s;#a;#n;#r;#o;constructor({basketPromotionsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o,basketOverallApi:c}){super(),this.#e=e,this.#s=t,this.#a=i,this.#t=s,this.#o=c,this.#n=a,this.#r=o,this._setupEventListeners()}_setupEventListeners(){new q(this.#i,this.#t)}#i=({body:e})=>{const t=e?.discounts.list||[];this._setPromotions(t)};_setPromotions(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}async addCoupon(e){const t=this.#o.getActions().usePromoCode;if(!t)throw new Error("Using promo codes is not allowed");try{const{response:i}=this.#s.addCoupon(t,e),{data:s}=await i;return this.#a.emitUpdateBasketEvent(s),!s.flashMessages.some(a=>a.isError)}catch(i){return this._handleUnexpectedError(i),!1}}async removeCoupon(){const e=this.#o.getActions().removePromoCode;try{const{response:t}=this.#s.removeCoupon(e),{data:i}=await t;this.#a.emitUpdateBasketEvent(i)}catch(t){this._handleUnexpectedError(t)}}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class qi{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}class zi extends de{constructor({basketPromotionListService:e,basketPromotionSummaryService:t}){super(),this.moduleName=ge.api,this.#e=e,this.#t=t}#e;#t;add(e){return this.#e.addCoupon(e)}remove(){return this.#e.removeCoupon()}get(){return this.#e.get()}select$(){return this.#e.select$()}getDiscountsSum(){return this.#t.getDiscountsSum()}selectDiscountsSum$(){return this.#t.selectDiscountsSum$()}getHasPromotionCode(){return this.#t.getHasPromotionCode()}selectHasPromotionCode$(){return this.#t.selectHasPromotionCode$()}getPromotionCode(){return this.#t.getPromotionCode()}selectPromotionCode$(){return this.#t.selectPromotionCode$()}}class Hi extends O{#e;#t;constructor({basketPromotionsSummaryRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.discounts.sum,i=e?.promotionCode,s=e?.hasPromotionCode;t!==void 0&&this._setDiscountsSum(t),i!==void 0&&this._setPromotionCode(i),s!==void 0&&this._setHasPromotionCode(s)};_setDiscountsSum(e){this.#e.setDiscountsSum(e)}getDiscountsSum(){return this.#e.getDiscountsSum()}selectDiscountsSum$(){return this.#e.selectDiscountsSum$().pipe(k((e,t)=>B(e,t)))}_setHasPromotionCode(e){this.#e.setHasPromotionCode(e)}getHasPromotionCode(){return this.#e.getHasPromotionCode()}selectHasPromotionCode$(){return this.#e.selectHasPromotionCode$()}_setPromotionCode(e){this.#e.setPromotionCode(e)}getPromotionCode(){return this.#e.getPromotionCode()}selectPromotionCode$(){return this.#e.selectPromotionCode$().pipe(k((e,t)=>B(e,t)))}}class Ki{#e;#t;#s;constructor(e){this.#e=e,this.#t=new Lt,this.#s=new pi}setDiscountsSum(e){this.#e.update(y("discountsSum",this.#t.toDTO(e)))}getDiscountsSum(){return this.#t.toModel(this.#e.getValue().discountsSum)}selectDiscountsSum$(){return this.#e.pipe(C(e=>this.#t.toModel(e.discountsSum)))}setHasPromotionCode(e){this.#e.update(y("hasPromotionCode",e))}getHasPromotionCode(){return this.#e.getValue().hasPromotionCode}selectHasPromotionCode$(){return this.#e.pipe(C(e=>e.hasPromotionCode))}setPromotionCode(e){this.#e.update(y("promotionCode",e?this.#s.toDTO(e):null))}getPromotionCode(){const e=this.#e.getValue().promotionCode;return e?this.#s.toModel(e):null}selectPromotionCode$(){return this.#e.pipe(C(({promotionCode:e})=>e?this.#s.toModel(e):null))}}const Wi={discountsSum:{currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""},hasPromotionCode:!1,promotionCode:null},ji=({storeName:n="BasketPromotionsSummaryStore"}={})=>U({name:n},K(Wi));class Qi extends de{constructor({basketShippingsListService:e,basketShippingsCountriesService:t}){super(),this.moduleName=Ce.api,this.#e=e,this.#t=t}#e;#t;get(){return this.#e.get()}select$(){return this.#e.select$()}setShipping(e){this.#e.setShipping(e)}setPickupPoint(e,t){this.#e.setPickupPoint(e,t)}getAvailableShippingCountries(){return this.#t.get()}selectAvailableShippingCountries$(){return this.#t.select$()}getSelectedShippingCountries(){return this.#e.getSelectedShippingCountries()}getSelectedShippingCountry(){return this.#e.getSelectedShippingCountry()}selectSelectedShippingCountries$(){return this.#e.selectSelectedShippingCountries$()}selectSelectedShippingCountry$(){return this.#e.selectSelectedShippingCountry$()}setCountry(e){return this.#e.setCountry(e)}getSelectedShipping(){return this.#e.getSelectedShipping()}selectSelectedShipping$(){return this.#e.selectSelectedShipping$()}getPaymentCostForActiveShippingByPaymentId(e){return this.#e.getPaymentCostForActiveShippingByPaymentId(e)}selectPaymentCostForActiveShippingByPaymentId$(e){return this.#e.selectPaymentCostForActiveShippingByPaymentId$(e)}isEveryAvailablePaymentFree(){return this.#e.isEveryAvailablePaymentFree()}selectIsEveryAvailablePaymentFree$(){return this.#e.selectIsEveryAvailablePaymentFree$()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}addMap(e,t){this.#e.addMap(e,t)}async showPickupPointMap(e){this.#e.showPickupPointMap(e)}shouldDisplayRemainingBasketValueForFreeShippingMessage(e){return this.#e.shouldDisplayRemainingBasketValueForFreeShippingMessage(e)}addShippingInfo(e,t){this.#e.addShippingInfo(e,t)}getShippingInfo(e){return this.#e.getShippingInfo(e)}}var bs;bs=cs;const Yi=class fs{constructor({code:e,isCollectOnDeliveryAvailable:t,supplier:i,name:s,description:a,street:o,house
1Number:c,city:h,postalCode:_,province:b,countryCode:w,latitude:F,longitude:x,openingHours:N}){this[bs]=!0,this.code=e,this.isCollectOnDeliveryAvailable=t,this.supplier=i,this.name=s,this.description=a,this.street=o,this.houseNumber=c,this.city=h,this.postalCode=_,this.province=b,this.countryCode=w,this.latitude=F,this.longitude=x,this.openingHours=N}static create(e){return new fs(e)}};let he=Yi;const Et={inpost:"INPOST",inpostInternational:"INPOST_INTERNATIONAL"};class re{toModel(e){return he.create(e)}pocztaPolskaToModel(e){return he.create({code:e.pni,isCollectOnDeliveryAvailable:e.payOnPickup,supplier:e.type,name:e.name,description:e.description,street:e.street,houseNumber:null,city:e.city,postalCode:e.zipCode,province:e.province,countryCode:null,latitude:e.latitude,longitude:e.longitude,openingHours:null})}inpostToModel(e){return he.create({code:e.name,isCollectOnDeliveryAvailable:null,supplier:Et.inpost,name:e.name,description:e.location_description,street:`${e.address_details.street}`,houseNumber:e.address_details.building_number,city:e.address_details.city,postalCode:e.address_details.post_code,province:e.address_details.province,countryCode:null,latitude:String(e.location.latitude),longitude:String(e.location.longitude),openingHours:e.opening_hours})}inpostInternationalToModel(e){const t=e.operatingHours.customer?Object.entries(e.operatingHours.customer).filter(([,i])=>i&&i.length>0).map(([i,s])=>{const a=s.map(({start:o,end:c})=>`${o} - ${c}`).join(", ");return`${i}: ${a}`}).join(", "):null;return he.create({code:e.id,isCollectOnDeliveryAvailable:null,supplier:Et.inpostInternational,name:e.id,description:e.description.content||e.description2.content||e.description3.content||"",street:e.address.street||"",houseNumber:e.address.buildingNumber,city:e.address.city,postalCode:e.address.postalCode,province:e.address.administrativeArea,countryCode:e.country,latitude:`${e.coordinates.latitude}`,longitude:`${e.coordinates.longitude}`,openingHours:t})}inpostInternationalMapToModel(e){return he.create({code:e.name,isCollectOnDeliveryAvailable:null,supplier:Et.inpostInternational,name:e.name,description:e.location_description||e.location_description_1||e.location_description_2||"",street:e.address_details.street||"",houseNumber:e.address_details.building_number,city:e.address_details.city,postalCode:e.address_details.post_code,province:e.address_details.province,countryCode:e.country,latitude:`${e.location.latitude}`,longitude:`${e.location.longitude}`,openingHours:e.opening_hours})}shoperDeliveryToModel(e){const t=e.house_number?String(e.house_number):"";return he.create({code:e.foreign_access_point_id,isCollectOnDeliveryAvailable:e.services_cod,supplier:e.supplier,name:e.name,description:e.name,street:e.street.replace(t,""),houseNumber:t,city:e.city,postalCode:e.postal_code,province:null,countryCode:e.country_code,latitude:e.latitude,longitude:e.longitude,openingHours:null})}alsendoToModel(e){return he.create({code:e.code,isCollectOnDeliveryAvailable:e.cod,supplier:e.operator,name:e.brandPretty,description:e.description,street:e.street,houseNumber:null,city:e.city,postalCode:e.postalCode,province:e.province||null,countryCode:null,latitude:String(e.latitude),longitude:String(e.longitude),openingHours:null})}}class st{static{this._isMapReady=!1}async showMap(e){await this._initMap(),PPWidgetApp.toggleMap({callback:t=>{const i=new re;e(i.pocztaPolskaToModel(t))},options:{basemapProvider:"OpenStreetMap",geocoderProvider:"Nominatim"},address:"Warszawa",type:["POCZTA","ORLEN","AUTOMAT_POCZTOWY","RUCH","ZABKA","FRESHMARKET","AUTOMAT_BIEDRONKA","AUTOMAT_CARREFOUR","AUTOMAT_SPOLEM","AUTOMAT_LEWIATAN","AUTOMAT_PLACOWKA","LEWIATAN","ABC","DELIKATESY_CENTRUM"]})}async _initMap(){st._isMapReady||(await this._createMapScript(),st._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e(),window.addEventListener("message",PPWidgetApp.messageDispatcher,!1)},t.async=!0,t.src="https://mapa.ecommerce.poczta-polska.pl/widget/scripts/ppwidget.js",document.head.appendChild(t)})}}class Ji{execute(){return st}}class it{constructor(e){this._isPww=!1,e&&(this._isPww=e.isPww)}static{this._isMapReady=!1}async showMap(e,t){await this._initMap();const i=window.innerWidth<1e3?600:1100;window.easyPack.modalMap((a,o)=>
1{if(this._isPww&&a.location_247||!this._isPww){o.closeModal();const h=new re;e(h.inpostToModel(a))}else typeof t=="function"&&t("W wybranym punkcie nie ma możliwości odbioru paczki w weekend. Aby odebrać paczkę w sobotę lub niedzielę, wybierz Paczkomat dostępny: 24/7.")},{width:i,height:700});const s=document.getElementById("widget-modal");s&&(this._manageFocus(s),this._styleModal(s),document.addEventListener("keydown",this._closeModalOnEsc))}_manageFocus(e){const t=document.querySelector(".widget-modal__close");setTimeout(()=>{_e.setFocusToFirstFocusableElementInContainer(e)},50);const i=s=>{_e.keepFocusWithinContainer(e,s)};document.addEventListener("keydown",i),t?.addEventListener("click",()=>{document.removeEventListener("keydown",i)})}_styleModal(e){e.style.backgroundColor="#fff",e.parentElement.style.zIndex="99"}_closeModalOnEsc(e){e.code==="Escape"&&(document.querySelector(".widget-modal__close")?.click(),document.removeEventListener("keydown",this._closeModalOnEsc))}async _initMap(){it._isMapReady||(window.easyPackAsyncInit=()=>{window.easyPack.init({apiEndpoint:"https://api-pl-points.easypack24.net/v1",showNonOperatingLockers:!1,showOverLoadedLockers:!1,defaultLocale:"pl",locales:["uk","pl"],langSelection:!0,mapType:"osm",searchType:"osm",points:{types:this._isPww?["parcel_locker_only"]:["parcel_locker","parcel_locker_superpop"]},map:{initialTypes:this._isPww?["parcel_locker_only"]:["parcel_locker","parcel_locker_superpop"]}})},await this._createMapScript(),await this._createMapStylesheet(),it._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://geowidget.easypack24.net/js/sdk-for-javascript.js",document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href="https://geowidget.easypack24.net/css/easypack.css",document.head.appendChild(t)})}}class Xi{execute(){return it}}const Yt="inpost-geowidget-map",Jt="inpost-geowidget-modal";class at{constructor(e){this._isPww=!1,this._token="",e&&(this._isPww=e.isPww,this._token=e.token)}static{this._isMapReady=!1}async showMap(e,t){await this._initMap();const i=this._createModal();i.addEventListener("opened",()=>{ie.nextTick(()=>{this._appendGeowidgetToModal(),document.getElementById(Yt)?.addEventListener("inpost.geowidget.init",s=>{this._removeLoader(),s.detail.api.addPointSelectedCallback(async o=>{this._isPww&&o.location_247||!this._isPww?this._selectPoint(o,e):this._notifyPointNotSelectable(t)})})})}),document.body.appendChild(i)}_selectPoint(e,t){const i=new re;t(i.inpostToModel(e)),this._closeModal()}_notifyPointNotSelectable(e){typeof e=="function"&&e("W wybranym punkcie nie ma możliwości odbioru paczki w weekend. Aby odebrać paczkę w sobotę lub niedzielę, wybierz Paczkomat dostępny: 24/7.")}async _initMap(){at._isMapReady||(await this._createMapScript(),await this._createMapStylesheet(),at._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://geowidget.inpost.pl/inpost-geowidget.js",document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href="https://geowidget.inpost.pl/inpost-geowidget.css",document.head.appendChild(t)})}_createModal(){const e=document.createElement("aside");return e.innerHTML=`
2            <h-modal class="modal-wrapper_inpost-map" id="${Jt}" opened>
3                <h-modal-header>
4                    <h2 class="font_semibold h2">Wybierz punkt</h2>
5                    <h-modal-close class="btn btn_icon">
6                      <h-icon
7                        icon-name="icon-x"
8                        role="button"
9                        size="xl"
10                        clickable
11                    ></h-icon>
12                    </h-modal-close>
13                </h-modal-header>
14    
15                <h-modal-body>
16                  <div class="loader">
17                    <div class="loader__spinner loader__spinner_m"></div>
18                  </div>
19                </h-modal-body>
20            </h-modal>
21        `,e}_createGeoWidgetWebComponent(){const e=document.createElement("inpost-geowidget");return e.setAttribute("id",Yt),e.setAttribute("token",this._token),e.setAttribute("language","pl"),e.setAttribute("config","parcelcollect"),e}_appendGeowidgetToModal(){const e=document.querySelector('h-portal-target[name="modals"] h-modal-body'),t=this._createGeoWidgetWebComponent();e?.appendChild(t)}_removeLoader(){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body')?.querySelector(".loader");t&&t.remove()}_closeModal(){const e=document.querySelector(`#${Jt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class Zi{execute(){return at}}
21const ea="parcelCollect",ta="inpost-geowidget",Xt="inpost-geowidget-map",Zt="inpost-geowidget-modal",Ss="en",sa=["pl",Ss,"uk","es","fr","pt","it","nl","de"],ia="PL",aa="https://geowidget.inpost-group.com/inpost-geowidget.js",na="https://geowidget.inpost-group.com/inpost-geowidget.css",ra="https://sandbox-global-geowidget-sdk.easypack24.net/inpost-geowidget.js",oa="https://sandbox-global-geowidget-sdk.easypack24.net/inpost-geowidget.css";class nt{constructor(e){this._token="",this._isSandbox=!1,e&&(this._token=e.token,this._isSandbox=e.isSandbox??!1),this._translationApi=e.translationsApi,this._basketShippingListService=e.basketShippingListService,this._flashMessengerApi=e.flashMessengerApi}static{this._isMapReady=!1}async showMap(e){await this._initMap();const t=this._createModal();t.addEventListener(ki.opened,()=>{ie.nextTick(()=>{this._appendGeowidgetToModal(),document.getElementById(Xt)?.addEventListener("inpost.geowidget.init",i=>{this._removeLoader();const s=i.detail.api,a=this._basketShippingListService.getSelectedShipping()?.pickupPoint?.code;a&&s.showPoint(a),s.addPointSelectedCallback(async o=>{this._selectPoint(o,e)})})})}),document.body.appendChild(t)}_selectPoint(e,t){const i=new re;t(i.inpostInternationalMapToModel(e)),this._closeModal()}async _initMap(){nt._isMapReady||(await this._createMapScript(),await this._createMapStylesheet(),nt._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.onerror=()=>{this._flashMessengerApi.addFlashMessage({type:"error",content:this._translationApi.translate("An error occurred while loading the map. Please try again later.")})},t.async=!0,t.src=this._isSandbox?ra:aa,document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href=this._isSandbox?oa:na,document.head.appendChild(t)})}_createModal(){const e=document.createElement("aside");return e.innerHTML=`
22            <h-modal
23                class="modal-wrapper_inpost-map"
24                id="${Zt}"
25                opened
26            >
27                <h-modal-header>
28                    <h2 class="font_semibold h2">
29                        ${this._translationApi.translate("Choose delivery point")}
30                    </h2>
31                    <h-modal-close class="btn btn_icon">
32                        <h-icon
33                            icon-name="icon-x"
34                            role="button"
35                            size="xl"
36                            clickable
37                        ></h-icon>
38                    </h-modal-close>
39                </h-modal-header>
40
41                <h-modal-body>
42                    <div class="loader">
43                        <div class="loader__spinner loader__spinner_m"></div>
44                    </div>
45                </h-modal-body>
46            </h-modal>
47        `,e}_createGeoWidgetWebComponent(){const e=document.createElement(ta);e.setAttribute("id",Xt),e.setAttribute("token",this._token),e.setAttribute("config",ea);const t=this._translationApi.selectedLanguage().split("_")[0],i=sa.includes(t)?t:Ss;e.setAttribute("language",i);const s=this._basketShippingListService.getSelectedShippingCountry()?.country.isocode??ia;return e.setAttribute("country",s),e}_appendGeowidgetToModal(){const e=document.querySelector('h-portal-target[name="modals"] h-modal-body'),t=this._createGeoWidgetWebComponent();e?.appendChild(t)}_removeLoader(){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body')?.querySelector(".loader");t&&t.remove()}_closeModal(){const e=document.querySelector(`#${Zt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class la{execute(){return nt}}const es="alsendo-modal";class rt{static{this._isMapReady=!1}constructor({basketShippingListService:e,pickupPointTypes:t,appId:i}){this._appId=i,this._pickupPointTypes=t,this._basketShippingListService=e}_getWidgetLanguage(){const e=["pl","en","ro","cz","sk"],t=(document.documentElement.lang||navigator.language).substring(0,2).toLowerCase();return e.includes(t)?t:"pl"}async showMap(e){await this._initMap();const t=this._createModal();t.addEventListener("opened",()=>{ie.nextTick(()=>{this._createAlsendoWidget(e),this._removeLoader()})}),t.addEventListener("close",()=>t.remove()),document.body.appendChild(t)}async _initMap(){rt._isMapReady||(await this._createMapScript(),await this._createMapStylesheet(),rt._isMapReady=!0)}async _createMapScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://map.alsendo.com/v8.7/main.js",document.head.appendChild(t)})}async _createMapStylesheet(){return new Promise(e=>{const t=document.createElement("link");t.onload=function(){e()},t.rel="stylesheet",t.type="text/css",t.href="https://map.alsendo.com/v8.7/main.css",document.head.appendChild(t)})}_createModal(){const e=document.createElement("aside");return e.innerHTML=`
48            <h-modal class="modal-wrapper_inpost-map" id="${es}" opened>
49                <h-modal-header>
50                    <h2 class="font_semibold h2">Wybierz punkt</h2>
51                    <h-modal-close class="btn btn_icon">
52                      <h-icon
53                        icon-name="icon-x"
54                        role="button"
55                        size="xl"
56                        clickable
57                    ></h-icon>
58                    </h-modal-close>
59                </h-modal-header>
60    
61                <h-modal-body>
62                  <div class="loader">
63                    <div class="loader__spinner loader__spinner_m"></div>
64                  </div>
65                </h-modal-body>
66            </h-modal>
67        `,e}_createAlsendoWidget(e){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body');let i={};const s=this._basketShippingListService.getSelectedShipping();if(s&&s.isPickupPointDelivery){const a=s.pickupPoint?.supplier.code;i={code:s.pickupPoint?.code,operator:a?this._remapOperatorNameForAlsendo(a):void 0}}BPWidget.init(t,{language:this._getWidgetLanguage(),callback:a=>{this._selectPoint(a,e),this._closeModal()},posType:"DELIVERY",codOnly:!1,countryCodes:this._basketShippingListService.getSelectedShippingCountry()?.country.isocode||"PL",operatorMarkers:!0,operators:this._remapOperatorNamesForAlsendo(this._pickupPointTypes).map(a=>({operator:a})),selectedPos:i,codeSearch:!0,changeFiltersPosition:!0})}_remapOperatorNameForAlsendo(e){return e==="DHL_PARCEL"?"DHL":e==="PWR"?"RUCH":e}_remapOperatorNameFromAlsendo(e){return e==="DHL"?"DHL_PARCEL":e==="RUCH"?"PWR":e}_remapOperatorNamesForAlsendo(e){return e.map(t=>this._remapOperatorNameForAlsendo(t))}_selectPoint(e,t){const i=new re;t(i.alsendoToModel({...e,operator:this._remapOperatorNameFromAlsendo(e.operator)}))}_removeLoader(){const t=document.querySelector('h-portal-target[name="modals"] h-modal-body')?.querySelector(".loader");t&&t.remove()}_closeModal(){const e=document.querySelector(`#${es}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class ca{execute(){return rt}}const ts={pocztaPolska:Ji,inpost:Xi,inpostV5:Zi,InPostInternational:la,ShoperShipment:ca},G={billingAddressModalOpened:"billingAddressModal.opened",shippingAddressModalOpened:"shippingAddressModal.opened",basketPreviewOpened:"basketPreview.opened",ssoShippingSetEvent:"basket.SSOShippingSetEvent",paymentChosenByUser:"basket.paymentChosenByUser",shippingChosenByUser:"basket.shippingChosenByUser",ssoAddressSetEvent:"basket.ssoAddressSetEvent"};class da extends pt{constructor(e){super(e,{eventName:G.shippingChosenByUser})}}class ha extends pt{constructor(e){super(e,{eventName:G.ssoAddressSetEvent})}}class pa extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;#d;#h;constructor({basketShippingsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o,basketOverallApi:c,templateHolder:h,settingsApi:_,storeFactoryApi:b}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this.#i=_,this.#l=b,this.#d=h,this.#c=new Tt,this._setupLocalStore(),this._setupEventListeners(),this._setupSubscriptions(),Object.defineProperty(window,"__esModule",{value:void 0})}_setupLocalStore(){this.#h=this.#l.getStore(ke),this.#h||(this.#h=this.#l.createStore("local",ke))}_setupEventListeners(){new q(this.#p,this.#a),this.eventBus.on("invalidSection.shipping",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),new da(()=>{this.#h?.set("shippingChosenByUser","1")}),new ha(({body:e})=>{e&&this._setShippingFromSSO(e)})}_setupSubscriptions(){this._setDefaultCountryIfNone()}async _setShippingFromSSO(e){const t=e.shippingChannels;if(this.#h?.get("shippingChosenByUser")==="1"){this.eventBus.emit(new m(G.ssoShippingSetEvent));return}if(t.length===0)return;const s=this._findFirstAvailableShippingFromSSO(t);if(s){s.isSelected||await this.setShipping(s);const a=t.find(o=>o.shippingId==s.id);if(a?.pickupPoint&&!s.pickupPoint){const o=new re;await this.setPickupPoint(s,o.toModel(a.pickupPoint))}}this.eventBus.emit(new m(G.ssoShippingSetEvent,e))}_findFirstAvailableShippingFromSSO(e){const t=this.get();return e.reduce((i,s)=>i||t.find(o=>s.shippingId==o.id)||void 0,void 0)}_setDefaultCountryIfNone(){this.selectSelectedShipping$().subscribe(async e=>{if(this.#i.isFeatureEnabled("dev_storefront_basket_set_default_country_fix")){if(!e)return;if(!this.getSelectedShippingCountry()){const i=this._getCountryIdBasedOnLocale(e)||this._getCountryIdFromFirstCountryInList(e);await this.setCountry(i)}}else!this.getSelectedShippingCountry()&&e&&await this.setCountry(e.countries[0].c
67ountry.id)})}_getCountryIdBasedOnLocale(e){const t=this.#i.getSkinSettings().locale.split("_")[1];return e.countries.find(i=>i.country.isocode===t)?.country.id}_getCountryIdFromFirstCountryInList(e){return e.countries[0].country.id}#p=({body:e})=>{const t=e?.shippings||[];this._setShippings(t)};_setShippings(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}getSelectedShipping(){return this.get().find(e=>e.isSelected)}selectSelectedShipping$(){return this.select$().pipe(A(e=>e.find(t=>t.isSelected))).pipe(k((e,t)=>e?.id===t?.id&&e?.price.grossValue===t?.price.grossValue))}getSelectedShippingCountries(){return this.get().flatMap(e=>e.countries)}getSelectedShippingCountry(){return this.getSelectedShippingCountries().find(e=>e.isSelected)}selectSelectedShippingCountries$(){return this.select$().pipe(A(e=>e.flatMap(t=>t.countries)))}selectSelectedShippingCountry$(){return this.selectSelectedShippingCountries$().pipe(A(e=>e.find(t=>t.isSelected)))}async setShipping(e){try{const t=e.actions.selectShipping,{response:i}=this.#t.setShipping(t),{data:s}=await i;s.basket.invalidSections.shipping||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this.eventBus.emit(new m(S.setShipping)),this.#s.emitUpdateBasketEvent(s)}catch(t){this._handleUnexpectedError(t)}}async setPickupPoint(e,t){try{const i=e.actions.changePickupPoint,{response:s}=this.#t.changePickupPoint(i,t),{data:a}=await s;a.basket.invalidSections.shipping||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this.eventBus.emit(new m(S.setPickupPoint,t)),this.#s.emitUpdateBasketEvent(a)}catch(i){this._handleUnexpectedError(i)}}async setCountry(e){try{const t=this.#o.getActions().changeShippingCountry,{response:i}=this.#t.setCountry(t,e),{data:s}=await i;this.#s.emitUpdateBasketEvent(s)}catch(t){this._handleUnexpectedError(t)}}getPaymentCostForActiveShippingByPaymentId(e){return this.getSelectedShipping()?.payments.find(i=>i.id===e)?.cost}selectPaymentCostForActiveShippingByPaymentId$(e){return this.select$().pipe(A(()=>this.getSelectedShipping()?.payments.find(i=>i.id===e)?.cost))}isEveryAvailablePaymentFree(){return this.getSelectedShipping()?.payments.every(t=>t.cost.grossValue===0)||!1}selectIsEveryAvailablePaymentFree$(){return this.select$().pipe(A(()=>this.getSelectedShipping()?.payments.every(t=>t.cost.grossValue===0)||!0))}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}addMap(e,t){let i=e.shippingKey;if(i==="inpost"&&e.integrationData.token&&(i="inpostV5"),i==="parcelLocker"){const s=e.integrationData;s.mapStrategyKey&&(i=s.mapStrategyKey)}this.#c.has(`${i}_${e.id}`)||this.#c.add(`${i}_${e.id}`,new t)}_setMap(e){this.#c.setCurrent(e)}_createMap(){return this.#c.execute(null)}async showPickupPointMap(e){let t=e.shippingKey;if(t==="inpost"&&e.integrationData.token&&(t="inpostV5"),t==="parcelLocker"){const i=e.integrationData;i.mapStrategyKey&&(t=i.mapStrategyKey)}if(ts[t]&&this.addMap(e,ts[t]),this.#c.has(`${t}_${e.id}`)){this._setMap(`${t}_${e.id}`);const i=this._createMap();new i({basketShippingListService:this,translationsApi:this.#r,flashMessengerApi:this.#n,...e.integrationData}).showMap(a=>this.setPickupPoint(e,a),a=>{this.#n.addFlashMessage({type:"error",content:this.#r.translate(a)})})}}shouldDisplayRemainingBasketValueForFreeShippingMessage(e){return e.price.grossValue>0&&e.remainingBasketValueForFreeShipping!==null&&e.remainingBasketValueForFreeShipping.float>0}addShippingInfo(e,t){this.#d.addTemplate(String(e.id),t),this.eventBus.emit(new m(S.shippingInfoAdded))}getShippingInfo(e){return this.#d.getTemplate(String(e.id))}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class ua{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}const ma=({storeName:n="BasketShippingsListStore"}={})=>U({name:n},ye(),K(Ee));class _a extends de{constructor({basketPaymentsListService:e}){super(),this.moduleName=Ie.api,this.#e=e}#e;get(){return this.#e.get()}select$(){return this.#e.select$()}getAvailable(){return this.#e.getAvailable()}selectAvailable$(){return this.#e.selectAvailable$()}setPayment(e){return this.#e.set(e)}setPaymentData(e,t){return this.#e.setPaymentData(e,t)}getSelectedPayment(){return this.#e.getSelectedPayment()}selectSelectedPayment$(){return this.#e.selectSelectedPayment$()}getActivePaymentCost(){return this.#e.getActivePaymentCost()}selectActivePaymentCost$(){return this.#e.selectActivePaymentCost$()}addPaymentChannelStrategy(e,t){this.#e.addPaymentChannelStrategy(e,t)}getPaymentChannelStrategy(e){return this.#e.getPaymentChannelStrategy(e)}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}addPaymentInfo(e,t){this.#e.addPaymentInfo(e,t)}getPaymentInfo(e){return this.#e.getPaymentInfo(e)}}const ga=({storeName:n="BasketPaymentsListStore"}={})=>U({name:n},ye(),K(Ee));class ya{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}class te{constructor({settingsApi:e,basketOverallApi:t,basketOrderApi:i,basketAddressesApi:s,basketPaymentsService:a,pageManagerApi:o,eventBus:c,flashMessengerApi:h,translationsApi:_}
67){this._placeOrder=async()=>{const b=await this.basketOrderApi.order();b?.isPlaced&&(this.pageManagerApi.visit(b._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))},this.settingsApi=e,this.basketOverallApi=t,this.basketOrderApi=i,this.basketAddressesApi=s,this.basketPaymentsService=a,this.pageManagerApi=o,this.eventBus=c,this.flashMessengerApi=h,this.translationsApi=_}initialize(e){}isPaymentAvailable(){return!0}getPaymentAdditionalInfo(){return null}async getPaymentButton(){return r`
68            <button
69                class="btn btn_primary btn_full-width"
70                @click=${this._placeOrder}
71                tabindex="0"
72                aria-label="${l("Place order and pay, you will be redirected to the payment gateway.")}"
73            >
74                <h-icon
75                    icon-name="icon-basket"
76                    css-classes="btn__icon btn__icon_left"
77                    aria-hidden="true"
78                ></h-icon>
79
80                ${l("Place order and pay")}
81            </button>
82        `}execute(){return{initialize:this.initialize.bind(this),isPaymentAvailable:this.isPaymentAvailable.bind(this),getPaymentButton:this.getPaymentButton.bind(this),getPaymentAdditionalInfo:this.getPaymentAdditionalInfo.bind(this)}}getLocale(){return this.translationsApi.selectedLanguage().split("_")[1].toLowerCase()}}class ba extends te{constructor(){super(...arguments),this.isInitialized=!1,this.isTestEnvironment=!1,this.baseRequest={apiVersion:2,apiVersionMinor:0,emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:!0}},this.allowedCardNetworks=["MASTERCARD","VISA"],this.allowedCardAuthMethods=["PAN_ONLY"],this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:this.allowedCardAuthMethods,allowedCardNetworks:this.allowedCardNetworks}},this.isReadyToPay=!1,this.isButtonAdded=!1,this._onGooglePaymentButtonClicked=async e=>{if(!this._validateSections()){e?.preventDefault(),e?.stopPropagation(),e?.stopImmediatePropagation();return}const t=await this._processPayment(),i=this.basketPaymentsService.getSelectedPayment();i&&t&&await this.basketPaymentsService.setPaymentData(i,t);const s=await this.basketOrderApi.order();s?.isPlaced&&(this.pageManagerApi.visit(s._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}}async initialize(e){this.isInitialized||(this.isTestEnvironment=e.environment==="TEST",this.settings={authJwt:e.jwt,environment:e.environment,gateway:e.gateway,gatewayMerchantId:e.gateway_merchant_id,isEnabled:e.active,merchantId:e.merchant_id,merchantName:e.merchant_name,merchantOrigin:e.merchant_origin},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:this.settings.gateway,gatewayMerchantId:this.settings.gatewayMerchantId}},this.cardPaymentMethod=Object.assign({},this.baseCardPaymentMethod,{tokenizationSpecification:this.tokenizationSpecification}),await this._getGPayScript(),this.paymentsClient=new google.payments.api.PaymentsClient({environment:this.settings.environment}),this.paymentsClient.isReadyToPay(this._getGoogleIsReadyToPayRequest()).then(t=>{this.isReadyToPay=t.result,this.isReadyToPay&&this._prefetchGooglePaymentData(),this.isButtonAdded||this._addGooglePayButton()}).catch(function(t){console.error(t)}),this.isInitialized=!0)}_addGooglePayButton(){let e=this.settingsApi.getLocales().locale.split("_")[1];const t=this.paymentsClient.createButton({onClick:this._onGooglePaymentButtonClicked,buttonLocale:e.toLowerCase()});document.getElementById("gpay")?.appendChild(t),this.isButtonAdded=!0}_doesGooglePayButtonExist(){const e=document.getElementById("gpay");return e?e.children.length>0:!1}_removeGooglePayButton(){document.getElementById("gpay")?.firstElementChild?.remove()}async _getGPayScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://pay.google.com/gp/p/js/pay.js",document.head.appendChild(t)})}_getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}_getGooglePaymentDataRequest(){const e=Object.assign({},this.baseRequest);return e.allowedPaymentMethods=[this.cardPaymentMethod],e.shippingAddressRequired=!0,e.transactionInfo=this._getGoogleTransactionInfo(),e.merchantInfo={merchantId:this.settings.merchantId,merchantName:this.settings.merchantName,merchantOrigin:this.settings.merchantOrigin},this.isTestEnvironment||(e.merchantInfo.authJwt=this.settings.authJwt),e}async getPaymentButton(){return this._doesGooglePayButtonExist()||(this.isButtonAdded=!1),setTimeout(()=>{this.isReadyToPay&&!this.isButtonAdded&&this._addGooglePayButton()},100),r`<div aria-label="${l("Pay with Google Pay, opens payment window with Google account.")}">
83            <span
84                id="gpay"
85                class="gpay"
86            ></span>
87        </div>`}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}_getGoogleTransactionInfo(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return{currencyCode:e.currency,totalPriceStatus:"FINAL",totalPrice:`${e.grossValue}`,totalPriceLabel:"Total",countryCode:this.settingsApi.getLocales().locale.split("_")[1]}}_prefetchGooglePaymentData(){const e=this._getGooglePaymentDataRequest();e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:this.settingsApi.getSkinSettings().currency},this.paymentsClient.prefetchPaymentData(e)}async _processPayment(){const e=this._getGooglePaymentDataRequest();e.transactionInfo=this._getGoogleTransactionInfo();try{return await this.paymentsClient.loadPaymentData(e)}catch(t){return console.error(t),null}}execute(){return{initialize:this.initialize.bind(this),isPaymentAvailable:this.isPaymentAvailable.bind(this),getPaymentButton:this.getPaymentButton.bind(this),getPaymentAdditionalInfo:this.getPaymentAdditionalInfo.bind(this)}}}class fa extends te{isPaymentAvailable(){return window.ApplePaySession||this.settingsApi.isFeatureEnabled("dev_payments_basket_apple_pay")}}const T={default:"default",googlePay:"onlinePayment:gpay",applePay:"onlinePayment:applePay",autopayDefault:"onlinePayment:default",autopayInstallments:"onlinePayment:installments",paypalec:"paypalec",paypal:"paypal",p24:"shoperP24",googlePayP24:"shoperP24:gpay",applePayP24:"shoperP24:applePay",goPayP24:"shoperP24:goPay",blik:"shoperP24:blik",blik0:"shoperP24:blik0",hubP24:"shoperP24:installmentsHub",installmentsP24:"shoperP24:installments",cardsP24:"shoperP24:cards",paypoP24:"shoperP24:paypo",p24Default:"shoperP24:default",stripeApplePay:"stripe:apple_pay",stripeGooglePay:"stripe:google_pay",stripeLink:"stripe:link",stripeCard:"stripe:card",zagiel:"zagiel",stripeDefault:"stripe:default",klarna:"klarna",payu:"platnosci.pl"};class ss extends te{async getPaymentButton(){const e=this.basketOverallApi.selectSum$().pipe(A(({grossValueFormatted:t})=>l("Pay {{ price }} with PayPal, proceeding to payment gateway.",{price:t})));return r` <div
88            @click=${async()=>{const t=await this.basketOrderApi.order();t?.isPlaced&&(this.pageManagerApi.visit(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}}
89            aria-label="${$(e)}"
90        >
91            <img
92                src="${`https://www.paypalobjects.com/webstatic/en_AU/i/buttons/btn_paywith_primary_l.png?${Date.now()}`}"
93                alt="PayPal"
94            />
95            <p class="p_xs color_main mt-xs-2">
96                ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Paypal"})}
97            </p>
98        </div>`}}class Y extends te{isPaymentAvailable(){const e=this.basketOverallApi.getSum().currency;return this.settingsApi.isFeatureEnabled("p24_payment_hide_none_pln_payments")?e==="PLN":!0}getPaymentAdditionalInfo(){const e=document.createElement("template");return e.id="p24",e.innerHTML=`
99            <p class="p p_xs mt-xs-1">
100                ${this.translationsApi.translate("By paying, you accept the {{ tosLinkStart }}Terms and Conditions of Service{{ tosLinkEnd }} and confirm that you have read the {{ ioLinkStart }}Information Obligation{{ ioLinkEnd }}.",{tosLinkStart:`<a
101                        href="https://www.przelewy24.pl/regulamin"
102                        target="_blank"
103                        rel="noopener noreferrer"
104                        class="link link_secondary"
105                    >`,tosLinkEnd:"</a>",ioLinkStart:`<a
106                        href="https://www.przelewy24.pl/obowiazek-informacyjny-rodo-platnicy"
107                        target="_blank"
108                        rel="noopener noreferrer"
109                        class="link link_secondary"
110                    >
110`,ioLinkEnd:"</a>",interpolation:{escapeValue:!1}})}
111            </p>
112        `,e}async getPaymentButton(){const e=await super.getPaymentButton();return r`
113            ${e}
114            <p class="p_xs color_main mt-xs-2">
115                ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Przelewy24"})}
116            </p>
117        `}}class Sa{constructor({payWithBlikId:e,blikWaitForAcceptanceId:t,blikCodeId:i,payWithBlikButtonId:s}){this._blikInputAbortController=null,this.getConfirmButton=()=>document.querySelector(`#${this._payWithBlikButtonId}`),this._preventConsentModalFromClosingOnBackdropClick=a=>{a.stopImmediatePropagation()},this._preventConsentModalFromClosingOnEscape=a=>{a.key==="Escape"&&a.stopImmediatePropagation()},this._payWithBlikId=e,this._blikWaitForAcceptanceId=t,this._blikCodeId=i,this._payWithBlikButtonId=s}setFocusOnBlikInput(){setTimeout(()=>document.querySelector(`#${this._blikCodeId}`)?.focus(),50)}allowOnlyFilledBlikCode(){ie.nextTick(()=>{const e=document.querySelector(`#${this._blikCodeId}`);if(e){this._blikInputAbortController?.abort(),this._blikInputAbortController=new AbortController;const{signal:t}=this._blikInputAbortController;e.addEventListener("input",()=>{const i=this.getBlikCode(),s=this.getConfirmButton();i.length===6&&i.indexOf("_")===-1?(s?.removeAttribute("disabled"),s?.classList.add("btn_primary"),s?.classList.remove("btn_primary-disabled")):(s?.classList.remove("btn_primary"),s?.classList.add("btn_primary-disabled"),s?.setAttribute("disabled","true"))},{signal:t}),e.addEventListener("paste",i=>{const s=i.clipboardData;if(!s)return;const a=s.getData("text");if(!a)return;i.preventDefault();const o=a.replace(/\D/g,"").slice(0,6),c=`${o.slice(0,3)} ${o.slice(3)}`.trim();e.value=c,e.dispatchEvent(new Event("input",{bubbles:!0}))},{signal:t})}})}getBlikCode(){return document.querySelector(`#${this._blikCodeId}`).value.replace(/\s/g,"")}async showWaitingForAcceptanceModal(){const e=document.querySelector(`h-modal#${this._payWithBlikId}`),t=document.querySelector(`h-modal#${this._blikWaitForAcceptanceId}`);t&&e&&!t.opened&&(this._disableModalAbilityToClose(),await e.close(),await t.open())}_disableModalAbilityToClose(){document.addEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick),document.addEventListener("keydown",this._preventConsentModalFromClosingOnEscape)}}class Aa extends Y{async getPaymentButton(){const e=`pay-with-blik-${v()}`,t=`blik-wait-for-acceptance-${v()}`,i=`blik-code-${v()}`,s=`pay-with-blik-button-${v()}`,a=new Sa({payWithBlikId:e,blikWaitForAcceptanceId:t,blikCodeId:i,payWithBlikButtonId:s});return r`<div>
118            <h-modal-opener
119                @click="${o=>{this._validateSections()||(o.preventDefault(),o.stopPropagation(),o.stopImmediatePropagation())}}"
120                name="${e}"
121            >
122                <a class="btn btn_primary btn_full-width" aria-label="${l("Pay with BLIK, opens a window to enter BLIK code.")}">
123                    ${l("Pay with BLIK")}
124                </a>
125            </h-modal-opener>
126
127            <h-modal
128                class="modal_blik"
129                @opened=${()=>{a.setFocusOnBlikInput(),a.allowOnlyFilledBlikCode()}}
130                id="${e}"
131                hidden
132            >
133                <h-modal-header>
134                    &nbsp;
135
136                    <h-modal-close
137                        aria-label="${l("Close window")}"
138                        class="btn btn_icon"
139                    >
140                        <h-icon
141                            icon-name="icon-x"
142                            role="button"
143                            size="xl"
144                            clickable
145                        ></h-icon>
146                    </h-modal-close>
147                </h-modal-header>
148
149                <h-modal-body>
150                    <div class="grid blik-modal">
151                        <div class="grid__row grid__row_xs-hcenter">
152                            <div class="grid__col">
153                                <figure class="align_center full-width mb
153-xs-3">
154                                    <img
155                                        src="https://static.przelewy24.pl/payment-form-logo/svg/154"
156                                        alt="Blik logo"
157                                        width="100"
158                                    />
159                                </figure>
160
161                                <div class="full-width font_size-l font_semibold align_center mb-xs-2">
162                                    <p class="p_no-margin">${l("Enter the 6-digit BLIK code")}</p>
163                                    <span class="font_size-xs color_secondary font_normal">
164                                        ${l("Generate the code in your banking app")}
165                                    </span>
166                                </div>
167
168                                <div class="blik-modal__input-container">
169                                    <figure>
170                                        <img
171                                            src="https://static.przelewy24.pl/payment-form-logo/svg/154"
172                                            alt="Blik logo"
173                                            width="60"
174                                        />
175                                    </figure>
176
177                                    <h-control>
178                                        <h-control-content>
179                                            <h-control-element>
180                                                <h-input
181                                                    class="blik-modal__input"
182                                                    controlId="${i}"
183                                                    controlName="${i}"
184                                                    autocomplete="off"
185                                                >
186                                                    <h-input-control
187                                                        autocomplete="off"
188                                                        mask="___ ___"
189                                                        pattern="^(\\d{3})(\\s)(\\d{3})$"
190                                                        valid-pattern="000 000"
191                                                    ></h-input-control>
192                                                </h-input>
193                                            </h-control-element>
194
195                                            <control-errors></control-errors>
196                                        </h-control-content>
197                                    </h-control>
198                                </div>
199                            </div>
200                        </div>
201                    </div>
202
203                    <div class="full-width">
204                        <button
205                            @click=${async()=>{await this._processPayment(a)}}
206                            class="btn btn_full-width btn_primary-disabled mb-xs-2"
207                            id="${s}"
208                            disabled
209                        >
210                            ${l("Confirm order and pay")}
211                        </button>
212                        <h-modal-close class="btn btn_full-width btn_secondary mb-xs-4">${l("Pay with another method")}</h-modal-close>
213
214                        <hr
215                            class="separator"
216                            aria-hidden="true"
217                        />
218                        <p class="font_size-xs color_secondary mb-xs-2">
219                            <h-icon
220                                icon-name="icon-lock"
221                                role="button"
222                                size="s"
223                            ></h-icon>
224                            ${l("Payment processed via Przelewy24.")}
225                        </p>
226                    </div>
227                </h-modal-body>
228            </h-modal>
229
230            <h-modal
231                class="modal_blik"
232                id="${t}"
233                hidden
234            >
235                <h-modal-body>
236                    <div class="grid blik-modal">
237                        <div class="grid__row grid__row_xs-hcenter">
238                            <div class="grid__col">
239                                <figure class="align_center full-width mb
239-xs-3 mt-xs-6">
240                                    <img
241                                        src="https://static.przelewy24.pl/payment-form-logo/svg/154"
242                                        alt="Blik logo"
243                                        width="100"
244                                    />
245                                </figure>
246
247                                <div class="full-width font_size-l font_semibold align_center">
248                                    <p class="p_no-margin">${l("Confirm the BLIK payment in your banking app")}</p>
249                                    <span class="font_size-xs color_secondary font_normal">
250                                        ${l("If you don't do this, the payment will not be processed.")}
251                                    </span>
252                                </div>
253
254                                <div class="grid mt-xs-4 mb-xs-4">
255                                    <div class="grid__row grid__row_xs-hcenter">
256                                        <div class="grid__col">
257                                            <div class="loader">
258                                                <div class="loader__spinner loader__spinner_l"></div>
259                                            </div>
260                                        </div>
261                                    </div>
262                                </div>
263                            </div>
264                        </div>
265                    </div>
266
267                    <div class="full-width">
268                        <hr
269                            class="separator"
270                            aria-hidden="true"
271                        />
272                        <p class="font_size-xs color_secondary mb-xs-2">
273                            <h-icon
274                                icon-name="icon-lock"
275                                role="button"
276                                size="s"
277                            ></h-icon>
278                            ${l("Payment processed via Przelewy24.")}
279                        </p>
280                    </div>
281                </h-modal-body>
282            </h-modal>
283        </div>`}async _processPayment(e){try{this._disableConfirmButton(e),await this._setBlikCodeForPayment(e);const t=await this.basketOrderApi.order();t?.isPlaced&&this._checkForTransactionStatus(e,t)}catch(t){console.error(t),this.flashMessengerApi.addFlashMessage({type:"error",content:this.translationsApi.translate("Blik payment temporary unavailable. Please try again later or change payment method."),timeout:3e3})}}_disableConfirmButton(e){e.getConfirmButton()?.setAttribute("disabled","true")}async _setBlikCodeForPayment(e){const t=e.getBlikCode(),i=this.basketPaymentsService.getSelectedPayment();i&&t&&await this.basketPaymentsService.setPaymentData(i,{blikCode:t})}async _checkForTransactionStatus(e,t){await e.showWaitingForAcceptanceModal();const i=await fetch("/console/plugin/execute/plugin/ShoperP24-Transaction/act/transactionStatus",{method:"post",body:JSON.stringify({orderId:t.orderId})});if(t.isPlaced)if(i.status===200){const s=await i.json();s.status==="success"?(this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced))):s.status==="pending"?setTimeout(()=>{this._checkForTransactionStatus(e,t)},1e3):(this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}else this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced))}_redirectToBasketDonePage(e){this.pageManagerApi.visit(e)}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}}class ot extends Y{static{this.INSTALLMENTS_HUB_MIN_AMOUNT=100}static{this.INSTALLMENTS_HUB_MAX_AMOUNT=5e4}getPaymentAdditionalInfo(){const e=super.getPaymentAdditionalInfo();return e.id="p24-hub",e.innerHTML=`
284            <p24-installments-modal mode="basket">
285                <div slot="modal-opener">
286                    <button class="btn btn_outline" id="p24-installments-button">
287                        ${this.translationsApi.translate("Check the instalments")}
288                    </button>
289                </div>
290            </p24-installments-modal>
291            ${e.innerHTML}
292        `,e}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
292SumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=ot.INSTALLMENTS_HUB_MIN_AMOUNT&&e.grossValue<=ot.INSTALLMENTS_HUB_MAX_AMOUNT}}class va extends Y{}class ka extends Y{isPaymentAvailable(){return window.ApplePaySession||this.settingsApi.isFeatureEnabled("dev_payments_basket_p24_apple_pay")}}class $a extends Y{constructor(){super(...arguments),this.isInitialized=!1,this.isTestEnvironment=!1,this.baseRequest={apiVersion:2,apiVersionMinor:0,emailRequired:!0,shippingAddressParameters:{phoneNumberRequired:!0}},this.allowedCardNetworks=["MASTERCARD","VISA"],this.allowedCardAuthMethods=["PAN_ONLY"],this.baseCardPaymentMethod={type:"CARD",parameters:{allowedAuthMethods:this.allowedCardAuthMethods,allowedCardNetworks:this.allowedCardNetworks}},this.isReadyToPay=!1,this.isButtonAdded=!1,this._onGooglePaymentButtonClicked=async e=>{if(!this._validateSections()){e?.preventDefault(),e?.stopPropagation(),e?.stopImmediatePropagation();return}const t=await this._processPayment(),i=this.basketPaymentsService.getSelectedPayment();i&&t&&await this.basketPaymentsService.setPaymentData(i,t);const s=await this.basketOrderApi.order();s?.isPlaced&&(this.pageManagerApi.visit(s._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}}async initialize(e){this.isInitialized||(this.isTestEnvironment=e.environment==="TEST",this.settings={authJwt:e.jwt,environment:e.environment,gateway:e.gateway,gatewayMerchantId:e.gateway_merchant_id,isEnabled:e.active,merchantId:e.merchant_id,merchantName:e.merchant_name,merchantOrigin:e.merchant_origin},this.tokenizationSpecification={type:"PAYMENT_GATEWAY",parameters:{gateway:this.settings.gateway,gatewayMerchantId:this.settings.gatewayMerchantId}},this.cardPaymentMethod=Object.assign({},this.baseCardPaymentMethod,{tokenizationSpecification:this.tokenizationSpecification}),await this._getGPayScript(),this.paymentsClient=new google.payments.api.PaymentsClient({environment:this.settings.environment}),this.paymentsClient.isReadyToPay(this._getGoogleIsReadyToPayRequest()).then(t=>{this.isReadyToPay=t.result,this.isReadyToPay&&this._prefetchGooglePaymentData(),this.isButtonAdded||this._addGooglePayButton()}).catch(function(t){console.error(t)}),this.isInitialized=!0)}_addGooglePayButton(){let e=this.settingsApi.getLocales().locale.split("_")[1];const t=this.paymentsClient.createButton({onClick:this._onGooglePaymentButtonClicked,buttonLocale:e.toLowerCase()});document.getElementById("gpay")?.appendChild(t),this.isButtonAdded=!0}_doesGooglePayButtonExist(){const e=document.getElementById("gpay");return e?e.children.length>0:!1}_removeGooglePayButton(){document.getElementById("gpay")?.firstElementChild?.remove()}async _getGPayScript(){return new Promise(e=>{const t=document.createElement("script");t.onload=function(){e()},t.async=!0,t.src="https://pay.google.com/gp/p/js/pay.js",document.head.appendChild(t)})}_getGoogleIsReadyToPayRequest(){return Object.assign({},this.baseRequest,{allowedPaymentMethods:[this.baseCardPaymentMethod]})}_getGooglePaymentDataRequest(){const e=Object.assign({},this.baseRequest);return e.allowedPaymentMethods=[this.cardPaymentMethod],e.shippingAddressRequired=!0,e.transactionInfo=this._getGoogleTransactionInfo(),e.merchantInfo={merchantId:this.settings.merchantId,merchantName:this.settings.merchantName,merchantOrigin:this.settings.merchantOrigin},this.isTestEnvironment||(e.merchantInfo.authJwt=this.settings.authJwt),e}async getPaymentButton(){return this._doesGooglePayButtonExist()||(this.isButtonAdded=!1),setTimeout(()=>{this.isReadyToPay&&!this.isButtonAdded&&this._addGooglePayButton()},100),r`<div aria-label="${l("Pay with Google Pay, opens payment window with Google account.")}">
293            <span
294                id="gpay"
295                class="gpay"
296            ></span>
297        </div>`}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}_getGoogleTransactionInfo(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
297SumToPay():this.basketOverallApi.getSum();return{currencyCode:e.currency,totalPriceStatus:"FINAL",totalPrice:`${e.grossValue}`,totalPriceLabel:"Total",countryCode:this.settingsApi.getLocales().locale.split("_")[1]}}_prefetchGooglePaymentData(){const e=this._getGooglePaymentDataRequest();e.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:this.settingsApi.getSkinSettings().currency},this.paymentsClient.prefetchPaymentData(e)}async _processPayment(){const e=this._getGooglePaymentDataRequest();e.transactionInfo=this._getGoogleTransactionInfo();try{return await this.paymentsClient.loadPaymentData(e)}catch(t){return console.error(t),null}}isPaymentAvailable(){return this.settingsApi.isFeatureEnabled("dev_payments_p24_gopay_googlepay_in_all_currencies")?!0:super.isPaymentAvailable()}execute(){return{initialize:this.initialize.bind(this),isPaymentAvailable:this.isPaymentAvailable.bind(this),getPaymentButton:this.getPaymentButton.bind(this),getPaymentAdditionalInfo:this.getPaymentAdditionalInfo.bind(this)}}}class Se extends te{static{this.minimumAmount={USD:.5,AED:2,ARS:.5,AUD:.5,BRL:.5,CAD:.5,CHF:.5,COP:.5,CZK:15,DKK:2.5,EUR:.5,GBP:.3,HKD:4,HUF:175,IDR:.5,ILS:.5,INR:.5,JPY:50,KRW:50,MXN:10,MYR:2,NOK:3,NZD:.5,PHP:.5,PLN:2,RON:2,RUB:.5,SEK:3,SGD:.5,THB:10,ZAR:.5}}async getPaymentButton(){const e=await super.getPaymentButton();return r`
298            ${e}
299            <p class="p_xs color_main mt-xs-2">
300                ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Stripe"})}
301            </p>
302        `}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum(),t=e.currency,i=Se.minimumAmount[t]||0;return super.isPaymentAvailable()&&e.grossValue>=i}}class Pa{map(e){return{address:{city:e.city,country:e.country??null,line1:e.street,line2:e.streetAdditional,postal_code:e.zipCode,state:e.state},email:e.email,name:`${e.firstName} ${e.lastName}`.trim(),phone:e.phone}}}class ut{constructor({connectedAccountId:e,publicKey:t,paymentMethods:i,locale:s}){this._stripeBillingDetailsMapper=new Pa,this.stripe=Stripe(t,{stripeAccount:e}),this.locale=s,this.paymentMethods=i}createStripeElements(e,t={enabled:!0},i=[]){this.elements=this.stripe.elements({locale:this.locale,mode:"payment",amount:Math.round(e.grossValue*100),currency:e.currency.toLowerCase(),automatic_payment_methods:t,payment_method_types:i})}mountCardElement(e){this.cardElement=this.elements.create("payment",{payment_method_types:["card"],paymentMethodOrder:["card"],wallets:{applePay:"never",googlePay:"never",link:"never"}}),this.cardElement.mount(`#${e}`)}getStripeElements(){return this.elements}updateStripeElements(e){!e.grossValue||!e.currency||this.elements.update({amount:Math.round(e.grossValue*100),currency:e.currency.toLowerCase()})}createExpressCheckoutElement(e,t){this.expressCheckout=this.elements.create("expressCheckout",{paymentMethods:this.paymentMethods}),this.expressCheckout.on("click",e),this.expressCheckout.on("confirm",t)}mountCheckoutExpressElement(e){const t=document.querySelector(`#${e}`);t&&this.expressCheckout.mount(t)}async createConfirmationToken(){return this.stripe.createConfirmationToken({elements:this.getStripeElements()})}async createConfirmationTokenWithDetails(e){const t=this._stripeBillingDetailsMapper.map(e);return this.stripe.createConfirmationToken({elements:this.getStripeElements(),params:{payment_method_data:{billing_details:t}}})}async submit(){return this.getStripeElements().submit()}async handleNextAction(e){return await this.stripe.handleNextAction({clientSecret:e})}}class Ca extends Se{constructor(){super(...arguments),this._isInitialized=!1}async initialize(e){this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this._isInitialized=!0}_isReady(){return new Promise(e=>{this._isInitialized&&e();const t=setInterval(()=>{this._isInitialized&&(clearInterval(t),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async getPaymentButton(){const e=`express-checkout-element-${v()}`;await this._isReady();const t=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:{applePay:"always",googlePay:"never",link:"never",klarna:"never"},locale:this.getLocale()}),i=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
302SumToPay():this.basketOverallApi.getSum();return t.createStripeElements(i),t.createExpressCheckoutElement(async s=>{if(this.settingsApi.isFeatureEnabled("dev_gift_cards")){const a=this.basketOverallApi.getSumToPay();t.updateStripeElements(a)}this._validateSections()&&s.resolve()},async()=>{const{error:s}=await t.submit();if(s){this.flashMessengerApi.addFlashMessage({type:"error",content:s.message});return}const{error:a,confirmationToken:o}=await t.createConfirmationToken();if(a){this.flashMessengerApi.addFlashMessage({type:"error",content:a.message});return}const c=this.basketPaymentsService.getSelectedPayment();c&&await this.basketPaymentsService.setPaymentData(c,{confirmationTokenId:o.id});const h=await this.basketOrderApi.order();h?.isPlaced&&(this.pageManagerApi.visit(h._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}),this.basketOverallApi.selectSum$().subscribe(s=>{t.updateStripeElements(s)}),ie.nextTick(()=>{t.mountCheckoutExpressElement(e)}),r`<div id="${e}" aria-label="${l("Pay with Apple Pay, opens Link payment window.")}"></div>`}isAppleDevice(){const t=navigator.userAgentData?.platform?.toLowerCase();if(t)return t.includes("mac");const i=navigator.userAgent.toLowerCase();return/iphone|ipad|ipod|macintosh|mac os/.test(i)}isPaymentAvailable(){return!/Firefox|FxiOS/i.test(navigator.userAgent)&&this.isAppleDevice()&&super.isPaymentAvailable()&&(window.ApplePaySession||this.settingsApi.isFeatureEnabled("dev_payments_basket_stripe_apple_pay"))}}class Ia extends Se{constructor(){super(...arguments),this._isInitialized=!1}async initialize(e){this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this._isInitialized=!0}_isReady(){return new Promise(e=>{this._isInitialized&&e();const t=setInterval(()=>{this._isInitialized&&(clearInterval(t),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async getPaymentButton(){const e=`express-checkout-element-${v()}`;await this._isReady();const t=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:{applePay:"never",googlePay:"always",link:"never",klarna:"never"},locale:this.getLocale()}),i=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return t.createStripeElements(i),t.createExpressCheckoutElement(async s=>{if(this.settingsApi.isFeatureEnabled("dev_gift_cards")){const a=this.basketOverallApi.getSumToPay();t.updateStripeElements(a)}
302this._validateSections()&&s.resolve()},async()=>{const{error:s}=await t.submit();if(s){this.flashMessengerApi.addFlashMessage({type:"error",content:s.message});return}const{error:a,confirmationToken:o}=await t.createConfirmationToken();if(a){this.flashMessengerApi.addFlashMessage({type:"error",content:a.message});return}const c=this.basketPaymentsService.getSelectedPayment();c&&await this.basketPaymentsService.setPaymentData(c,{confirmationTokenId:o.id});const h=await this.basketOrderApi.order();h?.isPlaced&&(this.pageManagerApi.visit(h._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}),this.basketOverallApi.selectSum$().subscribe(s=>{t.updateStripeElements(s)}),ie.nextTick(()=>{t.mountCheckoutExpressElement(e)}),r`<div id="${e}" aria-label="${l("Pay with Google Pay, opens payment window with Google account.")}"></div>`}}class wa extends Se{constructor(){super(...arguments),this._isInitialized=!1}async initialize(e){this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this._isInitialized=!0}_isReady(){return new Promise(e=>{this._isInitialized&&e();const t=setInterval(()=>{this._isInitialized&&(clearInterval(t),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async getPaymentButton(){const e=`express-checkout-element-${v()}`;await this._isReady();const t=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:{applePay:"never",googlePay:"never",link:"auto",klarna:"never"},locale:this.getLocale()}),i=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return t.createStripeElements(i),t.createExpressCheckoutElement(async s=>{if(this.settingsApi.isFeatureEnabled("dev_gift_cards")){const a=this.basketOverallApi.getSumToPay();t.updateStripeElements(a)}
302this._validateSections()&&s.resolve()},async()=>{const{error:s}=await t.submit();if(s){this.flashMessengerApi.addFlashMessage({type:"error",content:s.message});return}const{error:a,confirmationToken:o}=await t.createConfirmationToken();if(a){this.flashMessengerApi.addFlashMessage({type:"error",content:a.message});return}const c=this.basketPaymentsService.getSelectedPayment();c&&await this.basketPaymentsService.setPaymentData(c,{confirmationTokenId:o.id});const h=await this.basketOrderApi.order();h?.isPlaced&&(this.pageManagerApi.visit(h._links.showOrder.href),this.eventBus.emit(new m(S.orderPlaced)))}),this.basketOverallApi.selectSum$().subscribe(s=>{t.updateStripeElements(s)}),ie.nextTick(()=>{t.mountCheckoutExpressElement(e)}),r`<div id="${e}" aria-label="${l("Pay with Link, opens Link payment window.")}"></div>`}}var et=(n=>(n.Success="success",n.Failed="failed",n.Pending="pending",n))(et||{});class Ea extends Se{constructor(){super(...arguments),this._initPromise=null,this.STRIPE_CARD_ELEMENT_ID="stripe-card-payment-widget",this.STRIPE_CONTAINER_TIMEOUT=1500,this.STRIPE_TRANSACTION_STATUS_CHECK_INTERVAL=1e3,this.STRIPE_TRANSACTION_STATUS_CHECK_MAX_ATTEMPTS=10,this._paymentButton=null}async initialize(e){return this._initPromise=(async()=>{this._settings={publicKey:e.publicKey,connectedAccountId:e.connectedAccountId,embeddedCardCheckoutEnabled:e.embeddedCardCheckoutEnabled&&this.settingsApi.isFeatureEnabled("dev_payments_basket_stripe_card_storefront")},await ht.create("stripe-pay","https://js.stripe.com/v3/"),this.stripeClient=new ut({connectedAccountId:this._settings.connectedAccountId,publicKey:this._settings.publicKey,paymentMethods:void 0,locale:this.getLocale()})})(),this._initPromise}async _isReady(){return this._initPromise&&await this._initPromise,new Promise((e,t)=>{const i=setTimeout(()=>{clearInterval(s),t()},this.STRIPE_CONTAINER_TIMEOUT),s=setInterval(()=>{document.getElementById(this.STRIPE_CARD_ELEMENT_ID)&&(clearInterval(s),clearTimeout(i),e())},100)})}_validateSections(){let e=!0;for(const[t,i]of Object.entries(this.basketOverallApi.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${t}`,i)),e=!1;return e}async _fetchTransactionStatus(e){return(await fetch("/console/plugin/execute/plugin/Stripe-Transaction/act/transactionStatus",{method:"post",body:JSON.stringify({orderId:e})})).json()}async _checkForNextStep(e,t){const i=await this._fetchTransactionStatus(e),s=i?.status??null;if(s===et.Success||s===et.Failed)return Promise.resolve();if(s===et.Pending)if(i?.["3dsRequired"]){const a=await this.stripeClient.handleNextAction(i.transactionClientSecret);return a?.error?Promise.reject(a.error):Promise.resolve()}else return await new Promise(a=>setTimeout(a,1e3)),t===0?Promise.reject(new Error("Transaction is still pending after maximum number of attempts")):this._checkForNextStep(e,t-1)}async _placeCardOrder(){const e=await this._validateSections();let t=null;if(!e)return;this._disableButton();const{error:i}=await this.stripeClient.submit();if(i){this.flashMessengerApi.addFlashMessage({type:"error",content:i.message}),this._enableButton();return}const s=document.querySelector("billing-address-form");s?t=await s.getFormValues():t=this.basketAddressesApi.getBillingAddress();const a=t?await this.stripeClient.createConfirmationTokenWithDetails(t):await this.stripeClient.createConfirmationToken();if(a.error){this.flashMessengerApi.addFlashMessage({type:"error",content:a.error.message}),this._enableButton();return}const o=this.basketPaymentsService.getSelectedPayment();o&&await this.basketPaymentsService.setPaymentData(o,{confirmationTokenId:a.confirmationToken.id});const c=await this.basketOrderApi.order();c?.isPlaced&&this._checkForNextStep(c.orderId,this.STRIPE_TRANSACTION_STATUS_CHECK_MAX_ATTEMPTS).catch(h=>{console.error("Transaction status check failed or timed out, proceeding with order placement",h)}).finally(()=>{this.eventBus.emit(new m(S.orderPlaced)),this.pageManagerApi.visit(c._links.showOrder.href)})}_disableButton(){this._paymentButton?.classList.remove("btn_primary"),this._paymentButton?.classList.add("btn_primary-disabled"),this._paymentButton?.setAttribute("disabled","true")}_enableButton(){this._paymentButton?.classList.remove("btn_primary-disabled"),this._paymentButton?.classList.add("btn_primary"),this._paymentButton?.removeAttribute("disabled")}getPaymentAdditionalInfo(){if(!this._settings.embeddedCardCheckoutEnabled)return null;const e=document.createElement("template"),t='By clicking "Confirm purchase", you confirm that you have read the {{linkServiceStart}}Stripe Service Agreement{{linkEnd}} and {{linkPrivacyStart}}Privacy Policy{{linkPrivacyEnd}} and you accept their provisions.';return e.id="stripe-card-payment-widget-container",e.innerHTML=`
303            <div class="mt-xs-2 mb-xs-2" id="${this.STRIPE_CARD_ELEMENT_ID}"></div>
304            ${this.translationsApi.translate(t,{linkServiceStart:'<a href="https://stripe.com/en-pl/legal" target="_blank" rel="nofollow noopener">',linkEnd:"</a>",linkPrivacyStart:'<a href="https://stripe.com/en-pl/privacy" target="_blank" rel="nofollow noopener">',linkPrivacyEnd:"</a>",interpolation:{escapeValue:!1}})}
305        `,e}async getPaymentButton(){const e=await super.getPaymentButton();if(!this._settings.embeddedCardCheckoutEnabled)return r`${e}`;try{await this._isReady()}catch{return r`${e}`}const t=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.get
305SumToPay():this.basketOverallApi.getSum();return this.stripeClient.createStripeElements(t,{enabled:!1},["card"]),this.stripeClient.mountCardElement(this.STRIPE_CARD_ELEMENT_ID),this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.selectSumToPay$().subscribe(i=>{this.stripeClient.updateStripeElements(i)}):this.basketOverallApi.selectSum$().subscribe(i=>{this.stripeClient.updateStripeElements(i)}),r`
306            <button
307                class="btn btn_primary btn_full-width"
308                @click=${i=>{this._paymentButton=i.currentTarget,this._placeCardOrder()}}
309                tabindex="0"
310                aria-label="${l("Place order and pay, you will be redirected to the payment gateway.")}"
311            >
312                <h-icon
313                    icon-name="icon-basket"
314                    css-classes="btn__icon btn__icon_left"
315                    aria-hidden="true"
316                    ></h-icon>
317                ${l("Place order and pay")}
318            </button>
319        `}}class As extends te{async getPaymentButton(){const e=await super.getPaymentButton();return r`
320            ${e}
321            <p class="p_xs color_main mt-xs-2">
322                ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Autopay"})}
323            </p>
324        `}}class lt extends As{static{this.INSTALLMENTS_MIN_AMOUNT=100}static{this.INSTALLMENTS_MAX_AMOUNT=15e3}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=lt.INSTALLMENTS_MIN_AMOUNT&&e.grossValue<=lt.INSTALLMENTS_MAX_AMOUNT}}class Ba extends te{async getPaymentButton(){const e=await super.getPaymentButton();return r`
325            ${e}
326            <p class="p_xs color_main mt-xs-2">
327                ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"Klarna"})}
328            </p>
329        `}}class xa extends te{async getPaymentButton(){const e=await super.getPaymentButton();return r`
330            ${e}
331            <p class="p_xs color_main mt-xs-2">
332                ${this.translationsApi.translate("You will be redirected to the {{ gatewayName }} payment gateway.",{gatewayName:"PayU"})}
333            </p>
334        `}}class Fa extends Y{isPaymentAvailable(){return!0}}class ct extends Y{static{this.INSTALLMENTS_MIN_AMOUNT=300}static{this.INSTALLMENTS_MAX_AMOUNT=1e4}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=ct.INSTALLMENTS_MIN_AMOUNT&&e.grossValue<=ct.INSTALLMENTS_MAX_AMOUNT}}class dt extends Y{static{this.PAYPO_MIN_AMOUNT=10}static{this.PAYPO_MAX_AMOUNT=8e3}isPaymentAvailable(){const e=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();return super.isPaymentAvailable()&&e.grossValue>=dt.PAYPO_MIN_AMOUNT&&e.grossValue<=dt.PAYPO_MAX_AMOUNT}}class Ma extends te{constructor(e){super(e)}initialize(e){this.integrationData=e}isIntegrationDataValid(e){const{shopVariation:t,shopId:i}=e;return!(t===void 0||i===void 0||typeof t!="string"||typeof i!="string")}getPaymentAdditionalInfo(){const e=document.createElement("template");e.id="zagiel-payment-additional-info";const t=this.integrationData?.shopVariation,i=this.integrationData?.shopId,s=this.settingsApi.isFeatureEnabled("dev_gift_cards")?this.basketOverallApi.getSumToPay():this.basketOverallApi.getSum();if(!this.settingsApi.isFeatureEnabled("payments_santander_installments_calculator")||!s.grossValue||!this.isIntegrationDataValid(this.integrationData))return null;const a=`https://wniosek.eraty.pl/symulator/oblicz/numerSklepu/${i}/wariantSklepu/${t}/typProduktu/0/wartoscTowarow/${encodeURIComponent(s.grossValue)}`,o=document.createElement("a");o.href=a,o.setAttribute("data-sum-href",a),o.target="_blank",o.rel="noopener noreferrer",o.title=this.translationsApi.translate("calculate the installment"),o.className="d-block mt-xs-1";const c=document.createElement("img");return c.className="mr-xs-1",c.src="https://dcsaascdn.net/storefront/img/payments/santander_installments_calculator_button.svg",c.alt=this.translationsApi.translate("calculate the installment"),o.appendChild(c),e.content.appendChild(o),e}}class Ta extends Y{isPaymentAvailable(){return this.settingsApi.isFeatureEnabled("dev_payments_p24_gopay_googlepay_in_all_currencies")?!0:super.isPaymentAvailable()}}const Oa={[T.default]:te,[T.googlePay]:ba,[T.applePay]:fa,[T.autopayDefault]:As,[T.autopayInstallments]:lt,[T.paypalec]:ss,[T.paypal]:ss,[T.googlePayP24]:$a,[T.goPayP24]:Ta,[T.applePayP24]:ka,[T.blik]:va,[T.blik0]:Aa,[T.hubP24]:ot,[T.cardsP24]:Fa,[T.paypoP24]:dt,[T.installmentsP24]:ct,[T.p24]:Y,[T.p24Default]:Y,[T.stripeApplePay]:Ca,[T.stripeGooglePay]:Ia,[T.stripeLink]:wa,[T.stripeCard]:Ea,[T.zagiel]:Ma,[T.
334stripeDefault]:Se,[T.klarna]:Ba,[T.payu]:xa};class La extends pt{constructor(e){super(e,{eventName:G.ssoShippingSetEvent})}}class Na extends pt{constructor(e){super(e,{eventName:G.paymentChosenByUser})}}class Va extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;#d;#h;#p;#u;#m=new Tt;#_;constructor({basketPaymentsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,basketShippingsApi:a,basketOverallApi:o,flashMessengerApi:c,translationsApi:h,settingsApi:_,basketOrderApi:b,basketAddressesApi:w,pageManagerApi:F,templateHolder:x,storeFactoryApi:N}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this.#i=h,this.#l=_,this.#c=b,this.#d=w,this.#h=F,this.#_=x,this.#p=N;for(const[se,Le]of Object.entries(Oa))this.addPaymentChannelStrategy(se,new Le({settingsApi:this.#l,basketOverallApi:this.#r,basketOrderApi:this.#c,basketAddressesApi:this.#d,basketPaymentsService:this,pageManagerApi:this.#h,eventBus:this.eventBus,flashMessengerApi:this.#o,translationsApi:this.#i}));this._setupLocalStore(),this._setupEventListeners(),this._setupPaymentChannel()}_setupLocalStore(){this.#u=this.#p.getStore(ke),this.#u||(this.#u=this.#p.createStore("local",ke))}_setupEventListeners(){new q(this.#g,this.#a),this.eventBus.on("invalidSection.payment",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),new Na(()=>{this.#u?.set("paymentChosenByUser","1")}),new La(({body:e})=>{e&&this._setPaymentFromSSO(e)})}_setupPaymentChannel(){this.selectSelectedPayment$().subscribe(e=>{if(!e)return;const t=this.getPaymentChannelStrategy(e.channelKey);t.initialize(e?.integrationData);const i=t.getPaymentAdditionalInfo();i&&this.addPaymentInfo(e,i)})}async _setPaymentFromSSO(e){if(this.#u?.get("shippingChosenByUser")==="1")return;const i=this.#l.isFeatureEnabled("dev_sso_default_payment_method_fix")?this._findFirstAvailablePaymentFromSSOFixed(e.paymentChannels):this._findFirstAvailablePaymentFromSSO(e.paymentChannels);i&&!i.isSelected&&await this.set(i)}_findFirstAvailablePaymentFromSSOFixed(e){const t=this.getAvailable();return e.reduce((i,s)=>{if(i)return i;let a=t.find(c=>s.channelId===c.channelKey);if(a)return a;const[,o]=s.channelId.split(":");return o&&(a=t.find(c=>c.id===`${s.paymentId}:${o}`),a)?a:(a=t.find(c=>c.paymentId===s.paymentId),a||void 0)},void 0)}_findFirstAvailablePaymentFromSSO(e){const t=this.getAvailable();return e.reduce((i,s)=>i||t.find(o=>s.channelId===o.channelKey)||void 0,void 0)}#g=({body:e})=>{const t=e?.payments||[];this._setPayments(t)};_setPayments(e){this.#e.set(e)}addPaymentChannelStrategy(e,t){this.#m.add(e,t)}getPaymentChannelStrategy(e="default"){return this.#m.has(e)?this.#m.setCurrent(e):this.#m.setCurrent(this._getDefaultChannelStrategy(e)),this.#m.execute()}_getDefaultChannelStrategy(e){return e.includes("stripe")?"stripe:default":e.includes("onlinePayment")?"onlinePayment:default":e.includes("shoperP24")?"shoperP24:default":"default"}get(){return this.#e.get().filter(e=>this.getPaymentChannelStrategy(e.channelKey).isPaymentAvailable())}select$(){return D([this.#e.select$(),this.#r.selectSumToPay$()]).pipe(k((e,t)=>B(e,t)),A(([e])=>e.filter(t=>this.getPaymentChannelStrategy(t.channelKey).isPaymentAvailable())))}getAvailable(){return this._filterAvailablePayments(this.get())}selectAvailable$(){return D([this.select$(),this.#n.selectSelectedShipping$()]).pipe(A(([e,t])=>{const i=t?.payments.flatMap(s=>s.id)||[];return e.filter(s=>i.includes(s.paymentId))}))}_filterAvailablePayments(e){const i=this.#n.getSelectedShipping()?.payments.flatMap(s=>s.id)||[];return e.filter(s=>i.includes(s.paymentId))}async set(e){try{const t=e.actions.selectChannel,{response:i}=this.#t.setPayment(t),{data:s}=await i;s.basket.invalidSections.payment||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this.eventBus.emit(new m(S.setPayment)),this.#s.emitUpdateBasketEvent(s)}catch(t){this._handleUnexpectedError(t)}}getSelectedPayment(){return this.get().find(e=>e.isSelected)}selectSelectedPayment$(){return this.select$().pipe(A(e=>e.find(t=>t.isSelected))).pipe(k((e,t)=>
334e?.id===t?.id))}getActivePaymentCost(){const e=this.#n.getSelectedShipping(),t=this.getSelectedPayment();return e?.payments.find(i=>i.id===t?.paymentId)?.cost}selectActivePaymentCost$(){return D([this.#n.selectSelectedShipping$(),this.selectSelectedPayment$()]).pipe(A(([e,t])=>e?.payments.find(i=>i.id===t?.paymentId)?.cost))}async setPaymentData(e,t){try{const{response:i}=this.#t.setPaymentData(e.actions.savePaymentData,t),{data:s}=await i;this.#s.emitUpdateBasketEvent(s)}catch(i){this._handleUnexpectedError(i)}}addPaymentInfo(e,t){this.#_.addTemplate(e.channelKey,t),this.eventBus.emit(new m(S.paymentInfoAdded))}getPaymentInfo(e){return this.#_.getTemplate(e.channelKey)}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}_handleUnexpectedError(e){console.error(e),this.#o.addFlashMessage({type:"error",content:this.#i.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}const Ra=({storeName:n="BasketAddressesStore"}={})=>U({name:n},K({shippingAddress:null,paymentAddress:null,pickupPointData:null,...Ee}));class Da{#e;constructor(e){this.#e=e}getShippingAddress(){return this.#e.getValue().shippingAddress}selectShippingAddress$(){return this.#e.pipe(C(e=>e.shippingAddress))}getBillingAddress(){return this.#e.getValue().paymentAddress}selectBillingAddress$(){return this.#e.pipe(C(e=>e.paymentAddress))}setShippingAddress(e){this.#e.update(y("shippingAddress",t=>e===null?null:t?{...t,...e}:e))}setBillingAddress(e){this.#e.update(y("paymentAddress",t=>e===null?null:t?{...t,...e}:e))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}setPickupPointData(e){this.#e.update(y("pickupPointData",{zipCode:e}))}getPickupPointData(){return this.#e.getValue().pickupPointData}}var vs;vs=cs;const Ua=class ks{constructor({isCompany:e,companyName:t,firstName:i,lastName:s,phone:a,street:o,countryId:c,buildingNumber:h,apartmentNumber:_,email:b,state:w,city:F,taxId:x,postalCode:N}){this[vs]=!0,this.isCompany=e,this.companyName=t,this.firstName=i,this.lastName=s,this.countryId=c,this.city=F,this.postalCode=N,this.buildingNumber=h,this.apartmentNumber=_,this.phone=a,this.taxId=x,this.email=b,this.street=o,this.state=w}static create(e){return new ks(e)}};let Ga=Ua;class qa{toModel(e){return Ga.create(e)}toDTO(e){return{...e}}toBasketAddressDTO(e){return{email:e.email,isCompany:e.isCompany,companyName:e.companyName,firstName:e.firstName,lastName:e.lastName,personalIdNumber:"",taxId:e.taxId,countryId:Number(e.countryId),city:e.city,postalCode:e.postalCode,street:e.street,street2:`${e.buildingNumber} ${e.apartmentNumber}`.trim(),phone:e.phone,state:e.state,createUserAccount:!1}}}class za extends O{constructor({basketAddressesRepository:e,messageStorageApi:t,basketShippingsApi:i,basketHttpApi:s,basketUpdaterApi:a,flashMessengerApi:o,translationsApi:c,userApi:h,basketOverallApi:_,settingsApi:b}){super(),this.showBillingAddressCard$=new ve(!1),this.showShippigAddressCard$=new ve(!1),this.isCompany$=new ve(!1),this.#d=({body:w})=>{w&&(this._setBillingAddress(w.billingAddress),this._setShippingAddress(w.shippingAddress))},this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this.#i=h,this.#l=_,this.#c=b,this._setupEventListeners()}#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;_setupEventListeners(){new q(this.#d,this.#t),this.eventBus.on("invalidSection.shippingAddress",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),this.eventBus.on("invalidSection.billingAddress",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),this.eventBus.on(S.setPickupPoint,({body:e})=>{const t=this.getBillingAddress();!e||!t||!this.isDifferentShippingAddressRequired()||this.setShippingAddress({email:t.email,isCompany:t.isCompany===!0,companyName:t.companyName,firstName:t.firstName,lastName:t.lastName,personalIdNumber:t.personalId||"",taxId:t.taxId,countryId:this.#s.getSelectedShipping().countries[0].c
334ountry.id,city:e.city,postalCode:e.postalCode,street:`${e.street} ${e.houseNumber}`,street2:"",phone:t.phone,state:"",useAsShippingAddress:!0,createUserAccount:!1})}),this._subscribeToUserAddressesChange(),this.selectBillingAddress$().pipe(A(e=>e?.isCompany===!0),k()).subscribe(e=>this.isCompany$.next(e)),D([this.#i.selectUser$(),this.selectBillingAddress$()]).pipe(k((e,t)=>B(e,t))).subscribe(async([e,t])=>{this.showBillingAddressCard$.next(!1),this.isAddressFilled(t)&&e&&this.showBillingAddressCard$.next(!0)}),D([this.#i.selectUser$(),this.selectShippingAddress$()]).pipe(k((e,t)=>B(e,t))).subscribe(async([e,t])=>{this.showShippigAddressCard$.next(!1),this.isAddressFilled(t)&&e&&this.showShippigAddressCard$.next(!0)})}#d;_subscribeToUserAddressesChange(){const e=this.#l.selectActions$().pipe(A(i=>i.changeBillingAddress),k((i,s)=>B(i,s))),t=this.#l.selectActions$().pipe(A(i=>i.changeShippingAddress),k((i,s)=>B(i,s)));D([this.#i.selectUser$(),e,t]).pipe(k((i,s)=>B(i,s))).subscribe(async([i,s,a])=>{if(!(!s||!a)&&i){if(this.#c.getSkinSettings().isShoperSSOActive==="1"){const o=!this.isAddressFilled(this.getBillingAddress()),c=!this.isAddressFilled(this.getShippingAddress()),_=await(await this.getApi(Js.api)).getCheckoutData();if(o||c){const b=new qa;if(_?.billingAddress){const w=b.toModel(_?.billingAddress);if(w&&o){const F={...b.toBasketAddressDTO(w),useAsShippingAddress:!1,createUserAccount:!1};await this.setBillingAddress(F)}}if(_?.shippingAddress){const w=b.toModel(_?.shippingAddress);if(w&&c){const F={...b.toBasketAddressDTO(w),useAsShippingAddress:!1,createUserAccount:!1};await this.setShippingAddress(F)}}}this.eventBus.emit(new m(G.ssoAddressSetEvent,_))}await this._setBillingAddressFromUserBillingAddressIfEmpty(i),await this._setShippingAddressFromUserShippingAddressIfEmpty(i)}})}async _setBillingAddressFromUserBillingAddressIfEmpty(e){if(!this.isAddressFilled(this.getBillingAddress())){const i=e?.addresses.billing?.address;if(i){let s=i?.countryId;if(!s){const a=this.#c.getCountries().find(o=>o.isocode===i?.country);s=Number(a?.id)}await this.setBillingAddress({email:e.email,isCompany:i.companyName!=="",companyName:i.companyName,firstName:i.firstName,lastName:i.lastName,personalIdNumber:"",taxId:i.taxId,countryId:Number(s),city:i.city,postalCode:i.zipCode,street:i.street,street2:"",phone:i.phone,state:"",useAsShippingAddress:!1,createUserAccount:!1})}}}async _setShippingAddressFromUserShippingAddressIfEmpty(e){if(!this.isAddressFilled(this.getShippingAddress())){const i=e?.addresses.shipping?.address;if(i){let s=i?.countryId;if(!s){const a=this.#c.getCountries().find(o=>o.isocode===i?.country);s=Number(a?.id)}await this.setShippingAddress({email:e.email,isCompany:i.companyName!=="",companyName:i.companyName,firstName:i.firstName,lastName:i.lastName,personalIdNumber:"",taxId:i.taxId,countryId:Number(s),city:i.city,postalCode:i.zipCode,street:i.street,street2:"",phone:i.phone,state:"",useAsShippingAddress:!1,createUserAccount:!1})}}}_setShippingAddress(e){this.#e.setShippingAddress(e)}_setBillingAddress(e){this.#e.setBillingAddress(e)}getShippingAddress(){return this.#e.getShippingAddress()}selectShippingAddress$(){return this.#e.selectShippingAddress$().pipe(k((e,t)=>B(e,t)))}getBillingAddress(){return this.#e.getBillingAddress()}selectBillingAddress$(){return this.#e.selectBillingAddress$().pipe(k((e,t)=>B(e,t)))}async setBillingAddressAsShippingAddress(){const e=this.getBillingAddress();e&&this.setShippingAddress({email:e.email,isCompany:e.isCompany===!0,companyName:e.companyName,firstName:e.firstName,lastName:e.lastName,personalIdNumber:e.personalId||"",taxId:e.taxId,countryId:e.countryId,city:e.city,postalCode:e.zipCode,street:e.street,street2:e.streetAdditional,phone:e.phone,state:e.state,useAsShippingAddress:!0,createUserAccount:!1})}async setShippingAddress(e){const t=this.#l.getActions().changeShippingAddress;if(t)return this._setAddress(t,e)}async setBillingAddress(e){const t=this.#s.getAvailableShippingCountries().find(h=>h.id===e.countryId),i=this.isAddressFilled(this.getShippingAddress())&&!this.isBillingAddressEqualShippingAddress(),s=e.countryId!==this.getBillingAddress()?.countryId;let a=!1;this.#c.isFeatureEnabled("select_shipping_country_on_shipping_step")&&(a=e.countryId!==this.getShippingAddress()?.countryId),t&&!a&&(!i||s)&&(e.useAsShippingAddress=!0);const c=this.#l.getActions().changeBillingAddress;if(c)return this._setAddress(c,e)}async _setAddress(e,t){const{response:i}=this.#a.setAddress(e,t);try{const{data:s}=await i;return this.#n.emitUpdateBasketEvent(s),!s.basket.invalidSections.shippingAddress&&!s.basket.invalidSections.billingAddress&&!s.formErrors&&(this.#e.setSectionValidation({isValid:!0,validationMessage:""}),this._displaySetAddressSuccessFlashMessage()),s.formErrors}catch(s){this._handleUnexpectedError(s)}}isAddressFilled(e){return e?[e.city,e.countryId,e.firstName,e.lastName,e.phone,e.street,e.zipCode].every(i=>i):!1}isBillingAddressEqualShippingAddress(){return B(this.getBillingAddress(),this.get
334ShippingAddress())}selectIsBillingAddressEqualShippingAddress$(){return D([this.selectBillingAddress$(),this.selectShippingAddress$()]).pipe(A(([e,t])=>JSON.stringify(e)===JSON.stringify(t)))}isDifferentShippingAddressRequired(){const e=this.getBillingAddress();return e?!this.#s.getAvailableShippingCountries().map(t=>t.id).includes(e.countryId):!1}selectIsDifferentShippingAddressRequired$(){return D([this.selectBillingAddress$(),this.#s.selectAvailableShippingCountries$()]).pipe(A(([e,t])=>e?!t.map(i=>i.id).includes(e.countryId):!1))}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}selectIsDifferentShippingAddressAvailable$(){return D([this.#s.selectSelectedShipping$()]).pipe(A(([e])=>!(e?.isPickupPointDelivery||e?.isPersonalCollect)))}selectShowBillingAddressCard$(){return this.showBillingAddressCard$.asObservable().pipe(k())}selectShowShippingAddressCard$(){return this.showShippigAddressCard$.asObservable().pipe(k())}setIsCompany(e){this.isCompany$.next(e)}selectIsCompany$(){return this.isCompany$.asObservable().pipe(k())}_handleUnexpectedError(e){console.error(e),this.#r.addFlashMessage({type:"error",content:this.#o.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}_displaySetAddressSuccessFlashMessage(){this.#r.addFlashMessage({type:"success",content:this.#o.translate("Buyer's details have been added to the order information")})}setPickupPointData(e){this.#e.setPickupPointData(e)}getPickupPointData(){return this.#e.getPickupPointData()}}class Ha extends O{constructor({basketAddressesService:e}){super(),this.moduleName="basketAddressesApi",this.#e=e}#e;getShippingAddress(){return this.#e.getShippingAddress()}selectShippingAddress$(){return this.#e.selectShippingAddress$()}getBillingAddress(){return this.#e.getBillingAddress()}selectBillingAddress$(){return this.#e.selectBillingAddress$()}async setShippingAddress(e){return this.#e.setShippingAddress(e)}async setBillingAddress(e){return this.#e.setBillingAddress(e)}isBillingAddressEqualShippingAddress(){return this.#e.isBillingAddressEqualShippingAddress()}selectIsBillingAddressEqualShippingAddress$(){return this.#e.selectIsBillingAddressEqualShippingAddress$()}isDifferentShippingAddressRequired(){return this.#e.isDifferentShippingAddressRequired()}selectIsDifferentShippingAddressRequired$(){return this.#e.selectIsDifferentShippingAddressRequired$()}setBillingAddressAsShippingAddress(){return this.#e.setBillingAddressAsShippingAddress()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}selectIsDifferentShippingAddressAvailable$(){return this.#e.selectIsDifferentShippingAddressAvailable$()}isAddressFilled(e){return this.#e.isAddressFilled(e)}selectShowBillingAddressCard$(){return this.#e.selectShowBillingAddressCard$()}selectShowShippingAddressCard$(){return this.#e.selectShowShippingAddressCard$()}setIsCompany(e){this.#e.setIsCompany(e)}selectIsCompany$(){return this.#e.selectIsCompany$()}setPickupPointData(e){this.#e.setPickupPointData(e)}getPickupPointData(){return this.#e.getPickupPointData()}}const Ka=({storeName:n="BasketAdditionalFieldsStore"}={})=>U({name:n},K({selectFields:[],descriptionFields:[],inputFields:[],fileFields:[],hiddenFields:[],checkboxFields:[],...Ee}));class Wa{#e;constructor(e){this.#e=e}get(){return{selectFields:this.#e.getValue().selectFields,descriptionFields:this.#e.getValue().descriptionFields,inputFields:this.#e.getValue().inputFields,fileFields:this.#e.getValue().fileFields,hiddenFields:this.#e.getValue().hiddenFields,checkboxFields:this.#e.getValue().checkboxFields}}select$(){return this.#e.pipe(C(e=>({selectFields:e.selectFields,descriptionFields:e.descriptionFields,inputFields:e.inputFields,fileFields:e.fileFields,hiddenFields:e.hiddenFields,checkboxFields:e.checkboxFields})))}set(e){this.#e.update(y("selectFields",e.selectFields)),this.#e.update(y("descriptionFields",e.descriptionFields)),this.#e.update(y("inputFields",e.inputFields)),this.#e.update(y("fileFields",e.fileFields)),this.#e.update(y("hiddenFields",e.hiddenFields)),this.#e.update(y("checkboxFields",e.checkboxFields))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}}class ja extends O{#e;#t;#s;#a;#n;constructor({basketAdditionalFieldsRepository:e,messageStorageApi:t,basketOverallApi:i,basketHttpApi:s,basketUpdaterApi:a}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this._setupEventListeners()}_setupEventListeners(){new q(this.#r,this.#t),this.eventBus.on("invalidSection.additionalFields",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})})}#r=({body:e})=>{const t=e?.additionalFields;t&&this._setAdditionalFields(t)};_setAdditionalFields(e){this.#e.set(e)}#o(e){const t=this.get(),i=t.selectFields.find(c=>c.id===e);if(i)return i.options.find(h=>h.isSelected)?.value||null;const s=t.checkboxFields.find(c=>c.id===e);if(s)return s.isChecked?"1":"0";const a=t.inputFields.find(c=>c.id===e);if(a)return a.value||null;const o=t.hiddenFields.find(c=>c.id===e);return o&&o.value||null}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}async change(e,t){const i=this.#o(e);if(t===i)return;const s=this.#s.getActions().changeAdditionalFields,{response:a}=this.#a.changeAdditionalField(s,e,t);try{const{data:o}=await a;return this.#n.emitUpdateBasketEvent(o),o.basket.invalidSections.additionalFields||this.#e.setSectionValidation({isValid:!0,validationMessage:""}),o.formErrors}catch(o){console.error(o)}}async upload(e,t){try{const{response:i}=this.#a.uploadAdditionalFieldFile(e.actions.upload,t),{data:s}=await i;return s}catch(i){return console.error(i),null}}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}}class Qa extends O{constructor({basketAdditionalFieldsService:e}){super(),this.moduleName=ds.api,this.#e=e}#e;get(){return this.#e.get()}select$(){return this.#e.select$()}change(e,t){return this.#e.change(e,t)}upload(e,t){return this.#e.upload(e,t)}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}}const Ya=({storeName:n="BasketOverallStore"}={})=>{const e=new ui,t=new Lt,i=e.toModel({name:"",duration:{valueFormatted:"",timeInSeconds:0,timeInHours:0,timeInDays:0}}),s=t.toModel({currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""}),a=t.toModel({currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""}),o=t.toModel({currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""});return U({name:n},K({actions:{},id:"",comment:"",isVatEu:!1,delivery:i,sum:s,sumWithoutPaymentAndShipping:a,sumToPay:o,state:ue.empty,invalidSections:{},...Ee}))};class Ja{#e;constructor(e){this.#e=e}setActions(e){this.#e.update(y("actions",e))}getActions(){return this.#e.getValue().actions}selectActions$(){return this.#e.pipe(C(e=>e.actions))}setId(e){this.#e.update(y("id",e))}getId(){return this.#e.getValue().id}selectId$(){return this.#e.pipe(C(e=>e.id))}setComment(e){this.#e.update(y("comment",e))}getComment(){return this.#e.getValue().comment}selectComment$(){return this.#e.pipe(C(e=>e.comment))}setIsVatEu(e){this.#e.update(y("isVatEu",e))}getIsVatEu(){return this.#e.getValue().isVatEu}selectIsVatEu$(){return this.#e.pipe(C(e=>e.isVatEu))}setDelivery(e){this.#e.update(y("delivery",e))}getDelivery(){return this.#e.getValue().delivery}selectDelivery$(){return this.#e.pipe(C(e=>e.delivery))}setSum(e){this.#e.update(y("sum",e))}getSum(){return this.#e.getValue().sum}selectSum$(){return this.#e.pipe(C(e=>e.sum))}setSumWithoutPaymentAndShipping(e){this.#e.update(y("sumWithoutPaymentAndShipping",e))}getSumWithoutPaymentAndShipping(){return this.#e.getValue().sumWithoutPaymentAndShipping}selectSumWithoutPaymentAndShipping$(){return this.#e.pipe(C(e=>e.sumWithoutPaymentAndShipping))}setSumToPay(e){this.#e.update(y("sumToPay",e))}getSumToPay(){return this.#e.getValue().sumToPay}selectSumToPay$(){return this.#e.pipe(C(e=>e.sumToPay))}setInvalidSections(e){this.#e.update(y("invalidSections",e))}getInvalidSections(){return this.#e.getValue().invalidSections}selectInvalidSections$(){return this.#e.pipe(C(e=>e.invalidSections))}setSectionValidation(e){this.#e.update(y("isValid",e.isValid)),this.#e.update(y("validationMessage",e.validationMessage))}getSectionValidation(){return{isValid:this.#e.getValue().isValid,validationMessage:this.#e.getValue().validationMessage}}selectSectionValidation$(){return this.#e.pipe(C(e=>({isValid:e.isValid,validationMessage:e.validationMessage})))}setState(e){this.#e.update(y("state",e))}getState(){return this.#e.getValue().state}selectState$(){return this.#e.pipe(C(e=>e.state))}}class Xa extends O{#e;#t;#s;#a;#n;#r;constructor({basketHttpApi:e,basketUpdaterApi:t,basketOverallRepository:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o}){super(),this.#e=i,this.#s=e,this.#a=t,this.#t=s,this.#n=a,this.#r=o,this._setupEventListeners()}_setupEventListeners(){new q(this.#o,this.#t),this.eventBus.on("invalidSection.sum",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),this.eventBus.on(S.changeState,({body:e})=>{e&&this.#e.setState(e)}),this.#e.selectState$().subscribe(e=>{e===ue.longProcessing&&document.querySelectorAll(".basket-module").forEach(t=>t.classList.add("basket-module_processing")),e===ue.idle&&document.querySelectorAll(".basket-module").forEach(t=>t.classList.remove("basket-module_processing"))})}#o=({body:e})=>{e?.actions&&this._setActions(e.actions),e?.id&&this._setId(e.id),e?.comment!==void 0&&this._setComment(e.comment),e?.isVatEu!==void 0&&this._setIsVatEu(e.isVatEu),e?.delivery&&this._setDelivery(e.delivery),e?.sum&&this._setSum(e.sum),e?.sumWithoutPaymentAndShipping&&this._setSumWithoutPaymentAndShipping(e.sumWithoutPaymentAndShipping),e?.sumToPay&&this._setSumToPay(e.sumToPay),e?.invali
334dSections&&this._setInvalidSections(e.invalidSections),e?.invalidSections.sum||this.#e.setSectionValidation({isValid:!0,validationMessage:""})};_setActions(e){this.#e.setActions(e)}getActions(){return this.#e.getActions()}selectActions$(){return this.#e.selectActions$()}_setId(e){this.#e.setId(e)}getId(){return this.#e.getId()}selectId$(){return this.#e.selectId$()}_setComment(e){this.#e.setComment(e)}getComment(){return this.#e.getComment()}selectComment$(){return this.#e.selectComment$()}_setIsVatEu(e){this.#e.setIsVatEu(e)}getIsVatEu(){return this.#e.getIsVatEu()}selectIsVatEu$(){return this.#e.selectIsVatEu$()}_setDelivery(e){this.#e.setDelivery(e)}getDelivery(){return this.#e.getDelivery()}selectDelivery$(){return this.#e.selectDelivery$().pipe(k((e,t)=>B(e,t)))}_setSum(e){this.#e.setSum(e)}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}_setSumWithoutPaymentAndShipping(e){this.#e.setSumWithoutPaymentAndShipping(e)}getSumWithoutPaymentAndShipping(){return this.#e.getSumWithoutPaymentAndShipping()}selectSumWithoutPaymentAndShipping$(){return this.#e.selectSumWithoutPaymentAndShipping$().pipe(k((e,t)=>B(e,t)))}_setSumToPay(e){this.#e.setSumToPay(e)}getSumToPay(){return this.#e.getSumToPay()}selectSumToPay$(){return this.#e.selectSumToPay$().pipe(k((e,t)=>B(e,t)))}async setComment(e){const t=this.getActions().changeComment,{response:i}=this.#s.setComment(t,e);try{const{data:s}=await i;this.#a.emitUpdateBasketEvent(s)}catch(s){this._handleUnexpectedError(s)}}async cleanBasket(){const e=this.getActions().clean,{response:t}=this.#s.cleanBasket(e);try{const{data:i}=await t;this.#a.emitUpdateBasketEvent(i)}catch(i){this._handleUnexpectedError(i)}}_setInvalidSections(e){this.#e.setInvalidSections(e)}getInvalidSections(){return this.#e.getInvalidSections()}selectInvalidSections$(){return this.#e.selectInvalidSections$().pipe(k((e,t)=>B(e,t)))}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}_handleUnexpectedError(e){console.error(e),this.#n.addFlashMessage({type:"error",content:this.#r.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}class Za extends de{constructor({basketOverallService:e}){super(),this.moduleName=H.api,this.#e=e}#e;getActions(){return this.#e.getActions()}selectActions$(){return this.#e.selectActions$()}getId(){return this.#e.getId()}selectId$(){return this.#e.selectId$()}getComment(){return this.#e.getComment()}selectComment$(){return this.#e.selectComment$()}getIsVatEu(){return this.#e.getIsVatEu()}selectIsVatEu$(){return this.#e.selectIsVatEu$()}getDelivery(){return this.#e.getDelivery()}selectDelivery$(){return this.#e.selectDelivery$()}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$()}getSumWithoutPaymentAndShipping(){return this.#e.getSumWithoutPaymentAndShipping()}selectSumWithoutPaymentAndShipping$(){return this.#e.selectSumWithoutPaymentAndShipping$()}getSumToPay(){return this.#e.getSumToPay()}selectSumToPay$(){return this.#e.selectSumToPay$()}async cleanBasket(){return this.#e.cleanBasket()}async setComment(e){return this.#e.setComment(e)}getInvalidSections(){return this.#e.getInvalidSections()}selectInvalidSections$(){return this.#e.selectInvalidSections$()}getSectionValidation(){return this.#e.getSectionValidation()}selectSectionValidation$(){return this.#e.selectSectionValidation$()}}class en extends O{constructor({basketTaxesSummaryService:e,basketTaxesListService:t}){super(),this.moduleName="basketTaxesApi",this.#e=e,this.#t=t}#e;#t;get(){return this.#t.get()}select$(){return this.#t.select$()}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$()}}const tn=({storeName:n="BasketTaxesSummaryStore"}={})=>{const e=new $i().toModel({text:"",float:0});return U({name:n},K({sum:e}))};class sn extends O{#e;#t;constructor({basketTaxesSummaryRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.taxes.sum;t&&this._setSum(t)};_setSum(e){this.#e.setSum(e)}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}}class an{#e;constructor(e){this.#e=e}getSum(){return this.#e.getValue().sum}selectSum$(){return this.#e.pipe(C(e=>e.sum))}setSum(e){this.#e.update(y("sum",e))}}class nn extends O{#e;#t;constructor({basketTaxesListRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.taxes.list||[];this._setTaxes(t)};_setTaxes(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}}const rn=({storeName:n="BasketTaxesListStore"}={})=>U({name:n},ye());class on{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}class ln extends O{constructor({basketLoyaltyService:e}){super(),this.moduleName="basketLoyaltyApi",this.#e=e}#e;getLoyaltyPointsAwarded(){return this.#e.getLoyaltyPointsAwarded()}selectLoyaltyPointsAwarded$(){return this.#e.selectLoyaltyPointsAwarded$()}getHasItemsPaidInLoyaltyPoints(){return this.#e.getHasItemsPaidInLoyaltyPoints()}selectHasItemsPaidInLoyaltyPoints$(){return this.#e.selectHasItemsPaidInLoyaltyPoints$()}getLoyaltyPointsCost(){return this.#e.getLoyaltyPointsCost()}selectLoyaltyPointsCost$(){return this.#e.selectLoyaltyPointsCost$()}getLoyaltyPointsExchangePrice(){return this.#e.getLoyaltyPointsExchangePrice()}selectLoyaltyPointsExchangePrice$(){return this.#e.selectLoyaltyPointsExchangePrice$()}}const cn=({storeName:n="BasketLoyaltyStore"}={})=>U({name:n},K({loyaltyPointsAwarded:null,hasItemsPaidInLoyaltyPoints:!1,loyaltyPointsCost:null,loyaltyPointsExchangePrice:null}));class dn{#e;constructor(e){this.#e=e}setLoyaltyPointsAwarded(e){this.#e.update(y("loyaltyPointsAwarded",e))}getLoyaltyPointsAwarded(){return this.#e.getValue().loyaltyPointsAwarded}selectLoyaltyPointsAwarded$(){return this.#e.pipe(C(e=>e.loyaltyPointsAwarded))}setHasItemsPaidInLoyaltyPoints(e){this.#e.update(y("hasItemsPaidInLoyaltyPoints",e))}getHasItemsPaidInLoyaltyPoints(){return this.#e.getValue().hasItemsPaidInLoyaltyPoints}selectHasItemsPaidInLoyaltyPoints$(){return this.#e.pipe(C(e=>e.hasItemsPaidInLoyaltyPoints))}setLoyaltyPointsCost(e){this.#e.update(y("loyaltyPointsCost",e))}getLoyaltyPointsCost(){return this.#e.getValue().loyaltyPointsCost}selectLoyaltyPointsCost$(){return this.#e.pipe(C(e=>e.loyaltyPointsCost))}setLoyaltyPointsExchangePrice(e){this.#e.update(y("loyaltyPointsExchangePrice",e))}getLoyaltyPointsExchangePrice(){return this.#e.getValue().loyaltyPointsExchangePrice}selectLoyaltyPointsExchangePrice$(){return this.#e.pipe(C(e=>e.loyaltyPointsExchangePrice))}}class hn extends O{#e;#t;constructor({basketLoyaltyRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{e&&(this._setLoyaltyPointsAwarded(e.loyaltyPointsAwarded),this._setHasItemsPaidInLoyaltyPoints(e.hasItemsExchangedWithLoyaltyPoints),this._setLoyaltyPointsCost(e.loyaltyPointsCost),this._setLoyaltyPointsExchangePrice(e.loyaltyPointsExchangePrice))};_setLoyaltyPointsAwarded(e){this.#e.setLoyaltyPointsAwarded(e)}getLoyaltyPointsAwarded(){return this.#e.getLoyaltyPointsAwarded()}selectLoyaltyPointsAwarded$(){return this.#e.selectLoyaltyPointsAwarded$().pipe(k((e,t)=>B(e,t)))}_setHasItemsPaidInLoyaltyPoints(e){this.#e.setHasItemsPaidInLoyaltyPoints(e)}getHasItemsPaidInLoyaltyPoints(){return this.#e.getHasItemsPaidInLoyaltyPoints()}selectHasItemsPaidInLoyaltyPoints$(){return this.#e.selectHasItemsPaidInLoyaltyPoints$()}_setLoyaltyPointsCost(e){this.#e.setLoyaltyPointsCost(e)}getLoyaltyPointsCost(){return this.#e.getLoyaltyPointsCost()}selectLoyaltyPointsCost$(){return this.#e.selectLoyaltyPointsCost$().pipe(k((e,t)=>B(e,t)))}_setLoyaltyPointsExchangePrice(e){this.#e.setLoyaltyPointsExchangePrice(e)}getLoyaltyPointsExchangePrice(){return this.#e.getLoyaltyPointsExchangePrice()}selectLoyaltyPointsExchangePrice$(){return this.#e.selectLoyaltyPointsExchangePrice$().pipe(k((e,t)=>B(e,t)))}}var pn=Object.defineProperty,$s=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&pn(e,t,s),s};class Vt extends f{constructor(){super(),this.mode="basket",this._isValid=!0,this._confirmModal=P(),this._confirmModalId=`remove-all-products-confirm-modal-${v()}`,this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("basket-products");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"basket-products"),this._flashMessengerRef.value?.focus()},this._clearBasket=async()=>{await this._basketOverallApi.cleanBasket(),this._confirmModal.value?.close()},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketOverallApi=this.getApiSync(H.api),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this.isBasketFilled$=D([this._basketOverallApi.selectActions$(),this._basketProductsApi.selectBasketCount$()]).pipe(A(([e,t])=>t>0&&e.clean&&e.clean.method&&e.clean.href)),this._basketProductsApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)}),setTimeout(()=>this.eventBus.emit(new m(S.viewedBasket)))}static{this.moduleName="basket-products"}render(){return r`
335            <div class="basket-module__content">
336                <flash-messenger
337                    ${I(this._flashMessengerRef)}
338                    class="d-block mb-xs-1"
339                    name="basket-products"
340                    tabindex="-1"
341                ></flash-messenger>
342
343                <header class="grid__row">
344                    <div class="grid__col grid__col_xs-12 grid__col_sm-grow">
345                        <h2 class="section-title section-title_s">${l("Products in the cart")}</h2>
346                        <p><small>${l("All prices include VAT.")}</small></p>
347                    </div>
348
349                    ${g(this.mode==="basket",()=>r`${M(this.isBasketFilled$,r` <div class="grid__col grid__col_xs-12 grid__col_sm-auto mt-xs-2 mt-sm-0">
350                                    <h-modal-opener
351                                        name="${this._confirmModalId}"
352                                        class="btn btn_outline btn_xs"
353                                        aria-label="${l("Remove all products from the cart")}"
354                                    >
355                                        <h-icon
356                                            icon-name="icon-trash"
357                                            css-classes="btn__icon btn__icon_left"
358                                            aria-hidden="true"
359                                        ></h-icon>
360
361                                        ${l("Remove all products")}
362                                    </h-modal-opener>
363                                </div>`,d)}`,()=>r` ${M(this.isBasketFilled$,r` <div class="grid__col grid__col_xs-12 grid__col_sm-auto">
364                                    <button
365                                        aria-label="${l("Edit products in your cart")}"
366                                        @click=${()=>{this.mode="basket"}}
367                                        class="link link_no-underline"
368                                    >
369                                        <h-icon
370                                            icon-name="icon-check-square"
371                                            css-classes="icon_link icon_link_left"
372                                            aria-hidden="true"
373                                        ></h-icon>
374
375                                        ${l("Edit")}
376                                    </button>
377                                </div>`,d)}`)}
378                </header>
379                ${M(this.isBasketFilled$,r` <basket-products-list
380                        .mode=${this.mode}
381                        .products="${$(this._basketProductsApi.select$())}"
382                    ></basket-products-list>`,r` <p class="align_center mt-xs-2">
383                            <h-icon
384                                icon-name="icon-basket"
385                                css-classes="icon_xxl"
386                                aria-hidden="true"
387                            ></h-icon>
388                        </p>
389                        <p class="align_center mb-xs-2">${l("Your cart is empty")}</p>`)}
390            </div>
391
392            <confirm-modal
393                ${I(this._confirmModal)}
394                id="${this._confirmModalId}"
395                hidden
396                header="${l("Clearing all products from the cart")}"
397                confirmText="${l("Clear all products")}"
398                cancelText="${l("Cancel")}"
399                @confirm="${this._clearBasket}"
400            >
401                <p slot>${l("Are you sure you want to clear all items from your shopping cart?")}</p>
402            </confirm-modal>
403        `}}$s([p()],Vt.prototype,"mode");$s([u()],Vt.prototype,"_isValid");var un=Object.defineProperty,mt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&un(e,t,s),s};class De extends f{constructor(){super(),this.mode="basket",this.hasAdditionalInfo=!0,this.products=[],this._confirmModal=P(),this._currentProduct=null,this._listId=v(),this._confirmModalId=`remove-product-confirm-modal-${v()}`,this._mapEventToAction=e=>{const i=e.target.getAttribute("product-id"),s=this.products.find(o=>o.id===i),a=e.detail.value;if(!s)throw"No product found";return{product:s,quantity:a}},this._removeProduct=async()=>{this._currentProduct&&(await this._basketProductsApi.remove(this._currentProduct),this.products.length>1&&this._confirmModal.value?.close())},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._setupQuantityChange()}static{this.moduleName="basket-products-list"}_setupQuantityChange(){us(this,Pi.valueChanged).pipe(k(),oi(200),A(this._mapEventToAction)).subscribe(({product:i,quantity:s})=>{this._basketProductsApi.update(i,s)})}_hasSumLoyaltyPointsExchangePrice(e){return e!==null&&e.grossValue>0}render(){return r`
404            <div class="basket-products__list">
405                ${this.products.map(e=>r`
406                            <div
407                                data-product-id="${e.productId}"
408                                data-variant-id="${e.variantId}"
409                                class="basket-product"
410                            >
411                                <div class="basket-product__image">
412                                    <a
413                                        aria-hidden="true"
414                                        tabindex="-1"
415                                        class="basket-product__image-border"
416                                        href="${e.url}"
417                                    >
418                                        <img
419                                            src="${e.image.paths.webp}"
420                                            alt="${e.image.title}"
421                                        />
422                                    </a>
423                                </div>
424                                <div class="basket-product__wrapper">
425                                    <div class="basket-product__content">
426                                        <div class="basket-product__info">
427                                            <div class="basket-product__name">
428                                                ${e.isExchangedWithLoyaltyPoints?r`<span class="tag tag_minimal mb-xs-1">
429                                                          ${l("Loyalty program <<basket product list tag>>")}
430                                                      </span>`:d}
431                                                ${e.isBundle?r`<span class="tag tag_minimal mb-xs-1">${l("Bundle")}</span>`:d}
432                                                ${e.isDigital?r`<span class="tag tag_minimal mb-xs-1"> ${l("Digital product")} </span>`:d}
433                                                <h3>
434                                                    <a
435                                                        class="p basket-product__link"
436                                                        href="${e.url}"
437                                                        >${e.name}</a
438                                                    >
439                                                </h3>
440
441                                                ${e.hasOptions?r` <ul class="basket-product__options">
442                                                          ${e.options.map(t=>r` <li
443                                                                  data-option-name="${t.name}"
444                                                                  data-option-value="${t.value}"
445                                                              >
446                                                                  ${t.name}: <span class="font_semibold">${t.value}</span>
447                                                              </li>`)}
448                                                      </ul>`:d}
449                                            </div>
450
451                                            ${g(this.mode==="basket",()=>r` <div class="basket-product__actions">
452                                                    ${e.actions.changeQuantity?r` <h-input-stepper
453                                                              product-id="${e.id}"
454                                                              ${e.unit.isFloatingPoint?r`allowed-number-of-fraction-digits="3"`:d}
455                                                              allowed-number-of-fraction-digits="${e.unit.isFloatingPoint?"3":"0"}"
456                                                              class="input-stepper"
457                                                              min="${e.unit.isFloatingPoint?"0.01":"1"}"
458                                                              step="${e.package?e.package:"1"}"
459                                                              round-to="${e.package}"
460                                                              value="${e.quantity}"
461                                                              control-id="product-quantity-${e.id}-${this._listId}"
462                                                          >
463                                                              <h-button-stepper
464                                                                  class="input-stepper__button"
465                                                                  type="decrement"
466                                                                  aria-label="${l("Remove {{ count }} {{ unit }} {{ product }}",{count:e.package||1,unit:e.unit.name,product:e.name})}"
467                                                              >
468                                                                  <span
469                                                                      class="btn-icon btn-icon_outline btn-icon_join-right input-stepper__icon"
470                                                                  >
471                                                                      <h-icon
472                                                                          icon-name="icon-minus"
473                                                                          role="button"
474                                                                          size="xs"
475                                                                          clickable
476                                                                          aria-hidden="true"
477                                                                          css-classes="btn__icon"
478                                                                      ></h-icon>
479                                                                  </span>
480                                                              </h-button-stepper>
481
482                                                              <div class="input-stepper__display-container">
483                                                                  <h-display-stepper
484                                                                      class="input-stepper__value"
485                                                                      aria-label="${l("Quantity of {{ product }}",{product:e.name})}"
486                                                                  ></h-display-stepper>
487                                                                  <sp
487an class="input-stepper__additional-content">${e.unit.name}</span>
488                                                              </div>
489
490                                                              <h-button-stepper
491                                                                  class="input-stepper__button input-stepper_increment"
492                                                                  type="increment"
493                                                                  aria-label="${l("Add {{ count }} {{ unit }} {{ product }}",{count:e.package||1,unit:e.unit.name,product:e.name})}"
494                                                              >
495                                                                  <span class="btn-icon btn-icon_outline btn-icon_join-left input-stepper__icon">
496                                                                      <h-icon
497                                                                          icon-name="icon-plus"
498                                                                          role="button"
499                                                                          size="xs"
500                                                                          clickable
501                                                                          aria-hidden="true"
502                                                                          css-classes="btn__icon"
503                                                                      ></h-icon>
504                                                                  </span>
505                                                              </h-button-stepper>
506                                                          </h-input-stepper>`:d}
507                                                    ${e.actions.remove?r` <h-modal-opener
508                                                              name="${this._confirmModalId}"
509                                                              @click="${()=>{this._currentProduct=e}}"
510                                                              @keydown="${t=>{t.key!=="Enter"&&t.key!==" "||(this._currentProduct=e)}}"
511                                                              aria-label="${l("Remove")} ${e.name}"
512                                                              class="link link_secondary remove-product__button"
513                                                          >
514                                                              ${l("Remove")}
515                                                          </h-modal-opener>`:d}
516                                                </div>`,()=>r` <div class="basket-product__actions">
517                                                        <b class="font_semibold font_size-xs">${e.quantity} x ${e.unit.name}</b>
518                                                    </div>`)}
519                                        </div>
520
521                                        ${this.hasAdditionalInfo?r` <div class="basket-product__additional-info">
522                                                  <p class="p_no-margin">
523                                                      ${l("Shipping time")}:
524                                                      <strong class="font_semibold">${e.delivery?.name}</strong>
525                                                  </p>
526                                                  <p>
527                                                      <add-to-favourites
528                                                          class="link"
529                                                          product-id=${e.productId}
530                                                          variant-id=${e.variantId}
531                                                          module-instance-id="test"
532                                                      >
533                                                          <span
534                                                              aria-label="${l("Add to wishlist")}: ${e.name}"
535                                                              slot="not-added"
536                                                          >
537                                                              ${l("Add to wishlist")}
538                                                          </span>
539                                                          <span
540                                                              aria-label="${l("Remove from wishlist")}: ${e.name}"
541                                                              slot="added"
542                                                              hidden
543                                                          >
544                                                              ${l("Remove from wishlist")}
545                                                          </span>
546                                                      </add-to-favourites>
547                                                  </p>
548                                              </div>`:d}
549                                    </div>
550                                </div>
551                                <ul class="basket-product__prices">
552                                    ${e.isExchangedWithLoyaltyPoints?r`
553                                              <li class="basket-product__price price price_m price__value">
554                                                  <span class="font_semibold">
555                                                      ${e.sumLoyaltyPointsCost?.pointsFormatted}${this._hasSumLoyaltyPointsExchangePrice(e.sumLoyaltyPointsExchangePrice)?r` + ${e.sumLoyaltyPointsExchangePrice?.grossValueFormatted}`:d}
556                                                  </span>
557                                              </li>
558
559                                              ${e.quantity>1?r`<li class="price price_xs">
560                                                        ${this._hasSumLoyaltyPointsExchangePrice(e.loyaltyPointsExchangePrice)?r`${e.quantity} x (${e.loyaltyPointsCost?.pointsFormatted} +
561                                                              ${e.loyaltyPointsExchangePrice?.grossValueFormatted})`:r`${e.quantity} x ${e.loyaltyPointsCost?.pointsFormatted}`}
562                                                    </li> `:d}
563                                          `:d}
564                                    ${e.isExchangedWithLoyaltyPoints?d:r`
565                                              <li class="price price_to-pay basket-product__price">
566                                                  <p class="sr-only">
567                                                      ${e.isSpecialOffer?l("Promotional price"):l("Price")}
568                                                      ${e.sum.grossValueFormatted}
569                                                      ${l("incl. {{ taxFormatted }} vat",{taxFormatted:e.sum.taxFormatted})}
570                                                  </p>
571
572                                                  ${e.isSpecialOffer?r`
573                                                            <h-icon
574                                                                css-classes="icon_promo price__special-offer-icon"
575                                                                icon-name="icon-percent"
576                                                                size="xs"
577                                                                aria-hidden="true"
578                                                            ></h-icon>
579                                                        `:d}
580                                                  <span
581                                                      aria-hidden="true"
582                                                      class="${ee({price__value:!0,price__value_special:e.isSpecialOffer,price__value_bold:!0})}"
583                                                      >${e.sum.grossValueFormatted}</span
584                                                  >
585                                                  <span
586                                                      class="vat-info"
587                                                      aria-hidden="true"
588                                                  >
589                                                      ${l("incl. {{ taxFormatted }} vat",{taxFormatted:e.sum.taxFormatted})}
590                                                  </span>
591                                              </li>
592
593                                              ${e.quantity>1?r`
594                                                        <li class="price price_xs price_per-product">
595                                                            <p class="sr-only">
596                                                                ${l("Price per product")} ${e.price.grossValueFormatted}
597                                                            </p>
598                                                            <span aria-hidden="true">
599                                                                ${e.quantity} x ${e.price.grossValueFormatted}
600                                                            </span>
601                                                        </li>
602                                                    `:d}
603                                              ${e.isSpecialOffer?r` <li class="price price_xs price_regular">
604                                                            <p class="price__label p_no-margin">
605                                                                ${l("Regular price")} :
606
607                                                                <span class="price__value price__value_inactive">
608                                                                    ${e.basePrice.grossValueFormatted}
609                                                                </span>
610                                                            </p>
611                                                        </li>
612                                                        <li class="price price_xs price_lowest">
613                                                            <p class="price__label p_no-margin">
614                                                                ${l("Lowest price")} :
615
616                                                                <span class="price__value price__value_inactive p_no-margin">
617                                                                    ${e.lowestHistoricalPriceInLast30Days.grossValueFormatted}
618                                                                </span>
619                                                            </p>
620                                                        </li>`:d}
621                                          `}
622                                </ul>
623                            </div>
624                        `)}
625            </div>
626
627            <confirm-modal
628                ${I(this._confirmModal)}
629                id="${this._confirmModalId}"
630                header="${l("Are you sure you want to remove the product from your cart?")}"
631                confirmText="${l("Remove product")}"
632                cancelText="${l("Cancel")}"
633                @confirm="${this._removeProduct}"
634            >
635                <div
636                    class="grid__row grid__row_xs-vcenter"
637                    slot
638                >
639                    <div class="grid__col">
640                        <img
641                            width="80"
642                            src="${this._currentProduct?.image.paths.webp}"
643                            alt="${this._currentProduct?.image.title}"
644                        />
645                    </div>
646                    <div class="grid__col">${this._currentProduct?.name}</div>
647                </div>
648            </confirm-modal>
649        `}}mt([p()],De.prototype,"mode");mt([p({type:Boolean,attribute:"has-additional-info"})],De.prototype,"hasAdditionalInfo");mt([p()],De.prototype,"products");mt([u()],De.prototype,"_currentProduct");const pe={basket:"basket",fullBasket:"fullBasket",checkout:"checkout"},is="basket-summary__coupon",mn=/[\u200B-\u200D\uFEFF]/g;var _n=Object.defineProperty,Ue=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&_n(e,t,s),s};class Be extends f{constructor(){super(),this.mode=pe.basket,this.hasContent=!0,this.url="",this.basketUrl="",this._showTaxInfo=!1,this._basketPromotionsApi=this.getApiSync(ge.api),this._storefrontSettingsApi=this.getApiSync(L.api),this._basketOverallApi=this.getApiSync(H.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showTaxInfo=e.showAdditionalTaxInfo==="1"}),this._hasAnyPromotions$=this._basketPromotionsApi.select$().pipe(A(e=>e.length>0)),this._hasAnyDiscounts$=D([this._basketPromotionsApi.selectHasPromotionCode$(),this._hasAnyPromotions$]).pipe(A(([e,t])=>e||t)),this._shouldDisplayBasketSummaryPrices$=this._hasAnyDiscounts$.pipe(A(e=>e||this._showTaxInfo))}static{this.moduleName="basket-summary"}render(){return r`
650            ${this.hasContent?r`
651                      <div class="basket-module__content">
652                          <h2 class="section-title section-title_s mb-xs-2">${l("Summary")}
652</h2>
653
654                          ${g(this._basketOverallApi.getActions().usePromoCode,()=>r`<div
655                                  class="basket-summary__coupon"
656                                  tabindex="-1"
657                              >
658                                  <h3 class="font_semibold mb-xs-2">${l("Discount coupon")}</h3>
659
660                                  <basket-summary-coupon-codes></basket-summary-coupon-codes>
661                              </div>`,()=>d)}
662                          ${g(this.mode===pe.checkout||this.mode===pe.fullBasket,()=>r`<basket-summary-checkout-prices></basket-summary-checkout-prices>`,()=>r` ${M(this._shouldDisplayBasketSummaryPrices$,r`<basket-summary-basket-prices></basket-summary-basket-prices>`,d)}`)}
663                      </div>
664                  `:d}
665            ${g(this.mode===pe.basket||this.mode===pe.fullBasket,()=>r`
666                    <basket-summary-basket-footer
667                        basket-url="${this.basketUrl}"
668                        url="${this.url}"
669                        mode="${this.mode}"
670                    >
671                    </basket-summary-basket-footer>
672                `,()=>r`<basket-summary-checkout-footer></basket-summary-checkout-footer>`)}
673        `}}Ue([p()],Be.prototype,"mode");Ue([p()],Be.prototype,"hasContent");Ue([p()],Be.prototype,"url");Ue([p({type:String,attribute:"basket-url"})],Be.prototype,"basketUrl");Ue([u()],Be.prototype,"_showTaxInfo");var gn=Object.defineProperty,Ps=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&gn(e,t,s),s};class Rt extends f{constructor(){super(),this.discounts=[],this.discountsSum=null,this._storefrontSettingsApi=this.getApiSync(L.api)}static{this.moduleName="basket-discounts-list"}render(){const e=document.querySelector("#iconsPath")?.href||"/assets/img/icons/symbol-defs.svg";return r`${g(this.discounts.length>0,()=>r` <h-accordion
674                lazy
675                class="basket-discounts-list"
676            >
677                <h-accordion-group>
678                    <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
679                        <span>
680                            ${l("All discounts")}
681                            <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary">
682                                <use
683                                    href="${e}#icon-chevron-down"
684                                    xlink:href="${e}#icon-chevron-down"
685                                ></use>
686                            </svg>
687                        </span>
688
689                        <span>
690                            ${g(this.discountsSum,()=>r` <span class="price__value price__value_special"> ${this.discountsSum?.grossValueFormatted} </span> `,()=>d)}
691                        </span>
692                    </h-accordion-toggler>
693
694                    <h-accordion-content
695                        ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_optimization")}
696                        ?is-dev-accordion-safari-flash-fix-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_safari_flash_fix")}
697                    >
698                        <ul class="price-list price-list_secondary price-list_s">
699                            ${this.discounts.map(t=>r`
700                                    <li class="price-list__item">
701                                        <span class="price-list__label price_s">
702                                            ${g(t.percentage,()=>r`
703                                                    <span class="tag font_semibold tag_promotion"> -${t.percentage+"%"} </span>
704                                                `,()=>d)}
705                                            ${t.label}
706                                        </span>
707                                        <span class="price-list__value price__value price__value_special price_s">
708                                            ${t.discount?.grossValueFormatted}
709                                        </span>
710                                    </li>
711                                `)}
712                        </ul>
713                    </h-accordion-content>
714                </h-accordion-group>
715            </h-accordion>`)}`}}Ps([p()],Rt.prototype,"discounts");Ps([p()],Rt.prototype,"discountsSum");class E{constructor(e,t,i){this._subscription=null,this._host=e,this._source=t,this.value=i,this._host.addController(this)}hostConnected(){this._subscription=this._source.subscribe(e=>{this.value=e,this._host.requestUpdate()})}hostDisconnected(){this._subscription?.unsubscribe()}}class yn extends f{constructor(){super(),this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("shipping-chooser");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"shipping-chooser"),this._flashMessengerRef.value?.focus()},this._basketShippingsApi=this.getApiSync(Ce.api),this._basketOverallApi=this.getApiSync("basketOverallApi"),this._basketUpdaterApi=this.getApiSync(Mt.api),this._translationsApi=this.getApiSync(J.api),this._settingsApi=this.getApiSync(L.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._flashMessengerApi=this.getApiSync(ae.api),this._basketUpdaterApi.refreshBasket(),this._canChangeShippingCountry$=D([this._basketOverallApi.selectActions$(),this._basketShippingsApi.selectAvailableShippingCountries$(),this._basketAddressesApi.selectShippingAddress$()]).pipe(A(([e,t,i])=>e.changeShippingCountry!==void 0&&t.length>1&&!this._basketAddressesApi.isAddressFilled(i))),this._deliveryTime$=this._basketOverallApi.selectDelivery$().pipe(A(e=>e.name)),this._basketShippingsApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)}),this._selectedShippingCountry=new E(this,this._basketShippingsApi.selectSelectedShippingCountry$())}static{this.moduleName="shipping-chooser"}render(){return r` <section class="basket-module__content">
716            <div class="grid__row grid__row_xs-vcenter mb-xs-1">
717                <div class="grid__col grid__col_xs-grow">
718                    <flash-messenger
719                        ${I(this._flashMessengerRef)} 
720                        class="d-block mb-xs-1"
721                        name="shipping-chooser"
722                        tabindex="-1"
723                    ></flash-messenger>
724
725                    <h2 class="section-title section-title_s mb-xs-2">${l("Delivery")}</h2>
726
727                    ${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")?r`<basket-shipping-country isShippingCountryChangeAvailable="true"></basket-shipping-country>`:r`${g(this._selectedShippingCountry.value,()=>r`<p class="font_size-s">
728                                  <img
729                                      src="/assets/img/flags/${this._settingsApi.getCountryById(this._selectedShippingCountry.value.country.id)?.locale}.png"
730                                      alt=""
731                                      class="mr-xs-1"
732                                  />${this._selectedShippingCountry.value?.country.name}
733                                  ${M(this._canChangeShippingCountry$,r`<small class="d-block color_tertiary mt-xs-2"
734                                          >${l("To change the country, add a shipping address.")}</small
735                                      >`,d)}
736                              </p>`,()=>d)}`}
737                </div>
738            </div>
739
740            <p class="font_size-s">${l("Shipping within")} <b class="font_semibold">${$(this._deliveryTime$)}</b></p>
741
742            <basket-shippings-list .shippings=${$(this._basketShippingsApi.select$())}></basket-shippings-list>
743        </section>`}}const bn={shippingSelected:"shippingSelected"},Cs={api:"nearestPickupPointsApi"};var fn=Object.defineProperty,Ge=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&fn(e,t,s),s};class xe extends f{constructor(){super(),this.shippings=[],this.isSimple=!1,this._nearestPickupPoints=[],this.focusedId="",this._basketShippingsApi=this.getApiSync(Ce.api),this._basketAddressApi=this.getApiSync("basketAddressesApi"),this._nearestPickupPointsApi=this.getApiSync(Cs.api),this.eventBus.on(S.shippingInfoAdded,()=>this.requestUpdate()),this._basketShippingsApi.selectSelectedShipping$().subscribe(async e=>{e&&this._nearestPickupPointsApi.hasNearestPickupPointStrategy()&&(this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints())}),this._basketAddressApi.selectBillingAddress$().subscribe(async e=>{e?.zipCode&&(this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints())})}static{this.moduleName="basket-shippings-list"}_setShipping(e,t){const i=e.target;this.focusedId=`shipping-${t.id}`,i instanceof HTMLInputElement&&i.name==="basket_shipping"&&(this._basketShippingsApi.setShipping(t),this.dispatchEvent(new CustomEvent(bn.shippingSelected,{bubbles:!0})),this._currentRadioId=i.id,this.eventBus.emit(new m(G.shippingChosenByUser)))}async updated(e){if(super.updated(e),e.has("shippings")&&!e.has("_nearestPickupPoints")&&this._currentRadioId){await this.updateComplete;const t=this.querySelector(`input#${this._currentRadioId}`);t&&t.focus()}}_renderDescription(e){const t=!!e.description,i=e.price.grossValue>0&&!!e.requiredBasketValueForFreeShipping;return!t&&!i?d:r`
744            <div slot="description">
745                <p class="font_size-xs">
746                    ${g(i,()=>r`
747                            <span class="color_main">
748                                ${l("Free delivery for orders over")}
749                                <strong class="font_semibold"> ${e.requiredBasketValueForFreeShipping?.text} </strong>
750                            </span>
751                        `,()=>d)}
752                    ${t?e.description:d}
753                </p>
754            </div>
755        `}render(){return r`
756            ${$e(this.shippings,e=>_s.encode(JSON.stringify(e)),e=>r`
757                    <h-radio
758                        class="${ee({"basket-shipping":!0,"basket-shipping_selected":e.isSelected})}"
759                        controlId="${`shipping-${e.id}`}"
760                        controlName="basket_shipping"
761                        ?checked="${e.isSelected}"
762                        .value="${e.id}"
763                        @change="${t=>this._setShipping(t,e)}"
764                    >
765                        <h-radio-control aria-describedby="shipping-desc-${e.id}"></h-radio-control>
766
767                        <h-radio-content class="basket-shipping__radio">
768                            <div
769                                aria-label="${e.name}"
770                                class="basket-shipping__header"
771                                slot="label"
772                            >
773                                <span
774                                    aria-hidden="true"
775                                    class="basket-shipping__name"
776                                    >${e.name}</span
777                                >
778
779                                <div class="basket-shipping__summary">
780                                    ${g(e.image,()=>r`<img
781                                                aria-hidden="true"
782                                                style="height: 30px"
783                                                src="${e.image}"
784                                                alt="${e.name}"
785                                            />`,()=>d)}
786
787                                    <strong
788                                        aria-hidden="true"
789                                        class="font_semibold"
790                                    >
791                                        ${e.price.grossValue?e.price.grossValueFormatted:r`<span class="basket-shipping__price_highlight">${l("Free")}</span>`}
792                                    </strong>
793                                </div>
794                            </div>
795
796                            ${e.isSelected&&!this.isSimple?r` <div slot="description">
797                                      ${g(e.description,()=>r`<span
798                                                  class="font_size-xs"
799                                                  id="shipping-desc-${e.id}"
800                                                  >${e.description}</span
801                                              >`,()=>d)}
802                                      ${g(e.isPickupPointDelivery&&!this.isSimple,()=>r`
803                                              <div class="basket-shipping__pickup-point">
804                                                  ${g(e.pickupPoint,()=>r`
805                                                          ${M(this._nearestPickupPointsApi.selectHasNearestPickupPointStrategy$(),r` <nearest-pickup-points
806                                                                      class="nearest-pickup-points"
807                                                                      .nearestPickupPoints=${this._nearestPickupPoints}
808                                                                      .shipping=${e}
809                                                                      .selectedPickupPoint=${e.pickupPoint}
810                                                                      @nearestPickupPointsSearch=${async t=>{this._basketAddressApi.setPickupPointData(t.detail.zipCode),this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints()||[]}}
811                                                                      @pickupPointSelected=${t=>{const i=t.detail.pickupPoint;this._basketShippingsApi.setPickupPoint(e,i)}}
812                                                                      class="d-block mb-xs-2"
813                                                                  ></nearest-pickup-points>
814                                                                  <button
815                                                                      @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}}
816                                                                      class="btn btn_s btn_outline"
817                                                                  >
818                                                                      <h-icon
819                                                                          icon-name="icon-map-pin"
820                                                                          css-classes="btn__icon btn__icon_left"
821                                                                          aria-hidden="true"
822                                                                      ></h-icon>
823
824                                                                      ${l("Choose delivery point")}
825                                                                  </button>`,r`<span class="font_size-xs color_main"
826                                                                      >${l("Choosen delivery point")}</span
827                                                                  >
828
829                                                                  <address class="basket-shipping__pickup-point-address">
830                                                                      <p class="font_size-xs">
831                                                                          <strong class="font_semibold"> ${e.pickupPoint?.code} </strong>,
832                                                                          ${e.pickupPoint?.address.street}
833                                                                          ${e.pickupPoint?.address.houseNumber},
834                                                                          ${e.pickupPoint?.address.postalCode}
835                                                                          ${e.pickupPoint?.address.city},
836                                                                          ${e.pickupPoint?.address.description}
837                                                                      </p>
838
839                                                                      <button
840                                                                          @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}}
841                                                                          class="btn btn_s btn_outline"
842                                                                      >
843                                                                          <h-icon
844                                                                              icon-name="icon-map-pin"
845                                                                              css-classes="btn__icon btn__icon_left"
846                                                                              aria-hidden="true"
847                                                                          ></h-icon>
848
849                                                                          ${l("Change delivery point")}
850                                                                      </button>
851                                                                  </address>`)}
852                                                      `,()=>r`
853                                                          ${M(this._nearestPickupPointsApi.selectHasNearestPickupPointStrategy$(),r`<nearest-pickup-points
854                                                                  class="nearest-pickup-points"
855                                                                  .nearestPickupPoints=${this._nearestPickupPoints}
856                                                                  .shipping=${e}
857                                                                  @nearestPickupPointsSearch=${async t=>{this._basketAddressApi.setPickupPointData(t.detail.zipCode),this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints()||[]}}
858                                                                  @pickupPointSelected=${t=>{const i=t.detail.pickupPoint;this._basketShippingsApi.setPickupPoint(e,i)}}
859                                                                  class="d-block mb-xs-2"
860                                                              ></nearest-pickup-points>`,d)}
861
862                                                          <button
863                                                              @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}}
864                                                              class="btn btn_s btn_outline"
865                                                              aria-haspopup="dialog"
866                                                          >
867                                                              <h-icon
868                                                                  icon-name="icon-map-pin"
869                                                                  css-classes="btn__icon btn__icon_left"
870                                                                  aria-hidden="true"
871                                                              ></h-icon>
872
873                                                              ${l("Choose delivery point")}
874                                                          </button>
875                                                      `)}
876                                              </div>
877                                          `,()=>d)}
878                                      ${g(this._basketShippingsApi.shouldDisplayRemainingBasketValueForFreeShippingMessage(e),()=>r` ${g(this.isSimple,()=>d,()=>r` <div class="progress-bar mb-xs-1">
879                                                          <div
880                                                              class="progress-bar__bar"
881                                                              style="width: ${(e.requiredBasketValueForFreeShipping.float-e.remainingBasketValueForFreeShipping.float)*100/e.requiredBasketValueForFreeShipping.float}%"
882                                                          ></div>
883                                                      </div>`)}
884
885                                                  <p class="font_size-xs color_main">
886                                                      ${l("Add products worth {{ remainingBasketValueForFreeShipping }} to qualify for free delivery.",{remainingBasketValueForFreeShipping:e.remainingBasketValueForFreeShipping.text})}
887                                                  </p>`,()=>d)}
888                                      ${g(e.isSelected&&this._basketShippingsApi.getShippingInfo(e),()=>[...this._basketShippingsApi.getShippingInfo(e)].map(([,t])=>r`${gs(t)}`))}
889                                  </div>`:this._renderDescription(e)}
890                        </h-radio-content>
891                    </h-radio>
892                `)}
893        `}}Ge([p()],xe.prototype,"shippings");Ge([p({attribute:"is-simple",type:Boolean})],xe.prototype,"isSimple");Ge([u()],xe.prototype,"_currentRadioId");Ge([u()],xe.prototype,"_nearestPickupPoints");Ge([p({type:String})],xe.prototype,"focusedId");var Sn=Object.defineProperty,Is=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Sn(e,t,s),s};class Dt extends f{constructor(){super(),this.AUTOPAY_PAYMENT_CHANNEL_KEY="onlinePayment",this.AUTOPAY_POPULAR_SUBCHANNELS=["onlinePayment:1803","onlinePayment:1800","onlinePayment:1808","onlinePayment:1806"],this.P24_PAYMENT_CHANNEL_KEY="shoperP24",this.P24_POPULAR_SUBCHANNELS=["shoperP24:31","shoperP24:20","shoperP24:270","shoperP24:112"],this.payments=[],this.isOrderCoveredByGiftCards=!1,this._paymentsListModalRef=P(),this._basketPaymentsApi=this.getApiSync(Ie.api),this._basketShippingsApi=this.getApiSync(Ce.api),this._basketProductsApi=this.getApiSync("basketProductsApi"),this._settingsApi=this.getApiSync(L.api),this.eventBus.on(S.paymentInfoAdded,()=>this.requestUpdate()),setTimeout(()=>this.eventBus.emit(new m(S.beganCheckout)))}static{this.moduleName="basket-payments-list"}updated(e){e.has("payments")&&!this.isOrderCoveredByGiftCards&&this._ensurePaymentSelected()}_ensurePaymentSelected(){if(this._basketProductsApi.getBasketCount()===0)return;const e=this._getChannelsForList();if(e.length===0||e.some(s=>this._isPaymentOrSubPaymentSelected(s)))return;const i=e.find(s=>
893s.actions.selectChannel);i&&this._setPayment(i)}_getChannelsForModal(e){return this.payments.filter(i=>e.subChannels.includes(i.id))}_filterPopularSubchannelsForSelectedPayment(e,t,i){return e.filter(s=>t.subChannels.includes(s.id)).filter(s=>i.includes(s.channelKey)).sort((s,a)=>i.indexOf(s.channelKey)-i.indexOf(a.channelKey))}_getChannelsForPopular(e){return this._settingsApi.isFeatureEnabled("dev_payments_popular_subchannels")?e.channelKey===this.AUTOPAY_PAYMENT_CHANNEL_KEY?this._filterPopularSubchannelsForSelectedPayment(this.payments,e,this.AUTOPAY_POPULAR_SUBCHANNELS):e.channelKey===this.P24_PAYMENT_CHANNEL_KEY?this._filterPopularSubchannelsForSelectedPayment(this.payments,e,this.P24_POPULAR_SUBCHANNELS):[]:[]}_getChannelsForList(){return this.payments.filter(e=>e.isFeatured).sort((e,t)=>{const i=typeof e.integrationData=="object"&&e.integrationData!==null&&"pisChannelId"in e.integrationData&&!!e.integrationData.pisChannelId,s=typeof t.integrationData=="object"&&t.integrationData!==null&&"pisChannelId"in t.integrationData&&!!t.integrationData.pisChannelId;return Number(s)-Number(i)})}_getSelectedSubChannelForSelectedPayment(e){return this._getChannelsForModal(e).find(t=>t.isSelected)}_isPaymentOrSubPaymentSelected(e){return e.isSelected||e.subChannels.some(t=>this.payments.find(i=>i.id===t)?.isSelected)}_renderPaymentAdditionalInfo(e){return r` ${g(this._isPaymentOrSubPaymentSelected(e)&&this._basketPaymentsApi.getPaymentInfo(e),()=>[...this._basketPaymentsApi.getPaymentInfo(e)].map(([,t])=>r`${gs(t)}`))}`}_setPayment(e){this._basketPaymentsApi.setPayment(e),this.eventBus.emit(new m(G.paymentChosenByUser))}_getPaymentCtaLabel(e){return(e?.ctaPaymentLabel?.length??0)>0?e.ctaPaymentLabel:l("Select a bank")}render(){return r`
894            ${this._getChannelsForList().map(e=>r`
895                    <h-radio
896                        class="${ee({"basket-shipping":!0,"basket-shipping_selected":this._isPaymentOrSubPaymentSelected(e)})}"
897                        controlId=${`payment-${e.id}-${e.paymentId}`}
898                        controlName="basket_payment"
899                        .checked=${this._isPaymentOrSubPaymentSelected(e)}
900                        .value=${e.id}
901                        @change=${t=>{t.target instanceof HTMLInputElement&&this._setPayment(e)}}
902                    >
903                        <h-radio-control aria-describedby="payment-desc-${e.id}-${e.paymentId}"></h-radio-control>
904
905                        <h-radio-content class="basket-shipping__radio">
906                            <div
907                                class="basket-shipping__header"
908                                aria-label="${e.name}"
909                                slot="label"
910                            >
911                                <span
912                                    aria-hidden="true"
913                                    class="basket-shipping__name"
914                                    >${e.name}</span
915                                >
916                                <div class="basket-shipping__summary">
917                                    ${g(e.image,()=>r`<img
918                                                aria-hidden="true"
919                                                class="basket-shipping__image"
920                                                src="${e.image}"
921                                                alt="${e.name}"
922                                            />`,()=>d)}
923                                    ${g(this._basketShippingsApi.isEveryAvailablePaymentFree(),()=>d,()=>r`<strong
924                                            aria-hidden="true"
925                                            class="font_semibold"
926                                        >
927                                            ${this._basketShippingsApi.getPaymentCostForActiveShippingByPaymentId(e.paymentId)?.grossValue?this._basketShippingsApi.getPaymentCostForActiveShippingByPaymentId(e.paymentId)?.grossValueFormatted:r`<span class="color_secondary-500">${l("Free")}</span>`}
928                                        </strong> `)}
929                                </div>
930                            </div>
931
932                            <div slot="description">
933                                ${g(e.description,()=>r`
934                                        <p
935                                            class="font_size-xs"
936                                            id="payment-desc-${e.id}-${e.paymentId}"
937                                        >
938                                            ${e.description}
939                                        </p>
940                                    `)}
941                                ${g(e.subChannels.length>1&&this._isPaymentOrSubPaymentSelected(e),()=>r`
942                                            <payments-list-popular
943                                                .payments=${this._getChannelsForPopular(e)}
944                                            ></payments-list-popular>
945                                            <payments-list-modal
946                                                ${I(this._paymentsListModalRef)}
947                                                .payments=${this._getChannelsForModal(e)}
948                                                .ctaPaymentLabel=${e.ctaPaymentLabel??""}
949                                            ></payments-list-modal>
950                                            ${g(this._getSelectedSubChannelForSelectedPayment(e),()=>r`
951                                                    <div class="color_main mb-xs-2">
952                                                        <p class="p_no-margin">
953                                                            ${l("Selected")}:
954                                                            <b class="font_semibold">
955                                                                ${this._getSelectedSubChannelForSelectedPayment(e)?.name}
956                                                            </b>
957                                                        </p>
958
959                                                        <button
960                                                            @click=${()=>{this._paymentsListModalRef.value?.open()}}
961                                                            class="btn btn_outline btn_s mt-xs-1"
962                                                        >
963                                                            ${l("Change payment bank")}
964                                                        </button>
965                                                    </div>
966                                                `,()=>r` <button
967                                                    @click=${()=>{this._paymentsListModalRef.value?.open()}}
968                                                    class="btn btn_primary btn_s"
969                                                >
970                                                    ${this._getPaymentCtaLabel(e)}
971                                                </button>`)}
972                                        `,()=>d)}
973                                ${this._renderPaymentAdditionalInfo(e)}
974                            </div>
975                        </h-radio-content>
976                    </h-radio>
977                `)}
978        `}}Is([p()],Dt.prototype,"payments");Is([p()],Dt.prototype,"isOrderCoveredByGiftCards");var An=Object.defineProperty,vn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&An(e,t,s),s};class ws extends f{constructor(){super(),this._subscriptionController=new Nt(this),this._isOrderCoveredByGiftCards=!1,this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("payment-chooser");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"payment-chooser"),this._flashMessengerRef.value?.focus()},this._basketPaymentsApi=this.getApiSync(Ie.api),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this._settingsApi=this.getApiSync(L.api),this._basketOverallApi=this.getApiSync(H.api),this._isGiftCardsEnabled=this._settingsApi.isFeatureEnabled("dev_gift_cards"),this._isGiftCardsEnabled&&(this._basketGiftCardsApi=this.getApiSync(ne.api),this._setupPaymentChooserVisibility()),this._basketPaymentsApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)})}static{this.moduleName="payment-chooser"}_setupPaymentChooserVisibility(){if(!this._basketGiftCardsApi)return;
978const e=D([this._basketGiftCardsApi.selectHasAppliedGiftCards$(),this._basketOverallApi.selectSumToPay$()]);this._subscriptionController.subscribe(e,([t,i])=>{this._isOrderCoveredByGiftCards=t&&i.grossValue<=0,this._isOrderCoveredByGiftCards?_e.hide(this):_e.show(this)})}render(){return r`<section class="basket-module__content">
979            <flash-messenger
980                ${I(this._flashMessengerRef)}
981                class="d-block mb-xs-1"
982                name="payment-chooser"
983                tabindex="-1"
984            ></flash-messenger>
985
986            <h2 class="section-title section-title_s mb-xs-2">${l("Payment")}</h2>
987
988            <basket-payments-list
989                .payments=${$(this._basketPaymentsApi.selectAvailable$())}
990                .isOrderCoveredByGiftCards=${this._isOrderCoveredByGiftCards}
991            ></basket-payments-list>
992
993            <p class="mt-xs-1">
994                <h-icon
995                    class="mr-xs-1 "
996                    icon-name="icon-lock"
997                    css-classes="icon_tertiary-color"
998                    aria-hidden="true"
999                ></h-icon>
1000                <small class="color_tertiary">${l("Payments comply with the latest security standards.")}</small>
1001            </p>
1002        </section>`}}vn([u()],ws.prototype,"_isOrderCoveredByGiftCards");const Z={consumerAndCompany:"0",consumerOnly:"1",companyOnly:"2"};var kn=Object.defineProperty,$n=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&kn(e,t,s),s};class Es extends f{constructor(){super(),this.addressMode=Z.consumerAndCompany,this._differentShippingAddressCheckboxRef=P(),this._differentShippingAddressCheckboxId=`different-shipping-${v()}`,this._billingAddressModalRef=P(),this._shippingAddressModalRef=P(),this._basketAddressFormTeaserRef=P(),this._flashMessengerRef=P(),this._handleFlashMessages=(i,s)=>{const a=["basket-addresses-1","basket-addresses-2","basket-addresses-3"];if(i){a.forEach(o=>{this._flashMessengerApi.removeAllFlashMessages(o)});return}a.forEach(o=>{this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(s),type:z.error,isCloseable:!1,timeout:0},o)}),this._flashMessengerRef.value?.focus()},this._mapEventToAction=i=>{const s=i.target;return s.id===this._differentShippingAddressCheckboxId?s.checked:this._differentShippingAddressCheckboxRef.value?.checked||!1},this._dispatchBillingModalActionEvent=i=>{const s=new CustomEvent(i.type);this._basketAddressFormTeaserRef.value?.dispatchEvent(s)},this._authenticationApi=this.getApiSync(hs.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this._hasShippingAddress$=this._basketAddressesApi.selectShippingAddress$().pipe(A(i=>this._basketAddressesApi.isAddressFilled(i)));const e=this._basketAddressesApi.getBillingAddress()!==null&&(this._basketAddressesApi.isDifferentShippingAddressRequired()||!this._basketAddressesApi.isBillingAddressEqualShippingAddress()),t=us(this,"change");this._differentShippingAddressVisibilityChange$=t.pipe(A(this._mapEventToAction)).pipe(ms(e)),this._differentShippingAddressVisibilityChange$.pipe(k()).subscribe(i=>{!i&&e&&this._basketAddressesApi.setBillingAddressAsShippingAddress()}),this._isDifferentShippingAddressChecked$=D([this._basketAddressesApi.selectBillingAddress$(),this._basketAddressesApi.selectIsDifferentShippingAddressRequired$(),this._differentShippingAddressVisibilityChange$,this._basketAddressesApi.selectIsBillingAddressEqualShippingAddress$()]).pipe(A(([i,s,a,o])=>!!(i&&(!o||s)||a))),this._isDifferentShippingAddressDisabled$=D([this._basketAddressesApi.selectIsDifferentShippingAddressRequired$(),this._basketAddressesApi.selectBillingAddress$()]).pipe(A(([i,s])=>i||!s)),this._basketAddressesApi.selectSectionValidation$().subscribe(({isValid:i,validationMessage:s})=>{i?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),s&&this._handleFlashMessages(i,s)})}static{this.moduleName="basket-addresses"}
1002_renderBillingAddress(){return r`<div class="basket-module__content basket-module__content_pb-0 basket-module__content_pl-0 basket-module__content_pr-0">
1003            <h2 class="section-title section-title_s mb-xs-2 pl-xs-2 pr-xs-2">${l("Order information")}</h2>
1004
1005            ${this._renderStandardBillingAddress()}
1006        </div>`}_renderStandardBillingAddress(){return r`
1007            ${M(this._basketAddressesApi.selectShowBillingAddressCard$(),this._renderEditBillingAddressModal(),r`<div class="pl-xs-2 pr-xs-2 mb-xs-2">
1008                        <flash-messenger
1009                            ${I(this._flashMessengerRef)} 
1010                            name="basket-addresses-2"
1011                            tabindex="-1"
1012                        ></flash-messenger>
1013                    </div>
1014                    <billing-address-standard
1015                        .addressMode=${this.addressMode}
1016                        .address=${$(this._basketAddressesApi.selectBillingAddress$())}
1017                        .isLoggedIn=${$(this._authenticationApi.selectIsAuthorized$())}
1018                    ></billing-address-standard>`)}
1019        `}_renderEditBillingAddressModal(){return r`
1020            <edit-billing-address-modal
1021                @open-modal="${()=>{this._billingAddressModalRef.value?.open()}}"
1022            ></edit-billing-address-modal>
1023        `}
1023_renderShippingAddress(){return r`<div class="control__additional-content control__additional-content_with-border">
1024            ${this._renderStandardShippingAddress()}
1025        </div>`}_renderStandardShippingAddress(){return r`
1026            ${M(this._basketAddressesApi.selectShowShippingAddressCard$(),this._renderEditShippingAddressModal(),r` <shipping-address-standard
1027                    .address=${$(this._basketAddressesApi.selectShippingAddress$())}
1028                ></shipping-address-standard>`)}
1029        `}_renderEditShippingAddressModal(){return r`
1030            <edit-shipping-address-modal
1031                @open-modal="${()=>{this._shippingAddressModalRef.value?.open()}}"
1032            ></edit-shipping-address-modal>
1033        `}_renderDifferentShippingAddressCheckbox(){return r`
1034            <h-checkbox
1035                ${I(this._differentShippingAddressCheckboxRef)}
1036                controlId=${this._differentShippingAddressCheckboxId}
1037                controlName=${this._differentShippingAddressCheckboxId}
1038                value="1"
1039                ?checked=${$(this._isDifferentShippingAddressChecked$)}
1040                ?disabled=${$(this._isDifferentShippingAddressDisabled$)}
1041            >
1042                <h-checkbox-control></h-checkbox-control>
1043
1044                <h-checkbox-content>
1045                    <span slot="label"> ${l("Shipping to a different address")} </span>
1046                </h-checkbox-content>
1047            </h-checkbox>
1048        `}render(){return r`
1049            <div class="basket-addresses">
1050                ${this._renderBillingAddress()}
1051                ${M(this._basketAddressesApi.selectIsDifferentShippingAddressAvailable$(),r`<div class="basket-module__content basket-module__content_secondary">
1052                        <div class="d-flex">
1053                            <h3 class="font_semibold">${l("Delivery details")}</h3>
1054                            <h-icon
1055                                css-classes="ml-xs-1"
1056                                icon-name="icon-truck"
1057                                aria-hidden="true"
1058                            ></h-icon>
1059                        </div>
1060
1061                        <h-control class="mt-xs-1">
1062                            <h-control-content class="control">
1063                                <h-control-element class="control__element">
1064                                    ${M(this._basketAddressesApi.selectBillingAddress$(),r` ${this._renderDifferentShippingAddressCheckbox()} `,r`<h-hint direction="top-left">
1065                                            ${this._renderDifferentShippingAddressCheckbox()}
1066
1067                                            <h-hint-content>
1068                                                <p>${l("First, enter order information (above)")}</p>
1069                                            </h-hint-content>
1070                                        </h-hint>`)}
1071                                </h-control-element>
1072
1073                                ${M(this._isDifferentShippingAddressChecked$,this._renderShippingAddress(),d)}
1074                            </h-control-content>
1075                        </h-control>
1076                    </div>`,d)}
1077            </div>
1078
1079            ${M(this._basketAddressesApi.selectShowBillingAddressCard$(),r`<billing-address-modal
1080                    ${I(this._billingAddressModalRef)}
1081                    .addressMode=${this.addressMode}
1082                    .address=${$(this._basketAddressesApi.selectBillingAddress$())}
1083                    .isLoggedIn=${$(this._authenticationApi.selectIsAuthorized$())}
1084                    @open=${this._dispatchBillingModalActionEvent}
1085                    @close=${this._dispatchBillingModalActionEvent}
1086                ></billing-address-modal>`,d)}
1087            ${M(this._basketAddressesApi.selectShowShippingAddressCard$(),r`<shipping-address-modal
1088                    ${I(this._shippingAddressModalRef)}
1089                    .address=${$(this._basketAddressesApi.selectShippingAddress$())}
1090                ></shipping-address-modal>`,d)}
1091        `}}$n([p({type:String,attribute:"address-mode"})],Es.prototype,"addressMode");var Pn=Object.defineProperty,Bs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Pn(e,t,s),s};class Ut extends f{constructor(){super(...arguments),this.address=null,this.country=null}static{this.moduleName="address-card"}connectedCallback(){if(super.connectedCallback(),!this.address||!this.country)throw new Error("address or country attribute is missing")}render(){return!this.address||!this.country?d:r`
1092            <p class="p_overflow-wrap-anywhere">
1093                <strong class="font_semibold">
1094                    <h-icon
1095                        class="mr-xs-1"
1096                        icon-name="icon-user"
1097                        aria-hidden="true"
1098                    ></h-icon
1099                    >${this.address.firstName} ${this.address.lastName}
1100                    ${this.address.companyName?r` (${this.address.companyName})`:d}</strong
1101                >
1102            </p>
1103
1104            ${this.address.isCompany?r` <p>${l("Tax ID")} ${this.address.taxId}</p>`:d}
1105
1106            <div class="mb-xs-2">
1107                <p class="p_no-margin p_overflow-wrap-anywhere">
1108                    ${this.address.street}<br aria-hidden="true" />${this.address.zipCode} ${this.address.city}
1109                </p>
1110                <img
1111                    class="mr-xs-1"
1112                    src=${`/assets/img/flags/${this.country.locale}.png`}
1113                    alt=""
1114                />
1115                <span>${l(this.country.name)}</span>
1116            </div>
1117
1118            <p class="p_no-margin p_overflow-wrap-anywhere">${this.address.phone}</p>
1119            <p class="p_overflow-wrap-anywhere">${this.address.email}</p>
1120        `}}Bs([p({type:Object})],Ut.prototype,"address");Bs([p({type:Object})],Ut.prototype,"country");const Ne={Valid:"valid",Invalid:"invalid",ValidationError:"validation_error"};class _t{async saveAddressForm(e){const t=await e(),i=this.processValidationResult(t);return i===Ne.Invalid?!1:i===Ne.ValidationError?{...t}:null}processValidationResult(e){return e===!1?Ne.Invalid:e==null?Ne.Valid:Ne.ValidationError}}var Cn=Object.defineProperty,qe=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Cn(e,t,s),s};class Fe extends f{constructor(){super(),this._modal=P(),this._form=P(),this.address=null,this.addressMode=Z.consumerAndCompany,this.isLoggedIn=!1,this._formErrors=null,this._isLoading=!0,this._cancel=async()=>{await this._modal.value?.close(),this._isLoading=!0},this._save=async e=>{this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setBillingAddress(e)),this._formErrors===null&&this.close()},this._addressController=new _t}static{this.moduleName="billing-address-modal"}async open(){await this._modal.value?.open(),this._isLoading=!1,this._form.value?.focusFirstInput(),this.eventBus.emit(new m(G.billingAddressModalOpened,{modal:this,address:this.address}))}async close(){await this._modal.value?.close(),this._isLoading=!0}render(){return r` <h-modal
1121            ${I(this._modal)}
1122            hidden
1123        >
1124            <h-modal-header>
1125                <h2 class="font_semibold h2">${l("Order information")}</h2>
1126                <h-modal-close
1127                    aria-label="${l("Close window")}"
1128                    class="btn btn_icon"
1129                >
1130                    <h-icon
1131                        icon-name="icon-x"
1132                        role="button"
1133                        size="xl"
1134                        clickable
1135                    ></h-icon>
1136                </h-modal-close>
1137            </h-modal-header>
1138            <h-modal-body>
1139                <flash-messenger
1140                    class="d-block mb-xs-2"
1141                    name="billing-address-modal"
1142                ></flash-messenger>
1143
1144                ${g(this._isLoading,()=>r`<div class="loader">
1145                        <div class="loader__spinner loader__spinner"></div>
1146                    </div>`,()=>r`<billing-address-form
1147                            ${I(this._form)}
1148                            .address=${this.address}
1149                            .addressMode=${this.addressMode}
1150                            .isLoggedIn=${this.isLoggedIn}
1151                            .formErrors=${we.toJson(this._formErrors)}
1152                        ></billing-address-form>`)}
1153            </h-modal-body>
1154
1155            <h-modal-footer>
1156                <button
1157                    class="btn btn_secondary"
1158                    @click=${this._cancel}
1159                >
1160                    ${l("Cancel")}
1161                </button>
1162                <button
1163                    class="btn btn_primary"
1164                    @click=${this._save}
1165                >
1166                    ${l("Save information")}
1167                </button>
1168            </h-modal-footer>
1169        </h-modal>`}}
1169qe([p()],Fe.prototype,"address");qe([p()],Fe.prototype,"addressMode");qe([p()],Fe.prototype,"isLoggedIn");qe([u()],Fe.prototype,"_formErrors");qe([u()],Fe.prototype,"_isLoading");var In=Object.defineProperty,gt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&In(e,t,s),s};class ze extends f{constructor(){super(),this._modal=P(),this._form=P(),this.address=null,this._formErrors=null,this._hasErrors=!1,this._isLoading=!0,this._cancel=async()=>{await this._modal.value?.close(),this._isLoading=!0},this._save=async e=>{this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setShippingAddress(e)),this._formErrors===null&&this.close()},this._addressController=new _t}static{this.moduleName="shipping-address-modal"}async open(){await this._modal.value?.open(),this._isLoading=!1,this._form.value?.focusFirstInput(),this.eventBus.emit(new m(G.shippingAddressModalOpened,{modal:this,address:this.address}))}async close(){await this._modal.value?.close(),this._isLoading=!0}render(){return r` <h-modal
1170            ${I(this._modal)}
1171            hidden
1172        >
1173            <h-modal-header>
1174                <h2 class="font_semibold h2">${l("Order information")}</h2>
1175                <h-modal-close
1176                    aria-label="${l("Close window")}"
1177                    class="btn btn_icon"
1178                >
1179                    <h-icon
1180                        icon-name="icon-x"
1181                        role="button"
1182                        size="xl"
1183                        clickable
1184                    ></h-icon>
1185                </h-modal-close>
1186            </h-modal-header>
1187            <h-modal-body>
1188                <flash-messenger
1189                    class="d-block mb-xs-2"
1190                    name="shipping-address-modal"
1191                ></flash-messenger>
1192
1193                ${g(this._isLoading,()=>r`<div class="loader">
1194                        <div class="loader__spinner loader__spinner"></div>
1195                    </div>`,()=>r`<shipping-address-form
1196                            ${I(this._form)}
1197                            .address=${this.address}
1198                            .formErrors=${we.toJson(this._formErrors)}
1199                        ></shipping-address-form>`)}
1200            </h-modal-body>
1201
1202            <h-modal-footer>
1203                <button
1204                    class="btn btn_secondary"
1205                    @click=${this._cancel}
1206                >
1207                    ${l("Cancel")}
1208                </button>
1209                <button
1210                    class="btn btn_primary"
1211                    @click=${this._save}
1212                >
1213                    ${l("Save information")}
1214                </button>
1215            </h-modal-footer>
1216        </h-modal>`}}gt([p()],ze.prototype,"address");gt([u()],ze.prototype,"_formErrors");gt([u()],ze.prototype,"_hasErrors");gt([u()],ze.prototype,"_isLoading");const Q="179";var wn=Object.defineProperty,X=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&wn(e,t,s),s};class W extends f{constructor(){super(),this.addressMode=Z.consumerAndCompany,this.address=null,this.isLoggedIn=!1,this.formErrors=null,this._reactiveFormRef=P(),this._postalCodeInputRef=P(),this._countrySelectRef=P(),this._formId=`form-${v()}`,this._emailId=`email-${v()}`,this._firstNameId=`first-name-${v()}`,this._lastNameId=`last-name-${v()}`,this._phoneId=`phone-${v()}`,this._countryId=`country-${v()}`,this._streetId=`street-${v()}`,this._postalCodeId=`postal-code-${v()}`,this._cityId=`city-${v()}`,this._taxId=`tax-${v()}`,this._companyName=`company-name-${v()}`,this._createUserAccountId=`create-user-account-${v()}`,this._allCountries=[],this._isCompany=!1,this._userEmail="",this._translations={},this._displayConsumerRadio=!1,this._displayCompanyRadio=!1,this._selectedCountryId=this.address?.countryId?String(this.address?.countryId):Q,this._isRegistrationEnabled=new wt,this._isBuyingEnabledToUnregistered=new wt,this._isRegistrationRequired=new wt,this.setBillingAddress=async e=>{e.preventDefault();const t=await this.getFormValues();return t&&this.getFormState()!==Pe.validationFailed?this._basketAddressesApi.setBillingAddress({email:t.email,isCompany:this._isCompany,companyName:t.companyName,firstName:t.firstName,lastName:t.lastName,personalIdNumber:"",taxId:t.taxId,countryId:Number(t.countryId),city:t.city,postalCode:t.postalCode,street:t.street,street2:"",ph
1216one:t.phone,state:"",createUserAccount:t.createUserAccount==="1"}):!1},this.getFormValues=async()=>{const e=this.getFormService(),t=e.getFormControls();await e.validateControls({focusOnFirstInvalidField:!1});const i={};return t.forEach(s=>{s.type==="radio"?s.checked&&(i[s.name]=s.value):Ai.isDefined(s.value)&&(i[s.name]=s.value)}),i},this._storefrontSettings=this.getApiSync(L.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._translationApi=this.getApiSync(J.api),this._orderApi=this.getApiSync(Re.api),this.getApi(ps.api).then(e=>{this._userApi=e,this._userApi.selectUser$().subscribe(t=>{t&&(this._userEmail=t.email)})}),this._setTranslations()}static{this.moduleName="billing-address-form"}_setTranslations(){const e="Only registered customers can place orders. {{ link }}Log in{{ linkEnd }} or create a new account by filling out this information.";this._translations[e]=this._translationApi.translate(e,{link:'<login-modal-opener class="link link_regular" tabindex="0" role="button">',linkEnd:"</login-modal-opener>",interpolation:{escapeValue:!1}})}connectedCallback(){super.connectedCallback();const e=this._storefrontSettings.getSkinSettings().locale.replace("_","-");this._allCountries=this._storefrontSettings.getCountries().map(t=>({value:String(t.id),content:this._translationApi.translate(t.name),selected:t.id==this.address?.countryId||!this.address&&t.id==179})).sort((t,i)=>t.content.localeCompare(i.content,e))}willUpdate(e){super.willUpdate(e),e.has("address")&&(this._selectedCountryId=this.address?.countryId?String(this.address.countryId):Q)}firstUpdated(e){super.firstUpdated(e),this._selectedCountryId=this.address?.countryId?String(this.address?.countryId):Q,this._orderApi.addOrderValidation(()=>document.querySelector("reactive-form")?.formService.getFormState()!==Pe.validationFailed,()=>{this.scrollIntoView()}),this._storefrontSettings.isFeatureEnabled("storefront_registration")?this._displayConsumerRadio=this._displayCompanyRadio=this.addressMode===Z.consumerAndCompany:(this._displayConsumerRadio=this.addressMode===Z.consumerAndCompany||this.addressMode===Z.consumerOnly,this._displayCompanyRadio=this.addressMode===Z.consumerAndCompany||this.addressMode===Z.companyOnly),this._isCompany=!!(this.address?.isCompany||this.addressMode===Z.companyOnly),this._basketAddressesApi.setIsCompany(this._isCompany),this._isRegistrationEnabled=this._storefrontSettings.selectSkinSettings$().pipe(A(({isRegistrationEnabled:t})=>t==="1"&&!this.isLoggedIn)),this._isBuyingEnabledToUnregistered=this._storefrontSettings.selectSkinSettings$().pipe(A(({isBuyingEnabledToUnregistered:t})=>t==="1"&&!this.isLoggedIn)),this._isRegistrationRequired=this._isBuyingEnabledToUnregistered.pipe(A(t=>!t))}updated(e){if(super.updated(e),this.formErrors){const t=we.fromJson(this.formErrors);if(t)for(const[i,s]of Object.entries(t))this.getFormService().updateFormControlByName(i,{errors:s})}}getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}getFormState(){return this.getFormService().getFormState()}async checkValidity(){try{return await this.getFormService().checkValidity()}catch{return!1}}focusFirstInput(){setTimeout(()=>{this._reactiveFormRef.value?.querySelector('input[type="text"]')?.focus()})}_renderMandatoryAccountCreationInfo(){return this._userApi?.getUser()?d:r`
1217            <div class="flash-message flash-message__info mb-xs-2">
1218                <h-icon
1219                    icon-name="icon-alert-triangle"
1220                    css-classes="flash-message__icon"
1221                    role="button"
1222                    aria-hidden="true"
1223                ></h-icon>
1224
1225                <p>
1226                    ${j(this._translations["Only registered customers can place orders. {{ link }}Log in{{ linkEnd }} or create a new account by filling out this information."])}
1227                </p>
1228            </div>
1229        `}_renderForm(){return r` <reactive-form ${I(this._reactiveFormRef)}>
1230            <form
1231                id=${this._formId}
1232                @submit=${this.setBillingAddress}
1233            >
1234                <div
1235                    class="form__additional-info mt-xs-0"
1236                    aria-hidden="true"
1237                >
1238                    <i>
1239                        ${l("Required fields are marked with")} -
1240                        <span class="form__additional-info_secondary">*</span>
1241                    </i>
1242                </div>
1243
1244                ${g(!this._storefrontSettings.isFeatureEnabled("storefront_registration")||this._displayCompanyRadio||this._displayConsumerRadio,()=>r`
1245                        <control-connector
1246                            requiredInGroup
1247                            class="control control_row pt-xs-1"
1248                            @change=${e=>{const t=e.target;t instanceof HTMLInputElement&&(this._isCompany=t.value==="true",this._basketAddressesApi.setIsCompany(this._isCompany))}}
1249                        >
1250                            ${g(this._displayConsumerRadio,()=>r`<h-control-content class="control__content_auto">
1251                                    <h-control-element class="control__element">
1252                                        <div class="radio-box">
1253                                            <input
1254                                                type="radio"
1255                                                id="firstname1"
1256                                                name="isCompany"
1257                                                .checked=${!this._isCompany}
1258                                                value="false"
1259                                                class="radio-box__input"
1260                                                aria-label="${l("Consumer")}"
1261                                            />
1262
1263                                            <label
1264                                                class="radio-box__label"
1265                                                for="firstname1"
1266                                                aria-hidden="true"
1267                                            >
1268                                                ${l("Consumer")}
1269                                            </label>
1270                                        </div>
1271                                    </h-control-element>
1272
1273                                    <control-errors></control-errors>
1274                                </h-control-content>`,()=>d)}
1275                            ${g(this._displayCompanyRadio,()=>r`<h-control-content class="control__content_auto">
1276                                    <h-control-element class="control__element">
1277                                        <div class="radio-box">
1278                                            <input
1279                                                type="radio"
1280                                                id="firstname2"
1281                                                name="isCompany"
1282                                                .checked=${this._isCompany}
1283                                                value="true"
1284                                                class="radio-box__input"
1285                                                aria-label="${l("Company")}"
1286                                            />
1287
1288                                            <label
1289                                                class="radio-box__label"
1290                                                for="firstname2"
1291                                                aria-hidden="true"
1292                                            >
1293                                                ${l("Company")}
1294                                            </label>
1295                                        </div>
1296                                    </h-control-element>
1297
1298                                    <control-errors></control-errors>
1299                                </h-control-content>`,()=>d)}
1300                        </control-connector>
1301                    `)}
1302
1303                <control-connector
1304                    min="3"
1305                    email
1306                    class="control"
1307                >
1308                    <h-control>
1309                        <h-control-label class="control__label">
1310                            <label
1311                                class="label label_required"
1312                                for=${this._emailId}
1313                            >
1314                                <span
1315                                    class="label__asterisk"
1316                                    aria-hidden="true"
1317                                    >*</span
1318                                >
1319                                ${l("E-mail address")}
1320                            </label>
1321                        </h-control-label>
1322
1323                        <h-control-content class="control">
1324                            <h-control-element class="control__element">
1325                                <h-input
1326                                    controlId=${this._emailId}
1327                                    controlName="email"
1328                                    .value=${this.address?.email||this._userEmail}
1329                                    required
1330                                >
1331                                    <h-input-control></h-input-control>
1332                                </h-input>
1333                            </h-control-element>
1334
1335                            <control-errors></control-errors>
1336                        </h-control-content>
1337                    </h-control>
1338                </control-connector>
1339
1340                <control-connector
1341                    required
1342                    class="control"
1343                >
1344                    <h-control>
1345                        <h-control-label class="control__label">
1346                            <label
1347                                class="label label_required"
1348                                for=${this._firstNameId}
1349                            >
1350                                <span
1351                                    class="label__asterisk"
1352                                    aria-hidden="true"
1353                                    >*</span
1354                                >
1355                                ${l("First name")}
1356                            </label>
1357                        </h-control-label>
1358
1359                        <h-control-content class="control">
1360                            <h-control-element class="control__element">
1361                                <h-input
1362                                    controlId=${this._firstNameId}
1363                                    controlName="firstName"
1364                                    .value=${this.address?.firstName}
1365                                    required
1366                                >
1367                                    <h-input-control></h-input-control>
1368                                </h-input>
1369                            </h-control-element>
1370
1371                            <control-errors></control-errors>
1372                        </h-control-content>
1373                    </h-control>
1374                </control-connector>
1375
1376                <control-connector
1377                    required
1378                    class="control"
1379                >
1380                    <h-control>
1381                        <h-control-label class="control__label">
1382                            <label
1383                                class="label label_required"
1384                                for=${this._lastNameId}
1385                            >
1386                                <span
1387                                    class="label__asterisk"
1388                                    aria-hidden="true"
1389                                    >*</span
1390                                >
1391                                ${l("Last name")}
1392                            </label>
1393                        </h-control-label>
1394
1395                        <h-control-content class="control">
1396                            <h-control-element class="control__element">
1397                                <h-input
1398                                    controlId=${this._lastNameId}
1399                                    controlName="lastName"
1400                                    .value=${this.address?.lastName}
1401                                    required
1402                                >
1403                                    <h-input-control></h-input-control>
1404                                </h-input>
1405                            </h-control-element>
1406
1407                            <control-errors></control-errors>
1408                        </h-control-content>
1409                    </h-control>
1410                </control-connector>
1411
1412                ${g(this._isCompany,()=>r` <control-connector
1413                            ?required=${this._isCompany}
1414                            class="control"
1415                        >
1416                            <h-control>
1417                                <h-control-label class="control__label">
1418                                    <label
1419                                        class="label label_required"
1420                                        for=${this._taxId}
1421                                    >
1422                                        <span
1423                                            class="label__asterisk"
1424                                            aria-hidden="true"
1425                                            >*</span
1426                                        >
1427                                        ${l("Taxpayer Identification Number (TIN)")}
1428                                    </label>
1429                                </h-control-label>
1430
1431                                <h-control-content class="control">
1432                                    <h-control-element class="control__element">
1433                                        <h-input
1434                                            controlId=${this._taxId}
1435                                            controlName="taxId"
1436                                            .value=${this.address?.taxId}
1437                                            ?required=${this._isCompany}
1438                                        >
1439                                            <h-input-control></h-input-control>
1440                                        </h-input>
1441                                    </h-control-element>
1442
1443                                    <control-errors></control-errors>
1444                                </h-control-content>
1445                            </h-control>
1446                        </control-connector>
1447
1448                        <control-connector
1449                            ?required=${this._isCompany}
1450                            class="control"
1451                        >
1452                            <h-control>
1453                                <h-control-label class="control__label">
1454                                    <label
1455                                        class="label label_required"
1456                                        for=${this._companyName}
1457                                    >
1458                                        <span
1459                                            class="label__asterisk"
1460                                            aria-hidden="true"
1461                                            >*</span
1462                                        >
1463                                        ${l("Company name")}
1464                                    </label>
1465                                </h-control-label>
1466
1467                                <h-control-content class="control">
1468                                    <h-control-element class="control__element">
1469                                        <h-input
1470                                            controlId=${this._companyName}
1471                                            controlName="companyName"
1472                                            .value=${this.address?.companyName}
1473                                            ?required=${this._isCompany}
1474                                        >
1475                                            <h-input-control></h-input-control>
1476                                        </h-input>
1477                                    </h-control-element>
1478
1479                                    <control-errors></control-errors>
1480                                </h-control-content>
1481                            </h-control>
1482                        </control-connector>`,()=>d)}
1483
1484                <control-connector
1485                    required
1486                    class="control"
1487                >
1488                    <h-control>
1489                        <h-control-label class="control__label">
1490                            <label
1491                                class="label label_required"
1492                                for=${this._phoneId}
1493                            >
1494                                <span
1495                                    class="label__asterisk"
1496                                    aria-hidden="true"
1497                                    >*</span
1498                                >
1499                                ${l("Phone number")}
1500                            </label>
1501                        </h-control-label>
1502
1503                        <h-control-content class="control">
1504                            <h-control-element class="control__element">
1505                                <h-input
1506                                    controlId=${this._phoneId}
1507                                    controlName="phone"
1508                                    .value=${this.address?.phone}
1509                                    required
1510                                >
1511                                    <h-input-control type="tel"></h-input-control>
1512                                </h-input>
1513                            </h-control-element>
1514
1515                            <control-errors></control-errors>
1516                        </h-control-content>
1517                    </h-control>
1518                </control-connector>
1519
1520                <control-connector
1521                    required
1522                    class="control"
1523                >
1524                    <h-control>
1525                        <h-control-label class="control__label">
1526                            <label
1527                                class="label label_required"
1528                                for="${this._countryId}"
1529                                id="${this._countryId}-label"
1530                            >
1531                                <span
1532                                    class="label__asterisk"
1533                                    aria-hidden="true"
1534                                    >*</span
1535                                >
1536                                ${l("Country")}
1537                            </label>
1538                        </h-control-label>
1539
1540                        <h-control-content class="control">
1541                            <h-control-element class="control__element control__element_half">
1542                                <h-select
1543                                    @change=${e=>{const i=e.target?.selectedOptions?.[0]?.value;i&&(this._selectedCountryId=i),i===Q?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this.getFormService()?.revalidateControlWhenReady(this._streetId)}}
1544                                    class="select"
1545                                    control-id=${this._countryId}
1546                                    control-name="countryId"
1547                                    no-deselect
1548                                    ${I(this._countrySelectRef)}
1549                                    .optionsList="${this._allCountries}"
1550                                    assistive-title-id="${this._countryId}-label"
1551                                    ?required=${this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")}
1552                                    ?dev_cached_select_options=${this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")}
1553                                >
1554                                    <h-select-toggler
1555                                        class="select-toggler"
1556                                        aria-labelledby="${this._countryId}-label"
1557                                    >
1558                                        <span
1559                                            class="select-toggler__placeholder"
1560                                            slot="placeholder"
1561                                            >${l("Select")}</span
1562                                        >
1563                                    </h-select-toggler>
1564                                </h-select>
1565                            </h-control-element>
1566
1567                            <control-errors></control-errors>
1568                        </h-control-content>
1569                    </h-control>
1570                </control-connector>
1571
1572                <control-connector
1573                    ?streetWithNumber=${this._selectedCountryId===Q}
1574                    ?required=${this._selectedCountryId!==Q}
1575                    class="control"
1576                >
1577                    <h-control>
1578                        <h-control-label class="control__label">
1579                            <label
1580                                class="label label_required"
1581                                for=${this._streetId}
1582                            >
1583                                <span
1584                                    class="label__asterisk"
1585                                    aria-hidden="true"
1586                                    >*</span
1587                                >
1588                                ${l("Street name and house number")}
1589                            </label>
1590                        </h-control-label>
1591
1592                        <h-control-content class="control">
1593                            <h-control-element class="control__element">
1594                                <h-input
1595                                    controlId=${this._streetId}
1596                                    controlName="street"
1597                                    .value=${this.address?.street}
1598                                    required
1599                                >
1600                                    <h-input-control></h-input-control>
1601                                </h-input>
1602                            </h-control-element>
1603
1604                            <control-errors></control-errors>
1605                        </h-control-content>
1606                    </h-control>
1607                </control-connector>
1608
1609                <control-connector
1610                    required
1611                    class="control"
1612                >
1613                    <h-control>
1614                        <h-control-label class="control__label">
1615                            <label
1616                                class="label label_required"
1617                                for=${this._postalCodeId}
1618                            >
1619                                <span
1620                                    class="label__asterisk"
1621                                    aria-hidden="true"
1622                                    >*</span
1623                                >
1624                                ${l("Postal code")}
1625                            </label>
1626                        </h-control-label>
1627
1628                        <h-control-content class="control">
1629                            <h-control-element class="control__element control__element_quarter">
1630                                <h-input
1631                                    controlId=${this._postalCodeId}
1632                                    controlName="postalCode"
1633                                    .value=${this.address?.zipCode}
1634                                    required
1635                                >
1636                                    <h-input-control
1637                                        @connected="${e=>{e.target===this._postalCodeInputRef.value&&setTimeout(()=>{this._selectedCountryId===Q?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask()},50)}}"
1638                                        ${I(this._postalCodeInputRef)}
1639                                        mask="__-___"
1640                                        mask-disabled=${this._selectedCountryId!==Q||d}
1641                                        pattern="^(\\d{2})(-)(\\d{3})$"
1642                                        valid-pattern="00-000"
1643                                    ></h-input-control>
1644                                </h-input>
1645                            </h-control-element>
1646
1647                            <control-errors></control-errors>
1648                        </h-control-content>
1649                    </h-control>
1650                </control-connector>
1651
1652                <control-connector
1653                    required
1654                    class="control"
1655                >
1656                    <h-control>
1657                        <h-control-label class="control__label">
1658                            <label
1659                                class="label label_required"
1660                                for=${this._cityId}
1661                            >
1662                                <span
1663                                    class="label__asterisk"
1664                                    aria-hidden="true"
1665                                    >*</span
1666                                >
1667                                ${l("City")}
1668                            </label>
1669                        </h-control-label>
1670
1671                        <h-control-content class="control">
1672                            <h-control-element class="control__element">
1673                                <h-input
1674                                    controlId=${this._cityId}
1675                                    controlName="city"
1676                                    .value=${this.address?.city}
1677                                    required
1678                                >
1679                                    <h-input-control></h-input-control>
1680                                </h-input>
1681                            </h-control-element>
1682
1683                            <control-errors></control-errors>
1684                        </h-control-content>
1685                    </h-control>
1686                </control-connector>
1687
1688                ${M(this._isRegistrationEnabled,r` <control-connector
1689                        class="control"
1690                        ?required=${$(this._isRegistrationRequired)}
1691                    >
1692                        <h-control>
1693                            <h-control-content class="control">
1694                                <h-control-element class="control__element">
1695                                    <h-checkbox
1696                                        controlId=${this._createUserAccountId}
1697                                        controlName="createUserAccount"
1698                                        value="1"
1699                                        ?required=${$(this._isRegistrationRequired)}
1700                                    >
1701                                        <h-checkbox-control></h-checkbox-control>
1702
1703                                        <h-checkbox-content>
1704                                            ${M(this._isBuyingEnabledToUnregistered,r`<span slot="label">${l("I want to create an account in the store")}</span>`,r`
1705                                                    <span
1706                                                        slot="label"
1707                                                        class="label_required"
1708                                                    >
1709                                                        <span
1710                                                            class="label__asterisk"
1711                                                            aria-hidden="true"
1712                                                            >*</span
1713                                                        >
1714                                                        ${l("I want to create an account in the store")}
1715                                                    </span>
1716                                                `)}
1717
1718                                            <div slot="description">
1719                                                <p class="p_no-margin">
1720                                                    ${M(this._isBuyingEnabledToUnregistered,r`${l("Optional")}`,d)}
1721                                                </p>
1722                                                <p class="p_no-margin">
1723                                                    ${l("You will receive a link to create a password by e-mail.")}
1724                                                </p>
1725                                            </p>
1726                                        </h-checkbox-content>
1727                                    </h-checkbox>
1728                                </h-control-element>
1729
1730                                <control-errors></control-errors>
1731                            </h-control-content>
1732                        </h-control>
1733                    </control-connector>`,d)}
1734            </form>
1735        </reactive-form>`}render(){return r`
1736            ${M(this._isBuyingEnabledToUnregistered,d,this._renderMandatoryAccountCreationInfo())} ${this._renderForm()}
1737        `}}X([p()],W.prototype,"addressMode");X([p()],W.prototype,"address");X([p()],W.prototype,"isLoggedIn");X([p({type:Object})],W.prototype,"formErrors");X([u()],W.prototype,"_allCountries");X([u()],W.prototype,"_isCompany");X([u()],W.prototype,"_userEmail");X([u()],W.prototype,"_translations");X([u()],W.prototype,"_displayConsumerRadio");X([u()],W.prototype,"_displayCompanyRadio");X([u()],W.prototype,"_selectedCountryId");var En=Object.defineProperty,yt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&En(e,t,s),s};class He extends f{constructor(){super(),this.address=null,this.isLoggedIn=!1,this.formErrors=null,this._selectedCountryId=Q,this._reactiveFormRef=P(),this._postalCodeInputRef=P(),this._countrySelectRef=P(),this._formId=`form-${v()}`,this._firstNameId=`first-name-${v()}`,this._lastNameId=`last-name-${v()}`,this._phoneId=`phone-${v()}`,this._countryId=`country-${v()}`,this._streetId=`street-${v()}`,this._postalCodeId=`postal-code-${v()}`,this._cityId=`city-${v()}`,this._companyName=`company-name-${v()}`,this._getCountriesList$=()=>this._basketShippingsApi.selectAvailableShippingCountries$().pipe(A(e=>{const t=e.map(s=>({value:String(s.id),content:s.name,selected:String(s.id)===this._selectedCountryId}
1737));return!t.some(s=>s.selected)&&t.length>0&&(t[0].selected=!0,this._selectedCountryId=t[0].value),t})),this.setShippingAddress=async e=>{e.preventDefault();const t=await this.getFormValues();return t&&this.getFormState()!==Pe.validationFailed?this._basketAddressesApi.setShippingAddress({isCompany:!1,companyName:t.companyName,firstName:t.firstName,lastName:t.lastName,personalIdNumber:"",taxId:"",countryId:Number(t.countryId),city:t.city,postalCode:t.postalCode,street:t.street,street2:"",phone:t.phone,state:"",createUserAccount:!1}):!1},this.getFormValues=async()=>{const e=this.getFormService(),t=e.getFormControls();await e.validateControls({focusOnFirstInvalidField:!1});const i={};return t.forEach(s=>{s.value===null||s.value===void 0||(s.type==="radio"?s.checked&&(i[s.name]=s.value):i[s.name]=s.value)}),i},this._storefrontSettings=this.getApiSync(L.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._basketShippingsApi=this.getApiSync(Ce.api),this._orderApi=this.getApiSync(Re.api)}static{this.moduleName="shipping-address-form"}firstUpdated(e){super.firstUpdated(e),this._selectedCountryId=this.address?.countryId?String(this.address?.countryId):this._selectedCountryId,this._orderApi.addOrderValidation(()=>document.querySelector("reactive-form")?.formService.getFormState()!==Pe.validationFailed,()=>{this.scrollIntoView()})}updated(e){if(super.updated(e),this.formErrors){const t=we.fromJson(this.formErrors);if(t)for(const[i,s]of Object.entries(t))this.getFormService().updateFormControlByName(i,{errors:s})}}getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}getFormState(){return this.getFormService().getFormState()}async checkValidity(){try{return await this.getFormService().checkValidity()}catch{return!1}}focusFirstInput(){setTimeout(()=>{this._reactiveFormRef.value?.querySelector('input[type="text"]')?.focus()})}render(){return r` <reactive-form ${I(this._reactiveFormRef)}>
1738            <form
1739                id=${this._formId}
1740                @submit=${this.setShippingAddress}
1741            >
1742                <div
1743                    class="form__additional-info mt-xs-0"
1744                    aria-hidden="true"
1745                >
1746                    <i>
1747                        ${l("Required fields are marked with")} -
1748                        <span class="form__additional-info_secondary">*</span>
1749                    </i>
1750                </div>
1751
1752                <control-connector
1753                    required
1754                    class="control"
1755                >
1756                    <h-control>
1757                        <h-control-label class="control__label">
1758                            <label
1759                                class="label label_required"
1760                                for=${this._firstNameId}
1761                            >
1762                                <span
1763                                    class="label__asterisk"
1764                                    aria-hidden="true"
1765                                    >*</span
1766                                >
1767                                ${l("First name")}
1768                            </label>
1769                        </h-control-label>
1770
1771                        <h-control-content class="control">
1772                            <h-control-element class="control__element">
1773                                <h-input
1774                                    controlId=${this._firstNameId}
1775                                    controlName="firstName"
1776                                    .value=${this.address?.firstName}
1777                                >
1778                                    <h-input-control></h-input-control>
1779                                </h-input>
1780                            </h-control-element>
1781
1782                            <control-errors></control-errors>
1783                        </h-control-content>
1784                    </h-control>
1785                </control-connector>
1786
1787                <control-connector
1788                    required
1789                    class="control"
1790                >
1791                    <h-control>
1792                        <h-control-label class="control__label">
1793                            <label
1794                                class="label label_required"
1795                                for=${this._lastNameId}
1796                            >
1797                                <span
1798                                    class="label__asterisk"
1799                                    aria-hidden="true"
1800                                    >*</span
1801                                >
1802                                ${l("Last name")}
1803                            </label>
1804                        </h-control-label>
1805
1806                        <h-control-content class="control">
1807                            <h-control-element class="control__element">
1808                                <h-input
1809                                    controlId=${this._lastNameId}
1810                                    controlName="lastName"
1811                                    .value=${this.address?.lastName}
1812                                >
1813                                    <h-input-control></h-input-control>
1814                                </h-input>
1815                            </h-control-element>
1816
1817                            <control-errors></control-errors>
1818                        </h-control-content>
1819                    </h-control>
1820                </control-connector>
1821
1822                <control-connector class="control">
1823                    <h-control>
1824                        <h-control-label class="control__label">
1825                            <label
1826                                class="label"
1827                                for=${this._companyName}
1828                                >${l("Company name")}</label
1829                            >
1830                        </h-control-label>
1831
1832                        <h-control-content class="control">
1833                            <h-control-element class="control__element">
1834                                <h-input
1835                                    controlId=${this._companyName}
1836                                    controlName="companyName"
1837                                    .value=${this.address?.companyName}
1838                                >
1839                                    <h-input-control></h-input-control>
1840                                </h-input>
1841                            </h-control-element>
1842
1843                            <control-errors></control-errors>
1844                        </h-control-content>
1845                    </h-control>
1846                </control-connector>
1847
1848                <control-connector
1849                    required
1850                    class="control"
1851                >
1852                    <h-control>
1853                        <h-control-label class="control__label">
1854                            <label
1855                                class="label label_required"
1856                                for=${this._phoneId}
1857                            >
1858                                <span
1859                                    class="label__asterisk"
1860                                    aria-hidden="true"
1861                                    >*</span
1862                                >
1863                                ${l("Phone number")}
1864                            </label>
1865                        </h-control-label>
1866
1867                        <h-control-content class="control">
1868                            <h-control-element class="control__element">
1869                                <h-input
1870                                    controlId=${this._phoneId}
1871                                    controlName="phone"
1872                                    .value=${this.address?.phone}
1873                                >
1874                                    <h-input-control type="tel"></h-input-control>
1875                                </h-input>
1876                            </h-control-element>
1877
1878                            <control-errors></control-errors>
1879                        </h-control-content>
1880                    </h-control>
1881                </control-connector>
1882
1883                <control-connector
1884                    required
1885                    class="control"
1886                >
1887                    <h-control>
1888                        <h-control-label class="control__label">
1889                            <label
1890                                class="label label_required"
1891                                for="${this._countryId}"
1892                                id="${this._countryId}-label"
1893                            >
1894                                <span
1895                                    class="label__asterisk"
1896                                    aria-hidden="true"
1897                                    >*</span
1898                                >
1899                                ${l("Country")}
1900                            </label>
1901                        </h-control-label>
1902
1903                        <h-control-content class="control">
1904                            <h-control-element class="control__element">
1905                                <shipping-address-country-select
1906                                    ${I(this._countrySelectRef)}
1907                                    @enableMask="${()=>{this._postalCodeInputRef.value?.enableMask()}}"
1908                                    @disableMask="${()=>{this._postalCodeInputRef.value?.disableMask()}}"
1909                                    @change="${()=>{const e=this._countrySelectRef.value?.getSelectedValue();e&&(this._selectedCountryId=e,this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this.getFormService()?.revalidateControlWhenReady(this._streetId))}}"
1910                                    .address=${this.address}
1911                                    .countries="${$(this._getCountriesList$())}"
1912                                    aria-labelledby="${this._countryId}-label"
1913                                ></shipping-address-country-select>
1914                            </h-control-element>
1915
1916                            <control-errors></control-errors>
1917                        </h-control-content>
1918                    </h-control>
1919                </control-connector>
1920                <control-connector
1921                    ?streetWithNumber=${this._selectedCountryId===Q}
1922                    ?required=${this._selectedCountryId!==Q}
1923                    class="control"
1924                >
1925                    <h-control>
1926                        <h-control-label class="control__label">
1927                            <label
1928                                class="label label_required"
1929                                for=${this._streetId}
1930                            >
1931                                <span
1932                                    class="label__asterisk"
1933                                    aria-hidden="true"
1934                                    >*</span
1935                                >
1936                                ${l("Street name and house number")}
1937                            </label>
1938                        </h-control-label>
1939
1940                        <h-control-content class="control">
1941                            <h-control-element class="control__element">
1942                                <h-input
1943                                    controlId=${this._streetId}
1944                                    controlName="street"
1945                                    .value=${this.address?.street}
1946                                >
1947                                    <h-input-control></h-input-control>
1948                                </h-input>
1949                            </h-control-element>
1950
1951                            <control-errors></control-errors>
1952                        </h-control-content>
1953                    </h-control>
1954                </control-connector>
1955
1956                <control-connector
1957                    required
1958                    class="control"
1959                >
1960                    <h-control>
1961                        <h-control-label class="control__label">
1962                            <label
1963                                class="label label_required"
1964                                for=${this._postalCodeId}
1965                            >
1966                                <span
1967                                    class="label__asterisk"
1968                                    aria-hidden="true"
1969                                    >*</span
1970                                >
1971                                ${l("Postal code")}
1972                            </label>
1973                        </h-control-label>
1974
1975                        <h-control-content class="control">
1976                            <h-control-element class="control__element control__element_half">
1977                                <h-input
1978                                    controlId=${this._postalCodeId}
1979                                    controlName="postalCode"
1980                                    .value=${this.address?.zipCode}
1981                                >
1982                                    <h-input-control
1983                                        @connected="${e=>{e.target===this._postalCodeInputRef.value&&setTimeout(()=>{this._countrySelectRef.value?.getSelectedValue?.()==="179"?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask()},50)}}"
1984                                        ${I(this._postalCodeInputRef)}
1985                                        mask="__-___"
1986                                        mask-disabled=${this._countrySelectRef.value?.getSelectedValue?.()!=="179"||d}
1987                                        pattern="^(\\d{2})(-)(\\d{3})$"
1988                                        valid-pattern="00-000"
1989                                    ></h-input-control>
1990                                </h-input>
1991                            </h-control-element>
1992
1993                            <control-errors></control-errors>
1994                        </h-control-content>
1995                    </h-control>
1996                </control-connector>
1997
1998                <control-connector
1999                    required
2000                    class="control"
2001                >
2002                    <h-control>
2003                        <h-control-label class="control__label">
2004                            <label
2005                                class="label label_required"
2006                                for=${this._cityId}
2007                            >
2008                                <span
2009                                    class="label__asterisk"
2010                                    aria-hidden="true"
2011                                    >*</span
2012                                >
2013                                ${l("City")}
2014                            </label>
2015                        </h-control-label>
2016
2017                        <h-control-content class="control">
2018                            <h-control-element class="control__element">
2019                                <h-input
2020                                    controlId=${this._cityId}
2021                                    controlName="city"
2022                                    .value=${this.address?.city}
2023                                >
2024                                    <h-input-control></h-input-control>
2025                                </h-input>
2026                            </h-control-element>
2027
2028                            <control-errors></control-errors>
2029                        </h-control-content>
2030                    </h-control>
2031                </control-connector>
2032            </form>
2033        </reactive-form>`}}yt([p()],He.prototype,"address");yt([p()],He.prototype,"isLoggedIn");yt([p({type:Object})],He.prototype,"formErrors");yt([u()],He.prototype,"_selectedCountryId");var Bn=Object.defineProperty,xn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Bn(e,t,s),s};class xs extends f{constructor(){super(...arguments),this._modal=P(),this.shippings=[],this._close=()=>{this.close()}}static{this.moduleName="shipping-list-modal"}connectedCallback(){super.connectedCallback(),window.addEventListener("shippingSelected",this._close)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("shippingSelected",this._close)}open(){this._modal.value?.open()}close(){this._modal.value?.close()}render(){return r`<h-modal
2034            ${I(this._modal)}
2035            hidden
2036        >
2037            <h-modal-header>
2038                <b class="font_semibold">${l("Select a delivery method")}</b>
2039                <h-modal-close
2040                    aria-label="${l("Close window")}"
2041                    class="btn btn_icon"
2042                >
2043                    <h-icon
2044                        icon-name="icon-x"
2045                        role="button"
2046                        size="xl"
2047                        clickable
2048                    ></h-icon>
2049                </h-modal-close>
2050            </h-modal-header>
2051            <h-modal-body>
2052                <div class="pb-xs-4">
2053                    <basket-shippings-list
2054                        is-simple="true"
2055                        .shippings=${this.shippings}
2056                    ></basket-shippings-list>
2057                </div>
2058            </h-modal-body>
2059        </h-modal>`}}xn([p()],xs.prototype,"shippings");const Fn="basket-additional-informations";class Mn{constructor({basketOverallApi:e}){this._changeComment$=new li,this._changeComment$.pipe(k(),A(t=>t.target?.value)).subscribe(async t=>{await e.setComment(t)})}changeComment(e){this._changeComment$.next(e)}}class Tn extends f{constructor(){super(),this._commentId=`comment-${v()}`,this._basketOverallApi=this.getApiSync(H.api),this._controller=new Mn({basketOverallApi:this._basketOverallApi})}static{this.moduleName=Fn}render(){return r`
2060            <h-control>
2061                <h-control-label class="control__label">
2062                    <label
2063                        class="label"
2064                        for=${this._commentId}
2065                        >${l("Order notes")}</label
2066                    >
2067                </h-control-label>
2068
2069                <h-control-content class="control">
2070                    <h-control-element class="control__element">
2071                        <h-textarea
2072                            controlId=${this._commentId}
2073                            controlName="comment"
2074                            @change=${e=>this._controller.changeComment(e)}
2075                            .value=${$(this._basketOverallApi.selectComment$())}
2076                        >
2077                            <h-textarea-control></h-textarea-control>
2078                        </h-textarea>
2079                    </h-control-element>
2080
2081                    <control-errors></control-errors>
2082                </h-control-content>
2083            </h-control>
2084        `}}var On=Object.defineProperty,Fs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&On(e,t,s),s};class Gt extends f{constructor(){super(...arguments),this._modal=P(),this.payments=[],this.ctaPaymentLabel=""}static{this.moduleName="payments-list-modal"}open(){this._modal.value?.open()}close(){this._modal.value?.close()}
2084render(){return r`<h-modal
2085            class="modal-wrapper_l modal_payment-list"
2086            ${I(this._modal)}
2087            hidden
2088        >
2089            <h-modal-header>
2090                <h2 class="font_semibold h2">
2091                    ${g(this.ctaPaymentLabel.length>0,()=>r`${this.ctaPaymentLabel}`,()=>r`${l("Select payment bank or service")}`)}
2092                </h2>
2093                <h-modal-close
2094                    aria-label="${l("Close window")}"
2095                    class="btn btn_icon"
2096                >
2097                    <h-icon
2098                        icon-name="icon-x"
2099                        role="button"
2100                        size="xl"
2101                        clickable
2102                    ></h-icon>
2103                </h-modal-close>
2104            </h-modal-header>
2105            <h-modal-body>
2106                <payments-list-options
2107                    .payments=${this.payments}
2108                    .onPaymentSet=${()=>this.close()}
2109                ></payments-list-options>
2110            </h-modal-body>
2111        </h-modal>`}}Fs([p()],Gt.prototype,"payments");Fs([p()],Gt.prototype,"ctaPaymentLabel");var Ln=Object.defineProperty,Nn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Ln(e,t,s),s};class Ms extends f{constructor(){super(...arguments),this.payments=[]}static{this.moduleName="payments-list-popular"}render(){return r`<payments-list-options additionalClass="payments-channels-list_popular" .payments=${this.payments}></payments-list-options>`}}Nn([p()],Ms.prototype,"payments");var Vn=Object.defineProperty,qt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Vn(e,t,s),s};class bt extends f{constructor(){super(),this.payments=[],this.onPaymentSet=()=>{},this.additionalClass="",this._basketPaymentsApi=this.getApiSync(Ie.api)}static{this.moduleName="payments-list-options"}_setPayment(e){this._basketPaymentsApi.setPayment(e),this.eventBus.emit(new m(G.paymentChosenByUser)),this.onPaymentSet()}render(){return this.payments.length===0?d:r`<div class="payments-channels-list pb-xs-4 ${this.additionalClass}">
2112            ${this.payments.map(e=>r`<div
2113                    @click=${()=>{this._setPayment(e)}}
2114                    class="${ee({"payment-channel":!0,"payment-channel_selected":e.isSelected})}"
2115                >
2116                    ${g(e.image,()=>r`<figure class="payment-channel__image">
2117                            <img
2118                                alt="${e.name}"
2119                                src="${e.image}"
2120                                width="200"
2121                                height="70"
2122                            />
2123                        </figure> `,()=>r`<p>${e.name}</p>`)}
2124                </div>`)}
2125        </div>`}}qt([p({attribute:!1})],bt.prototype,"payments");qt([p({attribute:!1})],bt.prototype,"onPaymentSet");qt([p({type:String})],bt.prototype,"additionalClass");var Rn=Object.defineProperty,Ts=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Rn(e,t,s),s};class zt extends f{constructor(){super(),this._additionalFields=[],this._flashMessengerRef=P(),this._isValid=!0,this._storefrontSettings=this.getApiSync(L.api),this._basketOverallApi=this.getApiSync(H.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._basketAdditionalFieldsApi=this.getApiSync(ds.api),this._flashMessengerApi=this.getApiSync(ae.api),this._basketAdditionalFieldsApi.select$().pipe(A(t=>Object.values(t).reduce((s,a)=>[...s,...a],[]).sort((s,a)=>s.order-a.order))).subscribe(t=>{this._additionalFields=t}),this._canChangeAdditionalFields$=this._basketOverallApi.selectActions$().pipe(A(t=>t.changeAdditionalFields===void 0)),this._isCompany$=this._basketAddressesApi.selectIsCompany$(),this._isCompany$.subscribe(t=>{if(t||!this._storefrontSettings.isFeatureEnabled("dev_vat_eu_visibility_fix"))return;const i=this._additionalFields.find(s=>s instanceof Ze&&s.id==="vat_eu");i?.isChecked&&this._basketAdditionalFieldsApi.change(i.id,"0")}),this._basketAdditionalFieldsApi.selectSectionValidation$().subscribe(({isValid:t})=>{t?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),this._isValid=t}),this._basketAdditionalFieldsApi.selectSectionValidation$().subscribe(({isValid:t,validationMessage:i})=>{if(!i)return;const s="basket-additional-fields";if(t){this._flashMessengerApi.removeAllFlashMessages(s);return}this._flashMessengerApi.addFlashMessage({content:i,type:z.error,isCloseable:!1,timeout:0},s),this._flashMessengerRef.value?.focus()})}static{this.moduleName="basket-additional-fields"}
2125_renderSelect(e){return r`
2126            <h-control class="control">
2127                <h-control-label class="control__label">
2128                    <label
2129                        class="${ee({label:!0,label_required:e.isRequired})}"
2130                        for=${`additional_${e.id}`}
2131                        id="additional_${e.id}-label"
2132                    >
2133                        ${e.isRequired?r`<span
2134                                  class="label__asterisk"
2135                                  aria-hidden="true"
2136                                  >*</span
2137                              >`:d}
2138                        ${j(e.description)}
2139                    </label>
2140                </h-control-label>
2141
2142                <h-control-content class="control">
2143                    <h-control-element class="control__element">
2144                        <h-select
2145                            class="select"
2146                            @change=${t=>{const s=t.target.selectedOptions[0]?.value||null;this._basketAdditionalFieldsApi.change(e.id,s)}}
2147                            control-id=${`additional_${e.id}`}
2148                            control-name=${`additional_${e.id}`}
2149                            ?disabled=${$(this._canChangeAdditionalFields$)}
2150                            ?required=${e.isRequired}
2151                            assistive-title-id="additional_${e.id}-label"
2152                        >
2153                            <h-select-toggler
2154                                class="select-toggler"
2155                                aria-labelledby="additional_${e.id}-label"
2156                            >
2157                                <span
2158                                    class="select-toggler__placeholder"
2159                                    slot="placeholder"
2160                                    >${l("Select")}</span
2161                                >
2162                            </h-select-toggler>
2163
2164                            ${$e(e.options,t=>t.value,t=>r` <h-option
2165                                        slot="content"
2166                                        value=${t.value}
2167                                        id="additional_${e.id}_${t.value}"
2168                                        ?selected=${t.isSelected}
2169                                    >
2170                                        <h-option-content>${t.label}</h-option-content>
2171                                    </h-option>`)}
2172                        </h-select>
2173                    </h-control-element>
2174                </h-control-content>
2175            </h-control>
2176        `}_renderDescription(e){return r` <p class="font_size-s">${j(e.description)}</p>`}_renderCheckbox(e){return r`
2177            <h-control class="control">
2178                <h-control-content class="control">
2179                    <h-control-element class="control__element">
2180                        <h-checkbox
2181                            @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}}
2182                            controlId=${`additional_${e.id}`}
2183                            controlName=${`additional_${e.id}`}
2184                            ?checked=${e.isChecked}
2185                            value="1"
2186                            ?disabled=${$(this._canChangeAdditionalFields$)}
2187                            ?required=${e.isRequired}
2188                        >
2189                            <h-checkbox-control></h-checkbox-control>
2190
2191                            <h-checkbox-content>
2192                                <span
2193                                    class="${ee({label_required:e.isRequired})}"
2194                                    slot="label"
2195                                >
2196                                    ${e.isRequired?r`<span
2197                                              class="label__asterisk"
2198                                              aria-hidden="true"
2199                                              >*</span
2200                                          >`:d}
2201                                    ${j(e.description)}
2202                                </span>
2203                            </h-checkbox-content>
2204                        </h-checkbox>
2205                    </h-control-element>
2206                </h-control-content>
2207            </h-control>
2208        `}_renderCheckboxVatEU(e){return r`
2209            <h-control
2210                class="control"
2211                ?hidden=${$(this._isCompany$.pipe(A(t=>!t)))}
2212            >
2213                <h-control-content class="control">
2214                    <h-control-element class="control__element">
2215                        <h-checkbox
2216                            @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}}
2217                            controlId=${`additional_${e.id}`}
2218                            controlName=${`additional_${e.id}`}
2219                            ?checked=${e.isChecked}
2220                            value="1"
2221                            ?disabled=${$(this._canChangeAdditionalFields$)}
2222                            ?required=${e.isRequired}
2223                        >
2224                            <h-checkbox-control></h-checkbox-control>
2225
2226                            <h-checkbox-content>
2227                                <span
2228                                    class="${ee({label_required:e.isRequired})}"
2229                                    slot="label"
2230                                >
2231                                    ${e.isRequired?r`<span
2232                                              class="label__asterisk"
2233                                              aria-hidden="true"
2234                                              >*</span
2235                                          >`:d}
2236                                    ${j(e.description)}
2237                                </span>
2238                            </h-checkbox-content>
2239                        </h-checkbox>
2240                    </h-control-element>
2241                </h-control-content>
2242            </h-control>
2243        `}_renderCheckboxNewsletter(e){return r`
2244            <h-control class="control">
2245                <h-control-content class="control">
2246                    <h-control-element class="control__element">
2247                        <h-checkbox
2248                            @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}}
2249                            controlId=${`additional_${e.id}`}
2250                            controlName=${`additional_${e.id}`}
2251                            ?checked=${e.isChecked}
2252                            value="1"
2253                            ?disabled=${$(this._canChangeAdditionalFields$)}
2254                            ?required=${e.isRequired}
2255                        >
2256                            <h-checkbox-control></h-checkbox-control>
2257
2258                            <h-checkbox-content>
2259                                <span
2260                                    class="${ee({label_required:e.isRequired})}"
2261                                    slot="label"
2262                                >
2263                                    ${e.isRequired?r`<span
2264                                              class="label__asterisk"
2265                                              aria-hidden="true"
2266                                              >*</span
2267                                          >`:d}
2268                                    ${j(e.label)}
2269                                </span>
2270
2271                                <span slot="description">${j(e.description)}</span>
2272                            </h-checkbox-content>
2273                        </h-checkbox>
2274                    </h-control-element>
2275                </h-control-content>
2276            </h-control>
2277        `}_renderTextInput(e){return r`
2278            <h-control class="control">
2279                <h-control-label class="control__label">
2280                    <label
2281                        class="${ee({label:!0,label_required:e.isRequired})}"
2282                        for=${`additional_${e.id}`}
2283                    >
2284                        ${e.isRequired?r`<span
2285                                  class="label__asterisk"
2286                                  aria-hidden="true"
2287                                  >*</span
2288                              >`:d}
2289                        ${j(e.description)}
2290                    </label>
2291                </h-control-label>
2292
2293                <h-control-content class="control">
2294                    <h-control-element class="control__element">
2295                        <h-input
2296                            @change=${t=>{if(t.isTrusted){const i=t.target;this._basketAdditionalFieldsApi.change(e.id,i.value)}}}
2297                            controlId=${`additional_${e.id}`}
2298                            controlName=${`additional_${e.id}`}
2299                            value=${e.value}
2300                            ?disabled=${$(this._canChangeAdditionalFields$)}
2301                        >
2302                            <h-input-control></h-input-control>
2303                        </h-input>
2304                    </h-control-element>
2305                </h-control-content>
2306            </h-control>
2307        `}_renderHiddenInput(e){return r`
2308            <h-input
2309                @change=${t=>{const i=t.target;this._basketAdditionalFieldsApi.change(e.id,i.value)}}
2310                type="hidden"
2311                controlId=${`additional_${e.id}`}
2312                controlName=${`additional_${e.id}`}
2313                value=${e.value}
2314                ?disabled=${$(this._canChangeAdditionalFields$)}
2315            >
2316                <h-input-control type="hidden"></h-input-control>
2317            </h-input>
2318        `}_renderFileInput(e){return r` <h-control class="control">
2319            <h-control-label class="control__label">
2320                <label
2321                    class="${ee({label:!0,label_required:e.isRequired})}"
2322                    for=${`additional_${e.id}`}
2323                >
2324                    ${e.isRequired?r`<span
2325                              class="label__asterisk"
2326                              aria-hidden="true"
2327                              >*</span
2328                          >`:d}
2329                    ${j(e.description)}
2330                </label>
2331            </h-control-label>
2332
2333            <h-control-content class="control">
2334                <h-control-element class="control__element">
2335                    <h-file-picker
2336                        @change=${async t=>{this._uploadFile(t,e)}}
2337                        ?required=${e.isRequired}
2338                        class="file-picker"
2339                        control-id="${`additional_${e.id}`}"
2340                        control-name="${`additional_${e.id}`}"
2341                        label-text="${l("Upload file")}"
2342                        files=""
2343                    ></h-file-picker>
2344                </h-control-element>
2345            </h-control-content>
2346        </h-control>`}async _uploadFile(e,t){const i=e.target,{files:s}=i,a=s?s[0]:null;if(a){const o=await this._basketAdditionalFieldsApi.upload(t,a);o&&o.isError===!1&&this._basketAdditionalFieldsApi.change(t.id,{fileKey:o.fileKey,fileName:a.name})}else this._basketAdditionalFieldsApi.change(t.id,null)}_renderAdditionalField(e){return e instanceof mi?this._renderSelect(e):e instanceof _i?this._renderDescription(e):this._storefrontSettings.isFeatureEnabled("dev_vat_eu_visibility_fix")&&e.id==="vat_eu"&&e instanceof Ze?this._renderCheckboxVatEU(e):e.id==="newsletter"&&e instanceof Ze?this._renderCheckboxNewsletter(e):e instanceof Ze?this._renderCheckbox(e):e instanceof gi?this._renderTextInput(e):e instanceof yi?this._renderHiddenInput(e):e instanceof bi?this._renderFileInput(e):d}render(){return r` <div class="basket-module__content">
2347            <flash-messenger
2348                ${I(this._flashMessengerRef)}
2349                class="d-block mb-xs-2"
2350                name="basket-additional-fields"
2351                tabindex="-1"
2352            ></flash-messenger>
2353
2354            <h2 class="section-title section-title_s mb-xs-2">${l("Consents and additional fields")}</h2>
2355
2356            <form class="form">
2357                ${$e(this._additionalFields,e=>e.id,e=>this._renderAdditionalField(e))}
2358            </form>
2359        </div>`}}Ts([u()],zt.prototype,"_additionalFields");
2359Ts([u()],zt.prototype,"_isValid");var Dn=Object.defineProperty,R=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Dn(e,t,s),s};class V extends f{constructor(){super(),this.url="",this._productName="",this._hasOptions=!1,this._options=[],this._productImage="",this._quantity=0,this._unit="",this._productPrice="",this._productVat="",this._productLikeAdded="",this._basketPositions=0,this._basketPricesSum="",this._hasSpecialOffer=!1,this._shouldDisplayProductVat=!1,this._shouldDisplayBasketVat=!1,this._isLoyalty=!1,this._isBundle=!1,this._modal=P(),this.eventBus.on(S.itemAddedToBasket,({body:e})=>{if(!e)return;const{addedItem:t,product:i,basket:s,showAddedModal:a}=e;!i||!a||(this.open(),this._productName=i.name,this._hasOptions=i?.hasOptions,this._options=i?.options,this._productImage=i.image.paths.webp,this._quantity=t.addedQuantity,this._unit=i.unit.name,this._productPrice=i.price.grossValueFormatted,this._productVat=i.price.taxFormatted,this._productLikeAdded=i.quantity.toString(),this._productLoyaltyPointsCost=i.loyaltyPointsCost?.pointsFormatted,this._productLoyaltyPointsExchangePrice=i.loyaltyPointsExchangePrice?.grossValueFormatted,this._basketPositions=s.products.positions,this._basketPricesSum=s.products.discountedSum?.grossValueFormatted||s.products.sum?.grossValueFormatted||"",this._basketLoyaltyPointsCost=s.loyaltyPointsCost?.pointsFormatted,this._hasSpecialOffer=i.isSpecialOffer,this._isLoyalty=i.isExchangedWithLoyaltyPoints,this._shouldDisplayProductVat=i.isExchangedWithLoyaltyPoints&&!!i.loyaltyPointsExchangePrice||!i.isExchangedWithLoyaltyPoints,this._shouldDisplayBasketVat=s.sum.grossValue>0,this._isBundle=i.isBundle)})}static{this.moduleName="added-to-basket-modal"}open(){this._modal.value?.open()}render(){return r`
2360            <h-modal
2361                ${I(this._modal)}
2362                id="after_added_to_basket"
2363                class="added-to-basket-modal__container"
2364            >
2365                <h-modal-header>
2366                    <h2 class="modal__title">${l("Added to cart")}</h2>
2367
2368                    <h-modal-close
2369                        aria-label="${l("Close window")}"
2370                        class="btn btn_icon"
2371                    >
2372                        <h-icon
2373                            icon-name="icon-x"
2374                            role="button"
2375                            size="xl"
2376                            clickable
2377                        ></h-icon>
2378                    </h-modal-close>
2379                </h-modal-header>
2380                <h-modal-body class="added-to-basket-modal__h-modal-paddings">
2381                    <figure class="align_center">
2382                        <img
2383                            class="added-to-basket-modal_preview-image"
2384                            src=${this._productImage}
2385                            alt=""
2386                            width=""
2387                        />
2388                    </figure>
2389                    <div class="d-flex added-to-basket-modal__generic_wrap">
2390                        <span class="mr-xs-1 font_semibold added-to-basket-modal_quantity-badge"
2391                            >${this._quantity} ${this._isBundle?"x":d} ${this._unit}</span
2392                        >
2393                        <p class="font_semibold added-to-basket-modal_product-name">${this._productName}</p>
2394                    </div>
2395
2396                    ${this._hasOptions?r` <ul class="added-to-basket-modal__options">
2397                              ${this._options.map(e=>r` <li
2398                                      data-option-name="${e.name}"
2399                                      data-option-value="${e.value}"
2400                                  >
2401                                      ${e.name}: <span class="font_semibold">${e.value}</span>
2402                                  </li>`)}
2403                          </ul>`:d}
2404                    ${this._isLoyalty?r`
2405                              <div class="tag tag_quaternary mb-xs-2">
2406                                  <span class="overline overline_s mb-xs-0 color_secondary"> ${l("loyalty program")} </span>
2407                              </div>
2408                          `:d}
2409                    <p>
2410                        <span class="sr-only">${l("Price")}</span>
2411                        <span class="price__value font_semibold">
2412                            ${this._productLoyaltyPointsCost?this._productLoyaltyPointsCost:this._productPrice}
2413                            ${this._productLoyaltyPointsExchangePrice?`+ ${this._productLoyaltyPointsExchangePrice}`:d}
2414                        </span>
2415                        ${this._shouldDisplayProductVat?r`
2416                                  <span
2417                                      class="vat-info"
2418                                      aria-label="${l("incl.")} ${this._productVat} VAT"
2419                                  >
2420                                      <span aria-hidden="true">${l("incl.")}</span>
2421                                      <span aria-hidden="true">${this._productVat}</span>
2422                                      <span aria-hidden="true">VAT</span>
2423                                  </span>
2424                              `:d}
2425                    </p>
2426
2427                    <div class="d-flex p-all-xs-1 added-to-basket-modal_quantity-summary">
2428                        <p class="added-to-basket-modal__generic_reset-bottom-margins added-to-basket-modal__generic_margin-right">
2429                            ${l("Quantity of this product in the basket")}:
2430                            <span class="font_semibold">${this._productLikeAdded} ${this._unit}</span>
2431                        </p>
2432                    </div>
2433
2434                    <div
2435                        class="separator"
2436                        aria-hidden="true"
2437                    ></div>
2438
2439                    <p class="added-to-basket-modal__customized-paragraph">
2440                        ${l("Total items in cart")}: <span class="font_semibold">${this._basketPositions}</span>
2441                    </p>
2442
2443                    <p class="added-to-basket-modal__customized-paragraph">
2444                        ${l("Cart value")}:
2445                        ${this._basketLoyaltyPointsCost?r`<span class="font_semibold">${this._basketLoyaltyPointsCost}.</span> +`:d}
2446                        <span class="font_semibold">${this._basketPricesSum}</span>
2447                        ${this._shouldDisplayBasketVat?r`${l("incl. VAT")} `:d}
2448                    </p>
2449                </h-modal-body>
2450                <h-modal-footer class="grid grid__col grid__col_xs-vcenter grid__col_xs-hcenter added-to-basket-modal__h-modal-paddings">
2451                    <a
2452                        href="${this.url}"
2453                        class="btn btn_primary mb-sm-2 btn_full-width added-to-basket-modal_button"
2454                        >${l("Go to shopping cart")}</a
2455                    >
2456                    <h-modal-close class="full-width">
2457                        <button class="btn btn_secondary btn_full-width added-to-basket-modal_button">${l("Keep browsing")}</button>
2458                    </h-modal-close>
2459                </h-modal-footer>
2460            </h-modal>
2461        `}}R([p({type:String})],V.prototype,"url");R([u()],V.prototype,"_productName");R([u()],V.prototype,"_hasOptions");R([u()],V.prototype,"_options");R([u()],V.prototype,"_productImage");R([u()],V.prototype,"_quantity");R([u()],V.prototype,"_unit");R([u()],V.prototype,"_productPrice");R([u()],V.prototype,"_productVat");R([u()],V.prototype,"_productLikeAdded");R([u()],V.prototype,"_productLoyaltyPointsCost");R([u()],V.prototype,"_productLoyaltyPointsExchangePrice");R([u()],V.prototype,"_basketPositions");R([u()],V.prototype,"_basketPricesSum");R([u()],V.prototype,"_basketLoyaltyPointsCost");R([u()],V.prototype,"_hasSpecialOffer");R([u()],V.prototype,"_shouldDisplayProductVat");R([u()],V.prototype,"_shouldDisplayBasketVat");R([u()],V.prototype,"_isLoyalty");R([u()],V.prototype,"_isBundle");var Un=Object.defineProperty,Ke=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Un(e,t,s),s};class Me extends f{constructor(){super(),this.basketUrl="",this.basketDeliveryPaymentUrl="",this.isWithValue=!1,this.moduleInstanceId="",this.isSheet=!1,this._dropdown=P(),this._sheet=P(),this._confirmModal=P(),this._confirmModalId=`remove-all-products-confirm-modal-${v()}`,this._cleanBasket=async()=>{await this._basketOverallApi.cleanBasket(),this._confirmModal.value?.close(),window.dispatchEvent(new Event("resize"))},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketOverallApi=this.getApiSync(H.api),this.isBasketFilled$=D([this._basketOverallApi.selectActions$(),this._basketProductsApi.selectBasketCount$()]).pipe(A(([e,t])=>t>0&&e.clean&&e.clean.method&&e.clean.href)),this._discountSum=new E(this,this._basketProductsApi.selectDiscountedSum$()),this.firstElementChild&&_e.remove(this.firstElementChild)}static{this.moduleName="basket-preview"}connectedCallback(){super.connectedCallback(),this.isSheet?this.addEventListener("opened",()=>{this.eventBus.emit(new m(G.basketPreviewOpened,{sheet:this}))}):this.addEventListener("showed",()=>{this.eventBus.emit(new m(G.basketPreviewOpened,{dropdown:this}))})}
2461_renderToggler(){return r`<div class="labeled-icon">
2462            <div
2463                class="indicator"
2464                data-value="${$(this._basketProductsApi.selectBasketCount$())}"
2465            >
2466                <h-icon
2467                    icon-name="icon-basket"
2468                    css-classes="labeled-icon__icon"
2469                    aria-hidden="true"
2470                ></h-icon>
2471            </div>
2472
2473            <div class="labeled-icon__signature font_bold">
2474                ${g(this.isWithValue,()=>r`${this._discountSum.value?.grossValueFormatted}`,()=>r`${l("Cart")}`)}
2475            </div>
2476        </div>`}_renderBasketPreviewDropdownHeader(){return r`
2477            <div class="grid__col grid__col_xs-12 grid__col_sm-grow mb-xs-2">
2478                <h2 class="section-title section-title_s">${l("Products in the cart")}</h2>
2479            </div>
2480        `}_renderBasketPreviewSheetHeader(){return r`
2481            <h2 class="section-title section-title_s">${l("Products in the cart")}</h2>
2482            <h-sheet-close class="btn btn_icon">
2483                <span class="sr-only">${l("Close window")}</span>
2484                <h-icon
2485                    icon-name="icon-x"
2486                    aria-hidden="true"
2487                ></h-icon>
2488            </h-sheet-close>
2489        `}
2489_renderBasketPreview(){return r`<div
2490                class="grid__row ${this.isSheet?"grid__row_xs-hright grid__row_sm-hright grid__row_lg-hright grid__row_xxl-hright":""}"
2491            >
2492                ${this.isSheet?d:this._renderBasketPreviewDropdownHeader()}
2493                <div class="grid__col grid__col_xs-12 grid__col_sm-auto">
2494                    <h-modal-opener
2495                        name="${this._confirmModalId}"
2496                        @click=${()=>{this.isSheet?this._sheet.value?.close():this._dropdown.value?.hide()}}
2497                        class="btn btn_outline btn_xs"
2498                        aria-label="${l("Remove all products from the cart")}"
2499                    >
2500                        <h-icon
2501                            icon-name="icon-trash"
2502                            css-classes="btn__icon btn__icon_left"
2503                        ></h-icon>
2504
2505                        ${l("Clear")}
2506                    </h-modal-opener>
2507                </div>
2508            </div>
2509
2510            <basket-products-list
2511                .mode="basket"
2512                .hasAdditionalInfo="${!1}"
2513                .products="${$(this._basketProductsApi.select$())}"
2514            ></basket-products-list>
2515
2516            <basket-summary
2517                .hasContent="${!1}"
2518                url="${this.basketDeliveryPaymentUrl}"
2519                basket-url="${this.basketUrl}"
2520            ></basket-summary>`}_renderEmptyBasket(){return r`<div class="grid__row grid__row_xs-vcenter">
2521            <div class="grid__col">
2522                <h-icon
2523                    icon-name="icon-basket"
2524                    css-classes="icon_xxl"
2525                    aria-hidden="true"
2526                ></h-icon>
2527            </div>
2528            <div class="grid__col">
2529                <h2
2530                    class="p align_center"
2531                    tabindex="0"
2532                >
2533                    ${l("Your cart is empty")}
2534                </h2>
2535            </div>
2536        </div>`}_renderConfirmModal(){return r`<confirm-modal
2537            id="${this._confirmModalId}"
2538            hidden
2539            ${I(this._confirmModal)}
2540            header="${l("Clearing all products from the cart")}"
2541            confirmText="${l("Clear all products")}"
2542            cancelText="${l("Cancel")}"
2543            @confirm="${this._cleanBasket}"
2544        >
2545            <p slot>${l("Are you sure you want to clear all items from your shopping cart?")}</p>
2546        </confirm-modal>`}_renderSheet(){return r`
2547            <h-sheet-opener
2548                name="basket-preview-sheet-${this.moduleInstanceId}"
2549                aria-label="${l("Products in the cart")}: ${$(this._basketProductsApi.selectBasketCount$())}, ${l("Sum")}: ${this._discountSum.value?.grossValueFormatted}, ${l("See details")}"
2550                >${this._renderToggler()}</h-sheet-opener
2551            >
2552
2553            <h-sheet
2554                id="basket-preview-sheet-${this.moduleInstanceId}"
2555                ${I(this._sheet)}
2556                hidden
2557            >
2558                <h-sheet-header> ${this._renderBasketPreviewSheetHeader()} </h-sheet-header>
2559
2560                <h-sheet-body>
2561                    <div class="basket-preview">
2562                        ${M(this.isBasketFilled$,this._renderBasketPreview(),this._renderEmptyBasket())}
2563                    </div>
2564                </h-sheet-body>
2565            </h-sheet>
2566
2567            ${this._renderConfirmModal()}
2568        `}_renderDropdown(){return r`
2569            <h-dropdown
2570                name="basket-preview"
2571                direction="bottom-right"
2572                ${I(this._dropdown)}
2573            >
2574                <h-dropdown-toggler
2575                    name="basket-preview-${this.moduleInstanceId}"
2576                    aria-label="${l("Products in the cart")}: ${$(this._basketProductsApi.selectBasketCount$())}, ${l("Sum")}: ${this._discountSum.value?.grossValueFormatted}, ${l("See details")}"
2577                    >${this._renderToggler()}</h-dropdown-toggler
2578                >
2579
2580                <h-dropdown-content name="basket-preview-${this.moduleInstanceId}">
2581                    <div class="basket-preview">
2582                        ${M(this.isBasketFilled$,this._renderBasketPreview(),this._renderEmptyBasket())}
2583                    </div>
2584                </h-dropdown-content>
2585            </h-dropdown>
2586
2587            ${this._renderConfirmModal()}
2588        `}render(){return this.isSheet?this._renderSheet():this._renderDropdown()}}Ke([p({type:String,attribute:"basket-url"})],Me.prototype,"basketUrl");Ke([p({type:String,attribute:"basket-delivery-payment-url"})],Me.prototype,"basketDeliveryPaymentUrl");Ke([p({type:Boolean,attribute:"is-with-value"})],Me.prototype,"isWithValue");Ke([p({type:Number,attribute:"module-instance-id"})],Me.prototype,"moduleInstanceId");Ke([p({type:Boolean,attribute:"sheet"})],Me.prototype,"isSheet");var Gn=Object.defineProperty,qn=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Gn(e,t,s),s};class Os extends f{constructor(){super(),this.isShippingCountryChangeAvailable=!1,this._selectCountryId=`delivery-country-${v()}`,this._basketShippingsApi=this.getApiSync(Ce.api),this._translationApi=this.getApiSync(J.api),this._storefrontSettings=this.getApiSync(L.api)}static{this.moduleName="basket-shipping-country"}async connectedCallback(){super.connectedCallback()}getCountries$(){return this._basketShippingsApi.selectAvailableShippingCountries$().pipe(A(e=>e.map(t=>({value:String(t.id),content:this._translationApi.translate(t.name),selected:this._basketShippingsApi.getSelectedShippingCountry()?.country.id===t.id}))))}render(){return r`${g(this.isShippingCountryChangeAvailable,()=>r` <h-control class="mb-xs-2">
2589                <h-control-label class="control__label">
2590                    <label
2591                        class="label"
2592                        for=${this._selectCountryId}
2593                        id="${this._selectCountryId}-label"
2594                        >${l("Country of delivery")}</label
2595                    >
2596                </h-control-label>
2597
2598                <h-control-content class="control">
2599                    <h-control-element class="control__element control__element_half">
2600                        <h-select
2601                            class="select"
2602                            control-id=${this._selectCountryId}
2603                            control-name="delivery_country"
2604                            no-deselect
2605                            .optionsList="${$(this.getCountries$())}"
2606                            @change="${e=>{const t=e.target;t.selectedOptions[0]&&this._basketShippingsApi.setCountry(Number(t.selectedOptions[0].value))}}"
2607                            assistive-title-id="${this._selectCountryId}-label"
2608                        >
2609                            <h-select-toggler
2610                                class="select-toggler"
2611                                aria-labelledby="${this._selectCountryId}-label"
2612                            >
2613                                <span
2614                                    class="select-toggler__placeholder"
2615                                    slot="placeholder"
2616                                    >${l("Select")}</span
2617                                >
2618                            </h-select-toggler>
2619                        </h-select>
2620                    </h-control-element>
2621
2622                    <control-errors></control-errors>
2623                </h-control-content>
2624            </h-control>`,()=>r`<div class="font_size-s mb-xs-2">
2625                    <p class="p_no-margin">${l("Country of delivery")}</p>
2626
2627                    <b class="font_semibold">${l(this._basketShippingsApi.getAvailableShippingCountries()[0]?.name)}</b>
2628                </div>`)}`}}qn([p()],Os.prototype,"isShippingCountryChangeAvailable");const as={enableMask:"enableMask",disableMask:"disableMask"};var zn=Object.defineProperty,ft=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&zn(e,t,s),s};class We extends f{constructor(){super(),this.countries=[],this.address=null,this.ariaLabelledBy="",this.selectedCountryId="",this._countryId=`country-${v()}`,this._select=P(),this._settingsApi=this.getApiSync(L.api)}static{this.moduleName="shipping-address-country-select"}firstUpdated(e){super.firstUpdated(e),this.selectedCountryId=this.getSelectedValue()??""}getSelectedValue(){return this._select.value?.selectedOptions[0]?.value}render(){return r` <h-select
2629            ${I(this._select)}
2630            @showed=${()=>{this._select.value?.assignSlots()}}
2631            @change=${e=>{const t=e.target,i=t.selectedOptions[0]?.value;i&&(this.selectedCountryId=i),t&&i==="179"?this.dispatchEvent(new CustomEvent(as.enableMask)):this.dispatchEvent(new CustomEvent(as.disableMask))}}
2632            class="select"
2633            control-id=${this._countryId}
2634            control-name="countryId"
2635            no-deselect
2636            .optionsList="${this.countries}"
2637            assistive-title-id="${this.ariaLabelledBy}"
2638            aria-disabled="${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")}"
2639            .disabled=${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")}
2640            ?required=${this._settingsApi.isFeatureEnabled("dev_cached_select_options")}
2641            ?dev_cached_select_options=${this._settingsApi.isFeatureEnabled("dev_cached_select_options")}
2642        >
2643            <h-select-toggler
2644                class="select-toggler"
2645                aria-labelledby="${this.ariaLabelledBy}"
2646            >
2647                <span
2648                    class="select-toggler__placeholder"
2649                    slot="placeholder"
2650                    >${l("Select")}</span
2651                >
2652            </h-select-toggler>
2653
2654            ${$e(this.countries,e=>e.id,e=>r` <h-option
2655                        slot="content"
2656                        value=${e.id}
2657                        id="${this._countryId}-${e.id}"
2658                        ?selected=${e.id==this.address?.countryId}
2659                    >
2660                        <h-option-content>${e.name}</h-option-content>
2661                    </h-option>`)}
2662        </h-select>`}}ft([p()],We.prototype,"countries");ft([p({type:Object})],We.prototype,"address");ft([p({type:String,attribute:"aria-labelledby"})],We.prototype,"ariaLabelledBy");ft([p({type:String,reflect:!0})],We.prototype,"selectedCountryId");const Hn=({storeName:n="BasketShippingsCountriesStore"}={})=>U({name:n},ye());class Kn{#e;constructor(e){this.#e=e}get(){return this.#e.query(ce())}select$(){return this.#e.pipe(be())}set(e){this.#e.update(fe(e))}}class Wn extends O{#e;#t;constructor({basketShippingsCountriesRepository:e,messageStorageApi:t}){super(),this.#e=e,this.#t=t,this._setupEventListeners()}_setupEventListeners(){new q(this.#s,this.#t)}#s=({body:e})=>{const t=e?.countries||[];this._setCountries(t)};_setCountries(e){this.#e.set(e)}get(){return this.#e.get()}select$(){return this.#e.select$().pipe(k((e,t)=>B(e,t)))}}class jn extends de{constructor({basketOrderService:e}){super(),this.moduleName=Re.api,this.#e=e}#e;async order(){return this.#e.order()}isOrderInProgress(){return this.#e.isOrderInProgress()}selectOrderInProgress$(){return this.#e.selectOrderInProgress$()}isOrderQueued(){return this.#e.isOrderQueued()}selectIsOrderQueued$(){return this.#e.selectIsOrderQueued$()}addOrderValidation(e,t){this.#e.addOrderValidation(e,t)}}class Qn extends O{#e;#t;#s;#a;#n;#r;constructor({basketHttpApi:e,flashMessengerApi:t,translationsApi:i,basketOverallApi:s,basketOrderRepository:a,basketUpdaterApi:o}){super(),this.#e=e,this.#s=i,this.#t=t,this.#a=s,this.#n=a,this.#r=o}async order(){const e=this.#a.getActions().placeOrder;try{const{response:t}=this.#e.placeOrder(e),{data:i}=await t;if(i.isPlaced)return i;this.#r.emitUpdateBasketEvent(i)}catch(t){this._handleUnexpectedError(t)}finally{setTimeout(()=>{this.#n.setIsOrderInProgress(!1)},200)}}_handleUnexpectedError(e){throw console.error(e),this.#t.addFlashMessage({type:"error",content:this.#s.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError)),e}}class Yn extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;constructor({basketHttpApi:e,flashMessengerApi:t,pageManagerApi:i,translationsApi:s,settingsApi:a,storeFactoryApi:o,basketOverallApi:c,basketOrderRepository:h,basketUpdaterApi:_}){super(),this.#e=e,this.#s=i,this.#a=s,this.#t=t,this.#n=a,this.#r=o,this.#o=c,this.#i=h,this.#l=_,this._isRememberOrderQueueEnabled()&&(this._setupSessionStore(),this._resumeRememberedOrderQueue())}async order(){const e=this.#o.getActions().queueOrder;try{const{response:t}=this.#e.queueOrder(e),{data:i}=await t;if(!i.isSuccess){this.#l.emitUpdateBasketEvent(i),this.#i.setIsOrderInProgress(!1);return}if(i._links.checkStatus){if(this.#i.setIsOrderQueued(!0),this._isRememberOrderQueueEnabled()){const s=this._setOrderCheckStatusUrl(i._links.checkStatus.href);if(s){this._getQueueStatus(s);return}this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError("Order queue returned invali
2662d check status URL.");return}this._getQueueStatus(i._links.checkStatus.href);return}this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError("Order queue did not return a check status URL.")}catch(t){this._removeOrderCheckStatusUrl(),this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError(t)}}async _getQueueStatus(e){try{const{response:t}=this.#e.getQueueStatus(e),{data:i}=await t,{status:s,_links:a}=i;if(s===Pt.done){this._removeOrderCheckStatusUrl(),this.eventBus.emit(new m(S.orderPlaced)),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),this.#s.visit(a.showOrder.href);return}if(s===Pt.error){this._removeOrderCheckStatusUrl(),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),this.#s.visit(window.location.href);return}if(s===Pt.pending){this.#i.setIsOrderInProgress(!0),this.#i.setIsOrderQueued(!0),setTimeout(()=>{this._getQueueStatus(e)},1e3);return}this._removeOrderCheckStatusUrl(),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),console.error(`Unknown order queue status: "${s}"`),this.#s.visit(window.location.href)}catch(t){this._removeOrderCheckStatusUrl(),this.#i.setIsOrderQueued(!1),this.#i.setIsOrderInProgress(!1),this._handleUnexpectedError(t)}}_isRememberOrderQueueEnabled(){return this.#n.isFeatureEnabled("dev_remember_order_queue")}_setupSessionStore(){this.#c=this.#r.getStore(tt),this.#c||(this.#c=this.#r.createStore("session",tt))}_resumeRememberedOrderQueue(){const e=this._getRememberedOrderCheckStatusUrl();e&&(this.#i.setIsOrderQueued(!0),this.#i.setIsOrderInProgress(!0),this._getQueueStatus(e))}_normalizeOrderCheckStatusUrl(e){try{const t=new URL(e,window.location.origin),i=t.origin===window.location.origin,s=Zs.test(t.pathname),a=t.hash!=="";return!i||!s||a?null:`${t.pathname}${t.search}`}catch{return null}}_isOrderCheckStatusUrlExpired(e){if(!e)return!0;const t=parseInt(e,10);return Number.isNaN(t)?!0:Date.now()-t>Xs}_getRememberedOrderCheckStatusUrl(){const e=this.#c?.get(Ct),t=this.#c?.get(It);if(!e||this._isOrderCheckStatusUrlExpired(t))return this._removeOrderCheckStatusUrl(),null;const i=this._normalizeOrderCheckStatusUrl(e);return i||(this._removeOrderCheckStatusUrl(),null)}_setOrderCheckStatusUrl(e){const t=this._normalizeOrderCheckStatusUrl(e);return t?(this.#c?.set(Ct,t),this.#c?.set(It,String(Date.now())),t):(this._removeOrderCheckStatusUrl(),null)}_removeOrderCheckStatusUrl(){this._isRememberOrderQueueEnabled()&&(this.#c?.remove(Ct),this.#c?.remove(It))}_handleUnexpectedError(e){throw console.error(e),this.#t.addFlashMessage({type:"error",content:this.#a.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError)),e}}class Jn extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;constructor({basketHttpApi:e,flashMessengerApi:t,pageManagerApi:i,translationsApi:s,settingsApi:a,storeFactoryApi:o,basketOverallApi:c,basketOrderRepository:h,basketCustomValidation:_,basketUpdaterApi:b}){super(),this.#e=e,this.#s=i,this.#a=s,this.#t=t,this.#n=c,this.#r=h,this.#o=_,this.#i=b,this.#l=new Yn({basketHttpApi:this.#e,flashMessengerApi:this.#t,pageManagerApi:this.#s,translationsApi:this.#a,settingsApi:a,storeFactoryApi:o,basketOverallApi:this.#n,basketOrderRepository:this.#r,basketUpdaterApi:this.#i})}async order(){const e=this.#n.getActions().queueOrder,t=this.#n.getActions().queueOrder||this.#n.getActions().placeOrder;if(this.#o.run())return;if(!t){this._validateSections();return}return this.#r.setIsOrderInProgress(!0),await(e?this.#l:new Qn({basketHttpApi:this.#e,flashMessengerApi:this.#t,translationsApi:this.#a,basketOverallApi:this.#n,basketOrderRepository:this.#r,basketUpdaterApi:this.#i})).order()}isOrderInProgress(){return this.#r.getIsOrderInProgress()}selectOrderInProgress$(){return this.#r.selectIsOrderInProgress$()}isOrderQueued(){return this.#r.getIsOrderQueued()}selectIsOrderQueued$(){return this.#r.selectIsOrderQueued$()}addOrderValidation(e,t){this.#o.addOrderValidation(e,t)}_validateSections(){for(const[e,t]of Object.entries(this.#n.getInvalidSections()))this.eventBus.emit(new m(`invalidSection.${e}`,t))}}const Xn=({storeName:n="BasketOrderStore"}={})=>U({name:n},K({isOrderInProgress:!1,isOrderQueued:!1}));class Zn{#e;constructor(e){this.#e=e}setIsOrderInProgress(e){this.#e.update(y("isOrderInProgress",e))}getIsOrderInProgress(){return this.#e.getValue().isOrderInProgress}selectIsOrderInProgress$(){return this.#e.pipe(C(e=>e.isOrderInProgress))}setIsOrderQueued(e){this.#e.update(y("isOrderQueued",e))}getIsOrderQueued(){return this.#e.getValue().isOrderQueued}selectIsOrderQueued$(){return this.#e.pipe(C(e=>e.isOrderQueued))}}class ns{#e={};addTemplate(e,t){if(typeof t!="string"&&!(t instanceof HTMLTemplateElement))throw new Error("Template must be a id of template tag or an instance of HTMLTemplateElement");typeof t=="string"&&this._addTemplateInfoFromId(e,t),t instanceof HTMLTemplateElement&&this._addTemplate(e,t)}getTemplate(e){return this.#e[e]}_addTemplate(e,t){this.#e[e]||(this.#e[e]=new Map),this.#e[e].set(t.id,t)}_addTemplateInfoFromId(e,t){const i=document.getElementById(t);i&&this._addTemplate(e,i)}}var er=Object.defineProperty,tr=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&er(e,t,s),s};class Ls extends f{constructor(){super(),this._loyaltyPointsAwardedSubscription=void 0,this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._loyaltyPoints=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsAwarded$())}static{this.moduleName="loyalty-awarded-points-sum"}disconnectedCallback(){super.disconnectedCallback(),this._loyaltyPointsAwardedSubscription?.unsubscribe()}render(){return r`${this._loyaltyPoints.value?.points}`}}tr([u()],Ls.prototype,"_loyaltyPoints");const sr="js__product-in-basket-count";var ir=Object.defineProperty,Ns=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);
2662return s&&ir(e,t,s),s};class Ht extends f{constructor(){super(),this.variantId$=new ve(0),this.selectedOptions$=new ve([]),this._checkProductInBasket$=null,new wi(e=>this._updateVariantId(e))}static{this.moduleName="product-in-basket"}connectedCallback(){super.connectedCallback(),this.variantId$.next(this.variantId);const e=this.getApiSync("basketProductsApi");this._checkProductInBasket$=D([this.variantId$,this.selectedOptions$,e.select$()]).subscribe(([t,i,s])=>this._update(s,t,i))}disconnectedCallback(){super.disconnectedCallback(),this._checkProductInBasket$&&this._checkProductInBasket$.unsubscribe()}_update(e,t,i){const s=e.find(a=>{const o=a.options.map(c=>c.value);return a.productId===this.productId&&a.variantId===t&&B(o.sort(),i.sort())});s?(_e.show(this),this._updateProductQuantityInBasket(s.quantity)):_e.hide(this)}_updateProductQuantityInBasket(e){this.querySelectorAll(`.${sr}`).forEach(t=>t.textContent=e.toString())}_updateVariantId({body:e}){!e?.productId||e.productId!==this.productId||(this.variantId$.next(e.stockId),this.selectedOptions$.next(e.optionValues?.map(t=>t.userValue)||[]))}}Ns([p({type:Number,attribute:"product-id"})],Ht.prototype,"productId");Ns([p({type:Number,attribute:"variant-id"})],Ht.prototype,"variantId");class ar extends f{constructor(){super(),this._reactiveFormRef=P(),this._formId=`form-${v()}`,this._couponId=`coupon-${v()}`,this._$basketCouponContainer=null,this._addPromotionCode=async e=>{e.preventDefault();const t=this._getFormService();let i=t.getFormControl(this._couponId);if(i&&typeof i.value=="string"){const a=i.value.replace(mn,"").trim();t.setFormControlValue(this._couponId,a)}if(await t.validateControls(),i=t.getFormControl(this._couponId),!i||this._getFormState()===Pe.validationFailed)return;await this._basketPromotionsApi.add(i.value)&&this._$basketCouponContainer?.focus()},this._removePromotionCode=async()=>{await this._basketPromotionsApi.remove(),this._$basketCouponContainer?.focus()},this._basketOverallApi=this.getApiSync(H.api),this._basketPromotionsApi=this.getApiSync(ge.api),this._settingsApi=this.getApiSync(L.api),this._isDevGiftCardsFlagEnabled=this._settingsApi.isFeatureEnabled("dev_gift_cards"),this._basketActions=new E(this,this._basketOverallApi.selectActions$()),this._promotionCode=new E(this,this._basketPromotionsApi.selectPromotionCode$())}static{this.moduleName="basket-summary-coupon-codes"}connectedCallback(){super.connectedCallback(),this._$basketCouponContainer||(this._$basketCouponContainer=this.closest(`.${is}`)||document.querySelector(`.${is}`))}_getFormState(){return this._getFormService().getFormState()}_getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}render(){return super.render(),r`
2663            <div class="control__additional-content">
2664                ${this._promotionCode.value?r`<div>
2665                              <span class="d-block mb-xs-1 tag tag_l font_semibold font_size-s mb-xs-1 basket-summary__coupon-code">
2666                                  ${this._promotionCode.value?.code}
2667                              </span>
2668                              <span class="d-block mb-xs-1 font_size-s font_semibold color_primary">${this._promotionCode.value?.label}</span>
2669                              ${this._promotionCode.value?.description?r`
2670                                        <span class="d-block mb-xs-1 font_size-xs color_secondary">
2671                                            ${this._promotionCode.value?.description}
2672                                        </span>
2673                                    `:d}
2674                          </div>
2675
2676                          ${this._basketActions.value?.removePromoCode!==void 0?r` <button
2677                                    type="submit"
2678                                    class="btn btn_outline btn_xs"
2679                                    @click=${this._removePromotionCode}
2680                                >
2681                                    ${l("Remove code from order")}
2682                                </button>`:d} `:r`
2683                          <reactive-form ${I(this._reactiveFormRef)}>
2684                              <h-control-label class="control__label">
2685                                  <label
2686                                      class="label"
2687                                      for=${this._couponId}
2688                                      >${l(this._isDevGiftCardsFlagEnabled?"Enter a discount coupon":"Coupon code")}</label
2689                                  >
2690                              </h-control-label>
2691
2692                              <form
2693                                  class="d-flex"
2694                                  id=${this._formId}
2695                                  @submit=${this._addPromotionCode}
2696                              >
2697                                  <control-connector
2698                                      required
2699                                      errorMessage=${this._isDevGiftCardsFlagEnabled?l("The field is required"):d}
2700                                      class="control control_no-margin mr-xs-1"
2701                                      validationMode="${ys.change}"
2702                                  >
2703                                      <h-control>
2704                                          <h-control-content class="control">
2705                                              <h-control-element class="control__element">
2706                                                  <h-input
2707                                                      controlId=${this._couponId}
2708                                                      controlName="coupon"
2709                                                  >
2710                                                      <h-input-control></h-input-control>
2711                                                  </h-input>
2712                                              </h-control-element>
2713
2714                                              <control-errors></control-errors>
2715                                          </h-control-content>
2716                                      </h-control>
2717                                  </control-connector>
2718
2719                                  <button
2720                                      type="submit"
2721                                      class="btn btn_secondary"
2722                                      @click=${this._addPromotionCode}
2723                                  >
2724                                      ${l("Activate")}
2725                                  </button>
2726                              </form>
2727                          </reactive-form>
2728                      `}
2729            </div>
2730        `}}var nr=Object.defineProperty,Vs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);
2730return s&&nr(e,t,s),s};class Kt extends f{constructor(){super(),this._showTaxInfo=!1,this._showGrossPrices=!1,this._renderPrices=()=>this._showTaxInfo?r`
2731                <h-accordion lazy>
2732                    <h-accordion-group>
2733                        <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
2734                            <span>
2735                                ${l("Products (with VAT)")}
2736                                <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary">
2737                                    <use
2738                                        href="/assets/img/icons/symbol-defs.svg#icon-chevron-down"
2739                                        xlink:href="/assets/img/icons/symbol-defs.svg#icon-chevron-down"
2740                                    ></use>
2741                                </svg>
2742                            </span>
2743
2744                            <span> ${this._productsSum.value?.grossValueFormatted} </span>
2745                        </h-accordion-toggler>
2746
2747                        <h-accordion-content
2748                            ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("is-dev-accordion-optimization-flag-enabled")}
2749                            ?is-dev-accordion-safari-flash-fix-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_safari_flash_fix")}
2750                        >
2751                            <ul class="price-list price-list_secondary price-list_s">
2752                                <li class="price-list__item">
2753                                    <span class="price-list__label price_s"> ${l("Products (without VAT)")} </span>
2754                                    <span class="price-list__value price__value price_s"> ${this._productsSum.value?.netValueFormatted} </span>
2755                                </li>
2756
2757                                ${g(this._taxes.value&&this._taxes.value.length>1,()=>r` ${this._taxes.value?.map(e=>r` <li class="price_s price-list__item">
2758                                                <span class="price__label price-list__label">
2759                                                    ${l("{{ taxPercent }} VAT",{taxPercent:`${e.name}%`})}
2760                                                </span>
2761                                                <span class="price__value price-list__value">${e.sum.text}</span>
2762                                            </li>`)}`,()=>r` <li class="price_s price-list__item">
2763                                        <span class="price__label price-list__label">
2764                                            ${l("{{ taxPercent }} VAT",{taxPercent:`${this._productsSum.value?.taxFormatted}`})}
2765                                        </span>
2766                                        <span class="price__value price-list__value"> ${this._productsSum.value?.taxValueFormatted} </span>
2767                                    </li>`)}
2768                            </ul>
2769                        </h-accordion-content>
2770                    </h-accordion-group>
2771                </h-accordion>
2772            `:this._showGrossPrices?r`
2773                <li class="price-list__item">
2774                    <span class="price-list__label">${l("Products")}</span>
2775                    <span class="price-list__value">${this._productsSum.value?.grossValueFormatted}</span>
2776                </li>
2777            `:r`
2778            <li class="price-list__item">
2779                <span class="price-list__label">${l("Products (without VAT)")}</span>
2780                <span class="price-list__value">${this._productsSum.value?.netValueFormatted}</span>
2781            </li>
2782        `,this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketTaxesApi=this.getApiSync("basketTaxesApi"),this._storefrontSettingsApi=this.getApiSync(L.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showTaxInfo=e.showAdditionalTaxInfo==="1",this._showGrossPrices=e.showGrossPrices==="1"}),this._productsSum=new E(this,this._basketProductsApi.selectSum$()),this._taxes=new E(this,this._basketTaxesApi.select$()),this._promotions=new E(this,this._basketPromotionsApi.select$())}static{this.moduleName="basket-summary-basket-prices"}render(){return super.render(),r`
2783            <div class="basket-summary__prices">
2784                <h3 class="font_semibold mb-xs-2">${l("Product summary")}
2784</h3>
2785                <ul class="price-list price-list_s mb-xs-0 color_secondary">
2786                    ${this._renderPrices()}
2787                    ${g(this._promotions.value&&this._promotions.value?.length>0,()=>r` <li>
2788                            <basket-discounts-list
2789                                .discounts="${$(this._basketPromotionsApi.select$())}"
2790                                .discountsSum="${$(this._basketPromotionsApi.selectDiscountsSum$())}"
2791                            ></basket-discounts-list>
2792                        </li>`,()=>d)}
2793                </ul>
2794            </div>
2795        `}}Vs([u()],Kt.prototype,"_showTaxInfo");Vs([u()],Kt.prototype,"_showGrossPrices");var rr=Object.defineProperty,St=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&rr(e,t,s),s};class je extends f{constructor(){super(),this.url="",this.basketUrl="",this.mode=pe.basket,this._showNetPrices=!1,this._renderPriceList=()=>r`
2796            <ul class="price-list">
2797                <li class="price-list__item">
2798                    <span class="price-list__label">${l("Subtotal")}</span>
2799                    <span class="price-list__value price price_m">
2800                        ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r`
2801                                <p class="p p_no-margin price__value">
2802                                    <strong class="p_l p_no-margin font_semibold price__value_special">
2803                                        ${this._productsDiscountedSum.value?.grossValueFormatted}
2804                                    </strong>
2805                                    ${this._showNetPrices?l("with VAT"):d}
2806                                </p>
2807                            `,()=>r`
2808                                <strong class="d-block p_l p_no-margin font_semibold price__value">
2809                                    ${this._productsDiscountedSum.value?.grossValueFormatted}
2810                                    ${this._showNetPrices?l("with VAT"):d}
2811                                </strong>
2812                            `)}
2813                        <p class="p_s p_no-margin color_tertiary">
2814                            ${this._showNetPrices?r`${this._productsDiscountedSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`}
2815                        </p>
2816                    </span>
2817                </li>
2818
2819                ${M(this._basketLoyaltyApi.selectHasItemsPaidInLoyaltyPoints$(),r`
2820                        <li class="price-list__item">
2821                            <span class="price-list__label">${l("Products in the loyalty program")}</span>
2822                            <span class="price-list__value font_semibold">
2823                                ${this._loyaltyPointsCost.value?.pointsFormatted}
2824                                ${this._loyaltyPointsExchangePrice.value?`+ ${this._loyaltyPointsExchangePrice.value.grossValueFormatted}`:""}
2825                            </span>
2826                        </li>
2827                    `,d)}
2828            </ul>
2829        `,this._basketOverallApi=this.getApiSync(H.api),this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._storefrontSettingsApi=this.getApiSync(L.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showNetPrices=e.showNetPrices==="1"}),this._totalSum=new E(this,this._basketOverallApi.selectSum$()),this._productsDiscountedSum=new E(this,this._basketProductsApi.selectDiscountedSum$()),this._productsSum=new E(this,this._basketProductsApi.selectSum$()),this._promotions=new E(this,this._basketPromotionsApi.select$()),this._hasPromotionCode=new E(this,this._basketPromotionsApi.selectHasPromotionCode$()),this._loyaltyPointsCost=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsCost$()),this._loyaltyPointsExchangePrice=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsExchangePrice$())}static{this.moduleName="basket-summary-basket-footer"}
2829_fullBasketRenderPriceList(){return r`<ul class="price-list">
2830            <li class="price-list__item">
2831                <span class="price-list__label">${l("Total")}</span>
2832                <span class="price-list__value price price_m">
2833                    ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r`
2834                            <p class="p p_no-margin price__value">
2835                                <strong class="p_l font_semibold price__value_special"> ${this._totalSum.value?.grossValueFormatted} </strong>
2836                                ${this._showNetPrices?l("with VAT"):d}
2837                            </p>
2838                        `,()=>r`
2839                            <strong class="d-block p_l font_semibold price__value">
2840                                ${this._totalSum.value?.grossValueFormatted} ${this._showNetPrices?l("with VAT"):d}
2841                            </strong>
2842                        `)}
2843                    <p class="p_s p_no-margin  color_tertiary">
2844                        ${this._showNetPrices?r`${this._totalSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`}
2845                    </p>
2846                </span>
2847            </li>
2848        </ul>`}render(){return super.render(),r`
2849            <div class="basket-module__content basket-module__content_secondary">
2850                <footer class="basket-summary__footer">
2851                    ${g(this.mode===pe.fullBasket,()=>this._fullBasketRenderPriceList(),()=>r`${this._renderPriceList()}
2852                            <p>
2853                                <small>${l("Delivery cost in the next step.")}</small>
2854                            </p>`)}
2855
2856                    <p>
2857                        <a
2858                            href=${this.url}
2859                            class="btn btn_primary btn_full-width"
2860                            aria-label="${l("Next step: choosing shipping and payment")}"
2861                        >
2862                            <h-icon
2863                                icon-name="icon-truck"
2864                                css-classes="btn__icon btn__icon_left"
2865                                aria-hidden="true"
2866                            ></h-icon>
2867
2868                            ${l("Delivery and payment")}</a
2869                        >
2870                    </p>
2871
2872                    ${g(this.basketUrl,()=>r`<p>
2873                            <a
2874                                href=${this.basketUrl}
2875                                class="btn btn_outline btn_full-width"
2876                            >
2877                                ${l("View products in the cart")}</a
2878                            >
2879                        </p>`,()=>d)}
2880                    ${g(this._storefrontSettingsApi.getInpostPayWidgetSettings()&&this._storefrontSettingsApi.getInpostPayWidgetSettings()?.showInBasket,()=>r`${g(this._storefrontSettingsApi.getInpostPayWidgetSettings()?.merchantClientId,()=>this._storefrontSettingsApi.isFeatureEnabled("dev_inpost_pay_button")?r` <inpost-pay-button binding-place="${Ci.BASKET_SUMMARY}"></inpost-pay-button> `:r`<inpost-izi-button
2881                                              data-v2
2882                                              variation="${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.buttonVariant=="secondary"?"secondary":"primary"} ${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.isDarkMode?"dark":""} ${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.frameStyle}"
2883                                              binding_place="BASKET_SUMMARY"
2884                                          >
2885                                          </inpost-izi-button>`,()=>d)}`,()=>d)}
2886                </footer>
2887            </div>
2888        `}}St([p()],je.prototype,"url");St([p({type:String,attribute:"basket-url"})],je.prototype,"basketUrl");St([p()],je.prototype,"mode");St([u()],je.prototype,"_showNetPrices");var or=Object.defineProperty,Rs=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&or(e,t,s),s};class Wt extends f{constructor(){super(),this._showTaxInfo=!1,this._showGrossPrices=!1,this._renderPrices=()=>{const e=document.querySelector("#iconsPath")?.href||"/assets/img/icons/symbol-defs.svg";return this._showTaxInfo?r`
2889                <h-accordion lazy>
2890                    <h-accordion-group>
2891                        <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
2892                            <span>
2893                                ${l("Products (with VAT)")}
2894                                <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary">
2895                                    <use
2896                                        href="${e}#icon-chevron-down"
2897                                        xlink:href="${e}#icon-chevron-down"
2898                                    ></use>
2899                                </svg>
2900                            </span>
2901
2902                            <span> ${this._productsSum.value?.grossValueFormatted} </span>
2903                        </h-accordion-toggler>
2904
2905                        <h-accordion-content
2906                            ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("is-dev-accordion-optimization-flag-enabled")}
2907                            ?is-dev-accordion-safari-flash-fix-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_safari_flash_fix")}
2908                        >
2909                            <ul class="price-list price-list_secondary price-list_s">
2910                                <li class="price-list__item">
2911                                    <span class="price-list__label price_s"> ${l("Products (without VAT)")} </span>
2912                                    <span class="price-list__value price__value price_s"> ${this._productsSum.value?.netValueFormatted} </span>
2913                                </li>
2914
2915                                ${g(this._taxes.value&&this._taxes.value.length>1,()=>r` ${this._taxes.value?.map(t=>r` <li class="price_s price-list__item">
2916                                                <span class="price__label price-list__label">
2917                                                    ${l("{{ taxPercent }} VAT",{taxPercent:`${t.name}%`})}
2918                                                </span>
2919                                                <span class="price__value price-list__value">${t.sum.text}</span>
2920                                            </li>`)}`,()=>r` <li class="price_s price-list__item">
2921                                        <span class="price__label price-list__label">
2922                                            ${l("{{ taxPercent }} VAT",{taxPercent:`${this._productsSum.value?.taxFormatted}`})}
2923                                        </span>
2924                                        <span class="price__value price-list__value"> ${this._productsSum.value?.taxValueFormatted} </span>
2925                                    </li>`)}
2926                            </ul>
2927                        </h-accordion-content>
2928                    </h-accordion-group>
2929                </h-accordion>
2930            `:this._showGrossPrices?r`
2931                <li class="price-list__item">
2932                    <span class="price-list__label">${l("Products")}</span>
2933                    <span class="price-list__value">${this._productsSum.value?.grossValueFormatted}</span>
2934                </li>
2935            `:r`
2936            <li class="price-list__item">
2937                <span class="price-list__label">${l("Products (without VAT)")}</span>
2938                <span class="price-list__value">${this._productsSum.value?.netValueFormatted}</span>
2939            </li>
2940        `},this._renderShippingTaxValue=()=>{const e=this._selectedShipping.value?.price;if(!e)return d;const t=e.grossValue===0?"":e.taxFormatted;return t&&this._showTaxInfo?r`
2941                ${l("Delivery (with {{ taxPercent }} VAT)",{taxPercent:t})}
2942            `:r`${l("Delivery")}`},this._renderPaymentTaxValue=()=>{const e=this._paymentCost.value;if(!e)return d;const t=e.grossValue===0?"":e.taxFormatted;return t&&this._showTaxInfo?r`
2943                ${l("Payment method (with {{ taxPercent }} VAT)",{taxPercent:t})}
2944            `:r`${l("Payment method")}`},this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketTaxesApi=this.getApiSync("basketTaxesApi"),this._basketShippingsApi=this.getApiSync("basketShippingsApi"),this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._basketPaymentsApi=this.getApiSync(Ie.api),this._storefrontSettingsApi=this.getApiSync(L.api),this._isGiftCardsEnabled=this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards"),this._isGiftCardsEnabled&&(this._basketGiftCardsApi=this.getApiSync(ne.api),this._hasAppliedGiftCards=new E(this,this._basketGiftCardsApi.selectHasAppliedGiftCards$(
2944))),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showTaxInfo=e.showAdditionalTaxInfo==="1",this._showGrossPrices=e.showGrossPrices==="1"}),this._productsSum=new E(this,this._basketProductsApi.selectSum$()),this._taxes=new E(this,this._basketTaxesApi.select$()),this._selectedShipping=new E(this,this._basketShippingsApi.selectSelectedShipping$()),this._promotions=new E(this,this._basketPromotionsApi.select$()),this._selectedPayment=new E(this,this._basketPaymentsApi.selectSelectedPayment$()),this._paymentCost=new E(this,this._basketPaymentsApi.selectActivePaymentCost$()),this._loyaltyPointsCost=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsCost$()),this._loyaltyPointsExchangePrice=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsExchangePrice$())}static{this.moduleName="basket-summary-checkout-prices"}render(){return super.render(),r`
2945            <div class="basket-summary__prices">
2946                <h3 class="font_semibold mb-xs-2">${l("Order value")}</h3>
2947                <ul class="price-list price-list_s">
2948                    ${this._renderPrices()}
2949                    ${g(this._promotions.value&&this._promotions.value.length>0,()=>r` <li>
2950                            <basket-discounts-list
2951                                .discounts="${$(this._basketPromotionsApi.select$())}"
2952                                .discountsSum="${$(this._basketPromotionsApi.selectDiscountsSum$())}"
2953                            ></basket-discounts-list>
2954                        </li>`,()=>d)}
2955                    ${M(this._basketLoyaltyApi.selectHasItemsPaidInLoyaltyPoints$(),r`
2956                            <li class="price-list__item">
2957                                <span class="price-list__label">${l("Products in the loyalty program")}</span>
2958                                <div class="price-list__value">
2959                                    <p class="p_no-margin">${this._loyaltyPointsCost.value?.pointsFormatted}</p>
2960                                    <p class="p_no-margin">${this._loyaltyPointsExchangePrice.value?`+ ${this._loyaltyPointsExchangePrice.value.grossValueFormatted}`:""}</p>
2961                                </p>
2962                            </li>
2963                        `,d)}
2964
2965                    <li class="price price_s price-list__item">
2966                        <div class="price__label price-list__label">
2967                            <p class="p_no-margin">${this._renderShippingTaxValue()}</p>
2968                            <small class="color_secondary"> ${this._selectedShipping.value?.name} </small>
2969                        </div>
2970
2971                        <span
2972                            class="
2973                                price__value
2974                                price-list__value
2975                                ${this._selectedShipping.value&&this._selectedShipping.value?.price.grossValue==0?"price__value_special":""}
2976                            "
2977                        >
2978                            ${this._selectedShipping.value&&this._selectedShipping.value?.price.grossValue>0?this._selectedShipping.value.price.grossValueFormatted:l("Free")}
2979                        </span>
2980                    </li>
2981
2982                    ${this._paymentCost.value&&this._paymentCost.value?.grossValue>0?r`
2983                              <li class="price price_s price-list__item">
2984                                  <div class="price__label price-list__label">
2985                                      ${this._renderPaymentTaxValue()}
2986                                      <small class="color_secondary"> ${this._selectedPayment.value?.name} </small>
2987                                  </div>
2988
2989                                  <span class="price__value price-list__value"> ${this._paymentCost.value.grossValueFormatted} </span>
2990                              </li>
2991                          `:d}
2992                    ${g(this._isGiftCardsEnabled&&!!this._hasAppliedGiftCards?.value,()=>r` <li><basket-gift-cards-discounts-list></basket-gift-cards-discounts-list></li>`,()=>d)}
2993                </ul>
2994            </div>
2995        `}}Rs([u()],Wt.prototype,"_showTaxInfo");Rs([u()],Wt.prototype,"_showGrossPrices");class lr extends f{constructor(){super(),this._flashMessengerRef=P(),this._handleFlashMessages=(e,t)=>{if(e){this._flashMessengerApi.removeAllFlashMessages("basket-summary-checkout-footer");return}this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate(t),type:z.error,isCloseable:!1,timeout:0},"basket-summary-checkout-footer")},this._basketOverallApi=this.getApiSync(H.api),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this._val
2995idationMessage=new E(this,this._basketOverallApi.selectSectionValidation$()),this._basketOverallApi.selectSectionValidation$().subscribe(({isValid:e,validationMessage:t})=>{e?this.classList.remove("basket-module_error"):(this.classList.add("basket-module_error"),this.scrollIntoView()),t&&this._handleFlashMessages(e,t)})}static{this.moduleName="basket-summary-checkout-footer"}render(){return super.render(),r`
2996            <div class="basket-module__content basket-module__content_secondary">
2997                <footer class="basket-summary__footer">
2998                    <flash-messenger
2999                        ${I(this._flashMessengerRef)}
3000                        class="d-block mb-xs-1"
3001                        name="basket-summary-checkout-footer"
3002                        tabindex="-1"
3003                    ></flash-messenger>
3004
3005                    <total-and-pay></total-and-pay>
3006                </footer>
3007            </div>
3008        `}}var cr=Object.defineProperty,Qe=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&cr(e,t,s),s};class Te extends f{constructor(){super(),this._checkoutButton=r``,this._loyaltyPointsAwardInfo="",this._loginInfo="",this._canBuyWhileUnregistered=!1,this._showNetPrices=!1,this._basketOverallApi=this.getApiSync(H.api),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketLoyaltyApi=this.getApiSync("basketLoyaltyApi"),this._basketPaymentsApi=this.getApiSync(Ie.api),this._translationApi=this.getApiSync(J.api),this._authenticationApi=this.getApiSync(hs.api),this._storefrontSettingsApi=this.getApiSync(L.api),this._basketOrderApi=this.getApiSync(Re.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._canBuyWhileUnregistered=e.isBuyingEnabledToUnregistered==="1",this._showNetPrices=e.showNetPrices==="1"}),this._totalSum=new E(this,this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards")?this._basketOverallApi.selectSumToPay$():this._basketOverallApi.selectSum$()),this._promotions=new E(this,this._basketPromotionsApi.select$()),this._hasPromotionCode=new E(this,this._basketPromotionsApi.selectHasPromotionCode$()),this._loyaltyPointsAwarded=new E(this,this._basketLoyaltyApi.selectLoyaltyPointsAwarded$()),this._basketPaymentsApi.selectSelectedPayment$().subscribe(async e=>{const t=this._basketPaymentsApi.getPaymentChannelStrategy(e?.channelKey);this._checkoutButton=await t.getPaymentButton()}),this._basketLoyaltyApi.selectLoyaltyPointsAwarded$().pipe(A(e=>e&&e.points)).subscribe(e=>{this._loyaltyPointsAwardInfo=this._translationApi.translate("For this order, you will receive {{ points }}",{points:`<strong>${e} ${this._translationApi.translate("loyalty points")}</strong>`,interpolation:{escapeValue:!1}})}),this._loginInfo=this._translationApi.translate("{{ login }} or {{ register }} to continue.",{login:`<login-modal-opener class="link link_regular">${this._translationApi.translate("Log in")}</login-modal-opener>`,register:`<register-modal-opener class="link link_regular">${this._translationApi.translate("register an account")}</register-modal-opener>`,interpolation:{escapeValue:!1}})}static{this.moduleName="total-and-pay"}render(){return r`
3009            <ul class="price-list">
3010                <li class="price-list__item">
3011                    <span class="price-list__label">${l("Total")}</span>
3012                    <span class="price-list__value price price_m">
3013                        ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r`
3014                                <p class="p p_no-margin price__value">
3015                                    <strong class="p_l font_semibold price__value_special">
3016                                        ${this._totalSum.value?.grossValueFormatted}
3017                                    </strong>
3018                                    ${this._showNetPrices?l("with VAT"):d}
3019                                </p>
3020                            `,()=>r`
3021                                <strong class="d-block p_l font_semibold price__value">
3022                                    ${this._totalSum.value?.grossValueFormatted} ${this._showNetPrices?l("with VAT"):d}
3023                                </strong>
3024                            `)}
3025                        <p class="p_s p_no-margin  color_tertiary">
3026                            ${this._showNetPrices?r`${this._totalSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`}
3027                        </p>
3028                    </span>
3029                </li>
3030            </ul>
3031
3032            ${M(this._basketOrderApi.selectOrderInProgress$(),r`<div>
3033                    <div class="btn btn_primary btn_full-width">
3034                        <div class="loader">
3035                            <div class="loader__spinner loader__spinner_xs"></div>
3036                        </div>
3037                    </div>
3038                </div>`,r` ${this._checkoutButton} `)}
3039            ${!this._canBuyWhileUnregistered&&!this._authenticationApi.isAuthorized()?r` <p class="p_xs p_no-margin mt-xs-1">${j(this._loginInfo)}</p> `:d}
3040            ${g(this._loyaltyPointsAwarded.value&&this._loyaltyPointsAwarded.value.points>0,()=>r` <p class="p_xs color_secondary mt-xs-2">${j(this._loyaltyPointsAwardInfo)}</p> `,()=>d)}
3041        `}}Qe([u()],Te.prototype,"_checkoutButton");Qe([u()],Te.prototype,"_loyaltyPointsAwardInfo");Qe([u()],Te.prototype,"_loginInfo");Qe([u()],Te.prototype,"_canBuyWhileUnregistered");Qe([u()],Te.prototype,"_showNetPrices");class dr extends f{constructor(){super(...arguments),this._teaserButtonRef=P(),this._handleTeaserButtonAria=e=>{this._teaserButtonRef.value?.setAttribute("aria-expanded",e.type==="open"?"true":"false")}}static{this.moduleName="basket-address-form-teaser"}connectedCallback(){super.connectedCallback(),this.addEventListener("open",this._handleTeaserButtonAria),this.addEventListener("close",this._handleTeaserButtonAria)}render(){return r`
3042            <div class="basket-addresses__form-teaser">
3043                <div
3044                    inert
3045                    role="presentation"
3046                    class="basket-addresses__form-teaser-blur"
3047                >
3048                    <h-control class="control control_row pt-xs-1">
3049                        <h-control-content class="control__content_auto">
3050                            <h-control-element class="control__element">
3051                                <div class="radio-box">
3052                                    <input
3053                                        type="radio"
3054                                        checked
3055                                        value="false"
3056                                        class="radio-box__input"
3057                                        tabindex="-1"
3058                                    />
3059
3060                                    <label class="radio-box__label"> ${l("Consumer")} </label>
3061                                </div>
3062                            </h-control-element>
3063                        </h-control-content>
3064
3065                        <h-control-content class="control__content_auto">
3066                            <h-control-element class="control__element">
3067                                <div class="radio-box">
3068                                    <input
3069                                        type="radio"
3070                                        value="false"
3071                                        class="radio-box__input"
3072                                        tabindex="-1"
3073                                    />
3074
3075                                    <label class="radio-box__label"> ${l("Company")} </label>
3076                                </div>
3077                            </h-control-element>
3078                        </h-control-content></h-control
3079                    >
3080
3081                    <h-control class="control">
3082                        <h-control-label class="control__label">
3083                            <label class="label label_required">
3084                                <span class="label__asterisk" aria-hidden="true">*</span>
3085                                ${l("E-mail address")}
3086                            </label>
3087                        </h-control-label>
3088
3089                        <h-control-content class="control">
3090                            <h-control-element class="control__element">
3091                                <div class="input">
3092                                    <div class="input__control">
3093                                        <input
3094                                            type="text"
3095                                            tabindex="-1"
3096                                        />
3097                                    </div>
3098                                </div>
3099                            </h-control-element>
3100                        </h-control-content>
3101                    </h-control>
3102
3103                    <h-control class="control">
3104                        <h-control-label class="control__label">
3105                            <label class="label label_required">
3106                                <span class="label__asterisk" aria-hidden="true">*</span>
3107                                ${l("First name")}
3108                            </label>
3109                        </h-control-label>
3110
3111                        <h-control-content class="control">
3112                            <h-control-element class="control__element">
3113                                <div class="input">
3114                                    <div class="input__control">
3115                                        <input
3116                                            type="text"
3117                                            tabindex="-1"
3118                                        />
3119                                    </div>
3120                                </div>
3121                            </h-control-element>
3122                        </h-control-content>
3123                    </h-control>
3124
3125                    <h-control class="control">
3126                        <h-control-label class="control__label">
3127                            <label class="label label_required">
3128                                <span class="label__asterisk" aria-hidden="true">*</span>    
3129                                ${l("Last name")}
3130                            </label>
3131                        </h-control-label>
3132
3133                        <h-control-content class="control">
3134                            <h-control-element class="control__element">
3135                                <div class="input">
3136                                    <div class="input__control">
3137                                        <input
3138                                            type="text"
3139                                            tabindex="-1"
3140                                        />
3141                                    </div>
3142                                </div>
3143                            </h-control-element>
3144                        </h-control-content>
3145                    </h-control>
3146                </div>
3147
3148                <button
3149                    ${I(this._teaserButtonRef)}
3150                    aria-haspopup="dialog"
3151                    aria-expanded="false"
3152                    class="btn btn_primary basket-addresses__form-teaser-btn"
3153                    aria-label="${l("Open the Order information form")}"
3154                >
3155                    <h-icon
3156                        icon-name="icon-user"
3157                        css-classes="btn__icon btn__icon_left"
3158                        aria-hidden="true"
3159                    ></h-icon>
3160                    ${l("Add order information")}
3161                </button>
3162            </div>
3163        `}}class hr{constructor({httpApi:e,basketAddressesApi:t}){this.API_BASE_URL="//api-shipx-pl.easypack24.net/v1/points",this.PICKUP_POINTS_LIMIT=5,this.#e=e,this.#t=t}static{this.strategyName="inpost"}#e;#t;async findNearestPickupPoints(){const e=this.#t.getPickupPointData()?.zipCode??this.#t.getBillingAddress()?.zipCode;if(!e)return[];try{const t=await this._fetchPickupPoints(e);return this._processPickupPointsResponse(t)}catch(t){return console.error("Error fetching pickup points:",t),[]}}async _fetchPickupPoints(e){const t=`${this.API_BASE_URL}?relative_post_code=${e}&limit=${this.PICKUP_POINTS_LIMIT}`;return this.#e.fetch({method:"get",url:t})?.response||null}_processPickupPointsResponse(e){if(!e||e.status!==200)return[];const t=new re;return e.data.items?.map(i=>t.inpostToModel(i))||[]}}class pr{execute(){return hr}}class ur{constructor({httpApi:e,basketAddressesApi:t,integrationData:i}){this.API_BASE_URL="//mapa.apaczka.pl/access_points/fetch",this.PICKUP_POINTS_LIMIT=5,this.#e=e,this.#t=t,this.#s=i.appId,this.#a=i.pickupPointTypes}static{this.strategyName="inpost"}#e;#t;#s;#a;async findNearestPickupPoints(){const e=this.#t.getPickupPointData()?.zipCode??this.#t.getBillingAddress()?.zipCode;if(!e)return[];try{const t=await this._fetchPickupPoints(e);return this._processPickupPointsResponse(t)}catch(t){return console.error("Error fetching pickup points:",t),[]}}async _fetchPickupPoints(e){const t=`${this.API_BASE_URL}`;return this.#e.fetch({method:"post",url:t,data:{app_id:this.#s,startRow:0,endRow:this.PICKUP_POINTS_LIMIT,operationType:"fetch",orderBy:"foreign_access_point_id",data:{operator:"and",criteria:[{field:"is_active",operator:"=",value:"1"},{field:"services_receiver",operator:"=",value:!0},{field:"country_code",operator:"=",value:"PL"},{field:"supplier",operator:"in",value:this.#a},{operator:"or",criteria:[{field:"foreign_access_point_id",operator:"like",value:e},{field:"name",operator:"like",value:e},{field:"street",operator:"like",value:e},{field:"house_number",operator:"like",value:e},{field:"city",operator:"like",value:e},{field:"postal_code",operator:"like",value:e}]}]}}})?.response||null}_processPickupPointsResponse(e){if(!e||e.status!==200)return[];const t=new re;return e.data.data?.map(i=>t.shoperDeliveryToModel({...i,street:`${i.street}${i.house_number?` ${i.house_number}`:""}`}))||[]}}class mr{execute(){return ur}}class _r{constructor({httpApi:e,basketAddressesApi:t,basketShippingsApi:i}){this.API_BASE_URL="/console/plugin/execute/plugin/InPostInternational-Points/act/points",this.#e=e,this.#t=t,this.#s=i}static{this.strategyName="inpostInternational"}#e;#t;#s;async findNearestPickupPoints(){const e=this.#t.getPickupPointData()?.zipCode??this.#t.getBillingAddress()?.zipCode,t=this.#s.getSelectedShippingCountry()?.country.isocode;if(!e||!t)return[];try{const i=await this._fetchPickupPoints(e,t);return this._processPickupPointsResponse(i)}catch(i){return console.error("Error fetching pickup points:",i),[]}}async _fetchPickupPoints(e,t){const i=new URLSearchParams;i.append("countryCode",t),i.append("postalCode",e);const s=`${this.API_BASE_URL}?countryCode=${t}&postalCode=${e}`;return this.#e.fetch({method:"get",url:s,headers:{"Content-Type":"application/x-www-form-urlencoded"},data:i})?.response||null}_processPickupPointsResponse(e){if(!e||e.status!==200||!e.data.length)return[];const t=new re;return e.data?.map(i=>t.inpostInternationalToModel(i))||[]}}class gr{execute(){return _r}}const rs={inpost:pr,ShoperShipment:mr,InPostInternational:gr};class yr extends O{#e;#t;#s;#a=new Tt;#n=null;#r=new ve(!1);constructor({httpApi:e,basketShippingsApi:t,basketAddressesApi:i}){super(),this.#e=e,this.#t=i,this.#s=t,t.selectSelectedShipping$().subscribe(s=>{s&&this.setNearestPickupPointsStrategy(s)})}getNearestPickupPointsStrategy(){return this.#n}hasNearestPickupPointStrategy(){return this.#r.getValue()}selectHasNearestPickupPointStrategy$(){return this.#r.asObservable().pipe(k())}setNearestPickupPointsStrategy(e){let t=e.shippingKey;if(t==="parcelLocker"){const a=e.integrationData;a.nearestPickupPointsShippingKey&&(t=a.nearestPickupPointsShippingKey)}if(!this._isStrategyAvailable(t)||!e.isPickupPointDelivery)return this._clearPickupPointService(),null;const i=this._getUniqueShippingName(t,e.id);this._ensureStrategyExists(t,i);const s=this._createPickupPointStrategy(e.integrationData);return this._updateServiceState(s),s}_isStrategyAvailable(e){return!!rs[e]}_getUniqueShippingName(e,t){return`${e}_${t}`}_ensureStrategyExists(e,t){this.#a.has(t)||this.#a.add(t,new rs[e]),this.#a.setCurrent(t)}_createPickupPointStrategy(e){const t=this.#a.execute(null);return new t({httpApi:this.#e,basketAddressesApi:this.#t,basketShippingsApi:this.#s,integrationData:e})}_updateServiceState(e){this.#r.next(!0),this.#n=e}_clearPickupPointService(){this.#r.next(!1),this.#n=null}async findNearestPickupPoints(){return this.#n?this.#n.findNearestPickupPoints():[]}}class br extends de{constructor({nearestPickupPointsService:e}){super(),this.moduleName=Cs.api,this.#e=e}#e;getNearestPickupPointsStrategy(){return this.#e.getNearestPickupPointsStrategy()}hasNearestPickupPointStrategy(){return this.#e.hasNearestPickupPointStrategy()}selectHasNearestPickupPointStrategy$(){return this.#e.selectHasNearestPickupPointStrategy$()}setNearestPickupPointsStrategy(e){return this.#e.setNearestPickupPointsStrategy(e)}async findNearestPickupPoints(){return this.#e.findNearestPickupPoints()}}var fr=Object.defineProperty,Oe=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&fr(e,t,s),s};class Ae extends f{constructor(){super(...arguments),this.selectedPickupPoint=null,this.nearestPickupPoints=[],this._isSelectedPointOnList=!1,this._showErrorFlag=!1,this.focusedId="",this._nearestPickupPointZipCodeId=`nearear-pickup-point-zip-code-${v()}`,this._debouncedSearch=Ot(async e=>{e&&e.trim().length>0&&(this.emitCustomEvent("nearestPickupPointsSearch",{bubbles:!0,detail:{zipCode:e}}),this._showErrorFlag=!0)},300)}static{this.moduleName="nearest-pickup-points"}_setPickupPoint(e,t){const i=e.target;this.focusedId=`nearest-pickup-point-${t.code}`,i instanceof HTMLInputElement&&i.name==="nearest_pickup_point"&&this.emitCustomEvent("pickupPointSelected",{bubbles:!0,detail:{pickupPoint:t}})}_handleInputChange(e){const t=e.target;this._debouncedSearch(t.value)}async updated(e){super.updated(e),this._isSelectedPointOnList=this.nearestPickupPoints.some(i=>i.code===this.selectedPickupPoint?.code);const t=`nearest-pickup-point-${this.selectedPickupPoint?.code}`;if(e.has("selectedPickupPoint")&&t){await this.updateComplete;const i=this.querySelector(`input#${t}`);i&&i.focus()}}
3163render(){return r`<h-control-label class="control__label">
3164                <label
3165                    class="label"
3166                    for="${this._nearestPickupPointZipCodeId}"
3167                    >${l("Choose a delivery point near you")}</label
3168                >
3169            </h-control-label>
3170
3171            <h-control>
3172                <h-control-content class="control">
3173                    <h-control-element class="control__element">
3174                        <h-input
3175                            controlId="${this._nearestPickupPointZipCodeId}"
3176                            controlName="nearest_pickup_point_zip_code"
3177                            placeholder=${l("Enter your postal code")}
3178                            @keyup="${e=>this._handleInputChange(e)}"
3179                        >
3180                            <h-input-control></h-input-control>
3181
3182                            <h-icon
3183                                icon-name="icon-search"
3184                                aria-hidden="true"
3185                            ></h-icon>
3186                        </h-input>
3187                    </h-control-element>
3188                </h-control-content>
3189            </h-control>
3190
3191            <div role="radiogroup">
3192                ${g(this._showErrorFlag&&this.nearestPickupPoints.length<=0,()=>r`<div class="flash-message flash-message__error mb-xs-2">
3193                        <h-icon
3194                            icon-name="icon-alert-triangle"
3195                            css-classes="flash-message__icon"
3196                            role="button"
3197                            aria-hidden="true"
3198                        ></h-icon>
3199
3200                        <p>${l("No items match your search. Check if your data is correct.")}</p>
3201                    </div>`,()=>d)}
3202                ${$e(this.nearestPickupPoints,e=>_s.encode(JSON.stringify(e)),e=>r`
3203                        <h-radio
3204                            controlId="${`nearest-pickup-point-${e.code}`}"
3205                            controlName="nearest_pickup_point"
3206                            class="basket-shipping__pickup-point-address nearest-pickup-points__point"
3207                            .value="${e.code}"
3208                            @change="${t=>this._setPickupPoint(t,e)}"
3209                            ?checked="${this.selectedPickupPoint?.code===e.code}"
3210                        >
3211                            <h-radio-control
3212                                aria-describedby="${e?.description?`${e.code}-description`:""}"
3213                            ></h-radio-control>
3214
3215                            <h-radio-content class="nearest-pickup-points__radio">
3216                                <div class="nearest-pickup-points__header" slot="label">
3217                                    <p class="font_size-xs p_no-margin">
3218                                        <strong class="font_semibold"> ${e?.code} </strong>, ${e?.street}
3219                                        ${e?.houseNumber}, ${e?.postalCode} ${e?.city}
3220                                        <span class="sr-only">${e?.description}</span>
3221                                    </p>
3222
3223                                    <p
3224                                        class="font_size-xs nearest-pickup-points__description"
3225                                        id="${e.code}-description"
3226                                        slot="description"
3227                                        aria-hidden="true"
3228                                    >
3229                                        ${e?.description}
3230                                    </p>
3231                                </div>
3232                            </h-radio-content>
3233                        </h-radio>
3234                    `)}
3235                ${g(this._isSelectedPointOnList||!this.selectedPickupPoint,()=>d,()=>r`<h-radio
3236                        controlId="${`nearest-pickup-point-${this.selectedPickupPoint?.code}`}"
3237                        controlName="nearest_pickup_point"
3238                        class="basket-shipping__pickup-point-address nearest-pickup-points__point"
3239                        .value="${this.selectedPickupPoint?.code}"
3240                        ?checked="${!0}"
3241                    >
3242                        <h-radio-control
3243                            aria-describedby="${this.selectedPickupPoint?.address.description?`${this.selectedPickupPoint?.code}-description`:""}"
3244                        ></h-radio-control>
3245
3246                        <h-radio-content class="nearest-pickup-points__radio">
3247                            <div class="nearest-pickup-points__header" slot="label">
3248                                <p class="font_size-xs p_no-margin">
3249                                    <strong class="font_semibold"> ${this.selectedPickupPoint?.code} </strong>,
3250                                    ${this.selectedPickupPoint?.address.street} ${this.selectedPickupPoint?.address.houseNumber},
3251                                    ${this.selectedPickupPoint?.address.postalCode} ${this.selectedPickupPoint?.address.city}
3252                                    <span class="sr-only">${this.selectedPickupPoint?.address.description}</span>
3253                                </p>
3254                            </div>
3255
3256                            <p
3257                                class="font_size-xs nearest-pickup-points__description"
3258                                id="${this.selectedPickupPoint?.code}-description"
3259                                slot="description"
3260                                aria-hidden="true"
3261                            >
3262                                ${this.selectedPickupPoint?.address.description}
3263                            </p>
3264                        </h-radio-content>
3265                    </h-radio>`)}
3266            </div>
3267
3268            <p class="nearest-pickup-points__separator">${l("or")}</p>`}}Oe([p()],Ae.prototype,"shipping");Oe([p()],Ae.prototype,"selectedPickupPoint");Oe([p()],Ae.prototype,"nearestPickupPoints");Oe([u()],Ae.prototype,"_isSelectedPointOnList");Oe([u()],Ae.prototype,"_showErrorFlag");Oe([p({type:String})],Ae.prototype,"focusedId");class Sr{#e=[];addOrderValidation(e,t){this.#e.push({isValid:e,callback:t})}run(){const e=this.#e.find(t=>!t.isValid());return e?(e.callback(),!0):!1}}var Ar=Object.defineProperty,At=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Ar(e,t,s),s};class Ye extends f{constructor(){super(),this._form=P(),this.address=null,this.addressMode=Z.consumerAndCompany,this.isLoggedIn=!1,this._formErrors=null,this._debouncedHandleAddressFormChange=Ot(async()=>{await this._form.value?.checkValidity()&&(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setBillingAddress(new Event("change"))))},300),this._addressController=new _t,this._storefrontSettings=this.getApiSync(L.api)}static{this.moduleName="billing-address-standard"}connectedCallback(){super.connectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")?this.addEventListener("change",this._debouncedHandleAddressFormChange):this.addEventListener("focusout",this._handleAddressFormFocusOut.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this._debouncedHandleAddressFormChange?.cancel()}async _handleAddressFormFocusOut(e){const t=e.relatedTarget;setTimeout(async()=>{const i=t?.closest("h-dropdown-content");this._form.value?.contains(t)||this._form.value?.contains(document.activeElement)||i||(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setBillingAddress(e)))},100)}render(){return r`
3269            <div class="basket-module__content basket-module__content_pt-0">
3270                <flash-messenger
3271                    class="d-block mb-xs-2"
3272                    name="billing-address-standard"
3273                ></flash-messenger>
3274
3275                <billing-address-form
3276                    ${I(this._form)}
3277                    .address=${this.address}
3278                    .addressMode=${this.addressMode}
3279                    .isLoggedIn=${this.isLoggedIn}
3280                    .formErrors=${we.toJson(this._formErrors)}
3281                ></billing-address-form>
3282            </div>
3283        `}}At([p()],Ye.prototype,"address");At([p()],Ye.prototype,"addressMode");At([p()],Ye.prototype,"isLoggedIn");At([u()],Ye.prototype,"_formErrors");var vr=Object.defineProperty,Ds=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&vr(e,t,s),s};class jt extends f{constructor(){super(),this._form=P(),this.address=null,this._formErrors=null,this._debouncedHandleAddressFormChange=Ot(async()=>{await this._form.value?.checkValidity()&&(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setShippingAddress(new Event("change"))))},300),this._addressController=new _t,this._storefrontSettings=this.getApiSync(L.api)}static{this.moduleName="shipping-address-standard"}connectedCallback(){super.connectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")?this.addEventListener("change",this._debouncedHandleAddressFormChange):this.addEventListener("focusout",this._handleAddressFormFocusOut.bind(this))}disconnectedCallback(){super.disconnectedCallback(),this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this._debouncedHandleAddressFormChange?.cancel()}async _handleAddressFormFocusOut(e){const t=e.relatedTarget;setTimeout(async()=>{const i=t?.closest("h-dropdown-content");this._form.value?.contains(t)||this._form.value?.contains(document.activeElement)||i||(this._formErrors=await this._addressController.saveAddressForm(async()=>this._form.value?.setShippingAddress(e)))},100)}render(){return r` <flash-messenger
3284                class="d-block mb-xs-2"
3285                name="shipping-address-standard"
3286            ></flash-messenger>
3287            <shipping-address-form
3288                ${I(this._form)}
3289                .address=${this.address}
3290                .formErrors=${we.toJson(this._formErrors)}
3291            ></shipping-address-form>`}}Ds([p()],jt.prototype,"address");Ds([u()],jt.prototype,"_formErrors");class kr extends f{static{this.moduleName="edit-billing-address-modal"}constructor(){super(),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._settingsApi=this.getApiSync(L.api),this._billingCountry$=this._basketAddressesApi.selectBillingAddress$().pipe(A(e=>{if(e){const t=e.country,i=e.countryId;return t?this._settingsApi.getCountryByCode(t):i?this._settingsApi.getCountryById(i):null}return null}))}connectedCallback(){super.connectedCallback()}
3291render(){return r`<div class="pl-xs-2 pr-xs-2 mb-xs-2">
3292                <flash-messenger name="basket-addresses-1"></flash-messenger>
3293            </div>
3294
3295            <div class="pl-xs-2 pr-xs-2">
3296                <h3 class="font_semibold mb-xs-2">${l("Buyer's details")}</h3>
3297
3298                <address class="address-card mb-xs-2">
3299                    <address-card
3300                        .address=${$(this._basketAddressesApi.selectBillingAddress$())}
3301                        .country=${$(this._billingCountry$)}
3302                    ></address-card>
3303
3304                    <button
3305                        aria-haspopup="dialog"
3306                        aria-label="${l("Edit buyer details")}"
3307                        @click=${()=>{this.emitCustomEvent("open-modal",{bubbles:!0})}}
3308                        class="link link_no-underline mt-xs-1"
3309                    >
3310                        <h-icon
3311                            css-classes="mr-xs-1 icon_link icon_link_left"
3312                            icon-name="icon-edit"
3313                            aria-hidden="true"
3314                        ></h-icon>
3315                        ${l("Edit")}
3316                    </button>
3317                </address>
3318            </div>`}}class $r extends f{static{this.moduleName="edit-shipping-address-modal"}constructor(){super(),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._settingsApi=this.getApiSync(L.api),this._shippingCountry$=this._basketAddressesApi.selectShippingAddress$().pipe(A(e=>{if(e){const t=e.country,i=e.countryId;return t?this._settingsApi.getCountryByCode(t):i?this._settingsApi.getCountryById(i):null}return null}))}render(){return r` <header class="font_size-s mb-xs-1">
3319                <b class="font_semibold">${l("Delivery address")}</b>
3320            </header>
3321            <address class="address-card">
3322                <address-card
3323                    .address=${$(this._basketAddressesApi.selectShippingAddress$())}
3324                    .country=${$(this._shippingCountry$)}
3325                ></address-card>
3326
3327                <button
3328                    aria-haspopup="dialog"
3329                    aria-label="${l("Edit shipping address")}"
3330                    @click=${()=>{this.emitCustomEvent("open-modal",{bubbles:!0})}}
3331                    class="link link_no-underline mt-xs-1"
3332                >
3333                    <h-icon
3334                        css-classes="mr-xs-1 icon_link icon_link_left"
3335                        icon-name="icon-edit"
3336                        aria-hidden="true"
3337                    ></h-icon>
3338                    ${l("Edit")}
3339                </button>
3340            </address>`}}class Pr extends f{constructor(){super(),this._modal=P(),this._showModal=e=>{ie.nextTick(()=>{e?this._modal.value?.open():this._modal.value?.close()})},this._preventConsentModalFromClosingOnEscape=e=>{e.key==="Escape"&&e.stopImmediatePropagation()},this._preventConsentModalFromClosingOnBackdropClick=e=>{e.stopImmediatePropagation()},this._basketOrderApi=this.getApiSync(Re.api)}static{this.moduleName="modal-order-queued"}connectedCallback(){super.connectedCallback(),this._sub=this._basketOrderApi.selectIsOrderQueued$().subscribe(this._showModal),document.addEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.addEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),this._sub.unsubscribe(),document.removeEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.removeEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}render(){return r`<h-modal
3341            ${I(this._modal)}
3342            class="modal-wrapper_s modal_queue"
3343        >
3344            <h-modal-header class="modal__header_center">
3345                <h2 class="font_semibold h2">${l("Your order is being processed")}</h2>
3346            </h-modal-header>
3347            <h-modal-body>
3348                <p class="font_size-s text-align-center">
3349                    ${l("Due to high demand, it may take a little longer. Thank you for your patience and trust
3349!")}
3350                </p>
3351
3352                <div
3353                    class="loader mt-xs-4 mb-xs-4"
3354                    role="progressbar"
3355                    aria-busy="true"
3356                >
3357                    <div class="loader__spinner loader__spinner_l"></div>
3358                </div>
3359
3360                <p class="text-align-center mt-xs-2 mb-xs-4">${l("Don't leave this page")}</p>
3361            </h-modal-body>
3362        </h-modal>`}}const Cr=({storeName:n="BasketUpdaterStore"}={})=>U({name:n},K({isCreateBasketQueued:!1}));class Ir{#e;constructor(e){this.#e=e}setIsCreateBasketInProgress(e){this.#e.update(y("isCreateBasketQueued",e))}getIsCreateBasketInProgress(){return this.#e.getValue().isCreateBasketQueued}selectIsCreateInProgress$(){return this.#e.pipe(C(e=>e.isCreateBasketQueued))}}class wr extends f{constructor(){super(),this._modal=P(),this._showModal=e=>{ie.nextTick(()=>{e?this._modal.value?.open():this._modal.value?.close()})},this._preventConsentModalFromClosingOnEscape=e=>{e.key==="Escape"&&e.stopImmediatePropagation()},this._preventConsentModalFromClosingOnBackdropClick=e=>{e.stopImmediatePropagation()},this._basketUpdaterApi=this.getApiSync(Mt.api)}static{this.moduleName="modal-create-basket-queued"}connectedCallback(){super.connectedCallback(),this._sub=this._basketUpdaterApi.selectIsBasketCreateInProgress$().subscribe(this._showModal),document.addEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.addEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}disconnectedCallback(){super.disconnectedCallback(),this._sub.unsubscribe(),document.removeEventListener("keydown",this._preventConsentModalFromClosingOnEscape),document.removeEventListener(Ve.clicked,this._preventConsentModalFromClosingOnBackdropClick)}render(){return r`<h-modal
3363            ${I(this._modal)}
3364            class="modal_queue modal-wrapper_s"
3365        >
3366            <h-modal-header class="modal__header_center">
3367                <h2 class="font_semibold h2">${l("Please wait, adding product...")}</h2>
3368            </h-modal-header>
3369            <h-modal-body>
3370                <p class="font_size-s text-align-center">
3371                    ${l("Adding the product to your cart will take a moment due to high demand. Please do not refresh the page.")}
3372                </p>
3373
3374                <div
3375                    class="loader mt-xs-4 mb-xs-4"
3376                    role="progressbar"
3377                    aria-busy="true"
3378                >
3379                    <div class="loader__spinner loader__spinner_l"></div>
3380                </div>
3381            </h-modal-body>
3382        </h-modal>`}}class Er extends O{constructor({basketGiftCardsService:e}){super(),this.moduleName=ne.api,this.#e=e}#e;addGiftCard(e){return this.#e.addGiftCard(e)}removeGiftCard(e){return this.#e.removeGiftCard(e)}getGiftCards(){return this.#e.getGiftCards()}getGiftCardById(e){return this.#e.getGiftCardById(e)}getGiftCardByCode(e){return this.#e.getGiftCardByCode(e)}
3382selectGiftCards$(){return this.#e.selectGiftCards$()}getCount(){return this.#e.getCount()}selectCount$(){return this.#e.selectCount$()}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$()}getIsApplying(){return this.#e.getIsApplying()}selectIsApplying$(){return this.#e.selectIsApplying$()}hasAppliedGiftCards(){return this.#e.hasAppliedGiftCards()}selectHasAppliedGiftCards$(){return this.#e.selectHasAppliedGiftCards$()}}const Br=({storeName:n="BasketGiftCardsStore"}={})=>U({name:n},ye(),K({count:0,sum:null,isApplying:!1}));class xr{#e;constructor(e){this.#e=e}setGiftCards(e){this.#e.update(fe(e))}getGiftCards(){return this.#e.query(ce())}getGiftCardById(e){return this.#e.query(di(e))}getGiftCardByCode(e){return this.#e.query(ce()).find(t=>t.code===e)}selectGiftCards$(){return this.#e.pipe(be())}setCount(e){this.#e.update(y("count",e))}getCount(){return this.#e.getValue().count}selectCount$(){return this.#e.pipe(C(e=>e.count))}setSum(e){this.#e.update(y("sum",e))}getSum(){return this.#e.getValue().sum}selectSum$(){return this.#e.pipe(C(e=>e.sum))}setIsApplying(e){this.#e.update(y("isApplying",e))}getIsApplying(){return this.#e.getValue().isApplying}selectIsApplying$(){return this.#e.pipe(C(e=>e.isApplying))}}class Fr extends O{#e;#t;#s;#a;#n;#r;#o;constructor({basketGiftCardsRepository:e,basketHttpApi:t,basketUpdaterApi:i,basketOverallApi:s,messageStorageApi:a,flashMessengerApi:o,translationsApi:c}){super(),this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#n=a,this.#r=o,this.#o=c,this._setupEventListeners()}_setupEventListeners(){new q(this.#i,this.#n)}#i=({body:e})=>{e?.giftCards&&(this.#e.setGiftCards(e.giftCards.list),this.#e.setCount(e.giftCards.count),this.#e.setSum(e.giftCards.sum))};async addGiftCard(e){const t=this.#a.getActions().addGiftCard;if(!t)throw new Error("Adding gift cards is not allowed");this.#e.setIsApplying(!0);try{const{response:i}=this.#t.addGiftCard(t,e),{data:s}=await i;return this.#s.emitUpdateBasketEvent(s),!s.flashMessages.some(a=>a.isError)}catch(i){return i.response?.status===Ft.notFound||i.response?.status===Ft.tooManyRequests?(this.#s.emitUpdateBasketEvent(i.response.data),!1):(this._handleUnexpectedError(i),!1)}finally{this.#e.setIsApplying(!1)}}async removeGiftCard(e){try{const{response:t}=this.#t.removeGiftCard(e.removeAction),{data:i}=await t;return this.#s.emitUpdateBasketEvent(i),!i.flashMessages.some(s=>s.isError)}catch(t){return this._handleUnexpectedError(t),!1}}getGiftCards(){return this.#e.getGiftCards()}getGiftCardById(e){return this.#e.getGiftCardById(e)}getGiftCardByCode(e){return this.#e.getGiftCardByCode(e)}
3382selectGiftCards$(){return this.#e.selectGiftCards$().pipe(k((e,t)=>B(e,t)))}getCount(){return this.#e.getCount()}selectCount$(){return this.#e.selectCount$().pipe(k())}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(k((e,t)=>B(e,t)))}getIsApplying(){return this.#e.getIsApplying()}selectIsApplying$(){return this.#e.selectIsApplying$()}hasAppliedGiftCards(){return this.#e.getGiftCards().length>0}selectHasAppliedGiftCards$(){return this.#e.selectGiftCards$().pipe(A(e=>e.length>0),k())}_handleUnexpectedError(e){console.error(e),this.#r.addFlashMessage({type:"error",content:this.#o.translate("An unexpected error occurred")}),this.eventBus.emit(new m(S.unexpectedError))}}var Mr=Object.defineProperty,vt=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Mr(e,t,s),s};class Je extends f{constructor(){super(),this._headerId=`gift-cards-header-${v()}`,this._subscriptionController=new Nt(this),this._sectionRef=P(),this._isAvailable=!1,this._isContentExpanded=!1,this._isGiftCardFormVisible=!1,this._isDevGiftCardsPaymentCheckFlagEnabled=!1,this._handleFormReady=e=>{e.target.focusInput()},this._storefrontSettingsApi=this.getApiSync(L.api),this._basketGiftCardsApi=this.getApiSync(ne.api),this._basketOverallApi=this.getApiSync(H.api),this._isDevGiftCardsPaymentCheckFlagEnabled=this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards_payment_check"),this._isAvailable=!!this._basketOverallApi.getActions().addGiftCard,this._isContentExpanded=this._basketGiftCardsApi.hasAppliedGiftCards(),this._isDevGiftCardsPaymentCheckFlagEnabled&&this._initAvailabilityHandler(),this._canAddAnotherCard$=D([this._basketGiftCardsApi.selectHasAppliedGiftCards$(),this._basketOverallApi.selectSumToPay$()]).pipe(A(([e,t])=>e&&(t?.grossValue??0)>0)),this._initGiftCardsCountHandler()}static{this.moduleName="gift-cards"}_initAvailabilityHandler(){const e=this._basketOverallApi.selectActions$().pipe(A(t=>!!t.addGiftCard));this._subscriptionController.subscribe(e,t=>{this._isAvailable=t,this._isAvailable?this.classList.add("module","basket-module"):this.classList.remove("module","basket-module")})}_initGiftCardsCountHandler(){const e=this._basketGiftCardsApi.selectCount$().pipe(ms(this._basketGiftCardsApi.getCount()),ci());this._subscriptionController.subscribe(e,([t,i])=>{i>t&&(this._isGiftCardFormVisible=!1),i===0&&t>0?this._focusSection():this._focusGiftCardsList()})}_focusSection(){requestAnimationFrame(()=>{this._sectionRef.value?.focus()})}_focusGiftCardsList(){requestAnimationFrame(()=>{this.querySelector(".basket-gift-cards__list")?.focus()})}render(){return!this._isAvailable&&this._isDevGiftCardsPaymentCheckFlagEnabled?d:r`<section
3383            ${I(this._sectionRef)}
3384            class="basket-module__content basket-gift-cards"
3385            aria-labelledby="${this._headerId}"
3386            tabindex="-1"
3387        >
3388            <header class="grid__row">
3389                <div class="grid__col grid__col_xs-12 grid__col_sm-grow ">
3390                    <h2
3391                        id="${this._headerId}"
3392                        class="section-title section-title_s"
3393                    >
3394                        ${l("Gift card")}
3395                    </h2>
3396                </div>
3397                <div class="grid__col grid__col_xs-12 grid__col_sm-auto d-flex">
3398                    ${M(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),d,r`<button
3399                            type="button"
3400                            aria-expanded="${this._isContentExpanded}"
3401                            class="basket-gift-cards__action-button"
3402                            @click=${()=>this._isContentExpanded=!this._isContentExpanded}
3403                        >
3404                            ${l(this._isContentExpanded?"Cancel":"Add card")}
3405                        </button>`)}
3406                </div>
3407            </header>
3408            ${g(this._isContentExpanded,()=>r`
3409                    ${M(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),r`
3410                            <gift-cards-list></gift-cards-list>
3411                            ${g(!this._isGiftCardFormVisible,()=>M(this._canAddAnotherCard$,r`<button
3412                                            type="button"
3413                                            class="basket-gift-cards__action-button basket-gift-cards__action-button_left"
3414                                            @click=${()=>{this._isGiftCardFormVisible=!0}}
3415                                        >
3416                                            <h-icon
3417                                                icon-name="icon-plus"
3418                                                aria-hidden="true"
3419                                            ></h-icon>
3420                                            ${l("Add another card")}
3421                                        </button>`,d),()=>r`<gift-cards-form @gift-cards-form-ready=${this._handleFormReady}></gift-cards-form>`)}
3422                            <gift-cards-alerts></gift-cards-alerts>
3423                        `,r`<gift-cards-form></gift-cards-form>`)}
3424                `)}
3425        </section>`}}vt([u()],Je.prototype,"_isAvailable");vt([u()],Je.prototype,"_isContentExpanded");vt([u()],Je.prototype,"_isGiftCardFormVisible");vt([u()],Je.prototype,"_isDevGiftCardsPaymentCheckFlagEnabled");class Tr extends f{static{this.moduleName="gift-cards-list"}constructor(){super(),this._basketGiftCardsApi=this.getApiSync(ne.api),this._giftCards=new E(this,this._basketGiftCardsApi.selectGiftCards$(
3425))}render(){return r`${M(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),r`
3426                <ul
3427                    class="basket-gift-cards__list"
3428                    aria-label="${l("Gift cards list")}"
3429                    tabindex="-1"
3430                >
3431                    ${$e(this._giftCards.value??[],e=>e.id,e=>r`<li class="basket-gift-cards__list-item-wrapper">
3432                                <gift-cards-list-item .giftCard=${e}></gift-cards-list-item>
3433                            </li>`)}
3434                </ul>
3435            `,d)}`}}var Or=Object.defineProperty,Lr=(n,e,t,i)=>{for(var s=void 0,a=n.length-1,o;a>=0;a--)(o=n[a])&&(s=o(e,t,s)||s);return s&&Or(e,t,s),s};class Us extends f{constructor(){super(),this._currentAlertId=null,this._removeGiftCard=async()=>{await this._basketGiftCardsApi.removeGiftCard(this.giftCard)},this._basketGiftCardsApi=this.getApiSync(ne.api),this._flashMessengerApi=this.getApiSync(ae.api),this._translationsApi=this.getApiSync(J.api),this._storefrontSettingsApi=this.getApiSync(L.api)}static{this.moduleName="gift-cards-list-item"}get _flashMessengerContainerName(){return`gift-card-item-${this.giftCard.id}`}get _locale(){return this._storefrontSettingsApi.getLocales().locale.replace("_","-")}updated(e){if(!e.has("giftCard"))return;const t=e.get("giftCard"),i=(t?.isOneTimeUse??!1)&&(t?.remainingBalance.grossValue??0)>0,s=this.giftCard.isOneTimeUse&&this.giftCard.remainingBalance.grossValue>0;i!==s&&(this._currentAlertId&&(this._flashMessengerApi.removeFlashMessage(this._currentAlertId,this._flashMessengerContainerName),this._currentAlertId=null),s&&(this._currentAlertId=this._flashMessengerApi.addFlashMessage({content:this._translationsApi.translate("This is a single-use card. You can use it for only one transaction. Any unused funds will be forfeited."),type:z.warning,isCloseable:!1,timeout:0},this._flashMessengerContainerName)))}disconnectedCallback(){this._currentAlertId&&(this._flashMessengerApi.removeFlashMessage(this._currentAlertId,this._flashMessengerContainerName),this._currentAlertId=null),super.disconnectedCallback?.()}_renderExpirationDate(){return this.giftCard.expirationDate?r`<time datetime="${this.giftCard.expirationDate.toISOString()}"
3436            >${vi.toLocaleDate(this.giftCard.expirationDate,this._locale)}</time
3437        >`:l("No expiration date")}render(){return r`
3438            <div class="basket-gift-cards__list-item">
3439                <picture>
3440                    <img
3441                        class="basket-gift-cards__image"
3442                        src="${this.giftCard.image.paths.original}"
3443                        alt="${l("Gift card")} ${this.giftCard.truncatedCode}"
3444                    />
3445                </picture>
3446                <div class="basket-gift-cards__info">
3447                    <span class="basket-gift-cards__description-line basket-gift-cards__description-line_main"
3448                        >${l("Last characters of the card code:")} ${this.giftCard.truncatedCode}</span
3449                    >
3450                    <span class="basket-gift-cards__description-line ">${l("Expiration date:")} ${this._renderExpirationDate()}</span>
3451                    <span class="basket-gift-cards__description-line"
3452                        >${l("Remaining balance on the card:")} ${this.giftCard.balance.grossValueFormatted}</span
3453                    >
3454                </div>
3455                <button
3456                    type="button"
3457                    class="basket-gift-cards__action-button"
3458                    @click=${this._removeGiftCard}
3459                >
3460                    ${l("Remove")}
3461                </button>
3462            </div>
3463            <flash-messenger name="${this._flashMessengerContainerName}"></flash-messenger>
3464        `}}Lr([p({attribute:!1})],Us.prototype,"giftCard");class me{constructor({host:e,formRef:t,basketGiftCardsApi:i,giftCardInputId:s}){this.addGiftCard=async a=>{a.preventDefault();const o=this.getFormService(),c=o.getFormControl(this.#a);if(await o.validateControls(),!c||this.getFormState()===Pe.validationFailed)return;const h=me.normalizeGiftCardCode(c.value);await this.#s.addGiftCard(h)&&o.hasFormControl(this.#a)&&o.updateFormControl(this.#a,{value:""})},this.removeGiftCard=async a=>{await this.#s.removeGiftCard(a)},this.#e=e,this.#t=t,this.#s=i,this.#a=s,this.#e.addController(this)}#e;#t;#s;#a;static normalizeGiftCardCode(e){return e.replace(Ii,"").toUpperCase()}hostConnected(){}getFormState(){return this.getFormService().getFormState()}getFormService(){if(!this.#t.value)throw"No form found";return this.#t.value.formService}}const os=4,Bt=" ";class Nr{constructor({host:e,inputId:t}){this.#s=null,this._handleInput=i=>{const s=i.target,a=s.value,o=s.selectionStart??0,c=this._formatCode(a);if(c!==a){s.value=c;const h=this._calculateCursorPosition(a,c,o);s.setSelectionRange(h,h)}},this._handlePaste=i=>{const s=i.target,a=i.clipboardData;if(!a)return;const o=a.getData("text");if(!o)return;i.preventDefault();const c=s.selectionStart??0,h=s.selectionEnd??0,_=s.value,b=_.slice(0,c),w=_.slice(h),F=b+o+w,x=this._formatCode(F);s.value=x;const N=me.normalizeGiftCardCode(o),Le=me.normalizeGiftCardCode(b).length+N.length;let Xe=0,oe=0;for(let le=0;le<x.length;le++)if(x[le]!==Bt&&(Xe++,Xe>
3464=Le)){oe=le+1;break}s.setSelectionRange(oe,oe),s.dispatchEvent(new Event("input",{bubbles:!0}))},this.#e=e,this.#t=t,this.#e.addController(this)}#e;#t;#s;hostConnected(){}hostUpdated(){this._attachEventListeners()}hostDisconnected(){this._removeEventListeners()}_formatCode(e){const t=me.normalizeGiftCardCode(e),i=[];for(let s=0;s<t.length;s+=os)i.push(t.slice(s,s+os));return i.join(Bt)}_calculateCursorPosition(e,t,i){const s=e.slice(0,i),a=me.normalizeGiftCardCode(s).length;let o=0,c=0;for(let h=0;h<t.length;h++)if(t[h]!==Bt){if(o++,o>a)break;c=h+1}return c}_attachEventListeners(){if(this.#s)return;const e=this.#e;this.#s=e.querySelector?.(`#${this.#t}`),this.#s&&(this.#s.addEventListener("input",this._handleInput),this.#s.addEventListener("paste",this._handlePaste))}_removeEventListeners(){this.#s&&(this.#s.removeEventListener("input",this._handleInput),this.#s.removeEventListener("paste",this._handlePaste),this.#s=null)}}class Vr extends f{constructor(){super(),this._reactiveFormRef=P(),this._formId=`form-gift-card-${v()}`,this._giftCardInputId=`gift-card-${v()}`,this._addGiftCard=async e=>{await this._formController.addGiftCard(e)},this._basketGiftCardsApi=this.getApiSync(ne.api),this._formController=new me({host:this,formRef:this._reactiveFormRef,basketGiftCardsApi:this._basketGiftCardsApi,giftCardInputId:this._giftCardInputId}),this._formatterController=new Nr({host:this,inputId:this._giftCardInputId})}static{this.moduleName="gift-cards-form"}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("gift-cards-form-ready",{bubbles:!0,composed:!0}))}async focusInput(){await this.updateComplete,this.querySelector(`#${this._giftCardInputId}`)?.focus()}render(){return r`
3465            <div class="control__additional-content">
3466                <reactive-form ${I(this._reactiveFormRef)}>
3467                    <h-control-label class="control__label">
3468                        <label
3469                            class="label"
3470                            for=${this._giftCardInputId}
3471                            >${l("Enter the card code")}</label
3472                        >
3473                    </h-control-label>
3474
3475                    <form
3476                        class="d-flex"
3477                        id=${this._formId}
3478                        @submit=${this._addGiftCard}
3479                    >
3480                        <control-connector
3481                            required
3482                            errorMessage=${l("The field is required")}
3483                            validationNameLabel=${void 0}
3484                            validationMode="${ys.change}"
3485                            class="control control_no-margin mr-xs-1"
3486                        >
3487                            <h-control>
3488                                <h-control-content class="control">
3489                                    <h-control-element class="control__element">
3490                                        <h-input
3491                                            controlId=${this._giftCardInputId}
3492                                            controlName="gift_card_code"
3493                                        >
3494                                            <h-input-control></h-input-control>
3495                                        </h-input>
3496                                    </h-control-element>
3497
3498                                    <control-errors></control-errors>
3499                                </h-control-content>
3500                            </h-control>
3501                        </control-connector>
3502
3503                        <button
3504                            type="submit"
3505                            class="btn btn_secondary"
3506                            ?disabled=${$(this._basketGiftCardsApi.selectIsApplying$())}
3507                            @click=${this._addGiftCard}
3508                        >
3509                            ${l("Apply")}
3510                        </button>
3511                    </form>
3512                </reactive-form>
3513            </div>
3514        `}}const xt="gift-cards-alerts";class Rr extends f{constructor(){super(),this._subscriptionController=new Nt(this),this._currentAlertId=null,this._basketGiftCardsApi=this.getApiSync(ne.api),this._flashMessengerApi=this.getApiSync(ae.api),this._translationsApi=this.getApiSync(J.api),this._basketOverallApi=this.getApiSync(H.api),this._setupAlerts()}static{this.moduleName="gift-cards-alerts"}_setupAlerts(){const e=D([this._basketGiftCardsApi.selectHasAppliedGiftCards$(
3514),this._basketOverallApi.selectSumToPay$()]).pipe(A(([t,i])=>this._resolveAlertMessage(t,i.grossValue,i.grossValueFormatted)));this._subscriptionController.subscribe(e,t=>{this._currentAlertId&&this._flashMessengerApi.removeFlashMessage(this._currentAlertId,xt),this._currentAlertId=t?this._flashMessengerApi.addFlashMessage(t,xt):null})}_resolveAlertMessage(e,t,i){return e?t>0?{content:this._translationsApi.translate("Amount remaining to be paid: {{ grossValue }}. Please choose a payment method.",{grossValue:i}),type:z.info,isCloseable:!1,timeout:0}:{content:this._translationsApi.translate("The card covers the entire order. Amount to pay: {{ grossValue }}.",{grossValue:i}),type:z.success,isCloseable:!1,timeout:0}:null}render(){return r`<flash-messenger name="${xt}"></flash-messenger>`}}class Dr extends f{static{this.moduleName="basket-gift-cards-discounts-list"}constructor(){super(),this._storefrontSettingsApi=this.getApiSync(L.api),this._isGiftCardsEnabled=this._storefrontSettingsApi.isFeatureEnabled("dev_gift_cards"),this._isGiftCardsEnabled&&(this._basketGiftCardsApi=this.getApiSync(ne.api),this._giftCards=new E(this,this._basketGiftCardsApi.selectGiftCards$(
3514)),this._giftCardsSum=new E(this,this._basketGiftCardsApi.selectSum$()))}_renderGiftCardsList(){return this._giftCards?.value?r`
3515            ${this._giftCards.value.map(e=>r`
3516                    <li class="price-list__item">
3517                        <span class="sr-only"
3518                            >${l("Gift card ending with {{ code }}, {{ price }} paid",{code:e.truncatedCode,price:e.payWithCard.grossValueFormatted})}</span
3519                        >
3520                        <span
3521                            class="price-list__label price_s"
3522                            aria-hidden="true"
3523                            >...${e.truncatedCode}</span
3524                        >
3525                        <span
3526                            class="price-list__value price__value price__value_special price_s"
3527                            aria-hidden="true"
3528                        >
3529                            ${e.payWithCard.grossValueFormatted}
3530                        </span>
3531                    </li>
3532                `)}
3533        `:d}_renderGiftCardsSum(){return this._giftCardsSum?.value?r` <span class="price__value price__value_special"> ${this._giftCardsSum.value.grossValueFormatted} </span> `:d}render(){const e=document.querySelector("#iconsPath")?.href||"/assets/img/icons/symbol-defs.svg";return r`${g(this._giftCards?.value&&this._giftCards.value.length>0,()=>r`
3534                <h-accordion
3535                    lazy
3536                    class="basket-discounts-list"
3537                >
3538                    <h-accordion-group>
3539                        <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
3540                            <span>
3541                                ${l("Gift cards")}
3542                                <svg
3543                                    class="icon accordion__toggler-icon accordion__toggler-icon_secondary"
3544                                    aria-hidden="true"
3545                                >
3546                                    <use
3547                                        href="${e}#icon-chevron-down"
3548                                        xlink:href="${e}#icon-chevron-down"
3549                                    ></use>
3550                                </svg>
3551                            </span>
3552
3553                            <span>${this._renderGiftCardsSum()}</span>
3554                        </h-accordion-toggler>
3555
3556                        <h-accordion-content
3557                            ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_optimization")}
3558                            ?is-dev-accordion-safari-flash-fix-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_safari_flash_fix")}
3559                        >
3560                            <ul
3561                                class="price-list price-list_secondary price-list_s"
3562                                aria-label="${l("Gift cards list")}"
3563                            >
3564                                ${this._renderGiftCardsList()}
3565                            </ul>
3566                        </h-accordion-content>
3567                    </h-accordion-group>
3568                </h-accordion>
3569            `)}`}}class fo extends ei{static{this.featureName=ls.feature}async init(){const e=this.getApiSync(ti),t=this.getApiSync(si),i=await this.getApi(L.api),s=await this.getApi(ae.api),a=await this.getApi(J.api),o=await this.getApi(ps.api),c=this.getApiSync(ii),h=await this.getApi(ai.api),_=new Ni({httpApi:t}),b=Cr(),w=new Ir(b),F=new Ri({basketHttpApi:_,flashMessengerApi:s,settingsApi:i,storeFactoryApi:c,translationsApi:a,basketUpdaterRepository:w}),x=new Di({basketUpdaterService:F}),N=this._createBasketOverallApi(e,_,x,s,a),se=this._createBasketOrderApi(_,s,h,a,i,c,N,x),Le=this._createProductsBasketApi(e,_,x,s,a),Xe=this._createBasketPromotionsApi(e,_,x,s,a,N),oe=this._createBasketShippingsApi(e,_,x,s,a,N,i,c),le=this._createBasketAddressesApi(e,_,x,oe,s,a,o,N,i),Gs=this._createBasketPaymentsApi(e,_,x,oe,N,s,a,i,se,le,h,c),qs=new yr({httpApi:t,basketShippingsApi:oe,basketAddressesApi:le}),zs=new br({nearestPickupPointsService:qs}),Hs=this._createBasketTaxesApi(e),Ks=this._createBasketLoyaltyApi(e),Qt=i.isFeatureEnabled("dev_gift_cards")?this._createBasketGiftCardsApi(_,x,N,e,s,a):void 0,Ws=this._createBasketAdditionalFieldsApi(e,_,N,x);return this.eventBus.emit(new m(S.initialized)),{cores:[{type:ni.api,instance:[x,Le,Xe,Gs,oe,le,N,Hs,Ks,Ws,se,zs,...Qt?[Qt]:[]]},{type:ri,instance:[Vt,De,Kt,je,Wt,lr,ar,Be,Rt,yn,xe,ws,Dt,Es,dr,Ut,Fe,ze,W,He,Ye,jt,kr,$r,xs,Tn,Gt,Ms,bt,zt,V,Me,Os,We,Ls,Ht,Te,Ae,Pr,wr,...i.isFeatureEnabled("dev_gift_cards")?[Je,Tr,Us,Vr,Rr,Dr]:[]]}]}}_createProductsBasketApi(e,t,i,s,a){const o=Bi(),c=new xi(o),h=new Ei({basketProductsListRepository:c,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a}),_=Mi(),b=new Ti(_),w=new Oi({basketProductsSummaryRepository:b,messageStorageApi:e});return new Li({basketProductsListService:h,basketProductsSummaryService:w})}_createBasketPromotionsApi(e,t,i,s,a,o){const c=Ui(),h=new qi(c),_=new Gi({basketPromotionsListRepository:h,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a,basketOverallApi:o}),b=ji(),w=new Ki(b),F=new Hi({basketPromotionsSummaryRepository:w,messageStorageApi:e});return new zi({basketPromotionListService:_,basketPromotionSummaryService:F})}_createBasketPaymentsApi(e,t,i,s,a,o,c,h,_,b,w,F){const x=ga(),N=new ya(x),se=new Va({basketPaymentsListRepository:N,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,basketShippingsApi:s,basketOverallApi:a,flashMessengerApi:o,translationsApi:c,settingsApi:h,basketOrderApi:_,basketAddressesApi:b,pageManagerApi:w,templateHolder:new ns,storeFactoryApi:F});return new _a({basketPaymentsListService:se})}_createBasketShippingsApi(e,t,i,s,a,o,c,h){const _=ma(),b=new ua(_),w=new pa({basketShippingsListRepository:b,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a,basketOverallApi:o,templateHolder:new ns,settingsApi:c,storeFactoryApi:h}),F=Hn(),x=new Kn(F),N=new Wn({basketShippingsCountriesRepository:x,messageStorageApi:e});return new Qi({basketShippingsListService:w,basketShippingsCountriesService:N})}_createBasketAddressesApi(e,t,i,s,a,o,c,h,_){const b=Ra(),w=new Da(b),F=new za({basketAddressesRepository:w,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,basketShippingsApi:s,flashMessengerApi:a,translationsApi:o,userApi:c,basketOverallApi:h,settingsApi:_});return new Ha({basketAddressesService:F})}_createBasketAdditionalFieldsApi(e,t,i,s){const a=Ka(),o=new Wa(a),c=new ja({basketAdditionalFieldsRepository:o,messageStorageApi:e,basketOverallApi:i,basketHttpApi:t,basketUpdaterApi:s});return new Qa({basketAdditionalFieldsService:c})}_createBasketOverallApi(e,t,i,s,a){const o=Ya(),c=new Ja(o),h=new Xa({basketOverallRepository:c,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a});return new Za({basketOverallService:h})}_createBasketTaxesApi(e){const t=tn(),i=new an(t),s=new sn({basketTaxesSummaryRepository:i,messageStorageApi:e}),a=rn(),o=new on(a),c=new nn({basketTaxesListRepository:o,messageStorageApi:e});return new en({basketTaxesSummaryService:s,basketTaxesListService:c})}_createBasketLoyaltyApi(e){const t=cn(),i=new dn(t),s=new hn({basketLoyaltyRepository:i,messageStorageApi:e});return new ln({basketLoyaltyService:s})}_createBasketOrderApi(e,t,i,s,a,o,c,h){const _=Xn(),b=new Zn(_),w=new Sr,F=new Jn({basketHttpApi:e,flashMessengerApi:t,pageManagerApi:i,translationsApi:s,settingsApi:a,storeFactoryApi:o,basketOverallApi:c,basketOrderRepository:b,basketCustomValidation:w,basketUpdaterApi:h});return new jn({basketOrderService:F})}_createBasketGiftCardsApi(e,t,i,s,a,o){const c=Br(),h=new xr(c),_=new Fr({basketG
3569iftCardsRepository:h,basketHttpApi:e,basketUpdaterApi:t,basketOverallApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o});return new Er({basketGiftCardsService:_})}}export{fo as BasketInitializer};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.