import{ai as _,b8 as y,m as o,r as m,a9 as h,F as E,_ as b,R as k,e as w,a1 as A,a2 as I,a0 as V}from"./vendor-D8NNcBCx.js";import{b8 as v,a6 as F}from"./index-C3Ufbmof.js";import{u as O,a as P}from"./useCheckout-D2DHarRK.js";import{_ as S}from"./proceed-to.vue_vue_type_script_setup_true_lang-CF362pBP.js";const c=m(""),p=m("");function U(){const{t:d}=_(),{cart:t,validateCartCoupon:n,addCartCoupon:s,removeCartCoupon:r}=v(),u=d("common.messages.invalid_coupon"),e=o(()=>t.value?.coupons?.[0]),i=o(()=>!!e.value?.isAppliedSuccessfully),a=o(()=>c.value.trim());function l(){p.value=""}async function C(){if(l(),!a.value)return;await n(a.value)?await s(a.value):p.value=u}async function f(){a.value&&await r(a.value)}return y(()=>{c.value=e.value?.code??""}),{couponCode:c,applyCoupon:C,removeCoupon:f,couponIsApplied:i,clearCouponValidationError:l,couponValidationError:h(p)}}const g=E({__name:"place-order",setup(d){const{hasOnlyUnselectedLineItems:t}=v(),{paymentMethod:n,isValidCheckout:s,createOrderFromCart:r}=O(),{isCanFinalizePayment:u}=P(),{isAuthenticated:e}=F(),i=o(()=>t.value||!s.value||e.value&&n.value?.allowCartPayment&&!u.value);return(a,l)=>(k(),b(S,{disabled:i.value,onClick:w(r)},{default:A(()=>[I(V(a.$t("common.buttons.place_order")),1)]),_:1},8,["disabled","onClick"]))}});export{g as _,U as u};
//# sourceMappingURL=place-order.vue_vue_type_script_setup_true_lang-D0rQ9zQn.js.map
