1import{u as K,n as $,s as z,bp as se,bq as oe,br as le,bs as ue,bt as j,bu as ce,bv as q,bw as pe,bx as F,by as E,bz as U,bA as de,bB as fe,bC as H,bD as ge,$ as ve,bE as he,d as me,bF as Q,a as ye,bm as be,i as _e,c as Se,Q as Te,E as xe}from"./Cy0oRjCk.js";import{q as i,c as we,n as J,ab as X,A as Z,W as M,a1 as V,k as A,V as P,a8 as I,L as N,Y as R,aa as C,a7 as ee,C as k,a0 as te,u as h,N as ne,v as De,m as Pe,a9 as Be,a6 as L}from"./gu3xCS1W.js";import Ce from"./Bc6GCvDm.js";const Ie={"de-DE":"de-DE","de-AT":"de-at","de-CH":"de-ch","fr-CH":"fr-ch","fr-FR":"fr-FR","fr-BE":"fr-be","nl-BE":"nl-be","nl-NL":"nl-NL"},W="shared/attributes/shipping-cost-mapping";function Oe(n){return n?oe.reduce((t,a)=>{const e=n[a];return typeof e=="string"&&e.trim()&&(t[a]=le(e)),t},{}):{}}async function We(){const{localeProperties:n}=K(),{fetchBySlug:t}=$("shipping-cost-mapping"),a=z(),e=Ie[a.value.locale]??n.value.storyblokLang??a.value.locale,s=`${n.value.storyblokLang}/${W}`,l=await t(W,{language:e}),o=l.data.value?.data?.story==null?await t(s,{language:e}):null,u=i(()=>l.data.value??o?.data.value),d=i(()=>l.status.value==="pending"||o&&l.data.value?.data?.story==null&&o.status.value==="pending"?"pending":"success"),f=i(()=>Oe(u.value?.data?.story?.content)),g=i(()=>d.value==="pending"),p=i(()=>d.value!=="pending"),m=i(()=>p.value&&se(f.value)),S=i(()=>p.value&&!m.value);return{priceMap:f,isShippingMapReady:p,isShippingMapLoading:g,hasShippingPriceMap:m,isShippingMapUnavailable:S}}function Y(n,t){const a=E(t);if(F(a))return;const e=U(a);e&&n.add(e)}function Ae(n){const t=new Set;for(const a of q(n)){const e=E(a.variant);if(F(e))continue;const s=U(e);s&&t.add(s)}return t}function ae(n,t={}){const a=G(n,t);if(a.length>0){if(j(a))return new Set;const s=Ae(a);return t.previewVariant&&Y(s,t.previewVariant),s}if(!t.previewVariant)return new Set;const e=new Set;return Y(e,t.previewVariant),e}function Ve(n){return q(n).some(t=>!pe(t,n)&&F(E(t.variant)))}function re(n,t,a=!0){if(!a||!n)return 0;const e=E(n);if(F(e))return 0;const s=U(e);if(!s)return 0;const l=t[s];return l!=null&&l>=0?l:0}function Ye(n,t,a){return{...n,shippingDisplayTotal:re(n,t,a)}}function Le(n){if(!n||!("shippingDisplayTotal"in n))return;const t=n.shippingDisplayTotal;return typeof t=="number"?t:void 0}function G(n,t){return t.includeBasket===!1?[]:n}function Ke(n,t,a={}){if(!a.mapReady)return null;const e=G(n,a),s=ae(e,a);return ue(s,t)}function $e(n,t,a={}){if(!a.mapReady)return 0;const e=G(n,a);if(e.length>0){if(j(e)||Ve(e)&&!a.previewVariant)return 0;const l=ae(e,a);return ce(l,t)}const s=Le(a.previewVariant);return s!==void 0?s:re(a.previewVariant,t,a.mapReady)}function je(n,t={}){const a=t.fetchOriginal!==!1,e=i(()=>we(n)),s=z(),l=i(()=>s.value?.locale??"de-DE"),o=i(()=>e.value?he(e.value):null),u=i(()=>!!o.value),d=i(()=>o.value?o.value.masterBargainInfo?.offline===!0||o.value.variantBargainInfo?.offline===!0:!1),f=i(()=>u.value&&!d.value),g=i(()=>u.value&&d.value),p=i(()=>fe(o.value)),m=i(()=>!a||!p.value?!1:H(o.value,l.value)==null),{useProduct:S}=de(),{data:y}=S(p,m),T=i(()=>_(e.value)),x=i(()=>e.value?(e.value?.variants??[]).reduce((c,v)=>c+(v.stock?.quantity??0),0):0),w=i(()=>u.value&&((ve(y.value?.attributes,"productOdooId")?.value??null)||o.value?.masterBargainInfo?.originalProductMasterArticleNumber)||null),B=i(()=>{const r=H(o.value,l.value);return r??ge(y.value,p.value)}),D=i(()=>T.value?.length?T.value:_(y.value));function _(r){if(!r)return null;const c=me(r,"masterUniqueSellingPropositions");if(typeof c=="string"&&c.trim().length>0){const v=c.split(/[;\n]/).map(b=>b.trim()).filter(Boolean);return v.length>0?v:null}return null}return{bargainData:o,isBargain:u,isOnlineBargain:f,isPickupBargain:g,isOffline:d,originalMasterArticleNumber:w,originalVariantReferenceKey:p,originalVariantPrice:B,middlewareUSPs:D,bargainStockQuantity:x}}const ke={class:"flex flex-col gap-4"},Fe={class:"text-5xl font-heading font-bold text-salesred leading-[120%]"},Ee={class:"text-salesred"},Ne=J({__name:"TieredDiscountOverlay",props:{defaultOpen:{type:Boolean,default:!1}},emits:["close"],async setup(n,{expose:t,emit:a}){let e,s;const{tiers:l,eligibleCategories:o}=Q(),{t:u}=K(),{formatCurrency:d}=ye(),f=z(),{fetchBySlug:g}=$("tiered-discount-overlay"),m={"de-DE":"de-DE","de-AT":"de-at","de-CH":"de-ch","fr-CH":"fr-ch","fr-FR":"fr-FR","fr-BE":"fr-be","nl-BE":"nl-be","nl-NL":"nl-NL"}[f.value.locale]??f.value.locale,{data:S}=([e,s]=X(()=>g("shared/promotions/tiered-discount-overlay",{language:m})),e=await e,s(),e),y=i(()=>S.value?.data?.story?.content),T=i(()=>o.value.map(({name:_})=>_).join(", ")),x=A(null),w=n,B=a,D=_=>{x.value?.toggle?.(_)};return Z(()=>{w.defaultOpen&&D(!0)}),t({toggle:D}),(_,r)=>{const c=_e,v=be,b=Se,ie=Ce;return P(),M(ie,{id:"tiered-discount-overlay",type:"overlay",classes:"tiered-discount-overlay","z-index":140,"background-z-index":139,ref_key:"overlayRef",ref:x,"default-open":w.defaultOpen,onClose:r[0]||(r[0]=O=>B("close",O))},{default:V(()=>[I("div",ke,[N(c,{intent:"h2",tag:"h4"},{default:V(()=>[R(C(y.value?.headline),1)]),_:1}),y.value?.text?(P(),M(v,{key:0,"rich-text":y.value.text},null,8,["rich-text"])):ee("",!0),(P(!0),k(ne,null,te(h(l),O=>(P(),k("div",{key:O.mov,class:"flex justify-start items-center gap-4 py-4 px-6 rounded-[10px] bg-light-grey focus:rounded-[10px]"},[I("div",Fe,C(O.effectPercent)+"% ",1),N(b,null,{default:V(()=>[R(C(h(u)("global.promotion.tieredDiscount.overlay_basket_value"))+" ",1),I("strong",Ee,C(h(d)(O.mov)),1)]),_:2},1024)]))),128)),N(b,{intent:"sm"},{default:V(()=>[R(C(h(u)("global.promotion.tieredDiscount.overlay_categories"))+" "+C(T.value),1)]),_:1})])]),_:1},8,["default-open"])}}}),qe=Object.assign(Ne,{__name:"TieredDiscountOverlay"}),Re=1e3,Me=1200,ze=J({__name:"TieredDiscountProgress",props:{theme:{},position:{}},async setup(n){let t,a;const{currentTierIndex:e}=([t,a]=X(()=>Q()),t=await t,a(),t),s={0:"20%",1:"33%",2:"66%",3:"100%"},l=A(null),o=A("0%"),u=A(!1),d=A(!1);let f,g,p=!0,m;const S=Te("",{variants:{currentTierIndex:{0:"left-[calc(5%-5px)]",1:"left-[calc(33%-5px)]",2:"left-[calc(66%-5px)]",3:"left-[calc(100%-13px)]"}},defaultVariants:{currentTierIndex:1}}),y=[{tier:0,positionClass:"left-[calc(5%-5px)]"},{tier:1,positionClass:"left-[calc(33%-5px)]"},{tier:2,positionClass:"left-[calc(66%-5px)]"},{tier:3,positionClass:"left-[calc(100%-13px)]"}],T=i(()=>y.length-1);console.log("lastTierIndex",T.value);const x=()=>{f&&(clearTimeout(f),f=void 0),g&&(clearTimeout(g),g=void 0)},w=()=>
1{x(),u.value=!1,o.value="0%"},B=r=>{if(g&&clearTimeout(g),r<=0){u.value=!1;return}g=setTimeout(()=>{u.value=!0},Me)},D=r=>{w();const c=s[r]??"0%";f=setTimeout(()=>{o.value=c,B(r)},Re)},_=r=>{u.value=!1;const c=s[r]??"0%";o.value=c,B(r)};return De(e,r=>{d.value&&_(r)}),Z(()=>{const r=l.value;if(!r||typeof IntersectionObserver>"u"){d.value=!0,D(e.value);return}m=new IntersectionObserver(([c])=>{const v=!!c?.isIntersecting;if(d.value=v,v&&p){p=!1,D(e.value);return}v||(p=!0,w())},{threshold:.05}),m.observe(r)}),Pe(()=>{m?.disconnect(),x()}),(r,c)=>{const v=xe;return P(),k("div",{ref_key:"rootEl",ref:l,class:L([[n.position==="header"?"grow sm:grow-0 basis-1/2 lg:basis-1/3 bg-white/50":"grow basis-1/2 bg-white"],"relative h-1 rounded-full outline outline-1 outline-salesred"])},[I("div",{class:L([[n.position==="header"?"bg-white":"bg-salesred"],"absolute top-0 left-0 h-1 rounded-full transition-[width] duration-[1200ms] ease-out"]),style:Be({width:h(o)})},null,6),(P(),k(ne,null,te(y,b=>I("span",{id:"tiered-discount-progress-marker",key:b.tier,class:L([[b.positionClass,b.tier===0?"hidden":"",n.position==="header"?"outline outline-1 outline-white bg-white":"outline outline-1 outline-salesred bg-salesred",{[h(e)>=b.tier?"":n.position==="header"?"bg-white outline outline-1 outline-white":"bg-white outline outline-1 outline-salesred"]:!0},b.tier===h(T)?"bg-white":""],"absolute w-[16px] h-[16px] -top-[7px] rounded-full transition-opacity duration-300"])},null,2)),64)),I("span",{id:"tiered-discount-progress-icon",class:L([[h(S)({currentTierIndex:h(e)}),h(u)?"opacity-100 scale-100":"opacity-0 scale-50",n.position==="header"?"bg-white text-salesred":"bg-salesred text-white"],"absolute -top-[7px] rounded-full z-10 transition-all duration-300 ease-out"])},[h(e)>0?(P(),M(v,{key:0,name:"ic_percent_borderless",size:"2xs"})):ee("",!0)],2)],2)}}}),Qe=Object.assign(ze,{__name:"TieredDiscountProgress"});export{qe as T,$e as a,je as b,Ke as c,Qe as d,Ye as e,We as u};
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.