import{r as o,h as t,H as i,a as s}from"./p-e97fde0a.js";import{s as n}from"./p-d225de50.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-3918a0cc.js";import"./p-f09ee70b.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-88aed607.js";import"./p-07b1b1ed.js";import"./p-93127aa7.js";import"./p-edd617b4.js";import"./p-1f60f497.js";import"./p-addaf7a4.js";import"./p-d9fa04f9.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,r,c,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:(c=(r=this.state())===null||r===void 0?void 0:r.selectedPrice)===null||c===void 0?void 0:c.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-3598892f.entry.js.map