import{r as s,h as i,F as t}from"./p-e97fde0a.js";import{a as e}from"./p-03fa5ba7.js";import{a as r}from"./p-323c2e84.js";import{s as o}from"./p-4cae87fc.js";import{s as a}from"./p-6c74654a.js";import{o as n}from"./p-393cb717.js";import{f as l}from"./p-ff10bfbf.js";import"./p-e2e1fe1f.js";import"./p-401e165e.js";import"./p-93127aa7.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-d3366af3.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-610295e2.js";const c=(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 d="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=d;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}=c(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-f7566322.entry.js.map