import{s as o}from"./p-93127aa7.js";import{c as s}from"./p-03631502.js";import{g as i}from"./p-9dbc54d6.js";import{s as n}from"./p-6c74654a.js";import{s as r}from"./p-4cae87fc.js";const{processors:d}=i(),{state:l,onChange:a,on:e,dispose:t}=s({processors:[],methods:[],manualPaymentMethods:[],disabled:{processors:[]},sortOrder:{processors:["stripe","paystack","paypal","mollie","mock"],manualPaymentMethods:[],paymentMethods:{mollie:["creditcard","paypal"],razorpay:["card","upi"]}},instances:{stripe:void 0},config:{stripe:{paymentElement:!1}},...d},((o,e)=>JSON.stringify(o)!==JSON.stringify(e))),v=["mollie","razorpay"],p=o=>!!o&&v.includes(o),c=()=>o(l.processors,"processor_type",l.sortOrder.processors).filter((o=>(null==o?void 0:o.live_mode)===("live"===(null==n?void 0:n.mode)))).filter((o=>!(l.disabled.processors||[]).includes(o.processor_type))).filter((o=>{var e;return!(null===(e=null==n?void 0:n.checkout)||void 0===e?void 0:e.reusable_payment_method_required)||!!(null==o?void 0:o.recurring_enabled)})).filter(((o,e,r)=>!r.some((o=>"mollie"===o.processor_type))||"mollie"===o.processor_type||"mock"===o.processor_type)),u=o=>c().find((({processor_type:e})=>e===o)),m=o=>c().find((({processor_type:e})=>e===o)),w=o=>{var e,r;return!!o&&(null!==(e=o.supported_currencies)&&void 0!==e?e:[]).includes(null===(r=null===window||void 0===window?void 0:window.scData)||void 0===r?void 0:r.currency)},y=o=>c().some((({processor_type:e})=>e!==o&&"paypal"!==e&&"mock"!==e)),f=()=>o(l.manualPaymentMethods,"id",l.sortOrder.manualPaymentMethods).filter((o=>!(l.disabled.processors||[]).includes(null==o?void 0:o.id))).filter((o=>{var e;return!(null===(e=null==n?void 0:n.checkout)||void 0===e?void 0:e.reusable_payment_method_required)||!!(null==o?void 0:o.reusable)})),h=()=>{const e=null==r?void 0:r.id,s=p(e)?l.sortOrder.paymentMethods[e]:[];return o(l.methods,"id",s||[]).filter((o=>{var e,r;return"applepay"!==o.id||(null===window||void 0===window?void 0:window.ApplePaySession)&&(null===(r=null===(e=null===window||void 0===window?void 0:window.ApplePaySession)||void 0===e?void 0:e.canMakePayments)||void 0===r?void 0:r.call(e))}))},j=()=>[...c(),...f()],k=()=>{var o;return(null===(o=j())||void 0===o?void 0:o.length)>1},g=()=>[...h(),...f(),u("mock")].filter(Boolean),_=()=>{var o;return(null===(o=g())||void 0===o?void 0:o.length)>1};export{c as a,f as b,h as c,k as d,_ as e,m as f,u as g,y as h,p as i,a as o,w as p,l as s};