'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-8acc3c89.js');
const util = require('./util-b877b2bd.js');
const watchers = require('./watchers-1dba543c.js');
require('./index-bcdafe6e.js');
require('./utils-2e91d46c.js');
require('./getters-4eeca6b3.js');
require('./mutations-22165f96.js');
require('./remove-query-args-b57e8cd3.js');
require('./add-query-args-49dcb630.js');
require('./index-fb76df07.js');
require('./google-59d23803.js');
require('./currency-71fce0f0.js');
require('./store-4a539aea.js');
require('./price-da3cab3d.js');
require('./address-7404695f.js');
require('./mutations-ce399aca.js');
require('./mutations-11c8f9a8.js');
require('./index-d9aeadfe.js');
require('./fetch-d374a251.js');

const scProductDonationAmountChoiceCss = "";
const ScProductDonationAmountChoiceStyle0 = scProductDonationAmountChoiceCss;

const ScProductDonationAmountChoice = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
        this.productId = undefined;
        this.value = undefined;
        this.label = undefined;
    }
    state() {
        return watchers.state[this.productId];
    }
    render() {
        var _a;
        const amounts = watchers.getInRangeAmounts(this.productId);
        const order = amounts.indexOf(this.value);
        if (!util.isInRange(this.value, this.state().selectedPrice) || order < 0)
            return index.h(index.Host, { style: { display: 'none' } });
        return (index.h("sc-choice-container", { "show-control": "false", checked: this.state().ad_hoc_amount === this.value, onScChange: () => watchers.updateDonationState(this.productId, { ad_hoc_amount: this.value, custom_amount: null }), "aria-label": wp.i18n.sprintf(wp.i18n.__('%d of %d', 'surecart'), order + 1, amounts.length), role: "button" }, this.label ? (this.label) : (index.h("sc-format-number", { type: "currency", currency: (_a = this.state().selectedPrice) === null || _a === void 0 ? void 0 : _a.currency, value: this.value, "minimum-fraction-digits": "0" }))));
    }
    get el() { return index.getElement(this); }
};
ScProductDonationAmountChoice.style = ScProductDonationAmountChoiceStyle0;

exports.sc_product_donation_amount_choice = ScProductDonationAmountChoice;

//# sourceMappingURL=sc-product-donation-amount-choice.cjs.entry.js.map