import{r as t,h as s,g as e}from"./p-b891c2f1.js";import{_ as r}from"./p-684c85b4.js";import"./p-aafd8ea4.js";import"./p-112455b1.js";const i=class{constructor(s){t(this,s),this.loading=!1}async handleSubmit(){const t=this.el.querySelector("sc-stripe-payment-element");if(t){this.loading=!0;try{await t.confirm("setup",{successUrl:this.successUrl}),this.successUrl?window.location.assign(this.successUrl):this.loading=!1}catch(t){this.error=(null==t?void 0:t.message)||r("Something went wrong","surecart"),this.loading=!1}}else this.error=r("Something went wrong","surecart")}render(){return s("sc-card",null,s("sc-form",{onScFormSubmit:()=>this.handleSubmit()},this.error&&s("sc-alert",{open:!!this.error,type:"danger"},s("span",{slot:"title"},r("Error","surecart")),this.error),s("slot",null),s("sc-button",{type:"primary",submit:!0,full:!0,loading:this.loading},r("Save Payment Method","surecart")),this.loading&&s("sc-block-ui",null)))}get el(){return e(this)}};i.style="sc-payment-method-create{display:block;position:relative}";export{i as sc_payment_method_create}