!function(){"use strict";var t={145:function(t,r,n){function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=Array(r);n3?(o=y===e)&&(a=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=p&&((o=n<2&&pe||e>y)&&(i[4]=n,i[5]=e,d.n=y,c=0))}if(o||n>1)return u;throw l=!0,e}return function(o,f,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&p(f,y),c=f,a=y;(r=c<2?t:a)||!l;){i||(c?c<3?(c>1&&(d.n=-1),p(c,a)):d.n=a:d.v=a);try{if(s=2,i){if(c||(o="next"),r=i[o]){if(!(r=r.call(i,a)))throw TypeError("iterator result is not an object");if(!r.done)return r;a=r.value,c<2&&(c=0)}else 1===c&&(r=i.return)&&r.call(i),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((r=(l=d.n<0)?a:n.call(e,d))!==u)break}catch(r){i=t,c=1,a=r}finally{s=1}}return{value:r,done:l}}}(n,o,i),!0),f}var u={};function s(){}function f(){}function l(){}r=Object.getPrototypeOf;var d=[][e]?r(r([][e]())):(c(r={},e,function(){return this}),r),p=l.prototype=s.prototype=Object.create(d);function y(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,l):(t.__proto__=l,c(t,o,"GeneratorFunction")),t.prototype=Object.create(p),t}return f.prototype=l,c(p,"constructor",l),c(l,"constructor",f),f.displayName="GeneratorFunction",c(l,o,"GeneratorFunction"),c(p),c(p,o,"Generator"),c(p,e,function(){return this}),c(p,"toString",function(){return"[object Generator]"}),(i=function(){return{w:a,m:y}})()}function c(t,r,n,e){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}c=function(t,r,n,e){function i(r,n){c(t,r,function(t){return this._invoke(r,n,t)})}r?o?o(t,r,{value:n,enumerable:!e,configurable:!e,writable:!e}):t[r]=n:(i("next",0),i("throw",1),i("return",2))},c(t,r,n,e)}document.addEventListener("DOMContentLoaded",function(){var t=hostinger_reach_subscription_block_data.translations;document.querySelectorAll(".hostinger-reach-block-subscription-form").forEach(function(r){var n=r.querySelector(".reach-subscription-message"),c=r.querySelector(".reach-subscription-message__icon"),a=r.querySelector(".reach-subscription-message__text"),u=r.querySelector(".hostinger-reach-block-form-fields");r.addEventListener("submit",function(s){s.preventDefault();var f=r.querySelector('button[type="submit"]'),l=new FormData(r),d={};l.forEach(function(t,r){if(r.includes(".")){var n=r.split("."),e=(0,o.A)(n,2),i=e[0],c=e[1];d[i]||(d[i]={}),d[i][c]=t}else d[r]=t}),f.disabled=!0,fetch(hostinger_reach_subscription_block_data.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":hostinger_reach_subscription_block_data.nonce},body:JSON.stringify(d)}).then(function(){var o=(0,e.A)(i().m(function e(o){var s;return i().w(function(e){for(;;)switch(e.n){case 0:if(n.style.display="flex",r.reset(),!o.ok){e.n=1;break}a.textContent=t.thanks,n.classList.add("is-success"),u.style.display="none",c.style.display="block",e.n=4;break;case 1:return e.n=2,o.json();case 2:if(!(s=e.v).errors){e.n=3;break}a.textContent=s.errors,n.style.display="block",n.classList.add("is-error"),f.disabled=!1,e.n=4;break;case 3:throw new Error;case 4:return e.a(2)}},e)}));return function(_x){return o.apply(this,arguments)}}()).catch(function(r){n.textContent=t.error,n.style.display="block",f.disabled=!1})})})})}(); //# sourceMappingURL=subscription-view.js.map