(()=>{"use strict";var e={20:(e,t,r)=>{var o=r(609),s=Symbol.for("react.element"),n=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),a=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function i(e,t,r){var o,i={},p=null,d=null;for(o in void 0!==r&&(p=""+r),void 0!==t.key&&(p=""+t.key),void 0!==t.ref&&(d=t.ref),t)n.call(t,o)&&!c.hasOwnProperty(o)&&(i[o]=t[o]);if(e&&e.defaultProps)for(o in t=e.defaultProps)void 0===i[o]&&(i[o]=t[o]);return{$$typeof:s,type:e,key:p,ref:d,props:i,_owner:a.current}}t.jsx=i,t.jsxs=i},609:e=>{e.exports=window.React},848:(e,t,r)=>{e.exports=r(20)}},t={};const r=window.wp.element,o=window.wc.wcBlocksRegistry,s=window.wp.htmlEntities,n=window.wc.wcSettings,a="mercadopago_blocks_update_cart";var c=function r(o){var s=t[o];if(void 0!==s)return s.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}(848);const i=({text:e,imgSrc:t,id:r})=>(0,c.jsxs)("div",{id:r,className:"row-image-select",children:[(0,c.jsx)("img",{src:t}),(0,c.jsx)("span",{children:e})]});var p;const d="mp_checkout_blocks",u="woo-mercado-pago-credits",l=(0,n.getSetting)("woo-mercado-pago-credits_data",{}),m=(0,s.decodeEntities)(l.title)||"Checkout Credits",_=()=>{const e=(0,s.decodeEntities)(l?.params?.fee_title||""),t=`${m} ${e}`;return(0,c.jsx)(i,{text:t,imgSrc:l.params.icon})},y=e=>((e=>{const{extensionCartUpdate:t}=wc.blocksCheckout,{eventRegistration:o,emitResponse:s}=e,{onPaymentSetup:n,onCheckoutSuccess:c,onCheckoutFail:i}=o;(0,r.useEffect)((()=>{((e,t)=>{e({namespace:a,data:{action:"add",gateway:t}})})(t,u);const e=n((()=>({type:s.responseTypes.SUCCESS,meta:{paymentMethodData:{...window.mpHiddenInputDataFromBlocksCheckout}}})));return()=>(((e,t)=>{e({namespace:a,data:{action:"remove",gateway:t}})})(t,u),e())}),[n]),(0,r.useEffect)((()=>{const e=c((async e=>{const t=e.processingResponse;return sendMetric("MP_CREDITS_BLOCKS_SUCCESS",t.paymentStatus,d),{type:s.responseTypes.SUCCESS}}));return()=>e()}),[c]),(0,r.useEffect)((()=>{const e=i((e=>{"undefined"!=typeof MPCheckoutErrorDispatcher&&MPCheckoutErrorDispatcher.dispatchEventWhenBlocksCheckoutErrorOccurred(e);const t=e.processingResponse;return sendMetric("MP_CREDITS_BLOCKS_ERROR",t.paymentStatus,d),{type:s.responseTypes.FAIL,messageContext:s.noticeContexts.PAYMENTS}}));return()=>e()}),[i])})(e),(0,c.jsx)("div",{dangerouslySetInnerHTML:{__html:l.params.content}})),w={name:u,label:(0,c.jsx)(_,{}),content:(0,c.jsx)(y,{}),edit:(0,c.jsx)(y,{}),canMakePayment:()=>!0,ariaLabel:m,supports:{features:null!==(p=l?.supports)&&void 0!==p?p:[]}};(0,o.registerPaymentMethod)(w)})();