import{createElement as e,Fragment as t}from"../../../../external/preact/dist/preact.js";import{OrderPaymentMethods as o}from"./OrderPaymentMethods.js";import{InstantPaymentMethods as n}from"./InstantPaymentMethods.js";import{useCoreContext as r}from"../../../../core/Context/CoreProvider.js";import{useBrandLogoConfiguration as s}from"./useBrandLogoConfiguration.js";import a from"./PaymentMethodsContainer.js";import{useEffect as d}from"../../../../external/preact/hooks/dist/hooks.js";const m=({paymentMethods:m,instantPaymentMethods:i,storedPaymentMethods:l,openFirstStoredPaymentMethod:p,openFirstPaymentMethod:y,openPaymentMethod:h,order:c,orderStatus:f=null,onOrderCancel:M,onSelect:u=()=>{},...P})=>{const{i18n:g}=r(),C=s(m),j=i?.length>0,S=l?.length>0,b=j||S?g.get("paymentMethodsList.otherPayments.label"):"";return d(()=>{if(h?.type){const e=m?.find(e=>e.type===h?.type);if(e)return void u(e);console.warn(`Drop-in: payment method type "${h?.type}" not found`)}const e=l?.[0],t=m?.[0];if(e||t){if(p&&!0===e?.props?.oneClick)return void u(e);y&&u(t)}},[l,m,p,y,h]),e(t,null,f&&e(o,{order:c,orderStatus:f,onOrderCancel:M,brandLogoConfiguration:C}),j&&e(n,{paymentMethods:i,onSelect:u}),S&&e(a,{...P,label:g.get("paymentMethodsList.storedPayments.label"),classNameModifiers:["storedPayments"],paymentMethods:l,onSelect:u}),!!m.length&&e(a,{...P,label:b,classNameModifiers:["otherPayments"],paymentMethods:m,onSelect:u}))};export{m as default};
//# sourceMappingURL=PaymentMethodList.js.map
