1"use strict";window.registration_form=function(e){return{init(){this.setMainSubscriptionTypeId(e),this.$watch((()=>this.formData),(()=>{setTimeout((()=>this.validateForm()),300)})),setTimeout((()=>this.initializeTooltip()),2e3)},initializeTooltip(){window.tippy(".tooltip-icon",{theme:"light",content:'<div class="tippy-content">De introductietarieven op deze site zijn alleen geldig voor nieuwe abonnees die de afgelopen 12 maanden geen abonnement hebben gehad. \n<a href="https://nd.nl/service/alle-abonnementen">Klik hier</a> voor het aanvragen van een regulier abonnement.</div>',interactive:!0,allowHTML:!0})},offer:{},hasOffer(){return!!this.offer.SubscriptionTypeId},setOffer(e){this.offer=e},subOffers(){var e,t;return(null==(t=null==(e=this.offer)?void 0:e.SubOffers)?void 0:t.filter((e=>"Variation"===e.SubOfferType)))||[]},hasSubOffers(){var e;return(null==(e=this.subOffers())?void 0:e.length)>0},subOffer:{},setSubOffer(e){this.subOffer=e},offerIsSubOffer(){var e,t;return!!(null==(t=null==(e=this.offer)?void 0:e.SubOffers)?void 0:t.find((e=>
1e.SubscriptionTypeId==this.selected_subscription_type_id)))},upsellOffer:{},hasUpsellOffer(){var e;return!!(null==(e=this.upsellOffer)?void 0:e.SubscriptionTypeId)},toggleUpsellOffer(){if(this.offerIsUpsellOffer())return this.resetSigningKey(),void this.setMainSubscriptionTypeId(e);this.hasUpsellOffer()&&(this.setMainSubscriptionTypeId(this.upsellOffer.SubscriptionTypeId),this.selectSubscriptionTypeId(this.upsellOffer.SubscriptionTypeId))},offerIsUpsellOffer(){var e,t;return(null==(e=this.offer)?void 0:e.SubscriptionTypeId)===(null==(t=this.upsellOffer)?void 0:t.SubscriptionTypeId)},subscription_type_id:null,_selected_subscription_type_id:null,get selected_subscription_type_id(){return this._selected_subscription_type_id},set selected_subscription_type_id(e){this.getSubOffer(e),this._selected_subscription_type_id=e},selectedOffer(){return this.offerIsSubOffer()?this.subOffer:this.offerIsUpsellOffer()?this.upsellOffer:this.offer},selectSubscriptionTypeId(e){this.selected_subscription_type_id=e},_upsellFromUrlApplied:!1,async setMainSubscriptionTypeId(e){var t,i;
1this.subscription_type_id=e,await this.getSubscriptionOffer(e),this.hasSubOffers()&&(this.selected_subscription_type_id=this.subOffers()[0].SubscriptionTypeId),this.hasUpsellOffer()||(this.upsellOffer=(null==(i=null==(t=this.offer)?void 0:t.SubOffers)?void 0:i.find((e=>"Upsell"===e.SubOfferType)))||this.upsellOffer);"true"!==new URLSearchParams(window.location.search).get("upsell")||!this.hasUpsellOffer()||this.offerIsUpsellOffer()||this._upsellFromUrlApplied||(this._upsellFromUrlApplied=!0,this.toggleUpsellOffer())},startDate(){return new Date(this.formData.startDateYear,this.formData.startDateMonth-1,this.formData.startDateDay)},startDateIsToday(){return this.startDate().toDateString()===(new Date).toDateString()},startDateLabel(){return this.startDateIsToday()?"Vandaag":this.startDate().toLocaleDateString("nl-NL",{day:"numeric",month:"long",year:"numeric"})},isVisible:!1,toggleBenefits:!1,contractIntervalString(){var e;if(!this.hasOffer())return"";return`${null==(e=this.selectedOffer().Display)?void 0:e.ContractInterval} ${this.selectedOffer().Display?{Years:"jaar",Months:"maanden",Days:"dagen"}[this.selectedOffer().Display.ContractIntervalType]:""}`},isLoading:!1,formHasBeenSubmittedOnce:!1,formData:{firstName:null,infix:null,lastName:null,postalCode:null,houseNumber:null,emailAddress:null,phoneNumber:null,startDateDay:(new Date).getDate(),startDateMonth:(new Date).getMonth()+1,startDateYear:(new Date).getFullYear(),iban:null,terms:null},submitForm(e){var t;if(this.formHasBeenSubmittedOnce=!0,this.isLoading&&e.preventDefault(),this.validateForm(),this.hasErrors())return e.preventDefault(),void(null==(t=this.$refs.main)||t.scrollIntoView({behavior:"smooth"}));this.isLoading=!0},errors:{},hasErrors(){return Object.keys(this.errors).length>0},hasError(e){return void 0!==this.errors[e]},clearError(e){var t,i;null==(t=this.$refs[e])||t.classList.remove("registration-form__group__row__field--invalid"),null==(i=this.$refs[e])||i.classList.remove("registration-form__group__row__field--valid")},addError(e,t){var i,n;this.errors[e]=t,null==(i=this.$refs[e])||i.classList.add("registration-form__group__row__field--invalid"),null==(n=this.$refs[e])||n.classList.remove("registration-form__group__row__field--valid")},addConfirmation(e){var t,i;null==(t=this.$refs[e])||t.classList.add("registration-form__group__row__field--valid"),null==(i=this.$refs[e])||i.classList.remove("registration-form__group__row__field--invalid")},clearErrors(){this.errors={}},validateField(e,t){const i=t.map((e=>e())).filter((e=>e));this.clearError(e),i.length>0?this.formHasBeenSubmittedOnce&&this.addError(e,i[0]):this.addConfirmation(e)},validateForm(){this.clearErrors(),console.log("validateForm"),this.validateField("firstName",[()=>{var e,t;return this.formData.firstName=null==(t=null==(e=this.formData)?void 0:e.firstName)?void 0:t.toUpperCase(),null},()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.firstName)?"Vul uw voorletters in":null}]),this.validateField("lastName",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.lastName)?"Vul uw achternaam in":null}]),this.validateField("postalCode",[()=>{var e,t;return this.formData.postalCode=null==(t=null==(e=this.formData)?void 0:e.postalCode)?void 0:t.trim(),null},()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.postalCode)?"Vul uw postcode in":null},()=>{var e;return this.isPostalCode(null==(e=this.formData)?void 0:e.postalCode)?null:"Vul een geldige postcode in"}]),this.validateField("houseNumber",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.houseNumber)?"Vul uw huisnummer in":null},()=>{var e,t;return this.isValidPostalCode(null==(e=this.formData)?void 0:e.postalCode,null==(t=this.formData)?void 0:t.houseNumber)?"Vul een geldig postcode + huisnummer in":null}]),this.validateField("emailAddress",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.emailAddress)?"Vul uw e-mailadres in":null},()=>{var e;return this.isEmail(null==(e=this.formData)?void 0:e.emailAddress)?null:"Vul een geldig e-mailadres in"}]),this.validateField("phoneNumber",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.phoneNumber)?"Vul uw telefoonnummer in":null},()=>{var e;return this.isPhoneNumber(null==(e=this.formData)?void 0:e.phoneNumber)?null:"Vul een geldig telefoonnummer in"}]),this.validateField("startDate",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.startDateDay)?"Vul een geldige startdatum in":null},()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.startDateMonth)?"Vul een geldige startdatum in":null},()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.startDateYear)?"Vul een geldige startdatum in":null},()=>{var e;return this.isValidStartDateDay(null==(e=this.formData)?void 0:e.startDateDay)?null:"Vul een geldige startdatum in"},()=>{var e;return this.isValidStartDateMonth(null==(e=this.formData)?void 0:e.startDateMonth)?null:"Vul een geldige startdatum in"},()=>{var e,t,i;return this.isValidStartDate(null==(e=this.formData)?void 0:e.startDateDay,null==(t=this.formData)?void 0:t.startDateMonth,null==(i=this.formData)?void 0:i.startDateYear)?"Kies een geldige datum die niet in het verleden ligt":null}]),this.validateField("startDateDay",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.startDateDay)?"Vul een geldige startdatum in":null},()=>{var e;return this.isValidStartDateDay(null==(e=this.formData)?void 0:e.startDateDay)?null:"Vul een geldige startdatum in"},()=>{var e,t,i;return this.isValidStartDate(null==(e=this.formData)?void 0:e.startDateDay,null==(t=this.formData)?void 0:t.startDateMonth,null==(i=this.formData)?void 0:i.startDateYear)?"Kies een geldige datum die niet in het verleden ligt":null}]),this.validateField("startDateMonth",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.startDateMonth)?"Vul een geldige startdatum in":null},()=>{var e;return this.isValidStartDateMonth(null==(e=this.formData)?void 0:e.startDateMonth)?null:"Vul een geldige startdatum in"},()=>{var e,t,i;return this.isValidStartDate(null==(e=this.formData)?void 0:e.startDateDay,null==(t=this.formData)?void 0:t.startDateMonth,null==(i=this.formData)?void 0:i.startDateYear)?"Kies een geldige datum die niet in het verleden ligt":null}]),this.validateField("startDateYear",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.startDateYear)?"Vul een geldige startdatum in":null},()=>{var e,t,i;return this.isValidStartDate(null==(e=this.formData)?void 0:e.startDateDay,null==(t=this.formData)?void 0:t.startDateMonth,null==(i=this.formData)?void 0:i.startDateYear)?"Kies een geldige datum die niet in het verleden ligt":null}]),this.validateField("iban",[()=>{var e;try{this.formData.iban=this.formData.iban=window.IBAN.printFormat(null==(e=this.formData)?void 0:e.iban)}catch(t){console.error("Error formatting IBAN:",t)}return null},()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.iban)?"Vul een geldig IBAN nummer in":null},()=>{var e;return this.isIban(null==(e=this.formData)?void 0:e.iban)?null:"Vul een geldig IBAN nummer in"}]),this.validateField("terms",[()=>{var e;return this.isEmpty(null==(e=this.formData)?void 0:e.terms)?"Accepteer de voorwaarden om de bestelling af te ronden":null}])},isEmpty:e=>
1null==e||""===e||!1===e,isEmail:e=>null==e?void 0:e.match(new RegExp('^(([^<>()\\[\\]\\\\.,;:\\s@"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@"]+)*)|(".+"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$')),isPhoneNumber:e=>null==e?void 0:e.match(new RegExp("^(?:\\D*\\d){9,}\\D*[^A-Za-z]*$")),isPostalCode:e=>null==e?void 0:e.match(new RegExp("^\\d\\d\\d\\d\\s?[a-zA-Z][a-zA-Z]$")),isValidPostalCode(e,t){if(!e||!t||(null==e?void 0:e.length)<6||(null==t?void 0:t.length)<1)return!1;const i=new XMLHttpRequest;i.open("POST","/api/adresvalideren",!1),i.setRequestHeader("Content-Type","application/json");const n=JSON.stringify({Postcode:e,Huisnummer:t});try{return i.send(n),200!==i.status&&(404===i.status||console.error("Unexpected server response:",i.status,i.responseText),!0)}catch(a){return console.error("Error during postal code validation:",a),!0}},isIban(e){if(!window.IBAN.isValid(e))return!1;const t=`https://openiban.com/validate/${e}?getBIC=true&validateBankCode=true`,i=new XMLHttpRequest;if(i.open("GET",t,!1),i.send(null),200!==!i.status)return!0;const n=JSON.parse(i.responseText);return console.log("heyy",n),n.valid},isValidStartDateDay:e=>e<=31&&e>0,isValidStartDateMonth:e=>e<=12&&e>0,isValidStartDate(e,t,i){if(!this.isValidStartDateDay(e))return!1;if(!this.isValidStartDateMonth(t))return!1;const n=new Date(this.formData.startDateYear,this.formData.startDateMonth-1,this.formData.startDateDay);if(!n)return!1;const a=new Date;return a.setHours(0,0,0,0),n<a},async getSubscriptionOffer(e){const t=await this.fetchSubscriptionOffer(e),i=await t.json();t.ok?(this.setOffer(i.SubscriptionOffer),this.setSigningKey(i.SigningKey)):console.error("Failed to send the subscription form:",i)},async getSubOffer(e){const t=await this.fetchSubscriptionOffer(e),i=await t.json();t.ok?this.setSubOffer(i.SubscriptionOffer):console.error("Failed to send the subscription form:",i)},_signingKey:null,get signingKey(){if(this._signingKey)return this._signingKey;return document.querySelector('input[name="SigningKey"]').value},setSigningKey(e){this._signingKey=e},resetSigningKey(){this._signingKey=null},async fetchSubscriptionOffer(e){const t={signingKey:this.signingKey,subscriptionTypeId:e,__RequestVerificationToken:document.getElementsByName("__RequestVerificationToken")[0].value},i={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)};return fetch("/api/v2/subscription-forms",i)}}},window.studentportal=function(){return{isInitialized:!1,isMobile:window.innerWidth<1024,resellerHasSubscriptions:!1,canceledSubName:"",showElement:!1,subscriptions:{},SortDirection:Alpine.$persist("Descending"),sortField:Alpine.$persist("StartDate"),IsActive:Alpine.$persist(null),search:null,keyword:Alpine.$persist(null),referralLink:null,currentPage:null,pageSize:50,newPageNumber:Alpine.$persist(1),endpoint:"/api/v2/subscriptions/",hostname:"https://"+window.location.hostname,async getSubscriptions(e){return fetch(e).then((e=>e.json())).then((e=>this.subscriptions=e)).catch((()=>{}))},buildApiUrl(){const e=new URL(this.endpoint,this.hostname),t={"Filter.Keyword":this.keyword,sortField:this.sortField,SortDirection:this.SortDirection,page:this.newPageNumber,pageSize:this.pageSize,"Filter.IsActive":this.IsActive,aggregateSubscriptions:"true"};for(const[i,n]of Object.entries(t))null!=n&&e.searchParams.set(i,n);return e},calculateTotalPages(){const e=Math.ceil(this.subscriptions.TotalCount/this.pageSize);return 0!=e?e:1},hasNextPage(){return this.newPageNumber+1<=this.calculateTotalPages()},hasPreviousPage(){return this.newPageNumber>1},goToNextPage(){this.newPageNumber+=1},goToPreviousPage(){this.newPageNumber-=1},convertDate:e=>new Date(e).toLocaleDateString("nl-NL",{day:"2-digit",month:"2-digit",year:"2-digit"}),handleSearchInput(){this.keyword=this.search,this.newPageNumber=1},setSortFieldAndSetSortDirection(e,t){this.sortField=e,this.SortDirection=t},showNoResult(){return 0==this.subscriptions.TotalCount},async validateCancellationStatus(e){const t=this.endpoint+e.SubscriptionId;return fetch(t,{method:"DELETE"}).then((e=>e.json())).catch((()=>{}))},async cancelSubscription(e){if(confirm("Weet je zeker dat je het abonnement van "+e.SubscriberName+" wilt stopzetten?")){const t=await this.validateCancellationStatus(e);t.IsSuccessful?pubbleUtility.createNotification("Het abonnement van "+e.SubscriberName+" is stopgezet"):"Subscription not found"==t.message?pubbleUtility.createNotification("Het abonnement van "+e.SubscriberName+" is niet gevonden."):"Subscription cannot be cancelled"==t.message&&pubbleUtility.createNotification("Het abonnement van "+e.SubscriberName+"kan niet worden stopgezet.")}},async subscriptionsExist(){const e=new URL(this.endpoint,this.hostname);return await fetch(e).then((e=>e.json())).then((e=>e.TotalCount))>0},async getReferralLink(){const e=this.endpoint+"redirect/json?forLinkedReseller=true";return fetch(e).then((e=>e.json())).then((e=>e.Url)).catch((()=>{}))},async copyReferralLink(){const e=new URL(this.referralLink,this.hostname);try{await navigator.clipboard.writeText(e),pubbleUtility.createNotification("Aanmeldlink is gekopieerd naar het klembord!")}catch(t){console.error("Failed to copy: ",t)}}
1,async init(){this.referralLink=await this.getReferralLink(),this.resellerHasSubscriptions=await this.subscriptionsExist(),this.search=this.keyword,await this.getSubscriptions(this.buildApiUrl()),this.isInitialized=!0}}},window.page_header=function(){return{init(){this.initSearchPane(),this.initUserDropdown(),this.initContainerHeights(),setTimeout((()=>this.initContainerHeights()),1e3),setTimeout((()=>this.initScroll()),1500)},scrollingDown:!1,scrollPosition:window.scrollY,topbarContainerHeight:0,menuFloating:!1,menuFloatingStart:!1,menuFloatingVisible:!1,initScroll(){window.addEventListener("scroll",this.onScroll.bind(this))},onScroll(){const e=window.scrollY;this.scrollingDown=e>this.scrollPosition,this.menuFloatingStart=e>this.menuContainerBottomHeight,this.menuFloatingStart?setTimeout((()=>{this.menuFloating=!0}),50):this.menuFloating=!1;const t=e<this.menuContainerBottomHeight&&e>this.topbarContainerHeight,i=!this.scrollingDown&&e<this.menuContainerBottomHeight&&this.menuFloatingVisible;this.menuFloatingVisible=!!i||!this.scrollingDown&&(t?e>this.menuContainerBottomHeight:e>this.topbarContainerHeight),this.scrollPosition=e},get showShortLogo(){return this.scrollingDown?this.scrollPosition>this.menuContainerBottomHeight:this.scrollPosition>this.topbarContainerHeight+30},isScrollingDown:!0,lastScrollPosition:0,menuContainerHeight:0,menuContainerBottomHeight:0,submenuContainerHeight:0,initContainerHeights(){this.topbarContainerHeight=this.$refs.topbarContainer.clientHeight+this.$refs.topbarContainer.offsetTop,this.menuContainerHeight=this.$refs.menuContainer.clientHeight,this.submenuContainerHeight=this.$refs.submenuContainer.clientHeight,this.menuContainerBottomHeight=this.$refs.menuContainer.clientHeight+this.topbarContainerHeight},defaultActiveSubmenu:null,activeSubmenu:null,setDefaultActiveSubmenu(e){this.defaultActiveSubmenu=e},toggleSubmenu(e){this.activeSubmenu!==e?this.activeSubmenu=e:this.activeSubmenu=null},openSubmenu(e){console.log("openSubmenu",window.innerWidth<1024),window.innerWidth<1024||(this.activeSubmenu=e)},closeSubmenu(){this.activeSubmenu=null},get currentSubmenu(){return this.activeSubmenu||this.defaultActiveSubmenu},get hasDefaultActiveSubmenu(){return this.defaultActiveSubmenu&&this.defaultActiveSubmenu.length>0},get isSubmenuOpen(){return!!this.isScrollingDown&&null!==this.currentSubmenu},searchPanelVisible:!1,searchQuery:"",initSearchPane(){-1!==window.location.href.indexOf("?zoekterm=")&&(this.toggleSearchPane(),this.searchQuery=new URLSearchParams(window.location.search).get("zoekterm"))},focusSearchInput(){setTimeout((()=>{this.$refs.searchInput.focus()}),50)},toggleSearchPane(){this.searchPanelVisible=!this.searchPanelVisible,this.searchPanelVisible&&this.focusSearchInput()},clearSearchQuery(){this.searchQuery="",this.focusSearchInput()},userDropdownVisible:!1,userDropdownCloseTimeout:null,initUserDropdown(){},closeUserDropdown(){this.userDropdownVisible=!1},openUserDropdown(e){if(this.userDropdownVisible)return;const t=this.$refs[e],i=this.$refs.userDropdown,n=t.getBoundingClientRect(),a=window.innerWidth-n.right-14;i.style.right=`${Math.max(0,a)}px`,i.style.minWidth=`${n.width}px`,i.style.display="block",this.userDropdownVisible=!0},toggleUserDropdown(e){switch(this.userDropdownVisible){case!0:this.closeUserDropdown();break;case!1:this.openUserDropdown(e)}},slideoverVisible:!1,toggleSlideover(){this.slideoverVisible=!this.slideoverVisible},closeSlideover(){this.slideoverVisible=!1},openSlideover(){this.slideoverVisible=!0}}},window.saved_articles=function(e){return{init(){console.log("Hoi Laura",e)},async toggle(){console.log("Nu wordt er getoggled");const t=await fetch(`/api/saved-articles/internetarticle/${e}/toggle`,{method:"PUT",body:new FormData}),i=await t.text();return"Created"===i?(pubbleUtility.createNotification('Artikel is opgeslagen. <a class="underline" href="/mijnleeslijst">Bekijk je opgeslagen artikelen</a>.'),void this.updateLocalStorage()):"Deleted"===i?(pubbleUtility.createNotification('Artikel is niet meer opgeslagen. <a class="underline" href="/mijnleeslijst">Bekijk je opgeslagen artikelen</a>.'),void this.updateLocalStorage()):void pubbleUtility.createNotification("Er is iets misgegaan. Probeer het later opnieuw.")},savedArticlesList:Alpine.$persist({}).as("nd:saved-articles"),updateLocalStorage(){e in this.savedArticlesList?delete this.savedArticlesList[e]:this.savedArticlesList[e]=!0},get isArticleSaved(){return e in this.savedArticlesList}}},window.read_aloud=function(){return{isActive:!1,async read(){this.isActive=!0;const e=document.getElementById("audio-placeholder");e.innerHTML="";const t=document.createElement("audio");t.setAttribute("id","player"),t.setAttribute("controls","");const i=document.createElement("source");i.setAttribute("src","?handler=spoken"),i.setAttribute("type","audio/mp3"),t.appendChild(i),e.appendChild(t),new Plyr("#player",{controls:["play","progress","current-time","mute","volume","settings"],settings:["speed"],speed:{selected:1,options:[.5,.75,1,1.25,1.5]}})}}},document.addEventListener("alpine:init",(()=>{Alpine.data("mijnnd_persoongegevens",(()=>({isInitialized:!1,isLoading:!1,isEditing:!1,alert:"",formData:{voornaam:"",tussenvoegsel:"",achternaam:"",email:"",telefoonNummer:"",telefoonNummerMobiel:""},viewFields(){return[{label:"Naam",value:`${this.formData.voornaam||""} ${this.formData.tussenvoegsel||""} ${this.formData.achternaam||""}`.trim(),skeleton:["nd-skeleton-sm","nd-skeleton-md"]},{label:"Email",value:this.formData.email,skeleton:["nd-skeleton-lg"]},{label:"Telefoon",value:this.formData.telefoonNummer,skeleton:["nd-skeleton-md"]},{label:"Mobiel",value:this.formData.telefoonNummerMobiel,skeleton:["nd-skeleton-md"]}]},editFields:()=>[{name:"voornaam",label:"Voornaam",type:"text",width:"nd-form-group-third",readonly:!1},{name:"tussenvoegsel",label:"Tussenvoegsel",type:"text",width:"nd-form-group-third",readonly:!1},{name:"achternaam",label:"Achternaam",type:"text",width:"nd-form-group-third",readonly:!1},{name:"email",label:"E-mailadres",type:"email",width:"nd-form-group-full",disabled:!1},{name:"telefoonNummer",label:"Telefoonnummer",type:"text",width:"nd-form-group-half",readonly:!1},{name:"telefoonNummerMobiel",label:"Mobiel",type:"text",width:"nd-form-group-half",readonly:!1}
1],async init(){await this.loadData()},async loadData(){return this.isLoading=!0,fetch("/api/mijnnd/mijngegevens").then((e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((e=>{this.isInitialized=!0,this.formData={...e},Alpine.store("loading",!1)})).catch((e=>{this.alert="Er is een fout opgetreden bij het laden van uw gegevens."})).finally((()=>{this.isLoading=!1}))},toggleEdit(){this.isEditing=!this.isEditing,this.alert=""},async save(){const e={method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.formData)};this.isLoading=!0,fetch("/api/mijnnd/mijngegevens",e).then((e=>e.ok?this.loadData():e.text().then((e=>{throw new Error(e)})))).then((()=>{window.pubbleUtility.createNotification("<b>Persoonsgegevens bijgewerkt</b>","Uw persoonsgegevens zijn bijgewerkt.",3e3),this.toggleEdit()})).catch((e=>{this.alert=e.message||"Er is een fout opgetreden bij het opslaan van uw gegevens."})).finally((()=>{this.isLoading=!1}))},cancel(){this.loadData().then((()=>{this.toggleEdit()}))}}))),Alpine.data("mijnnd_adresgegevens",(()=>({isInitialized:!1,isLoading:!1,isEditing:!1,alert:"",successMessage:"",formData:{adres:{postcode:"",huisnummer:"",huisnummerToevoeging:"",straat:"",woonplaats:"",ingangsdatum:(new Date).toISOString().split("T")[0]},isCompleet:!1},verhuizing:null,viewFields(){return[{label:"Adres",value:`${this.formData.adres.straat||""} ${this.formData.adres.huisnummer||""} ${this.formData.adres.huisnummerToevoeging||""} <br> ${this.formData.adres.postcode||""} ${this.formData.adres.woonplaats||""}`,skeleton:["nd-skeleton-sm","nd-skeleton-md","nd-skeleton-md","nd-skeleton-sm"]}]},editFields(){return[{name:"postcode",label:"Postcode",type:"text",width:"nd-form-group-full",readonly:!1,onInput:()=>this.validateAdres()},{name:"huisnummer",label:"Huisnummer",type:"text",width:"nd-form-group-half",readonly:!1,onInput:()=>this.validateAdres()},{name:"huisnummerToevoeging",label:"Toevoeging",type:"text",width:"nd-form-group-half",readonly:!1,onInput:()=>this.validateAdres()},{name:"straat",label:"Straat",type:"text",width:"nd-form-group-half",readonly:!0,disabled:!0},{name:"woonplaats",label:"Woonplaats",type:"text",width:"nd-form-group-half",readonly:!0,disabled:!0},{name:"ingangsdatum",label:"Ingangsdatum",type:"date",width:"nd-form-group-full",readonly:!1,min:()=>{let e=new Date;return e.setDate(e.getDate()+4),e.toISOString().split("T")[0]}}]},async init(){await Promise.all([this.loadAdres(),this.loadVerhuizing()]);let e=new Date;e.setDate(e.getDate()+4),this.formData.adres.ingangsdatum=e.toISOString().split("T")[0],this.isInitialized=!0},toggleEdit(){this.isEditing=!this.isEditing,this.alert=""},async loadAdres(){return this.isLoading=!0,fetch("/api/mijnnd/adres").then((e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((e=>{this.formData={...e}})).catch((e=>{this.alert="Er is een fout opgetreden bij het laden van uw adresgegevens."})).finally((()=>{this.isLoading=!1}))},async loadVerhuizing(){return this.isLoading=!0,fetch("/api/mijnnd/verhuizing").then((e=>{if(e.ok)return e.json()})).then((e=>{e&&(this.verhuizing=e)})).catch((e=>{console.error("Failed to load verhuizing:",e)})).finally((()=>{this.isLoading=!1}))},async validateAdres(){if(this.formData.adres.huisnummer.length<1||this.formData.adres.postcode.length<6)return;this.isLoading=!0;const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({huisnummer:this.formData.adres.huisnummer,postcode:this.formData.adres.postcode})};return fetch("/api/adresvalideren",e).then((e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((e=>{this.formData.adres.straat=e.straat,this.formData.adres.woonplaats=e.plaats,this.alert=""})).catch((e=>{this.formData.adres.straat="",this.formData.adres.woonplaats=""})).finally((()=>{this.isLoading=!1}))},formatDate(e){if(!e)return"";const t=e.match(/^(\d{2})-(\d{2})-(\d{4})$/);return(t?new Date(t[3],t[2]-1,t[1]):new Date(e)).toLocaleDateString("nl-NL",{day:"2-digit",month:"2-digit",year:"numeric"})},async save(){this.isLoading=!0;const e={method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(this.formData.adres)},t=this.formData.adres.ingangsdatum;return fetch("/api/mijnnd/adres",e).then((e=>{if(!e.ok)return e.text().then((e=>{throw this.alert=e,new Error(e)}));const t=201===e.status;return this.loadAdres().then((()=>t?this.loadVerhuizing().then((()=>({isVerhuizing:t}))):{isVerhuizing:t}))})).then((({isVerhuizing:e})=>{e?this.successMessage=`Je adreswijziging is verwerkt en gaat in o
1p ${this.formatDate(t)}. Je ontvangt hierover binnenkort een e-mail.`:window.pubbleUtility.createNotification("<b>Adresgegevens bijgewerkt</b>","Uw adresgegevens zijn bijgewerkt.",3e3),this.toggleEdit()})).catch((e=>{this.alert="Er is een fout opgetreden bij het opslaan van uw adresgegevens."})).finally((()=>{this.isLoading=!1}))},cancel(){this.init().then((()=>{this.toggleEdit()}))}}))),Alpine.data("mijnnd_accountgegevens",(()=>({isInitialized:!1,alert:"",init(){this.isInitialized=!0},async wijzigWachtwoord(){return this.isLoading=!0,fetch("/api/mijnnd/mijngegevens/wachtwoord-vergeten").then((e=>{if(!e.ok)throw new Error("Network response was not ok");this.alert="Er is een e-mail verstuurd met een link om uw wachtwoord te wijzigen."})).catch((e=>{this.alert="Er is een fout opgetreden bij het wijzigen van uw wachtwoord."})).finally((()=>{this.isLoading=!1}))},async saveAdres(){this.isLoading=!0;const e={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({huisnummer:this.formData.huisnummer,postcode:this.formData.postcode})};fetch("/api/adres/",e).catch((e=>{this.alert="Er is een fout opgetreden bij het opslaan van uw adresgegevens."})).finally((()=>{this.isLoading=!1}))},logOut(){localStorage.setItem("openweb_logout_trigger","true"),window.location.href="/login/signout"}}))),Alpine.data("mijnnd_betaalgegevens",(()=>({isInitialized:!1,isLoading:!1,alert:"",formData:{rekeningIbanNummer:""},async init(){await this.loadData()},async loadData(){return this.isLoading=!0,fetch("/api/mijnnd/betaalgegevens").then((e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()})).then((e=>{this.isInitialized=!0,this.formData={...e},Alpine.store("loading",!1)})).catch((e=>{this.alert="Er is een fout opgetreden bij het laden van uw gegevens."})).finally((()=>{this.isLoading=!1}))}})))})),document.addEventListener("alpine:init",(()=>{Alpine.data("overzicht",(()=>({isLoading:!1,alert:"",displayName:"",async init(){await this.loadData()},async loadData(){try{const e=await fetch("/api/mijnnd");if(!e.ok)throw new Error("Network response was not ok");const t=await e.json();
1this.displayName=`Welkom ${t.displayName}!`,Alpine.store("loading",!1),this.initialized=!0}catch(e){console.error("There has been a problem with your fetch operation:",e),this.alert="Er is een fout opgetreden bij het laden van de gegevens."}}}))),Alpine.data("veelgesteldeVragen",(()=>({firstAccordion:!1,secondAccordion:!1,thirdAccordion:!1,fourthAccordion:!1,async init(){},toggleAccordion(e){switch(e){case"first":this.firstAccordion=!this.firstAccordion;break;case"second":this.secondAccordion=!this.secondAccordion;break;case"third":this.thirdAccordion=!this.thirdAccordion;break;case"fourth":this.fourthAccordion=!this.fourthAccordion}}})))})),document.addEventListener("alpine:init",(()=>{Alpine.data("mijnnd_mijnabonnement",(()=>({isLoading:!1,alert:"",showOpzeggenModal:!1,async init(){await this.loadData(),window.addEventListener("abonnement-updated",(()=>this.loadData()))},viewItems:[],async loadData(){try{this.isLoading=!0;const e=await fetch("/api/mijnnd/abonnement");if(!e.ok)throw new Error("Network response was not ok");const t=await e.json(),i=[];if(t.forEach((e=>{i.push({type:e.abonnementType,fields:[{label:"Abonnementnummer",value:e.abonnementnummer},{label:"Startdatum",value:e.startdatum},{label:"Einddatum",value:e.einddatum??"-"}]})})),this.viewItems=i,t.length>0&&t[0].startdatum){const e=this.isWithin14Days(t[0].startdatum),i=!1!==t[0].canCancelWithin14Days;this.showOpzeggenModal=e&&i}else this.showOpzeggenModal=!1}catch(e){console.error("Failed to load subscription data:",e),this.alert="Er is een fout opgetreden bij het laden van de gegevens. Probeer het later opnieuw."}finally{this.isLoading=!1}},isWithin14Days(e){if(!e)return!1;try{const t=e.split("-");if(3!==t.length)return!1;const i=parseInt(t[0],10),n=parseInt(t[1],10)-1,a=parseInt(t[2],10),s=new Date(a,n,i);s.setHours(0,0,0,0);const r=new Date;r.setHours(0,0,0,0);const o=r-s,l=Math.floor(o/864e5);return l>=0&&l<=14}catch(t){return console.error("Error parsing date:",t),!1}}}))),Alpine.data("mijnnd_opzeggen_check",(()=>
1({showModal:!1,async init(){try{const e=await fetch("/api/mijnnd/abonnement");if(!e.ok)return void(this.showModal=!1);const t=await e.json();if(t.length>0&&t[0].startdatum){const e=this.isWithin14Days(t[0].startdatum),i=!1!==t[0].canCancelWithin14Days;this.showModal=e&&i}else this.showModal=!1}catch(e){console.error("Failed to load subscription data for opzeggen check:",e),this.showModal=!1}},isWithin14Days(e){if(!e)return!1;const t=e.split("-");if(3!==t.length)return!1;const i=parseInt(t[0],10),n=parseInt(t[1],10)-1,a=parseInt(t[2],10),s=new Date(a,n,i);s.setHours(0,0,0,0);const r=new Date;r.setHours(0,0,0,0);const o=Math.floor((r-s)/864e5);return o>=0&&o<=14}})))})),document.addEventListener("alpine:init",(()=>{Alpine.data("calamiteiten",(()=>({isInitialized:!1,isLoading:!1,viewItems:[],async init(){await this.loadData()},async loadData(){try{this.isLoading=!0;const e=await fetch("/api/mijnnd/calamiteiten");if(!e.ok)throw new Error("Network response was not ok");(await e.json()).forEach((e=>{this.viewItems.push(e)})),this.isLoading=!1}catch(e){console.error("FAILED to load form data:",e),this.alert="Er is een fout opgetreden bij het laden van de gegevens. Probeer het later opnieuw."}}})))})),document.addEventListener("alpine:init",(()=>{Alpine.data("mijnndFacturen",(()=>({isInitialized:!1,isLoading:!1,alert:"",viewItems:[],async init(){await this.loadData()},formatPeriode(e){var t,i;if(!(null==(i=null==(t=e.subtotaalInfo)?void 0:t.subtotaal)?void 0:i[0]))return"";return`${new Date(e.subtotaalInfo.subtotaal[0].periodeVan).toLocaleDateString("nl-NL",{day:"2-digit",month:"2-digit",year:"numeric"})} - ${new Date(e.subtotaalInfo.subtotaal[0].periodeTm).toLocaleDateString("nl-NL",{day:"2-digit",month:"2-digit",year:"numeric"})}`},formatDate:e=>e?new Date(e).toLocaleDateString("nl-NL",{day:"numeric",month:"long",year:"numeric"}):"",formatCurrency:e=>`â¬${Number(e).toLocaleString("nl-NL",{minimumFractionDigits:2,maximumFractionDigits:2})}`,async loadData(){try{this.isLoading=!0;const e=await fetch("/api/mijnnd/facturen");if(!e.ok)throw new Error("Network response was not ok");const t=await e.json();this.viewItems=t.map((e=>({...e,formattedDatum:this.formatDate(e.factuurDatum),formattedPeriode:this.formatPeriode(e),formattedBedrag:this.formatCurrency(e.totaalInclBtw),downloadUrl:`/api/mijnnd/facturen/${e.factuurNo}/download`}))),this.isLoading=!1}catch(e){console.error("FAILED to load form data:",e),this.alert="Er is een fout opgetreden bij het laden van de gegevens. Probeer het later opnieuw."}}})))})),document.addEventListener("alpine:init",(()=>{Alpine.data("mijnnd_mijnabonnement_faq",(()=>({firstAccordion:!1,secondAccordion:!1,toggleAccordion(e){switch(e){case"first":this.firstAccordion=!this.firstAccordion;break;case"second":this.secondAccordion=!this.secondAccordion}}})))})),document.addEventListener("alpine:init",(()=>{Alpine.data("bedrijfsportaalFacturen",(()=>({isLoading:!1,alert:"",viewItems:[],async init(){await this.loadData()},formatPeriode(e){var t,i;if(!(null==(i=null==(t=e.subtotaalInfo)?void 0:t.subtotaal)?void 0:i[0]))return"";return`${new Date(e.subtotaalInfo.subtotaal[0].periodeVan).toLocaleDateString("nl-NL",{day:"2-digit",month:"2-digit",year:"numeric"})} - ${new Date(e.subtotaalInfo.subtotaal[0].periodeTm).toLocaleDateString("nl-NL",{day:"2-digit",month:"2-digit",year:"numeric"})}`},formatDate:e=>e?new Date(e).toLocaleDateString("nl-NL",{day:"numeric",month:"long",year:"numeric"}):"",formatCurrency:e=>null==e||isNaN(Number(e))?"":`â¬${Number(e).toLocaleString("nl-NL",{minimumFractionDigits:2,maximumFractionDigits:2})}`,async loadData(){try{this.isLoading=!0;const e=await fetch("/api/bedrijfsportaal/facturen");if(!e.ok)throw new Error("Network response was not ok");const t=await e.json();this.viewItems=t.map((e=>({...e,formattedDatum:this.formatDate(e.factuurDatum),formattedPeriode:this.formatPeriode(e),formattedBedrag:this.formatCurrency(e.totaalInclBtw),downloadUrl:`/api/bedrijfsportaal/facturen/${e.factuurNo}/download`}))),this.isLoading=!1}catch(e){console.error("FAILED to load facturen:",e),this.alert="Er is een fout opgetreden bij het laden van de gegevens. Probeer het later opnieuw.",this.isLoading=!1}}})))}));
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.