1import jt from"./Du9UN61w.js";import{_ as Tt,u as Ut,a as Nt}from"./D6dr3nMX.js";import{_ as qt}from"./CUio1qhl.js";import{_ as st}from"./CeIJJ296.js";import{y as K,u as W,B as N,r as b,j as S,G as lt,c as x,o as r,h as B,f as V,w as Q,g as e,a1 as _e,Q as ue,d as a,t as P,F as ae,q as ke,p as O,z as Z,e as oe,v as re,K as rt,m as ne,n as de,D as se,aj as De,E as ie,ao as Kt,af as Rt,ai as Gt,i as it,M as Ht,ap as Wt,Y as Yt,N as je,aq as Jt,O as Le,ah as Qt,Z as Xt,ar as ct,b as Zt,as as eo,T as to,l as oo,U as ao,a as no,P as so,am as Ze,C as lo,at as le,X as ro,W as et,a3 as Oe}from"./K1b_ijTh.js";import{d as dt,g as io}from"./D3CM0kaY.js";import{_ as ut,a as pt,b as co,c as uo,d as po}from"./BFbb30Cx.js";import{u as mt}from"./BQguEG_I.js";import{u as ft}from"./Zxf_Ata2.js";import{b as mo,u as fo,a as tt,c as ot}from"./ClJUjObH.js";import{r as yo}from"./CZ-9ZaBF.js";import{_ as vo}from"./Bg9PB-UY.js";import{_ as ho,a as _o}from"./pjb_M3L6.js";import{u as ko}from"./B1Fi2rw8.js";import{h as bo,a as ze}from"./XUID70n1.js";import"./B6djy50J.js";const go={class:"space-y-6"},wo={key:0,class:"flex gap-2"},xo={__name:"ContactForm",props:{contactData:{type:Object,default:()=>({})},newsletterTerms:{type:Array,required:!1,default:()=>[]}},emits:["updateContact","newsletterChecked"],setup(_,{expose:$,emit:u}){const y=_,{contactData:n,newsletterTerms:o}=K(y),i=u,{t:p}=W(),v=b(null),t=io().classes,h=S(()=>v.value?.node?.value||{}),m=S(()=>v.value?.node?.context?.state?.valid===!0);async function d(f){f&&f?.target.attributes["aria-describedby"]||await i("updateContact",h.value)}const k=dt(d,300);function E(){}const F=b(!1);return N(F,f=>i("newsletterChecked",f)),$({contact:h,isValid:m}),(f,c)=>{const I=qt,A=lt("FormKit"),D=st;return r(),x("div",go,[B(A,{type:"form",ref_key:"form",ref:v,config:{classes:e(t)},"submit-attrs":{inputClass:"hidden"},value:e(n),id:"contactForm","incomplete-message":!1,onSubmit:E,onKeydown:c[0]||(c[0]=_e(ue(()=>{},["prevent"]),["enter"]))},{default:Q(()=>[B(I,{type:"email",name:"email",placeholder:e(p)("checkout.Email_template"),label:e(p)("checkout.Email_address"),validation:"required|*email",onChange:e(k)},null,8,["placeholder","label","onChange"])]),_:1},8,["config","value"]),e(o)?.length>
10?(r(),x("div",wo,[B(D,{terms:e(o),onAllChecked:c[1]||(c[1]=L=>F.value=L)},null,8,["terms"])])):V("",!0)])}}},Co={class:"bg-white rounded-lg shadow-lg w-11/12 max-w-lg p-6"},So={class:"text-xl font-semibold mb-4"},$o={class:"max-h-64 overflow-y-auto mb-4"},Po={key:0,class:"p-2 border-b"},Vo=["onClick"],Fo={class:"flex space-x-4 text-teal-400 text-sm"},Io=["onClick"],Ao={class:"flex justify-end space-x-2"},Eo={__name:"AddressPopup",props:{addresses:{type:Array,default:()=>[]},type:{type:String,default:"address"}},emits:["addressSelected","addAddress","editAddress","close"],setup(_,{emit:$}){const{t:u}=W(),y=_,{addresses:n,type:o}=K(y),i=$,p=S(()=>o.value==="address"?u("user.Add_your_address"):u("user.Add_your_invoice_data")),v=S(()=>o.value==="address"?u("user.Select_address"):u("user.Select_invoice_data"));function t(k){i("addressSelected",k)}function h(){i("addAddress")}function m(k){i("editAddress",k)}function d(){i("close")}return(k,E)=>{const F=ut,f=pt;return r(),x("div",{class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",onClick:ue(d,["self"])},[a("div",Co,[a("h3",So,P(e(v)),1),a("ul",$o,[(r(!0),x(ae,null,ke(e(n),c=>(r(),x("div",{key:c.id},[c.valid?(r(),x("li",Po,[a("div",{onClick:I=>t(c),class:"cursor-pointer hover:bg-gray-100"},[e(o)==="address"?(r(),O(F,{key:0,address:c,editable:!1},null,8,["address"])):(r(),O(f,{key:1,invoice:c,editable:!1},null,8,["invoice"]))],8,Vo),a("div",Fo,[a("button",{onClick:I=>m(c)},P(k.$t("global.Edit")),9,Io)])])):V("",!0)]))),128))]),a("div",Ao,[a("button",{onClick:h,class:"bg-blue-600 text-white px-4 py-2 rounded hover:bg-blue-700"},P(e(p)),1),a("button",{onClick:d,class:"bg-gray-300 text-gray-700 px-4 py-2 rounded hover:bg-gray-400"},P(k.$t("global.Cancel")),1)])])])}}},Mo={key:0},Bo={key:1},Oo={class:"font-medium text-blue-600"},zo={__name:"CheckoutAddressSelector",props:{address:{type:Object,default:()=>({})},availableAddresses:{type:Array,default:()=>[]},countries:{type:Array,default:()=>[]},type:{type:String,default:"address"}},emits:["getAddresses","editAddress","addressSelected","addressAdded"],setup(_,{expose:$,emit:u}){const{t:y}=W(),n=_,{address:o,availableAddresses:i,countries:p,type:v}=K(n),t=u,h=b({}),m=b(!1),d=b(!1),k=S(()=>o.value?o.value&&o.value.valid:!1),E=S(()=>v.value==="address"?y("user.Add_your_address"):y("user.Add_your_invoice_data"));async function F(){await t("getAddresses"),m.value=!0}function f(){m.value=!1}function c(){f(),d.value=!0}function I(){d.value=!1}function A(l){t("addressSelected",l.id),f()}function D(l){f(),h.value=l,d.value=!0}function L(l){h.value?(t("editAddress",l,l.id),h.value={}):t("addressAdded",l),I()}return $({isValid:k}),(l,C)=>{const w=ut,M=pt,z=Eo,j=co;return r(),x("div",null,[a("div",{onClick:F,class:"cursor-pointer border rounded hover:bg-gray-50"},[e(o).valid?(r(),x("div",Mo,[e(v)==="address"?(r(),O(w,{key:0,address:e(o)},null,8,["address"])):(r(),O(M,{key:1,invoice:e(o)},null,8,["invoice"]))])):(r(),x("div",Bo,[a("p",Oo,P(e(E)),1)]))]),e(m)?(r(),O(z,{key:0,addresses:e(i),type:e(v),onAddressSelected:A,onAddAddress:c,onEditAddress:D,onClose:f},null,8,["addresses","type"])):V("",!0),e(d)?(r(),O(j,{key:1,countries:e(p),type:e(v),"address-data":e(h),onOnSave:L,onClose:I},null,8,["countries","type","address-data"])):V("",!0)])}}},Lo={class:"px-4 py-2.5 bg-error-100"},Do={class:"flex-1 flex justify-start items-center gap-1"},jo={class:"justify-start text-error-500 text-sm font-normal font-['Inter'] leading-tight"},yt={__name:"CheckoutValidationBox",props:{message:{Type:String,required:!0}},setup(_){return($,u)=>(r(),x("div",Lo,[a("div",Do,[a("div",jo,P(_.message),1)])]))}},To={class:"checkout-delivery-card-container"},Uo=["aria-checked","onKeydown"],No={key:0,class:"checkout-fake-radio-dot"},qo={class:"checkout-delivery-card--content"},Ko={class:"checkout-delivery-card--name"},Ro={key:0,class:"checkout-delivery-card--locker-select"},Go={key:1,class:"checkout-delivery-card--locker-select"},Ho={class:"checkout-delivery-card--footer"},Wo={class:"checkout-delivery-card--delivery-text"},Yo={class:"checkout-delivery-card--icon flex flex-col lg:hidden"},Jo={class:"checkout-delivery-card--cost lg:hidden"},Qo={class:"checkout-delivery-card--icon-box"},Xo={class:"checkout-delivery-card--cost"},Zo={class:"checkout-delivery-card--icon"},ea={key:0,class:"card-validation-message"},ta={__name:"CheckoutDeliveryCard",props:{option:{type:Object,required:!0},isSelected:{type:Boolean,default:!1},selectedParcelLocker:{type:Object,default:()=>null},raiseValidation:{type:Boolean,default:!1,required:!1}},emits:["select"],setup(_,{emit:$}){const u=_,{resolveImageUrl:y}=mt(),n=ft(),{option:o,isSelected:i,selectedParcelLocker:p}=K(u),v=$,t=()=>
1{v("select")},h=S(()=>p.value?p.value.street.replace(`${p.value.name} -`,"").trim():""),m=S(()=>["Parcel locker","Pickup point"].includes(o.value?.delivery_method?.type)),d=S(()=>y(o.value?.delivery_method?.icon,{isMobile:n.isMobile}));return(k,E)=>{const F=re,f=rt;return r(),x("div",To,[a("div",{class:Z(["checkout-selectable-card","checkout-delivery-card",e(i)?"checkout-delivery-card--selected":"",_.raiseValidation&&e(i)?"checkout-delivery-card--validation":""]),role:"radio","aria-checked":e(i),tabindex:"0",onClick:t,onKeydown:_e(ue(t,["prevent"]),["space"])},[a("div",{class:Z(["checkout-fake-radio",{"checkout-fake-radio-selected":e(i)}])},[e(i)?(r(),x("span",No)):V("",!0)],2),a("div",qo,[a("span",Ko,P(e(o).delivery_method.name),1),e(i)&&e(p)?(r(),x("div",Ro,[oe(" ("+P(e(p).name)+") ",1),e(h)?(r(),x(ae,{key:0},[oe(P(e(h))+", "+P(e(p).postcode)+" "+P(e(p).city),1)],64)):V("",!0),B(F,{name:"iconoir:edit-pencil"})])):e(m)&&e(i)&&!e(p)?(r(),x("div",Go,P(k.$t("global.Choose")),1)):V("",!0),a("div",Ho,[a("span",Wo,P(e(o)?.delivery_method?.delivery_text?e(o).delivery_method.delivery_text:`${k.$t("cart.Dispatch")} ${e(o).dispatch_within}`),1),a("div",Yo,[e(o)?.delivery_method?.icon?(r(),O(f,{key:0,src:e(d),alt:e(o)?.delivery_method?.name,class:"ml-auto h-6 max-w-16 w-auto object-contain flex-shrink-0"},null,8,["src","alt"])):V("",!0)]),a("span",Jo,P(k.$n(parseFloat(e(o)?.costs?.cost),"currency")),1)])]),a("div",Qo,[a("span",Xo,P(k.$n(parseFloat(e(o)?.costs?.cost),"currency")),1),a("div",Zo,[e(o)?.delivery_method?.icon?(r(),O(f,{key:0,src:e(d),alt:e(o)?.delivery_method?.name,class:"ml-auto h-6 max-w-16 w-auto object-contain flex-shrink-0"},null,8,["src","alt"])):V("",!0)])])],42,Uo),e(i)&&_.raiseValidation&&e(m)?(r(),x("div",ea,[B(F,{name:"iconoir:info-circle"}),oe(" "+P(k.$t("checkout.Select_parcel_locker")),1)])):V("",!0)])}}},oa={key:0,class:"fixed inset-0 z-[9999] flex items-center justify-center","aria-modal":"true",role:"dialog"},aa={class:"relative bg-white rounded-lg shadow-xl w-[95vw] max-w-[1400px]"},na={__name:"DpdMapModal",props:{show:{type:Boolean,default:!1},dpdKey:{type:String,default:""},dpdUrl:{type:String,default:""},country:{type:String,default:"PL"},filterPoints:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["close","select"],setup(_,{emit:$}){const u=_,y=$,n=()=>y("close"),o=b(null);let i=null,p=null,v=null;const t=()=>{if(!u.dpdKey||!u.dpdUrl)return console.log("[DPD] Missing key or URL",u.dpdKey,u.dpdUrl),"";const m=new URLSearchParams;m.set("key",u.dpdKey),u.country&&m.set("query",u.country),u.filterPoints&&(m.set("hideFilters","1"),u.type==="Parcel locker"?m.set("swip_box","1"):m.set("points_with_services","1"));const d=u.dpdUrl.includes("?")?"&":"?";return`${u.dpdUrl}${d}${m.toString()}`},h=async()=>{if(await de(),!o.value)return;const m=t();m&&(v=d=>{d&&(y("select",{code:d,name:"",type:"dpd",country_code:u.country||"PL"}),n())},window.__dpdPointSelected=v,p=document.createElement("script"),p.id="dpd-widget",p.type="text/javascript",p.text=` 2 function pointSelected(pointID) { 3 if (!pointID) return; 4 window.__dpdPointSelected(pointID); 5 } 6 `,o.value.appendChild(p),console.log("[DPD] anchor appended"),i=document.createElement("script"),i.id="dpd-widget-loader",i.type="text/javascript",i.src=m,o.value.appendChild(i),console.log("[DPD] loader appended"))};return N(()=>u.show,async m=>{m&&await h()}),ne(async()=>{u.show&&await h()}),(m,d)=>_.show?(r(),x("div",oa,[a("div",{class:"absolute inset-0 bg-black bg-opacity-40",onClick:n}),a("div",aa,[a("button",{class:"absolute top-2 right-3 text-xl leading-none text-neutral-600 hover:text-neutral-800",type:"button",onClick:n,"aria-label":"Close"}," Ã "),a("div",{ref_key:"dpdMount",ref:o,class:"w-full h-full overflow-hidden rounded-lg"},null,512)])])):V("",!0)}},sa={class:"checkout-form-subsection flex flex-col justify-start items-start gap-6",id:"deliveryForm"},la={key:0,class:"w-full"},ra={class:"w-full self-stretch flex flex-col justify-start items-start gap-2"},ia={__name:"CheckoutDeliverySelector",props:{options:{type:Array,required:!0},selectedOptionId:{type:Number,default:()=>0},selectedParcelLocker:{type:Object,default:()=>({})},countryDelivery:{type:String,default:""},address:{type:Object,default:()=>({})},isFormValid:{type:Boolean,required:!0},raiseValidation:{type:Boolean,default:!1}},emits:["select","selectParcelLocker"],setup(_,{emit:$}){const u=_,{options:y,selectedOptionId:n,selectedParcelLocker:o,address:i,countryDelivery:p,isFormValid:v,raiseValidation:t}=K(u),h=$,m=b(n.value??null),d=w=>{m.value!==w.delivery_method.id&&A(null),m.value=w.delivery_method.id,h("select",w),["Parcel locker","Pickup point"].includes(w.delivery_method.type)&&f(w.delivery_method)},k=se(),E=b(!1),F=b({type:"",filterPoints:!1,country:""}),f=w=>{const{code:M,type:z,filter_points:j,map_provider:R}=w,H=R||"Furgonetka",T=p.value||k.public?.country||"PL";if(H==="Dpd"){I({code:M,type:z,filterPoints:j,country:T});return}c({code:M,type:z,filterPoints:j,country:T})},c=({code:w,type:M,filterPoints:z,country:j})=>{const R={apiKey:k.public?.furgonetkaMapApiKey,courierServices:w?[w]:["inpost","dpd"],city:i.value?.city,street:i.value?.street,country:j,callback:A};z&&(R.type=M==="Parcel locker"?"parcel_machine":"service_point"),new window.Furgonetka.Map(R).show()},I=({code:w,type:M,filterPoints:z,country:j})=>{F.value={type:M,filterPoints:z,country:j},E.value=!0},A=w=>{const M=w?.point?w.point:w;h("selectParcelLocker",M)},D=w=>m.value===w,L=()=>{E.value=!1},l=S(()=>!m.value&&!v.value&&t.value),C=S(()=>m.value&&!v.value&&t.value);return(w,M)=>{const z=yt,j=ta,R=na;return r(),x(ae,null,[a("section",sa,[a("h3",null,P(w.$t("checkout.Delivery_method")),1),e(l)?(r(),x("div",la,[B(z,{message:w.$t("checkout.Select_delivery_method")},null,8,["message"])])):V("",!0),a("div",ra,[(r(!0),x(ae,null,ke(e(y),H=>(r(),O(j,{key:H.id,option:H,"is-selected":D(H.delivery_method.id),selectedParcelLocker:["Parcel locker","Pickup point"].includes(H.delivery_method.type)?e(o):null,raiseValidation:e(C),onSelect:T=>d(H)},null,8,["option","is-selected","selectedParcelLocker","raiseValidation","onSelect"]))),128))])]),B(R,{show:e(E),dpdKey:e(k).public?.dpdWidgetKey,dpdUrl:e(k).public?.dpdWidgetUrl,country:e(F).country,filterPoints:e(F).filterPoints,type:e(F).type,onClose:L,onSelect:A},null,8,["show","dpdKey","dpdUrl","country","filterPoints","type"])],64)}}},ca={id:"card-form",class:"card_container w-full border-t border-neutral-200 pt-4"},da={class:"p-4 text-center text-[10px] text-neutral-600 flex items-center justify-center border-t border-neutral-200"},ua=["innerHTML"],pa={__name:"PayPalCardFields",props:{buttonName:{type:String,required:!0},checkout:{type:Object,required:!0},currency:{type:String,required:!0},checkoutValid:{type:Boolean,default:!1}},emits:["isFormValid"],setup(_,{emit:$}){const u=se(),y=_,{buttonName:n,currency:o,checkoutValid:i}=K(y),p=$;let v=null,t=null;const h=b(!1),m=b(null),d=b(!1);let k=null;const E=b({numberField:null,expiryField:null,cvvField:null}),F=async()=>{const l=m.value;if(!l)return;const C=await l.getState();if(!C.isFormValid){const{numberField:w,expiryField:M,cvvField:z}
6=E.value,j=Object.entries(C.fields).find(([,R])=>!R.isValid)?.[0];j==="cardNumberField"&&w?.focus(),j==="cardExpiryField"&&M?.focus(),j==="cardCvvField"&&z?.focus();return}i.value&&l.submit({}).catch(w=>{const M=w?.message||"";if(M.includes("Window closed for postrobot_method")||M.includes("Target window is closed")){console.debug("Ignoring transient PayPal submit error",w);return}console.error("CardField submission error:",w)})};N(d,l=>p("isFormValid",l));async function f(l,C){const w=await y.checkout.createPayment();if(!w)throw new Error("Creating payment failed");if(w.skipped)return;const M=w.value?.payment?.data?.id;if(!M)throw new Error("Creating payment failed");return M}async function c(l,C){await y.checkout.capturePayment(l.orderID)}async function I(l,C){l&&await y.checkout.handleNotApprovedPayment("Canceled",l.orderID)}async function A(l){h.value&&(await y.checkout.handleNotApprovedPayment("Error"),D())}function D(){window.paypal&&de(()=>{if(n.value.toLowerCase()==="card"){["card-name-field-container","card-number-field-container","card-expiry-field-container","card-cvv-field-container"].forEach(C=>{const w=document.getElementById(C);w&&(w.innerHTML="")});const l=window.paypal.CardFields({createOrder:f,onApprove:c,onCancel:I,onError:A,inputEvents:{onChange:C=>{d.value=C.isFormValid}},style:{input:{padding:"8px 10px","font-size":"12px","font-family":"sans-serif","letter-spacing":"0.05em","font-weight":"lighter","border-radius":"5px"},".invalid":{color:"red"}}});if(m.value=l,l.isEligible()){l.NameField().render("#card-name-field-container");const C=l.NumberField();C.render("#card-number-field-container");const w=l.ExpiryField();w.render("#card-expiry-field-container");const M=l.CVVField();M.render("#card-cvv-field-container"),E.value={numberField:C,expiryField:w,cvvField:M};const z=document.getElementById("checkout-submit-button");z&&(k&&k!==z&&k.removeEventListener("click",F),z.addEventListener("click",F),k=z),d.value=!1}}})}const L=()=>document.getElementById("checkout-submit-button")?(v=document.createElement("script"),v.async=!0,v.setAttribute("data-sdk-integration-source","developer-studio"),v.src=`https://www.paypal.com/sdk/js?client-id=${u?.public?.paypalClientId}¤cy=${o.value}&components=card-fields`,v.onload=()=>{D(),h.value=!0},document.body.appendChild(v),!0):!1;return ne(()=>{L()||(t=new MutationObserver(l=>{L()&&t.disconnect()}),t.observe(document.body,{childList:!0,subtree:!0}))}),N(n,()=>{h.value&&D()}),ie(()=>{v&&(document.body.removeChild(v),v=null),t&&t.disconnect(),k&&(k.removeEventListener("click",F),k=null),p("isFormValid",!1)}),(l,C)=>{const w=re;return r(),x("div",ca,[C[0]||(C[0]=Kt('<div id="card-name-field-container" data-v-2f25cf04></div><div id="card-number-field-container" data-v-2f25cf04></div><div class="flex flex-row w-full" data-v-2f25cf04><div class="flex flex-col w-1/2" data-v-2f25cf04><div class="w-full" id="card-expiry-field-container" data-v-2f25cf04></div></div><div class="flex flex-col w-1/2" data-v-2f25cf04><div class="w-full" id="card-cvv-field-container" data-v-2f25cf04></div></div></div>',3)),a("div",da,[B(w,{name:"tabler:shield-check",class:"flex-shrink-0 w-10 h-10 md:w-8 md:h-8 mr-2 text-lime-600"}),a("span",{class:"text-left",innerHTML:l.$t("checkout.PayPal_card_security_message")},null,8,ua)])])}}},ma=De(pa,[["__scopeId","data-v-2f25cf04"]]),fa={class:"przelewy24-card-wrapper relative w-full"},ya={key:0,class:"absolute inset-0 grid place-items-center z-10 bg-white/50"},at=370,nt=370,va={__name:"Przelewy24Card",props:{sessionId:String,checkoutValid:Boolean,checkout:Object},emits:["isFormValid","updateFields","tokenizationStarted","tokenizationFinished"],setup(_,{emit:$}){const u=_,y=$,{sessionId:n,checkoutValid:o}=K(u),{public:{przelewy24MerchantId:i,przelewy24Env:p,przelewy24Lang:v}}=se(),t=b(null),h=b(!0);let m=null,d,k,E;function F(){const l=f.value,C=l?.querySelector("iframe");if(!l||!C)return;const w=l.clientWidth;if(w>=370){C.style.transform="",l.style.height=nt+"px";return}const M=w/at;C.style.transform=`scale(${M}
6)`,C.style.transformOrigin="top left",C.style.width=at+"px",l.style.height=nt*M+"px"}const f=b(null);async function c(){return d||(d=new Promise(l=>{if(window.Przelewy24CardTokenization)return l();mo(`https://${p}.przelewy24.pl/js/cardTokenizationIframe.min.js`,l)}),d)}async function I(){if(t.value)return;const{sign:l}=await $fetch("/api/przelewy24Sign",{method:"POST",body:{sessionId:n.value}});t.value=l}function A(){k=l=>{if(!l.data||typeof l.data!="object")return;const{type:C,...w}=l.data;switch(C){case"start":h.value=!1;case"ready":y("isFormValid",w.status);break;case"fail":y("tokenizationFinished",{success:!1});break;case"success":y("updateFields",{ref_id:w.data.refId}),y("tokenizationFinished",{success:!0})}},window.addEventListener("message",k)}function D(){k&&window.removeEventListener("message",k)}function L(){if(!f.value){console.warn("cardContainer ref is null. Component may have unmounted.");return}f.value.innerHTML="",m=new window.Przelewy24CardTokenization(Number(i),n.value,t.value);const l={size:{width:"370"},agreement:{contentEnabled:{enabled:!1}},styles:{border:{form:{width:"0px"}}},lang:v};m.render("form","#przelewy24-card-container",l),document?.getElementById("checkout-submit-button")&&document.getElementById("checkout-submit-button").addEventListener("click",async function(){if(o.value&&await u.checkout.validateCart()){try{m.tokenize("temporary")}catch{}y("tokenizationStarted")}})}return ne(async()=>{await I(),await c(),A(),L(),new MutationObserver(F).observe(f.value,{childList:!0}),E=new ResizeObserver(F),E.observe(f.value)}),ie(()=>{E?.disconnect(),D(),m?.destroy?.(),f.value&&(f.value.innerHTML=""),m=null}),(l,C)=>(r(),x("div",fa,[e(h)?(r(),x("div",ya,[...C[0]||(C[0]=[a("div",{class:"w-12 h-12 border-4 border-gray-200 border-t-black rounded-full animate-spin"},null,-1)])])):V("",!0),a("div",{ref_key:"cardContainer",ref:f,id:"przelewy24-card-container",class:"w-full h-full"},null,512)]))}},ha={__name:"CheckoutPaymentExtraFields",props:{raiseValidation:{type:Boolean,default:!1}},emits:["isFormValid","updateFields"],setup(_,{emit:$}){const{t:u}=W(),y=_,{raiseValidation:n}=K(y),o=$,i=b(null),p=S(()=>i.value?.node?.context?.state?.valid===!0);async function v(h){if(!!(h&&h?.target.attributes["aria-describedby"]))return;const d={[h.target.name]:h.target.value};await o("updateFields",d)}const t=dt(v,300);return N(p,h=>o("isFormValid",h)),N(()=>n.value,h=>{if(!h||!i.value?.node)return;const m=i.value.node;m.walk(d=>{d.props?.type!=="form"&&(d.store.set("touched",!0),d.store.set("dirty",!0))}),m.submit?.(),o("isFormValid",p.value)}),ie(()=>{o("isFormValid",!1)}),(h,m)=>{const d=lt("FormKit");return r(),O(d,{type:"form","form-class":"w-full",ref_key:"form",ref:i,"submit-attrs":{inputClass:"hidden"},"incomplete-message":!1,onKeydown:m[0]||(m[0]=_e(ue(()=>{},["prevent"]),["enter"]))},{default:Q(()=>[B(d,{type:"date",name:"date_of_birth",label:e(u)("checkout.Birth_date")+"*","outer-class":"checkout-payment-extra-fields-date","input-class":"block w-full rounded-md border border-zinc-400 shadow-sm focus:border-stone-900 focus:ring-stone-900 sm:text-sm mt-1","label-class":"block text-base text-sm text-neutral-900 !text-neutral-900","messages-class":"hidden",validation:"required","validation-visibility":e(n)?"live":"blur",onChange:e(t)},null,8,["label","validation-visibility","onChange"])]),_:1},512)}}},_a={__name:"FraudNetScript",props:{token:{type:String,required:!0}},setup(_){const $=se(),u=_,{token:y}=K(u);let n=null,o=null;return ne(()=>{n=document.createElement("script"),n.type="application/json",n.setAttribute("fncls","fnparams-dede7cc5-15fd-4c75-a9f4-36c430ee3a99"),n.textContent=JSON.stringify({f:y.value,s:$?.public?.paypalMerchantId+"_checkout-page",sandbox:$?.public?.paypalSandbox}),document.body.appendChild(n),o=document.createElement("script"),o.type="text/javascript",o.src="https://c.paypal.com/da/r/fb.js",document.body.appendChild(o)}),ie(()=>{n&&(document.body.removeChild(n),n=null),o&&(document.body.removeChild(o),o=null)}),(i,p)=>null}},ka={class:"checkout-selectable-card-container"},ba=["aria-checked","onKeydown"],ga={class:"flex items-center p-4 w-full"},wa={key:0,class:"checkout-fake-radio-dot"},xa={class:"min-w-0 mr-2"},Ca={class:"text-neutral-900 text-base font-medium"},Sa={key:0,class:"text-neutral-900 text-base font-semibold truncate"},$a={class:"text-neutral-900 text-xs leading-3"},Pa={key:0,class:"px-2 mb-2"},Va={key:1,class:"p-0.5"},Fa={key:2,class:"px-4 mb-4"},Ia={key:0,class:"card-validation-message"},Aa={__name:"CheckoutPaymentCard",props:{option:{type:Object,required:!0},isSelected:{type:Boolean,default:!1},checkout:{type:Object,required:!0},currency:{type:String,required:!0},token:{type:String,required:!0},checkoutValid:{type:Boolean,default:!1},raiseValidation:{type:Boolean,default:!1}
6,showDetailsValidation:{type:Boolean,default:!1}},emits:["select","validChange","updateFields","tokenizationFinished","tokenizationStarted"],setup(_,{emit:$}){const u=_,{t:y}=W(),{option:n,isSelected:o,checkoutValid:i,raiseValidation:p,showDetailsValidation:v}=K(u),t=$,h=ft(),{resolveImageUrl:m}=mt(),d=b(!1),k=b(0),E=S(()=>{const l=n.value;return o.value&&l.module=="PayPal"&&l.reversed_process&&l.method.toLowerCase()==="card"}),F=S(()=>{const l=n.value;return o.value&&l.checkout_payment&&l.module==="Przelewy24"&&(l.method==="241"||l.method==="242")}),f=S(()=>{const l=n.value;return l?l.checkout_payment&&l.module==="Przelewy24"&&l.method==="blik_lvl0":!1}),c=S(()=>!E.value&&!F.value&&!f.value&&!n.value.risk_check?!0:f.value?!1:d.value),I=S(()=>n.value.fill_in_text||y("checkout.Fill_payment_details")),A=S(()=>o.value&&p.value&&v.value),D=()=>{t("select",n.value.id),t("validChange",{id:n.value.id,valid:c.value})};N(c,l=>{t("validChange",{id:n.value.id,valid:l})}),ne(()=>{o.value&&t("validChange",{id:n.value.id,valid:c.value})});function L({success:l}){t("tokenizationFinished",{success:l}),l||k.value++}return(l,C)=>{const w=rt,M=ma,z=va,j=ha,R=_a,H=re;return r(),x("div",ka,[a("div",{class:Z(["checkout-selectable-card",e(o)?"checkout-payment-card--selected":"",e(A)?"checkout-payment-card--validation":""]),role:"radio","aria-checked":e(o),tabindex:"0",onClick:D,onKeydown:_e(ue(D,["prevent"]),["space"])},[a("div",ga,[a("div",{class:Z(["checkout-fake-radio",{"checkout-fake-radio-selected":e(o)}])},[e(o)?(r(),x("span",wa)):V("",!0)],2),a("div",xa,[a("p",Ca,P(e(n).name),1),e(n)?.cost>0?(r(),x("p",Sa," +"+P(l.$n(parseFloat(e(n)?.cost),"currency")),1)):V("",!0)]),e(n).tags?(r(!0),x(ae,{key:0},ke(e(n)?.tags,T=>(r(),x("div",{class:"px-2 py-1 bg-warning-warning-500 rounded inline-flex justify-center items-center gap-2 flex-wrap",style:Rt({"--card-bg":T.color})},[a("span",$a,P(T.tag),1)],4))),256)):V("",!0),e(n)?.icon?(r(),O(w,{key:1,src:e(m)(e(n).icon,{isMobile:e(h).isMobile}),alt:e(n).name,class:"ml-auto h-6 max-w-16 w-auto object-contain flex-shrink-0"},null,8,["src","alt"])):V("",!0)]),e(E)?(r(),x("div",Pa,[B(M,{currency:_.currency,buttonName:e(n).method,checkout:_.checkout,checkoutValid:e(i),onIsFormValid:C[0]||(C[0]=T=>d.value=T),onUpdateFields:C[1]||(C[1]=T=>t("updateFields",T))},null,8,["currency","buttonName","checkout","checkoutValid"])])):V("",!0),e(F)?(r(),x("div",Va,[(r(),O(z,{sessionId:_.token,checkoutValid:e(i),checkout:_.checkout,key:e(k),onIsFormValid:C[2]||(C[2]=T=>d.value=T),onTokenizationStarted:C[3]||(C[3]=()=>t("tokenizationStarted")),onTokenizationFinished:L,onUpdateFields:C[4]||(C[4]=T=>t("updateFields",T))},null,8,["sessionId","checkoutValid","checkout"]))])):e(o)&&e(n).risk_check?(r(),x("div",Fa,[B(j,{raiseValidation:e(p),onIsFormValid:C[5]||(C[5]=T=>d.value=T),onUpdateFields:C[6]||(C[6]=T=>t("updateFields",T))},null,8,["raiseValidation"]),B(R,{token:_.token},null,8,["token"])])):V("",!0)],42,ba),e(A)?(r(),x("div",Ia,[B(H,{name:"iconoir:info-circle"}),oe(" "+P(e(I)),1)])):V("",!0)])}}},Ea={class:"checkout-form-subsection self-stretch flex flex-col justify-start items-stretch gap-6",id:"paymentForm"},Ma={class:"flex flex-row w-full justify-between items-center flex-wrap gap-2"},Ba={class:"flex flex-row items-center gap-2 text-success-success-500 justify-start text-neutral-500 text-sm font-normal leading-5"},Oa={key:0,class:"w-full xl:w-1/2 xl:mr-auto"},za={class:"flex flex-col gap-2"},La={__name:"CheckoutPaymentSelector",props:{options:{type:Array,required:!0},selectedOptionId:{type:Number,default:()=>0},checkout:{type:Object,required:!0},currency:{type:String,required:!0},token:{type:String,required:!0},checkoutValid:{type:Boolean,default:!1},raiseValidation:{type:Boolean,default:!1}},emits:["select","validChange","updateExtraFields","tokenizationStarted","tokenizationFinished"],setup(_,{emit:$}){const u=_,{options:y,selectedOptionId:n,raiseValidation:o}=K(u),i=$,p=b(n.value??null),v=Gt({}),t=S(()=>v[p.value]===!0),h=S(()=>y.value.find(f=>f.id===p.value)??null),m=S(()=>!p.value&&o.value),d=S(()=>!!h.value&&!t.value&&o.value);function k(f){p.value=f;const c=y.value.find(I=>I.id===f);i("select",c)}function E({id:f,valid:c}){v[f]=c,i("validChange",v[p.value]??!1)}const F=f=>p.value===f;return(f,c)=>{const I=re,A=yt,D=Aa;return r(),x("section",Ea,[a("div",Ma,[a("h3",null,P(f.$t("checkout.Payment_method")),1),a("div",Ba,[B(I,{name:"iconoir:lock",mode:"svg",class:"w-4 h-4 [&_path]:stroke-[2.5]"}),oe(" "+P(f.$t("checkout.Payment_method_description")),1)])]),e(m)?(r(),x("div",Oa,[B(A,{message:f.$t("checkout.Select_payment_method")},null,8,["message"])])):V("",!0),a("div",za,[(r(!0),x(ae,null,ke(e(y),L=>(r(),O(D,{key:L.id,option:L,"is-selected":F(L.id),checkout:_.checkout,currency:_.currency,token:_.token,checkoutValid:_.checkoutValid,raiseValidation:e(o),showDetail
6sValidation:e(d),onSelect:k,onValidChange:E,onUpdateFields:c[0]||(c[0]=l=>i("updateExtraFields",l)),onTokenizationStarted:c[1]||(c[1]=()=>i("tokenizationStarted")),onTokenizationFinished:c[2]||(c[2]=l=>i("tokenizationFinished",l)),class:"w-full"},null,8,["option","is-selected","checkout","currency","token","checkoutValid","raiseValidation","showDetailsValidation"]))),128))])])}}},Da={class:"sticky top-0 z-[3] flex items-start justify-between bg-white px-4 lg:px-0"},ja={class:"overflow-x-hidden overflow-y-auto max-h-[80dvh] flex flex-col gap-4 text-sm"},Ta=["src","alt"],Ua=["href"],Na=it({__name:"CustomerRightsPopup",props:{isOpen:{type:Boolean}},emits:["update:isOpen"],setup(_,{emit:$}){const{t:u}=W(),y=$,n=o=>{y("update:isOpen",o)};return(o,i)=>{const p=re;return r(),O(e(Yt),{open:_.isOpen,onClose:i[1]||(i[1]=v=>n(!1)),class:"fixed inset-0 z-[70] flex items-center justify-center bg-neutral-500/75 px-2"},{default:Q(()=>[B(e(Ht),{class:"relative flex h-auto w-full max-w-[750px] flex-col gap-6 bg-white p-2 py-4 lg:p-6 shadow-xl rounded-2xl"},{default:Q(()=>[a("div",Da,[B(e(Wt),{class:"inline-flex items-center justify-center gap-2 text-2xl font-medium text-neutral-900"},{default:Q(()=>[B(p,{name:"iconoir:page-star",class:"h-6 w-6 shrink-0"}),oe(" "+P(e(u)("checkout.Guarantees")),1)]),_:1}),a("button",{type:"button",class:"rounded-full bg-neutral-100 p-2 text-neutral-500 duration-300 lg:hover:bg-neutral-200",onClick:i[0]||(i[0]=v=>n(!1))},[i[2]||(i[2]=a("span",{class:"sr-only"},"Close panel",-1)),B(e(yo),{class:"h-4 w-4","aria-hidden":"true"})])]),a("div",ja,[a("img",{class:"h-auto w-full",src:e(u)("checkout.Guarantees_notice_img"),alt:e(u)("checkout.Guarantees_text")},null,8,Ta),a("a",{class:"underline",target:"_blank",rel:"noopener noreferrer",href:e(u)("checkout.Guarantees_read_more_link")},P(e(u)("checkout.Guarantees_read_more")),9,Ua)])]),_:1})]),_:1},8,["open"])}}}),qa={key:0,class:"checkout-form-subsection self-stretch bg-neutral-surface inline-flex flex-col justify-start items-start gap-4"},Ka={class:"rounded-content-box-narrow flex flex-col w-full gap-3 text-sm"},Ra=it({__name:"CustomerRights",setup(_){const{t:$,te:u}=W(),y=S(()=>u("checkout.Guarantees_read_more_link")&&$("checkout.Guarantees_read_more_link")!==""&&u("checkout.Guarantees_notice_img")&&$("checkout.Guarantees_notice_img")!==""),n=b(!1);return(o,i)=>{const p=Na;return e(y)?(r(),x("section",qa,[a("h3",null,P(e($)("checkout.Guarantees")),1),a("div",Ka,[a("button",{type:"button",class:"cursor-pointer underline text-start",onClick:i[0]||(i[0]=v=>n.value=!0)},P(e($)("checkout.Guarantees_text")),1)]),B(p,{isOpen:e(n),"onUpdate:isOpen":i[1]||(i[1]=v=>n.value=v)},null,8,["isOpen"])])):V("",!0)}}}),Ga=["innerHTML"],Ha={id:"blikForm",class:"relative inline-block"},Wa={class:"absolute left-4 top-1 text-xs text-neutral-500 pointer-events-none select-none"},Ya={key:0,class:"card-validation-message"},Ja={__name:"Przelewy24Blik",props:{raiseValidation:{type:Boolean,default:!1}},emits:["updateFields","isFormValid"],setup(_,{emit:$}){const{t:u}=W(),y=b(""),n=b(!1),o=_,{raiseValidation:i}=K(o),p=$;function v(d){const k=d.replace(/\D/g,"").slice(0,6);return k.length>3?`${k.slice(0,3)} ${k.slice(3)}`:k}const t=S(()=>y.value.replace(/\s/g,"").length===6),h=S(()=>!n.value&&!i.value?"border-neutral-300":t.value?"border-green-600":"border-red-600");function m(d){n.value||(n.value=!0),y.value=v(d.target.value),d.target.value=y.value}return N(y,d=>{n.value&&(p("updateFields",{blik_code:d.replace(/\s/g,"")}),p("isFormValid",t.value))}),(d,k)=>{const E=re;return r(),x(ae,null,[a("div",{class:"text-sm text-neutral-500 leading-5",innerHTML:d.$t("checkout.Blik_instruction")},null,8,Ga),a("div",Ha,[a("span",Wa,P(e(u)("checkout.Blik_code")),1),je(a("input",{"onUpdate:modelValue":k[0]||(k[0]=F=>Le(y)?y.value=F:null),onInput:m,inputmode:"numeric",maxlength:"7",placeholder:"___-___",class:Z(["w-full px-4 pt-6 pb-2 text-center text-xl tracking-widest rounded-lg","focus:outline-none focus-visible:outline-none focus:ring-0 focus-visible:ring-0 focus:border-neutral-500","placeholder:text-gray-400","border-2 ",e(h)])},null,34),[[Jt,e(y)]]),e(i)&&!e(t)?(r(),x("div",Ya,[B(E,{name:"iconoir:info-circle"}),oe(" "+P(e(u)("checkout.Fill_payment_details")),1)])):V("",!0)])],64)}}}
6,Qa={__name:"CheckoutPaymentBlik",props:{raiseValidation:{type:Boolean,default:!1},isBlikMethod:{type:Boolean,default:!1}},emits:["updateFields","validChange"],setup(_,{emit:$}){const u=_,{raiseValidation:y,isBlikMethod:n}=K(u),o=$,i=b(!1);return N(i,p=>{n.value&&o("validChange",p)}),(p,v)=>{const t=Ja;return e(n)?(r(),O(t,{key:0,raiseValidation:e(y),onIsFormValid:v[0]||(v[0]=h=>i.value=h),onUpdateFields:v[1]||(v[1]=h=>o("updateFields",h))},null,8,["raiseValidation"])):V("",!0)}}},Xa={class:"paypal-button-wrapper"},Za={__name:"PayPalButton",props:{amount:{type:String,required:!0},currency:{type:String,required:!0},buttonName:{type:String,required:!0},checkout:{type:Object,required:!0},isFormValidated:{type:Boolean,required:!0}},emits:["validateAll"],setup(_,{emit:$}){const u=se(),y=_,{amount:n,currency:o,buttonName:i,isFormValidated:p}=K(y),v=$;let t=null;const h=b(!1);async function m(f,c){if(!p.value){v("validateAll");return}const I=await y.checkout.createPayment();if(!I)throw new Error("Creating payment failed");if(I.skipped)return;const A=I.value?.payment?.data?.id;if(!A)throw new Error("Creating payment failed");return A}async function d(f,c){y.checkout.capturePayment(f.orderID)}async function k(f,c){f&&await y.checkout.handleNotApprovedPayment("Canceled",f.orderID)}async function E(f){if(!p.value){v("validateAll");return}await y.checkout.handleNotApprovedPayment("Error")}function F(){window.paypal&&de(()=>{const f=document.getElementById("paypal-button-container");f&&(f.innerHTML="");const c=window.paypal.FUNDING[i.value.toUpperCase()]||null;window.paypal.Buttons({fundingSource:c,createOrder:m,onApprove:d,onCancel:k,onError:E,style:{shape:"rect",layout:"horizontal",color:"gold"},message:{amount:parseFloat(n.value)}}).render("#paypal-button-container")})}return ne(()=>{t=document.createElement("script"),t.async=!0,t.setAttribute("data-sdk-integration-source","developer-studio"),t.src=`https://www.paypal.com/sdk/js?client-id=${u?.public?.paypalClientId}¤cy=${o.value}&components=buttons`,t.onload=()=>{h.value=!0,F()},document.body.appendChild(t)}),N(i,()=>{h.value&&F()}),ie(()=>{t&&(document.body.removeChild(t),t=null)}),(f,c)=>(r(),x("div",Xa,[...c[0]||(c[0]=[a("div",{id:"paypal-button-container",style:{display:"block",disableMaxHeight:!0},class:"paypal-button-container"},null,-1)])]))}},en={key:1,class:"checkout-summary-total"},tn={class:"text-right text-neutral-900"},on={class:"contents"},an={key:4,class:"pt-4"},nn={class:"self-stretch justify-start text-neutral-900 text-sm font-['Inter'] leading-tight"},sn={__name:"CheckoutSummary",props:{cart:{type:Object,required:!0},isFormValidated:{type:Boolean,required:!0},selectedPaymentMethod:{type:Object,required:!0},selectedDeliveryMethod:{type:Object,required:!0},checkout:{type:Object,required:!0},showLoader:{type:Object,required:!0},showStickySummary:{type:Boolean,default:!1}},emits:["validateAll"],setup(_,{emit:$}){const{t:u,n:y}=W(),n=_,{cart:o,isFormValidated:i,selectedPaymentMethod:p,checkout:v,showLoader:t}=K(n),h=$;function m(c){return y(parseFloat(c),"currency")}const d=S(()=>{const c=p.value;return c?c.module==="PayPal"&&c.method!=="pay_upon_invoice"&&c.reversed_process&&c.method.toLowerCase()!=="card":!1}),k=S(()=>{const c=p.value;return c?!(c.module==="PayPal"&&c.reversed_process&&c.method.toLowerCase()==="card"||c.checkout_payment&&c.module==="Przelewy24"&&(c.method==="241"||c.method==="242")):!1}),E=S(()=>!n.cart?.carry_in?.available||!n.cart?.carry_in_service?n.cart?.lines:[...n.cart.lines,{name:u("global.Carry_in_service_in_delivery_modal"),total_amount:n.cart?.carry_in?.cost,quantity:1,isCarryIn:!0,photo:{url:"",alt:""}}]),F=S(()=>o.value?.discount_codes?.length?o.value.discount:null),f=S(()=>o.value?.carry_in_service?o.value?.carry_in_cost:null);return(c,I)=>{const A=vo,D=ho,L=Za,l=Tt;return r(),x("div",{class:Z([_.showStickySummary?"checkout-summary-bottom-bar":"lg:static relative","bg-white border border-neutral-200 rounded-lg"])},[a("section",{"aria-labelledby":"summary-heading",class:Z(["checkout-summary-content",_.showStickySummary?"checkout-summary-content-sticky":""])},[_.showStickySummary?(r(),x("div",en,[a("span",tn,P(m(e(o)?.total_cost)),1)])):(r(),O(D,{key:0,productsValue:e(o)?.products_cost,vatValue:e(o)?.vat_amount,shipmentCost:_.selectedDeliveryMethod?.costs?.cost??null,totalPrice:e(o)?.total_cost,carryInCost:e(f),discountPrice:e(F)},{additionalContent:Q(()=>[e(E)?.length?(r(),O(A,{key:0,lines:e(E)},null,8,["lines"])):V("",!0)]),_:1},8,["productsValue","vatValue","shipmentCost","totalPrice","carryInCost","discountPrice"])),je(a("div",on,[Xt(c.$slots,"paymentMethods")],512),[[Qt,!_.showStickySummary]]),e(d)?(r(),O(L,{key:2,amount:e(o).total_cost,currency:e(o).currency_code,buttonName:e(p).method,checkout:e(v),isFormValidated:e(i),isCompact:_.showStickySummary,display:e(d),onValidateAll:I[0]||(I[0]=()=>h("validateAll"))},null,8,["amount","currency","buttonName","checkout","isFormValidated","isCompact","display"])):(r(),O(l,{key:3,isFormValidated:e(i),createOrder:e(k),handleCreate:e(v)?.handleCreate,showLoader:e(t),onValidateAll:I[1]||(I[
61]=()=>h("validateAll"))},null,8,["isFormValidated","createOrder","handleCreate","showLoader"])),e(p)?.below_submit_text&&!_.showStickySummary?(r(),x("div",an,[a("div",nn,P(e(p).below_submit_text),1)])):V("",!0)],2)],2)}}},ln={key:0,class:"fixed inset-0 z-50 grid place-items-center bg-black/50"},rn={class:"bg-white w-[90%] max-w-md rounded-lg shadow-lg p-6"},cn={class:"flex items-center justify-between mb-4"},dn={class:"text-xl font-semibold text-red-600"},un=["innerHTML"],pn={class:"text-sm text-gray-800 mb-6"},mn={class:"text-right"},fn={__name:"PaymentFailedPopUp",props:{show:{type:Object,default:b(!1)},status:Object,errorDisplay:[String,Object,Boolean,Number]},emits:["update:show"],setup(_,{emit:$}){const u=_,y=$,{t:n}=W(),{show:o,status:i,errorDisplay:p}=K(u),v=S(()=>typeof p.value=="string"?p.value.trim():"");function t(){y("update:show",!1)}return(h,m)=>(r(),O(ct,{name:"fade"},{default:Q(()=>[e(o)?(r(),x("div",ln,[a("div",rn,[a("header",cn,[a("h3",dn,P(e(i)),1),a("button",{"aria-label":"Close",class:"text-gray-500 text-2xl leading-none hover:text-gray-700",onClick:t}," Ã ")]),e(v)?(r(),x("p",{key:0,class:"text-sm text-gray-700 mb-4",innerHTML:e(v)},null,8,un)):V("",!0),a("p",pn,P(e(n)("checkout.Change_payment_message","You can change your payment method and try again.")),1),a("div",mn,[a("button",{class:"btn px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",onClick:t},P(e(n)("ok_button","OK")),1)])])])):V("",!0)]),_:1}))}},yn=De(fn,[["__scopeId","data-v-f877d96f"]]),vn={key:0,class:"fixed inset-0 z-[70] bg-black/60 backdrop-blur-sm flex items-center justify-center"},hn={class:"bg-white rounded-xl shadow-2xl w-[95%] h-[95%] max-w-[1200px] flex flex-col overflow-hidden"},_n={key:0,class:"flex flex-col items-center justify-center px-6 pt-6 pb-3 text-center"},kn={key:0,class:"mb-3 flex justify-center"},bn={key:1,class:"text-base md:text-lg font-medium text-neutral-800 leading-relaxed"},gn={__name:"Przelewy24ScriptPopUp",props:{token:{type:String,default:""},show:{type:Boolean,default:!1}},emits:["update:show"],setup(_,{emit:$}){const{t:u}=W(),y=_,{token:n,show:o}=K(y),{public:{przelewy24Env:i,baseUrl:p}}=se(),v=S(()=>`https://${i}.przelewy24.pl/whitelabel/card/javascript/${n.value}`),t=b(!0),h=b(u("checkout.Processing_card_transaction"));let m=null,d=null;function k(){const c=document?.getElementById("P24TargetElementId");c&&(c.innerHTML="")}function E(){d&&(window.removeEventListener("Przelewy24CardWhileLabelHandlerReady",d),d=null),k(),m&&(m.remove(),m=null),t.value=!1}function F(){document.querySelectorAll(`script[src^="https://${i}.przelewy24.pl/whitelabel/card/javascript/"]`).forEach(c=>c.remove()),m=null,t.value=!0,m=document.createElement("script"),m.src=v.value,m.async=!0,document.head.appendChild(m)}function f(){E(),setTimeout(()=>{window.location.replace(`${p}/order-status`)},3e3)}return N([o,n],([c,I])=>{c&&I?(F(),d=()=>{Przelewy24CardWhileLabelHandler.config({P24TargetElementId:"P24TargetElementId",P24CardWhiteLabelStartEventCallback:()=>{},P24NeedInteractionEventCallback:A=>{t.value=!1,h.value=""},P24DontNeedInteractionEventCallback:()=>{},P24ScriptFailedEventCallback:A=>{h.value=u("checkout.Processing_card_failed"),f()},P24ScriptSuccessfulEndsEventCallback:A=>{h.value=u("checkout.Processing_card_success"),f()}}),Przelewy24CardWhileLabelHandler.main()},window.addEventListener("Przelewy24CardWhileLabelHandlerReady",d)):c||E()},{immediate:!0}),ie(()=>{E()}),(c,I)=>(r(),O(ct,{name:"fade"},{default:Q(()=>[e(o)?(r(),x("div",vn,[a("div",hn,[e(t)||e(h)?(r(),x("div",_n,[e(t)?(r(),x("div",kn,[...I[0]||(I[0]=[a("div",{class:"h-10 w-10 rounded-full border-4 border-neutral-200 border-t-neutral-900 animate-spin"},null,-1)])])):V("",!0),e(h)?(r(),x("p",bn,P(e(h)),1)):V("",!0)])):V("",!0),I[1]||(I[
61]=a("div",{id:"P24TargetElementId",class:"flex-1 mx-4 mb-4 rounded-lg overflow-hidden"},null,-1))])])):V("",!0)]),_:1}))}},wn=De(gn,[["__scopeId","data-v-717c743b"]]),xn={class:"min-h-[100vh] mb-20"},Cn={key:1,class:"container"},Sn={class:"sr-only"},$n={class:"lg:grid lg:grid-cols-12 lg:gap-x-10"},Pn={class:"checkout-form-column"},Vn={class:"checkout-form-section"},Fn={class:"checkout-form-subsection",id:"contact-data"},In={id:"address-data",class:"checkout-form-subsection"},An=["disabled"],En={key:0,class:"absolute top-full left-0 mt-2 z-20 hidden group-hover:block bg-neutral-900 text-white text-sm px-3 py-2 rounded shadow-lg w-80 pointer-events-none",role:"tooltip"},Mn={key:2},Bn={class:"checkout-form-subsection self-stretch bg-neutral-surface inline-flex flex-col justify-start items-start gap-4"},On={class:"md:col-span-4"},zn={class:"flex h-full"},Ln={class:"lg:sticky lg:top-5 flex flex-col self-start w-full"},Dn={ref:"summaryRef",class:"my-4 lg:mt-0"},os={__name:"checkout",async setup(_){let $,u;const{t:y}=W();Zt();const{loggedIn:n}=eo(),o=ko(),{cartCheckout:i,putCartCheckout:p,recalculateCartCheckout:v}=o,{cartProducts:t}=to(o),{public:{useMatrixRate:h}}=se(),m=b(null),d=b(null),k=b(null),E=b(null),F=b(null),f=b(null),c=b("none"),I=b(null),A=b(!1),D=b(!1),L=b(!1),l=b([]),C=b(!1),w=b(!1),M=b(!1),z=b(null),j=b(!1),R=b(!1),H=b([]),T=b([]),Te=S(()=>n.value?!0:d.value?.isValid),pe=S(()=>n.value?E.value?.isValid:m.value?.isValid&&Te.value),Ue=S(()=>n.value?F.value?.isValid:k.value?.isValid),vt=S(()=>A.value?pe.value&&Ue.value:pe.value),be=S(()=>t.value?.delivery_methods?.find(s=>s.delivery_method.id===t.value.delivery_method)),ge=S(()=>be.value?["Parcel locker","Pickup point"].includes(be.value.delivery_method.type)?t.value.parcel_locker!==null:!0:!1),Ne=S(()=>vt.value&&j.value&&C.value&&ge.value),J=S(()=>t.value?.payment_methods?.find(s=>s.id===t.value.payment_method)),qe=S(()=>t.value?.terms_of_conditions?t.value?.terms_of_conditions.filter(s=>s.purpose!="Newsletter"):[]),ht=S(()=>t.value?.terms_of_conditions?t.value?.terms_of_conditions.filter(s=>s.purpose==="Newsletter"):[]),Ke=S(()=>w.value&&pe.value&&!M.value),_t=S(()=>f.value?J.value?f.value.id===J.value.id&&f.value.module===J.value.module&&f.value.method===J.value.method:!1:!0),kt=()=>{(!t.value||!t.value?.lines||t.value?.lines?.length===0)&&Ze("/")},Re=()=>{parseFloat(t.value?.total_cost)<=0&&Ze("/cart")},bt=s=>{let g=null;if(s!==null){const{code:q,country_code:Y,type:te,name:X}=s||{},ye=(X||"").split(","),Ae=(ye[0]||"").trim(),ve=(ye[1]||"").trim(),he=ve?ve.split(" "):[],Ee=he[0]||"",Me=he.slice(1).join(" ")||"",Be=Ae||"";g={name:q,country:Y||t.value?.country_delivery,city:Me,type:te,postcode:Ee,street:Be}}ee({parcel_locker:g})},gt=async s=>{const{data:g,error:q}=await le("/address",{method:"POST",body:s});if(q.value){const Y=q.value.data?.message?q.value.data.message:q.value.data?.detail;et("error",[{text:Y}]);return}await we(g.value.id)},wt=async()=>{const{data:s}=await le("/address");s&&(H.value=s.value)},xt=s=>({first_name:s.first_name,last_name:s.last_name,street:s.street,building:s.building,apartment:s.apartment,postcode:s.postcode,city:s.city,country:s.country,phone:s.phone,email:s.email}),we=s=>{ee({address_delivery:s})};function Ct(s,g){return s?.country!==g.country||s?.postcode!==g.postcode&&h}const Ge=b(null),He=S(()=>Ge.value||t.value?.address_delivery_data),xe=async(s,g=null)=>{Ge.value=s;const q=g!=null,Y=Ct(t.value.address_delivery_data,s);g||(g=t.value.address_delivery);const{data:te,error:X}=await le(`/address/change/${g}`,{method:"POST",body:xt(s)},!1);if(!X.value){const ce=te.value.id;q||g!==ce?await we(ce):Y&&await v()}},St=async s=>{const g={...He.value||{}};g.email=s?.email||"",await xe(g)},$t=async(s={})=>{const g={...s||{}};g.email=He.value?.email,await xe(g)},Pt=async s=>{const{data:g,error:q}=await le("/invoice_data",{method:"POST",body:s});if(q.value){const Y=q.value.data?.message?q.value.data.message:q.value.data?.detail;et("error",[{text:Y}]);return}await Ce(g.value.id)},Vt=async()=>{const{data:s}=await le("/invoice_data");s&&(T.value=s.value)},Ce=s=>{ee({invoice_data:s})},We=async(s,g=null)=>{const q=g!=null;g||(g=t.value.invoice_data);const{data:Y,error:te}=await le(`/invoice_data/change/${t.value.invoice_data}`,{method:"POST",body:s},!1);if(!te.value){const X=Y.value.id;(q||g!==X)&&await Ce(X)}},me=b({}),Ft=ot(async()=>
6{if(!D.value)return;const s=me.value;me.value={},await p(s),Se()},120),ee=s=>{me.value={...me.value,...s},Ft()},It=async()=>{await i(),Se()},Se=()=>{Re()},G=Ut({selectedTerms:l,selectedPaymentMethod:J,extraPaymentData:I,invoicePurchase:A,refreshData:Se}),At=S(()=>G.isLoading.value),$e=S(()=>{const s=J.value;return s?s.checkout_payment&&s.module==="Przelewy24"&&s.method==="blik_lvl0":!1}),Et=s=>{const g={delivery_method:s.delivery_method.id};["Parcel locker","Pickup point"].includes(s.delivery_method.type)||(g.parcel_locker=null),ee(g),ze("add_shipping_info",t.value,{deliveryMethodId:s.delivery_method.id})},Mt=s=>{f.value=s,ee({payment_method:s.id}),ze("add_payment_info",t.value,{paymentMethodId:s.id})},Pe=s=>{I.value=s},Bt=async()=>{if(R.value=!0,!pe.value){n.value||(Oe("addressForm"),Oe("contactForm")),Te.value?document.getElementById("address-data").scrollIntoView():document.getElementById("contact-data").scrollIntoView();return}if(A.value&&!Ue.value){Oe("invoiceForm"),document.getElementById("invoiceForm").scrollIntoView();return}if(!ge.value){document.getElementById("deliveryForm").scrollIntoView();return}if(!j.value){const s=document.getElementById("summarySentinel");if($e.value&&s){s.scrollIntoView();return}document.getElementById("paymentForm").scrollIntoView();return}if(!C.value){document.getElementById("termsForm").scrollIntoView();return}};N(A,()=>{A.value||(c.value="none")}),N(A,()=>ee({invoice_purchase:A.value})),N(L,()=>ee({carry_in_service:L.value})),N(t,()=>{t.value?.carry_in_cost<=0&&(L.value=!1),t.value?.payment_method===null&&(f.value=null)}),N(Ke,async()=>{if(Ke.value){const s=JSON.stringify({email:d.value?.contact.email,campaign:{type:"Newsletter"}});await ro("/campaign/subscribe",{method:"POST",body:s},{}),M.value=!0}});const Ye=b(null),Je=b(null),Ve=fo("(max-width: 1024px)",{}),fe=b(!1),Qe=b(!1),Xe=b(!0),Fe=b(!1),Ie=ot(()=>{fe.value=Ve.value&&Xe.value&&Qe.value&&!Fe.value},80);return N(Fe,s=>{s&&Ve.value?fe.value=!1:Ie()}),N(Ve,s=>{s?Ie():fe.value=!1},{immediate:!0}),[$,u]=oo(()=>i()),await $,u(),kt(),Re(),ne(async()=>{await de(),bo("page_view"),ze("begin_checkout",t.value,{}),L.value=t.value.carry_in_service,z.value=t.value.delivery_countries,t.value.invoice_purchase&&(A.value=!0,c.value=t.value.invoice_data_data.company?"company":"personal"),await de(),D.value=!0,tt(Ye,([s])=>{Qe.value=!s.isIntersecting,Xe.value=s.boundingClientRect.top>0,Ie()},{threshold:0,rootMargin:"0px 0px -120px 0px"}),tt(Je,([s])=>{Fe.value=s.isIntersecting},{threshold:0,rootMargin:"400px 0px 0px 0px"})}),ao(()=>{e(k),e(c),e(D),e(A),e(L),e(I),e(z)}),no({title:`${y("global.Order")}`,htmlAttrs:{lang:"pl"},script:[{src:"https://furgonetka.pl/js/dist/map/map.js",body:!0,async:!0,defer:!0}]}),(s,g)=>{const q=jt,Y=Nt,te=xo,X=zo,ce=uo,ye=po,Ae=ia,ve=La,he=lo,Ee=st,Me=Ra,Be=Qa,Ot=sn,zt=_o,Lt=yn,Dt=wn;return r(),x("div",xn,[e(At)?(r(),O(q,{key:0})):e(t)?(r(),x("div",Cn,[a("h2",Sn,P(s.$t("global.Checkout")),1),a("div",$n,[a("div",Pn,[B(Y),a("div",Vn,[a("div",Fn,[a("h3",null,P(s.$t("checkout.Contact_details")),1),B(te,{ref_key:"contactForm",ref:d,contactData:e(t)?.address_delivery_data,newsletterTerms:e(ht),onUpdateContact:St,onNewsletterChecked:g[0]||(g[0]=U=>w.value=U)},null,8,["contactData","newsletterTerms"])]),a("div",In,[a("h3",null,P(s.$t("checkout.Customers_data")),1),e(n)?(r(),O(X,{key:0,ref_key:"addressSelector",ref:E,address:e(t).address_delivery_data,availableAddresses:e(H),countries:e(z),onAddressAdded:gt,onEditAddress:xe,onAddressSelected:we,onGetAddresses:wt},null,8,["address","availableAddresses","countries"])):V("",!0),e(n)?V("",!0):(r(),O(ce,{key:1,ref_key:"addressForm",ref:m,addressData:e(t)?.address_delivery_data,countries:e(z),onUpdateAddress:$t},null,8,["addressData","countries"])),a("label",{class:Z(["term-checkbox",e(J)?.disallow_second_address?"cursor-not-allowed opacity-50":"cursor-pointer"])},[je(a("input",{type:"checkbox","onUpdate:modelValue":g[1]||(g[1]=U=>Le(A)?A.value=U:null),disabled:e(J)?.disallow_second_address,class:"w-5 h-5 rounded border border-neutral-500 text-success-success-500 <!-- green fill when checked -->
6 focus:ring-0 focus:outline-none disabled:border-neutral-300 disabled:bg-neutral-200"},null,8,An),[[so,e(A)]]),a("span",null,P(s.$t("checkout.Different_invoice_details_heading"))+" ("+P(s.$t("checkout.Optional"))+") ",1),e(J)?.disallow_second_address?(r(),x("div",En,P(s.$t("checkout.These_option_is_not_allowed_for_selected_payment_method")),1)):V("",!0)],2),e(A)?(r(),x("div",Mn,[e(n)?(r(),O(X,{key:0,ref_key:"invoiceSelector",ref:F,address:e(t).invoice_data_data,availableAddresses:e(T),countries:e(z),type:"invoice",onAddressAdded:Pt,onEditAddress:We,onAddressSelected:Ce,onGetAddresses:Vt},null,8,["address","availableAddresses","countries"])):(r(),O(ye,{key:1,ref_key:"invoiceForm",ref:k,invoiceData:e(t)?.invoice_data_data,countries:e(z),onUpdateInvoice:We,onRefreshCart:It},null,8,["invoiceData","countries"]))])):V("",!0)]),B(he,null,{default:Q(()=>[B(Ae,{options:e(t).delivery_methods,selectedOptionId:e(t).delivery_method,selectedParcelLocker:e(t).parcel_locker,countryDelivery:e(t).country_delivery,address:e(t).address_delivery_data,isFormValid:e(ge),raiseValidation:e(R),onSelect:Et,onSelectParcelLocker:bt},null,8,["options","selectedOptionId","selectedParcelLocker","countryDelivery","address","isFormValid","raiseValidation"]),B(ve,{options:e(t).payment_methods,selectedOptionId:e(t).payment_method,checkout:e(G),currency:e(t).currency_code,token:e(t).token,checkoutValid:e(Ne),raiseValidation:e(R)&&!e($e),onSelect:Mt,onValidChange:g[2]||(g[2]=U=>j.value=U),onUpdateExtraFields:Pe,onTokenizationStarted:g[3]||(g[3]=()=>e(G).tokenizationStarted()),onTokenizationFinished:g[4]||(g[4]=U=>e(G).tokenizationFinished(U))},null,8,["options","selectedOptionId","checkout","currency","token","checkoutValid","raiseValidation"])]),_:1}),a("section",Bn,[a("h3",null,P(s.$t("checkout.Consents")),1),e(qe)?(r(),O(Ee,{key:0,modelValue:e(l),"onUpdate:modelValue":g[5]||(g[5]=U=>Le(l)?l.value=U:null),terms:e(qe),id:"termsForm",raiseValidation:e(R),onAllRequiredChecked:g[6]||(g[6]=U=>C.value=U),class:"w-full rounded-content-box-narrow"},null,8,["modelValue","terms","raiseValidation"])):V("",!0)]),B(Me)])]),a("div",On,[a("div",zn,[a("div",Ln,[a("div",Dn,[Object.keys(e(t)).length>0?(r(),O(Ot,{key:0,cart:e(t),selectedPaymentMethod:e(f)||e(J),selectedDeliveryMethod:e(be),checkout:e(G),isFormValidated:!!e(Ne),showLoader:e(G).submitButtonShowLoader,showStickySummary:e(fe),onValidateAll:Bt,onValidChange:g[8]||(g[8]=U=>j.value=U),onUpdateExtraFields:Pe},{paymentMethods:Q(()=>[e(_t)?(r(),O(Be,{key:0,raiseValidation:e(R),onUpdateFields:Pe,onValidChange:g[7]||(g[7]=U=>j.value=U),isBlikMethod:e($e)},null,8,["raiseValidation","isBlikMethod"])):V("",!0)]),_:1},8,["cart","selectedPaymentMethod","selectedDeliveryMethod","checkout","isFormValidated","showLoader","showStickySummary"])):V("",!0)],512),B(zt,{appliedDiscountCodes:e(t).discount_codes},null,8,["appliedDiscountCodes"]),a("div",{id:"summarySentinel",ref_key:"summarySentinel",ref:Ye,"aria-hidden":"true",class:"h-px order-first lg:hidden"},null,512)])])])]),a("div",{ref_key:"footerSentinel",ref:Je,"aria-hidden":"true",class:"h-px"},null,512)])):V("",!0),B(Lt,{show:e(G).isPaymentPopupVisible,"onUpdate:show":[g[9]||(g[9]=U=>e(G).isPaymentPopupVisible=U),g[10]||(g[10]=U=>{U||e(G).dismissPaymentPopup()})],status:e(G).paymentErrorStatus,errorDisplay:e(G).paymentErrorDisplay},null,8,["show","status","errorDisplay"]),B(Dt,{show:e(G).isPaymentScriptPopupVisible,"onUpdate:show":g[11]||(g[11]=U=>e(G).isPaymentScriptPopupVisible=U),token:e(G).paymentScriptToken},null,8,["show","token"])])}}};export{os as default};
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.