!function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t,o,r){return(o=function(t){var o=function(t){if("object"!=e(t)||!t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var r=o.call(t,"string");if("object"!=e(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(o)?o:o+""}(o))in t?Object.defineProperty(t,o,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[o]=r,t}var o=window.wp.blocks,r=window.wp.blockEditor,n=window.wc.wcSettings,i=window.wp.components,c=window.wp.element,a=(0,c.forwardRef)((({icon:e,size:t=24,...o},r)=>(0,c.cloneElement)(e,{width:t,height:t,...o,ref:r}))),l=window.wp.primitives,u=window.ReactJSXRuntime,s=(0,u.jsx)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,u.jsx)(l.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"})}),p=window.wp.i18n,b=window.wc.blocksCheckout;function w(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function m(e){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?w(Object(r),!0).forEach((function(o){t(e,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=(0,n.getSetting)("automatewoo_data").optinEnabled,d=(0,n.getSetting)("adminUrl"),g=function(){return(0,u.jsxs)(i.Placeholder,{icon:(0,u.jsx)(a,{icon:s}),label:(0,p.__)("Marketing opt-in","automatewoo"),className:"wp-block-automatewoo-marketing-optin-placeholder",children:[(0,u.jsx)("span",{className:"wp-block-automatewoo-marketing-optin-placeholder__description",children:(0,p.__)("AutomateWoo marketing opt-in would be shown here if enabled. You can enable this from the settings page.","automatewoo")}),(0,u.jsx)(i.Button,{isPrimary:!0,href:"".concat(d,"admin.php?page=automatewoo-settings"),target:"_blank",rel:"noopener noreferrer",className:"wp-block-automatewoo-marketing-optin-placeholder__button",children:(0,p.__)("Enable opt-in for Checkout","automatewoo")})]})},y=JSON.parse('{"apiVersion":3,"name":"automatewoo/marketing-optin","version":"0.1.0","title":"AutomateWoo Marketing opt-in","category":"woocommerce","textdomain":"automatewoo","supports":{"multiple":false},"attributes":{"lock":{"type":"object","default":{"remove":true}}},"parent":["woocommerce/checkout-contact-information-block"],"editorScript":"file:./marketing-optin-block.js","editorStyle":"file:./marketing-optin-block.css"}'),h={text:{type:"string",default:(0,n.getSetting)("automatewoo_data","").optinDefaultText}};function j(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function O(e){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?j(Object(r),!0).forEach((function(o){t(e,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}(0,o.registerBlockType)(y,{edit:function(e){var t=e.attributes.text,o=e.setAttributes,n=(0,r.useBlockProps)();return(0,u.jsx)("div",m(m({},n),{},{children:f?(0,u.jsx)(b.CheckboxControl,{id:"automatewoo-marketing-optin",checked:!1,onChange:function(){},children:(0,u.jsx)(r.RichText,{className:"wc-block-components-checkbox__label",value:t,onChange:function(e){return o({text:e})}})}):(0,u.jsx)(g,{})}))},save:function(){return(0,u.jsx)("div",m({},r.useBlockProps.save()))},attributes:O(O({},y.attributes),h)})}();