'use strict';

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

const index = require('./index-be4abba1.js');
const util = require('./util-a15c420c.js');
const watchers = require('./watchers-78d592d3.js');
require('./index-c3de642f.js');
require('./utils-a9d13080.js');
require('./getters-a7cb114b.js');
require('./mutations-927be23d.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-01e8edc2.js');
require('./price-da3cab3d.js');
require('./store-9c215436.js');
require('./address-7404695f.js');
require('./mutations-06bf0ea4.js');
require('./mutations-d5d6ddf1.js');
require('./index-92023a2d.js');
require('./fetch-5e8dc1d5.js');
require('./index-7ced8198.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