!function(){"use strict";var e=window.wc.blocksCheckout,t=window.wc.wcBlocksSharedHocs,i=window.wp.element,n=window.wp.i18n,r=window.wc.wcSettings;const{optinDefaultText:o,gdprHeadline:c,gdprFields:a}=(0,r.getSetting)("mailchimp-newsletter_data","");var s={text:{type:"string",default:o},gdprHeadline:{type:"string",default:c},gdpr:{type:"array",default:a}},l=JSON.parse('{"apiVersion":2,"name":"woocommerce/mailchimp-newsletter-subscription","version":"1.0.0","title":"Mailchimp Newsletter!","category":"woocommerce","description":"Adds a newsletter subscription checkbox to the checkout.","supports":{"html":true,"align":false,"multiple":false,"reusable":false},"parent":["woocommerce/checkout-contact-information-block"],"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"textdomain":"mailchimp-woocommerce","editorStyle":"file:../../../build/style-newsletter-block.css"}');(0,e.registerCheckoutBlock)({metadata:l,component:(0,t.withFilteredAttributes)(s)((t=>{let{cart:r,extensions:o,text:c,gdprHeadline:a,gdpr:s,checkoutExtensionData:l}=t,m={};s&&s.length&&s.forEach((e=>{m[e.marketing_permission_id]=!1}));const[d,p]=(0,i.useState)(!1),[u]=(0,i.useState)({}),{setExtensionData:w}=l;return(0,i.useEffect)((()=>{w("mailchimp-newsletter","optin",d)}),[d,w]),(0,i.createElement)(i.Fragment,null,(0,i.createElement)(e.CheckboxControl,{id:"subscribe-to-newsletter",checked:d,onChange:p},(0,i.createElement)("span",{dangerouslySetInnerHTML:{__html:c}})),s&&s.length?(0,n.__)(a,"mailchimp-for-woocommerce"):"",s&&s.length?s.map((t=>(0,i.createElement)(e.CheckboxControl,{id:"gdpr_"+t.marketing_permission_id,checked:u[t.marketing_permission_id],onChange:e=>{u[t.marketing_permission_id]=!u[t.marketing_permission_id],w("mailchimp-newsletter","gdprFields",u)}},(0,i.createElement)("span",{dangerouslySetInnerHTML:{__html:t.text}})))):"")}))})}();