import{r as s,c as o,h as t,F as e}from"./p-dfbe004d.js";import{_ as l,s as r}from"./p-8415f806.js";import"./p-fd56940f.js";import{s as i}from"./p-ea78c070.js";import"./p-699b9e85.js";import{s as a,c as n,d as c,b as d}from"./p-a41f5fb3.js";import{d as m,a as u}from"./p-10aa7556.js";import{a as p}from"./p-f56cd460.js";import{l as h,u as v}from"./p-30ecac60.js";import{a as f}from"./p-7393a06c.js";import{M as y}from"./p-61b0c4ec.js";import{a as b}from"./p-1c2e2695.js";import"./p-9a7a47e8.js";import"./p-35c4916d.js";import"./p-6c2a2148.js";const g=class{constructor(t){s(this,t),this.scError=o(this,"scError",7)}componentWillLoad(){var s,o;i.id="mollie",this.fetchMethods(),s=["total_amount","currency","reusabled_payment_method_required","shipping_address"],o=()=>this.fetchMethods(),m("set",((t,e,l)=>{if("checkout"===t){if(Array.isArray(s)&&s.some((s=>JSON.stringify(null==e?void 0:e[s])!==JSON.stringify(null==l?void 0:l[s]))))return o();if("string"==typeof s){if(JSON.stringify(null==e?void 0:e[s])===JSON.stringify(null==l?void 0:l[s]))return;return o()}}}))}async fetchMethods(){var s;const o=u.checkout;if((null==o?void 0:o.currency)&&(null==o?void 0:o.total_amount))try{h("methods");const t=await f({path:b(`surecart/v1/processors/${this.processorId}/payment_method_types`,{amount:null==o?void 0:o.total_amount,country:(null===(s=null==o?void 0:o.shipping_address)||void 0===s?void 0:s.country)||"us",currency:null==o?void 0:o.currency,...(null==o?void 0:o.reusable_payment_method_required)?{reusable:null==o?void 0:o.reusable_payment_method_required}:{},per_page:100})});a.methods=(null==t?void 0:t.data)||[]}catch(s){this.scError.emit(s),console.error(s)}finally{v("methods")}}renderLoading(){return t("sc-card",null,t("sc-skeleton",{style:{width:"50%",marginBottom:"0.5em"}}),t("sc-skeleton",{style:{width:"30%",marginBottom:"0.5em"}}),t("sc-skeleton",{style:{width:"60%",marginBottom:"0.5em"}}))}render(){var s,o,i;if(p("methods")&&!(null===(s=n())||void 0===s?void 0:s.length))return this.renderLoading();if(!(null===(o=u.checkout)||void 0===o?void 0:o.currency))return this.renderLoading();if(!(null===(i=n())||void 0===i?void 0:i.length))return t("sc-alert",{type:"warning",open:!0},l("No available payment methods","surecart")," ");const a=c()?"sc-toggles":"div";return t(e,null,t(a,{collapsible:!1,theme:"container"},(n()||[]).map((s=>t("sc-payment-method-choice",{"processor-id":"mollie","method-id":null==s?void 0:s.id,key:null==s?void 0:s.id},t("span",{slot:"summary",class:"sc-payment-toggle-summary"},!!(null==s?void 0:s.image)&&t("img",{src:null==s?void 0:s.image}),t("span",null,null==s?void 0:s.description)),t("sc-card",null,t("sc-payment-selected",{label:r(l("%s selected for check out.","surecart"),null==s?void 0:s.description)},!!(null==s?void 0:s.image)&&t("img",{slot:"icon",src:null==s?void 0:s.image,style:{width:"32px"}}),l("Another step will appear after submitting your order to complete your purchase details.","surecart")))))),t(y,{methods:d()})),!!p("methods")&&t("sc-block-ui",{class:"busy-block-ui","z-index":9,style:{"--sc-block-ui-opacity":"0.4"}}))}};g.style=":host{display:block}";export{g as sc_checkout_mollie_payment}