import{F as O,m,r as W,l as $,P as d,_ as p,R as s,a1 as w,S as T,T as e,Q as l,W as o,X as u,a0 as n,a9 as z,a2 as v,Z as A,a6 as E,a7 as Q,e as i}from"./vendor-DYYUXsKb.js";import{bm as R,b6 as X,bL as Z,d as q}from"./index-BjgfEvRF.js";import{u as G}from"./useSaveForLater-C5rBLxnB.js";import{u as H}from"./useCheckout-07KxsLTC.js";/* empty css                                                                      */const J={class:"relative"},K={class:"mb-4 flex justify-between text-base font-black"},M={class:"border-y py-2 text-base font-normal"},U={class:"flex justify-between"},Y={key:0},tt={class:"list-disc pl-5 text-neutral-400 print:text-[color:var(--color-additional-950)]"},et={class:"flex items-center justify-between"},at={class:"text-sm"},st={key:0},nt={class:"flex items-center justify-between"},ot={class:"text-sm"},lt={key:1},ct={class:"flex items-center justify-between"},ut={class:"text-sm"},it={class:"flex justify-between"},rt={key:1,class:"flex justify-between"},mt={class:"mt-4 flex justify-between text-base font-black"},dt={class:"text-[--price-color] print:text-inherit"},pt={key:0,class:"mt-4 text-xs font-normal text-neutral-400"},vt=O({__name:"order-summary",props:{cart:{},selectedItems:{},noShipping:{type:Boolean},footnote:{type:Boolean}},setup(a){const c=a,{currentLanguage:f}=R(),{currentCurrency:b}=Z(),{changing:D}=X(),{changing:j}=H(),{loading:L}=G(),B=m(()=>D.value||j.value||L.value),h=W(!0),g=m(()=>$.sumBy(c.selectedItems??c.cart.items,t=>t.discountTotal?.amount??0)),C=m(()=>"shippingPrice"in c.cart?c.cart.shippingPrice:c.cart.shippingSubTotal),_=m(()=>$.sumBy(c.cart.shipments,t=>t.discountAmount?.amount)),x=m(()=>c.cart.discounts?.length||g.value>0||_.value>0);function S(t){return typeof t?.amount=="object"&&t?.amount!==null?t?.amount.amount:t?.amount}return(t,V)=>{const N=d("VcLoaderOverlay"),r=d("VcPriceDisplay"),I=d("VcIcon"),k=d("VcTotalDisplay"),P=d("VcWidget");return s(),p(P,{id:"order-summary",class:"max-md:mt-5 print:break-inside-avoid",title:t.$t("common.titles.order_summary"),"data-test-id":"order-summary-widget"},{default:w(()=>[T(t.$slots,"header",{},void 0,!0),e("div",J,[u(N,{visible:B.value},null,8,["visible"]),e("div",K,[e("span",null,n(t.$t("common.labels.subtotal")),1),e("span",null,[u(r,{value:a.cart.subTotal,"data-test-id":"cart-subtotal-label"},null,8,["value"])])]),e("div",M,[e("div",U,[(s(),p(z(x.value?"button":"span"),{class:"flex appearance-none items-center",onClick:V[0]||(V[0]=y=>h.value=!h.value)},{default:w(()=>[v(n(t.$t("common.labels.discount"))+" ",1),x.value?(s(),p(I,{key:0,class:"ml-1 fill-primary print:hidden",name:h.value?"chevron-down":"chevron-up",size:"xs"},null,8,["name"])):o("",!0)]),_:1})),a.cart.discountTotal?(s(),l("span",Y,[v(n(a.cart.discountTotal?.amount>0?"-":"")+" ",1),u(r,{value:a.cart.discountTotal,"data-test-id":"cart-discount-total-label"},null,8,["value"])])):o("",!0)]),x.value?(s(),l("div",{key:0,class:A(["print:block",{hidden:h.value}])},[e("ul",tt,[(s(!0),l(E,null,Q(a.cart.discounts,(y,F)=>(s(),l("li",{key:F},[e("div",et,[e("span",at,n(y.description||y.coupon),1),u(k,{amount:-S(y),"currency-code":i(b).code,"culture-name":i(f).cultureName},null,8,["amount","currency-code","culture-name"])])]))),128)),g.value>0?(s(),l("li",st,[e("div",nt,[e("span",ot,n(t.$t("common.labels.line_items")),1),u(k,{amount:-g.value,"currency-code":i(b).code,"culture-name":i(f).cultureName},null,8,["amount","currency-code","culture-name"])])])):o("",!0),_.value>0?(s(),l("li",lt,[e("div",ct,[e("span",ut,n(t.$t("common.labels.shipping")),1),u(k,{amount:-_.value,"currency-code":i(b).code,"culture-name":i(f).cultureName},null,8,["amount","currency-code","culture-name"])])])):o("",!0)])],2)):o("",!0),e("div",it,[e("span",null,n(t.$t("common.labels.tax")),1),e("span",null,[v(n(a.cart.taxTotal?.amount>0?"+":"")+" ",1),a.cart.taxTotal?(s(),p(r,{key:0,value:a.cart.taxTotal,"data-test-id":"cart-tax-total-label"},null,8,["value"])):o("",!0)])]),a.noShipping?o("",!0):(s(),l("div",rt,[e("span",null,n(t.$t("common.labels.shipping_cost")),1),e("span",null,[v(n(C.value?.amount>0?"+":"")+" ",1),u(r,{value:C.value,"data-test-id":"cart-shipping-total-label"},null,8,["value"])])]))]),e("div",mt,[e("span",null,n(t.$t("common.labels.total")),1),e("span",dt,[a.cart.total?(s(),p(r,{key:0,value:a.cart.total,"data-test-id":"cart-total-label"},null,8,["value"])):o("",!0)])])]),T(t.$slots,"footer",{},void 0,!0),a.footnote?(s(),l("div",pt,[T(t.$slots,"footnote",{},()=>[v(n(t.$t("common.messages.checkout_pricing_warning")),1)],!0)])):o("",!0)]),_:3},8,["title"])}}}),_t=q(vt,[["__scopeId","data-v-2281df6f"]]);export{_t as O};
//# sourceMappingURL=order-summary-BYk5d0To.js.map
