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