(()=>{"use strict";var e={538:(e,t,o)=>{var n=o(609),i=Symbol.for("react.element"),r=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),l=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,o){var n,s={},c=null,p=null;for(n in void 0!==o&&(c=""+o),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(p=t.ref),t)r.call(t,n)&&!a.hasOwnProperty(n)&&(s[n]=t[n]);if(e&&e.defaultProps)for(n in t=e.defaultProps)void 0===s[n]&&(s[n]=t[n]);return{$$typeof:i,type:e,key:c,ref:p,props:s,_owner:l.current}}t.jsx=s,t.jsxs=s},106:(e,t,o)=>{e.exports=o(538)},609:e=>{e.exports=window.React}},t={};const o=window.wp.element,n=(0,o.forwardRef)((function({icon:e,size:t=24,...n},i){return(0,o.cloneElement)(e,{width:t,height:t,...n,ref:i})})),i=window.wp.primitives;var r=function o(n){var i=t[n];if(void 0!==i)return i.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,o),r.exports}(106);const l=(0,r.jsx)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(i.Path,{fillRule:"evenodd",d:"M6.863 13.644L5 13.25h-.5a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5H5L18 6.5h2V16h-2l-3.854-.815.026.008a3.75 3.75 0 01-7.31-1.549zm1.477.313a2.251 2.251 0 004.356.921l-4.356-.921zm-2.84-3.28L18.157 8h.343v6.5h-.343L5.5 11.823v-1.146z",clipRule:"evenodd"})}),a=window.wp.blocks,s=window.wp.i18n,c=window.wp.blockEditor,p=window.wc.blocksCheckout,d=window.wc.wcSettings,m=window.wp.components,w=(0,d.getSetting)("adminUrl"),{optinEnabled:u,defaultText:f}=(0,d.getSetting)("mailpoet_data");function k(){const e=`${w}admin.php?page=mailpoet-settings#/woocommerce`;return(0,r.jsxs)(m.Placeholder,{icon:(0,r.jsx)(n,{icon:l}),label:(0,s.__)("Marketing opt-in","mailpoet"),className:"wp-block-mailpoet-newsletter-block-placeholder",children:[(0,r.jsx)("span",{className:"wp-block-mailpoet-newsletter-block-placeholder__description",children:(0,s.__)("MailPoet marketing opt-in would be shown here if enabled. You can enable from the settings page.","mailpoet")}),(0,r.jsx)(m.Button,{variant:"primary",className:"wp-block-mailpoet-newsletter-block-placeholder__button",onClick:()=>{window.open(e,"_blank","noopener noreferrer")},children:(0,s.__)("Enable opt-in for Checkout","mailpoet")})]})}const{optinEnabled:b,defaultText:h}=(0,d.getSetting)("mailpoet_data"),g={text:{type:"string",default:h},lock:{type:"object",default:{remove:!!b,move:!1}}},v=JSON.parse('{"apiVersion":3,"name":"mailpoet/marketing-optin-block","version":"0.1.0","title":"MailPoet Marketing Opt-in","category":"mailpoet","textdomain":"mailpoet","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/checkout-contact-information-block"],"editorScript":"file:./marketing-optin-block.js","editorStyle":"file:./marketing-optin-block.css"}'),x=(0,a.getCategories)();(0,a.setCategories)([...x,{slug:"mailpoet",title:"MailPoet"}]),(0,a.registerBlockType)(v,{icon:{src:(0,r.jsx)(n,{icon:l}),foreground:"#7f54b3"},attributes:{...v.attributes,...g},edit:function({attributes:{text:e},setAttributes:t}){const o=(0,c.useBlockProps)(),n=e||f;return(0,r.jsx)("div",{...o,children:u?(0,r.jsxs)("div",{className:"wc-block-checkout__marketing",children:[(0,r.jsx)(p.CheckboxControl,{id:"mailpoet-marketing-optin",checked:!1,onChange:()=>{}}),(0,r.jsx)(c.RichText,{value:n,onChange:e=>t({text:e})})]}):(0,r.jsx)(k,{})})},save:function(){return(0,r.jsx)("div",{...c.useBlockProps.save()})}})})();