1import{d as pe,a as Te,u as Ne,_ as we}from"./igncWrcQ.js";import{_ as Pe}from"./CIOySjh7.js";import{_ as He}from"./3ywocsYU.js";import{a as Ue,u as xe,_ as Ve}from"./DXin4JMg.js";import{d as K,af as re,O as Z,B as b,o as Le,b as p,e as S,f,k as e,E as C,y as ae,C as w,m as x,x as g,t as k,w as A,bp as he,D as y,bO as U,b0 as me,bS as _e,V as ke,T as Be,bT as Ke,H as P,bU as je,bi as Ce,u as de,bV as Ge,as as be,bW as Re,bX as qe,a3 as ze,N as Ye,I as Ae,bb as We,bF as Je,M as Xe,a as Ze,br as Qe,ac as et,a4 as tt,bY as st,P as ot,n as at,F as ie,r as nt,bc as rt,bz as it,a7 as dt,a5 as lt,aj as ct,a6 as Ie,Z as ut,$ as pt,bA as ht,ag as mt,ai as _t}from"./CYRhJ6we.js";import{_ as gt}from"./BFPyQAsd.js";import{m as ft,n as vt}from"./BFsw0r9c.js";import{u as St}from"./Ti2d-gtp.js";import{_ as yt}from"./Ds8iyCQl.js";import{t as kt}from"./D7WAQHSw.js";import{t as ge}from"./CcJh35uz.js";import{g as Ct,A as X}from"./D3egaY_B.js";import{g as fe,u as ve}from"./CXnXsFC1.js";import{a as bt}from"./Cfzd8IDF.js";import{u as At}from"./BY2sma6Z.js";import{u as It}from"./CdQgMPAD.js";import"./DnXUyRz1.js";import"./BThD7lvs.js";import"./3CzktXAw.js";const Dt={class:"checkout-address-book"},Mt=K({__name:"CheckoutAddressBook",props:{cartAddress:{type:Object,required:!0}},emits:["changeSelectedAddressId"],async setup(o,{emit:a}){let s,t;const r=o;[s,t]=re(()=>Ue({sync:!0})),await s,t();const{addresses:i,selectedBillingAddressId:d,selectedShippingAddressId:m,formData:n,formErrors:$,isLoading:l,onOpenModal:O,deleteAddress:j,updateAddressForm:G,setAddressForm:h,changeFormType:I,submitForm:V}=([s,t]=re(()=>xe({includeBillingAddress:!1,modalName:"checkout-address-book"})),s=await s,t(),s),T=async c=>{await j(c),ee()},Q=async c=>{await V(c),ee()},R=a,q=Z(),D=C(""),E=()=>{const c=r.cartAddress,F=i.value.find(v=>v.city===c.city&&v.country===c.country&&(v.gender===c.gender||v.gender==="UNKNOWN"&&!c.gender)&&v.company===(c.company||"")&&v.firstName===c.firstName&&v.lastName===c.lastName&&v.street===c.street&&v.houseNumber===c.houseNumber&&v.postCode===c.postCode)?.id||m.value||i.value[0]?.id||"";L(F)},L=c=>{const M=i.value.find(F=>c===F.id);if(!M){D.value="",R("changeSelectedAddressId",D.value);return}D.value=M.id||"",q.shippingAddress=M,R("changeSelectedAddressId",D.value)},ee=()=>{L(D.value)};return b(()=>r.cartAddress,()=>{E()},{immediate:!0,deep:!0}),b(()=>m.value,c=>{c&&L(c)}),Le(()=>{E()}),(c,M)=>{const F=Ve;return p(),S("div",Dt,[f(F,{addresses:e(i),"selected-shipping-address-id":e(m),"selected-billing-address-id":e(d),"form-data":e(n),"form-errors":e($),"is-loading":e(l),"selectable-address":!0,"selected-address-id":e(D),"show-billing-address":!1,"modal-name":"checkout-address-book","onModal:open":e(O),onDelete:T,"onF
1orm:change":e(G),"onForm:activate":e(h),"onForm:changeType":e(I),"onForm:submit":Q,onSelect:L},null,8,["addresses","selected-shipping-address-id","selected-billing-address-id","form-data","form-errors","is-loading","selected-address-id","onModal:open","onForm:change","onForm:activate","onForm:changeType"])])}}}),Ft=Object.assign(Mt,{__name:"CheckoutAddressBook"}),Ot=K({__name:"FormDeliveryInstructionsField",props:{formHandler:{type:Object,required:!0},value:{type:String,default:""}},setup(o){const{t:a}=ae(),s=x(()=>{const r=a("ih.checkoutSummaryForm.deliveryInstructions"),i=a("ih.request.dialog.request.optional.value");return`${r} ${i}`}),t=()=>[{test:r=>ft(r,255),error:a("ih.form.error.deliveryInstructions.maxLength",{length:255})},{test:r=>vt(r),error:a("ih.form.error.deliveryInstructions.invalidCharacters")}];return(r,i)=>{const d=gt;return p(),w(d,{"form-handler":o.formHandler,validation:t,label:e(s),"input-type":"textarea","show-icon":!1,class:"custom-textarea",placeholder:e(s)},null,8,["form-handler","label","placeholder"])}}}),Et=Object.assign(Ot,{__name:"FormDeliveryInstructionsField"}),$t={class:"checkout-shipping-methods"},Tt={class:"sr-only"},Nt={class:"checkout-shipping-methods__name"},wt={class:"checkout-shipping-methods__deliveryInstructions"},Pt={class:"checkout-shipping-methods__name"},Ht=K({__name:"CheckoutShippingMethods",props:{formHandler:{type:Object,required:!0},deliveryInstructionField:{type:Object,required:!0},shippingMethods:{type:Array,required:!0},modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(o,{emit:a}){const s=o,t=a,{t:r}=ae(),i=Z(),d=x(()=>s.shippingMethods.find(h=>h.shipperId===U.STANDARD_DELIVERY)),m=x(()=>s.shippingMethods.find(h=>h.shipperId===U.PICKUP_AT_DEALER)),n=C(s.modelValue);b(()=>s.modelValue,h=>{n.value=h}),b(n,h=>t("update:modelValue",h));const $=()=>[{test:h=>!!h,error:r("ih.form.error.required")}],{fieldState:l,localError:O,handleValidation:j,modelValue:G}=St(s.formHandler,$);return b(()=>s.formHandler.value,h=>{G.value=h,j()}),(h,I)=>{const V=Et;return p(),S("fieldset",$t,[g("legend",Tt,k(e(r)("ih.a11y.checkout.shipping-step.radio-selection.legend")),1),e(d)?(p(),w(e(_e),{key:0,modelValue:e(n),"onUpdate:modelValue":I[0]||(I[0]=T=>me(n)?n.value=T:null),value:e(U).STANDARD_DELIVERY,name:o.formHandler.fieldName,scheme:e(l),class:"checkout-shipping-methods__card--standard"},{content:A(()=>[he(h.$slots,"standardContent"),g("div",wt,[e(i).isActiveDeliveryInstructions?(p(),w(V,{key:0,"form-handler":o.deliveryInstructionField},null,8,["form-handler"])):y("",!0)])]),default:A(()=>[g("div",Nt,[g("span",null,k(e(pe)(e(d).name)),1)])]),_:3},8,["modelValue","value","name","scheme"])):y("",!0),e(m)?(p(),w(e(_e),{key:1,modelValue:e(n),"onUpdate:modelValue":I[1]||(I[1]=T=>me(n)?n.value=T:null),value:e(U).PICKUP_AT_DEALER,name:o.formHandler.fieldName,scheme:e(l),class:"checkout-shipping-methods__card--dealer"},{content:A(()=>[he(h.$slots,"dealerContent")]),default:A(()=>[g("div",Pt,[g("span",null,k(e(pe)(e(m).name)),1)])]),_:3},8,["modelValue","value","name","scheme"])):y("",!0),f(e(ke),{appear:"",name:"slide"},{default:A(()=>[e(l)==="invalid"&&e(O)?(p(),w(e(Be),{key:0,error:e(O)},null,8,["error"])):y("",!0)]),_:1})])}}}),Ut=Object.assign(Ht,{__name:"CheckoutShippingMethods"});function Se(o,a=!1){const s={value:{city:o.city,country:o.country?.toUpperCase()??"",firstname:o.firstName,lastname:o.lastName,number:o.houseNumber,phone:o.phone,postcode:o.postCode,street:o.street,isShop:a,isStation:!1,attributes:o.attributes||{}}};return o.state&&(s.value.attributes={state:o.state}),o.email&&(s.value.email=o.email),o.title&&(s.value.title=o.title),o.company&&(s.value.company=o.company),o.gender!==Ce.NOT_SPECIFIED&&(s.value.salutation=o.gender),o.addition&&(s.value.addition=o.addition),s}function ye(o,a,s,t,r,i){const d=[];if(t.method?.shipperId&&d.push({setShippingMethod:{value:{shipperId:t.method.shipperId}}}),t.isSameShippingAddress&&!i)d.push({resetShippingAddress:!0});else if(i){ge(i);const l=Se(i,!0);d.push({setShippingAddress:l})}else if(r){ge(r);const l=Se(r);d.push({setShippingAddress:l})}const{mutate:m,onDone:n,onError:$}=Ke({variables:{data:{cartId:o,ops:d}}});return $(l=>
1P.error("[%s] (%s) %o",new Date().toLocaleString(),"useAddShipping",l)),n(l=>{l.data?.cart_update?.__typename==="UpdateCartSuccess"&&l.data?.cart_update?.cart?s.cartTotals=je(l.data?.cart_update?.cart.promotionDetails):l.data?.cart_update?.__typename==="UpdateCartProblems"&&P.error("[%s] (%s) cart_update had problems during mutation for shipping",new Date().toLocaleString(),"useAddShipping",l.data?.cart_update.problems),a.shippingOptions=t,i?a.dealerAddress=i:t.isSameShippingAddress?a.shippingAddress=a.billingAddress:r&&(a.shippingAddress=r)}),{mutate:m,onDone:n,onError:$}}function xt(){const o=Z(),a=de(),s=C([]);async function t(){const{data:r,error:i}=await a.$apollo.default.query({query:Ge,variables:{cartId:a.$cartId.value},fetchPolicy:"no-cache"});if(i&&P.error("[%s] (%s) Check apollo logs to see what went wrong. Error: %s",new Date().toLocaleString(),"loadShippingMethods",i.message),r.shop_findCart?.availableShippingMethods){const d=r.shop_findCart.availableShippingMethods.map(Te).filter(be);s.value=d.length?d:[Re()]}else P.debug("[%s] (%s) Tried requesting availableShippingMethods but non were returned for cartId: %s",new Date().toLocaleString(),"loadShippingMethods",a.$cartId.value)}return b(s,r=>{o.availableShippingMethods=r}),{loadShippingMethods:t}}function Vt(){const o=Z(),a=de(),s=C(!1);async function t(){const{data:r,error:i}=await a.$apollo.default.query({query:qe});i?P.error("[%s] (%s) Check apollo logs to see what went wrong. Error: %s",new Date().toLocaleString(),"loadIsActiveDeliveryInstructions",i.message):r.shop_checkoutConfigurations?s.value=r.shop_checkoutConfigurations.activeDeliveryInstructions:P.debug("[%s] (%s) data.shop_checkoutConfigurations was empty",new Date().toLocaleString(),"loadIsActiveDeliveryInstructions")}return b(s,r=>{o.isActiveDeliveryInstructions=r}),{loadIsActiveDeliveryInstructions:t}}const Lt={class:"checkout-shipping-form"},Bt={class:"checkout-shipping-form__shipping-methods","aria-live":"polite"},Kt={class:"checkout-shipping-form__same-shipping-address-option"},jt={class:"sr-only"},Gt={class:"checkout-shipping-form__same-shipping-address"},Rt={key:0,class:"checkout-shipping-form__shipping-methods-dealer"},qt={class:"checkout-shipping-form__shipping-methods-dealer-address"},zt={class:"checkout-shipping-form__shipping-methods-dealer-address-label"},Yt={key:0},Wt={key:1},Jt={key:2},Xt={key:0,class:"checkout-shipping-form__shipping-methods-dealer-hours"},Zt={class:"checkout-shipping-form__opening-hours-days"},Qt={key:0},es=["textContent"],ts=K({__name:"CheckoutShippingForm",setup(o){const a=de(),{isAuthenticated:s}=ze(),t=Z(),r=Ye(),{t:i}=ae(),d=Ae(),m=We(),n=Je(),$=Xe(),l=Ze(),O=Qe().getIso3Country(l.currentMCS.country),{loadIsActiveDeliveryInstructions:j}=Vt(),{loadShippingMethods:G}=xt(),{loadCart:h}=et(),I=C(""),V=x(()=>m.preferredDealer??n.dealer??null),{groupedOpeningHours:T,openingHoursNote:Q}=At(V),{loadShippingOptions:R}=Ne(t,d,m,l.currentMCS.country);b(()=>n.dealer,()=>{R(a,l.currentMCS.country,O,t.shippingOptions.deliveryInstructions||"")},{immediate:!0}),b(()=>n.dealer,u=>{u&&R(a,l.currentMCS.country,O,t.shippingOptions.deliveryInstructions||"")},{immediate:!0});const{showToast:q}=tt(),D=st({...t.shippingAddress,country:O,gender:Ce.NOT_SPECIFIED});b(()=>t.shippingAddress,u=>Object.assign(D,u),{deep:!0});const E=C(t.shippingOptions.method?.shipperId??""),L=x(()=>E.value===U.PICKUP_AT_DEALER),ee=x(()=>L.value?i("ih.global.toCheckReservation"):i("ih.global.toPaymentMethods"));b(()=>t.shippingOptions.method?.shipperId,u=>{u&&(E.value=u)});const c=C(!1),M=C(""),F=C({}),v=C({validation:()=>!0,reset:()=>!0});function De(u){M.value=u}async function Me(u){E.value=u;const _=t.availableShippingMethods.find(W=>W.shipperId===u);if(!_)return;const B=u===U.PICKUP_AT_DEALER;B&&n.dealer&&(t.selectedDealer=n.dealer);const z=B&&n.dealer?fe(n.dealer,l.currentMCS.country):void 0;ve(_,d,t,m,l.currentMCS.country);const{mutate:se,onDone:Y}=ye(a.$cartId.value,t,d,{...t.shippingOptions,method:_},void 0,z);Y(()=>h()),await se()}function Fe(u){v.value={...u}}function Oe(u){t.shippingOptions={...t.shippingOptions,...JSON.parse(JSON.stringify(u))}}const le=C({}),te=C({validation:()=>!0,reset:()=>!0});function Ee(u){te.value={...u}}function $e(u){try{Object.assign(D,structuredClone(u))}
1catch(_){P.error("[%s] (%s) %o",new Date().toLocaleString(),"updateShippingAddress",_),q.error({description:"ih.global.error.general"})}I.value=""}async function ce(){l.isVwzBrand()&&l.isTrackingEnabled()&&it("Delivery",2);const u=t.availableShippingMethods.find(H=>H.shipperId===E.value);u&&ve(u,d,t,m,l.currentMCS.country);const _=E.value===U.PICKUP_AT_DEALER;_&&n.dealer&&(t.dealerAddress=fe(n.dealer,l.currentMCS.country));const B=s.value&&!_?M.value:te.value.validation(),z=_&&s.value||!_&&!s.value?te.value.validation():M.value;if(![v.value.validation(),...t.shippingOptions.isSameShippingAddress?[]:[B,z]].every(Boolean)){s.value&&!M.value&&q.error({description:"ih.checkout.shipping.warning.selectAddress"});return}F.value={},le.value={},c.value=!0;const Y=_&&t.dealerAddress?.city?t.dealerAddress:void 0,{mutate:W,onDone:oe,onError:N}=ye(a.$cartId.value,t,d,t.shippingOptions,D,Y);N(H=>{F.value.general=H?.message||"",c.value=!1}),oe(async H=>{if(H.data?.cart_update?.__typename==="UpdateCartProblems"){const J=H.data.cart_update.problems.map(ne=>ne?.message).filter(be).join("; ");J.startsWith("postcode with value")?I.value=J:q.error({description:"ih.global.error.general"}),F.value.general=J,c.value=!1,P.error("[%s] (%s) %o",new Date().toLocaleString(),"submitForm (useAddShipping)",H.data.cart_update.problems)}else{t.previouslyUsedShippingOptions=t.shippingOptions,t.shippingOptions.isSameShippingAddress||te.value.reset(),v.value.reset(),c.value=!1;const{url:J,hash:ne}=await Ct(s.value,t,O,a,i,!0);return dt({path:lt(J),hash:ne})}}),await W()}b(()=>t.goToNextStep,()=>{ce()});const ue=C(!1);return b(()=>d.cartItems,()=>{ue.value||(ue.value=!0,kt(1,Ie.CHECKOUT_SHIPPING),bt(pt.SHIPPING,ut.CHECKOUT_PAGE,$.selectedModel,r,l,d.cartItems,d.cartTotals,d.appliedVoucher,t.shippingOptions.method?.shipperId),l.isVwzBrand()&&l.isTrackingEnabled()&&ht("Delivery",2))}),ot(()=>{h(),j(),G()}),(u,_)=>{const B=He,z=Ft,se=Ut,Y=yt,W=ct;return p(),S("div",Lt,[f(Y,{name:"shipping","form-data":e(t).shippingOptions,"form-errors":e(F),onActivation:Fe,onChange:Oe},{fields:A(oe=>[g("div",Bt,[f(se,{"model-value":e(E),"form-handler":oe.formHandler("method"),"shipping-methods":e(t).availableShippingMethods,"delivery-instruction-field":oe.formHandler("deliveryInstructions"),"onUpdate:modelValue":Me},{standardContent:A(()=>[g("fieldset",Kt,[g("legend",jt,k(u.$t("ih.checkoutShippingForm.label")),1),g("div",Gt,[f(e(rt),{"model-value":e(t).shippingOptions.isSameShippingAddress,name:"isSameShippingAddress",label:e(i)("ih.checkoutShippingForm.sameAddress"),"onUpdate:modelValue":_[0]||(_[0]=N=>e(t).shippingOptions.isSameShippingAddress=N)},null,8,["model-value","label"])]),e(t).shippingOptions.isSameShippingAddress?y("",!0):(p(),S(ie,{key:0},[e(s)?y("",!0):(p(),w(B,{key:0,"form-data":e(D),"form-errors":e(le),"post-code-error-message":e(I),"is-country-disabled":"",onChange:$e,onActivation:Ee,"onPostcode:updated":_[1]||(_[1]=N=>I.value="")},null,8,["form-data","form-errors","post-code-error-message"])),e(s)?(p(),w(z,{key:1,"cart-address":e(t).shippingAddress,class:"checkout-shipping-form__address-book",onChangeSelectedAddressId:De},null,8,["cart-address"])):y("",!0)],64))])]),dealerContent:A(()=>[e(V)?(p(),S("div",Rt,[g("div",qt,[g("div",zt,k(e(i)("ih.checkoutDeliveryForm.dealerAddress")),1),e(n).dealer||e(t).dealerAddress.company?(p(),S("div",Yt,k(e(n).dealer?.name??e(n).dealer?.komName??e(t).dealerAddress.company),1)):y("",!0),e(n).dealer||e(t).dealerAddress.street?(p(),S("div",Wt,k(e(n).dealer?.street??e(t).dealerAddress.street),1)):y("",!0),e(n).dealer||e(t).dealerAddress.postCode?(p(),S("div",Jt,k(e(n).dealer?e(n).dealer.zipCode+" "+e(n).dealer.city:e(t).dealerAddress.postCode+" "+e(t).dealerAddress.city),1)):y("",!0)]),e(T).length?(p(),S("div",Xt,[g("strong",null,k(e(i)("ih.dealer.openingHours")),1),(p(!0),S(ie,null,nt(e(T),N=>(p(),S("p",{key:N.days,class:"checkout-shipping-form__opening-hours-row"},[g("span",Zt,k(N.days),1),g("span",null,k(N.time),1)]))),128)),e(Q)?(p(),S("p",Qt,k(e(Q)),1)):y("",!0)])):y("",!0)])):y("",!0)]),_:1},8,["model-value","form-handler","shipping-methods","delivery-instru
1ction-field"])])]),buttons:A(()=>[f(e(at),{type:"submit",disabled:e(c),onClick:ce},{default:A(()=>[g("span",{textContent:k(e(ee))},null,8,es)]),_:1},8,["disabled"])]),_:1},8,["form-data","form-errors"]),f(e(ke),{name:"fade"},{default:A(()=>[e(c)?(p(),w(W,{key:0,overlay:""})):y("",!0)]),_:1})])}}}),ss=Object.assign(ts,{__name:"CheckoutShippingForm"}),os=K({__name:"CheckoutShipping",setup(o){const a=Ae(),s=It();return(t,r)=>{const i=we,d=Pe,m=ss;return p(),S(ie,null,[f(d,{id:e(X).CHECKOUT_ADDRESS,headline:t.$t("ih.checkout.steps.address.headline"),number:1,"edit-url":e(Ie).CHECKOUT_ADDRESS},{default:A(()=>[f(i)]),_:1},8,["id","headline","edit-url"]),f(d,{id:e(X).CHECKOUT_SHIPPING,headline:t.$t(e(s)("ih.checkout.steps.shipping.headline")),number:2,active:""},{default:A(()=>[f(m)]),_:1},8,["id","headline"]),f(d,{id:e(X).CHECKOUT_PAYMENT,headline:t.$t("ih.checkout.steps.payment.headline"),number:3},null,8,["id","headline"]),f(d,{id:e(X).CHECKOUT_SUMMARY,headline:e(a).isPickup?t.$t("ih.checkout.steps.summary.headline.reservation"):t.$t("ih.checkout.steps.summary.headline"),number:4},null,8,["id","headline"]),f(d,{id:e(X).CHECKOUT_THANKYOU,headline:t.$t("ih.checkout.steps.ready.headline"),number:5},null,8,["id","headline"])],64)}}}),as=Object.assign(os,{__name:"CheckoutShipping"}),ns={class:"checkout__main"},Is=K({__name:"shipping",async setup(o){let a,s;const{t}=ae(),r=x(()=>({title:`${t("ih.checkout.steps.shipping.title",{storeName:t("ih.global.storeName")})}`,hreflang:[],metaTags:[]})),i=([a,s]=re(()=>_t()),a=await a,s(),a);return mt(r,i),(d,m)=>{const n=as;return p(),S("div",ns,[f(n)])}}});export{Is 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.