import{r as o,h as t,H as i,a as s}from"./p-e97fde0a.js";import{s as n}from"./p-979b2512.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-6b5d827f.js";import"./p-53e7f7d7.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-4df6e0c5.js";import"./p-30eb50ff.js";import"./p-93127aa7.js";import"./p-d7c7b076.js";import"./p-1f60f497.js";import"./p-be3a018c.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 d=a;const e=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,d,e,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)||((d=window===null||window===void 0?void 0:window.scData)===null||d===void 0?void 0:d.currency)||"usd",showCode:false,showLabel:false,value:`${((e=this.state())===null||e===void 0?void 0:e.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)}};e.style=d;export{e as sc_product_donation_custom_amount};
//# sourceMappingURL=p-371c73e4.entry.js.map