"use strict";(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[8806],{9576:(e,t,s)=>{s.d(t,{E:()=>c,X:()=>l});var n=s(9075),a=s(4613),r=s(9818),o=s(4801);const i=(e=!1)=>{const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:s,availablePaymentMethods:i,availableExpressPaymentMethods:c}=(0,r.useSelect)((e=>{const t=e(o.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}})),l=Object.values(i).map((({name:e})=>e)),d=Object.values(c).map((({name:e})=>e)),u=(0,a.getPaymentMethods)(),m=(0,a.getExpressPaymentMethods)(),h=Object.keys(u).reduce(((e,t)=>(l.includes(t)&&(e[t]=u[t]),e)),{}),g=Object.keys(m).reduce(((e,t)=>(d.includes(t)&&(e[t]=m[t]),e)),{}),p=(0,n.s)(h),b=(0,n.s)(g);return{paymentMethods:e?b:p,isInitialized:e?s:t}},c=()=>i(!1),l=()=>i(!0)},5390:(e,t,s)=>{s.d(t,{P:()=>i});var n=s(4801),a=s(9818),r=s(5999),o=s(9576);const i=()=>{const{isCalculating:e,isBeforeProcessing:t,isProcessing:s,isAfterProcessing:i,isComplete:c,hasError:l}=(0,a.useSelect)((e=>{const t=e(n.CHECKOUT_STORE_KEY);return{isCalculating:t.isCalculating(),isBeforeProcessing:t.isBeforeProcessing(),isProcessing:t.isProcessing(),isAfterProcessing:t.isAfterProcessing(),isComplete:t.isComplete(),hasError:t.hasError()}})),{activePaymentMethod:d,isExpressPaymentMethodActive:u}=(0,a.useSelect)((e=>{const t=e(n.PAYMENT_STORE_KEY);return{activePaymentMethod:t.getActivePaymentMethod(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive()}})),{onSubmit:m}=(0,r.U)(),{paymentMethods:h={}}=(0,o.E)(),g=s||i||t,p=c&&!l;return{paymentMethodButtonLabel:(h[d]||{}).placeOrderButtonLabel,onSubmit:m,isCalculating:e,isDisabled:s||u,waitingForProcessing:g,waitingForRedirect:p}}},9075:(e,t,s)=>{s.d(t,{s:()=>o});var n=s(9307),a=s(9127),r=s.n(a);function o(e){const t=(0,n.useRef)(e);return r()(e,t.current)||(t.current=e),t.current}},8365:(e,t,s)=>{s.r(t),s.d(t,{default:()=>y});var n=s(9307),a=s(5736),r=s(4184),o=s.n(r),i=s(3554),c=s(5390),l=s(4333),d=s(9818),u=s(4801),m=s(5271);const h=m.qy?`<a href="${m.qy}" target="_blank">${(0,a.__)("Terms and Conditions","woocommerce")}</a>`:(0,a.__)("Terms and Conditions","woocommerce"),g=m.Sb?`<a href="${m.Sb}" target="_blank">${(0,a.__)("Privacy Policy","woocommerce")}</a>`:(0,a.__)("Privacy Policy","woocommerce"),p=(0,a.sprintf)(/* translators: %1$s terms page link, %2$s privacy page link. */
(0,a.__)("By proceeding with your purchase you agree to our %1$s and %2$s","woocommerce"),h,g),b=(0,a.sprintf)(/* translators: %1$s terms page link, %2$s privacy page link. */
(0,a.__)("You must accept our %1$s and %2$s to continue with your purchase.","woocommerce"),h,g),y=(0,l.withInstanceId)((({text:e,checkbox:t,instanceId:s,className:r})=>{const[l,m]=(0,n.useState)(!1),{isDisabled:h}=(0,c.P)(),g="terms-and-conditions-"+s,{setValidationErrors:y,clearValidationError:P}=(0,d.useDispatch)(u.VALIDATION_STORE_KEY),E=(0,d.useSelect)((e=>e(u.VALIDATION_STORE_KEY).getValidationError(g))),_=!(null==E||!E.message||null!=E&&E.hidden);return(0,n.useEffect)((()=>{if(t)return l?P(g):y({[g]:{message:(0,a.__)("Please read and accept the terms and conditions.","woocommerce"),hidden:!0}}),()=>{P(g)}}),[t,l,g,P,y]),(0,n.createElement)("div",{className:o()("wc-block-checkout__terms",{"wc-block-checkout__terms--disabled":h},r)},t?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.CheckboxControl,{id:"terms-and-conditions",checked:l,onChange:()=>m((e=>!e)),hasError:_,disabled:h},(0,n.createElement)("span",{dangerouslySetInnerHTML:{__html:e||b}}))):(0,n.createElement)("span",{dangerouslySetInnerHTML:{__html:e||p}}))}))}}]);