PageSourceSearch

https://wydawnictworn.pl/application/assets/storefront/chunk-basket_initializer.DfSuArd.js

js wydawnictworn.pl collected 2026-10-04 13:57:31 UTC 391,459 bytes, 3,559 lines download raw bytes

1import{b as O,J as m,aP as f,c as U,l as K,bX as y,s as C,i as de,t as Hs,aN as rs,c0 as ue,c1 as Ae,c2 as tt,h as xt,c3 as Ks,c4 as kt,c5 as At,a as z,c6 as Ws,aO as Mt,bO as ge,bQ as Ce,L as os,aw as ie,c7 as Ft,bP as Ie,v as k,bq as ht,b_ as js,c8 as ls,bN as H,T as J,e as ae,b8 as cs,c9 as Re,aM as ds,ca as $t,cb as Qs,cc as Pt,cd as Ct,ce as Ys,N as Js,M as Xs,H as Zs,p as ei,D as ti,r as si,C as ii}from"./storefrontApp.5Jl33SLO.min.js";import{B as q}from"./chunk-basket_updated_handler.Dz3Oe5T.js";import{g as B,f as Tt}from"./chunk-vendor-lodash.CWHFt7Z.js";import{d as A,m as S,e as D,B as ke,a as hs,c as ai,k as ps,O as It,S as ni,h as ri}from"./chunk-vendor-rxjs.Dp7kflo.js";import{w as ye,g as ce,s as be,c as fe,i as oi}from"./chunk-index.esm.9jiXzDM.js";import{F as Ot,B as li,P as ci,D as di,C as Ze,S as hi,a as pi,I as ui,H as mi,b as _i}from"./chunk-basket_mapper.BO877fi.js";import{S as N}from"./chunk-storefront_settings_constants.DIF02Gz.js";import{A as gi}from"./chunk-authentication_events.CWEZ3im.js";import{U as yi}
1from"./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 u,t as p,a as ee,c as $e,B as us,h as ms,J as we,T as bi,g as j,q as fi}from"./chunk-vendor-lit.NvY0u02.js";import{M as Si}from"./chunk-modal_constants.RvL-5Lb.js";import{S as pt}from"./chunk-storefront_event_handler.D1TSrvL.js";import{t as l}from"./chunk-translations_directive.GYGOaCp.js";import{o as $}from"./chunk-observable_directive.eGckMWP.js";import{B as Ve}from"./chunk-backdrop_constants.5bk4eBT.js";import{P as vi}from"./chunk-price_mapper.q-RCATk.js";import{S as v}from"./chunk-storefront_base_lit_element.BngXaMu.js";import{o as F}from"./chunk-observe_when_directive.DWgxaey.js";import{I as ki}from"./chunk-input_stepper_constants.CxAeeF7.js";import{B as ne,a as Ai,G as $i}from"./chunk-inpost_pay_button_constants.RkLheTG.js";import{S as Lt}from"./chunk-subscription_controller.pXrelaM.js";import{F as Pe}from"./chunk-form_state_constants.Gcz9tYH.js";import{P as Pi}from"./chunk-product_stock_changed_handler.D1B5WJH.js";import{a as _s}from"./chunk-control_connector_constants.CepOMss.js";import"./chunk-vendor-di.Bh23gdA.js";import"./chunk-vendor-phoenix.cdKS79L.js";import"./chunk-address_mapper.AwvzYnt.js";import"./chunk-loyalty_points_mapper._k-IbY5.js";import"./chunk-bundle_item_mapper.BFbNen8.js";import"./chunk-producer_mapper.Dd9slVR.js";import"./chunk-product_events_constants.BHFu5GP.js";class Ci 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(A((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(f.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(f.unexpectedError))}}const Ii=({storeName:n="BasketProductsListStore"}={})=>U({name:n},ye());class wi{#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:""},Ei={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:""},position:0,count:0,...Ee},Bi=({storeName:n="BasketProductsSummaryStore"}={})=>U({name:n},K(Ei));class xi{#e;#t;constructor(e){this.#e=e,this.#t=new Ot}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 Mi 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})=>
1{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(A((e,t)=>B(e,t)))}_setDiscountedSum(e){this.#e.setDiscountedSum(e)}getDiscountedSum(){return this.#e.getDiscountedSum()}selectDiscountedSum$(){return this.#e.selectDiscountedSum$().pipe(A((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(A((e,t)=>B(e,t)))}}class Fi 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 Ti extends Hs{constructor({httpApi:e}){super(e),this.moduleName=rs.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(f.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(f.changeState,ue.idle)),b)).catch(b=>{throw clearTimeout(o),this.eventBus.emit(new m(f.changeState,ue.idle)),b})}catch(c){return this.eventBus.emit(new m(f.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 Oi={_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 Li extends O{#e;#t=new li;#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(Ae),this.#i||(this.#i=this.#n.createStore("local",Ae))}_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(f.unexpectedError,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(gi.loggedOut,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(f.orderPlaced,()=>{this._hasBasket()&&this._clearBasket()}),this.eventBus.on(yi.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 M=this.#t.toModel(w.basket),x=w.addedItem;c=c===void 0?!0:c;const L=M.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(f.itemAddedToBasket,{addedItem:x,product:L,basket:M,showAddedModal:c}))),M}catch(b){return console.error(b),b.response.status===xt.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=Ws.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>Ks}_getRememberedCreateBasketCheckStatusUrl(){const e=this.#l?.get(kt),t=this.#l?.get(At);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(At,String(Date.now()))),t):(this._removeCreateBasketCheckStatusUrl(),null)}_removeCreateBasketCheckStatusUrl(){this._isRememberCreateBasketQueueEnabled()&&(this.#l?.remove(kt),this.#l?.remove(At))}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(f.basketUpdated,this.#t.toModel(Oi)))}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(f.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(f.unexpectedError))}}class Ni 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 Vi=({storeName:n="BasketPromotionsListStore"}={})=>U({name:n},ye());class Ri 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(A((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(f.unexpectedError))}}class Di{#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 Ui 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 Gi 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(A((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(A((e,t)=>B(e,t)))}}class qi{#e;#t;#s;constructor(e){this.#e=e,this.#t=new Ot,this.#s=new ci}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 zi={discountsSum:{currency:"",grossValue:0,grossValueFormatted:"",netValue:0,netValueFormatted:"",taxValue:0,taxValueFormatted:"",tax:0,taxFormatted:""},hasPromotionCode:!1,promotionCode:null},Hi=({storeName:n="BasketPromotionsSummaryStore"}={})=>U({name:n},K(zi));class Ki 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 gs;gs=os;const Wi=class ys{constructor({code:e,isCollectOnDeliveryAvailable:t,supplier:i,name:s,description:a,street:o,house
1Number:c,city:h,postalCode:_,province:b,countryCode:w,latitude:M,longitude:x,openingHours:L}){this[gs]=!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=M,this.longitude=x,this.openingHours=L}static create(e){return new ys(e)}};let he=Wi;const wt={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:wt.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:wt.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:wt.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 Qi{execute(){return it}}const jt="inpost-geowidget-map",Qt="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(jt)?.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="${Qt}" 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",jt),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(`#${Qt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class Yi{execute(){return at}}const Ji="parcelCollect",Xi="inpost-geowidget",Yt="inpost-geowidget-map",Jt="inpost-geowidget-modal",bs="en",Zi=["pl",bs,"uk","es","fr","pt","it","nl","de"],ea="PL",ta="https://geowidget.inpost-group.com/inpost-geowidget.js",sa="https://geowidget.inpost-group.com/inpost-geowidget.css",ia="https://sandbox-global-geowidget-sdk.easypack24.net/inpost-geowidget.js",aa="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(Si.opened,()=>{ie.nextTick(()=>{this._appendGeowidgetToModal(),document.getElementById(Yt)?.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?ia:ta,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?aa:sa,document.head.appendChild(t)})}_createModal(){const e=document.createElement("aside");return e.innerHTML=`
22            <h-modal
23                class="modal-wrapper_inpost-map"
24                id="${Jt}"
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(Xi);e.setAttribute("id",Yt),e.setAttribute("token",this._token),e.setAttribute("config",Ji);const t=this._translationApi.selectedLanguage().split("_")[0],i=Zi.includes(t)?t:bs;e.setAttribute("language",i);const s=this._basketShippingListService.getSelectedShippingCountry()?.country.isocode??ea;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(`#${Jt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class na{execute(){return nt}}const Xt="alsendo-modal";class rt{static{this._isMapReady=!1}constructor({basketShippingListService:e,pickupPointTypes:t,appId:i}
47){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="${Xt}" 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(`#${Xt}`);e?.close().then(()=>{e?.parentElement?.remove()})}}class ra{execute(){return rt}}const Zt={pocztaPolska:ji,inpost:Qi,inpostV5:Yi,InPostInternational:na,ShoperShipment:ra},G={billingAddressModalOpened:"billingAddressModal.opened",shippingAddressModalOpened:"shippingAddressModal.opened",basketPreviewOpened:"basketPreview.opened",ssoShippingSetEvent:"basket.SSOShippingSetEvent",paymentChosenByUser:"basket.paymentChosenByUser",shippingChosenByUser:"basket.shippingChosenByUser",ssoAddressSetEvent:"basket.ssoAddressSetEvent"};class oa extends pt{constructor(e){super(e,{eventName:G.shippingChosenByUser})}}class la extends pt{constructor(e){super(e,{eventName:G.ssoAddressSetEvent})}}class ca 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 Ft,this._setupLocalStore(),this._setupEventListeners(),this._setupSubscriptions(),Object.defineProperty(window,"__esModule",{value:void 0})}_setupLocalStore(){this.#h=this.#l.getStore(Ae),this.#h||(this.#h=this.#l.createStore("local",Ae))}_setupEventListeners(){new q(this.#p,this.#a),this.eventBus.on("invalidSection.shipping",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),new oa(()=>{this.#h?.set("shippingChosenByUser","1")}),new la(({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(A((e,t)=>B(e,t)))}getSelectedShipping(){return this.get().find(e=>e.isSelected)}selectSelectedShipping$(){return this.select$().pipe(S(e=>e.find(t=>t.isSelected))).pipe(A((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(S(e=>e.flatMap(t=>t.countries)))}selectSelectedShippingCountry$(){return this.selectSelectedShippingCountries$().pipe(S(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(f.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(f.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(S(()=>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(S(()=>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(Zt[t]&&this.addMap(e,Zt[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(f.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(f.unexpectedError))}}class da{#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 ha=({storeName:n="BasketShippingsListStore"}={})=>U({name:n},ye(),K(Ee));class pa 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 ua=({storeName:n="BasketPaymentsListStore"}={})=>U({name:n},ye(),K(Ee));class ma{#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(f.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 _a 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(f.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 ga 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 es extends te{async getPaymentButton(){const e=this.basketOverallApi.selectSum$().pipe(S(({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(f.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 ya{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 ba extends Y{async getPaymentButton(){const e=`pay-with-blik-${k()}`,t=`blik-wait-for-acceptance-${k()}`,i=`blik-code-${k()}`,s=`pay-with-blik-button-${k()}`,a=new ya({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(f.orderPlaced))):s.status==="pending"?setTimeout(()=>{this._checkForTransactionStatus(e,t)},1e3):(this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(f.orderPlaced)))}else this._redirectToBasketDonePage(t._links.showOrder.href),this.eventBus.emit(new m(f.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 fa extends Y{}class Sa extends Y{isPaymentAvailable(){return window.ApplePaySession||this.settingsApi.isFeatureEnabled("dev_payments_basket_p24_apple_pay")}}class va 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(f.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 ka{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 ka,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 Aa 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-${k()}`;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(f.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 $a 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-${k()}`;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(f.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 Pa 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-${k()}`;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(f.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 Ca 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(f.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 fs 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 fs{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 Ia 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 wa 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 Ea 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 Ba 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 xa extends Y{isPaymentAvailable(){return this.settingsApi.isFeatureEnabled("dev_payments_p24_gopay_googlepay_in_all_currencies")?!0:super.isPaymentAvailable()}}const Ma={[T.default]:te,[T.googlePay]:_a,[T.applePay]:ga,[T.autopayDefault]:fs,[T.autopayInstallments]:lt,[T.paypalec]:es,[T.paypal]:es,[T.googlePayP24]:va,[T.goPayP24]:xa,[T.applePayP24]:Sa,[T.blik]:fa,[T.blik0]:ba,[T.hubP24]:ot,[T.cardsP24]:Ea,[T.paypoP24]:dt,[T.installmentsP24]:ct,[T.p24]:Y,[T.p24Default]:Y,[T.stripeApplePay]:Aa,[T.stripeGooglePay]:$a,[T.stripeLink]:Pa,[T.stripeCard]:Ca,[T.zagiel]:Ba,[T.
334stripeDefault]:Se,[T.klarna]:Ia,[T.payu]:wa};class Fa extends pt{constructor(e){super(e,{eventName:G.ssoShippingSetEvent})}}class Ta extends pt{constructor(e){super(e,{eventName:G.paymentChosenByUser})}}class Oa extends O{#e;#t;#s;#a;#n;#r;#o;#i;#l;#c;#d;#h;#p;#u;#m=new Ft;#_;constructor({basketPaymentsListRepository:e,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:s,basketShippingsApi:a,basketOverallApi:o,flashMessengerApi:c,translationsApi:h,settingsApi:_,basketOrderApi:b,basketAddressesApi:w,pageManagerApi:M,templateHolder:x,storeFactoryApi:L}){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=M,this.#_=x,this.#p=L;for(const[se,Le]of Object.entries(Ma))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(Ae),this.#u||(this.#u=this.#p.createStore("local",Ae))}_setupEventListeners(){new q(this.#g,this.#a),this.eventBus.on("invalidSection.payment",({body:e})=>{this.#e.setSectionValidation({isValid:!1,validationMessage:e||""})}),new Ta(()=>{this.#u?.set("paymentChosenByUser","1")}),new Fa(({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(A((e,t)=>B(e,t)),S(([e])=>e.filter(t=>this.getPaymentChannelStrategy(t.channelKey).isPaymentAvailable())))}getAvailable(){return this._filterAvailablePayments(this.get())}selectAvailable$(){return D([this.select$(),this.#n.selectSelectedShipping$()]).pipe(S(([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(f.setPayment)),this.#s.emitUpdateBasketEvent(s)}catch(t){this._handleUnexpectedError(t)}}getSelectedPayment(){return this.get().find(e=>e.isSelected)}selectSelectedPayment$(){return this.select$().pipe(S(e=>e.find(t=>t.isSelected))).pipe(A((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(S(([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(f.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(f.unexpectedError))}}const La=({storeName:n="BasketAddressesStore"}={})=>U({name:n},K({shippingAddress:null,paymentAddress:null,pickupPointData:null,...Ee}));class Na{#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 Ss;Ss=os;const Va=class vs{constructor({isCompany:e,companyName:t,firstName:i,lastName:s,phone:a,street:o,countryId:c,buildingNumber:h,apartmentNumber:_,email:b,state:w,city:M,taxId:x,postalCode:L}){this[Ss]=!0,this.isCompany=e,this.companyName=t,this.firstName=i,this.lastName=s,this.countryId=c,this.city=M,this.postalCode=L,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 vs(e)}};let Ra=Va;class Da{toModel(e){return Ra.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 Ua 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 ke(!1),this.showShippigAddressCard$=new ke(!1),this.isCompany$=new ke(!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(f.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(S(e=>e?.isCompany===!0),A()).subscribe(e=>this.isCompany$.next(e)),D([this.#i.selectUser$(),this.selectBillingAddress$()]).pipe(A((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(A((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(S(i=>i.changeBillingAddress),A((i,s)=>B(i,s))),t=this.#l.selectActions$().pipe(S(i=>i.changeShippingAddress),A((i,s)=>B(i,s)));D([this.#i.selectUser$(),e,t]).pipe(A((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 Da;if(_?.billingAddress){const w=b.toModel(_?.billingAddress);if(w&&o){const M={...b.toBasketAddressDTO(w),useAsShippingAddress:!1,createUserAccount:!1};await this.setBillingAddress(M)}}if(_?.shippingAddress){const w=b.toModel(_?.shippingAddress);if(w&&c){const M={...b.toBasketAddressDTO(w),useAsShippingAddress:!1,createUserAccount:!1};await this.setShippingAddress(M)}}}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(A((e,t)=>B(e,t)))}getBillingAddress(){return this.#e.getBillingAddress()}selectBillingAddress$(){return this.#e.selectBillingAddress$().pipe(A((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(S(([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(S(([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(S(([e])=>!(e?.isPickupPointDelivery||e?.isPersonalCollect)))}selectShowBillingAddressCard$(){return this.showBillingAddressCard$.asObservable().pipe(A())}selectShowShippingAddressCard$(){return this.showShippigAddressCard$.asObservable().pipe(A())}setIsCompany(e){this.isCompany$.next(e)}selectIsCompany$(){return this.isCompany$.asObservable().pipe(A())}_handleUnexpectedError(e){console.error(e),this.#r.addFlashMessage({type:"error",content:this.#o.translate("An unexpected error occurred")}),this.eventBus.emit(new m(f.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 Ga 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 qa=({storeName:n="BasketAdditionalFieldsStore"}={})=>U({name:n},K({selectFields:[],descriptionFields:[],inputFields:[],fileFields:[],hiddenFields:[],checkboxFields:[],...Ee}));class za{#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 Ha 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(A((e,t)=>
334B(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 Ka extends O{constructor({basketAdditionalFieldsService:e}){super(),this.moduleName=ls.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 Wa=({storeName:n="BasketOverallStore"}={})=>{const e=new di,t=new Ot,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 Qa 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(f.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(A((e,t)=>B(e,t)))}_setSum(e){this.#e.setSum(e)}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(A((e,t)=>B(e,t)))}_setSumWithoutPaymentAndShipping(e){this.#e.setSumWithoutPaymentAndShipping(e)}getSumWithoutPaymentAndShipping(){return this.#e.getSumWithoutPaymentAndShipping()}selectSumWithoutPaymentAndShipping$(){return this.#e.selectSumWithoutPaymentAndShipping$().pipe(A((e,t)=>B(e,t)))}_setSumToPay(e){this.#e.setSumToPay(e)}getSumToPay(){return this.#e.getSumToPay()}selectSumToPay$(){return this.#e.selectSumToPay$().pipe(A((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(A((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(f.unexpectedError))}}class Ya 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 Ja 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 Xa=({storeName:n="BasketTaxesSummaryStore"}={})=>{const e=new vi().toModel({text:"",float:0});return U({name:n},K({sum:e}))};class Za 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(A((e,t)=>
334B(e,t)))}}class en{#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 tn 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(A((e,t)=>B(e,t)))}}const sn=({storeName:n="BasketTaxesListStore"}={})=>U({name:n},ye());class an{#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 nn 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 rn=({storeName:n="BasketLoyaltyStore"}={})=>U({name:n},K({loyaltyPointsAwarded:null,hasItemsPaidInLoyaltyPoints:!1,loyaltyPointsCost:null,loyaltyPointsExchangePrice:null}));class on{#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 ln 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(A((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(A((e,t)=>B(e,t)))}_setLoyaltyPointsExchangePrice(e){this.#e.setLoyaltyPointsExchangePrice(e)}getLoyaltyPointsExchangePrice(){return this.#e.getLoyaltyPointsExchangePrice()}selectLoyaltyPointsExchangePrice$(){return this.#e.selectLoyaltyPointsExchangePrice$().pipe(A((e,t)=>B(e,t)))}}var cn=Object.defineProperty,ks=(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 Nt extends v{constructor(){super(),this.mode="basket",this._isValid=!0,this._confirmModal=P(),this._confirmModalId=`remove-all-products-confirm-modal-${k()}`,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(S(([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(f.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`${F(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` ${F(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                ${F(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        `}}ks([u()],Nt.prototype,"mode");ks([p()],Nt.prototype,"_isValid");var dn=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&&dn(e,t,s),s};class De extends v{constructor(){super(),this.mode="basket",this.hasAdditionalInfo=!0,this.products=[],this._confirmModal=P(),this._currentProduct=null,this._listId=k(),this._confirmModalId=`remove-product-confirm-modal-${k()}`,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(){hs(this,ki.valueChanged).pipe(A(),ai(200),S(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([u()],De.prototype,"mode");mt([u({type:Boolean,attribute:"has-additional-info"})],De.prototype,"hasAdditionalInfo");mt([u()],De.prototype,"products");mt([p()],De.prototype,"_currentProduct");const pe={basket:"basket",fullBasket:"fullBasket",checkout:"checkout"},ts="basket-summary__coupon",hn=/[\u200B-\u200D\uFEFF]/g;var pn=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&&pn(e,t,s),s};class Be extends v{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(N.api),this._basketOverallApi=this.getApiSync(H.api),this._storefrontSettingsApi.selectSkinSettings$().subscribe(e=>{this._showTaxInfo=e.showAdditionalTaxInfo==="1"}),this._hasAnyPromotions$=this._basketPromotionsApi.select$().pipe(S(e=>e.length>0)),this._hasAnyDiscounts$=D([this._basketPromotionsApi.selectHasPromotionCode$(),this._hasAnyPromotions$]).pipe(S(([e,t])=>e||t)),this._shouldDisplayBasketSummaryPrices$=this._hasAnyDiscounts$.pipe(S(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` ${F(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([u()],Be.prototype,"mode");Ue([u()],Be.prototype,"hasContent");Ue([u()],Be.prototype,"url");Ue([u({type:String,attribute:"basket-url"})],Be.prototype,"basketUrl");Ue([p()],Be.prototype,"_showTaxInfo");var un=Object.defineProperty,As=(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 Vt extends v{constructor(){super(),this.discounts=[],this.discountsSum=null,this._storefrontSettingsApi=this.getApiSync(N.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                    >
697                        <ul class="price-list price-list_secondary price-list_s">
698                            ${this.discounts.map(t=>r`
699                                    <li class="price-list__item">
700                                        <span class="price-list__label price_s">
701                                            ${g(t.percentage,()=>r`
702                                                    <span class="tag font_semibold tag_promotion"> -${t.percentage+"%"} </span>
703                                                `,()=>d)}
704                                            ${t.label}
705                                        </span>
706                                        <span class="price-list__value price__value price__value_special price_s">
707                                            ${t.discount?.grossValueFormatted}
708                                        </span>
709                                    </li>
710                                `)}
711                        </ul>
712                    </h-accordion-content>
713                </h-accordion-group>
714            </h-accordion>`)}`}}As([u()],Vt.prototype,"discounts");
714As([u()],Vt.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 mn extends v{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(N.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(S(([e,t,i])=>e.changeShippingCountry!==void 0&&t.length>1&&!this._basketAddressesApi.isAddressFilled(i))),this._deliveryTime$=this._basketOverallApi.selectDelivery$().pipe(S(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">
715            <div class="grid__row grid__row_xs-vcenter mb-xs-1">
716                <div class="grid__col grid__col_xs-grow">
717                    <flash-messenger
718                        ${I(this._flashMessengerRef)} 
719                        class="d-block mb-xs-1"
720                        name="shipping-chooser"
721                        tabindex="-1"
722                    ></flash-messenger>
723
724                    <h2 class="section-title section-title_s mb-xs-2">${l("Delivery")}</h2>
725
726                    ${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">
727                                  <img
728                                      src="/assets/img/flags/${this._settingsApi.getCountryById(this._selectedShippingCountry.value.country.id)?.locale}.png"
729                                      alt=""
730                                      class="mr-xs-1"
731                                  />${this._selectedShippingCountry.value?.country.name}
732                                  ${F(this._canChangeShippingCountry$,r`<small class="d-block color_tertiary mt-xs-2"
733                                          >${l("To change the country, add a shipping address.")}</small
734                                      >`,d)}
735                              </p>`,()=>d)}`}
736                </div>
737            </div>
738
739            <p class="font_size-s">${l("Shipping within")} <b class="font_semibold">${$(this._deliveryTime$)}</b></p>
740
741            <basket-shippings-list .shippings=${$(this._basketShippingsApi.select$())}></basket-shippings-list>
742        </section>`}}const _n={shippingSelected:"shippingSelected"},$s={api:"nearestPickupPointsApi"};var gn=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&&gn(e,t,s),s};class xe extends v{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($s.api),this.eventBus.on(f.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(_n.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`
743            <div slot="description">
744                <p class="font_size-xs">
745                    ${g(i,()=>r`
746                            <span class="color_main">
747                                ${l("Free delivery for orders over")}
748                                <strong class="font_semibold"> ${e.requiredBasketValueForFreeShipping?.text} </strong>
749                            </span>
750                        `,()=>d)}
751                    ${t?e.description:d}
752                </p>
753            </div>
754        `}render(){return r`
755            ${$e(this.shippings,e=>us.encode(JSON.stringify(e)),e=>r`
756                    <h-radio
757                        class="${ee({"basket-shipping":!0,"basket-shipping_selected":e.isSelected})}"
758                        controlId="${`shipping-${e.id}`}"
759                        controlName="basket_shipping"
760                        ?checked="${e.isSelected}"
761                        .value="${e.id}"
762                        @change="${t=>this._setShipping(t,e)}"
763                    >
764                        <h-radio-control aria-describedby="shipping-desc-${e.id}"></h-radio-control>
765
766                        <h-radio-content class="basket-shipping__radio">
767                            <div
768                                aria-label="${e.name}"
769                                class="basket-shipping__header"
770                                slot="label"
771                            >
772                                <span
773                                    aria-hidden="true"
774                                    class="basket-shipping__name"
775                                    >${e.name}</span
776                                >
777
778                                <div class="basket-shipping__summary">
779                                    ${g(e.image,()=>r`<img
780                                                aria-hidden="true"
781                                                style="height: 30px"
782                                                src="${e.image}"
783                                                alt="${e.name}"
784                                            />`,()=>d)}
785
786                                    <strong
787                                        aria-hidden="true"
788                                        class="font_semibold"
789                                    >
790                                        ${e.price.grossValue?e.price.grossValueFormatted:r`<span class="basket-shipping__price_highlight">${l("Free")}</span>`}
791                                    </strong>
792                                </div>
793                            </div>
794
795                            ${e.isSelected&&!this.isSimple?r` <div slot="description">
796                                      ${g(e.description,()=>r`<span
797                                                  class="font_size-xs"
798                                                  id="shipping-desc-${e.id}"
799                                                  >${e.description}</span
800                                              >`,()=>d)}
801                                      ${g(e.isPickupPointDelivery&&!this.isSimple,()=>r`
802                                              <div class="basket-shipping__pickup-point">
803                                                  ${g(e.pickupPoint,()=>r`
804                                                          ${F(this._nearestPickupPointsApi.selectHasNearestPickupPointStrategy$(),r` <nearest-pickup-points
805                                                                      class="nearest-pickup-points"
806                                                                      .nearestPickupPoints=${this._nearestPickupPoints}
807                                                                      .shipping=${e}
808                                                                      .selectedPickupPoint=${e.pickupPoint}
809                                                                      @nearestPickupPointsSearch=${async t=>{this._basketAddressApi.setPickupPointData(t.detail.zipCode),this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints()||[]}}
810                                                                      @pickupPointSelected=${t=>{const i=t.detail.pickupPoint;this._basketShippingsApi.setPickupPoint(e,i)}}
811                                                                      class="d-block mb-xs-2"
812                                                                  ></nearest-pickup-points>
813                                                                  <button
814                                                                      @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}}
815                                                                      class="btn btn_s btn_outline"
816                                                                  >
817                                                                      <h-icon
818                                                                          icon-name="icon-map-pin"
819                                                                          css-classes="btn__icon btn__icon_left"
820                                                                          aria-hidden="true"
821                                                                      ></h-icon>
822
823                                                                      ${l("Choose delivery point")}
824                                                                  </button>`,r`<span class="font_size-xs color_main"
825                                                                      >${l("Choosen delivery point")}</span
826                                                                  >
827
828                                                                  <address class="basket-shipping__pickup-point-address">
829                                                                      <p class="font_size-xs">
830                                                                          <strong class="font_semibold"> ${e.pickupPoint?.code} </strong>,
831                                                                          ${e.pickupPoint?.address.street}
832                                                                          ${e.pickupPoint?.address.houseNumber},
833                                                                          ${e.pickupPoint?.address.postalCode}
834                                                                          ${e.pickupPoint?.address.city},
835                                                                          ${e.pickupPoint?.address.description}
836                                                                      </p>
837
838                                                                      <button
839                                                                          @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}}
840                                                                          class="btn btn_s btn_outline"
841                                                                      >
842                                                                          <h-icon
843                                                                              icon-name="icon-map-pin"
844                                                                              css-classes="btn__icon btn__icon_left"
845                                                                              aria-hidden="true"
846                                                                          ></h-icon>
847
848                                                                          ${l("Change delivery point")}
849                                                                      </button>
850                                                                  </address>`)}
851                                                      `,()=>r`
852                                                          ${F(this._nearestPickupPointsApi.selectHasNearestPickupPointStrategy$(),r`<nearest-pickup-points
853                                                                  class="nearest-pickup-points"
854                                                                  .nearestPickupPoints=${this._nearestPickupPoints}
855                                                                  .shipping=${e}
856                                                                  @nearestPickupPointsSearch=${async t=>{this._basketAddressApi.setPickupPointData(t.detail.zipCode),this._nearestPickupPoints=await this._nearestPickupPointsApi.findNearestPickupPoints()||[]}}
857                                                                  @pickupPointSelected=${t=>{const i=t.detail.pickupPoint;this._basketShippingsApi.setPickupPoint(e,i)}}
858                                                                  class="d-block mb-xs-2"
859                                                              ></nearest-pickup-points>`,d)}
860
861                                                          <button
862                                                              @click=${()=>{this._basketShippingsApi.showPickupPointMap(e)}}
863                                                              class="btn btn_s btn_outline"
864                                                              aria-haspopup="dialog"
865                                                          >
866                                                              <h-icon
867                                                                  icon-name="icon-map-pin"
868                                                                  css-classes="btn__icon btn__icon_left"
869                                                                  aria-hidden="true"
870                                                              ></h-icon>
871
872                                                              ${l("Choose delivery point")}
873                                                          </button>
874                                                      `)}
875                                              </div>
876                                          `,()=>d)}
877                                      ${g(this._basketShippingsApi.shouldDisplayRemainingBasketValueForFreeShippingMessage(e),()=>r` ${g(this.isSimple,()=>d,()=>r` <div class="progress-bar mb-xs-1">
878                                                          <div
879                                                              class="progress-bar__bar"
880                                                              style="width: ${(e.requiredBasketValueForFreeShipping.float-e.remainingBasketValueForFreeShipping.float)*100/e.requiredBasketValueForFreeShipping.float}%"
881                                                          ></div>
882                                                      </div>`)}
883
884                                                  <p class="font_size-xs color_main">
885                                                      ${l("Add products worth {{ remainingBasketValueForFreeShipping }} to qualify for free delivery.",{remainingBasketValueForFreeShipping:e.remainingBasketValueForFreeShipping.text})}
886                                                  </p>`,()=>d)}
887                                      ${g(e.isSelected&&this._basketShippingsApi.getShippingInfo(e),()=>[...this._basketShippingsApi.getShippingInfo(e)].map(([,t])=>r`${ms(t)}`))}
888                                  </div>`:this._renderDescription(e)}
889                        </h-radio-content>
890                    </h-radio>
891                `)}
892        `}}Ge([u()],xe.prototype,"shippings");Ge([u({attribute:"is-simple",type:Boolean})],xe.prototype,"isSimple");Ge([p()],xe.prototype,"_currentRadioId");Ge([p()],xe.prototype,"_nearestPickupPoints");Ge([u({type:String})],xe.prototype,"focusedId");var yn=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&&yn(e,t,s),s};class Rt extends v{constructor(){super(),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.eventBus.on(f.paymentInfoAdded,()=>this.requestUpdate()),setTimeout(()=>this.eventBus.emit(new m(f.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=>
892s.actions.selectChannel);i&&this._setPayment(i)}_getChannelsForModal(e){return this.payments.filter(t=>e.subChannels.includes(t.id))}_getChannelsForList(){return this.payments.filter(e=>e.isFeatured)}_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`${ms(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`
893            ${this._getChannelsForList().map(e=>r`
894                    <h-radio
895                        class="${ee({"basket-shipping":!0,"basket-shipping_selected":this._isPaymentOrSubPaymentSelected(e)})}"
896                        controlId=${`payment-${e.id}-${e.paymentId}`}
897                        controlName="basket_payment"
898                        .checked=${this._isPaymentOrSubPaymentSelected(e)}
899                        .value=${e.id}
900                        @change=${t=>{t.target instanceof HTMLInputElement&&this._setPayment(e)}}
901                    >
902                        <h-radio-control aria-describedby="payment-desc-${e.id}-${e.paymentId}"></h-radio-control>
903
904                        <h-radio-content class="basket-shipping__radio">
905                            <div
906                                class="basket-shipping__header"
907                                aria-label="${e.name}"
908                                slot="label"
909                            >
910                                <span
911                                    aria-hidden="true"
912                                    class="basket-shipping__name"
913                                    >${e.name}</span
914                                >
915                                <div class="basket-shipping__summary">
916                                    ${g(e.image,()=>r`<img
917                                                aria-hidden="true"
918                                                class="basket-shipping__image"
919                                                src="${e.image}"
920                                                alt="${e.name}"
921                                            />`,()=>d)}
922                                    ${g(this._basketShippingsApi.isEveryAvailablePaymentFree(),()=>d,()=>r`<strong
923                                            aria-hidden="true"
924                                            class="font_semibold"
925                                        >
926                                            ${this._basketShippingsApi.getPaymentCostForActiveShippingByPaymentId(e.paymentId)?.grossValue?this._basketShippingsApi.getPaymentCostForActiveShippingByPaymentId(e.paymentId)?.grossValueFormatted:r`<span class="color_secondary-500">${l("Free")}</span>`}
927                                        </strong> `)}
928                                </div>
929                            </div>
930
931                            <div slot="description">
932                                ${g(e.description,()=>r`
933                                        <p
934                                            class="font_size-xs"
935                                            id="payment-desc-${e.id}-${e.paymentId}"
936                                        >
937                                            ${e.description}
938                                        </p>
939                                    `)}
940                                ${g(e.subChannels.length>1&&this._isPaymentOrSubPaymentSelected(e),()=>r`
941                                            <payments-list-modal
942                                                ${I(this._paymentsListModalRef)}
943                                                .payments=${this._getChannelsForModal(e)}
944                                                .ctaPaymentLabel=${e.ctaPaymentLabel??""}
945                                            ></payments-list-modal>
946                                            ${g(this._getSelectedSubChannelForSelectedPayment(e),()=>r`
947                                                    <div class="color_main mb-xs-2">
948                                                        <p class="p_no-margin">
949                                                            ${l("Selected")}:
950                                                            <b class="font_semibold">
951                                                                ${this._getSelectedSubChannelForSelectedPayment(e)?.name}
952                                                            </b>
953                                                        </p>
954
955                                                        <button
956                                                            @click=${()=>{this._paymentsListModalRef.value?.open()}}
957                                                            class="btn btn_outline btn_s mt-xs-1"
958                                                        >
959                                                            ${l("Change payment bank")}
960                                                        </button>
961                                                    </div>
962                                                `,()=>r` <button
963                                                    @click=${()=>{this._paymentsListModalRef.value?.open()}}
964                                                    class="btn btn_primary btn_s"
965                                                >
966                                                    ${this._getPaymentCtaLabel(e)}
967                                                </button>`)}
968                                        `,()=>d)}
969                                ${this._renderPaymentAdditionalInfo(e)}
970                            </div>
971                        </h-radio-content>
972                    </h-radio>
973                `)}
974        `}}
974Ps([u()],Rt.prototype,"payments");Ps([u()],Rt.prototype,"isOrderCoveredByGiftCards");var bn=Object.defineProperty,fn=(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 Cs extends v{constructor(){super(),this._subscriptionController=new Lt(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(N.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;const 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">
975            <flash-messenger
976                ${I(this._flashMessengerRef)}
977                class="d-block mb-xs-1"
978                name="payment-chooser"
979                tabindex="-1"
980            ></flash-messenger>
981
982            <h2 class="section-title section-title_s mb-xs-2">${l("Payment")}</h2>
983
984            <basket-payments-list
985                .payments=${$(this._basketPaymentsApi.selectAvailable$())}
986                .isOrderCoveredByGiftCards=${this._isOrderCoveredByGiftCards}
987            ></basket-payments-list>
988
989            <p class="mt-xs-1">
990                <h-icon
991                    class="mr-xs-1 "
992                    icon-name="icon-lock"
993                    css-classes="icon_tertiary-color"
994                    aria-hidden="true"
995                ></h-icon>
996                <small class="color_tertiary">${l("Payments comply with the latest security standards.")}</small>
997            </p>
998        </section>`}}fn([p()],Cs.prototype,"_isOrderCoveredByGiftCards");const Z={consumerAndCompany:"0",consumerOnly:"1",companyOnly:"2"};var Sn=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&&Sn(e,t,s),s};class Is extends v{constructor(){super(),this.addressMode=Z.consumerAndCompany,this._differentShippingAddressCheckboxRef=P(),this._differentShippingAddressCheckboxId=`different-shipping-${k()}`,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(cs.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._translationsApi=this.getApiSync(J.api),this._flashMessengerApi=this.getApiSync(ae.api),this._hasShippingAddress$=this._basketAddressesApi.selectShippingAddress$().pipe(S(i=>this._basketAddressesApi.isAddressFilled(i)));const e=this._basketAddressesApi.getBillingAddress()!==null&&(this._basketAddressesApi.isDifferentShippingAddressRequired()||!this._basketAddressesApi.isBillingAddressEqualShippingAddress()),t=hs(this,"change");this._differentShippingAddressVisibilityChange$=t.pipe(S(this._mapEventToAction)).pipe(ps(e)),this._differentShippingAddressVisibilityChange$.pipe(A()).subscribe(i=>{!i&&e&&this._basketAddressesApi.setBillingAddressAsShippingAddress()}),this._isDifferentShippingAddressChecked$=D([this._basketAddressesApi.selectBillingAddress$(),this._basketAddressesApi.selectIsDifferentShippingAddressRequired$(),this._differentShippingAddressVisibilityChange$,this._basketAddressesApi.selectIsBillingAddressEqualShippingAddress$()]).pipe(S(([i,s,a,o])=>!!(i&&(!o||s)||a))),this._isDifferentShippingAddressDisabled$=D([this._basketAddressesApi.selectIsDifferentShippingAddressRequired$(),this._basketAddressesApi.selectBillingAddress$()]).pipe(S(([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"}
998_renderBillingAddress(){return r`<div class="basket-module__content basket-module__content_pb-0 basket-module__content_pl-0 basket-module__content_pr-0">
999            <h2 class="section-title section-title_s mb-xs-2 pl-xs-2 pr-xs-2">${l("Order information")}</h2>
1000
1001            ${this._renderStandardBillingAddress()}
1002        </div>`}_renderStandardBillingAddress(){return r`
1003            ${F(this._basketAddressesApi.selectShowBillingAddressCard$(),this._renderEditBillingAddressModal(),r`<div class="pl-xs-2 pr-xs-2 mb-xs-2">
1004                        <flash-messenger
1005                            ${I(this._flashMessengerRef)} 
1006                            name="basket-addresses-2"
1007                            tabindex="-1"
1008                        ></flash-messenger>
1009                    </div>
1010                    <billing-address-standard
1011                        .addressMode=${this.addressMode}
1012                        .address=${$(this._basketAddressesApi.selectBillingAddress$())}
1013                        .isLoggedIn=${$(this._authenticationApi.selectIsAuthorized$())}
1014                    ></billing-address-standard>`)}
1015        `}_renderEditBillingAddressModal(){return r`
1016            <edit-billing-address-modal
1017                @open-modal="${()=>{this._billingAddressModalRef.value?.open()}}"
1018            ></edit-billing-address-modal>
1019        `}
1019_renderShippingAddress(){return r`<div class="control__additional-content control__additional-content_with-border">
1020            ${this._renderStandardShippingAddress()}
1021        </div>`}_renderStandardShippingAddress(){return r`
1022            ${F(this._basketAddressesApi.selectShowShippingAddressCard$(),this._renderEditShippingAddressModal(),r` <shipping-address-standard
1023                    .address=${$(this._basketAddressesApi.selectShippingAddress$())}
1024                ></shipping-address-standard>`)}
1025        `}_renderEditShippingAddressModal(){return r`
1026            <edit-shipping-address-modal
1027                @open-modal="${()=>{this._shippingAddressModalRef.value?.open()}}"
1028            ></edit-shipping-address-modal>
1029        `}_renderDifferentShippingAddressCheckbox(){return r`
1030            <h-checkbox
1031                ${I(this._differentShippingAddressCheckboxRef)}
1032                controlId=${this._differentShippingAddressCheckboxId}
1033                controlName=${this._differentShippingAddressCheckboxId}
1034                value="1"
1035                ?checked=${$(this._isDifferentShippingAddressChecked$)}
1036                ?disabled=${$(this._isDifferentShippingAddressDisabled$)}
1037            >
1038                <h-checkbox-control></h-checkbox-control>
1039
1040                <h-checkbox-content>
1041                    <span slot="label"> ${l("Shipping to a different address")} </span>
1042                </h-checkbox-content>
1043            </h-checkbox>
1044        `}render(){return r`
1045            <div class="basket-addresses">
1046                ${this._renderBillingAddress()}
1047                ${F(this._basketAddressesApi.selectIsDifferentShippingAddressAvailable$(),r`<div class="basket-module__content basket-module__content_secondary">
1048                        <div class="d-flex">
1049                            <h3 class="font_semibold">${l("Delivery details")}</h3>
1050                            <h-icon
1051                                css-classes="ml-xs-1"
1052                                icon-name="icon-truck"
1053                                aria-hidden="true"
1054                            ></h-icon>
1055                        </div>
1056
1057                        <h-control class="mt-xs-1">
1058                            <h-control-content class="control">
1059                                <h-control-element class="control__element">
1060                                    ${F(this._basketAddressesApi.selectBillingAddress$(),r` ${this._renderDifferentShippingAddressCheckbox()} `,r`<h-hint direction="top-left">
1061                                            ${this._renderDifferentShippingAddressCheckbox()}
1062
1063                                            <h-hint-content>
1064                                                <p>${l("First, enter order information (above)")}</p>
1065                                            </h-hint-content>
1066                                        </h-hint>`)}
1067                                </h-control-element>
1068
1069                                ${F(this._isDifferentShippingAddressChecked$,this._renderShippingAddress(),d)}
1070                            </h-control-content>
1071                        </h-control>
1072                    </div>`,d)}
1073            </div>
1074
1075            ${F(this._basketAddressesApi.selectShowBillingAddressCard$(),r`<billing-address-modal
1076                    ${I(this._billingAddressModalRef)}
1077                    .addressMode=${this.addressMode}
1078                    .address=${$(this._basketAddressesApi.selectBillingAddress$())}
1079                    .isLoggedIn=${$(this._authenticationApi.selectIsAuthorized$())}
1080                    @open=${this._dispatchBillingModalActionEvent}
1081                    @close=${this._dispatchBillingModalActionEvent}
1082                ></billing-address-modal>`,d)}
1083            ${F(this._basketAddressesApi.selectShowShippingAddressCard$(),r`<shipping-address-modal
1084                    ${I(this._shippingAddressModalRef)}
1085                    .address=${$(this._basketAddressesApi.selectShippingAddress$())}
1086                ></shipping-address-modal>`,d)}
1087        `}}vn([u({type:String,attribute:"address-mode"})],Is.prototype,"addressMode");var kn=Object.defineProperty,ws=(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 Dt extends v{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`
1088            <p class="p_overflow-wrap-anywhere">
1089                <strong class="font_semibold">
1090                    <h-icon
1091                        class="mr-xs-1"
1092                        icon-name="icon-user"
1093                        aria-hidden="true"
1094                    ></h-icon
1095                    >${this.address.firstName} ${this.address.lastName}
1096                    ${this.address.companyName?r` (${this.address.companyName})`:d}</strong
1097                >
1098            </p>
1099
1100            ${this.address.isCompany?r` <p>${l("Tax ID")} ${this.address.taxId}</p>`:d}
1101
1102            <div class="mb-xs-2">
1103                <p class="p_no-margin p_overflow-wrap-anywhere">
1104                    ${this.address.street}<br aria-hidden="true" />${this.address.zipCode} ${this.address.city}
1105                </p>
1106                <img
1107                    class="mr-xs-1"
1108                    src=${`/assets/img/flags/${this.country.locale}.png`}
1109                    alt=""
1110                />
1111                <span>${l(this.country.name)}</span>
1112            </div>
1113
1114            <p class="p_no-margin p_overflow-wrap-anywhere">${this.address.phone}</p>
1115            <p class="p_overflow-wrap-anywhere">${this.address.email}</p>
1116        `}}ws([u({type:Object})],Dt.prototype,"address");ws([u({type:Object})],Dt.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 An=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&&An(e,t,s),s};class Me extends v{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
1117            ${I(this._modal)}
1118            hidden
1119        >
1120            <h-modal-header>
1121                <h2 class="font_semibold h2">${l("Order information")}</h2>
1122                <h-modal-close
1123                    aria-label="${l("Close window")}"
1124                    class="btn btn_icon"
1125                >
1126                    <h-icon
1127                        icon-name="icon-x"
1128                        role="button"
1129                        size="xl"
1130                        clickable
1131                    ></h-icon>
1132                </h-modal-close>
1133            </h-modal-header>
1134            <h-modal-body>
1135                <flash-messenger
1136                    class="d-block mb-xs-2"
1137                    name="billing-address-modal"
1138                ></flash-messenger>
1139
1140                ${g(this._isLoading,()=>r`<div class="loader">
1141                        <div class="loader__spinner loader__spinner"></div>
1142                    </div>`,()=>r`<billing-address-form
1143                            ${I(this._form)}
1144                            .address=${this.address}
1145                            .addressMode=${this.addressMode}
1146                            .isLoggedIn=${this.isLoggedIn}
1147                            .formErrors=${we.toJson(this._formErrors)}
1148                        ></billing-address-form>`)}
1149            </h-modal-body>
1150
1151            <h-modal-footer>
1152                <button
1153                    class="btn btn_secondary"
1154                    @click=${this._cancel}
1155                >
1156                    ${l("Cancel")}
1157                </button>
1158                <button
1159                    class="btn btn_primary"
1160                    @click=${this._save}
1161                >
1162                    ${l("Save information")}
1163                </button>
1164            </h-modal-footer>
1165        </h-modal>`}}
1165qe([u()],Me.prototype,"address");qe([u()],Me.prototype,"addressMode");qe([u()],Me.prototype,"isLoggedIn");qe([p()],Me.prototype,"_formErrors");qe([p()],Me.prototype,"_isLoading");var $n=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&&$n(e,t,s),s};class ze extends v{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
1166            ${I(this._modal)}
1167            hidden
1168        >
1169            <h-modal-header>
1170                <h2 class="font_semibold h2">${l("Order information")}</h2>
1171                <h-modal-close
1172                    aria-label="${l("Close window")}"
1173                    class="btn btn_icon"
1174                >
1175                    <h-icon
1176                        icon-name="icon-x"
1177                        role="button"
1178                        size="xl"
1179                        clickable
1180                    ></h-icon>
1181                </h-modal-close>
1182            </h-modal-header>
1183            <h-modal-body>
1184                <flash-messenger
1185                    class="d-block mb-xs-2"
1186                    name="shipping-address-modal"
1187                ></flash-messenger>
1188
1189                ${g(this._isLoading,()=>r`<div class="loader">
1190                        <div class="loader__spinner loader__spinner"></div>
1191                    </div>`,()=>r`<shipping-address-form
1192                            ${I(this._form)}
1193                            .address=${this.address}
1194                            .formErrors=${we.toJson(this._formErrors)}
1195                        ></shipping-address-form>`)}
1196            </h-modal-body>
1197
1198            <h-modal-footer>
1199                <button
1200                    class="btn btn_secondary"
1201                    @click=${this._cancel}
1202                >
1203                    ${l("Cancel")}
1204                </button>
1205                <button
1206                    class="btn btn_primary"
1207                    @click=${this._save}
1208                >
1209                    ${l("Save information")}
1210                </button>
1211            </h-modal-footer>
1212        </h-modal>`}}gt([u()],ze.prototype,"address");gt([p()],ze.prototype,"_formErrors");gt([p()],ze.prototype,"_hasErrors");gt([p()],ze.prototype,"_isLoading");const Q="179";var Pn=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&&Pn(e,t,s),s};class W extends v{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-${k()}`,this._emailId=`email-${k()}`,this._firstNameId=`first-name-${k()}`,this._lastNameId=`last-name-${k()}`,this._phoneId=`phone-${k()}`,this._countryId=`country-${k()}`,this._streetId=`street-${k()}`,this._postalCodeId=`postal-code-${k()}`,this._cityId=`city-${k()}`,this._taxId=`tax-${k()}`,this._companyName=`company-name-${k()}`,this._createUserAccountId=`create-user-account-${k()}`,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 It,this._isBuyingEnabledToUnregistered=new It,this._isRegistrationRequired=new It,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
1212one: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):bi.isDefined(s.value)&&(i[s.name]=s.value)}),i},this._storefrontSettings=this.getApiSync(N.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._translationApi=this.getApiSync(J.api),this._orderApi=this.getApiSync(Re.api),this.getApi(ds.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(S(({isRegistrationEnabled:t})=>t==="1"&&!this.isLoggedIn)),this._isBuyingEnabledToUnregistered=this._storefrontSettings.selectSkinSettings$().pipe(S(({isBuyingEnabledToUnregistered:t})=>t==="1"&&!this.isLoggedIn)),this._isRegistrationRequired=this._isBuyingEnabledToUnregistered.pipe(S(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`
1213            <div class="flash-message flash-message__info mb-xs-2">
1214                <h-icon
1215                    icon-name="icon-alert-triangle"
1216                    css-classes="flash-message__icon"
1217                    role="button"
1218                    aria-hidden="true"
1219                ></h-icon>
1220
1221                <p>
1222                    ${j(this._translations["Only registered customers can place orders. {{ link }}Log in{{ linkEnd }} or create a new account by filling out this information."])}
1223                </p>
1224            </div>
1225        `}_renderForm(){return r` <reactive-form ${I(this._reactiveFormRef)}>
1226            <form
1227                id=${this._formId}
1228                @submit=${this.setBillingAddress}
1229            >
1230                <div
1231                    class="form__additional-info mt-xs-0"
1232                    aria-hidden="true"
1233                >
1234                    <i>
1235                        ${l("Required fields are marked with")} -
1236                        <span class="form__additional-info_secondary">*</span>
1237                    </i>
1238                </div>
1239
1240                ${g(!this._storefrontSettings.isFeatureEnabled("storefront_registration")||this._displayCompanyRadio||this._displayConsumerRadio,()=>r`
1241                        <control-connector
1242                            requiredInGroup
1243                            class="control control_row pt-xs-1"
1244                            @change=${e=>{const t=e.target;t instanceof HTMLInputElement&&(this._isCompany=t.value==="true",this._basketAddressesApi.setIsCompany(this._isCompany))}}
1245                        >
1246                            ${g(this._displayConsumerRadio,()=>r`<h-control-content class="control__content_auto">
1247                                    <h-control-element class="control__element">
1248                                        <div class="radio-box">
1249                                            <input
1250                                                type="radio"
1251                                                id="firstname1"
1252                                                name="isCompany"
1253                                                .checked=${!this._isCompany}
1254                                                value="false"
1255                                                class="radio-box__input"
1256                                                aria-label="${l("Consumer")}"
1257                                            />
1258
1259                                            <label
1260                                                class="radio-box__label"
1261                                                for="firstname1"
1262                                                aria-hidden="true"
1263                                            >
1264                                                ${l("Consumer")}
1265                                            </label>
1266                                        </div>
1267                                    </h-control-element>
1268
1269                                    <control-errors></control-errors>
1270                                </h-control-content>`,()=>d)}
1271                            ${g(this._displayCompanyRadio,()=>r`<h-control-content class="control__content_auto">
1272                                    <h-control-element class="control__element">
1273                                        <div class="radio-box">
1274                                            <input
1275                                                type="radio"
1276                                                id="firstname2"
1277                                                name="isCompany"
1278                                                .checked=${this._isCompany}
1279                                                value="true"
1280                                                class="radio-box__input"
1281                                                aria-label="${l("Company")}"
1282                                            />
1283
1284                                            <label
1285                                                class="radio-box__label"
1286                                                for="firstname2"
1287                                                aria-hidden="true"
1288                                            >
1289                                                ${l("Company")}
1290                                            </label>
1291                                        </div>
1292                                    </h-control-element>
1293
1294                                    <control-errors></control-errors>
1295                                </h-control-content>`,()=>d)}
1296                        </control-connector>
1297                    `)}
1298
1299                <control-connector
1300                    min="3"
1301                    email
1302                    class="control"
1303                >
1304                    <h-control>
1305                        <h-control-label class="control__label">
1306                            <label
1307                                class="label label_required"
1308                                for=${this._emailId}
1309                            >
1310                                <span
1311                                    class="label__asterisk"
1312                                    aria-hidden="true"
1313                                    >*</span
1314                                >
1315                                ${l("E-mail address")}
1316                            </label>
1317                        </h-control-label>
1318
1319                        <h-control-content class="control">
1320                            <h-control-element class="control__element">
1321                                <h-input
1322                                    controlId=${this._emailId}
1323                                    controlName="email"
1324                                    .value=${this.address?.email||this._userEmail}
1325                                    required
1326                                >
1327                                    <h-input-control></h-input-control>
1328                                </h-input>
1329                            </h-control-element>
1330
1331                            <control-errors></control-errors>
1332                        </h-control-content>
1333                    </h-control>
1334                </control-connector>
1335
1336                <control-connector
1337                    required
1338                    class="control"
1339                >
1340                    <h-control>
1341                        <h-control-label class="control__label">
1342                            <label
1343                                class="label label_required"
1344                                for=${this._firstNameId}
1345                            >
1346                                <span
1347                                    class="label__asterisk"
1348                                    aria-hidden="true"
1349                                    >*</span
1350                                >
1351                                ${l("First name")}
1352                            </label>
1353                        </h-control-label>
1354
1355                        <h-control-content class="control">
1356                            <h-control-element class="control__element">
1357                                <h-input
1358                                    controlId=${this._firstNameId}
1359                                    controlName="firstName"
1360                                    .value=${this.address?.firstName}
1361                                    required
1362                                >
1363                                    <h-input-control></h-input-control>
1364                                </h-input>
1365                            </h-control-element>
1366
1367                            <control-errors></control-errors>
1368                        </h-control-content>
1369                    </h-control>
1370                </control-connector>
1371
1372                <control-connector
1373                    required
1374                    class="control"
1375                >
1376                    <h-control>
1377                        <h-control-label class="control__label">
1378                            <label
1379                                class="label label_required"
1380                                for=${this._lastNameId}
1381                            >
1382                                <span
1383                                    class="label__asterisk"
1384                                    aria-hidden="true"
1385                                    >*</span
1386                                >
1387                                ${l("Last name")}
1388                            </label>
1389                        </h-control-label>
1390
1391                        <h-control-content class="control">
1392                            <h-control-element class="control__element">
1393                                <h-input
1394                                    controlId=${this._lastNameId}
1395                                    controlName="lastName"
1396                                    .value=${this.address?.lastName}
1397                                    required
1398                                >
1399                                    <h-input-control></h-input-control>
1400                                </h-input>
1401                            </h-control-element>
1402
1403                            <control-errors></control-errors>
1404                        </h-control-content>
1405                    </h-control>
1406                </control-connector>
1407
1408                ${g(this._isCompany,()=>r` <control-connector
1409                            ?required=${this._isCompany}
1410                            class="control"
1411                        >
1412                            <h-control>
1413                                <h-control-label class="control__label">
1414                                    <label
1415                                        class="label label_required"
1416                                        for=${this._taxId}
1417                                    >
1418                                        <span
1419                                            class="label__asterisk"
1420                                            aria-hidden="true"
1421                                            >*</span
1422                                        >
1423                                        ${l("Taxpayer Identification Number (TIN)")}
1424                                    </label>
1425                                </h-control-label>
1426
1427                                <h-control-content class="control">
1428                                    <h-control-element class="control__element">
1429                                        <h-input
1430                                            controlId=${this._taxId}
1431                                            controlName="taxId"
1432                                            .value=${this.address?.taxId}
1433                                            ?required=${this._isCompany}
1434                                        >
1435                                            <h-input-control></h-input-control>
1436                                        </h-input>
1437                                    </h-control-element>
1438
1439                                    <control-errors></control-errors>
1440                                </h-control-content>
1441                            </h-control>
1442                        </control-connector>
1443
1444                        <control-connector
1445                            ?required=${this._isCompany}
1446                            class="control"
1447                        >
1448                            <h-control>
1449                                <h-control-label class="control__label">
1450                                    <label
1451                                        class="label label_required"
1452                                        for=${this._companyName}
1453                                    >
1454                                        <span
1455                                            class="label__asterisk"
1456                                            aria-hidden="true"
1457                                            >*</span
1458                                        >
1459                                        ${l("Company name")}
1460                                    </label>
1461                                </h-control-label>
1462
1463                                <h-control-content class="control">
1464                                    <h-control-element class="control__element">
1465                                        <h-input
1466                                            controlId=${this._companyName}
1467                                            controlName="companyName"
1468                                            .value=${this.address?.companyName}
1469                                            ?required=${this._isCompany}
1470                                        >
1471                                            <h-input-control></h-input-control>
1472                                        </h-input>
1473                                    </h-control-element>
1474
1475                                    <control-errors></control-errors>
1476                                </h-control-content>
1477                            </h-control>
1478                        </control-connector>`,()=>d)}
1479
1480                <control-connector
1481                    required
1482                    class="control"
1483                >
1484                    <h-control>
1485                        <h-control-label class="control__label">
1486                            <label
1487                                class="label label_required"
1488                                for=${this._phoneId}
1489                            >
1490                                <span
1491                                    class="label__asterisk"
1492                                    aria-hidden="true"
1493                                    >*</span
1494                                >
1495                                ${l("Phone number")}
1496                            </label>
1497                        </h-control-label>
1498
1499                        <h-control-content class="control">
1500                            <h-control-element class="control__element">
1501                                <h-input
1502                                    controlId=${this._phoneId}
1503                                    controlName="phone"
1504                                    .value=${this.address?.phone}
1505                                    required
1506                                >
1507                                    <h-input-control type="tel"></h-input-control>
1508                                </h-input>
1509                            </h-control-element>
1510
1511                            <control-errors></control-errors>
1512                        </h-control-content>
1513                    </h-control>
1514                </control-connector>
1515
1516                <control-connector
1517                    required
1518                    class="control"
1519                >
1520                    <h-control>
1521                        <h-control-label class="control__label">
1522                            <label
1523                                class="label label_required"
1524                                for="${this._countryId}"
1525                                id="${this._countryId}-label"
1526                            >
1527                                <span
1528                                    class="label__asterisk"
1529                                    aria-hidden="true"
1530                                    >*</span
1531                                >
1532                                ${l("Country")}
1533                            </label>
1534                        </h-control-label>
1535
1536                        <h-control-content class="control">
1537                            <h-control-element class="control__element control__element_half">
1538                                <h-select
1539                                    @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)}}
1540                                    class="select"
1541                                    control-id=${this._countryId}
1542                                    control-name="countryId"
1543                                    no-deselect
1544                                    ${I(this._countrySelectRef)}
1545                                    .optionsList="${this._allCountries}"
1546                                    assistive-title-id="${this._countryId}-label"
1547                                    ?required=${this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")}
1548                                    ?dev_cached_select_options=${this._storefrontSettings.isFeatureEnabled("dev_cached_select_options")}
1549                                >
1550                                    <h-select-toggler
1551                                        class="select-toggler"
1552                                        aria-labelledby="${this._countryId}-label"
1553                                    >
1554                                        <span
1555                                            class="select-toggler__placeholder"
1556                                            slot="placeholder"
1557                                            >${l("Select")}</span
1558                                        >
1559                                    </h-select-toggler>
1560                                </h-select>
1561                            </h-control-element>
1562
1563                            <control-errors></control-errors>
1564                        </h-control-content>
1565                    </h-control>
1566                </control-connector>
1567
1568                <control-connector
1569                    ?streetWithNumber=${this._selectedCountryId===Q}
1570                    ?required=${this._selectedCountryId!==Q}
1571                    class="control"
1572                >
1573                    <h-control>
1574                        <h-control-label class="control__label">
1575                            <label
1576                                class="label label_required"
1577                                for=${this._streetId}
1578                            >
1579                                <span
1580                                    class="label__asterisk"
1581                                    aria-hidden="true"
1582                                    >*</span
1583                                >
1584                                ${l("Street name and house number")}
1585                            </label>
1586                        </h-control-label>
1587
1588                        <h-control-content class="control">
1589                            <h-control-element class="control__element">
1590                                <h-input
1591                                    controlId=${this._streetId}
1592                                    controlName="street"
1593                                    .value=${this.address?.street}
1594                                    required
1595                                >
1596                                    <h-input-control></h-input-control>
1597                                </h-input>
1598                            </h-control-element>
1599
1600                            <control-errors></control-errors>
1601                        </h-control-content>
1602                    </h-control>
1603                </control-connector>
1604
1605                <control-connector
1606                    required
1607                    class="control"
1608                >
1609                    <h-control>
1610                        <h-control-label class="control__label">
1611                            <label
1612                                class="label label_required"
1613                                for=${this._postalCodeId}
1614                            >
1615                                <span
1616                                    class="label__asterisk"
1617                                    aria-hidden="true"
1618                                    >*</span
1619                                >
1620                                ${l("Postal code")}
1621                            </label>
1622                        </h-control-label>
1623
1624                        <h-control-content class="control">
1625                            <h-control-element class="control__element control__element_quarter">
1626                                <h-input
1627                                    controlId=${this._postalCodeId}
1628                                    controlName="postalCode"
1629                                    .value=${this.address?.zipCode}
1630                                    required
1631                                >
1632                                    <h-input-control
1633                                        @connected="${e=>{e.target===this._postalCodeInputRef.value&&setTimeout(()=>{this._selectedCountryId===Q?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask()},50)}}"
1634                                        ${I(this._postalCodeInputRef)}
1635                                        mask="__-___"
1636                                        mask-disabled=${this._selectedCountryId!==Q||d}
1637                                        pattern="^(\\d{2})(-)(\\d{3})$"
1638                                        valid-pattern="00-000"
1639                                    ></h-input-control>
1640                                </h-input>
1641                            </h-control-element>
1642
1643                            <control-errors></control-errors>
1644                        </h-control-content>
1645                    </h-control>
1646                </control-connector>
1647
1648                <control-connector
1649                    required
1650                    class="control"
1651                >
1652                    <h-control>
1653                        <h-control-label class="control__label">
1654                            <label
1655                                class="label label_required"
1656                                for=${this._cityId}
1657                            >
1658                                <span
1659                                    class="label__asterisk"
1660                                    aria-hidden="true"
1661                                    >*</span
1662                                >
1663                                ${l("City")}
1664                            </label>
1665                        </h-control-label>
1666
1667                        <h-control-content class="control">
1668                            <h-control-element class="control__element">
1669                                <h-input
1670                                    controlId=${this._cityId}
1671                                    controlName="city"
1672                                    .value=${this.address?.city}
1673                                    required
1674                                >
1675                                    <h-input-control></h-input-control>
1676                                </h-input>
1677                            </h-control-element>
1678
1679                            <control-errors></control-errors>
1680                        </h-control-content>
1681                    </h-control>
1682                </control-connector>
1683
1684                ${F(this._isRegistrationEnabled,r` <control-connector
1685                        class="control"
1686                        ?required=${$(this._isRegistrationRequired)}
1687                    >
1688                        <h-control>
1689                            <h-control-content class="control">
1690                                <h-control-element class="control__element">
1691                                    <h-checkbox
1692                                        controlId=${this._createUserAccountId}
1693                                        controlName="createUserAccount"
1694                                        value="1"
1695                                        ?required=${$(this._isRegistrationRequired)}
1696                                    >
1697                                        <h-checkbox-control></h-checkbox-control>
1698
1699                                        <h-checkbox-content>
1700                                            ${F(this._isBuyingEnabledToUnregistered,r`<span slot="label">${l("I want to create an account in the store")}</span>`,r`
1701                                                    <span
1702                                                        slot="label"
1703                                                        class="label_required"
1704                                                    >
1705                                                        <span
1706                                                            class="label__asterisk"
1707                                                            aria-hidden="true"
1708                                                            >*</span
1709                                                        >
1710                                                        ${l("I want to create an account in the store")}
1711                                                    </span>
1712                                                `)}
1713
1714                                            <div slot="description">
1715                                                <p class="p_no-margin">
1716                                                    ${F(this._isBuyingEnabledToUnregistered,r`${l("Optional")}`,d)}
1717                                                </p>
1718                                                <p class="p_no-margin">
1719                                                    ${l("You will receive a link to create a password by e-mail.")}
1720                                                </p>
1721                                            </p>
1722                                        </h-checkbox-content>
1723                                    </h-checkbox>
1724                                </h-control-element>
1725
1726                                <control-errors></control-errors>
1727                            </h-control-content>
1728                        </h-control>
1729                    </control-connector>`,d)}
1730            </form>
1731        </reactive-form>`}render(){return r`
1732            ${F(this._isBuyingEnabledToUnregistered,d,this._renderMandatoryAccountCreationInfo())} ${this._renderForm()}
1733        `}}X([u()],W.prototype,"addressMode");X([u()],W.prototype,"address");X([u()],W.prototype,"isLoggedIn");X([u({type:Object})],W.prototype,"formErrors");X([p()],W.prototype,"_allCountries");X([p()],W.prototype,"_isCompany");X([p()],W.prototype,"_userEmail");X([p()],W.prototype,"_translations");X([p()],W.prototype,"_displayConsumerRadio");X([p()],W.prototype,"_displayCompanyRadio");X([p()],W.prototype,"_selectedCountryId");var Cn=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&&Cn(e,t,s),s};class He extends v{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-${k()}`,this._firstNameId=`first-name-${k()}`,this._lastNameId=`last-name-${k()}`,this._phoneId=`phone-${k()}`,this._countryId=`country-${k()}`,this._streetId=`street-${k()}`,this._postalCodeId=`postal-code-${k()}`,this._cityId=`city-${k()}`,this._companyName=`company-name-${k()}`,this._getCountriesList$=()=>this._basketShippingsApi.selectAvailableShippingCountries$().pipe(S(e=>{const t=e.map(s=>({value:String(s.id),content:s.name,selected:String(s.id)===this._selectedCountryId}
1733));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(N.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)}>
1734            <form
1735                id=${this._formId}
1736                @submit=${this.setShippingAddress}
1737            >
1738                <div
1739                    class="form__additional-info mt-xs-0"
1740                    aria-hidden="true"
1741                >
1742                    <i>
1743                        ${l("Required fields are marked with")} -
1744                        <span class="form__additional-info_secondary">*</span>
1745                    </i>
1746                </div>
1747
1748                <control-connector
1749                    required
1750                    class="control"
1751                >
1752                    <h-control>
1753                        <h-control-label class="control__label">
1754                            <label
1755                                class="label label_required"
1756                                for=${this._firstNameId}
1757                            >
1758                                <span
1759                                    class="label__asterisk"
1760                                    aria-hidden="true"
1761                                    >*</span
1762                                >
1763                                ${l("First name")}
1764                            </label>
1765                        </h-control-label>
1766
1767                        <h-control-content class="control">
1768                            <h-control-element class="control__element">
1769                                <h-input
1770                                    controlId=${this._firstNameId}
1771                                    controlName="firstName"
1772                                    .value=${this.address?.firstName}
1773                                >
1774                                    <h-input-control></h-input-control>
1775                                </h-input>
1776                            </h-control-element>
1777
1778                            <control-errors></control-errors>
1779                        </h-control-content>
1780                    </h-control>
1781                </control-connector>
1782
1783                <control-connector
1784                    required
1785                    class="control"
1786                >
1787                    <h-control>
1788                        <h-control-label class="control__label">
1789                            <label
1790                                class="label label_required"
1791                                for=${this._lastNameId}
1792                            >
1793                                <span
1794                                    class="label__asterisk"
1795                                    aria-hidden="true"
1796                                    >*</span
1797                                >
1798                                ${l("Last name")}
1799                            </label>
1800                        </h-control-label>
1801
1802                        <h-control-content class="control">
1803                            <h-control-element class="control__element">
1804                                <h-input
1805                                    controlId=${this._lastNameId}
1806                                    controlName="lastName"
1807                                    .value=${this.address?.lastName}
1808                                >
1809                                    <h-input-control></h-input-control>
1810                                </h-input>
1811                            </h-control-element>
1812
1813                            <control-errors></control-errors>
1814                        </h-control-content>
1815                    </h-control>
1816                </control-connector>
1817
1818                <control-connector class="control">
1819                    <h-control>
1820                        <h-control-label class="control__label">
1821                            <label
1822                                class="label"
1823                                for=${this._companyName}
1824                                >${l("Company name")}</label
1825                            >
1826                        </h-control-label>
1827
1828                        <h-control-content class="control">
1829                            <h-control-element class="control__element">
1830                                <h-input
1831                                    controlId=${this._companyName}
1832                                    controlName="companyName"
1833                                    .value=${this.address?.companyName}
1834                                >
1835                                    <h-input-control></h-input-control>
1836                                </h-input>
1837                            </h-control-element>
1838
1839                            <control-errors></control-errors>
1840                        </h-control-content>
1841                    </h-control>
1842                </control-connector>
1843
1844                <control-connector
1845                    required
1846                    class="control"
1847                >
1848                    <h-control>
1849                        <h-control-label class="control__label">
1850                            <label
1851                                class="label label_required"
1852                                for=${this._phoneId}
1853                            >
1854                                <span
1855                                    class="label__asterisk"
1856                                    aria-hidden="true"
1857                                    >*</span
1858                                >
1859                                ${l("Phone number")}
1860                            </label>
1861                        </h-control-label>
1862
1863                        <h-control-content class="control">
1864                            <h-control-element class="control__element">
1865                                <h-input
1866                                    controlId=${this._phoneId}
1867                                    controlName="phone"
1868                                    .value=${this.address?.phone}
1869                                >
1870                                    <h-input-control type="tel"></h-input-control>
1871                                </h-input>
1872                            </h-control-element>
1873
1874                            <control-errors></control-errors>
1875                        </h-control-content>
1876                    </h-control>
1877                </control-connector>
1878
1879                <control-connector
1880                    required
1881                    class="control"
1882                >
1883                    <h-control>
1884                        <h-control-label class="control__label">
1885                            <label
1886                                class="label label_required"
1887                                for="${this._countryId}"
1888                                id="${this._countryId}-label"
1889                            >
1890                                <span
1891                                    class="label__asterisk"
1892                                    aria-hidden="true"
1893                                    >*</span
1894                                >
1895                                ${l("Country")}
1896                            </label>
1897                        </h-control-label>
1898
1899                        <h-control-content class="control">
1900                            <h-control-element class="control__element">
1901                                <shipping-address-country-select
1902                                    ${I(this._countrySelectRef)}
1903                                    @enableMask="${()=>{this._postalCodeInputRef.value?.enableMask()}}"
1904                                    @disableMask="${()=>{this._postalCodeInputRef.value?.disableMask()}}"
1905                                    @change="${()=>{const e=this._countrySelectRef.value?.getSelectedValue();e&&(this._selectedCountryId=e,this._storefrontSettings.isFeatureEnabled("dev_storefront_address_form_save")&&this.getFormService()?.revalidateControlWhenReady(this._streetId))}}"
1906                                    .address=${this.address}
1907                                    .countries="${$(this._getCountriesList$())}"
1908                                    aria-labelledby="${this._countryId}-label"
1909                                ></shipping-address-country-select>
1910                            </h-control-element>
1911
1912                            <control-errors></control-errors>
1913                        </h-control-content>
1914                    </h-control>
1915                </control-connector>
1916                <control-connector
1917                    ?streetWithNumber=${this._selectedCountryId===Q}
1918                    ?required=${this._selectedCountryId!==Q}
1919                    class="control"
1920                >
1921                    <h-control>
1922                        <h-control-label class="control__label">
1923                            <label
1924                                class="label label_required"
1925                                for=${this._streetId}
1926                            >
1927                                <span
1928                                    class="label__asterisk"
1929                                    aria-hidden="true"
1930                                    >*</span
1931                                >
1932                                ${l("Street name and house number")}
1933                            </label>
1934                        </h-control-label>
1935
1936                        <h-control-content class="control">
1937                            <h-control-element class="control__element">
1938                                <h-input
1939                                    controlId=${this._streetId}
1940                                    controlName="street"
1941                                    .value=${this.address?.street}
1942                                >
1943                                    <h-input-control></h-input-control>
1944                                </h-input>
1945                            </h-control-element>
1946
1947                            <control-errors></control-errors>
1948                        </h-control-content>
1949                    </h-control>
1950                </control-connector>
1951
1952                <control-connector
1953                    required
1954                    class="control"
1955                >
1956                    <h-control>
1957                        <h-control-label class="control__label">
1958                            <label
1959                                class="label label_required"
1960                                for=${this._postalCodeId}
1961                            >
1962                                <span
1963                                    class="label__asterisk"
1964                                    aria-hidden="true"
1965                                    >*</span
1966                                >
1967                                ${l("Postal code")}
1968                            </label>
1969                        </h-control-label>
1970
1971                        <h-control-content class="control">
1972                            <h-control-element class="control__element control__element_half">
1973                                <h-input
1974                                    controlId=${this._postalCodeId}
1975                                    controlName="postalCode"
1976                                    .value=${this.address?.zipCode}
1977                                >
1978                                    <h-input-control
1979                                        @connected="${e=>{e.target===this._postalCodeInputRef.value&&setTimeout(()=>{this._countrySelectRef.value?.getSelectedValue?.()==="179"?this._postalCodeInputRef.value?.enableMask():this._postalCodeInputRef.value?.disableMask()},50)}}"
1980                                        ${I(this._postalCodeInputRef)}
1981                                        mask="__-___"
1982                                        mask-disabled=${this._countrySelectRef.value?.getSelectedValue?.()!=="179"||d}
1983                                        pattern="^(\\d{2})(-)(\\d{3})$"
1984                                        valid-pattern="00-000"
1985                                    ></h-input-control>
1986                                </h-input>
1987                            </h-control-element>
1988
1989                            <control-errors></control-errors>
1990                        </h-control-content>
1991                    </h-control>
1992                </control-connector>
1993
1994                <control-connector
1995                    required
1996                    class="control"
1997                >
1998                    <h-control>
1999                        <h-control-label class="control__label">
2000                            <label
2001                                class="label label_required"
2002                                for=${this._cityId}
2003                            >
2004                                <span
2005                                    class="label__asterisk"
2006                                    aria-hidden="true"
2007                                    >*</span
2008                                >
2009                                ${l("City")}
2010                            </label>
2011                        </h-control-label>
2012
2013                        <h-control-content class="control">
2014                            <h-control-element class="control__element">
2015                                <h-input
2016                                    controlId=${this._cityId}
2017                                    controlName="city"
2018                                    .value=${this.address?.city}
2019                                >
2020                                    <h-input-control></h-input-control>
2021                                </h-input>
2022                            </h-control-element>
2023
2024                            <control-errors></control-errors>
2025                        </h-control-content>
2026                    </h-control>
2027                </control-connector>
2028            </form>
2029        </reactive-form>`}}yt([u()],He.prototype,"address");yt([u()],He.prototype,"isLoggedIn");yt([u({type:Object})],He.prototype,"formErrors");yt([p()],He.prototype,"_selectedCountryId");var In=Object.defineProperty,wn=(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 Es extends v{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
2030            ${I(this._modal)}
2031            hidden
2032        >
2033            <h-modal-header>
2034                <b class="font_semibold">${l("Select a delivery method")}</b>
2035                <h-modal-close
2036                    aria-label="${l("Close window")}"
2037                    class="btn btn_icon"
2038                >
2039                    <h-icon
2040                        icon-name="icon-x"
2041                        role="button"
2042                        size="xl"
2043                        clickable
2044                    ></h-icon>
2045                </h-modal-close>
2046            </h-modal-header>
2047            <h-modal-body>
2048                <div class="pb-xs-4">
2049                    <basket-shippings-list
2050                        is-simple="true"
2051                        .shippings=${this.shippings}
2052                    ></basket-shippings-list>
2053                </div>
2054            </h-modal-body>
2055        </h-modal>`}}wn([u()],Es.prototype,"shippings");const En="basket-additional-informations";class Bn{constructor({basketOverallApi:e}){this._changeComment$=new ni,this._changeComment$.pipe(A(),S(t=>t.target?.value)).subscribe(async t=>{await e.setComment(t)})}changeComment(e){this._changeComment$.next(e)}}class xn extends v{constructor(){super(),this._commentId=`comment-${k()}`,this._basketOverallApi=this.getApiSync(H.api),this._controller=new Bn({basketOverallApi:this._basketOverallApi})}static{this.moduleName=En}render(){return r`
2056            <h-control>
2057                <h-control-label class="control__label">
2058                    <label
2059                        class="label"
2060                        for=${this._commentId}
2061                        >${l("Order notes")}</label
2062                    >
2063                </h-control-label>
2064
2065                <h-control-content class="control">
2066                    <h-control-element class="control__element">
2067                        <h-textarea
2068                            controlId=${this._commentId}
2069                            controlName="comment"
2070                            @change=${e=>this._controller.changeComment(e)}
2071                            .value=${$(this._basketOverallApi.selectComment$())}
2072                        >
2073                            <h-textarea-control></h-textarea-control>
2074                        </h-textarea>
2075                    </h-control-element>
2076
2077                    <control-errors></control-errors>
2078                </h-control-content>
2079            </h-control>
2080        `}}var Mn=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&&Mn(e,t,s),s};class Ut extends v{constructor(){super(),this._modal=P(),this.payments=[],this.ctaPaymentLabel="",this._basketPaymentsApi=this.getApiSync(Ie.api)}static{this.moduleName="payments-list-modal"}open(){this._modal.value?.open()}close(){this._modal.value?.close()}_setPayment(e){this._basketPaymentsApi.setPayment(e),this.eventBus.emit(new m(G.paymentChosenByUser)),this.close()}
2080render(){return r`<h-modal
2081            class="modal-wrapper_l modal_payment-list"
2082            ${I(this._modal)}
2083            hidden
2084        >
2085            <h-modal-header>
2086                <h2 class="font_semibold h2">
2087                    ${g(this.ctaPaymentLabel.length>0,()=>r`${this.ctaPaymentLabel}`,()=>r`${l("Select payment bank or service")}`)}
2088                </h2>
2089                <h-modal-close
2090                    aria-label="${l("Close window")}"
2091                    class="btn btn_icon"
2092                >
2093                    <h-icon
2094                        icon-name="icon-x"
2095                        role="button"
2096                        size="xl"
2097                        clickable
2098                    ></h-icon>
2099                </h-modal-close>
2100            </h-modal-header>
2101            <h-modal-body>
2102                <div class="payments-channels-list pb-xs-4">
2103                    ${this.payments.map(e=>r`<div
2104                                @click=${()=>{this._setPayment(e)}}
2105                                class="${ee({"payment-channel":!0,"payment-channel_selected":e.isSelected})}"
2106                            >
2107                                ${g(e.image,()=>r`<figure class="payment-channel__image">
2108                                        <img
2109                                            alt="${e.name}"
2110                                            src="${e.image}"
2111                                            width="200"
2112                                            height="70"
2113                                        />
2114                                    </figure> `,()=>r`<p>${e.name}</p>`)}
2115                            </div>`)}
2116                </div>
2117            </h-modal-body>
2118        </h-modal>`}}Bs([u()],Ut.prototype,"payments");Bs([u()],Ut.prototype,"ctaPaymentLabel");var Fn=Object.defineProperty,xs=(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 Gt extends v{constructor(){super(),this._additionalFields=[],this._flashMessengerRef=P(),this._isValid=!0,this._storefrontSettings=this.getApiSync(N.api),this._basketOverallApi=this.getApiSync(H.api),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._basketAdditionalFieldsApi=this.getApiSync(ls.api),this._flashMessengerApi=this.getApiSync(ae.api),this._basketAdditionalFieldsApi.select$().pipe(S(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(S(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"}_renderSelect(e){return r`
2119            <h-control class="control">
2120                <h-control-label class="control__label">
2121                    <label
2122                        class="${ee({label:!0,label_required:e.isRequired})}"
2123                        for=${`additional_${e.id}`}
2124                        id="additional_${e.id}-label"
2125                    >
2126                        ${e.isRequired?r`<span
2127                                  class="label__asterisk"
2128                                  aria-hidden="true"
2129                                  >*</span
2130                              >`:d}
2131                        ${j(e.description)}
2132                    </label>
2133                </h-control-label>
2134
2135                <h-control-content class="control">
2136                    <h-control-element class="control__element">
2137                        <h-select
2138                            class="select"
2139                            @change=${t=>{const s=t.target.selectedOptions[0]?.value||null;this._basketAdditionalFieldsApi.change(e.id,s)}}
2140                            control-id=${`additional_${e.id}`}
2141                            control-name=${`additional_${e.id}`}
2142                            ?disabled=${$(this._canChangeAdditionalFields$)}
2143                            ?required=${e.isRequired}
2144                            assistive-title-id="additional_${e.id}-label"
2145                        >
2146                            <h-select-toggler
2147                                class="select-toggler"
2148                                aria-labelledby="additional_${e.id}-label"
2149                            >
2150                                <span
2151                                    class="select-toggler__placeholder"
2152                                    slot="placeholder"
2153                                    >${l("Select")}</span
2154                                >
2155                            </h-select-toggler>
2156
2157                            ${$e(e.options,t=>t.value,t=>r` <h-option
2158                                        slot="content"
2159                                        value=${t.value}
2160                                        id="additional_${e.id}_${t.value}"
2161                                        ?selected=${t.isSelected}
2162                                    >
2163                                        <h-option-content>${t.label}</h-option-content>
2164                                    </h-option>`)}
2165                        </h-select>
2166                    </h-control-element>
2167                </h-control-content>
2168            </h-control>
2169        `}_renderDescription(e){return r` <p class="font_size-s">${j(e.description)}</p>`}_renderCheckbox(e){return r`
2170            <h-control class="control">
2171                <h-control-content class="control">
2172                    <h-control-element class="control__element">
2173                        <h-checkbox
2174                            @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}}
2175                            controlId=${`additional_${e.id}`}
2176                            controlName=${`additional_${e.id}`}
2177                            ?checked=${e.isChecked}
2178                            value="1"
2179                            ?disabled=${$(this._canChangeAdditionalFields$)}
2180                            ?required=${e.isRequired}
2181                        >
2182                            <h-checkbox-control></h-checkbox-control>
2183
2184                            <h-checkbox-content>
2185                                <span
2186                                    class="${ee({label_required:e.isRequired})}"
2187                                    slot="label"
2188                                >
2189                                    ${e.isRequired?r`<span
2190                                              class="label__asterisk"
2191                                              aria-hidden="true"
2192                                              >*</span
2193                                          >`:d}
2194                                    ${j(e.description)}
2195                                </span>
2196                            </h-checkbox-content>
2197                        </h-checkbox>
2198                    </h-control-element>
2199                </h-control-content>
2200            </h-control>
2201        `}_renderCheckboxVatEU(e){return r`
2202            <h-control
2203                class="control"
2204                ?hidden=${$(this._isCompany$.pipe(S(t=>!t)))}
2205            >
2206                <h-control-content class="control">
2207                    <h-control-element class="control__element">
2208                        <h-checkbox
2209                            @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}}
2210                            controlId=${`additional_${e.id}`}
2211                            controlName=${`additional_${e.id}`}
2212                            ?checked=${e.isChecked}
2213                            value="1"
2214                            ?disabled=${$(this._canChangeAdditionalFields$)}
2215                            ?required=${e.isRequired}
2216                        >
2217                            <h-checkbox-control></h-checkbox-control>
2218
2219                            <h-checkbox-content>
2220                                <span
2221                                    class="${ee({label_required:e.isRequired})}"
2222                                    slot="label"
2223                                >
2224                                    ${e.isRequired?r`<span
2225                                              class="label__asterisk"
2226                                              aria-hidden="true"
2227                                              >*</span
2228                                          >`:d}
2229                                    ${j(e.description)}
2230                                </span>
2231                            </h-checkbox-content>
2232                        </h-checkbox>
2233                    </h-control-element>
2234                </h-control-content>
2235            </h-control>
2236        `}_renderCheckboxNewsletter(e){return r`
2237            <h-control class="control">
2238                <h-control-content class="control">
2239                    <h-control-element class="control__element">
2240                        <h-checkbox
2241                            @change=${async t=>{if(t.isTrusted){const s=t.target.checked?"1":"0";await this._basketAdditionalFieldsApi.change(e.id,s)}}}
2242                            controlId=${`additional_${e.id}`}
2243                            controlName=${`additional_${e.id}`}
2244                            ?checked=${e.isChecked}
2245                            value="1"
2246                            ?disabled=${$(this._canChangeAdditionalFields$)}
2247                            ?required=${e.isRequired}
2248                        >
2249                            <h-checkbox-control></h-checkbox-control>
2250
2251                            <h-checkbox-content>
2252                                <span
2253                                    class="${ee({label_required:e.isRequired})}"
2254                                    slot="label"
2255                                >
2256                                    ${e.isRequired?r`<span
2257                                              class="label__asterisk"
2258                                              aria-hidden="true"
2259                                              >*</span
2260                                          >`:d}
2261                                    ${j(e.label)}
2262                                </span>
2263
2264                                <span slot="description">${j(e.description)}</span>
2265                            </h-checkbox-content>
2266                        </h-checkbox>
2267                    </h-control-element>
2268                </h-control-content>
2269            </h-control>
2270        `}_renderTextInput(e){return r`
2271            <h-control class="control">
2272                <h-control-label class="control__label">
2273                    <label
2274                        class="${ee({label:!0,label_required:e.isRequired})}"
2275                        for=${`additional_${e.id}`}
2276                    >
2277                        ${e.isRequired?r`<span
2278                                  class="label__asterisk"
2279                                  aria-hidden="true"
2280                                  >*</span
2281                              >`:d}
2282                        ${j(e.description)}
2283                    </label>
2284                </h-control-label>
2285
2286                <h-control-content class="control">
2287                    <h-control-element class="control__element">
2288                        <h-input
2289                            @change=${t=>{if(t.isTrusted){const i=t.target;this._basketAdditionalFieldsApi.change(e.id,i.value)}}}
2290                            controlId=${`additional_${e.id}`}
2291                            controlName=${`additional_${e.id}`}
2292                            value=${e.value}
2293                            ?disabled=${$(this._canChangeAdditionalFields$)}
2294                        >
2295                            <h-input-control></h-input-control>
2296                        </h-input>
2297                    </h-control-element>
2298                </h-control-content>
2299            </h-control>
2300        `}_renderHiddenInput(e){return r`
2301            <h-input
2302                @change=${t=>{const i=t.target;this._basketAdditionalFieldsApi.change(e.id,i.value)}}
2303                type="hidden"
2304                controlId=${`additional_${e.id}`}
2305                controlName=${`additional_${e.id}`}
2306                value=${e.value}
2307                ?disabled=${$(this._canChangeAdditionalFields$)}
2308            >
2309                <h-input-control type="hidden"></h-input-control>
2310            </h-input>
2311        `}_renderFileInput(e){return r` <h-control class="control">
2312            <h-control-label class="control__label">
2313                <label
2314                    class="${ee({label:!0,label_required:e.isRequired})}"
2315                    for=${`additional_${e.id}`}
2316                >
2317                    ${e.isRequired?r`<span
2318                              class="label__asterisk"
2319                              aria-hidden="true"
2320                              >*</span
2321                          >`:d}
2322                    ${j(e.description)}
2323                </label>
2324            </h-control-label>
2325
2326            <h-control-content class="control">
2327                <h-control-element class="control__element">
2328                    <h-file-picker
2329                        @change=${async t=>{this._uploadFile(t,e)}}
2330                        ?required=${e.isRequired}
2331                        class="file-picker"
2332                        control-id="${`additional_${e.id}`}"
2333                        control-name="${`additional_${e.id}`}"
2334                        label-text="${l("Upload file")}"
2335                        files=""
2336                    ></h-file-picker>
2337                </h-control-element>
2338            </h-control-content>
2339        </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 hi?this._renderSelect(e):e instanceof pi?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 ui?this._renderTextInput(e):e instanceof mi?this._renderHiddenInput(e):e instanceof _i?this._renderFileInput(e):d}render(){return r` <div class="basket-module__content">
2340            <flash-messenger
2341                ${I(this._flashMessengerRef)}
2342                class="d-block mb-xs-2"
2343                name="basket-additional-fields"
2344                tabindex="-1"
2345            ></flash-messenger>
2346
2347            <h2 class="section-title section-title_s mb-xs-2">${l("Consents and additional fields")}</h2>
2348
2349            <form class="form">
2350                ${$e(this._additionalFields,e=>e.id,e=>this._renderAdditionalField(e))}
2351            </form>
2352        </div>`}}xs([p()],Gt.prototype,"_additionalFields");xs([p()],Gt.prototype,"_isValid");var Tn=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&&Tn(e,t,s),s};class V extends v{constructor(){super(),this.url="",this._productName="",this._hasOptions=!1,this._options=[],this._productImage="",this._quantity=0,this._unit="",this._productPrice
2352="",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(f.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`
2353            <h-modal
2354                ${I(this._modal)}
2355                id="after_added_to_basket"
2356                class="added-to-basket-modal__container"
2357            >
2358                <h-modal-header>
2359                    <h2 class="modal__title">${l("Added to cart")}</h2>
2360
2361                    <h-modal-close
2362                        aria-label="${l("Close window")}"
2363                        class="btn btn_icon"
2364                    >
2365                        <h-icon
2366                            icon-name="icon-x"
2367                            role="button"
2368                            size="xl"
2369                            clickable
2370                        ></h-icon>
2371                    </h-modal-close>
2372                </h-modal-header>
2373                <h-modal-body class="added-to-basket-modal__h-modal-paddings">
2374                    <figure class="align_center">
2375                        <img
2376                            class="added-to-basket-modal_preview-image"
2377                            src=${this._productImage}
2378                            alt=""
2379                            width=""
2380                        />
2381                    </figure>
2382                    <div class="d-flex added-to-basket-modal__generic_wrap">
2383                        <span class="mr-xs-1 font_semibold added-to-basket-modal_quantity-badge"
2384                            >${this._quantity} ${this._isBundle?"x":d} ${this._unit}</span
2385                        >
2386                        <p class="font_semibold added-to-basket-modal_product-name">${this._productName}</p>
2387                    </div>
2388
2389                    ${this._hasOptions?r` <ul class="added-to-basket-modal__options">
2390                              ${this._options.map(e=>r` <li
2391                                      data-option-name="${e.name}"
2392                                      data-option-value="${e.value}"
2393                                  >
2394                                      ${e.name}: <span class="font_semibold">${e.value}</span>
2395                                  </li>`)}
2396                          </ul>`:d}
2397                    ${this._isLoyalty?r`
2398                              <div class="tag tag_quaternary mb-xs-2">
2399                                  <span class="overline overline_s mb-xs-0 color_secondary"> ${l("loyalty program")} </span>
2400                              </div>
2401                          `:d}
2402                    <p>
2403                        <span class="sr-only">${l("Price")}</span>
2404                        <span class="price__value font_semibold">
2405                            ${this._productLoyaltyPointsCost?this._productLoyaltyPointsCost:this._productPrice}
2406                            ${this._productLoyaltyPointsExchangePrice?`+ ${this._productLoyaltyPointsExchangePrice}`:d}
2407                        </span>
2408                        ${this._shouldDisplayProductVat?r`
2409                                  <span
2410                                      class="vat-info"
2411                                      aria-label="${l("incl.")} ${this._productVat} VAT"
2412                                  >
2413                                      <span aria-hidden="true">${l("incl.")}</span>
2414                                      <span aria-hidden="true">${this._productVat}</span>
2415                                      <span aria-hidden="true">VAT</span>
2416                                  </span>
2417                              `:d}
2418                    </p>
2419
2420                    <div class="d-flex p-all-xs-1 added-to-basket-modal_quantity-summary">
2421                        <p class="added-to-basket-modal__generic_reset-bottom-margins added-to-basket-modal__generic_margin-right">
2422                            ${l("Quantity of this product in the basket")}:
2423                            <span class="font_semibold">${this._productLikeAdded} ${this._unit}</span>
2424                        </p>
2425                    </div>
2426
2427                    <div
2428                        class="separator"
2429                        aria-hidden="true"
2430                    ></div>
2431
2432                    <p class="added-to-basket-modal__customized-paragraph">
2433                        ${l("Total items in cart")}: <span class="font_semibold">${this._basketPositions}</span>
2434                    </p>
2435
2436                    <p class="added-to-basket-modal__customized-paragraph">
2437                        ${l("Cart value")}:
2438                        ${this._basketLoyaltyPointsCost?r`<span class="font_semibold">${this._basketLoyaltyPointsCost}.</span> +`:d}
2439                        <span class="font_semibold">${this._basketPricesSum}</span>
2440                        ${this._shouldDisplayBasketVat?r`${l("incl. VAT")} `:d}
2441                    </p>
2442                </h-modal-body>
2443                <h-modal-footer class="grid grid__col grid__col_xs-vcenter grid__col_xs-hcenter added-to-basket-modal__h-modal-paddings">
2444                    <a
2445                        href="${this.url}"
2446                        class="btn btn_primary mb-sm-2 btn_full-width added-to-basket-modal_button"
2447                        >${l("Go to shopping cart")}</a
2448                    >
2449                    <h-modal-close class="full-width">
2450                        <button class="btn btn_secondary btn_full-width added-to-basket-modal_button">${l("Keep browsing")}</button>
2451                    </h-modal-close>
2452                </h-modal-footer>
2453            </h-modal>
2454        `}}R([u({type:String})],V.prototype,"url");R([p()],V.prototype,"_productName");R([p()],V.prototype,"_hasOptions");R([p()],V.prototype,"_options");R([p()],V.prototype,"_productImage");R([p()],V.prototype,"_quantity");R([p()],V.prototype,"_unit");R([p()],V.prototype,"_productPrice");R([p()],V.prototype,"_productVat");R([p()],V.prototype,"_productLikeAdded");R([p()],V.prototype,"_productLoyaltyPointsCost");R([p()],V.prototype,"_productLoyaltyPointsExchangePrice");R([p()],V.prototype,"_basketPositions");R([p()],V.prototype,"_basketPricesSum");R([p()],V.prototype,"_basketLoyaltyPointsCost");R([p()],V.prototype,"_hasSpecialOffer");R([p()],V.prototype,"_shouldDisplayProductVat");R([p()],V.prototype,"_shouldDisplayBasketVat");R([p()],V.prototype,"_isLoyalty");R([p()],V.prototype,"_isBundle");var On=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&&On(e,t,s),s};class Fe extends v{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-${k()}`,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(S(([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}))})}
2454_renderToggler(){return r`<div class="labeled-icon">
2455            <div
2456                class="indicator"
2457                data-value="${$(this._basketProductsApi.selectBasketCount$())}"
2458            >
2459                <h-icon
2460                    icon-name="icon-basket"
2461                    css-classes="labeled-icon__icon"
2462                    aria-hidden="true"
2463                ></h-icon>
2464            </div>
2465
2466            <div class="labeled-icon__signature font_bold">
2467                ${g(this.isWithValue,()=>r`${this._discountSum.value?.grossValueFormatted}`,()=>r`${l("Cart")}`)}
2468            </div>
2469        </div>`}_renderBasketPreviewDropdownHeader(){return r`
2470            <div class="grid__col grid__col_xs-12 grid__col_sm-grow mb-xs-2">
2471                <h2 class="section-title section-title_s">${l("Products in the cart")}</h2>
2472            </div>
2473        `}_renderBasketPreviewSheetHeader(){return r`
2474            <h2 class="section-title section-title_s">${l("Products in the cart")}</h2>
2475            <h-sheet-close class="btn btn_icon">
2476                <span class="sr-only">${l("Close window")}</span>
2477                <h-icon
2478                    icon-name="icon-x"
2479                    aria-hidden="true"
2480                ></h-icon>
2481            </h-sheet-close>
2482        `}
2482_renderBasketPreview(){return r`<div
2483                class="grid__row ${this.isSheet?"grid__row_xs-hright grid__row_sm-hright grid__row_lg-hright grid__row_xxl-hright":""}"
2484            >
2485                ${this.isSheet?d:this._renderBasketPreviewDropdownHeader()}
2486                <div class="grid__col grid__col_xs-12 grid__col_sm-auto">
2487                    <h-modal-opener
2488                        name="${this._confirmModalId}"
2489                        @click=${()=>{this.isSheet?this._sheet.value?.close():this._dropdown.value?.hide()}}
2490                        class="btn btn_outline btn_xs"
2491                        aria-label="${l("Remove all products from the cart")}"
2492                    >
2493                        <h-icon
2494                            icon-name="icon-trash"
2495                            css-classes="btn__icon btn__icon_left"
2496                        ></h-icon>
2497
2498                        ${l("Clear")}
2499                    </h-modal-opener>
2500                </div>
2501            </div>
2502
2503            <basket-products-list
2504                .mode="basket"
2505                .hasAdditionalInfo="${!1}"
2506                .products="${$(this._basketProductsApi.select$())}"
2507            ></basket-products-list>
2508
2509            <basket-summary
2510                .hasContent="${!1}"
2511                url="${this.basketDeliveryPaymentUrl}"
2512                basket-url="${this.basketUrl}"
2513            ></basket-summary>`}_renderEmptyBasket(){return r`<div class="grid__row grid__row_xs-vcenter">
2514            <div class="grid__col">
2515                <h-icon
2516                    icon-name="icon-basket"
2517                    css-classes="icon_xxl"
2518                    aria-hidden="true"
2519                ></h-icon>
2520            </div>
2521            <div class="grid__col">
2522                <h2
2523                    class="p align_center"
2524                    tabindex="0"
2525                >
2526                    ${l("Your cart is empty")}
2527                </h2>
2528            </div>
2529        </div>`}_renderConfirmModal(){return r`<confirm-modal
2530            id="${this._confirmModalId}"
2531            hidden
2532            ${I(this._confirmModal)}
2533            header="${l("Clearing all products from the cart")}"
2534            confirmText="${l("Clear all products")}"
2535            cancelText="${l("Cancel")}"
2536            @confirm="${this._cleanBasket}"
2537        >
2538            <p slot>${l("Are you sure you want to clear all items from your shopping cart?")}</p>
2539        </confirm-modal>`}_renderSheet(){return r`
2540            <h-sheet-opener
2541                name="basket-preview-sheet-${this.moduleInstanceId}"
2542                aria-label="${l("Products in the cart")}: ${$(this._basketProductsApi.selectBasketCount$())}, ${l("Sum")}: ${this._discountSum.value?.grossValueFormatted}, ${l("See details")}"
2543                >${this._renderToggler()}</h-sheet-opener
2544            >
2545
2546            <h-sheet
2547                id="basket-preview-sheet-${this.moduleInstanceId}"
2548                ${I(this._sheet)}
2549                hidden
2550            >
2551                <h-sheet-header> ${this._renderBasketPreviewSheetHeader()} </h-sheet-header>
2552
2553                <h-sheet-body>
2554                    <div class="basket-preview">
2555                        ${F(this.isBasketFilled$,this._renderBasketPreview(),this._renderEmptyBasket())}
2556                    </div>
2557                </h-sheet-body>
2558            </h-sheet>
2559
2560            ${this._renderConfirmModal()}
2561        `}_renderDropdown(){return r`
2562            <h-dropdown
2563                name="basket-preview"
2564                direction="bottom-right"
2565                ${I(this._dropdown)}
2566            >
2567                <h-dropdown-toggler
2568                    name="basket-preview-${this.moduleInstanceId}"
2569                    aria-label="${l("Products in the cart")}: ${$(this._basketProductsApi.selectBasketCount$())}, ${l("Sum")}: ${this._discountSum.value?.grossValueFormatted}, ${l("See details")}"
2570                    >${this._renderToggler()}</h-dropdown-toggler
2571                >
2572
2573                <h-dropdown-content name="basket-preview-${this.moduleInstanceId}">
2574                    <div class="basket-preview">
2575                        ${F(this.isBasketFilled$,this._renderBasketPreview(),this._renderEmptyBasket())}
2576                    </div>
2577                </h-dropdown-content>
2578            </h-dropdown>
2579
2580            ${this._renderConfirmModal()}
2581        `}render(){return this.isSheet?this._renderSheet():this._renderDropdown()}}Ke([u({type:String,attribute:"basket-url"})],Fe.prototype,"basketUrl");Ke([u({type:String,attribute:"basket-delivery-payment-url"})],Fe.prototype,"basketDeliveryPaymentUrl");Ke([u({type:Boolean,attribute:"is-with-value"})],Fe.prototype,"isWithValue");Ke([u({type:Number,attribute:"module-instance-id"})],Fe.prototype,"moduleInstanceId");Ke([u({type:Boolean,attribute:"sheet"})],Fe.prototype,"isSheet");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 v{constructor(){super(),this.isShippingCountryChangeAvailable=!1,this._selectCountryId=`delivery-country-${k()}`,this._basketShippingsApi=this.getApiSync(Ce.api),this._translationApi=this.getApiSync(J.api),this._storefrontSettings=this.getApiSync(N.api)}static{this.moduleName="basket-shipping-country"}async connectedCallback(){super.connectedCallback()}getCountries$(){return this._basketShippingsApi.selectAvailableShippingCountries$().pipe(S(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">
2582                <h-control-label class="control__label">
2583                    <label
2584                        class="label"
2585                        for=${this._selectCountryId}
2586                        id="${this._selectCountryId}-label"
2587                        >${l("Country of delivery")}</label
2588                    >
2589                </h-control-label>
2590
2591                <h-control-content class="control">
2592                    <h-control-element class="control__element control__element_half">
2593                        <h-select
2594                            class="select"
2595                            control-id=${this._selectCountryId}
2596                            control-name="delivery_country"
2597                            no-deselect
2598                            .optionsList="${$(this.getCountries$())}"
2599                            @change="${e=>{const t=e.target;t.selectedOptions[0]&&this._basketShippingsApi.setCountry(Number(t.selectedOptions[0].value))}}"
2600                            assistive-title-id="${this._selectCountryId}-label"
2601                        >
2602                            <h-select-toggler
2603                                class="select-toggler"
2604                                aria-labelledby="${this._selectCountryId}-label"
2605                            >
2606                                <span
2607                                    class="select-toggler__placeholder"
2608                                    slot="placeholder"
2609                                    >${l("Select")}</span
2610                                >
2611                            </h-select-toggler>
2612                        </h-select>
2613                    </h-control-element>
2614
2615                    <control-errors></control-errors>
2616                </h-control-content>
2617            </h-control>`,()=>r`<div class="font_size-s mb-xs-2">
2618                    <p class="p_no-margin">${l("Country of delivery")}</p>
2619
2620                    <b class="font_semibold">${l(this._basketShippingsApi.getAvailableShippingCountries()[0]?.name)}</b>
2621                </div>`)}`}}Nn([u()],Ms.prototype,"isShippingCountryChangeAvailable");const ss={enableMask:"enableMask",disableMask:"disableMask"};var Vn=Object.defineProperty,bt=(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 We extends v{constructor(){super(),this.countries=[],this.address=null,this.ariaLabelledBy="",this.selectedCountryId="",this._countryId=`country-${k()}`,this._select=P(),this._settingsApi=this.getApiSync(N.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
2622            ${I(this._select)}
2623            @showed=${()=>{this._select.value?.assignSlots()}}
2624            @change=${e=>{const t=e.target,i=t.selectedOptions[0]?.value;i&&(this.selectedCountryId=i),t&&i==="179"?this.dispatchEvent(new CustomEvent(ss.enableMask)):this.dispatchEvent(new CustomEvent(ss.disableMask))}}
2625            class="select"
2626            control-id=${this._countryId}
2627            control-name="countryId"
2628            no-deselect
2629            .optionsList="${this.countries}"
2630            assistive-title-id="${this.ariaLabelledBy}"
2631            aria-disabled="${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")}"
2632            .disabled=${this._settingsApi.isFeatureEnabled("select_shipping_country_on_shipping_step")}
2633            ?required=${this._settingsApi.isFeatureEnabled("dev_cached_select_options")}
2634            ?dev_cached_select_options=${this._settingsApi.isFeatureEnabled("dev_cached_select_options")}
2635        >
2636            <h-select-toggler
2637                class="select-toggler"
2638                aria-labelledby="${this.ariaLabelledBy}"
2639            >
2640                <span
2641                    class="select-toggler__placeholder"
2642                    slot="placeholder"
2643                    >${l("Select")}</span
2644                >
2645            </h-select-toggler>
2646
2647            ${$e(this.countries,e=>e.id,e=>r` <h-option
2648                        slot="content"
2649                        value=${e.id}
2650                        id="${this._countryId}-${e.id}"
2651                        ?selected=${e.id==this.address?.countryId}
2652                    >
2653                        <h-option-content>${e.name}</h-option-content>
2654                    </h-option>`)}
2655        </h-select>`}}bt([u()],We.prototype,"countries");bt([u({type:Object})],We.prototype,"address");bt([u({type:String,attribute:"aria-labelledby"})],We.prototype,"ariaLabelledBy");bt([u({type:String,reflect:!0})],We.prototype,"selectedCountryId");const Rn=({storeName:n="BasketShippingsCountriesStore"}={})=>U({name:n},ye());class Dn{#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 Un 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(A((e,t)=>B(e,t)))}}class Gn 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(f.unexpectedError)),e}}class zn 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
2655d 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===$t.done){this._removeOrderCheckStatusUrl(),this.eventBus.emit(new m(f.orderPlaced)),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),this.#s.visit(a.showOrder.href);return}if(s===$t.error){this._removeOrderCheckStatusUrl(),this.#i.setIsOrderInProgress(!1),this.#i.setIsOrderQueued(!1),this.#s.visit(window.location.href);return}if(s===$t.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=Ys.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>Qs}_getRememberedOrderCheckStatusUrl(){const e=this.#c?.get(Pt),t=this.#c?.get(Ct);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(Pt,t),this.#c?.set(Ct,String(Date.now())),t):(this._removeOrderCheckStatusUrl(),null)}_removeOrderCheckStatusUrl(){this._isRememberOrderQueueEnabled()&&(this.#c?.remove(Pt),this.#c?.remove(Ct))}_handleUnexpectedError(e){throw console.error(e),this.#t.addFlashMessage({type:"error",content:this.#a.translate("An unexpected error occurred")}),this.eventBus.emit(new m(f.unexpectedError)),e}}class Hn 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 zn({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 Kn=({storeName:n="BasketOrderStore"}={})=>U({name:n},K({isOrderInProgress:!1,isOrderQueued:!1}));class Wn{#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 is{#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 jn=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&&jn(e,t,s),s};class Fs extends v{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}`}}Qn([p()],Fs.prototype,"_loyaltyPoints");const Yn="js__product-in-basket-count";var Jn=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&&Jn(e,t,s),s};class qt extends v{constructor(){super(),this.variantId$=new ke(0),this.selectedOptions$=new ke([]),this._checkProductInBasket$=null,new Pi(e=>
2655this._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(`.${Yn}`).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)||[]))}}Ts([u({type:Number,attribute:"product-id"})],qt.prototype,"productId");Ts([u({type:Number,attribute:"variant-id"})],qt.prototype,"variantId");class Xn extends v{constructor(){super(),this._reactiveFormRef=P(),this._formId=`form-${k()}`,this._couponId=`coupon-${k()}`,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(hn,"").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(N.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(`.${ts}`)||document.querySelector(`.${ts}`))}_getFormState(){return this._getFormService().getFormState()}_getFormService(){if(!this._reactiveFormRef.value)throw"No form found";return this._reactiveFormRef.value?.formService}render(){return super.render(),r`
2656            <div class="control__additional-content">
2657                ${this._promotionCode.value?r`<div>
2658                              <span class="d-block mb-xs-1 tag tag_l font_semibold font_size-s mb-xs-1 basket-summary__coupon-code">
2659                                  ${this._promotionCode.value?.code}
2660                              </span>
2661                              <span class="d-block mb-xs-1 font_size-s font_semibold color_primary">${this._promotionCode.value?.label}</span>
2662                              ${this._promotionCode.value?.description?r`
2663                                        <span class="d-block mb-xs-1 font_size-xs color_secondary">
2664                                            ${this._promotionCode.value?.description}
2665                                        </span>
2666                                    `:d}
2667                          </div>
2668
2669                          ${this._basketActions.value?.removePromoCode!==void 0?r` <button
2670                                    type="submit"
2671                                    class="btn btn_outline btn_xs"
2672                                    @click=${this._removePromotionCode}
2673                                >
2674                                    ${l("Remove code from order")}
2675                                </button>`:d} `:r`
2676                          <reactive-form ${I(this._reactiveFormRef)}>
2677                              <h-control-label class="control__label">
2678                                  <label
2679                                      class="label"
2680                                      for=${this._couponId}
2681                                      >${l(this._isDevGiftCardsFlagEnabled?"Enter a discount coupon":"Coupon code")}</label
2682                                  >
2683                              </h-control-label>
2684
2685                              <form
2686                                  class="d-flex"
2687                                  id=${this._formId}
2688                                  @submit=${this._addPromotionCode}
2689                              >
2690                                  <control-connector
2691                                      required
2692                                      errorMessage=${this._isDevGiftCardsFlagEnabled?l("The field is required"):d}
2693                                      class="control control_no-margin mr-xs-1"
2694                                      validationMode="${_s.change}"
2695                                  >
2696                                      <h-control>
2697                                          <h-control-content class="control">
2698                                              <h-control-element class="control__element">
2699                                                  <h-input
2700                                                      controlId=${this._couponId}
2701                                                      controlName="coupon"
2702                                                  >
2703                                                      <h-input-control></h-input-control>
2704                                                  </h-input>
2705                                              </h-control-element>
2706
2707                                              <control-errors></control-errors>
2708                                          </h-control-content>
2709                                      </h-control>
2710                                  </control-connector>
2711
2712                                  <button
2713                                      type="submit"
2714                                      class="btn btn_secondary"
2715                                      @click=${this._addPromotionCode}
2716                                  >
2717                                      ${l("Activate")}
2718                                  </button>
2719                              </form>
2720                          </reactive-form>
2721                      `}
2722            </div>
2723        `}}var Zn=Object.defineProperty,Os=(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 zt extends v{constructor(){super(),this._showTaxInfo=!1,this._showGrossPrices=!1,this._renderPrices=()=>this._showTaxInfo?r`
2724                <h-accordion lazy>
2725                    <h-accordion-group>
2726                        <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
2727                            <span>
2728                                ${l("Products (with VAT)")}
2729                                <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary">
2730                                    <use
2731                                        href="/assets/img/icons/symbol-defs.svg#icon-chevron-down"
2732                                        xlink:href="/assets/img/icons/symbol-defs.svg#icon-chevron-down"
2733                                    ></use>
2734                                </svg>
2735                            </span>
2736
2737                            <span> ${this._productsSum.value?.grossValueFormatted} </span>
2738                        </h-accordion-toggler>
2739
2740                        <h-accordion-content
2741                            ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("is-dev-accordion-optimization-flag-enabled")}
2742                        >
2743                            <ul class="price-list price-list_secondary price-list_s">
2744                                <li class="price-list__item">
2745                                    <span class="price-list__label price_s"> ${l("Products (without VAT)")} </span>
2746                                    <span class="price-list__value price__value price_s"> ${this._productsSum.value?.netValueFormatted} </span>
2747                                </li>
2748
2749                                ${g(this._taxes.value&&this._taxes.value.length>1,()=>r` ${this._taxes.value?.map(e=>r` <li class="price_s price-list__item">
2750                                                <span class="price__label price-list__label">
2751                                                    ${l("{{ taxPercent }} VAT",{taxPercent:`${e.name}%`})}
2752                                                </span>
2753                                                <span class="price__value price-list__value">${e.sum.text}</span>
2754                                            </li>`)}`,()=>r` <li class="price_s price-list__item">
2755                                        <span class="price__label price-list__label">
2756                                            ${l("{{ taxPercent }} VAT",{taxPercent:`${this._productsSum.value?.taxFormatted}`})}
2757                                        </span>
2758                                        <span class="price__value price-list__value"> ${this._productsSum.value?.taxValueFormatted} </span>
2759                                    </li>`)}
2760                            </ul>
2761                        </h-accordion-content>
2762                    </h-accordion-group>
2763                </h-accordion>
2764            `:this._showGrossPrices?r`
2765                <li class="price-list__item">
2766                    <span class="price-list__label">${l("Products")}</span>
2767                    <span class="price-list__value">${this._productsSum.value?.grossValueFormatted}</span>
2768                </li>
2769            `:r`
2770            <li class="price-list__item">
2771                <span class="price-list__label">${l("Products (without VAT)")}</span>
2772                <span class="price-list__value">${this._productsSum.value?.netValueFormatted}</span>
2773            </li>
2774        `,this._basketProductsApi=this.getApiSync("basketProductsApi"),this._basketPromotionsApi=this.getApiSync(ge.api),this._basketTaxesApi=this.getApiSync("basketTaxesApi"),this._storefrontSettingsApi=this.getApiSync(N.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`
2775            <div class="basket-summary__prices">
2776                <h3 class="font_semibold mb-xs-2">${l("Product summary")}</h3>
2777                <ul class="price-list price-list_s mb-xs-0 color_secondary">
2778                    ${this._renderPrices()}
2779                    ${g(this._promotions.value&&this._promotions.value?.length>0,()=>r` <li>
2780                            <basket-discounts-list
2781                                .discounts="${$(this._basketPromotionsApi.select$())}"
2782                                .discountsSum="${$(this._basketPromotionsApi.selectDiscountsSum$())}"
2783                            ></basket-discounts-list>
2784                        </li>`,()=>d)}
2785                </ul>
2786            </div>
2787        `}}Os([p()],zt.prototype,"_showTaxInfo");Os([p()],zt.prototype,"_showGrossPrices");var er=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&&er(e,t,s),s};
2787class je extends v{constructor(){super(),this.url="",this.basketUrl="",this.mode=pe.basket,this._showNetPrices=!1,this._renderPriceList=()=>r`
2788            <ul class="price-list">
2789                <li class="price-list__item">
2790                    <span class="price-list__label">${l("Subtotal")}</span>
2791                    <span class="price-list__value price price_m">
2792                        ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r`
2793                                <p class="p p_no-margin price__value">
2794                                    <strong class="p_l p_no-margin font_semibold price__value_special">
2795                                        ${this._productsDiscountedSum.value?.grossValueFormatted}
2796                                    </strong>
2797                                    ${this._showNetPrices?l("with VAT"):d}
2798                                </p>
2799                            `,()=>r`
2800                                <strong class="d-block p_l p_no-margin font_semibold price__value">
2801                                    ${this._productsDiscountedSum.value?.grossValueFormatted}
2802                                    ${this._showNetPrices?l("with VAT"):d}
2803                                </strong>
2804                            `)}
2805                        <p class="p_s p_no-margin color_tertiary">
2806                            ${this._showNetPrices?r`${this._productsDiscountedSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`}
2807                        </p>
2808                    </span>
2809                </li>
2810
2811                ${F(this._basketLoyaltyApi.selectHasItemsPaidInLoyaltyPoints$(),r`
2812                        <li class="price-list__item">
2813                            <span class="price-list__label">${l("Products in the loyalty program")}</span>
2814                            <span class="price-list__value font_semibold">
2815                                ${this._loyaltyPointsCost.value?.pointsFormatted}
2816                                ${this._loyaltyPointsExchangePrice.value?`+ ${this._loyaltyPointsExchangePrice.value.grossValueFormatted}`:""}
2817                            </span>
2818                        </li>
2819                    `,d)}
2820            </ul>
2821        `,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(N.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"}_fullBasketRenderPriceList(){return r`<ul class="price-list">
2822            <li class="price-list__item">
2823                <span class="price-list__label">${l("Total")}</span>
2824                <span class="price-list__value price price_m">
2825                    ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r`
2826                            <p class="p p_no-margin price__value">
2827                                <strong class="p_l font_semibold price__value_special"> ${this._totalSum.value?.grossValueFormatted} </strong>
2828                                ${this._showNetPrices?l("with VAT"):d}
2829                            </p>
2830                        `,()=>r`
2831                            <strong class="d-block p_l font_semibold price__value">
2832                                ${this._totalSum.value?.grossValueFormatted} ${this._showNetPrices?l("with VAT"):d}
2833                            </strong>
2834                        `)}
2835                    <p class="p_s p_no-margin  color_tertiary">
2836                        ${this._showNetPrices?r`${this._totalSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`}
2837                    </p>
2838                </span>
2839            </li>
2840        </ul>`}render(){return super.render(),r`
2841            <div class="basket-module__content basket-module__content_secondary">
2842                <footer class="basket-summary__footer">
2843                    ${g(this.mode===pe.fullBasket,()=>this._fullBasketRenderPriceList(),()=>r`${this._renderPriceList()}
2844                            <p>
2845                                <small>${l("Delivery cost in the next step.")}</small>
2846                            </p>`)}
2847
2848                    <p>
2849                        <a
2850                            href=${this.url}
2851                            class="btn btn_primary btn_full-width"
2852                            aria-label="${l("Next step: choosing shipping and payment")}"
2853                        >
2854                            <h-icon
2855                                icon-name="icon-truck"
2856                                css-classes="btn__icon btn__icon_left"
2857                                aria-hidden="true"
2858                            ></h-icon>
2859
2860                            ${l("Delivery and payment")}</a
2861                        >
2862                    </p>
2863
2864                    ${g(this.basketUrl,()=>r`<p>
2865                            <a
2866                                href=${this.basketUrl}
2867                                class="btn btn_outline btn_full-width"
2868                            >
2869                                ${l("View products in the cart")}</a
2870                            >
2871                        </p>`,()=>d)}
2872                    ${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="${Ai.BASKET_SUMMARY}"></inpost-pay-button> `:r`<inpost-izi-button
2873                                              data-v2
2874                                              variation="${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.buttonVariant=="secondary"?"secondary":"primary"} ${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.isDarkMode?"dark":""} ${this._storefrontSettingsApi.getInpostPayWidgetSettings()?.frameStyle}"
2875                                              binding_place="BASKET_SUMMARY"
2876                                          >
2877                                          </inpost-izi-button>
2877`,()=>d)}`,()=>d)}
2878                </footer>
2879            </div>
2880        `}}ft([u()],je.prototype,"url");ft([u({type:String,attribute:"basket-url"})],je.prototype,"basketUrl");ft([u()],je.prototype,"mode");ft([p()],je.prototype,"_showNetPrices");var tr=Object.defineProperty,Ls=(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&&tr(e,t,s),s};class Ht extends v{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`
2881                <h-accordion lazy>
2882                    <h-accordion-group>
2883                        <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
2884                            <span>
2885                                ${l("Products (with VAT)")}
2886                                <svg class="icon accordion__toggler-icon accordion__toggler-icon_secondary">
2887                                    <use
2888                                        href="${e}#icon-chevron-down"
2889                                        xlink:href="${e}#icon-chevron-down"
2890                                    ></use>
2891                                </svg>
2892                            </span>
2893
2894                            <span> ${this._productsSum.value?.grossValueFormatted} </span>
2895                        </h-accordion-toggler>
2896
2897                        <h-accordion-content
2898                            ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("is-dev-accordion-optimization-flag-enabled")}
2899                        >
2900                            <ul class="price-list price-list_secondary price-list_s">
2901                                <li class="price-list__item">
2902                                    <span class="price-list__label price_s"> ${l("Products (without VAT)")} </span>
2903                                    <span class="price-list__value price__value price_s"> ${this._productsSum.value?.netValueFormatted} </span>
2904                                </li>
2905
2906                                ${g(this._taxes.value&&this._taxes.value.length>1,()=>r` ${this._taxes.value?.map(t=>r` <li class="price_s price-list__item">
2907                                                <span class="price__label price-list__label">
2908                                                    ${l("{{ taxPercent }} VAT",{taxPercent:`${t.name}%`})}
2909                                                </span>
2910                                                <span class="price__value price-list__value">${t.sum.text}</span>
2911                                            </li>`)}`,()=>r` <li class="price_s price-list__item">
2912                                        <span class="price__label price-list__label">
2913                                            ${l("{{ taxPercent }} VAT",{taxPercent:`${this._productsSum.value?.taxFormatted}`})}
2914                                        </span>
2915                                        <span class="price__value price-list__value"> ${this._productsSum.value?.taxValueFormatted} </span>
2916                                    </li>`)}
2917                            </ul>
2918                        </h-accordion-content>
2919                    </h-accordion-group>
2920                </h-accordion>
2921            `:this._showGrossPrices?r`
2922                <li class="price-list__item">
2923                    <span class="price-list__label">${l("Products")}</span>
2924                    <span class="price-list__value">${this._productsSum.value?.grossValueFormatted}</span>
2925                </li>
2926            `:r`
2927            <li class="price-list__item">
2928                <span class="price-list__label">${l("Products (without VAT)")}</span>
2929                <span class="price-list__value">${this._productsSum.value?.netValueFormatted}</span>
2930            </li>
2931        `},this._renderShippingTaxValue=()=>{const e=this._selectedShipping.value?.price;if(!e)return d;const t=e.grossValue===0?"":e.taxFormatted;return t&&this._showTaxInfo?r`
2932                ${l("Delivery (with {{ taxPercent }} VAT)",{taxPercent:t})}
2933            `: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`
2934                ${l("Payment method (with {{ taxPercent }} VAT)",{taxPercent:t})}
2935            `: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(N.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$(
2935))),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`
2936            <div class="basket-summary__prices">
2937                <h3 class="font_semibold mb-xs-2">${l("Order value")}</h3>
2938                <ul class="price-list price-list_s">
2939                    ${this._renderPrices()}
2940                    ${g(this._promotions.value&&this._promotions.value.length>0,()=>r` <li>
2941                            <basket-discounts-list
2942                                .discounts="${$(this._basketPromotionsApi.select$())}"
2943                                .discountsSum="${$(this._basketPromotionsApi.selectDiscountsSum$())}"
2944                            ></basket-discounts-list>
2945                        </li>`,()=>d)}
2946                    ${F(this._basketLoyaltyApi.selectHasItemsPaidInLoyaltyPoints$(),r`
2947                            <li class="price-list__item">
2948                                <span class="price-list__label">${l("Products in the loyalty program")}</span>
2949                                <div class="price-list__value">
2950                                    <p class="p_no-margin">${this._loyaltyPointsCost.value?.pointsFormatted}</p>
2951                                    <p class="p_no-margin">${this._loyaltyPointsExchangePrice.value?`+ ${this._loyaltyPointsExchangePrice.value.grossValueFormatted}`:""}</p>
2952                                </p>
2953                            </li>
2954                        `,d)}
2955
2956                    <li class="price price_s price-list__item">
2957                        <div class="price__label price-list__label">
2958                            <p class="p_no-margin">${this._renderShippingTaxValue()}</p>
2959                            <small class="color_secondary"> ${this._selectedShipping.value?.name} </small>
2960                        </div>
2961
2962                        <span
2963                            class="
2964                                price__value
2965                                price-list__value
2966                                ${this._selectedShipping.value&&this._selectedShipping.value?.price.grossValue==0?"price__value_special":""}
2967                            "
2968                        >
2969                            ${this._selectedShipping.value&&this._selectedShipping.value?.price.grossValue>0?this._selectedShipping.value.price.grossValueFormatted:l("Free")}
2970                        </span>
2971                    </li>
2972
2973                    ${this._paymentCost.value&&this._paymentCost.value?.grossValue>0?r`
2974                              <li class="price price_s price-list__item">
2975                                  <div class="price__label price-list__label">
2976                                      ${this._renderPaymentTaxValue()}
2977                                      <small class="color_secondary"> ${this._selectedPayment.value?.name} </small>
2978                                  </div>
2979
2980                                  <span class="price__value price-list__value"> ${this._paymentCost.value.grossValueFormatted} </span>
2981                              </li>
2982                          `:d}
2983                    ${g(this._isGiftCardsEnabled&&!!this._hasAppliedGiftCards?.value,()=>r` <li><basket-gift-cards-discounts-list></basket-gift-cards-discounts-list></li>`,()=>d)}
2984                </ul>
2985            </div>
2986        `}}Ls([p()],Ht.prototype,"_showTaxInfo");Ls([p()],Ht.prototype,"_showGrossPrices");class sr extends v{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
2986idationMessage=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`
2987            <div class="basket-module__content basket-module__content_secondary">
2988                <footer class="basket-summary__footer">
2989                    <flash-messenger
2990                        ${I(this._flashMessengerRef)}
2991                        class="d-block mb-xs-1"
2992                        name="basket-summary-checkout-footer"
2993                        tabindex="-1"
2994                    ></flash-messenger>
2995
2996                    <total-and-pay></total-and-pay>
2997                </footer>
2998            </div>
2999        `}}var ir=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&&ir(e,t,s),s};class Te extends v{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(cs.api),this._storefrontSettingsApi=this.getApiSync(N.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(S(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`
3000            <ul class="price-list">
3001                <li class="price-list__item">
3002                    <span class="price-list__label">${l("Total")}</span>
3003                    <span class="price-list__value price price_m">
3004                        ${g(this._hasPromotionCode.value||this._promotions.value&&this._promotions.value.length>0,()=>r`
3005                                <p class="p p_no-margin price__value">
3006                                    <strong class="p_l font_semibold price__value_special">
3007                                        ${this._totalSum.value?.grossValueFormatted}
3008                                    </strong>
3009                                    ${this._showNetPrices?l("with VAT"):d}
3010                                </p>
3011                            `,()=>r`
3012                                <strong class="d-block p_l font_semibold price__value">
3013                                    ${this._totalSum.value?.grossValueFormatted} ${this._showNetPrices?l("with VAT"):d}
3014                                </strong>
3015                            `)}
3016                        <p class="p_s p_no-margin  color_tertiary">
3017                            ${this._showNetPrices?r`${this._totalSum.value?.netValueFormatted} ${l("without VAT")}`:r`${l("Includes VAT")}`}
3018                        </p>
3019                    </span>
3020                </li>
3021            </ul>
3022
3023            ${F(this._basketOrderApi.selectOrderInProgress$(),r`<div>
3024                    <div class="btn btn_primary btn_full-width">
3025                        <div class="loader">
3026                            <div class="loader__spinner loader__spinner_xs"></div>
3027                        </div>
3028                    </div>
3029                </div>`,r` ${this._checkoutButton} `)}
3030            ${!this._canBuyWhileUnregistered&&!this._authenticationApi.isAuthorized()?r` <p class="p_xs p_no-margin mt-xs-1">${j(this._loginInfo)}</p> `:d}
3031            ${g(this._loyaltyPointsAwarded.value&&this._loyaltyPointsAwarded.value.points>0,()=>r` <p class="p_xs color_secondary mt-xs-2">${j(this._loyaltyPointsAwardInfo)}</p> `,()=>d)}
3032        `}}Qe([p()],Te.prototype,"_checkoutButton");Qe([p()],Te.prototype,"_loyaltyPointsAwardInfo");Qe([p()],Te.prototype,"_loginInfo");Qe([p()],Te.prototype,"_canBuyWhileUnregistered");Qe([p()],Te.prototype,"_showNetPrices");class ar extends v{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`
3033            <div class="basket-addresses__form-teaser">
3034                <div
3035                    inert
3036                    role="presentation"
3037                    class="basket-addresses__form-teaser-blur"
3038                >
3039                    <h-control class="control control_row pt-xs-1">
3040                        <h-control-content class="control__content_auto">
3041                            <h-control-element class="control__element">
3042                                <div class="radio-box">
3043                                    <input
3044                                        type="radio"
3045                                        checked
3046                                        value="false"
3047                                        class="radio-box__input"
3048                                        tabindex="-1"
3049                                    />
3050
3051                                    <label class="radio-box__label"> ${l("Consumer")} </label>
3052                                </div>
3053                            </h-control-element>
3054                        </h-control-content>
3055
3056                        <h-control-content class="control__content_auto">
3057                            <h-control-element class="control__element">
3058                                <div class="radio-box">
3059                                    <input
3060                                        type="radio"
3061                                        value="false"
3062                                        class="radio-box__input"
3063                                        tabindex="-1"
3064                                    />
3065
3066                                    <label class="radio-box__label"> ${l("Company")} </label>
3067                                </div>
3068                            </h-control-element>
3069                        </h-control-content></h-control
3070                    >
3071
3072                    <h-control class="control">
3073                        <h-control-label class="control__label">
3074                            <label class="label label_required">
3075                                <span class="label__asterisk" aria-hidden="true">*</span>
3076                                ${l("E-mail address")}
3077                            </label>
3078                        </h-control-label>
3079
3080                        <h-control-content class="control">
3081                            <h-control-element class="control__element">
3082                                <div class="input">
3083                                    <div class="input__control">
3084                                        <input
3085                                            type="text"
3086                                            tabindex="-1"
3087                                        />
3088                                    </div>
3089                                </div>
3090                            </h-control-element>
3091                        </h-control-content>
3092                    </h-control>
3093
3094                    <h-control class="control">
3095                        <h-control-label class="control__label">
3096                            <label class="label label_required">
3097                                <span class="label__asterisk" aria-hidden="true">*</span>
3098                                ${l("First name")}
3099                            </label>
3100                        </h-control-label>
3101
3102                        <h-control-content class="control">
3103                            <h-control-element class="control__element">
3104                                <div class="input">
3105                                    <div class="input__control">
3106                                        <input
3107                                            type="text"
3108                                            tabindex="-1"
3109                                        />
3110                                    </div>
3111                                </div>
3112                            </h-control-element>
3113                        </h-control-content>
3114                    </h-control>
3115
3116                    <h-control class="control">
3117                        <h-control-label class="control__label">
3118                            <label class="label label_required">
3119                                <span class="label__asterisk" aria-hidden="true">*</span>    
3120                                ${l("Last name")}
3121                            </label>
3122                        </h-control-label>
3123
3124                        <h-control-content class="control">
3125                            <h-control-element class="control__element">
3126                                <div class="input">
3127                                    <div class="input__control">
3128                                        <input
3129                                            type="text"
3130                                            tabindex="-1"
3131                                        />
3132                                    </div>
3133                                </div>
3134                            </h-control-element>
3135                        </h-control-content>
3136                    </h-control>
3137                </div>
3138
3139                <button
3140                    ${I(this._teaserButtonRef)}
3141                    aria-haspopup="dialog"
3142                    aria-expanded="false"
3143                    class="btn btn_primary basket-addresses__form-teaser-btn"
3144                    aria-label="${l("Open the Order information form")}"
3145                >
3146                    <h-icon
3147                        icon-name="icon-user"
3148                        css-classes="btn__icon btn__icon_left"
3149                        aria-hidden="true"
3150                    ></h-icon>
3151                    ${l("Add order information")}
3152                </button>
3153            </div>
3154        `}}class nr{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 rr{execute(){return nr}}class or{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 lr{execute(){return or}}class cr{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 dr{execute(){return cr}}const as={inpost:rr,ShoperShipment:lr,InPostInternational:dr};class hr extends O{#e;#t;#s;#a=new Ft;#n=null;#r=new ke(!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(A())}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!!as[e]}_getUniqueShippingName(e,t){return`${e}_${t}`}_ensureStrategyExists(e,t){this.#a.has(t)||this.#a.add(t,new as[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 pr extends de{constructor({nearestPickupPointsService:e}){super(),this.moduleName=$s.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 ur=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&&ur(e,t,s),s};class ve extends v{constructor(){super(...arguments),this.selectedPickupPoint=null,this.nearestPickupPoints=[],this._isSelectedPointOnList=!1,this._showErrorFlag=!1,this.focusedId="",this._nearestPickupPointZipCodeId=`nearear-pickup-point-zip-code-${k()}`,this._debouncedSearch=Tt(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()}}
3154render(){return r`<h-control-label class="control__label">
3155                <label
3156                    class="label"
3157                    for="${this._nearestPickupPointZipCodeId}"
3158                    >${l("Choose a delivery point near you")}</label
3159                >
3160            </h-control-label>
3161
3162            <h-control>
3163                <h-control-content class="control">
3164                    <h-control-element class="control__element">
3165                        <h-input
3166                            controlId="${this._nearestPickupPointZipCodeId}"
3167                            controlName="nearest_pickup_point_zip_code"
3168                            placeholder=${l("Enter your postal code")}
3169                            @keyup="${e=>this._handleInputChange(e)}"
3170                        >
3171                            <h-input-control></h-input-control>
3172
3173                            <h-icon
3174                                icon-name="icon-search"
3175                                aria-hidden="true"
3176                            ></h-icon>
3177                        </h-input>
3178                    </h-control-element>
3179                </h-control-content>
3180            </h-control>
3181
3182            <div role="radiogroup">
3183                ${g(this._showErrorFlag&&this.nearestPickupPoints.length<=0,()=>r`<div class="flash-message flash-message__error mb-xs-2">
3184                        <h-icon
3185                            icon-name="icon-alert-triangle"
3186                            css-classes="flash-message__icon"
3187                            role="button"
3188                            aria-hidden="true"
3189                        ></h-icon>
3190
3191                        <p>${l("No items match your search. Check if your data is correct.")}</p>
3192                    </div>`,()=>d)}
3193                ${$e(this.nearestPickupPoints,e=>us.encode(JSON.stringify(e)),e=>r`
3194                        <h-radio
3195                            controlId="${`nearest-pickup-point-${e.code}`}"
3196                            controlName="nearest_pickup_point"
3197                            class="basket-shipping__pickup-point-address nearest-pickup-points__point"
3198                            .value="${e.code}"
3199                            @change="${t=>this._setPickupPoint(t,e)}"
3200                            ?checked="${this.selectedPickupPoint?.code===e.code}"
3201                        >
3202                            <h-radio-control
3203                                aria-describedby="${e?.description?`${e.code}-description`:""}"
3204                            ></h-radio-control>
3205
3206                            <h-radio-content class="nearest-pickup-points__radio">
3207                                <div class="nearest-pickup-points__header" slot="label">
3208                                    <p class="font_size-xs p_no-margin">
3209                                        <strong class="font_semibold"> ${e?.code} </strong>, ${e?.street}
3210                                        ${e?.houseNumber}, ${e?.postalCode} ${e?.city}
3211                                        <span class="sr-only">${e?.description}</span>
3212                                    </p>
3213
3214                                    <p
3215                                        class="font_size-xs nearest-pickup-points__description"
3216                                        id="${e.code}-description"
3217                                        slot="description"
3218                                        aria-hidden="true"
3219                                    >
3220                                        ${e?.description}
3221                                    </p>
3222                                </div>
3223                            </h-radio-content>
3224                        </h-radio>
3225                    `)}
3226                ${g(this._isSelectedPointOnList||!this.selectedPickupPoint,()=>d,()=>r`<h-radio
3227                        controlId="${`nearest-pickup-point-${this.selectedPickupPoint?.code}`}"
3228                        controlName="nearest_pickup_point"
3229                        class="basket-shipping__pickup-point-address nearest-pickup-points__point"
3230                        .value="${this.selectedPickupPoint?.code}"
3231                        ?checked="${!0}"
3232                    >
3233                        <h-radio-control
3234                            aria-describedby="${this.selectedPickupPoint?.address.description?`${this.selectedPickupPoint?.code}-description`:""}"
3235                        ></h-radio-control>
3236
3237                        <h-radio-content class="nearest-pickup-points__radio">
3238                            <div class="nearest-pickup-points__header" slot="label">
3239                                <p class="font_size-xs p_no-margin">
3240                                    <strong class="font_semibold"> ${this.selectedPickupPoint?.code} </strong>,
3241                                    ${this.selectedPickupPoint?.address.street} ${this.selectedPickupPoint?.address.houseNumber},
3242                                    ${this.selectedPickupPoint?.address.postalCode} ${this.selectedPickupPoint?.address.city}
3243                                    <span class="sr-only">${this.selectedPickupPoint?.address.description}</span>
3244                                </p>
3245                            </div>
3246
3247                            <p
3248                                class="font_size-xs nearest-pickup-points__description"
3249                                id="${this.selectedPickupPoint?.code}-description"
3250                                slot="description"
3251                                aria-hidden="true"
3252                            >
3253                                ${this.selectedPickupPoint?.address.description}
3254                            </p>
3255                        </h-radio-content>
3256                    </h-radio>`)}
3257            </div>
3258
3259            <p class="nearest-pickup-points__separator">${l("or")}</p>`}}Oe([u()],ve.prototype,"shipping");Oe([u()],ve.prototype,"selectedPickupPoint");Oe([u()],ve.prototype,"nearestPickupPoints");Oe([p()],ve.prototype,"_isSelectedPointOnList");Oe([p()],ve.prototype,"_showErrorFlag");Oe([u({type:String})],ve.prototype,"focusedId");class mr{#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 _r=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&&_r(e,t,s),s};class Ye extends v{constructor(){super(),this._form=P(),this.address=null,this.addressMode=Z.consumerAndCompany,this.isLoggedIn=!1,this._formErrors=null,this._debouncedHandleAddressFormChange=Tt(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(N.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`
3260            <div class="basket-module__content basket-module__content_pt-0">
3261                <flash-messenger
3262                    class="d-block mb-xs-2"
3263                    name="billing-address-standard"
3264                ></flash-messenger>
3265
3266                <billing-address-form
3267                    ${I(this._form)}
3268                    .address=${this.address}
3269                    .addressMode=${this.addressMode}
3270                    .isLoggedIn=${this.isLoggedIn}
3271                    .formErrors=${we.toJson(this._formErrors)}
3272                ></billing-address-form>
3273            </div>
3274        `}}St([u()],Ye.prototype,"address");St([u()],Ye.prototype,"addressMode");St([u()],Ye.prototype,"isLoggedIn");St([p()],Ye.prototype,"_formErrors");var gr=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);return s&&gr(e,t,s),s};class Kt extends v{constructor(){super(),this._form=P(),this.address=null,this._formErrors=null,this._debouncedHandleAddressFormChange=Tt(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(N.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
3275                class="d-block mb-xs-2"
3276                name="shipping-address-standard"
3277            ></flash-messenger>
3278            <shipping-address-form
3279                ${I(this._form)}
3280                .address=${this.address}
3281                .formErrors=${we.toJson(this._formErrors)}
3282            ></shipping-address-form>`}}Ns([u()],Kt.prototype,"address");Ns([p()],Kt.prototype,"_formErrors");class yr extends v{static{this.moduleName="edit-billing-address-modal"}constructor(){super(),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._settingsApi=this.getApiSync(N.api),this._billingCountry$=this._basketAddressesApi.selectBillingAddress$().pipe(S(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()}
3282render(){return r`<div class="pl-xs-2 pr-xs-2 mb-xs-2">
3283                <flash-messenger name="basket-addresses-1"></flash-messenger>
3284            </div>
3285
3286            <div class="pl-xs-2 pr-xs-2">
3287                <h3 class="font_semibold mb-xs-2">${l("Buyer's details")}</h3>
3288
3289                <address class="address-card mb-xs-2">
3290                    <address-card
3291                        .address=${$(this._basketAddressesApi.selectBillingAddress$())}
3292                        .country=${$(this._billingCountry$)}
3293                    ></address-card>
3294
3295                    <button
3296                        aria-haspopup="dialog"
3297                        aria-label="${l("Edit buyer details")}"
3298                        @click=${()=>{this.emitCustomEvent("open-modal",{bubbles:!0})}}
3299                        class="link link_no-underline mt-xs-1"
3300                    >
3301                        <h-icon
3302                            css-classes="mr-xs-1 icon_link icon_link_left"
3303                            icon-name="icon-edit"
3304                            aria-hidden="true"
3305                        ></h-icon>
3306                        ${l("Edit")}
3307                    </button>
3308                </address>
3309            </div>`}}class br extends v{static{this.moduleName="edit-shipping-address-modal"}constructor(){super(),this._basketAddressesApi=this.getApiSync("basketAddressesApi"),this._settingsApi=this.getApiSync(N.api),this._shippingCountry$=this._basketAddressesApi.selectShippingAddress$().pipe(S(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">
3310                <b class="font_semibold">${l("Delivery address")}</b>
3311            </header>
3312            <address class="address-card">
3313                <address-card
3314                    .address=${$(this._basketAddressesApi.selectShippingAddress$())}
3315                    .country=${$(this._shippingCountry$)}
3316                ></address-card>
3317
3318                <button
3319                    aria-haspopup="dialog"
3320                    aria-label="${l("Edit shipping address")}"
3321                    @click=${()=>{this.emitCustomEvent("open-modal",{bubbles:!0})}}
3322                    class="link link_no-underline mt-xs-1"
3323                >
3324                    <h-icon
3325                        css-classes="mr-xs-1 icon_link icon_link_left"
3326                        icon-name="icon-edit"
3327                        aria-hidden="true"
3328                    ></h-icon>
3329                    ${l("Edit")}
3330                </button>
3331            </address>`}}class fr extends v{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
3332            ${I(this._modal)}
3333            class="modal-wrapper_s modal_queue"
3334        >
3335            <h-modal-header class="modal__header_center">
3336                <h2 class="font_semibold h2">${l("Your order is being processed")}</h2>
3337            </h-modal-header>
3338            <h-modal-body>
3339                <p class="font_size-s text-align-center">
3340                    ${l("Due to high demand, it may take a little longer. Thank you for your patience and trust
3340!")}
3341                </p>
3342
3343                <div
3344                    class="loader mt-xs-4 mb-xs-4"
3345                    role="progressbar"
3346                    aria-busy="true"
3347                >
3348                    <div class="loader__spinner loader__spinner_l"></div>
3349                </div>
3350
3351                <p class="text-align-center mt-xs-2 mb-xs-4">${l("Don't leave this page")}</p>
3352            </h-modal-body>
3353        </h-modal>`}}const Sr=({storeName:n="BasketUpdaterStore"}={})=>U({name:n},K({isCreateBasketQueued:!1}));class vr{#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 kr extends v{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
3354            ${I(this._modal)}
3355            class="modal_queue modal-wrapper_s"
3356        >
3357            <h-modal-header class="modal__header_center">
3358                <h2 class="font_semibold h2">${l("Please wait, adding product...")}</h2>
3359            </h-modal-header>
3360            <h-modal-body>
3361                <p class="font_size-s text-align-center">
3362                    ${l("Adding the product to your cart will take a moment due to high demand. Please do not refresh the page.")}
3363                </p>
3364
3365                <div
3366                    class="loader mt-xs-4 mb-xs-4"
3367                    role="progressbar"
3368                    aria-busy="true"
3369                >
3370                    <div class="loader__spinner loader__spinner_l"></div>
3371                </div>
3372            </h-modal-body>
3373        </h-modal>`}}class Ar 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)}
3373selectGiftCards$(){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 $r=({storeName:n="BasketGiftCardsStore"}={})=>U({name:n},ye(),K({count:0,sum:null,isApplying:!1}));class Pr{#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(oi(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 Cr 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===xt.notFound||i.response?.status===xt.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)}
3373selectGiftCards$(){return this.#e.selectGiftCards$().pipe(A((e,t)=>B(e,t)))}getCount(){return this.#e.getCount()}selectCount$(){return this.#e.selectCount$().pipe(A())}getSum(){return this.#e.getSum()}selectSum$(){return this.#e.selectSum$().pipe(A((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(S(e=>e.length>0),A())}_handleUnexpectedError(e){console.error(e),this.#r.addFlashMessage({type:"error",content:this.#o.translate("An unexpected error occurred")}),this.eventBus.emit(new m(f.unexpectedError))}}var Ir=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&&Ir(e,t,s),s};class Je extends v{constructor(){super(),this._headerId=`gift-cards-header-${k()}`,this._subscriptionController=new Lt(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(N.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(S(([e,t])=>e&&(t?.grossValue??0)>0)),this._initGiftCardsCountHandler()}static{this.moduleName="gift-cards"}_initAvailabilityHandler(){const e=this._basketOverallApi.selectActions$().pipe(S(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(ps(this._basketGiftCardsApi.getCount()),ri());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
3374            ${I(this._sectionRef)}
3375            class="basket-module__content basket-gift-cards"
3376            aria-labelledby="${this._headerId}"
3377            tabindex="-1"
3378        >
3379            <header class="grid__row">
3380                <div class="grid__col grid__col_xs-12 grid__col_sm-grow ">
3381                    <h2
3382                        id="${this._headerId}"
3383                        class="section-title section-title_s"
3384                    >
3385                        ${l("Gift card")}
3386                    </h2>
3387                </div>
3388                <div class="grid__col grid__col_xs-12 grid__col_sm-auto d-flex">
3389                    ${F(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),d,r`<button
3390                            type="button"
3391                            aria-expanded="${this._isContentExpanded}"
3392                            class="basket-gift-cards__action-button"
3393                            @click=${()=>this._isContentExpanded=!this._isContentExpanded}
3394                        >
3395                            ${l(this._isContentExpanded?"Cancel":"Add card")}
3396                        </button>`)}
3397                </div>
3398            </header>
3399            ${g(this._isContentExpanded,()=>r`
3400                    ${F(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),r`
3401                            <gift-cards-list></gift-cards-list>
3402                            ${g(!this._isGiftCardFormVisible,()=>F(this._canAddAnotherCard$,r`<button
3403                                            type="button"
3404                                            class="basket-gift-cards__action-button basket-gift-cards__action-button_left"
3405                                            @click=${()=>{this._isGiftCardFormVisible=!0}}
3406                                        >
3407                                            <h-icon
3408                                                icon-name="icon-plus"
3409                                                aria-hidden="true"
3410                                            ></h-icon>
3411                                            ${l("Add another card")}
3412                                        </button>`,d),()=>r`<gift-cards-form @gift-cards-form-ready=${this._handleFormReady}></gift-cards-form>`)}
3413                            <gift-cards-alerts></gift-cards-alerts>
3414                        `,r`<gift-cards-form></gift-cards-form>`)}
3415                `)}
3416        </section>`}}vt([p()],Je.prototype,"_isAvailable");vt([p()],Je.prototype,"_isContentExpanded");vt([p()],Je.prototype,"_isGiftCardFormVisible");vt([p()],Je.prototype,"_isDevGiftCardsPaymentCheckFlagEnabled");class wr extends v{static{this.moduleName="gift-cards-list"}constructor(){super(),this._basketGiftCardsApi=this.getApiSync(ne.api),this._giftCards=new E(this,this._basketGiftCardsApi.selectGiftCards$(
3416))}render(){return r`${F(this._basketGiftCardsApi.selectHasAppliedGiftCards$(),r`
3417                <ul
3418                    class="basket-gift-cards__list"
3419                    aria-label="${l("Gift cards list")}"
3420                    tabindex="-1"
3421                >
3422                    ${$e(this._giftCards.value??[],e=>e.id,e=>r`<li class="basket-gift-cards__list-item-wrapper">
3423                                <gift-cards-list-item .giftCard=${e}></gift-cards-list-item>
3424                            </li>`)}
3425                </ul>
3426            `,d)}`}}var Er=Object.defineProperty,Br=(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 Vs extends v{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(N.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()}"
3427            >${fi.toLocaleDate(this.giftCard.expirationDate,this._locale)}</time
3428        >`:l("No expiration date")}render(){return r`
3429            <div class="basket-gift-cards__list-item">
3430                <picture>
3431                    <img
3432                        class="basket-gift-cards__image"
3433                        src="${this.giftCard.image.paths.original}"
3434                        alt="${l("Gift card")} ${this.giftCard.truncatedCode}"
3435                    />
3436                </picture>
3437                <div class="basket-gift-cards__info">
3438                    <span class="basket-gift-cards__description-line basket-gift-cards__description-line_main"
3439                        >${l("Last characters of the card code:")} ${this.giftCard.truncatedCode}</span
3440                    >
3441                    <span class="basket-gift-cards__description-line ">${l("Expiration date:")} ${this._renderExpirationDate()}</span>
3442                    <span class="basket-gift-cards__description-line"
3443                        >${l("Remaining balance on the card:")} ${this.giftCard.balance.grossValueFormatted}</span
3444                    >
3445                </div>
3446                <button
3447                    type="button"
3448                    class="basket-gift-cards__action-button"
3449                    @click=${this._removeGiftCard}
3450                >
3451                    ${l("Remove")}
3452                </button>
3453            </div>
3454            <flash-messenger name="${this._flashMessengerContainerName}"></flash-messenger>
3455        `}}Br([u({attribute:!1})],Vs.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($i,"").toUpperCase()}hostConnected(){}getFormState(){return this.getFormService().getFormState()}getFormService(){if(!this.#t.value)throw"No form found";return this.#t.value.formService}}const ns=4,Et=" ";class xr{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),M=b+o+w,x=this._formatCode(M);s.value=x;
3455const L=me.normalizeGiftCardCode(o),Le=me.normalizeGiftCardCode(b).length+L.length;let Xe=0,oe=0;for(let le=0;le<x.length;le++)if(x[le]!==Et&&(Xe++,Xe>=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+=ns)i.push(t.slice(s,s+ns));return i.join(Et)}_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]!==Et){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 Mr extends v{constructor(){super(),this._reactiveFormRef=P(),this._formId=`form-gift-card-${k()}`,this._giftCardInputId=`gift-card-${k()}`,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 xr({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`
3456            <div class="control__additional-content">
3457                <reactive-form ${I(this._reactiveFormRef)}>
3458                    <h-control-label class="control__label">
3459                        <label
3460                            class="label"
3461                            for=${this._giftCardInputId}
3462                            >${l("Enter the card code")}</label
3463                        >
3464                    </h-control-label>
3465
3466                    <form
3467                        class="d-flex"
3468                        id=${this._formId}
3469                        @submit=${this._addGiftCard}
3470                    >
3471                        <control-connector
3472                            required
3473                            errorMessage=${l("The field is required")}
3474                            validationNameLabel=${void 0}
3475                            validationMode="${_s.change}"
3476                            class="control control_no-margin mr-xs-1"
3477                        >
3478                            <h-control>
3479                                <h-control-content class="control">
3480                                    <h-control-element class="control__element">
3481                                        <h-input
3482                                            controlId=${this._giftCardInputId}
3483                                            controlName="gift_card_code"
3484                                        >
3485                                            <h-input-control></h-input-control>
3486                                        </h-input>
3487                                    </h-control-element>
3488
3489                                    <control-errors></control-errors>
3490                                </h-control-content>
3491                            </h-control>
3492                        </control-connector>
3493
3494                        <button
3495                            type="submit"
3496                            class="btn btn_secondary"
3497                            ?disabled=${$(this._basketGiftCardsApi.selectIsApplying$())}
3498                            @click=${this._addGiftCard}
3499                        >
3500                            ${l("Apply")}
3501                        </button>
3502                    </form>
3503                </reactive-form>
3504            </div>
3505        `}}const Bt="gift-cards-alerts";class Fr extends v{constructor(){super(),this._subscriptionController=new Lt(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$(
3505),this._basketOverallApi.selectSumToPay$()]).pipe(S(([t,i])=>this._resolveAlertMessage(t,i.grossValue,i.grossValueFormatted)));this._subscriptionController.subscribe(e,t=>{this._currentAlertId&&this._flashMessengerApi.removeFlashMessage(this._currentAlertId,Bt),this._currentAlertId=t?this._flashMessengerApi.addFlashMessage(t,Bt):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="${Bt}"></flash-messenger>`}}class Tr extends v{static{this.moduleName="basket-gift-cards-discounts-list"}constructor(){super(),this._storefrontSettingsApi=this.getApiSync(N.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$(
3505)),this._giftCardsSum=new E(this,this._basketGiftCardsApi.selectSum$()))}_renderGiftCardsList(){return this._giftCards?.value?r`
3506            ${this._giftCards.value.map(e=>r`
3507                    <li class="price-list__item">
3508                        <span class="sr-only"
3509                            >${l("Gift card ending with {{ code }}, {{ price }} paid",{code:e.truncatedCode,price:e.payWithCard.grossValueFormatted})}</span
3510                        >
3511                        <span
3512                            class="price-list__label price_s"
3513                            aria-hidden="true"
3514                            >...${e.truncatedCode}</span
3515                        >
3516                        <span
3517                            class="price-list__value price__value price__value_special price_s"
3518                            aria-hidden="true"
3519                        >
3520                            ${e.payWithCard.grossValueFormatted}
3521                        </span>
3522                    </li>
3523                `)}
3524        `: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`
3525                <h-accordion
3526                    lazy
3527                    class="basket-discounts-list"
3528                >
3529                    <h-accordion-group>
3530                        <h-accordion-toggler class="accordion__toggler p_s mb-xs-1">
3531                            <span>
3532                                ${l("Gift cards")}
3533                                <svg
3534                                    class="icon accordion__toggler-icon accordion__toggler-icon_secondary"
3535                                    aria-hidden="true"
3536                                >
3537                                    <use
3538                                        href="${e}#icon-chevron-down"
3539                                        xlink:href="${e}#icon-chevron-down"
3540                                    ></use>
3541                                </svg>
3542                            </span>
3543
3544                            <span>${this._renderGiftCardsSum()}</span>
3545                        </h-accordion-toggler>
3546
3547                        <h-accordion-content
3548                            ?is-dev-accordion-optimization-flag-enabled=${this._storefrontSettingsApi.isFeatureEnabled("dev_accordion_optimization")}
3549                        >
3550                            <ul
3551                                class="price-list price-list_secondary price-list_s"
3552                                aria-label="${l("Gift cards list")}"
3553                            >
3554                                ${this._renderGiftCardsList()}
3555                            </ul>
3556                        </h-accordion-content>
3557                    </h-accordion-group>
3558                </h-accordion>
3559            `)}`}}class uo extends Js{static{this.featureName=rs.feature}async init(){const e=this.getApiSync(Xs),t=this.getApiSync(Zs),i=await this.getApi(N.api),s=await this.getApi(ae.api),a=await this.getApi(J.api),o=await this.getApi(ds.api),c=this.getApiSync(ei),h=await this.getApi(ti.api),_=new Ti({httpApi:t}),b=Sr(),w=new vr(b),M=new Li({basketHttpApi:_,flashMessengerApi:s,settingsApi:i,storeFactoryApi:c,translationsApi:a,basketUpdaterRepository:w}),x=new Ni({basketUpdaterService:M}),L=this._createBasketOverallApi(e,_,x,s,a),se=this._createBasketOrderApi(_,s,h,a,i,c,L,x),Le=this._createProductsBasketApi(e,_,x,s,a),Xe=this._createBasketPromotionsApi(e,_,x,s,a,L),oe=this._createBasketShippingsApi(e,_,x,s,a,L,i,c),le=this._createBasketAddressesApi(e,_,x,oe,s,a,o,L,i),Rs=this._createBasketPaymentsApi(e,_,x,oe,L,s,a,i,se,le,h,c),Ds=new hr({httpApi:t,basketShippingsApi:oe,basketAddressesApi:le}),Us=new pr({nearestPickupPointsService:Ds}),Gs=this._createBasketTaxesApi(e),qs=this._createBasketLoyaltyApi(e),Wt=i.isFeatureEnabled("dev_gift_cards")?this._createBasketGiftCardsApi(_,x,L,e,s,a):void 0,zs=this._createBasketAdditionalFieldsApi(e,_,L,x);return this.eventBus.emit(new m(f.initialized)),{cores:[{type:si.api,instance:[x,Le,Xe,Rs,oe,le,L,Gs,qs,zs,se,Us,...Wt?[Wt]:[]]},{type:ii,instance:[Nt,De,zt,je,Ht,sr,Xn,Be,Vt,mn,xe,Cs,Rt,Is,ar,Dt,Me,ze,W,He,Ye,Kt,yr,br,Es,xn,Ut,Gt,V,Fe,Ms,We,Fs,qt,Te,ve,fr,kr,...i.isFeatureEnabled("dev_gift_cards")?[Je,wr,Vs,Mr,Fr,Tr]:[]]}]}}_createProductsBasketApi(e,t,i,s,a){const o=Ii(),c=new wi(o),h=new Ci({basketProductsListRepository:c,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a}),_=Bi(),b=new xi(_),w=new Mi({basketProductsSummaryRepository:b,messageStorageApi:e});return new Fi({basketProductsListService:h,basketProductsSummaryService:w})}_createBasketPromotionsApi(e,t,i,s,a,o){const c=Vi(),h=new Di(c),_=new Ri({basketPromotionsListRepository:h,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a,basketOverallApi:o}),b=Hi(),w=new qi(b),M=new Gi({basketPromotionsSummaryRepository:w,messageStorageApi:e});return new Ui({basketPromotionListService:_,basketPromotionSummaryService:M})}_createBasketPaymentsApi(e,t,i,s,a,o,c,h,_,b,w,M){const x=ua(),L=new ma(x),se=new Oa({basketPaymentsListRepository:L,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,basketShippingsApi:s,basketOverallApi:a,flashMessengerApi:o,translationsApi:c,settingsApi:h,basketOrderApi:_,basketAddressesApi:b,pageManagerApi:w,templateHolder:new is,storeFactoryApi:M});return new pa({basketPaymentsListService:se})}_createBasketShippingsApi(e,t,i,s,a,o,c,h){const _=ha(),b=new da(_),w=new ca({basketShippingsListRepository:b,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a,basketOverallApi:o,templateHolder:new is,settingsApi:c,storeFactoryApi:h}),M=Rn(),x=new Dn(M),L=new Un({basketShippingsCountriesRepository:x,messageStorageApi:e});return new Ki({basketShippingsListService:w,basketShippingsCountriesService:L})}_createBasketAddressesApi(e,t,i,s,a,o,c,h,_){const b=La(),w=new Na(b),M=new Ua({basketAddressesRepository:w,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,basketShippingsApi:s,flashMessengerApi:a,translationsApi:o,userApi:c,basketOverallApi:h,settingsApi:_});return new Ga({basketAddressesService:M})}_createBasketAdditionalFieldsApi(e,t,i,s){const a=qa(),o=new za(a),c=new Ha({basketAdditionalFieldsRepository:o,messageStorageApi:e,basketOverallApi:i,basketHttpApi:t,basketUpdaterApi:s});return new Ka({basketAdditionalFieldsService:c})}_createBasketOverallApi(e,t,i,s,a){const o=Wa(),c=new ja(o),h=new Qa({basketOverallRepository:c,basketHttpApi:t,basketUpdaterApi:i,messageStorageApi:e,flashMessengerApi:s,translationsApi:a});return new Ya({basketOverallService:h})}_createBasketTaxesApi(e){const t=Xa(),i=new en(t),s=new Za({basketTaxesSummaryRepository:i,messageStorageApi:e}),a=sn(),o=new an(a),c=new tn({basketTaxesListRepository:o,messageStorageApi:e});return new Ja({basketTaxesSummaryService:s,basketTaxesListService:c})}_createBasketLoyaltyApi(e){const t=rn(),i=new on(t),s=new ln({basketLoyaltyRepository:i,messageStorageApi:e});return new nn({basketLoyaltyService:s})}_createBasketOrderApi(e,t,i,s,a,o,c,h){const _=Kn(),b=new Wn(_),w=new mr,M=new Hn({basketHttpApi:e,flashMessengerApi:t,pageManagerApi:i,translationsApi:s,settingsApi:a,storeFactoryApi:o,basketOverallApi:c,basketOrderRepository:b,basketCustomValidation:w,basketUpdaterApi:h});return new Gn({basketOrderService:M})}_createBasketGiftCardsApi(e,t,i,s,a,o){const c=$r(),h=new Pr(c),_=new Cr({basketG
3559iftCardsRepository:h,basketHttpApi:e,basketUpdaterApi:t,basketOverallApi:i,messageStorageApi:s,flashMessengerApi:a,translationsApi:o});return new Ar({basketGiftCardsService:_})}}export{uo 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.