PageSourceSearch

https://www.human.nl/_astro/NewsletterForm.astro_astro_type_script_index_0_lang.D8LW9Er9.js

js human.nl collected 2026-09-24 18:32:21 UTC 5,288 bytes, 1 lines download raw bytes

1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{};e.SENTRY_RELEASE={id:`[email protected]+main-production`},e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!=null)for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:human":!0});var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`bef4259e-f5e0-4ee1-ae7c-713656414185`,e._sentryDebugIdIdentifier=`sentry-dbid-bef4259e-f5e0-4ee1-ae7c-713656414185`)}catch{}})();import{t as e}from"./attemptViewTransition.CyOAljFL.js";import{t}from"./analyticsJavascriptEvents.Br92LbJz.js";var n=(e,t)=>{r(new CustomEvent(e,{detail:t}))};function r(e){if(window.__analyticsQueue__??=[],!window.__analyticsReady__){window.__analyticsQueue__.push(e);return}window.dispatchEvent(e)}var i=class extends HTMLElement{constructor(){super(),this.timeout=0,this.errorMessage=``,this.isRegistered=!1,this.newsletterId=this.dataset.analyticsNewsletterId||null,this.newsletterForm=this.querySelector(`.VillaNewsletter-form`),this.popoverHandler=this.querySelector(`.VillaNewsletter-formContainer`);let e=this.dataset.confirmationSelector;this.confirmationContainer=e?this.closest(e):this.querySelector(`[data-default-confirmation-container]`),this.formButton=this.newsletterForm?.querySelector(`.VillaNewsletter-button`),this.doSubmitForm=this.doSubmitForm.bind(this),this.insertErrorMessage=this.insertErrorMessage.bind(this),this.insertConfirmationMessage=this.insertConfirmationMessage.bind(this),this.newsletterForm?.addEventListener(`submit`,this.doSubmitForm)}connectedCallback(){new IntersectionObserver(([e],r)=>{e.isIntersecting&&e.intersectionRatio===1&&(n(t.newsletterFormView,{formCategory:`Form | Redactie`,formAction:`Form | View`,formName:`Form | Redactie | ${this.newsletterId}`}),r.disconnect())},{threshold:1}).observe(this),this.newsletterForm?.addEventListener(`input`,e=>{let r=e.target;r&&r.matches(`input, textarea`)&&n(t.newsletterFormStart,{formCategory:`Form | Redactie`,formAction:`Form | Start`,formName:`Form | Redactie | ${this.newsletterId}`})},{once:!0}),window.addEventListener(`pagehide`,()=>this.formButton?.removeAttribute(`data-loading`))}async doSubmitForm(t){t.preventDefault();let n=t.target;this.formAction=n.action,this.formData=new FormData(n),this.formButton?.toggleAttribute(`data-loading`,!0),await this.postForm(),this.formButton?.removeAttribute(`data-loading`),this.isRegistered&&(this.listenForResubmit(),e(this.insertConfirmationMessage)),this.errorMessage&&e(this.insertErrorMessage)}async postForm(){if(!this.formAction||!this.formData)return;let e=await fetch(this.formAction,{method:`POST`,body:this.formData,headers:{Accept:`application/json`}});if(!e.ok){this.errorMessage=`Er is iets misgegaan bij het aanmelden. Probeer het later opnieuw. (Foutcode: ${e.status})`,this.isRegistered=!1;return}let{registered:r}=await e.json();this.isRegistered=r,n(t.newsletterFormSubscribe,{formCategory:`Form | Redactie`,formAction:`Form | Submit | Success`,formName:`Form | Redactie | ${this.newsletterId}`})}insertConfirmationMessage(){let e=this.querySelector(`[data-template='success']`);this.confirmationContainer?.replaceChildren(e?.content.cloneNode(!0)),this.popoverHandler?.remove()}insertErrorMessage(){if(!this.popoverHandler){console.error(`Popover handler not found`);return}if(this.errorElement)this.errorElement.textContent=this.errorMessage;else{let e=this.querySelector(`[data-template='error']`);if(!e){console.error(`No error template found`);return}let t=e.content.cloneNode(!0);if(this.errorElement=t.querySelector(`.VillaNewsletter-error`),!this.errorElement){console.error(`No error element found in template`);return}this.errorElement.textContent=this.errorMessage,this.popoverHandler.append(this.errorElement)}this.activatePopover()}async resubmit(){if(!this.formData||!this.formAction){console.error(`formData or action not set`);return}if(this.popoverHandler=this.confirmationContainer?.querySelector(`.VillaNewsletter-resubmit`),!this.popoverHandler){console.error(`No popover handler element found`);return}this.popoverHandler.toggleAttribute(`data-loading`,!0),await this.postForm(),this.popoverHandler.toggleAttribute(`data-loading`,!1);let e=this.popoverHandler.querySelector(`.VillaNewsletter-popover`);if(!e){console.error(`No popover element found`);return}e.textContent=this.isRegistered?`We hebben de e-mail opnieuw verstuurd naar dit e-mailadres: ${this.formData.get(`email`)}`:this.errorMessage,this.activatePopover()}activatePopover(){clearTimeout(this.timeout),this.popoverHandler?.showPopover(),this.timeout=window.setTimeout(()=>{this.popoverHandler?.hidePopover()},5e3)}listenForResubmit(){if(!this.confirmationContainer){console.error(`Can't find data-confirmation-container attribute`);return}new MutationObserver((e,t)=>
1{for(let n of e)n.type===`childList`&&(n.target.querySelector(`button`)?.addEventListener(`click`,async()=>this.resubmit()),t.disconnect())}).observe(this.confirmationContainer,{childList:!0})}};customElements.define(`villa-newsletter-form`,i);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.