(()=>{"use strict";const e=window.React,t=window.wc.wcBlocksRegistry,c=window.wc.wcSettings,o=window.wp.element,n=window.wp.htmlEntities,s="mercadopago_blocks_update_cart",a=({title:t,items:c,titleAlign:o="center",listMode:n="image"})=>(0,e.createElement)("checkout-benefits",{title:t,"title-align":o,items:c,"list-mode":n}),i=({text:t,src:c,alt:o})=>(0,e.createElement)("div",{className:"mp-checkout-pro-redirect"},(0,e.createElement)("checkout-redirect-v2",{text:t,src:c,alt:o})),r=({title:t,methods:c})=>(0,e.createElement)("div",{className:"mp-checkout-pro-payment-methods"},(0,e.createElement)("payment-methods-v2",{title:t,methods:c})),m=({description:t,linkText:c,linkSrc:o,checkoutClass:n="pro"})=>(0,e.createElement)("div",{className:`mp-checkout-${n}-terms-and-conditions`},(0,e.createElement)("terms-and-conditions",{description:t,"link-text":c,"link-src":o})),l=({title:t,description:c,linkText:o,linkSrc:n})=>(0,e.createElement)("div",{className:"mp-checkout-pro-test-mode"},(0,e.createElement)("test-mode",{title:t,description:c,"link-text":o,"link-src":n})),d=(e,t,c)=>{const o={name:e,message:t,target:c,plugin:{version:wc_mercadopago_custom_checkout_params.plugin_version},platform:{name:"woocommerce",uri:window.location.href,version:wc_mercadopago_custom_checkout_params.platform_version,location:`${wc_mercadopago_custom_checkout_params.location}_${wc_mercadopago_custom_checkout_params.theme}`}};navigator.sendBeacon("https://api.mercadopago.com/v1/plugins/melidata/errors",JSON.stringify(o))};var p;const _="mp_checkout_blocks",u="woo-mercado-pago-basic",k=(0,c.getSetting)("woo-mercado-pago-basic_data",{}),h=(0,n.decodeEntities)(k.title)||"Checkout Pro",E=t=>{(e=>{const{extensionCartUpdate:t}=wc.blocksCheckout,{eventRegistration:c,emitResponse:n}=e,{onPaymentSetup:a,onCheckoutSuccess:i,onCheckoutFail:r}=c;(0,o.useEffect)((()=>{((e,t)=>{e({namespace:s,data:{action:"add",gateway:t}})})(t,u);const e=a((()=>({type:n.responseTypes.SUCCESS})));return()=>(((e,t)=>{e({namespace:s,data:{action:"remove",gateway:t}})})(t,u),e())}),[a]),(0,o.useEffect)((()=>{const e=i((async e=>{const t=e.processingResponse;return d("MP_BASIC_BLOCKS_SUCCESS",t.paymentStatus,_),{type:n.responseTypes.SUCCESS}}));return()=>e()}),[i]),(0,o.useEffect)((()=>{const e=r((e=>{const t=e.processingResponse;return d("MP_BASIC_BLOCKS_ERROR",t.paymentStatus,_),{type:n.responseTypes.FAIL,messageContext:n.noticeContexts.PAYMENTS}}));return()=>e()}),[r])})(t);const{test_mode_title:c,test_mode_description:n,test_mode_link_text:p,test_mode_link_src:h,checkout_benefits_title:E,checkout_benefits_items:g,payment_methods_title:w,payment_methods_methods:S,method:y,checkout_redirect_text:v,checkout_redirect_src:C,checkout_redirect_alt:f,terms_and_conditions_description:x,terms_and_conditions_link_text:b,terms_and_conditions_link_src:N,test_mode:R}=k.params;return(0,e.createElement)("div",{className:"mp-checkout-container"},(0,e.createElement)("div",{className:"mp-checkout-pro-container"},(0,e.createElement)("div",{className:"mp-checkout-pro-content"},R?(0,e.createElement)(l,{title:c,description:n,"link-text":p,"link-src":h}):null,(0,e.createElement)("div",{className:"mp-checkout-pro-checkout-benefits"},(0,e.createElement)(a,{title:E,items:g})),(0,e.createElement)(r,{title:w,methods:S}),"redirect"===y?(0,e.createElement)(i,{text:v,src:C,alt:f}):null)),(0,e.createElement)(m,{description:x,linkText:b,linkSrc:N}))},g={name:u,label:(0,e.createElement)((t=>{const{PaymentMethodLabel:c}=t.components,o=(0,n.decodeEntities)(k?.params?.fee_title||""),s=`${h} ${o}`;return(0,e.createElement)(c,{text:s})}),null),content:(0,e.createElement)(E,null),edit:(0,e.createElement)(E,null),canMakePayment:()=>!0,ariaLabel:h,supports:{features:null!==(p=k?.supports)&&void 0!==p?p:[]}};(0,t.registerPaymentMethod)(g)})();