(()=>{"use strict";var t;const{ajax_url:e,namespace:a,plugin_root_path:n,plugin_root_url:o,is_pro:r,route_path:s,menu:c,nonce:i,addons:u,ablocks_nonce:l,rest_url:_,toplevel_menu_icon_url:d,third_party_plugin_status:p,settings:b,site_url:m,blocks_status:f,theme_builder:h,admin_url:k,is_fse_theme:w,post_types:y}=null!==(t=window.ABlocksGlobal)&&void 0!==t?t:{};document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".ablocks-stripe-form").forEach(t=>{const a=t.getAttribute("data-ablocks__block-id"),n=t.getAttribute("data-ablocks__post-id"),o=t.getAttribute("data-ablocks__open-new-tab"),r=t.getAttribute("data-ablocks__error-msg");t.querySelector('input[name="current_url"]').value=window.location.href,t.addEventListener("submit",s=>{s.preventDefault(),async function(t={},a=!1){const n=t instanceof FormData,o=n?t:new FormData;o.append("security",l),n||Object.entries(t).forEach(([t,e])=>{e instanceof File||e instanceof Blob||a||"object"!=typeof e||null===e?o.append(t,e):o.append(t,JSON.stringify(e))});try{const t=await fetch(e,{method:"POST",body:o});if((t.headers.get("Content-Type")||"").includes("application/json")){const e=await t.json();return{status:t.status,data:e}}const a=await t.text();return{status:t.status,data:a}}catch(t){return{status:0,error:t.message}}}({action:"ablocks/stripe_payment_process",block_id:a,current_post_id:n}).then(e=>{const a=e.data;a.success?"true"==o?window.open(a.data.redirect_url,"_blank"):window.open(a.data.redirect_url,"_self"):function(t,e){t.querySelector(".ablocks-stripe-button__error").innerHTML=e}(t,r)})})})})})();