import{r as s,h as i,F as t}from"./p-9add63ef.js";import{a as e}from"./p-73151c01.js";import{a as r}from"./p-ed1ab66f.js";import{s as o}from"./p-49fdface.js";import{s as a}from"./p-1282ed4a.js";import{o as n}from"./p-4773325d.js";import{f as l}from"./p-b51de06c.js";import"./p-e2e1fe1f.js";import"./p-401e165e.js";import"./p-fb28f84f.js";import"./p-2b28ea49.js";import"./p-dd24e53c.js";import"./p-d3366af3.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-31faf2b8.js";import"./p-610295e2.js";const d=(s=[],i,t)=>{var e;return((e=(s||[]).find((s=>(s===null||s===void 0?void 0:s.processor_type)===i&&(s===null||s===void 0?void 0:s.live_mode)===!!(t==="live"))))===null||e===void 0?void 0:e.processor_data)||{}};const c="sc-order-submit{display:block;width:auto;display:grid;gap:var(--sc-form-row-spacing)}.sc-secure-notice{display:flex;justify-content:center}";const p=c;const u=class{constructor(i){s(this,i);this.loading=undefined;this.paying=undefined;this.type="primary";this.size="medium";this.full=true;this.icon=undefined;this.showTotal=undefined;this.processors=undefined;this.order=undefined;this.currencyCode="usd";this.processor=undefined;this.secureNoticeText=undefined;this.secureNotice=true;this.backgroundColor="";this.textColor=""}cannotShipToLocation(){var s,i;return((s=a===null||a===void 0?void 0:a.checkout)===null||s===void 0?void 0:s.selected_shipping_choice_required)&&!((i=a.checkout)===null||i===void 0?void 0:i.selected_shipping_choice)}renderPayPalButton(s){const{client_id:t,account_id:o,merchant_initiated_enabled:n}=d(r(),"paypal",a.mode);if(!t&&!o)return null;return i("sc-paypal-buttons",{buttons:s,busy:l()||e(),mode:a.mode,order:a.checkout,merchantInitiated:n,"currency-code":a.currencyCode,"client-id":t,"merchant-id":o,label:"checkout",color:"blue"})}render(){var s;if(this.cannotShipToLocation()||e("OUT_OF_STOCK")){return i("sc-button",{type:this.type,size:this.size,full:this.full,loading:this.loading||this.paying,disabled:true,style:{"--sc-color-primary-text":this.textColor,"--sc-color-primary-500":this.backgroundColor}},!!this.icon&&i("sc-icon",{name:this.icon,slot:"prefix","aria-hidden":"true"}),i("slot",null,wp.i18n.__("Purchase","surecart")),this.showTotal&&i("span",null," ",i("sc-total",null)),i("sc-visually-hidden",null," ",wp.i18n.__("Press enter to purchase","surecart")))}const r=(s=a.checkout)===null||s===void 0?void 0:s.payment_method_required;return i(t,null,r&&o.id==="paypal"&&!(o===null||o===void 0?void 0:o.method)&&this.renderPayPalButton(["paypal"]),r&&o.id==="paypal"&&(o===null||o===void 0?void 0:o.method)==="card"&&this.renderPayPalButton(["card"]),i("sc-button",{hidden:["paypal","paypal-card"].includes(o.id)&&r,submit:true,type:this.type,size:this.size,full:this.full,loading:this.loading||this.paying,disabled:this.loading||this.paying||l()||e()||this.cannotShipToLocation(),style:{"--sc-color-primary-text":this.textColor,"--sc-color-primary-500":this.backgroundColor}},!!this.icon&&i("sc-icon",{name:this.icon,slot:"prefix","aria-hidden":"true"}),i("slot",null,wp.i18n.__("Purchase","surecart")),this.showTotal&&i("span",null," ",i("sc-total",null)),i("sc-visually-hidden",null," ",wp.i18n.__("Press enter to purchase","surecart"))),this.secureNotice&&location.protocol==="https:"&&i("div",{class:"sc-secure-notice"},i("sc-secure-notice",null,this.secureNoticeText||wp.i18n.__("This is a secure, encrypted payment.","surecart"))))}};n(u,["loading","paying","processors","processor","currencyCode","order"],false);u.style=p;export{u as sc_order_submit};
//# sourceMappingURL=p-cf126dac.entry.js.map