import{K as A,B as m,r as E,l as x,S as p,P as d,M as a,T as D,aw as V,U as t,L as l,a7 as n,V as r,W as s,R as F,X as v,aq as M,N as q,O as K,b as u}from"./vendor-bSWkQivH.js";import{ba as R,aj as U,aM as X,bb as G,e as H}from"./index-Dqv5IkpS.js";const J={class:"relative"},Q={class:"mb-4 flex justify-between text-base font-black"},Y={class:"border-y py-2 text-base font-normal"},Z={class:"flex justify-between"},ee={key:0},te={class:"list-disc pl-5 text-neutral-400 print:text-[color:var(--color-additional-950)]"},ae={class:"flex items-center justify-between"},se={class:"text-sm"},ne={key:0},oe={class:"flex items-center justify-between"},le={class:"text-sm"},ce={key:1},re={class:"flex items-center justify-between"},ue={class:"text-sm"},ie={class:"flex justify-between"},me={key:1,class:"flex justify-between"},pe={class:"mt-4 flex justify-between text-base font-black"},de={class:"text-[--price-color] print:text-inherit"},ve={key:0,class:"mt-4 text-xs font-normal text-neutral-400"},he=A({__name:"order-summary",props:{cart:{},selectedItems:{},noShipping:{type:Boolean},footnote:{type:Boolean}},setup(B){const c=B,{currentLanguage:_}=R(),{currentCurrency:f}=G(),{changing:N}=U(),{changing:S}=X(),I=m(()=>N.value||S.value),h=E(!0),b=m(()=>x.sumBy(c.selectedItems??c.cart.items,e=>{var o;return((o=e.discountTotal)==null?void 0:o.amount)??0})),C=m(()=>"shippingPrice"in c.cart?c.cart.shippingPrice:c.cart.shippingSubTotal),g=m(()=>x.sumBy(c.cart.shipments,e=>{var o;return(o=e.discountAmount)==null?void 0:o.amount})),k=m(()=>{var e;return((e=c.cart.discounts)==null?void 0:e.length)||b.value>0||g.value>0});function L(e){return typeof(e==null?void 0:e.amount)=="object"&&(e==null?void 0:e.amount)!==null?e==null?void 0:e.amount.amount:e==null?void 0:e.amount}return(e,o)=>{const P=p("VcLoaderOverlay"),i=p("VcPriceDisplay"),O=p("VcIcon"),T=p("VcTotalDisplay"),W=p("VcWidget");return a(),d(W,{id:"order-summary",class:"max-md:mt-5 print:break-inside-avoid",title:e.$t("common.titles.order_summary")},{default:D(()=>{var $,w,j;return[V(e.$slots,"header",{},void 0,!0),t("div",J,[r(P,{visible:I.value},null,8,["visible"]),t("div",Q,[t("span",null,s(e.$t("common.labels.subtotal")),1),t("span",null,[r(i,{value:e.cart.subTotal},null,8,["value"])])]),t("div",Y,[t("div",Z,[(a(),d(F(k.value?"button":"span"),{class:"flex appearance-none items-center",onClick:o[0]||(o[0]=y=>h.value=!h.value)},{default:D(()=>[v(s(e.$t("common.labels.discount"))+" ",1),k.value?(a(),d(O,{key:0,class:"ml-1 fill-primary print:hidden",name:h.value?"chevron-down":"chevron-up",size:"xs"},null,8,["name"])):n("",!0)]),_:1})),e.cart.discountTotal?(a(),l("span",ee,[v(s((($=e.cart.discountTotal)==null?void 0:$.amount)>0?"-":"")+" ",1),r(i,{value:e.cart.discountTotal},null,8,["value"])])):n("",!0)]),k.value?(a(),l("div",{key:0,class:M(["print:block",{hidden:h.value}])},[t("ul",te,[(a(!0),l(q,null,K(e.cart.discounts,(y,z)=>(a(),l("li",{key:z},[t("div",ae,[t("span",se,s(y.description||y.coupon),1),r(T,{amount:-L(y),"currency-code":u(f).code,"culture-name":u(_).cultureName},null,8,["amount","currency-code","culture-name"])])]))),128)),b.value>0?(a(),l("li",ne,[t("div",oe,[t("span",le,s(e.$t("common.labels.line_items")),1),r(T,{amount:-b.value,"currency-code":u(f).code,"culture-name":u(_).cultureName},null,8,["amount","currency-code","culture-name"])])])):n("",!0),g.value>0?(a(),l("li",ce,[t("div",re,[t("span",ue,s(e.$t("common.labels.shipping")),1),r(T,{amount:-g.value,"currency-code":u(f).code,"culture-name":u(_).cultureName},null,8,["amount","currency-code","culture-name"])])])):n("",!0)])],2)):n("",!0),t("div",ie,[t("span",null,s(e.$t("common.labels.tax")),1),t("span",null,[v(s(((w=e.cart.taxTotal)==null?void 0:w.amount)>0?"+":"")+" ",1),e.cart.taxTotal?(a(),d(i,{key:0,value:e.cart.taxTotal},null,8,["value"])):n("",!0)])]),e.noShipping?n("",!0):(a(),l("div",me,[t("span",null,s(e.$t("common.labels.shipping_cost")),1),t("span",null,[v(s(((j=C.value)==null?void 0:j.amount)>0?"+":"")+" ",1),r(i,{value:C.value},null,8,["value"])])]))]),t("div",pe,[t("span",null,s(e.$t("common.labels.total")),1),t("span",de,[e.cart.total?(a(),d(i,{key:0,value:e.cart.total},null,8,["value"])):n("",!0)])])]),V(e.$slots,"footer",{},void 0,!0),e.footnote?(a(),l("div",ve,[V(e.$slots,"footnote",{},()=>[v(s(e.$t("common.messages.checkout_pricing_warning")),1)],!0)])):n("",!0)]}),_:3},8,["title"])}}}),fe=H(he,[["__scopeId","data-v-471240a6"]]);export{fe as O};
//# sourceMappingURL=order-summary-DbBBQpx2.js.map
