1import H from"./BnvDg6mf.js";import J from"./Dk76xUxT.js";import K from"./M5ZXvbwJ.js";import W from"./hSZV-AEA.js";import Y from"./TSUV-kQ1.js";import{aV as Z,aX as ee,bv as te,b0 as se,bk as oe,aT as O,b4 as s,bc as h,b9 as ne,ba as m,aO as a,aP as r,b5 as S,b6 as T,aQ as o,bq as w,cn as ae,bp as re,aS as f,aR as p,b7 as _,br as V}from"./Cx0yNN-t.js";import de from"./DBqcIPyn.js";import{u as le}from"./CGPrBCk3.js";import{u as ce}from"./DlSyj8Pv.js";import"./1Fh_g1AI.js";import"./DEXLEz-3.js";import"./E684lmfX.js";import"./CWSnhNOK.js";import"./B3EdFU3U.js";import"./Bf5JpoYC.js";import"./vXRbqsk8.js";try{let d=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},b=new d.Error().stack;b&&(d._sentryDebugIds=d._sentryDebugIds||{},d._sentryDebugIds[b]="fdab642a-4b1d-4c71-94a1-43ea7d9f38c5",d._sentryDebugIdIdentifier="sentry-dbid-fdab642a-4b1d-4c71-94a1-43ea7d9f38c5")}catch{}const ie={key:0,class:"space-y-3"},ue={key:1,class:"space-y-3"},me={class:"flex items-center justify-between p-4 border border-border hover:border-secondary/50 transition-colors bg-base-200"},pe={class:"flex items-center space-x-4 flex-1"},ye=["id","value","disabled","onChange"],he={class:"flex-1"},fe={class:"flex items-center gap-2"},_e={class:"font-medium"},be={key:0,class:"flex gap-1"},ve={class:"text-xs text-success px-2 py-1 bg-success/10"},ge={key:0,class:"text-sm mt-1"},ke={key:0,class:"flex-shrink-0"},xe={key:0,class:"ml-2"},Me={key:2,class:"text-center py-8"},we={key:3,class:"p-4 border-l-4 border-error bg-error/10 text-error",role:"alert"},Pe={class:"font-medium"},Ce={class:"text-sm mt-1"},Ie=Z({__name:"CheckoutPayment",props:{disabled:{type:Boolean,default:!1},mode:{default:"checkout"},orderId:{default:""}},emits:["paymentChanged"],setup(d,{emit:b}){const l=d,P=b,{error:C}=ne(),{t:u}=ee(),I=le(),E=te(),k=l.orderId?ce(l.orderId):null,v=h(()=>l.mode==="checkout"?I.paymentMethods.value||[]:$.value),D=h(()=>l.mode==="checkout"?E.selectedPaymentMethod.value:k?.paymentMethod.value),L=h(()=>l.mode==="order"?u("orders.paymentChange.selectMethod"):u("checkout.paymentMethodLabel")),N=h(()=>l.mode==="order"?u("orders.paymentChange.description"):u("checkout.selectPaymentMethod")),$=m([]),U=async()=>{if(l.mode==="checkout")return await I.getPaymentMethods();{const e=await k?.getPaymentMethods();return $.value=e||[],e}},j=async e=>{if(l.mode==="checkout"){const n=await E.setPaymentMethod(e);return P("paymentChanged",e.id),n}else{const n=typeof e.id=="string"?e.id:String(e.id),M=await k?.changePaymentMethod(n);return P("paymentChanged",n),M}},g=m(!1),y=m(null),c=m(""),x=m(!1),R=m(null),i=h({get(){return D.value?.id||""},set(e){}}),z=async e=>{if(!(l.disabled||y.value||i.value===e)){c.value="",y.value=e;try{await j({id:e})}catch(n){c.value=n instanceof Error?n.message:u("checkout.payment.updateError"),C(c.value)}finally{y.value=null}}},q=async()=>{if(!g.value){c.value="",g.value=!0;try{await U()}catch(e){c.value=e instanceof Error?e.message:u("checkout.payment.loadError"),C(c.value)}finally{g.value=!1}}},B=e=>{x.value=e};return se(()=>{q()}),(e,n)=>{const M=H,A=J,G=K,Q=W,X=Y;return a(),oe(X,{headline:s(L),description:s(N)},{default:O(()=>[s(g)?(a(),r("div",ie,[(a(),r(S,null,T(3,t=>o("div",{key:t,class:"flex animate-pulse items-center space-x-4"},[...n[1]||(n[1]=[o("div",{class:"w-4 h-4 bg-border"},null,-1),o("div",{class:"flex-1 space-y-2"},[o("div",{class:"h-4 bg-border w-3/4"}),o("div",{class:"h-3 bg-border w-1/2"})],-1),o("div",{class:"h-8 bg-border w-16"},null,-1)])])),64))])):s(v).length>0?(a(),r("div",ue,[(a(!0),r(S,null,T(s(v),t=>(a(),r("div",{key:t.id,class:"relative"},[o("div",me,[o("div",pe,[w(o("input",{id:`payment-${t.id}`,"onUpdate:modelValue":n[0]||(n[0]=F=>re(i)?i.value=F:null),class:"checkbox",type:"radio",value:t.id,name:"payment-method",disabled:d.disabled||s(y)===t.id,onChange:F=>z(t.id)},null,40,ye),[[ae,s(i)]]),o("div",he,[f(M,{for:`payment-${t.id}`,class:"cursor-pointer"},{default:O(()=>[o("div",fe,[o("span",_e,p(t.translated?.name),1),t.afterOrderEnabled?(a(),r("div",be,[o("span",ve,p(e.$t("checkout.payment.afterOrder")),1)])):_("",!0)]),t.translated?.description?(a(),r("div",ge,p(t.translated.description),1)):_("",!0),w(f(de,{name:"components-checkout-payment-method-description-after",method:t,"selected-method-id":s(i),"show-modal":s(x),"onUpdate:showModal":B},null,8,["method","selected-method-id","show-modal"]),[[V,s(i)===t.id]])]),_:2},1032,["for"])]),t.media?.url?(a(),r("div",ke,[f(A,{src:t.media.url,alt:t.translated?.name,class:"w-12 h-8 object-contain",loading:"lazy"},null,8,["src","alt"])])):_("",!0)]),s(y)===t.id?(a(),r("div",xe,[...n[2]||(n[2]=[o("div",{class:"animate-spin h-4 w-4 border-b-2 border-primary"},null,-1)])])):_("",!0)])]))),128)),w(f(G,{ref_key:"payonePluginPaymentsModal",ref:R,"payment-methods":s(v),"selected-method-id":s(i),"show-modal":s(x),"onUpdate:showModal":B},null,8,["payment-methods","selected-method-id","show-modal"]),[[V,s(v).length>0]])])):(a(),r("div",Me,[f(Q,{name:"credit-card",size:"xl",class:"block text-secondary mx-auto mb-4"}),o("p",null,p(e.$t("checkout.payment.noMethodsAvailable")),1)])),s(c)?(a(),r("div",we,[o("p",Pe,p(e.$t("checkout.payment.error")),1),o("p",Ce,p(s(c)),1)])):_("",!0)]),_:1},8,["headline","description"])}}}),Ae=Object.assign(Ie,{__name:"CheckoutPayment"});export{Ae as default}; 2//# sourceMappingURL=B7vfU-IT.js.map
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.