import{r as o,h as t,H as i,a as s}from"./p-e97fde0a.js";import{s as n}from"./p-e1cd5477.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-03fa5ba7.js";import"./p-6c74654a.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-610295e2.js";import"./p-e2e1fe1f.js";import"./p-93127aa7.js";import"./p-75923b89.js";import"./p-1f60f497.js";import"./p-d19e982c.js";import"./p-dd3464cd.js";const a="sc-product-donation-custom-amount sc-price-input sc-button{margin-right:-10px !important}.sc-product-donation-custom-amount sc-button{opacity:0;visibility:hidden;transition:opacity var(--sc-transition-fast) ease-in-out, visibility var(--sc-transition-fast) ease-in-out}.sc-product-donation-custom-amount--has-value sc-button{opacity:1;visibility:visible}";const e=a;const d=class{constructor(t){o(this,t);this.productId=undefined;this.value=undefined}state(){return n[this.productId]}updateState(o){n[this.productId]={...n[this.productId],...o}}render(){var o,s,n,a,e,d,c,r,u,p;const l=!!((o=this.state())===null||o===void 0?void 0:o.custom_amount);return t(i,{key:"7a9b7f513d19b5dfa61fe1199c36ff8af9310e25",class:{"sc-product-donation-custom-amount":true,"sc-product-donation-custom-amount--has-value":!!this.value}},t("sc-choice-container",{key:"053018bee56a379f1fafd534d4ccfb26317d866b",value:`${(s=this.state())===null||s===void 0?void 0:s.custom_amount}`,"show-control":"false",checked:l,onClick:()=>this.priceInput.triggerFocus(),onKeyDown:()=>{this.priceInput.triggerFocus()},role:"button"},t("sc-visually-hidden",{key:"65639092b47669fa4102de1dd3f9985917ed6381"},wp.i18n.__("Enter a custom amount.","surecart")),t("sc-price-input",{key:"c985e5cfed51496288adb2763d12be39e857f67b",ref:o=>this.priceInput=o,currencyCode:((a=(n=this.state())===null||n===void 0?void 0:n.selectedPrice)===null||a===void 0?void 0:a.currency)||((e=window===null||window===void 0?void 0:window.scData)===null||e===void 0?void 0:e.currency)||"usd",showCode:false,showLabel:false,value:`${((d=this.state())===null||d===void 0?void 0:d.custom_amount)||""}`,onScChange:o=>this.updateState({ad_hoc_amount:null,custom_amount:o.target.value}),min:(r=(c=this.state())===null||c===void 0?void 0:c.selectedPrice)===null||r===void 0?void 0:r.ad_hoc_min_amount,max:(p=(u=this.state())===null||u===void 0?void 0:u.selectedPrice)===null||p===void 0?void 0:p.ad_hoc_max_amount,style:{"--sc-input-border-color-focus":"var(--sc-input-border-color-hover)","--sc-focus-ring-color-primary":"transparent"}})))}get el(){return s(this)}};d.style=e;export{d as sc_product_donation_custom_amount};
//# sourceMappingURL=p-e9dc0e1e.entry.js.map