import{o}from"./p-1282ed4a.js";import{o as i,s as d}from"./p-49fdface.js";import{o as s,a as l,b as n,c as r,i as t}from"./p-ed1ab66f.js";const e=()=>{var o,s;const i=[...l().map((({processor_type:o})=>o)),...n().map((({id:o})=>o))];i.includes(d.id)||(null===(s=null===(o=null===window||void 0===window?void 0:window.wp)||void 0===o?void 0:o.hooks)||void 0===s?void 0:s.applyFilters)&&!window.wp.hooks.applyFilters("surecart_auto_select_payment_method",!0)||(d.id=(null==i?void 0:i.length)?null==i?void 0:i[0]:null)},u=()=>{const o=(r()||[]).map((({id:o})=>o));t(null==d?void 0:d.id)?o.includes(d.method)||(d.method=(null==o?void 0:o.length)?null==o?void 0:o[0]:null):d.method=null};o("checkout",(()=>{e(),u()})),i("id",(()=>{e(),u()})),s("processors",(()=>e())),s("disabled",(()=>e())),s("methods",(()=>u()));