import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
import { _ as __ } from './default-i18n.js';
import './index2.js';
import { i as intervalString } from './price.js';
import { d as defineCustomElement$d } from './sc-alert2.js';
import { d as defineCustomElement$c } from './sc-block-ui2.js';
import { d as defineCustomElement$b } from './sc-button2.js';
import { d as defineCustomElement$a } from './sc-card2.js';
import { d as defineCustomElement$9 } from './sc-dashboard-module2.js';
import { d as defineCustomElement$8 } from './sc-form2.js';
import { d as defineCustomElement$7 } from './sc-form-control2.js';
import { d as defineCustomElement$6 } from './sc-icon2.js';
import { d as defineCustomElement$5 } from './sc-input2.js';
import { d as defineCustomElement$4 } from './sc-price-input2.js';
import { d as defineCustomElement$3 } from './sc-spinner2.js';
import { d as defineCustomElement$2 } from './sc-tooltip2.js';
import { a as addQueryArgs } from './add-query-args.js';

const scSubscriptionAdHocConfirmCss = ":host{display:block}";

const ScSubscriptionAdHocConfirm$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.busy = false;
  }
  async handleSubmit(e) {
    const { ad_hoc_amount } = await e.target.getFormJson();
    this.busy = true;
    return window.location.assign(addQueryArgs(window.location.href, {
      action: 'confirm',
      ad_hoc_amount,
    }));
  }
  render() {
    return (h("sc-dashboard-module", { heading: this.heading || __('Enter An Amount', 'surecart'), class: "subscription-switch" }, h("sc-card", null, h("sc-form", { onScSubmit: e => this.handleSubmit(e) }, h("sc-price-input", { label: "Amount", name: "ad_hoc_amount", autofocus: true, required: true }, h("span", { slot: "suffix", style: { opacity: '0.75' } }, intervalString(this.price))), h("sc-button", { type: "primary", full: true, submit: true, loading: this.busy }, __('Next', 'surecart'), " ", h("sc-icon", { name: "arrow-right", slot: "suffix" })))), this.busy && h("sc-block-ui", { style: { zIndex: '9' } })));
  }
  static get style() { return scSubscriptionAdHocConfirmCss; }
}, [0, "sc-subscription-ad-hoc-confirm", {
    "heading": [1],
    "price": [16],
    "busy": [32]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["sc-subscription-ad-hoc-confirm", "sc-alert", "sc-block-ui", "sc-button", "sc-card", "sc-dashboard-module", "sc-form", "sc-form-control", "sc-icon", "sc-input", "sc-price-input", "sc-spinner", "sc-tooltip"];
  components.forEach(tagName => { switch (tagName) {
    case "sc-subscription-ad-hoc-confirm":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, ScSubscriptionAdHocConfirm$1);
      }
      break;
    case "sc-alert":
      if (!customElements.get(tagName)) {
        defineCustomElement$d();
      }
      break;
    case "sc-block-ui":
      if (!customElements.get(tagName)) {
        defineCustomElement$c();
      }
      break;
    case "sc-button":
      if (!customElements.get(tagName)) {
        defineCustomElement$b();
      }
      break;
    case "sc-card":
      if (!customElements.get(tagName)) {
        defineCustomElement$a();
      }
      break;
    case "sc-dashboard-module":
      if (!customElements.get(tagName)) {
        defineCustomElement$9();
      }
      break;
    case "sc-form":
      if (!customElements.get(tagName)) {
        defineCustomElement$8();
      }
      break;
    case "sc-form-control":
      if (!customElements.get(tagName)) {
        defineCustomElement$7();
      }
      break;
    case "sc-icon":
      if (!customElements.get(tagName)) {
        defineCustomElement$6();
      }
      break;
    case "sc-input":
      if (!customElements.get(tagName)) {
        defineCustomElement$5();
      }
      break;
    case "sc-price-input":
      if (!customElements.get(tagName)) {
        defineCustomElement$4();
      }
      break;
    case "sc-spinner":
      if (!customElements.get(tagName)) {
        defineCustomElement$3();
      }
      break;
    case "sc-tooltip":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}
defineCustomElement$1();

const ScSubscriptionAdHocConfirm = ScSubscriptionAdHocConfirm$1;
const defineCustomElement = defineCustomElement$1;

export { ScSubscriptionAdHocConfirm, defineCustomElement };
