(()=>{"use strict";var e={};(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);const t=window.wp.element,r=window.wc.blocksCheckout,n=window.wp.plugins,o=window.wc.wcSettings,c=window.wcPPCP.utils;function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}window.wp.i18n,l(l({},{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""}),{},{email:""}),(0,o.getSetting)("ppcpGeneralData").i18n,window.wp.apiFetch,window.wp.data;var f=(0,o.getSetting)("paylaterParams"),y=function(e){var n=e.cart,i=(e.extensions,e.context,f.enabled),l=(0,t.useRef)(null),u=n.cartTotals,y=u.currency_code,b=u.total_price,w=function(e){var r,n,o=(r=(0,t.useState)(null),n=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c=[],a=!0,i=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(c.push(n.value),!t||c.length!==t);a=!0);}catch(e){i=!0,o=e}finally{try{a||null==r.return||r.return()}finally{if(i)throw o}}return c}}(r,n)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(r,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=o[0],l=o[1];return(0,t.useEffect)((function(){i||(0,c.loadPayPalSdk)(e).then((function(e){return l(e)}))}),[i]),i}((0,o.getSetting)("paypalQueryParams")),m=(0,t.useMemo)((function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({amount:b/Math.pow(10,u.currency_minor_unit),currency:y,placement:"payment"},f.options)}));return(0,t.useEffect)((function(){w&&i&&w.Messages(m).render(l.current)}),[w,m,i]),i?React.createElement(r.TotalsWrapper,null,React.createElement("div",{className:"wc-block-components-totals-item"},React.createElement("div",{ref:l,className:"wc-ppcp-paylater-msg__container"}))):null};(0,n.registerPlugin)("wc-ppcp",{render:function(){return React.createElement(r.ExperimentalOrderMeta,null,React.createElement(y,null))},scope:"woocommerce-checkout"}),(this.wcPPCP=this.wcPPCP||{})["paylater-messaging"]=e})();
//# sourceMappingURL=paylater-messaging.js.map