PageSourceSearch

https://www.belastingdienst.nl/bld-assets/bld/webcomponents/bld-webcomponents.js

js belastingdienst.nl collected 2026-09-24 08:25:49 UTC 120,123 bytes, 1 lines download raw bytes

1!function(){"use strict";!function(){const t=({acc:t,prod:n})=>({GMSBaseURLs:{acc:t,prod:n},wcmPreviewUrl:e()}),e=()=>({beta:"https://beta-t.belastingdienst.nl",www:"https://www-t.belastingdienst.nl"}),n=t=>{let e=window.location.host.split(".",1);return 0===e[0].indexOf("dxp")?0===e[0].indexOf("dxp-content")||0===e[0].indexOf("dxp-staging")?t.wcmPreviewUrl.www:t.wcmPreviewUrl.beta:""},o=t=>{let e=window.location.host.split(".",1);return 0===e[0].indexOf("dxp-content")||0===e[0].indexOf("dxp-contentn")||0===e[0].indexOf("dxp-staging")||0===e[0].indexOf("dxp-stagingn")||"www-o"===e[0]||"www-on"===e[0]||"www-t"===e[0]||"www-tn"===e[0]||"www-m"===e[0]||"www-mn"===e[0]||"www"===e[0]||"www-n"===e[0]||"prod"===i()?t.GMSBaseURLs.prod:t.GMSBaseURLs.acc},i=()=>{const t=window.location.search;let e=new URLSearchParams(t);return e.has("genesys")&&"prod"===e.get("genesys")?"prod":"acc"};function r(){const t=window.location.search;let e=new URLSearchParams(t);return!(!e.has("bld-debug")||"true"!==e.get("bld-debug"))}const a=(t,e={},n)=>{if(t&&"string"==typeof t&&t.length>0){let o=document.createElement(t);if(Object.keys(e).length>0)for(const t in e){const n=e[t];o.setAttribute(t,n)}return n&&"string"==typeof n&&n.length>0&&(o.innerHTML=n),o}console.error("Error in createHTMLElement(), <elemName> is not defined.")},s=t=>{const{jsonPathLocal:e,jsonPathWcm:n,projectID:o}=t;if([e,n].every((t=>"string"==typeof t&&t.length>0))){const t=new URL(window.location.href),{protocol:i,hostname:r,port:a,pathname:s}=t;if("localhost"===r)return i+"//"+r+(a.length>0?":"+a:"")+(0===e.indexOf("/")?"":"/")+e;if(r.endsWith(".belastingdienst.nl")){const t=/(^\/wps\/wcm\/(my)?connect)\//g,e=s.match(t)[0];return i+"//"+r+(a.length>0?":"+a:"")+e+(0===n.indexOf("/")?"":"/")+n+(o&&o.length>0?`?projectid=${o}`:"")}}else console.error("Error in utils.setWCMJsonUrl(), properties in <config>  doesn't meet the requirements.")};class c extends HTMLElement{constructor(){super(),this.version="1.1.0",this.autoUpdate=this.checkForAutoUpdate(),this.debug=this.checkForDebug(),this.isCompact=!1,this.updater=null,this.attachShadow({mode:"open"}),this._data={lastUpdate:{},queuetimeDataUrl:"/data/queuetime/cciwebstats.json",queuetimeDebugDataUrl:"/bld-assets/bld/webcomponents/debug/queue_time/cciwebstats-debug-statuses.json",genesys:{currentDepartmentCode:"",departments:{name:"departments",data:{},hasReceivedData:!1},department:{name:"department",data:{},hasReceivedData:!1}},WCM:{data:{},hasReceivedData:!1,jsonUrl:s({jsonPathLocal:"data/wcm/bld-beltel-queue-time.json",jsonPathWcm:"cci-content/wachtrijtijden-beltel/bld-beltel-queue-time.json",projectID:""})},hostServerUrl:"",cssPath:"/bld-assets/bld/webcomponents/bld-webcomponents.css",cssUrl:"",error:{state:"",defaultError:{title:"Er is een fout opgetreden.",text:"Het is op dit moment niet mogelijk om de wachttijd op te halen."}},defaultInterval:6e4,debugInterval:1e3,interval:{time:0,counter:0}},this.setUrls(),this.setIntervalAutoUpdateTime()}async connectedCallback(){try{if(await this.getQueuetimeData(),!this._data.genesys.departments.hasReceivedData)throw new Error("Error in getQueuetimeData(): No departments received");if(await this.getJSONFromWCM(),!this._data.WCM.hasReceivedData)throw new Error("No WCM data received");if(!this.checkWCMContent())throw new Error("Error in checkWCMContent(): <bld-beltel-queue-time.json> doesn't meet the requirements.");if(this.createTemplate(),0===this.template.innerHTML.length)throw new Error("Skillgroup not found");this.shadowRoot.appendChild(this.template.content.cloneNode(!0)),this.addEventListenerToElements()}catch(t){console.error("Error",t)}}checkForAutoUpdate(){return"false"!==new URL(document.location).searchParams.get("bld-autoupdate")}checkForDebug(){return"true"===new URL(document.location).searchParams.get("bld-debug")}setIntervalAutoUpdateTime(){const t=new URL(document.location).searchParams.get("bld-interval-time");!t||isNaN(t)?this.debug?this._data.interval.time=this._data.debugInterval:this._data.interval.time=this._data.defaultInterval:this._data.interval.time=parseInt(t)}setUrls(){const{hostServerUrl:e}=((e={})=>{const i=t(e);return{GMSBaseURL:o(i),hostServerUrl:n(i)}})();this._data.hostServerUrl=e,this._data.cssUrl=`${e}${this._data.cssPath}`,this._data.queuetimeDataFetchUrl=this.getQueuetimeDataFetchUrl()}getQueuetimeDataFetchUrl(){let t=this._data.queuetimeDataUrl;return this.debug&&(t=this._data.queuetimeDebugDataUrl),t=(()=>{const t=new URL(window.location.href),{hostname:n,pathname:o}=t;if(!o.includes("/wps/wcm/myconnect/"))return"";const i=e();return n.startsWith("dxp-content")||n.startsWith("dxp-staging")?i.www:i.beta})()+t,t}async getJSONFromWCM(){await fetch(this._data.WCM.jsonUrl).then((t=>{if(!t.ok)throw Error(t.statusText);return t.json()})).then((t=>{this._data.WCM.data=t,this._data.WCM.hasReceivedData=!0}
1)).catch((t=>{console.error("Error in getJSONFromWCM():",t),this._data.WCM.hasReceivedData=!1}))}checkWCMContent(){if(!this._data.WCM.data.queueTimeData)return!1;const{intro:{title:t,selectDepartment:{label:e}},queueTimeData:{labelQueueTime:n,suffixQueueTime:o,suffixQueueTimeSingular:i,insertionQueueTime:r,labelOpeningTime:a,suffixOpeningTime:s,insertionOpeningTime:c,labelPhoneNumber:l}}=this._data.WCM.data;return[t,e,a,s,c,n,o,i,r,l].every((t=>"string"==typeof t&&t.length>0))}createTemplate(){if(this.template=document.createElement("template"),this.template.innerHTML=`\n    <style>\n      @import '${this._data.cssUrl}';\n    </style>\n    `,this.getAttribute("department"))return this.isCompact=!0,void(this.template.innerHTML+=this.createTemplateSingleDeptartment());this.template.innerHTML+=this.createTemplateAllDepartments()}createTemplateSingleDeptartment(){const t=this.getAttribute("department"),e=this._data.genesys.departments.data.find((e=>this.debug?e:e.code===t));if(!e)return"";this.debug?this._data.genesyscurrentDepartmentCode=this._data.genesys.departments.data[0].code:this._data.genesyscurrentDepartmentCode=t,this._data.genesyscurrentPhone=e.phone,this.ShowDataAndSetAutoUpdate();let n="";this.debug&&!this.autoUpdate&&(n=this.getSelectForDebugSingleDeptartment());return`\n      <div class="${this.getClassNames()}">\n        <bldc-grid disable-padding="true">\n            <bldc-grid-row>\n                <bldc-grid-column disable-padding="true">\n                  <div class="bld_beltel_queue_time_result" role="region" id="bld_beltel_queue_time_result" aria-live="polite"></div>\n                  <div class="bld_beltel_queue_time_error"></div>\n                </bldc-grid-column>\n            </bldc-grid-row>\n        </bldc-grid>\n      </div>\n      ${n}\n    `}getSelectForDebugSingleDeptartment(){return`\n    <bldc-grid disable-padding="true">\n      <bldc-grid-row>\n        <bldc-grid-column disable-padding="true">\n          <bldc-select-box\n            data="${JSON.stringify(this.setDepartmentsOptions()).replaceAll('"',"&quot;")}"\n            class="bld_beltel_queue_time_select"\n          >\n            <span slot="label">Selecteer de gewenste situatie t.b.v. debugging</span>\n          </bldc-select-box>\n        </bldc-grid-column>\n      </bldc-grid-row>\n    </bldc-grid>\n`}createTemplateAllDepartments(){const t=this._data.WCM.data,e=JSON.stringify(this.setDepartmentsOptions()).replaceAll('"',"&quot;");return`\n        <div class="${this.getClassNames()}">\n            <bldc-grid disable-padding>\n                <bldc-grid-row>\n                    <bldc-grid-column col="8" md="12" disable-padding style="margin-bottom: 1rem;">\n                        <bldc-heading level="2" size="xl" color="#154273">${t.intro.title}</bldc-heading>\n                    </bldc-grid-column>\n                </bldc-grid-row>\n                <bldc-grid-row>\n                    <bldc-grid-column col="8" md="12" disable-padding style="margin-bottom: 1rem;">\n                        <bldc-select-box class="bld_beltel_queue_time_select" data="${e}" placeholder="${t.intro.selectDepartment.placeholder}" aria-controls="bld_beltel_queue_time_result" required="false">\n                            <span slot="label">${t.intro.selectDepartment.label}</span>\n                        </bldc-select-box>\n                    </bldc-grid-column>\n                </bldc-grid-row>\n                <bldc-grid-row>\n                    <bldc-grid-column col="8" md="12" disable-padding>\n                        <div class="bld_beltel_queue_time_result" role="region" id="bld_beltel_queue_time_result" aria-live="polite"></div>\n                    </bldc-grid-column>\n                </bldc-grid-row>\n                <bldc-grid-row>\n                    <bldc-grid-column col="8" md="12" disable-padding style="margin-bottom: 1rem;">\n                        <div class="bld_beltel_queue_time_error"></div>\n                    </bldc-grid-column>\n                </bldc-grid-row>\n            </bldc-grid>\n        </div>\n        `}getClassNames(){const t=document.body.classList.values().find((t=>t.includes("bld-theme")));
1return[this.isCompact?"bld_beltel_queue_time_container_compact":"bld_beltel_queue_time_container",t].filter((t=>t)).join(" ")}setDepartmentsOptions(){return this._data.genesys.departments.data.map((({displayname:t,code:e})=>({title:t,value:e})))}addEventListenerToElements(){(!this.isCompact||this.debug&&!this.autoUpdate)&&this.shadowRoot.querySelector(".bld_beltel_queue_time_select").addEventListener("bldcValueChange",(t=>{!t.detail?.bldcValue?.length>0||(this._data.genesyscurrentDepartmentCode=t.detail.bldcValue,this.ShowDataAndSetAutoUpdate())}))}ShowDataAndSetAutoUpdate(){this._data.interval.counter=0,clearInterval(this.updater),this.getAndShowData(),!0===this.autoUpdate&&this.runAutoUpdate()}runAutoUpdate(){this._data.interval?.time>=1e3&&(this.updater=setInterval((()=>{this._data.interval.counter++,this.debug&&console.log("runAutoUpdate",this._data.interval.counter),this.checkForUpdate()}),this._data.interval.time))}async checkForUpdate(){await this.setData(this._data.genesyscurrentDepartmentCode),this.getMinutesRoundedUp(this._data.genesys.department.data.awt)===this.getMinutesRoundedUp(this._data.lastUpdate.awt)&&this._data.genesys.department.data.openinghours===this._data.lastUpdate.openinghours&&this._data.genesys.department.data.isopen===this._data.lastUpdate.isopen||this.setResult()}async getAndShowData(){await this.setData(this._data.genesyscurrentDepartmentCode),this._data.error.state?.length>0||this.setResult()}getMinutesRoundedUp(t){if(!t?.length>0)return;const[e,n,o]=t.split(":"),i=1e3*(60*+e*60+60*+n+ +o);return Math.ceil(i/6e4)}getFormattedQueueTime(t){const{suffixQueueTime:e,suffixQueueTimeSingular:n,insertionQueueTime:o}=this._data.WCM.data.queueTimeData,i=this.getMinutesRoundedUp(t),r=Math.floor(i/60),a=i-60*r,s=1===a?n:e;return r>=1?`${r}${o}${a}${s}`:`${a}${s}`}clearElementBasedOnClass(t){this.shadowRoot.querySelector(t)&&this.shadowRoot.querySelector(t).querySelectorAll("*").forEach((t=>t.remove()))}async getQueuetimeData(){let t=this._data.queuetimeDataFetchUrl;this.debug&&(t=this.doChangesForDebugINeeded()),await fetch(t).then((e=>{if(!e.ok)throw Error(`${t}  ${e.status} (${e.statusText})`);return e.json()})).then((t=>{this._data.genesys.departments.data=t,this._data.genesys.departments.hasReceivedData=!0})).catch((t=>{this.showErrorNotification("no-response-for-department"),console.error("Error in getQueuetimeData: ",t),this._data.genesys.departments.hasReceivedData=!1}))}doChangesForDebugINeeded(){return"errorInFetch"===this._data?.genesyscurrentDepartmentCode?"FOUTE-URL":this.getQueuetimeDataFetchUrl()}async setData(t){if(!t?.length>0)return;if(this.debug&&!0===this.autoUpdate&&(t=this.modifyDepartmentCodeForDebug()),this.clearErrorStateAndContainer(),this._data.genesys.department.data={},await this.getQueuetimeData(),!this._data.genesys.departments.hasReceivedData)return;const e=this._data.genesys.departments.data.find((e=>e.code===t));if("string"!=typeof e.awt||"string"!=typeof e.openinghours||"boolean"!=typeof e.isopen)throw this.showErrorNotification("error-in-response-for-department"),Error(`Error in departmentData for ${t}. Format not as expected.`);this._data.genesys.department.data=e,this._data.genesys.department.hasReceivedData=!0}modifyDepartmentCodeForDebug(){return this._data.interval.counter>=3&&this._data.interval.counter<6?"open-2":this._data.interval.counter>=6&&this._data.interval.counter<10?"openTodayButNotNow":this._data.interval.counter>=10&&this._data.interval.counter<15?"closedWholeDay":this._data.interval.counter>=15&&this._data.interval.counter<20?"errorInData":this._data.interval.counter>=20&&this._data.interval.counter<25?"errorInFetch":"open-1"}setResult(){this.clearElementBasedOnClass(".bld_beltel_queue_time_result"),this._data.lastUpdate=this._data.genesys.department.data;const{awt:t,openinghours:e,isopen:n}=this._data.genesys.department.data;this.isCompact&&this.appendPhoneContainer(),n?this.showQueueTime(t):"00:00:00"===t&&!1===n&&e.length>0&&this.showOutsideOpeningHoursOfToday(),e.length>0&&!this.isCompact&&this.showOpeninghours(),"00:00:00"!==t||""!==e||n||this.showClosedToday(),this.isCompact||this.showAdditionalText()}showQueueTime(t){const{labelQueueTime:e}=this._data.WCM.data.queueTimeData,n=this.getFormattedQueueTime(t),o=this.getIconColor();
1if(this.isCompact){const t=`<bldc-icon icon="klok" size="22" color="${o}" style="float:left; margin-right:0.5rem"></bldc-icon>`;this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("div",{class:"bld_beltel_queue_time_compact_result_awt"},`${t}${this._data.WCM.data.queueTimeData.labelQueueTime}${n}`))}else this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("bldc-paragraph",{"disable-margin":!0},`${e}<span class="bld_beltel_queue_time_result-item">${n}</span>`))}getIconColor(){return document.body.classList.contains("bld-theme-tsl")?"#42145f":"#154273"}showOutsideOpeningHoursOfToday(){const{outsideOpeningHoursOfToday:t}=this._data.WCM.data.queueTimeData;this.isCompact?this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("div",{"disable-margin":!0,class:"bld_beltel_queue_time_compact_result_awt"},t)):this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("bldc-paragraph",{"disable-margin":!0},t))}showOpeninghours(){const{labelOpeningTime:t,insertionOpeningTimes:e}=this._data.WCM.data.queueTimeData,{openinghours:n}=this._data.genesys.department.data,o=this.getFormatAllOpeninghours(n).join(e);this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("bldc-paragraph",{"disable-margin":!0},`${t}${o}`))}showClosedToday(){const{closedToday:t}=this._data.WCM.data.queueTimeData;this.isCompact?this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("div",{"disable-margin":!0,class:"bld_beltel_queue_time_compact_result_awt"},t)):this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("bldc-paragraph",{"disable-margin":!0},t))}showAdditionalText(){const{additionalText:t}=this._data.WCM.data.queueTimeData;!t?.length>0||this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",a("bldc-paragraph",{"disable-margin":!0},t))}clearErrorStateAndContainer(){this._data.error.state="",this.clearElementBasedOnClass(".bld_beltel_queue_time_error")}appendPhoneContainer(){const t=this._data.genesyscurrentPhone,e=a("div",{"disable-margin":!0,class:"bld_beltel_queue_time_compact_result_phone"},`${this._data.WCM.data.queueTimeData.labelPhoneNumber}${t}`);this.shadowRoot.querySelector(".bld_beltel_queue_time_result").insertAdjacentElement("beforeend",e)}getFormatAllOpeninghours(t){const{insertionOpeningTime:e,suffixOpeningTime:n}=this._data.WCM.data.queueTimeData;let o=t.split(",");return o.forEach(((t,o,i)=>{let r=t.split("-");r.forEach(((t,e,n)=>{n[e]=t.replace(/^0/,"")}));const[a,s]=r;i[o]=`<span class="bld_beltel_queue_time_result-item">${a}${e}${s}</span><span aria-hidden="true">${n}</span>`})),o}showErrorNotification(t){if(this._data.error.state===t)return;let e;if(this._data.WCM.data.errors?.[t]){const{title:n,text:o}=this._data.WCM.data.errors[t];e=[n,o].every((t=>"string"==typeof t&&t.length>0))?this._data.WCM.data.errors[t]:this._data.error.defaultError}else e=this._data.error.defaultError;this.clearElementBasedOnClass(".bld_beltel_queue_time_result"),this.clearErrorStateAndContainer(),this.shadowRoot.querySelector(".bld_beltel_queue_time_error").insertAdjacentElement("beforeend",a("bldc-notification",{type:"error","elem-title":e.title},e.text)),this._data.error.state=t}}const l=t=>!!t&&t.some((t=>"ReqAns"===t.Type)),d=t=>{for(;t.firstChild;)t.removeChild(t.firstChild);return t};class u{constructor(){this.create=({Title:t,Body:e},n,o)=>{const i=n.closest(".bldSurveyMainContainer");d(i);const r=document.createElement("div");r.classList.add("bldSurvey-confirmationContainer");const a=document.createElement("bldc-notification");a.setAttribute("type","succes"),a.setAttribute("elem-title",t),a.innerText=e,r.append(a),i.append(r),o.setAttribute("surveysend",!0),o.setAttribute("confirmation-text",e)}}}const h={ChooseOne:class{constructor(){this.create=({Choices:t,Body:e,Id:n,CustomProperties:o})=>{const i=this.createRadioButtonGroup(n,o),r=this.createLegend(e),a=this.createRadioButtons(t,i);return i.append(r),a.forEach((t=>i.append(t))),i}}createRadioButtonGroup(t,e){const n=document.createElement("bldc-radiobutton-group");return this.getCustomProperties(e).includes("boxed")&&n.setAttribute("boxed","true"),n.setAttribute("id",t),n.setAttribute("name",t),n.classList.add("bldSurvey-input"),n}getCustomProperties(t){return(null==t?void 0:t.length)?t.map((({Name:t})=>t)):[]}createLegend(t){const e=document.createElement("span");return e.setAttribute("slot","legend"),e.innerText=t,e}createRadioButtons(t,e){return t.map((({Value:t,Label:n,Selected:o})=>{const i=document.createElement("bldc-radiobutton");return i.setAttribute("value",t),i.setAttribute("boxed","true"),i.innerText=n,o&&e.setAttribute("bldc-value",t),i}))}},Essay:class{constructor(){this.create=({Id:t,Body:e,Value:n,Instructions:o,Validations:i},r)=>{const a=this.createTextArea(t,n,o,i,r),s=this.createLabel(e);return a.append(s),a}}createTextArea(t,e,n,o,i){const r=document.createElement("bldc-textarea");r.classList.add("bldSurvey-input");const a={id:t,name:t,required:l(o),"max-characters":"350"};
1Object.entries(a).forEach((([t,e])=>r.setAttribute(t,e))),n&&r.setAttribute("explanation-text",n),e&&r.setAttribute("bldc-value",e);return r.setAttribute("validators",JSON.stringify([{name:"custom:personSpecificValidation"}])),r}createLabel(t){const e=document.createElement("span");return e.setAttribute("slot","label"),e.innerText=t,e}},ShortAnswer:class{constructor(){this.create=({Body:t,Id:e,Responses:n,Instructions:o,Validations:i},r)=>this.createTextInput(e,n,o,i,r,t)}createTextInput(t,e,n,o,i,r){const a=e[0].Id,s=document.createElement("bldc-input");s.classList.add("bldSurvey-input");const c=this.createLabel(r);s.append(c);const d={id:t,name:a,required:l(o)};Object.entries(d).forEach((([t,e])=>s.setAttribute(t,e))),s.dataset.responseId=a,n&&s.setAttribute("explanation-text",n),e[0].Value&&s.setAttribute("bldc-value",e[0].Value);return s.setAttribute("validators",JSON.stringify([{name:"custom:personSpecificValidation"}])),s}createLabel(t){const e=document.createElement("span");return e.setAttribute("slot","label"),e.innerHTML=t,e}}};var m=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class p{dispatch(t,e,n){const o=new CustomEvent("metrixEFMSurveyApi",{detail:{el:e,event:t,efmUrl:n}});window.dispatchEvent(o)}}var b=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class v{constructor(){this.create=(t,e,n)=>{const{Buttons:o}=t,i=this.createButtonContainer();return this.createButtons(o,e,t,n).forEach((t=>i.append(t))),i}}createButtons(t,e,n,o){return Object.entries(t).map((([t,i])=>{const r=this.createButton(t,i);if(r)return this.setSubmitEvents(r,e,t,n,o),r}))}createButton(t,e){const n=document.createElement("bldc-button");switch(n.setAttribute("elem-title",e),t){case"next":n.setAttribute("slot","right"),n.setAttribute("type","primary");break;case"back":n.setAttribute("slot","left"),n.setAttribute("type","secondary");break;case"submit":n.setAttribute("slot","right"),n.setAttribute("type","primary"),n.setAttribute("icon","verzend"),n.setAttribute("icon-pos","right")}return n}createButtonContainer(){const t=document.createElement("bldc-buttonbar");return t.setAttribute("disable-padding","true"),t.setAttribute("background-color","transparent"),t}setSubmitEvents(t,e,n,o,i){t.addEventListener("bldcClick",(t=>b(this,void 0,void 0,(function*(){t.preventDefault();const r=yield(t=>m(void 0,void 0,void 0,(function*(){const e=t.querySelectorAll("bldc-input, bldc-textarea, bldc-radiobutton-group"),n=Array.from(e).map((t=>m(void 0,void 0,void 0,(function*(){return"BLDC-INPUT"===t.nodeName?(t.bldcValidateValue(),yield t.bldcGetValid()):(yield t.doValidate(),t.valid)}))));return!(yield Promise.all(n)).some((t=>!t))})))(e);r&&(_(n,o,e,i),(new p).dispatch("survey_ended",i))}))))}}const g=(t,e,n)=>{const o=function(t,e,n){const{Elements:o}=t;if(!Array.isArray(o))return[];const i=o.map((e=>{if(!h[e.Type])return void console.warn("Type is not valid:",e.Type);const n=y(e.Id),o=new h[e.Type];if(!(null==o?void 0:o.create))return;const i=o.create(e,t.SurveyId);return i?(o.setCustomEvents&&o.setCustomEvents(i),n.insertAdjacentElement("afterbegin",i),n):void 0})).filter((t=>t)),r=(new v).create(t,e,n);return[...i,r]}(t,e,n);o.forEach((t=>{e.append(t)}))},f=t=>{const e=document.createElement("div");return e.setAttribute("id",`bldSurvey-${t}`),e.classList.add("bldSurveyMainContainer"),e},w=()=>{const t=document.createElement("bldc-form");return t.classList.add("bldSurveyForm"),t};const y=t=>{const e=document.createElement("div");return e.setAttribute("id",`${t}-inputContainer`),e.classList.add("bldSurvey-inputContainer"),e};
1var C=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};const S={method:"GET",cache:"no-cache",headers:{accept:"application/json"}},_=(t,{SurveyId:e,SessionKey:n,CurrentPageId:o,surveyUrl:i},a,s)=>{const c={SurveyId:e,SessionKey:n,CurrentPageId:o,data:x(a),Action:t};fetch(i,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}).then((t=>t.json())).then((t=>{if("Submit"===t.CurrentPageId){(new u).create(t,a,s)}else((t,e,n)=>{d(e),g(t,e,n)})(Object.assign(Object.assign({},t),{surveyUrl:i}),a,s);r()&&console.log("Success:",t)})).catch((t=>{a.remove(),T(a),console.error("Error:",t)}))},x=t=>{const e=t.querySelectorAll(".bldSurvey-input"),n={};if(e.length)return e.forEach((t=>{var e;return n[null!==(e=t.dataset.responseId)&&void 0!==e?e:t.id]=t.bldcValue})),n},T=t=>{const e=document.createElement("bldc-notification");e.setAttribute("type","error"),e.setAttribute("elem-title","Sorry"),e.innerText="Door een technische storing kunt u op dit moment geen gebruik maken van deze functionaliteit. Wilt u het later nog eens proberen? Onze excuses voor het ongemak.",t.insertAdjacentElement("afterend",e)};var k=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class E extends HTMLElement{constructor(){super(),this.version="2.0.0",this.attachShadow({mode:"open"}),this.hostPaths={beta:"https://beta-t.belastingdienst.nl",www:"https://www-t.belastingdienst.nl"}}connectedCallback(){return k(this,void 0,void 0,(function*(){const t=this.getAttribute("surveyUrl");if(!t)return;this.loadCSSInShadowRoot();const e=this.createLoader();this.shadowRoot.append(e);const n=yield(o={url:t,component:this},C(void 0,[o],void 0,(function*({url:t,param:e=S,component:n}){return yield fetch(t,e).then((t=>{if(!t.ok)throw Error(t.statusText);return t.json()})).catch((t=>{T(n),console.error("Error:",t)}))})));var o;if(r()&&console.log("this.surveyData",n),!n)return;e.remove();const i=((t,e)=>{const n=f(t.SurveyId),o=w();return g(t,o,e),n.append(o),n})(Object.assign(Object.assign({},n),{surveyUrl:t}),this);this.shadowRoot.append(i),(new p).dispatch("survey_started",this)}))}loadCSSInShadowRoot(){const t=document.createElement("style");t.innerText=`@import '${this.setHostServerUrl(this.hostPaths)}/bld-assets/bld/webcomponents/bld-webcomponents.css`,this.shadowRoot.append(t)}createLoader(){const t=document.createElement("div");t.classList.add("bld-loader-container");const e=document.createElement("div");return e.classList.add("bld-loader"),t.append(e),t}setHostServerUrl(t){const[e]=window.location.host.split(".",1);return e.startsWith("dxp")?e.startsWith("dxp-content")||e.startsWith("dxp-staging")?t.www:t.beta:""}}const D=t=>[...t.map((t=>t.htmlTag)),...A().map((t=>t.nodeName.toLowerCase()))],A=()=>{const t=document.evaluate("//*[starts-with(name(),'bldc-')]",document,null,XPathResult.ANY_TYPE,null);if(!t)return[];let e=[],n=null;for(;n=t.iterateNext();)e.push(n);return e},L=()=>{const t=768,e=1024,n=1240;return window.matchMedia("(min-width: "+n+"px)").matches?"lg":window.matchMedia("(min-width: "+e+"px)").matches?"md":window.matchMedia("(min-width: "+t+"px)").matches?"sm":"xs"},P={viewportSize:L,isViewportSize:function(t){return L()===t},getURLParameter:function(t,e){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");const n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)").exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null},removeSpecialChars:function(t){return t=t.replace(/&/g,"&amp;").replace(/</g,"").replace(/]/g,"").replace(/\[/g,"").replace(/\=/g,"").replace(/>/g,"").replace(/'/g," ").replace(/"/g,"").replace(/’/g," ").replace(/\./g," ")},trim:function(t){return t=t.replace(/(\s+$)|(^\s+)/g,"")},environment:()=>{const t=window.location.hostname.split(".belastingdienst.nl")[0],e={beta:["beta","beta-o","beta-t","beta-m"],delta:["delta","delta-o","delta-t","delta-m"],acc:["www-o.acc","www-t.acc","www-m.acc","www.acc","beta.acc","beta-o.acc","beta-t.acc","beta-m.acc","delta.acc","delta-o.acc","delta-t.acc","delta-m.acc"],wcm:["dxp-templates","dxp-tdelivery","dxp-tdstaging","dxp-content","dxp-staging"],test:["localhost"]};for(const n in e)if(e[n].includes(t))return n;return"live"},isWebpackEnviroment:()=>"webpackHotUpdatebelastingdienst"in window,isNewWebsite:()=>!!document.querySelector("app-root"),getScript:(t,e)=>{let n=!1;const o=document.createElement("script");o.src=t,o.type="text/javascript",o.onload=o.onreadystatechange=function(){n||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(n=!0,"function"==typeof e&&e())},o.onerror=function(){return console.log("==> Cannot load",t),!1},document.body.appendChild(o)},getOuterHeight:t=>{const{marginTop:e,marginBottom:n}=getComputedStyle(t);return t.getBoundingClientRect().height+parseFloat(e)+parseFloat(n)},getSiblings:t=>{const e=t.parentElement;return e?[...e.children].filter((e=>e!==t)):[]},getElementVisibilityPercentage:t=>{let e=0;
1const{top:n,bottom:o,left:i,right:r,height:a,width:s}=t.getBoundingClientRect(),{innerHeight:c,innerWidth:l}=window,d=Math.max(0,Math.min(o,c)-Math.max(n,0))*Math.max(0,Math.min(r,l)-Math.max(i,0)),u=s*a;return u&&d?(e=d/u*100,e):e}};function R(){const t=window.location;let e="/";return 0===t.pathname.indexOf("/wps/wcm/myconnect/")&&(e=t.host.indexOf("templates.belastingdienst.nl")>-1||t.host.indexOf("tdstaging.belastingdienst.nl")>-1?"https://beta-t.belastingdienst.nl/":"https://www-t.belastingdienst.nl/"),e}const M=(t,e)=>new Promise((n=>{const o=Date.now(),i=setInterval((()=>{const r=t.split(".");let a=window;for(const t of r){if(!a||"object"!=typeof a||!(t in a)){a=void 0;break}a=a[t]}"function"==typeof a?(clearInterval(i),n(!0)):Date.now()-o>e&&(clearInterval(i),console.warn(`Timeout: ${t} niet gevonden.`),n(!1))}),100)}));window.getScript=P.getScript,window.setHost=R,window.utilEnvironment=P.environment;class z{static validate(t,e){if((null==t?void 0:t.length)>0){const n=/^((\+|00(\s|\s?-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9])((\s|\s?-\s?)?[0-9])((\s|\s?-\s?)?[0-9])\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]$/g;if(!t.match(n))return{valid:!1,message:e[0]||"Vul een correct Nederlands telefoonnummer in.",threshold:2}}return{valid:!0}}}z.NAME="custom:dutchPhoneNumberValidation";class O{constructor(t){this.cases=t??{}}validateSome(t){return Object.values(this.cases).some(this.testRegex(` ${t} `))}testRegex(t){return e=>e.test(t)}}const q={email:/(([A-Za-z0-9_\-\.]+)@([A-Za-z0-9_\-\.]+)\.([A-Za-z]{2,5}))/,iban:/([A-Za-z]{2}[\s\.]?\d{2}[\s\.]?[A-Za-z0-9]{4}[\d\s\.]{6,10}[^\d])/,aanslagNummer:/(\d{3,4}\.\d{2,3}\.\d{2,4}\.[A-Za-z]\.?\d{1,2}(\.\d{2,4})?)[^\d]/,postalCode:/([^\d]([1-9]\d{3}[A-Za-z]{2}|([13-9]\d{3}|2[1-9]\d{2})\s[A-Za-z]{2})[^A-Za-z0-9])/,phone:/([^\d]\+?\d{2,16}(\(\d{1,3}\))?([\s\-]?\d{1,6})?[\s\-]?(\d{5}|20[4-9]\d|2[1-9]\d{2}|[13-9]\d{3}|\s\d{3}|\d\s\d{2}|\d{2}\s\d)[^\d])/};class N{static validate(t,e){if((null==t?void 0:t.length)>0){if(!!new O(q).validateSome(t))return{valid:!1,message:e[0]||"U mag hier geen persoonlijke gegevens invullen.",threshold:2}}return{valid:!0}}}N.NAME="custom:personSpecificValidation";var F=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};const j={urls:{mainJSON:{local:{nl:"/data/wcm/productenoverzicht/nl/productenoverzicht.json",de:"/data/wcm/productenoverzicht/de/produktubersicht.json",en:"/data/wcm/productenoverzicht/en/product-overview.json"},preview:{nl:"/wps/wcm/myconnect/nl/productenoverzicht/settings/productenoverzicht.json",de:"/wps/wcm/myconnect/de/produktubersicht/settings/produktubersicht.json",en:"/wps/wcm/myconnect/en/product-overview/settings/product-overview.json"},webserver:{nl:"/wps/wcm/connect/nl/productenoverzicht/settings/productenoverzicht.json",de:"/wps/wcm/connect/de/produktubersicht/settings/produktubersicht.json",en:"/wps/wcm/connect/en/product-overview/settings/product-overview.json"}},css:"bld-assets/bld/webcomponents/bld-webcomponents.css"},dataMapping:{datum:"datePub",jaar:"j",middel:"m",titel:"t"},filterFormatTypeMapping:{producten:"RadioButtonGroup",doelgroep:"CheckboxGroup",onderwerp:"CheckboxGroup",middel:"CheckboxGroup",jaar:"CheckboxGroup"},doelgroepMapping:{Business:"cb",Customs:"cc","Douane voor bedrijven":"cdb","Douane voor particulieren":"cdp",Individuals:"cin",Intermediair:"ci",Ondernemer:"co",Particulier:"cp",Privatpersonen:"cpp","Stichting en vereniging":"cs",Unternehmen:"cu",Werkgever:"cw"},itemsPerPage:25,dateFormatOptions:{year:"numeric",month:"2-digit",day:"2-digit"},timeFormatOptions:{hour:"2-digit",minute:"2-digit"},dateFormatter:Intl.DateTimeFormat(),timeFormatter:Intl.DateTimeFormat(),dateLanguages:{nl:"nl-NL",en:"en-GB",de:"de-DE"},sortOptionMapper:{datum:"sorteeroptieDatum",jaar:"sorteeroptieJaar",titel:"sorteeroptieTitel",middel:"sorteeroptieMiddel"},popoverMapping:{doelgroep:"d",belastingjaar:"j",belastingmiddel:"m"},textsNoMainData:{nl:{errorNoJsonTitle:"Er is iets mis gegaan.",errorNoJsonText:"We konden de benodigde gegevens niet ophalen. Ververs de pagina of probeer het later nog eens."},en:{errorNoJsonTitle:"There is something wrong.",errorNoJsonText:"We could not retrieve the required data. Please refresh the page or try again later."},de:{errorNoJsonTitle:"Da ist etwas schiefgelaufen.",errorNoJsonText:"Wir konnten die erforderlichen Daten nicht abrufen. Bitte aktualisieren Sie die Seite oder versuchen Sie es später erneut."}},sessionStorageKey:"bldProductOverzicht",illustrations:{noItems:"/bld-assets/bld/webcomponents/svg/productenoverzicht-no-results.svg"}},I=t=>j.sortOptionMapper[t],B=t=>{window.dispatchBldMetrixDynamic&&window.dispatchBldMetrixDynamic("bld-productenoverzicht","metrixBoldEvents",{context:t})},$=(t,e)=>e.map((e=>{return e.startsWith("d")?(n=new Date(t[e]),`${j.dateFormatter.format(n)} ${j.timeFormatter.format(n)}`):t[e];var n})).join(" ");
1var U=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};const V=t=>Object.entries(t.filterDataState).reduce(((t,[e,n])=>{const o=H(n);return Object.assign(Object.assign({},t),{[e]:o})}),{}),H=t=>t.reduce(((t,e)=>e.active&&e.checked?[...t,e.value]:t),[]),W=(t,e)=>{if("onderwerp"===e){return t.d.split("|").reduce(((e,n)=>{const o=j.doelgroepMapping[n];return t[o]?[...e,...t[o].split("|")]:e}),[])}const n=e,o=j.popoverMapping[n];return t[o].split("|")},G=t=>{const{filterDataState:e}=t.settings;Object.entries(e).forEach((([e,n])=>{const o=n.filter((t=>t.checked));o.length&&o.forEach((({value:n})=>{var o;const i=`bldc-checkbox[filtername="${e}"][value="${n}"]`;(null===(o=t.shadowRoot)||void 0===o?void 0:o.querySelector(i)).bldcValue="true";(null===document||void 0===document?void 0:document.querySelector(`bldc-modal[elemid="modal-filter-and-sort"] ${i}`)).bldcValue="true"}))}))},J=t=>{var e;const n=sessionStorage.getItem(j.sessionStorageKey);return!!n&&(null===(e=JSON.parse(n))||void 0===e?void 0:e.currentProductUrlPara)===t},K=()=>{const t=sessionStorage.getItem(j.sessionStorageKey);return JSON.parse(t)},Q=t=>{const e=window.location.search;return new URLSearchParams(e).get(t)},Z=(t,e)=>{if(!t)return!1;return e.some((e=>(null==e?void 0:e.urlPara)===t))},Y=(t,e,n)=>U(void 0,void 0,void 0,(function*(){var o;const i=e.filter((t=>t.urlPara===n));if(!i.length)return;const[r]=i,a=r.jsonpath,s=null===(o=t.shadowRoot)||void 0===o?void 0:o.querySelector('bldc-popover[filtername="product"]');if(!s)return;const c=null==s?void 0:s.querySelector(`bldc-radiobutton[value="${a}"]`);c&&(nt(c),yield X())})),X=()=>new Promise((t=>{const e=n=>{window.removeEventListener("product-data-loaded",e),t(n)};window.addEventListener("product-data-loaded",e)})),tt=(t,e)=>{const{doelgroepMapping:n}=j,o=t.split(",").map((t=>{var o;const i=Object.keys(n).find((e=>n[e]===t));if(!i)return;const r=null===(o=e.shadowRoot)||void 0===o?void 0:o.querySelector('bldc-popover[filtername="doelgroep"]');if(!r)return;const a=null==r?void 0:r.querySelector(`bldc-checkbox[value="${i}"]`);return a?nt(a):void 0}));return Promise.all(o)},et=(t,e)=>{const n=t.split(",").map((t=>{var n;const o=null===(n=e.shadowRoot)||void 0===n?void 0:n.querySelector('bldc-popover[filtername="onderwerp"]');if(!o)return;const i=null==o?void 0:o.querySelector(`bldc-checkbox[filtervalue="${t.toLowerCase()}"]`);return i?nt(i):void 0}));return Promise.all(n)},nt=t=>U(void 0,void 0,void 0,(function*(){const e=e=>{if(t){const e=t.shadowRoot?t.shadowRoot.querySelector("input"):t.querySelector("input");if(e)return e.click(),!0}return!1};setTimeout((()=>{if(e(document))return;new MutationObserver(((t,n)=>{e(document)&&n.disconnect()})).observe(document.body,{childList:!0,subtree:!0})}),1500)})),ot=()=>{const t=performance.getEntriesByType("navigation");if(t.length>0){if("navigate"===t[0].type)return!1}return!0},it=(t,e,n)=>{n.shadowRoot.querySelectorAll(`[id="filter-${e}"] bldc-checkbox`).forEach((n=>{const o=t.find((t=>t.value===n.value));if(!1===o.active&&!0===o.checked){n.bldcValue="",o.checked=!1;document.querySelector(`bldc-modal [id="modal-filter-${e}"] bldc-checkbox[value="${o.value}"]`).bldcValue=""}}))},rt=t=>Object.values(t).flat(1/0).some((t=>!0===t.checked)),at=(t,e)=>t.items.reduce(((t,n)=>{const o=W(n,e);return Array.from(new Set([...t,...o]))}),[]),st=(t,e,n)=>{n?ct(t):t.forEach((t=>{t.active=e.some((e=>e===t.value))}))},ct=t=>t.forEach((t=>{t.active=!0})),lt=(t,e,n)=>{[...n.shadowRoot.querySelectorAll(`[id="filter-${e}"] bldc-checkbox`),...document.querySelectorAll(`bldc-modal [id="modal-filter-${e}"] bldc-checkbox`)].forEach((e=>{const n=t.find((t=>t.value===e.value)),o=(null==n?void 0:n.active)?"block":"none";e.style.display=o}))},dt=(t,e)=>{const n=t.querySelector("bldc-button"),o=`${ut(n)} ${ht(t,e)}`;n.setAttribute("elem-title",o)},ut=t=>{const[e]=t.getAttribute("elem-title").split("(");return e.trimEnd()},ht=(t,e)=>{const n=t.getAttribute("filtername"),o=e.settings.filterDataState[n];if(!o)return"";const i=o.filter((({active:t,checked:e})=>t&&e)).length;return i?`(${i})`:""},mt=t=>(new DOMParser).parseFromString(t,"text/html").documentElement.textContent,pt=(t,e)=>{t&&e&&(Array.isArray(t)?e.forEach((({type:e,callback:n})=>t.forEach((t=>t.addEventListener(e,n))))):e.forEach((({type:e,callback:n})=>t.addEventListener(e,n))))};class bt{constructor(t,e){this.data=t,this.events=e}build(){return this.createCard(this.data)}createCard(t){const{heading:e,href:n,paragraph:o,icon:i,padding:r,extraAttributes:a}=t;if(!e||!n)throw new Error("Missing required properties");const s=this.createCardContainer(n,e,r,a);return pt(s,this.events),o&&(s.innerHTML=o),i&&s.setAttribute("icon",i),s}createCardContainer(t,e,n="md",o){const i=document.createElement("bldc-card"),r=Object.assign({href:t,heading:e,padding:n,role:"listitem","internal-link":!this.isExterneLink(t)},o);return Object.entries(r).forEach((([t,e])=>
1i.setAttribute(t,"string"==typeof e?mt(e):String(e)))),i}isExterneLink(t){try{const e=window.location.origin;return new URL(t,e).origin!==e}catch(t){return!1}}}class vt{constructor(t,e){this.overzichtComponent=t,this.data=e}displayItems(t=1){const{items:e}=this.data,n=this.filterItems(e,t),o=this.createCards(n),i=this.overzichtComponent.shadowRoot.querySelector(".overzicht__cards");this.removeOldItems(),this.addCardsInDOM(o),this.overzichtComponent.settings.currentPage=t,this.setDataInSessionStorage(),B(i)}setDataInSessionStorage(){const{currentSorting:t,currentPage:e,currentProductUrlPara:n,filterDataState:o}=this.overzichtComponent.settings;if(!(rt(this.overzichtComponent.settings.filterDataState)||t||e>1))return;const i=JSON.stringify({currentSorting:t,currentPage:e,currentProductUrlPara:n,filterDataState:o});sessionStorage.setItem(j.sessionStorageKey,i)}removeOldItems(){const t=this.overzichtComponent.shadowRoot.querySelector(".overzicht__cards");t&&(t.innerHTML="")}filterItems(t,e){const n=this.overzichtComponent.settings.itemsPerPage,o=(e-1)*n,i=e*n;return t.slice(o,i)}createCards(t){const e=(t=>{const e=t.filter((t=>"titel"!==t)),{dataMapping:n}=j;return e.map((t=>n[t]))})(this.overzichtComponent.settings.currentSorting.opties);return t.map((t=>new bt({heading:t.t,href:t.u,paragraph:$(t,e)}).build()))}addCardsInDOM(t){t.forEach((t=>this.overzichtComponent.shadowRoot.querySelector(".overzicht__cards").appendChild(t)))}}var gt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};
1const ft=t=>gt(void 0,void 0,void 0,(function*(){return yield fetch(t).then((t=>t.json())).catch((t=>console.error(t)))}));var wt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class yt{getMaindata(t){return wt(this,void 0,void 0,(function*(){const e=this.getMainJsonUrl(t);return yield ft(e)}))}getMainJsonUrl(t){const e=window.location.href;return e.includes("/wps/wcm/myconnect/")?j.urls.mainJSON.preview[t]:e.includes("http://localhost")?j.urls.mainJSON.local[t]:j.urls.mainJSON.webserver[t]}}const Ct=({data:t,opties:e,sortKey:n,sortOrder:o="ascending"})=>{const i=xt(e,n),r=t.items;i.forEach(((t,e)=>{0!==e?"descending"!==o?St(r,t):_t(r,t):St(r,t)}))},St=(t,e)=>{t.sort(((t,n)=>t[e].localeCompare(n[e])))},_t=(t,e)=>{t.sort(((t,n)=>n[e].localeCompare(t[e])))},xt=(t,e)=>{const n=Tt(t,e);return kt(n)},Tt=(t,e)=>{const n=e,o=t.filter((t=>t!==n));return e?[...o,n,e]:[...o,n]},kt=t=>t.map((t=>j.dataMapping[t])),Et=[{className:"overzicht__header"},{className:"overzicht__productblocks",attributes:{role:"list"}},{className:"overzicht__popovers"},{className:"overzicht__filter"},{className:"overzicht__filter_and_sort"},{className:"overzicht__info",attributes:{role:"status"}},{className:"overzicht__notifications"},{className:"overzicht__no_results"},{className:"overzicht__sortbutton"},{className:"overzicht__cards",attributes:{role:"list"}},{className:"overzicht__loader"},{className:"overzicht__pagination"}],Dt=t=>{const{className:e,attributes:n}=t,o=document.createElement("div");return o.classList.add(e),n&&Object.entries(n).forEach((([t,e])=>o.setAttribute(t,e))),o},At=()=>{const t=document.createElement("style"),{css:e}=j.urls;return t.innerHTML=`@import '${R()}${e}'`,t},Lt=(t,e)=>{const n=document.createElement("bldc-heading");return n.setAttribute("level",t),n.setAttribute("tabindex","-1"),n.innerText=e,n};class Pt{constructor(t,e){this.config=t,this.events=e}build(){const{pageCounter:t,max:e}=this.config,n=this.createPagination(t,e);return pt(n,this.events),n}createPagination(t,e){const n=document.createElement("bldc-pagination"),o={page:t,max:e};return Object.entries(o).forEach((([t,e])=>n.setAttribute(t,e))),n}}class Rt{constructor(t,e){this.dispatchMetrixForPagination=t=>{setTimeout((()=>{B(t)}),500)},this.overzichtComponent=t,this.data=e}addPagination(){this.removePagination();if(this.checkIfPaginationIsNeeded())return;const t=new Pt(this.createPaginationConfig(),this.customEvents()).build(),e=this.overzichtComponent.shadowRoot.querySelector(".overzicht__pagination");e.appendChild(t),this.dispatchMetrixForPagination(e)}checkIfPaginationIsNeeded(){return 0===this.data.items.length||this.data.items.length<=this.overzichtComponent.settings.itemsPerPage}createPaginationConfig(){return{pageCounter:"1",max:Math.ceil(this.data.items.length/this.overzichtComponent.settings.itemsPerPage).toString()}}removePagination(){var t;null===(t=this.overzichtComponent.shadowRoot.querySelector("bldc-pagination"))||void 0===t||t.remove()}callbackEvent(t){const e=t.detail;this.overzichtComponent.goToPreviousOrNextPage(this.data,parseInt(e.page)),this.setFocusFirstCard()}setFocusFirstCard(){const t=this.overzichtComponent.shadowRoot.querySelector(".overzicht__cards > bldc-card");t&&setTimeout((()=>{t.shadowRoot.querySelector("a").focus()}),500)}customEvents(){return[{type:"bldcNext",callback:t=>this.callbackEvent(t)},{type:"bldcPrevious",callback:t=>this.callbackEvent(t)}]}}class Mt{constructor(t,e){this.overzichtComponent=t,this.data=e}displayInfo(){const t=this.overzichtComponent.shadowRoot.querySelector(".overzicht__info");this.fillContainer(t)}fillContainer(t){this.emptyInfoContainer(t);const e=this.data.items.length,n=this.createCounter(e),o=this.createText(e);t.append(n,o)}createCounter(t){const e=document.createElement("span");return e.classList.add("overzicht__info__counter"),e.innerText=t.toString(),e}createText(t){const e=document.createElement("span"),{aantalResultatenEV:n,aantalResultatenMV:o}=this.overzichtComponent.settings.mainData.teksten;e.classList.add("overzicht__info__text");const i=1===t?n:o;return e.innerText=i,e}emptyInfoContainer(t){t.innerHTML=""}}class zt{constructor(t,e={}){this.text=t,this.attributes=e}build(){return this.createSpinner()}createSpinner(){var t;const e=document.createElement("bldc-spinner");return(null===(t=this.text)||void 0===t?void 0:t.length)>0&&(e.innerText=this.text),Object.entries(this.attributes).forEac
1h((([t,n])=>e.setAttribute(t,n))),e}}class Ot{constructor(t){this.overzichtComponent=t,this.elementsToHide=t.shadowRoot.querySelectorAll(".overzicht__container div:not(.overzicht__loader)"),this.container=this.overzichtComponent.shadowRoot.querySelector(".overzicht__loader")}add(t,e){var n;if(this.container.innerHTML.length)return;const o=new zt(t,e).build();this.overzichtComponent.settings.initLoad&&this.elementsToHide.forEach((t=>t.classList.add("d-none"))),null===(n=this.container)||void 0===n||n.appendChild(o)}remove(){this.container&&(this.container.innerHTML="");const t=this.overzichtComponent.shadowRoot.querySelector(".overzicht__productblocks");this.overzichtComponent.settings.validProduct?(null==t||t.remove(),this.elementsToHide.forEach((t=>t.classList.remove("d-none")))):t.classList.remove("d-none")}}class qt{constructor(t,e){this.chipData=t,this.events=e}build(){const t=this.createChipGroup();return pt(t,this.events),this.chipData.forEach((({text:e,id:n})=>t.append(this.createChip(e,n)))),t}createChipGroup(){const t=document.createElement("bldc-chip-group");return t.setAttribute("type","dismiss"),t.setAttribute("elem-id","productoverzicht-chipgroup"),t}createChip(t,e){const n=document.createElement("bldc-chip");return n.setAttribute("id",e),n.innerText=t,n}}class Nt{constructor(t={},e){this.attributes=t,this.events=e}build(){const t=this.createLink();return pt(t,this.events),t}createLink(){const t=document.createElement("bldc-link");return Object.entries(this.attributes).forEach((([e,n])=>t.setAttribute(e,n))),t}}class Ft{constructor(t,e){this.overzichtComponent=t,this.data=e}addFilters(){var t,e;this.removeFilters();const n=this.createChipData();if(!n.length)return;const o=new qt(n,this.customEvents()).build(),i=this.createSpan(),r=this.createDeleteFiltersLink();o.prepend(i),o.append(r),B(o),null===(e=null===(t=this.overzichtComponent.shadowRoot)||void 0===t?void 0:t.querySelector(".overzicht__filter"))||void 0===e||e.append(o)}createDeleteFiltersLink(){const t={"elem-text":this.overzichtComponent.settings.mainData.teksten.filtersWissen,type:"inline"};return new Nt(t,this.customEventsDeleteFiltersLink()).build()}createChipData(){return Object.entries(this.overzichtComponent.settings.filterDataState).reduce(((t,[e,n])=>[...t,...this.createChipDataFromArray(e,n)]),[])}createChipDataFromArray(t,e){return e.reduce(((e,n)=>{const{active:o,checked:i,text:r,value:a}=n,s=`filter-${t}_${a}`;return o&&i?[...e,{text:r,id:s}]:e}),[])}createSpan(){const{filtersGekozen:t}=this.overzichtComponent.settings.mainData.teksten,e=document.createElement("span");return e.classList.add("overzicht__filter__text"),e.innerText=`${t}: `,e}removeFilters(){var t;const e=null===(t=this.overzichtComponent.shadowRoot)||void 0===t?void 0:t.querySelector(".overzicht__filter");e&&(e.innerHTML="")}callbackEvent(t){const[e,n]=t.target.id.split("_");this.overzichtComponent.shadowRoot.querySelector(`bldc-popover[elemid="${e}"]`).querySelector(`bldc-checkbox[value="${n}"]`).shadowRoot.querySelector("input").click()}customEvents(){return[{type:"bldcDismiss",callback:t=>this.callbackEvent(t)}]}callbackEventDeleteFiltersLink(){this.overzichtComponent.shadowRoot.querySelectorAll("bldc-chip").forEach((t=>{const[e,n]=t.id.split("_");this.overzichtComponent.shadowRoot.querySelector(`bldc-popover[elemid="${e}"]`).querySelector(`bldc-checkbox[value="${n}"]`).shadowRoot.querySelector("input").click()}))}customEventsDeleteFiltersLink(){return[{type:"bldcClick",callback:()=>this.callbackEventDeleteFiltersLink()}]}}class jt{constructor(t,e){this.attributes=t,this.events=e}build(){const t=this.createModal();return pt(t,this.events),t}createModal(){const t=document.createElement("bldc-modal");t.id="bld-modal",Object.entries(this.attributes).forEach((([e,n])=>t.setAttribute(e,`${n}`)));const e=document.createElement("div");return e.classList.add("modal__container"),t.append(e),t}}class It{constructor(t){this.overzichtComponent=t,this.elemid="modal-filter-and-sort"}placeFilterAndSortButton(){const t=this.createmodalAttributes(),e=new jt(t,this.customEvents()).build(),n=this.createShowResultsButton(e);e.setAttribute("data-type","bld-productenoverzicht"),e.append(n),this.setAriaLabelOnModalCloseButton(e),document.body.appendChild(e);const o=this.createFilterAndSortButton();this.overzichtComponent.shadowRoot.querySelector(".overzicht__filter_and_sort").append(o)}setAriaLabelOnModalCloseButton(t){setTimeout((()=>{const e=t.shadowRoot.querySelector(".close-button");e&&e.setAttribute("aria-label",this.overzichtComponent.settings.mainData.teksten.closeButtonModalAriaLabel)}),1e3)}disableModalButton(t){const e=t.shadowRoot.querySelector(".bldc-modal-footer bldc-button");e&&e.setAttribute("disabled","true")}createmodalAttributes(){return{elemId:this.elemid}}createFilterAndSortButton(){const t=document.createElement("bldc-button"),e=this.overzichtComponent.settings.mainData.teksten.sorteerEn
1FilterModalLabel,n={type:"secondary",icon:"filter","icon-pos":"left","elem-title":e,elemid:this.elemid,"bldc-aria-expanded":"false"};return Object.entries(n).forEach((([e,n])=>t.setAttribute(e,mt(n)))),t.addEventListener("bldcClick",(()=>{const t=document.querySelector('bldc-modal[elemid="modal-filter-and-sort"]');t&&(t.setAttribute("data-modal-trigger",mt(e)),t.bldcShow({}))})),t}customEvents(){return[{type:"bldcModalShow",callback:t=>this.callbackEventShown(t)},{type:"bldcModalClose",callback:()=>this.callbackEventClose()}]}callbackEventClose(){const t=this.overzichtComponent.shadowRoot.querySelector(`bldc-button[elemid="${this.elemid}"]`);t&&(t.setAttribute("bldc-aria-expanded","false"),t.setFocus())}callbackEventShown(t){const e=this.overzichtComponent.shadowRoot.querySelector(`bldc-button[elemid="${this.elemid}"]`);e&&(e.setAttribute("bldc-aria-expanded","true"),Object.keys(this.overzichtComponent.settings.data).length||this.disableModalButton(t.target),setTimeout((()=>{const e=t.target.querySelector(".modal__container").querySelector("bldc-radiobutton");e&&e.setFocus()}),1e3))}createShowResultsButton(t){const e=document.createElement("bldc-button"),n={type:"primary","elem-title":this.overzichtComponent.settings.mainData.teksten.toonResultaten,elemid:"modal-button-1",slot:"footer"};return Object.entries(n).forEach((([t,n])=>e.setAttribute(t,mt(n)))),e.addEventListener("bldcClick",(()=>t.bldcClose({}))),e}}class Bt{constructor(t){this.data=t}build(){return this.createPopover(this.data)}createPopover(t){const{elemTitle:e,content:n,position:o,elemId:i,icon:r,iconPos:a,buttonAriaLabel:s}=t;if(!e||!n)throw new Error("Missing required properties");const c=this.createPopoverContainer(o,i),l=this.createPopoverTrigger(e,r,a,s),d=this.createPopoverContent(n,i);return c.append(l,d),c}createPopoverContainer(t,e){const n=document.createElement("bldc-popover");return n.setAttribute("content-position",t||"bottomRight"),n.setAttribute("elemId",e),n}createPopoverTrigger(t,e,n,o){const i=document.createElement("bldc-popover-trigger"),r=this.createButton(t,e,n,o);return i.append(r),i}createButton(t,e,n,o){const i=document.createElement("bldc-button");return i.setAttribute("elem-title",mt(t)),i.setAttribute("type","secondary"),e&&(i.setAttribute("icon",e),n&&i.setAttribute("icon-pos",n)),o&&i.setAttribute("aria-label",mt(o)),i.setAttribute("bldc-aria-haspopup","true"),i}createPopoverContent(t,e){const n=document.createElement("bldc-popover-content"),o=document.createElement("div");return o.setAttribute("id",e),o.classList.add("popover__container"),"string"==typeof t&&(o.innerHTML=t),t instanceof HTMLElement&&o.append(t),n.append(o),n}}class $t{constructor(t,e,n,o,i){this.legend=t,this.radioButtonGroupData=e,this.events=n,this.filterName=o,this.viewport=i}build(){const t=this.createRadioButtonGroup(this.radioButtonGroupData,this.legend);return pt(t,this.events),t}createRadioButtonGroup(t,e){if(!t||!e)throw new Error("Missing required data");const n=this.createRadioContainer(e);return Object.values(t).forEach((({text:t,value:e})=>n.append(this.createRadioButton(t,e)))),n}createRadioContainer(t){const e=document.createElement("bldc-radiobutton-group");e.setAttribute("required","false");const n=this.createLegend(t);return e.append(n),e}createRadioButton(t,e){const n=document.createElement("bldc-radiobutton");return n.setAttribute("filtername",this.filterName),n.setAttribute("value",e),n.innerHTML="mobile"===this.viewport?t:t.replaceAll(" ","&nbsp;"),n}createLegend(t){const e=document.createElement("span");return e.setAttribute("slot","legend"),e.innerText=t,e}}class Ut{constructor(t,e,n,o,i){this.legend=t,this.checkboxGroupData=e,this.events=n,this.filterName=o,this.viewport=i}build(){const t=this.createCheckboxGroup(this.checkboxGroupData,this.legend);return pt(t,this.events),t}createCheckboxGroup(t,e){if(!t||!e)throw new Error("Missing required data");const n=this.createCheckboxContainer(e);return Object.values(t).forEach((({text:t,value:e})=>n.append(this.createCheckbox(t,e)))),n}createCheckboxContainer(t){const e=document.createElement("bldc-checkbox-group"),n=this.createLegend(t);return e.append(n),e}createCheckbox(t,e){const n=document.createElement("bldc-checkbox"),o=this.getFilterValue(e);return n.setAttribute("filtername",this.filterName),n.setAttribute("value",e),n.setAttribute("filtervalue",o),n.innerHTML="mobile"===this.viewport?t:t.replaceAll(" ","&nbsp;"),n}getFilterValue(t){return t.replaceAll(" ","_").toLowerCase()}createLegend(t){const e=document.createElement("span");return e.setAttribute("slot","legend"),e.innerText=t,e}}
1var Vt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class Ht{constructor(t,e){this.overzichtComponent=t,this.filterName=e,this.elemID=`filter-${this.filterName}`}addPopoverAndMobileInputs(t,e,n){this.setPopover(t,e,n),this.setInputGroupMobile(t,n)}setPopover(t,e,n){var o,i;this.removePopover();const r=this.getPopover(t,e,n);this.setEventsOnTrigger(r),this.setMetrixEvents(r),null===(i=null===(o=this.overzichtComponent.shadowRoot)||void 0===o?void 0:o.querySelector(".overzicht__popovers"))||void 0===i||i.appendChild(r)}setEventsOnTrigger(t){t.addEventListener("bldcPopoverShow",(t=>{this.setChevron(t.target)})),t.addEventListener("bldcPopoverClose",(t=>{this.setChevron(t.target)}))}setChevron(t){const e=t.visible,n=t.querySelector("bldc-popover-trigger bldc-button");n&&(n.icon="chevron_"+(e?"omhoog":"omlaag"))}setMetrixEvents(t){"product"!==this.filterName&&B(t)}setInputGroupMobile(t,e){var n;const o=this.getInputGroupMobile(t,e);this.disableMetrixForRadiobuttonsInModal(o);const i=this.createMobileContainer();i.append(o),null===(n=document.querySelector("bldc-modal .modal__container"))||void 0===n||n.append(i)}disableMetrixForRadiobuttonsInModal(t){t.querySelectorAll("bldc-radiobutton").forEach((t=>{t.setAttribute("bld-metrix-exclude","true")}))}createMobileContainer(){const t=document.createElement("div"),e=`modal-filter-${this.filterName}`,n=this.overzichtComponent.shadowRoot.getElementById(e);return n&&n.remove(),t.id=e,t.classList.add("modal__filter","bldc-input-container"),t}getInputGroupMobile(t,e){const n=this.overzichtComponent.settings.mainData.teksten[this.filterName],o=[{type:"RadioButtonGroup"===e?"bldcClick":"bldcValueChange",callback:t=>this.clickDesktopRelatedRadioOrCheckbox(t.target)}];return"RadioButtonGroup"===e?new $t(n,t,o,this.filterName,"mobile").build():new Ut(n,t,o,this.filterName,"mobile").build()}clickDesktopRelatedRadioOrCheckbox(t){const{value:e}=t,n=t.getAttribute("filtername"),o=this.overzichtComponent.shadowRoot.querySelector(`#filter-${n}`);if(!o)return;const i=o.querySelector(`[value="${e}"]`);i.shadowRoot?i.shadowRoot.querySelector("input").click():i.querySelector("input").click()}getPopover(t,e,n){let o,i=this.overzichtComponent.settings.mainData.teksten[this.filterName];"product"===this.filterName&&(i+=" (1)");const r=this.filterName===this.overzichtComponent.settings.lastFilter?"bottomRight":"bottomLeft";"RadioButtonGroup"===n&&(o=new $t(i,t,e,this.filterName,"desktop").build()),"CheckboxGroup"===n&&(o=new Ut(i,t,e,this.filterName,"desktop").build());const a=this.elemID,s=new Bt({elemTitle:i,content:o,elemId:a,position:r,icon:"chevron_omlaag",iconPos:"right"}).build();return s.setAttribute("filtername",this.filterName),s}baseCallback(t){if(!Array.isArray(t.detail))return;const e=t.detail;this.updateOptionsCheckedInFilterDataState(e,this.filterName),this.overzichtComponent.updateData(this.filterName),this.setCheckboxOptionsMobile(this.filterName,e)}updateOptionsCheckedInFilterDataState(t,e){const n=this.overzichtComponent.settings.filterDataState[e];n&&n.forEach((e=>{e.checked=t.includes(e.text)}))}setCheckboxOptionsMobile(t,e){return Vt(this,void 0,void 0,(function*(){const n=document.querySelector(`#modal-filter-${t}`).querySelector("bldc-checkbox-group");yield n.reset();Array.from(n.querySelectorAll("bldc-checkbox")).forEach((t=>{const n=e.find((e=>e===t.value));t.bldcValue=n}))}))}removePopover(){var t,e;null===(e=null===(t=this.overzichtComponent.shadowRoot)||void 0===t?void 0:t.querySelector(`bldc-popover[elemid="${this.elemID}"]`))||void 0===e||e.remove()}}class Wt extends Ht{constructor(t){super(t,"doelgroep"),this.overzichtComponent=t,this.filterFormatType=j.filterFormatTypeMapping.doelgroep}addToPopoverContainer(){this.addPopoverAndMobileInputs(this.overzichtComponent.settings.filterDataState.doelgroep,this.customEvents(),this.filterFormatType)}callbackEvent(t){this.baseCallback(t)}customEvents(){return[{type:"bldcValueChange",callback:t=>this.callbackEvent(t)}]}}class Gt extends Ht{constructor(t){super(t,"onderwerp"),this.overzichtComponent=t,this.filterFormatType=j.filterFormatTypeMapping.onderwerp}
1addToPopoverContainer(){this.addPopoverAndMobileInputs(this.overzichtComponent.settings.filterDataState.onderwerp,this.customEvents(),j.filterFormatTypeMapping.onderwerp)}callbackEvent(t){this.baseCallback(t)}customEvents(){return[{type:"bldcValueChange",callback:t=>this.callbackEvent(t)}]}}class Jt extends Ht{constructor(t){super(t,"belastingmiddel"),this.overzichtComponent=t,this.filterFormatType=j.filterFormatTypeMapping.middel}addToPopoverContainer(){this.addPopoverAndMobileInputs(this.overzichtComponent.settings.filterDataState.belastingmiddel,this.customEvents(),this.filterFormatType)}callbackEvent(t){this.baseCallback(t)}customEvents(){return[{type:"bldcValueChange",callback:t=>this.callbackEvent(t)}]}}class Kt extends Ht{constructor(t){super(t,"belastingjaar"),this.overzichtComponent=t,this.filterFormatType=j.filterFormatTypeMapping.jaar}addToPopoverContainer(){this.addPopoverAndMobileInputs(this.overzichtComponent.settings.filterDataState.belastingjaar,this.customEvents(),this.filterFormatType)}callbackEvent(t){this.baseCallback(t)}customEvents(){return[{type:"bldcValueChange",callback:t=>this.callbackEvent(t)}]}}var Qt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class Zt{constructor(t,e){this.overzichtComponent=t,this.data=e}addSortButtons(){this.addSortPopover(),this.addSortButtonMobile()}addSortPopover(){var t,e;this.removeSortPopover();const n=new $t(this.overzichtComponent.settings.mainData.teksten.sorteerAriaLabel,this.createRadiobuttonConfig(),this.customEvents(),"sorteren").build();this.setCurrentSortingOnRadioButton(n);const o=this.getPopoverElemTitle(),i=`${this.overzichtComponent.settings.mainData.teksten.sorteerAriaLabel}${o}`,r=new Bt({elemTitle:o,content:n,elemId:"bldSortPopover",position:"bottomRight",icon:"sorteer",iconPos:"left",buttonAriaLabel:i}).build();null===(e=null===(t=this.overzichtComponent.shadowRoot)||void 0===t?void 0:t.querySelector(".overzicht__sortbutton"))||void 0===e||e.appendChild(r),B(r)}addSortButtonMobile(){const t=this.createSortButtonContainerMobile(),e=this.createSortButtonMobile();this.setCurrentSortingOnRadioButton(e),t.append(e),document.querySelector("bldc-modal .modal__container").insertAdjacentElement("afterbegin",t)}createSortButtonContainerMobile(){const t=document.createElement("div");return t.classList.add("modal__sortbutton","bldc-input-container"),t}createSortButtonMobile(){this.removeSortButtonMobile();return new $t(this.overzichtComponent.settings.mainData.teksten.sorteerAriaLabel,this.createRadiobuttonConfig(),this.customMobileEvents(),"sorteren").build()}removeSortButtonMobile(){var t;null===(t=document.querySelector("bldc-modal div.modal__sortbutton bldc-radiobutton-group"))||void 0===t||t.remove()}removeSortPopover(){var t,e;null===(e=null===(t=this.overzichtComponent.shadowRoot)||void 0===t?void 0:t.querySelector(".overzicht__sortbutton bldc-popover"))||void 0===e||e.remove()}setCurrentSortingOnRadioButton(t){const{sortKey:e,sortOrder:n}=this.overzichtComponent.settings.currentSorting,o=`${e}_${n}`;setTimeout((()=>{const e=t.querySelector(`[value="${o}"]`),n=e.closest("bldc-radiobutton-group"),i=n.bldcValue;if(i!==o){const e=t.querySelector(`[value="${i}"]`);e&&(e.bldcValue="false")}e.bldcValue="true",n.bldcValue=o,n.untouched="false",n.touched="true"}),100)}createRadiobuttonConfig(){return this.overzichtComponent.settings.currentSorting.opties.reduce(((t,e)=>{const[n,o]=((t,{mainData:e})=>{const n=e.teksten,o=n.sorteerOplopend,i=n.sorteerAflopend,r=n[I(t)];return[{text:`${r}${o}`,value:`${t}_ascending`},{text:`${r}${i}`,value:`${t}_descending`}]})(e,this.overzichtComponent.settings);return[...t,n,o]}),[])}callbackEvent(t){const e=t.detail,[n,o]=e.value.split("_");this.overzichtComponent.settings.currentSorting={sortKey:n,sortOrder:o,opties:this.overzichtComponent.settings.currentSorting.opties},this.sortDefaultAndFilteredData(n,o),this.updatePopoverTriggerButton(t);"true"===document.querySelector('bldc-modal[elemid="modal-filter-and-sort"]').getAttribute("visible")||this.updateSortButtonMobile()}updateSortButtonMobile(){const t=document.querySelector("bldc-modal .modal__sortbutton");t&&this.setCurrentSortingOnRadioButton(t)}callbackEventMobile(t){const e=t.detail.value;this.overzichtComponent.shadowRoot.querySelector("#bldSortPopover bldc-radiobutton-group").querySelector(`bldc-radiobutton[value="${e}"]`).querySelector("input").click()}updatePopoverTriggerButton(t){const e=t.target.textContent,n=t.target.closest("bldc-popover").querySelector("bldc-popover-trigger").querySelector("bldc-button");n.elemTitle=e,n.ariaLabel=`${this.overzichtComponent.settings.mainData.teksten.sorteerAriaLabel}${e}`}getPopoverElemTitle(){const{sortKey:t,sortOrder:e}=this.overzichtComponent.settings.currentSorting,{teksten:n}=this.overzichtComponent.settings.mainData;return((t,e,n)=>`${n[I(t)]}${"ascending"===e?n.sorteerOplopend:n.sorteerAflopend}`)(t,e,n)}
1setSelectedSortorderOnRadio(t){return Qt(this,void 0,void 0,(function*(){const e=document.querySelector("bldc-modal bldc-radiobutton-group"),n=e.querySelector(`bldc-radiobutton[value="${t}"]`);yield e.reset(),n.bldcValue="true",e.bldcValue=t}))}sortDefaultAndFilteredData(t,e){this.overzichtComponent.sortDataSelect(this.overzichtComponent.settings.newData,t,e);const n=this.data,{opties:o}=this.overzichtComponent.settings.currentSorting;Ct({data:n,opties:o,sortKey:t,sortOrder:e})}customEvents(){return[{type:"bldcClick",callback:t=>this.callbackEvent(t)}]}customMobileEvents(){return[{type:"bldcClick",callback:t=>Qt(this,void 0,void 0,(function*(){return this.callbackEventMobile(t)}))}]}}class Yt{getItems(t){return ft(t)}}const Xt=(t,e)=>{Object.entries(e).forEach((([e,n])=>{return t.setAttribute(e,(o=n,(new DOMParser).parseFromString(o,"text/html").documentElement.textContent));var o}))},te=(t,e={},n)=>{const o=document.createElement(t);return Xt(o,e),n&&(o.innerHTML=n),o},ee=t=>{const e=te("div",{class:"bold-margin"});return e.appendChild(t),e};class ne{constructor(t,e,n,o){this.elem_title=t,this.text=e,this.type=n,this.id=o}build(){return this.createNotification()}createNotification(){const t=document.createElement("bldc-notification"),e={id:this.id,type:this.t
1ype,"elem-title":this.elem_title};Object.entries(e).forEach((([e,n])=>t.setAttribute(e,n)));const n=this.createParagraph();return t.append(n),t}createParagraph(){const t=te("bldc-paragraph",{"disable-margin":"true"},this.text);return ee(t)}}class oe{constructor(t){this.overzichtComponent=t}add(t,e,n){var o,i;null===(o=this.overzichtComponent.shadowRoot.getElementById(n))||void 0===o||o.remove();const r=new ne(t,e,"error",n).build();null===(i=this.overzichtComponent.shadowRoot.querySelector(".overzicht__notifications"))||void 0===i||i.appendChild(r)}remove(t){var e;null===(e=this.overzichtComponent.shadowRoot.querySelector(`.overzicht__notifications #${t}`))||void 0===e||e.remove()}}const ie=(t,e)=>{t.shadowRoot.querySelectorAll(e).forEach((t=>t.innerHTML=""))},re=t=>{var e;t.loader.remove();const{currentLanguage:n}=t.settings,{errorNoJsonTitle:o,errorNoJsonText:i}=j.textsNoMainData[n];ie(t,".overzicht__info, .overzicht__sortbutton, .overzicht__cards, .overzicht__pagination"),null===(e=document.querySelector(".modal__sortbutton"))||void 0===e||e.remove(),new oe(t).add(o,i,"errorNoJSON")};var ae=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class se extends Ht{constructor(t){super(t,"product"),this.overzichtComponent=t,this.filterFormatType=j.filterFormatTypeMapping.producten}addToPopoverContainer(){this.addPopoverAndMobileInputs(this.createFilterItemData(),this.customEvents(),this.filterFormatType)}createFilterItemData(){return this.overzichtComponent.settings.mainData.producten.map((({titel:t,jsonpath:e})=>({text:t,value:e})))}callbackEvent(t){return ae(this,void 0,void 0,(function*(){this.overzichtComponent.loader.add(),((t,e)=>{var n;const o=null===(n=t.shadowRoot)||void 0===n?void 0:n.querySelectorAll(`bldc-popover:not([elemid="${e}"])`);null==o||o.forEach((t=>t.remove())),document.querySelectorAll(`div.modal__filter:not([id="modal-${e}"])`).forEach((t=>t.remove()))})(this.overzichtComponent,this.elemID),ie(this.overzichtComponent,".overzicht__notifications, .overzicht__no_results");const e=t.target,n=this.getHeaderText(e);((t,e)=>{const n=t.shadowRoot.querySelector(".overzicht__header");if(!n)return;n.innerHTML="";const o=Lt("2",e);n.append(o)})(this.overzichtComponent,n);const o=e.bldcValue;this.setCurrentProductUrlParaInSetting(o),this.setItemsPerPageInSettings(o),yield this.setRadioBldcValueMobile(o);const i=yield(new Yt).getItems(o),r=Object.assign(Object.assign({},i),{items:this.filterAndModifyItems(i)});window.dispatchEvent(new CustomEvent("product-data-loaded")),r?(this.sortDataAsDefault(o,r),this.fillOptions(r),this.enableModalFilterAndSortButton(),this.setDataInSettings(r),this.overzichtComponent.displayAllResults(r),r.items.length&&new Zt(this.overzichtComponent,r).addSortButtons(),yield this.fireUrlParaFunctions(o),(t=>{const e=t.shadowRoot.querySelector(".overzicht__popovers");if(!e)return;const{aantalResultatenEV:n,aantalResultatenMV:o}=t.settings.mainData.teksten,i=1===t.settings.data.items.length?n:o,r=document.createElement("h3");r.innerHTML=i,r.classList.add("sr-only"),e.insertAdjacentElement("afterend",r)})(this.overzichtComponent),this.overzichtComponent.settings.initLoadFromSessionStorage||setTimeout((()=>{this.overzichtComponent.loader.remove()}),500),this.overzichtComponent.settings.initLoad=!1):re(this.overzichtComponent)}))}filterAndModifyItems(t){return t.items.forEach((t=>{t.j&&(t.j=t.j.split("|").sort().join("|"))})),t.items.filter((t=>!1!==t.show))}getHeaderText(t){const e=t.bldcValue,n=t.querySelector(`bldc-radiobutton[value="${e}"]`);return n&&(null==n?void 0:n.innerText)||""}fireUrlParaFunctions(t){return ae(this,void 0,void 0,(function*(){const e=Q("product");if(e!==this.overzichtComponent.settings.currentProductUrlPara&&sessionStorage.removeItem(j.sessionStorageKey),e){const e=this.getSelectedProduct(t).urlPara;this.updateURLParameter("product",e)}var n;yield(n=this.overzichtComponent,U(void 0,void 0,void 0,(function*(){if(!n.settings.initLoad)return;const t=Q("dlgrp"),e=Q("onderwerp");t&&(yield tt(t,n)),e&&(yield et(e,n))})))}))}getSelectedProduct(t){return this.overzichtComponent.settings.mainData.producten.find((e=>e.jsonpath===t))}setDataInSettings(t){this.overzichtComponent.settings.data=t,this.overzichtComponent.settings.newData=t}sortDataAsDefault(t,e){const n=this.getSelectedProduct(t);if(this.setDefaultSortingOnSessionRestore(n.sortering),n.sortering.default){const{default:t,sortOrder:o,opties:i}=n.sortering;Ct({data:e,sortKey:t,sortOrder:o,opties:i}),this.overzichtComponent.settings.currentSorting={sortKey:t,sortOrder:o,opties:i}}}setItemsPerPageInSettings(t){const e=this.getSelectedProduct(t);this.overzichtComponent.settings.itemsPerPage=(null==e?void 0:e.itemsPerPage)||j.itemsPerPage}updateURLParameter(t,e){const n=new URL(window.location.href);n.searchParams.set(t,e),window.history.replaceState({},"",n)}setDefaultSortingOnSessionRestore(t){if(!this.overzichtComponent.settings.initLoadFromSessionStorage)return;if(!this.overzichtComponent.settingsToRestore.currentSorting)return;const{sortKey:e,sortOrder:n}=this.overzichtComponent.settingsToRestore.currentSorting;t.default=e,t.sortOrder=n}setCurrentProductUrlParaInSetting(t){const e=this.getSelectedProduct(t).urlPara;e&&(this.overzichtComponent.settings.currentProductUrlPara=e)}enableModalFilterAndSortButton(){if(Object.keys(this.overzichtComponent.settings.data).length)return;const t=document.querySelector('bldc-modal[elemid="modal-filter-and-sort"]');if(!t)return;const e=t.shadowRoot.querySelector(".bldc-modal-footer bldc-button");e&&e.removeAttribute("disabled")}setRadioBldcValueMobile(t){return ae(this,void 0,void 0,(function*(){const e=document.querySelector("#modal
1-filter-product").querySelector("bldc-radiobutton-group");yield e.reset();const n=e.querySelector(`[value="${t}"]`);e.querySelectorAll("bldc-radiobutton").forEach((t=>{t.reset()})),e.bldcValue=t,setTimeout((()=>{n.bldcValue=!0,e.untouched="false",e.touched="true"}),500)}))}getOptionMapper(t){return[{filterName:"doelgroep",keys:["d"],popover:new Wt(this.overzichtComponent)},{filterName:"onderwerp",keys:this.getUniqueKeysStartingWith(t.items,"c"),popover:new Gt(this.overzichtComponent)},{filterName:"belastingjaar",keys:["j"],popover:new Kt(this.overzichtComponent),sortOrder:"descending"},{filterName:"belastingmiddel",keys:["m"],popover:new Jt(this.overzichtComponent)}]}getUniqueKeysStartingWith(t,e){const n=new Set;return t.forEach((t=>{Object.keys(t).filter((t=>t.startsWith(e))).forEach((t=>n.add(t)))})),Array.from(n)}fillOptions(t){this.overzichtComponent.settings.filterDataState={};const e=this.getOptionMapper(t);this.setLastFilterInSettings(e,t),e.forEach((({filterName:e,keys:n,popover:o,sortOrder:i})=>{const r=this.getFilterValues(t.items,n).map((t=>({text:t,value:t,active:!0,checked:!1})));r.length&&(this.sortFilterValues(r,i),this.overzichtComponent.settings.filterDataState[e]=r,o.addToPopoverContainer())}))}setLastFilterInSettings(t,e){for(let n=t.length-1;n>0;n--){if(this.getFilterValues(e.items,t[n].keys).length){this.overzichtComponent.settings.lastFilter=t[n].filterName;break}}}sortFilterValues(t,e){"descending"!==e?St(t,"text"):_t(t,"text")}getFilterValues(t,e){const n=t.reduce(((t,n)=>{const o=e.reduce(((t,e)=>{const o=n[e];if(o){if(e.startsWith("c")){const{doelgroepMapping:o}=j,i=Object.entries(o).find((([,t])=>t===e));if(i){const[e]=i;if(!n.d.split("|").includes(e))return t}}return[...t,...o.split("|")]}return t}),[]);return o?[...t,...o]:t}),[]);return Array.from(new Set(n))}customEvents(){return[{type:"bldcValueChange",callback:t=>ae(this,void 0,void 0,(function*(){return yield this.callbackEvent(t)}))}]}}var ce=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class le{constructor(t){this.overzichtComponent=t}addBlocks(){return ce(this,void 0,void 0,(function*(){const t=this.overzichtComponent.shadowRoot.querySelector(".overzicht__productblocks");this.addBlocksToContainer(t)}))}addBlocksToContainer(t){const{producten:e}=this.overzichtComponent.settings.mainData;e.forEach((e=>{const n=new bt(this.createCardConfig(e),this.customEvents()).build();t.appendChild(n)}))}createCardConfig({titel:t,iconName:e,urlPara:n}){return{heading:mt(t),icon:e,href:`${window.location.pathname}?product=${n}`,padding:"lg",extraAttributes:{"data-product-urlpara":n}}}callbackEvent(t){const e=t.target.getAttribute("data-product-urlpara"),{producten:n}=this.overzichtComponent.settings.mainData;Y(this.overzichtComponent,n,e);this.overzichtComponent.shadowRoot.querySelector(".overzicht__productblocks").remove(),this.overzichtComponent.settings.validProduct=!0,this.focusBldcHeading()}focusBldcHeading(){setTimeout((()=>{const t=this.overzichtComponent.shadowRoot.querySelector(".overzicht__header bldc-heading");t&&t.focus()}),1e3)}customEvents(){return[{type:"bldcClick",callback:t=>this.callbackEvent(t)}]}}const de=(()=>{const t={},e=window.location.search,n=new URLSearchParams(e);return[{para:"bld-wc-delaytime",setting:"delayTime",type:"integer"},{para:"bld-wc-intervaltime",setting:"intervalTime",type:"integer"},{para:"bld-wc-closed-start",setting:"closedAfterStart",type:"boolean"},{para:"bld-wc-closed-intake",setting:"closedAfterIntake",type:"boolean"},{para:"bld-wc-survey",setting:"survey",type:"boolean"},{para:"bld-wc-open",setting:"open",type:"boolean"},{para:"bld-wc-top-init",setting:"topInit",type:"boolean"},{para:"bld-wc-top-start",setting:"topStart",type:"boolean"},{para:"bld-wc-top-intake",setting:"topIntake",type:"boolean"},{para:"bld-wc-force-agent",setting:"forceAgent",type:"boolean"}
1].forEach((e=>{if(n.has(e.para)){const o=n.get(e.para);"boolean"===e.type&&(t[e.setting]="true"===o),"integer"!==e.type||"string"!=typeof o||Number.isNaN(Number(o))||(t[e.setting]=parseInt(o))}})),Object.keys(t).length&&(t.debug=!0),t})(),ue={beta:"https://beta-t.belastingdienst.nl",www:"https://www-t.belastingdienst.nl"};he(de,"delayTime",1e3),he(de,"intervalTime",3e4),function(){var t;const e=document.querySelector('meta[name="webchat.topic"]');t=null==e?void 0:e.content}();function he(t,e,n){return(null==t?void 0:t[e])>=1e3?t[e]:n}const me=(t,e)=>{t.producten.forEach((t=>t.itemsPerPage=parseInt(e)))};var pe=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class be extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.settings={initLoad:!0,currentLanguage:document.querySelector("html").getAttribute("lang")||"nl",viewport:P.viewportSize(),data:{},filterDataState:{},initLoadFromSessionStorage:!1}}connectedCallback(){this.render()}render(){return pe(this,void 0,void 0,(function*(){var t;this.appendContainer(),this.loader=new Ot(this),this.loader.add(),yield this.getMainData(),new It(this).placeFilterAndSortButton(),new se(this).addToPopoverContainer(),this.setDateAndTimeFormatters(),yield(t=this,U(void 0,void 0,void 0,(function*(){var e;const n=t.settings.mainData.producten,o=Q("product"),i=Q("dlgrp"),r=Z(o,n);if(t.settings.validProduct=r,r){if(t.settings.initLoadFromSessionStorage=ot()&&J(o),t.settings.initLoadFromSessionStorage&&(t.settingsToRestore=yield K()),yield Y(t,n,o),(null===(e=t.settings.data)||void 0===e?void 0:e.items)||(yield X()),t.settings.initLoadFromSessionStorage)return new Promise((e=>{setTimeout((()=>{t.settings.initLoadFromSessionStorage&&(t.settings.filterDataState=t.settingsToRestore.filterDataState,t.updateData(),G(t),t.loader.remove(),t.settings.initLoadFromSessionStorage=!1),i||(t.settings.initLoad=!1),e()}),1500)}));sessionStorage.removeItem(j.sessionStorageKey)}else t.settings.initLoad=!1}))),this.settings.validProduct||(yield new le(this).addBlocks()),this.settings.initLoad||this.settings.initLoadFromSessionStorage||this.loader.remove()}))}setDateAndTimeFormatters(){const t=this.settings.currentLanguage,e=j.dateLanguages[t];Object.assign(j,((t="nl-NL")=>({dateFormatter:new Intl.DateTimeFormat(t,j.dateFormatOptions),timeFormatter:new Intl.DateTimeFormat(t,j.timeFormatOptions)}))(e))}updateData(t=""){const e={items:(t=>{let e=t.data.items;const n=V(t);return Object.entries(n).forEach((([t,n])=>{n.length&&(e=e.filter((e=>{const o=W(e,t);return n.some((t=>o.some((e=>e===t))))})))})),e})(this.settings)};var n;this.settings.showAllDoelgroepen=this.checkToShowAllDoelgroepen(t),((t,e,n)=>{const o=rt(n.settings.filterDataState);Object.entries(n.settings.filterDataState).forEach((([i,r])=>{if(i===t&&o)return void it(r,t,n);const a=at(e,i);st(r,a,n.settings.showAllDoelgroepen),lt(r,i,n),it(r,i,n)}))})(t,e,this),(n=this).shadowRoot.querySelectorAll(".overzicht__popovers bldc-popover").forEach((t=>{"product"!==t.getAttribute("filtername")&&dt(t,n)})),this.displayAllResults(e),this.settings.newData=e}checkToShowAllDoelgroepen(t){if("doelgroep"===t||""===t)return!1;return!Object.entries(this.settings.filterDataState).filter((t=>"doelgroep"!==t[0])).map((t=>t[1])).flat(1/0).some((t=>!0===t.checked))}getMainData(){return pe(this,void 0,void 0,(function*(){const t=yield(new yt).getMaindata(this.settings.currentLanguage);if(!t)throw re(this),new Error("Data not found");this.checkForMainDataUrlParams()&&(t=>{new URLSearchParams(window.location.search).get("main").split(";").forEach((e=>{const[n,o]=e.split("=");"itemsperpage"===n&&me(t,o)}))})(t),this.settings.mainData=t}))}checkForMainDataUrlParams(){return!!new URLSearchParams(window.location.search).get("main")}appendContainer(){var t;const e=(()=>{const t=document.createElement("div");t.classList.add("overzicht__container"),t.setAttribute("data-type","bld-productenoverzicht"),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||t.classList.add("no-safari");const e=At();return t.append(e),Et.forEach((e=>t.append(Dt(e)))),t})();null===(t=this.shadowRoot)||void 0===t||t.appendChild(e)}displayAllResults(t){if(!t.items)throw new Error("Data not found");new Mt(this,t).displayInfo(),t.items.length?(new Ft(this,t).addFilters(),new vt(this,t).displayItems(),new Rt(this,t).addPagination()):this.displayNoItemsMessage(t)}displayNoItemsMessage(t){new Ft(this,t).removeFilters(),new vt(this,t).removeOldItems(),new Rt(this,t).removePagination(),new Zt(this,t).removeSortPopover();const e=this.createTextNoItems(),n=this.createIllustration();this.shadowRoot.querySelector(".overzicht__no_results").innerHTML="",this.shadowRoot.querySelector(".overzicht__no_results").append(e,n)}createTextNoItems(){const t=te("bldc-paragraph",{"font-style":"italic"},this.settings.mainData.teksten.geenResultaten);return ee(t)}createIllustration(){const t=document.createElement("div");t.classList.add("illustration__container");const e=new Image,n=j.illustrations.noItems;return e.src=(()=>{const[t]=window.location.host.split(".",1);return t.includes("dxp")?t.includes("dxp-content")||t.includes("dxp-staging")?ue.www:ue.beta:""})()+n,e.alt="",e.ariaHidden="true",t.append(e),t}goToPreviousOrNextPage(t,e=1){new vt(this,t).displayItems(e)}sortDataSelect(t,e,n){const{opties:o}=this.settings.currentSorting;Ct({data:t,opties:o,sortKey:e,sortOrder:n}),new vt(this,t).displayItems(1)}}
1var ve=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};const ge=t=>{const e={boldComponent:t,selectors:"a"};setTimeout((()=>{window.dispatchBldMetrixDynamic("bld-video-component","metrixDynamicContent",e)}),500)};class fe{constructor(t,e={}){this.content=t,this.attributes=e}build(){const t=this.createContainer();return ge(t),t}createContainer(){const t=document.createElement("bldc-container"),e=document.createElement("div");return e.classList.add("bld-video-component__container"),Object.entries(this.attributes).forEach((([e,n])=>t.setAttribute(e,n.toString()))),"object"==typeof this.content?t.appendChild(this.content):t.innerHTML=this.content,e.append(t),e}}const we="//download.belastingdienst.nl/belastingdienst/media/",ye={local:"/data/wcm/video/video-data-v2.json",preview:"/wps/wcm/myconnect/nl/video_bibliotheek/systeem/video-data-v2.json",webserver:"/wps/wcm/connect/nl/video_bibliotheek/systeem/video-data-v2.json"},Ce={beta:"https://beta-t.belastingdienst.nl",www:"https://www-t.belastingdienst.nl"},Se={webcomponents:"/bld-assets/bld/webcomponents/bld-webcomponents.css"};class _e{constructor({filepathNoExtension:t,length:e},n,o){this.filepathNoExtension=t,this.videoLength=e,this.texts=n,this.headingLevel=o}render(){if(!this.videoLength)return;const t={heading:this.texts.titelDownload,expandable:!0,"heading-level":this.headingLevel},e=we+this.filepathNoExtension,n=document.createElement("bldc-footer-list"),o=document.createElement("bldc-link");o.setAttribute("elem-text",`${this.texts.titleDownloadVideoFile}, ${this.videoLength}`),o.setAttribute("href",`${e}.mp4`);const i=document.createElement("bldc-link");i.setAttribute("elem-text",this.texts.titleDownloadSrtFile),i.setAttribute("href",`${e}.srt`);const r=document.createElement("li");r.appendChild(o);const a=document.createElement("li");a.appendChild(i),n.append(r),n.append(a);return new fe(n,t).build()}}class xe{constructor({title:t,teaser:e},n){this.teaser=e,this.title=t,this.headingLevel=n}render(){if(!this.teaser&&!this.title)return;const t={heading:this.title,"heading-level":this.headingLevel};return new fe(this.teaser,t).build()}}class Te{constructor(t,e,n){this.transcript=t,this.texts=e,this.headingLevel=n}render(){if(!this.transcript)return;const t={heading:this.texts.titelTranscript,expandable:"true","heading-level":this.headingLevel};return new fe(this.transcript,t).build()}}const ke=t=>(new DOMParser).parseFromString(t,"text/html").documentElement.textContent;class Ee{constructor(t,e){this.data=t,this.events=e}build(){const t=this.createCard(this.data);return ge(t),t}createCard(t){const{heading:e,href:n,paragraph:o,icon:i,padding:r,imageUrl:a,videoKey:s}=t;if(!e||!n)throw new Error("Missing required properties");const c=this.createCardContainer(n,e,r,s);var l,d;if(l=c,d=this.events,l&&d&&(Array.isArray(l)?d.forEach((({type:t,callback:e})=>l.forEach((n=>n.addEventListener(t,e))))):d.forEach((({type:t,callback:e})=>l.addEventListener(t,e)))),a){const t=document.createElement("bldc-image");t.setAttribute("src",a),t.setAttribute("slot","image"),c.append(t)}o&&(c.innerHTML+=o),i&&c.setAttribute("icon",i);const u=document.createElement("div");return u.classList.add("bld-video-component__carrousel__card"),u.appendChild(c),u}createCardContainer(t,e,n,o){const i=document.createElement("bldc-card"),r={href:t,heading:e,padding:n,"data-video-key":o};return Object.entries(r).forEach((([t,e])=>i.setAttribute(t,ke(e)))),i}}class De{constructor(t,e){this.activeVideoKey=t,this.bldVideoComponent=e,this.headingLevel=e.headingLevel,this.videosToShow=e.videosToShow,this.videosData=e.videosData,this.videoTexts=e.videoTexts}render(){if(!this.videosToShow||!this.videosData||!this.activeVideoKey)return;const t=this.videosToShow.filter((t=>t!==this.activeVideoKey)),e=document.createElement("div");e.classList.add("bld-video-component__carrousel");const n=ee(te("bldc-heading",{level:this.headingLevel.toString(),size:"m"},this.videoTexts.meerVideos));e.appendChild(n);const o=document.createElement("div");return o.classList.add("bld-video-component__carrousel__container"),t.forEach((t=>{const e=new Ee(this.createCardConfig(this.videosData[t]),this.customEvents()).build();o.appendChild(e)})),e.appendChild(o),e}createCardConfig({title:t,youtubeId:e,key:n}){const o=`//img.youtube.com/vi/${e}/0.jpg`;return{heading:ke(t),imageUrl:o,href:"#",padding:"lg",videoKey:n}}callbackEvent(t){const e=t.target.getAttribute("data-video-key");e&&this.bldVideoComponent.render(this.videosData[e])}customEvents(){return[{type:"bldcClick",callback:t=>this.callbackEvent(t)}]}}class Ae{constructor(t){this.youtubeParams="?wmode=transparent&amp;rel=0&amp;showinfo=0&amp;modestbranding=1&amp;autohide=2&amp;fs=1&amp;disablekb=1",this.videoId=t}render(t){const e=document.createElement("iframe");return e.title=`Youtube-video: ${t}`,e.classList.add("embed-responsive-item"),e.src=`//www.youtube-nocookie.com/embed/${this.videoId}${this.youtubeParams}`,e.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",e.allowFullscreen=!0,e}}class Le{constructor(t){this.youtubeId=t}render(t){const e=this.createPlayerContainer(),n=new Ae(this.youtubeId).render(t);return e.appendChild(n),e}createPlayerContainer(){const t=document.createElement("div");return t.classList.add("bld-video-component__player"),t}}const Pe=()=>{const[t]=window.location.host.split(".",1);return t.startsWith("localhost")?"local":t.startsWith("dxp")?"preview":"webserver"},Re=()=>{var t;return null!==(t=document.querySelector("header nav.navbar"))&&void 0!==t?t:document.querySelector("bldc-navigation")};
1var Me=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class ze extends HTMLElement{constructor(){super(),this.version="0.9.1",this.attachShadow({mode:"open"}),this.videoJsonPath=ye[Pe()],this.videosToShow=[],this.videosData={},this.videoTexts={}}connectedCallback(){return Me(this,void 0,void 0,(function*(){const t=this.createLoader();this.shadowRoot.append(t);const e=yield(n=this.videoJsonPath,o="json",ve(void 0,void 0,void 0,(function*(){try{const t=yield fetch(n,{method:"GET",headers:{"Content-Type":"html"===o?"text/html":"application/json"}});if(!t.ok)throw new Error(`Error: ${t.status} - ${t.statusText}`);return"html"===o?yield t.text():yield t.json()}catch(t){console.error(t)}})));var n,o;e&&(this.videosData=e.videos,this.videoTexts=e.texts,this.videosToShow=this.getVideosToShow(this),this.videosToShow&&(this.headingLevel=this.getHeadingLevel(),t.remove(),this.render()))}))}render(t){var e;this.videosToShow=this.filterVideos(this.videosToShow,this.videosData);const n=!!t;if(!this.videosToShow.length)return;if(t||(t=this.videosData[this.videosToShow[0]]),!t)return;this.shadowRoot.innerHTML="",this.loadCSSInShadowRoot();const o=this.createVideoContainer();null===(e=this.shadowRoot)||void 0===e||e.appendChild(o);const i=new Le(t.youtubeId).render(t.title);o.appendChild(i);const r=new xe(t,this.headingLevel).render();o.appendChild(r);const a=new Te(t.transcript,this.videoTexts,this.headingLevel).render();o.appendChild(a);const s=new _e(t,this.videoTexts,this.headingLevel).render();if(o.appendChild(s),this.videosToShow.length>1){const e=new De(t.key,this).render();o.appendChild(e)}var c;c=this,window.dispatchBldMetrixDynamic&&window.dispatchBldMetrixDynamic("bld-video-component","metrixBoldEvents",{context:c}),n&&(t=>{if(!t)return;let e=t.getBoundingClientRect().top;e-=Re().offsetHeight,window.scrollTo({top:window.scrollY+e,behavior:"smooth"})})(o)}getVideosToShow(t){var e,n;return null===(n=null===(e=t.getAttribute("video"))||void 0===e?void 0:e.split("|"))||void 0===n?void 0:n.map((t=>t.trim()))}createVideoContainer(){const t=document.createElement("div");return t.classList.add("bld-video-component"),t}filterVideos(t,e){return t.filter((t=>!!e[t]))}loadCSSInShadowRoot(){const t=document.createElement("style");t.innerText=`@import '${this.setHostServerUrl()}${Se.webcomponents}`,this.shadowRoot.append(t)}createLoader(){return document.createElement("bldc-spinner")}setHostServerUrl(){const[t]=window.location.host.split(".",1);return t.startsWith("dxp")?t.startsWith("dxp-content")||t.startsWith("dxp-staging")?Ce.www:Ce.beta:""}getHeadingLevel(){const t=["H1","H2","H3","H4","H5","H6"];let e=this.previousElementSibling;for(;e;){if(t.includes(e.tagName)){const t=parseInt(e.tagName[1]);return Math.min(t+1,6)}e=e.previousElementSibling}return 2}}const Oe={GMSBaseURL:{acc:"https://le-webservices.acc.belastingdienst.nl/genesys",prod:"https://le-webservices.belastingdienst.nl/genesys"},basePaths:{beta:"https://beta-t.belastingdienst.nl",www:"https://www-t.belastingdienst.nl"},cssPath:"/bld-assets/bld/webcomponents/css/bld-callmeback.css",wcmConfig:{jsonPathLocal:"data/wcm/bld-callmeback.json",jsonPathWcm:"cci-content/callback/bld-callmeback.json",projectId:"7ed47526-4d00-4640-ab0d-67e28fd06948"},amountOfDaysToShow:7},qe=t=>window.getComputedStyle(document.body).getPropertyValue(t)||"#000";var Ne=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};const Fe=(t,e)=>{const n=new CustomEvent("metrixCallMeBack",{detail:{event:`form_${t}`,name:e,layer:e}});window.dispatchEvent(n)},je=(t,e)=>Ne(void 0,void 0,void 0,(function*(){return new Promise(((n,o)=>{const i=new Date,r=setInterval((function(){t()?(clearInterval(r),n(!0)):new Date-i>e&&(clearInterval(r),o())}),20)}))}));class Ie{constructor(t){this.callmebackComponent=t,this.wcmConfirmationText=this.callmebackComponent.wcmTexts.confirmation,this.template=this.createTemplate()}render(){Fe("complete",this.callmebackComponent.dataType);
1const t=this.createList();this.confirmationListColumn.append(t);this.callmebackComponent.shadowRoot.querySelector("section").append(this.template)}createTemplate(){const t=this.createContainer(),e=te("bldc-grid",{"disable-padding":"true"}),n=this.createHeading(),o=this.createConfirmationList(),i=this.createParagraphBottom();return e.append(n,o,i),t.append(e),t}createConfirmationList(){const t=te("bldc-grid-row",{});return this.confirmationListColumn=te("bldc-grid-column",{col:"10"}),t.append(this.confirmationListColumn),t}createList(){const t=[{icon:"kalender",ariaLabel:this.wcmConfirmationText.ariaLabelIconCalendar,text:this.getFormattedDate(this.callmebackComponent.dataPayload._desired_time)},{icon:"smartphone",ariaLabel:this.wcmConfirmationText.ariaLabelIconPhone,text:this.callmebackComponent.dataPayload._customer_number},{icon:"label_callmeback",ariaLabel:this.wcmConfirmationText.ariaLabelIconSubject,text:this.callmebackComponent.dataPayload.SUBJECT}],e=te("ul",{class:"bld_callmeback_confirmation_list"});return t.forEach((t=>{e.append(this.createListItem(t))})),e}getFormattedDate(t){return new Intl.DateTimeFormat("nl-NL",{weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"2-digit",minute:"2-digit",timeZone:"Europe/Amsterdam"}).format(new Date(t)).replace(",","")+" uur"}createListItem(t){const e=te("bldc-icon",{color:qe("--bldc-icon-primary"),"aria-hidden":"false","font-size":"20",icon:t.icon,"aria-label":t.ariaLabel}),n=te("li",{class:"bld_callmeback_confirmation_list-item"}),o=te("span",{class:"bld_callmeback_confirmation_phoneNumber"},t.text);return n.append(e,o),n}createHeading(){const t=te("bldc-grid-row",{}),e=te("bldc-grid-column",{col:"9"}),n=ee(te("bldc-heading",{bold:"true","disable-margin":"false",level:"2",size:"xl",color:qe("--bldc-text-heading")},this.wcmConfirmationText.title)),o=ee(te("bldc-paragraph",{},this.wcmConfirmationText.paragraphTop));return e.append(n,o),t.append(e),t}createParagraphBottom(){const t=te("bldc-grid-row",{}),e=te("bldc-grid-column",{col:"9.5"}),n=te("bldc-paragraph",{},this.wcmConfirmationText.paragraphBottom);return e.append(n),t.append(e),t}createContainer(){const t=te("div",{class:"bld_callmeback_confirmation"});"contact-op-maat"===this.callmebackComponent.callmebackType&&t.classList.add("bld_callmeback_contact_op_maat");const e=te("span",{role:"img","aria-label":this.wcmConfirmationText.srLabelForSuccessIcon});return t.append(e),t}}class Be{constructor(t){this.callmebackComponent=t,this.wcmErrorText=this.callmebackComponent.wcmTexts.errors,this.template=this.createTemplate()}render(){const t=this.callmebackComponent.responsePhrase||"default",e=this.wcmErrorText[t]||this.wcmErrorText.default,n=(null==e?void 0:e.title)||"Er is een fout opgetreden",o=(null==e?void 0:e.text)||"U kunt op dit moment geen afspraak maken. Probeer het later opnieuw.";this.errorNotificationElement.setAttribute("elem-title",n),this.errorNotificationElement.innerHTML=o;this.callmebackComponent.shadowRoot.querySelector("section").append(this.template)}createTemplate(){const t=te("bldc-grid",{"disable-padding":"true"}),e=this.createErrorMessage();return t.append(e),t}createErrorMessage(){const t=te("bldc-grid-row",{class:"error_message_row"}),e=te("bldc-grid-column",{});return this.errorNotificationElement=te("bldc-notification",{compact:"false","disable-icon":"false","show-animation":"show",type:"error"}),e.append(this.errorNotificationElement),t.append(e),t}}var $e=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class Ue{getJSON(t){return $e(this,void 0,void 0,(function*(){const e=yield this.getData(t);try{if(!e)throw new Error("No response in getJSON()");return e.json()}catch(t){console.error("ApiClient > getJSON > error:",t)}}))}postJSON(t,e){return $e(this,void 0,void 0,(function*(){const n=yield this.postData(t,e);try{if(!n)throw new Error("No response in postJSON()");return yield n.json()}catch(t){return console.error("ApiClient > postJSON > error:",t),n}}))}getData(t){return $e(this,void 0,void 0,(function*(){try{return yield fetch(t)}catch(t){console.error("Error in getData",t)}}))}postData(t,e){return $e(this,void 0,void 0,(function*(){try{return yield fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(t){console.error("Error in postData:",t)}}))}}
1var Ve=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};const He=new class{getCurrentTimeStamp(){return Ve(this,void 0,void 0,(function*(){try{const t=(yield fetch(window.location.href,{method:"HEAD"})).headers.get("date");return t?Date.parse(t):Date.now()}catch(t){return Date.now()}}))}};var We=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};const Ge=new class{constructor(){this.gmsBaseUrl=this.getGMSBaseURL()}getAvailableTimes(t){return We(this,void 0,void 0,(function*(){const e=yield this.getGenesysUrl(t,"get");return yield(new Ue).getJSON(e)}))}postData(t,e){return We(this,void 0,void 0,(function*(){const n=yield this.getGenesysUrl(t,"post");return yield(new Ue).postJSON(n,e)}))}getGenesysUrl(t,e){return We(this,void 0,void 0,(function*(){const n=`${this.gmsBaseUrl}/1/service/callback/${t}`;if("post"===e)return n;if("get"===e){const t=yield He.getCurrentTimeStamp();return`${n}/availability?start=${new Date(t).toISOString()}&number-of-days=${Oe.amountOfDaysToShow}`}return""}))}getGMSBaseURL(){const{GMSBaseURL:t}=Oe,[e]=window.location.host.split(".");return["dxp-content","dxp-staging","www-o","www-t","www-m","www"].some((t=>e===t))||"prod"===this.checkParaForBeta()?t.prod:t.acc}checkParaForBeta(){return"prod"===new URLSearchParams(window.location.search).get("genesys")?"prod":"acc"}};var Je=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class Ke{constructor(t){this.callmebackComponent=t,this.submitForm=()=>Je(this,void 0,void 0,(function*(){var t,e,n;if(!(yield this.triggerValidation()))return;this.setLoadingState(!0);const o=yield Ge.postData(this.callmebackComponent.skillGroup,this.callmebackComponent.dataPayload);if(this.setLoadingState(!1),!(null==o?void 0:o._id)||(null===(t=this.callmebackComponent.debug)||void 0===t?void 0:t.postResponse)){if((null===(n=null===(e=this.callmebackComponent.debug)||void 0===e?void 0:e.postResponse)||void 0===n?void 0:n.length)&&(o.phrase=this.callmebackComponent.debug.postResponse),"NUMBER_REJECTED"===(null==o?void 0:o.phrase))return this.inputPhoneNumber.validators=[{name:"custom:phoneNumberRejected",validationType:"rejected",message:this.wcmErrorText.NUMBER_REJECTED.text}],yield this.inputPhoneNumber.bldcValidateValue(),void(this.inputPhoneNumber.validators=[]);this.callmebackComponent.responsePhrase=null==o?void 0:o.phrase,this.callmebackComponent.viewController.setView("error")}else this.callmebackComponent.viewController.setView("confirmation")})),this.triggerValidation=()=>Je(this,void 0,void 0,(function*(){const t=Array.from(this.form.querySelectorAll("bldc-input, bldc-select-box")).filter((t=>{var e;return t.required||(null===(e=t.getAttribute("validators"))||void 0===e?void 0:e.includes("required"))})).map((t=>Je(this,void 0,void 0,(function*(){try{return"function"==typeof t.bldcValidateValue?(yield t.bldcValidateValue(),t.bldcGetValid()):"function"!=typeof t.doValidate||(yield t.doValidate(),t.valid)}catch(e){return console.error("Validation failed for:",t,e),!1}}))));return(yield Promise.all(t)).every((t=>!0===t))})),this.wcmFormText=this.callmebackComponent.wcmTexts.form,this.wcmErrorText=this.callmebackComponent.wcmTexts.errors,this.template=this.createTemplate(),this.setEvents()}render(){var t;this.selectboxDay.data=this.getAvailableDays();const e=this.callmebackComponent.shadowRoot.querySelector("section");(null===(t=this.callmebackComponent.debug)||void 0===t?void 0:t.autoFill)&&this.autoFillForm(
1),"default"===this.callmebackComponent.callmebackType&&Fe("start",this.callmebackComponent.dataType),e.append(this.template),this.dispatchMetrixStandardElements()}createTemplate(){this.form=te("bldc-form",{class:"bld_callmeback_form",name:"callmeback"});const t=te("bldc-grid",{"disable-padding":"true"});return"default"===this.callmebackComponent.callmebackType&&this.createDefaultForm(t),"contact-op-maat"===this.callmebackComponent.callmebackType&&this.createContactOpMaatForm(t),this.form.append(t),this.form}createDefaultForm(t){const e=this.createFormHeader(),n=this.createPhoneRow(),o=this.createLastNameRow(),i=this.createDayAndTimeRow(),r=this.createAvgRow(),a=this.createButtonRow();t.append(e,n,o,i,r,a)}createContactOpMaatForm(t){this.form.classList.add("bld_callmeback_contact_op_maat");const e=this.createPhoneRow(),n=this.createLastNameRow(),o=this.createDayRow(),i=this.createTimeRow(),r=this.createAvgRow(),a=this.createButtonRow();t.append(e,n,o,i,r,a)}createFormHeader(){const t=te("bldc-grid-row",{class:"form_header_row"}),e=te("bldc-grid-column",{col:"9"}),n=ee(te("bldc-heading",{bold:"true","disable-margin":"false",color:qe("--bldc-text-heading"),level:"2",size:"xl"},this.wcmFormText.title)),o=ee(te("bldc-paragraph",{},this.wcmFormText.introText));return e.append(n,o),t.append(e),t}createPhoneRow(){var t;const e=te("bldc-grid-row",{class:"input_row"}),n=te("bldc-grid-column",{col:"9",md:"12"}),o=te("span",{slot:"explanation"},this.wcmFormText.phoneNumber.explanationText),i=te("span",{slot:"label"},this.wcmFormText.phoneNumber.label),r=te("div",{slot:"help"},(null===(t=this.wcmFormText.phoneNumber)||void 0===t?void 0:t.helpText)||"");return this.inputPhoneNumber=te("bldc-input",{class:"bld_callmeback_phoneNumber",name:"phoneNumber",predefined:"phone-nl"},o.outerHTML+r.outerHTML+i.outerHTML),n.append(this.inputPhoneNumber),e.append(n),e}createLastNameRow(){var t;const e=te("bldc-grid-row",{class:"input_row"}),n=te("bldc-grid-column",{col:"9",md:"12"}),o=te("span",{slot:"explanation"},this.wcmFormText.lastName.explanationText),i=te("span",{slot:"label"},this.wcmFormText.lastName.label),r=te("div",{slot:"help"},(null===(t=this.wcmFormText.lastName)||void 0===t?void 0:t.helpText)||"");return this.inputLastName=te("bldc-input",{class:"bld_callmeback_lastName",name:"lastName",predefined:"name","input-type":"text",size:"44",validators:JSON.stringify([{name:"required",message:this.wcmFormText.lastName.validationText}])},o.outerHTML+r.outerHTML+i.outerHTML),n.append(this.inputLastName),e.append(n),e}createDayAndTimeRow(){const t=te("bldc-grid-row",{class:"day_and_time_row"}),e=this.createDayColumn(),n=this.createTimeColumn();return t.append(e,n),t}createDayRow(){const t=te("bldc-grid-row",{class:"input_row"}),e=this.createDayColumn();return t.append(e),t}createTimeRow(){const t=te("bldc-grid-row",{class:"input_row"}),e=this.createTimeColumn();return t.append(e),t}createDayColumn(){const t=te("bldc-grid-column",{col:"contact-op-maat"===this.callmebackComponent.callmebackType?"7.28":"5",md:"12"}),e=te("span",{slot:"label"},this.wcmFormText.selectDay.label);return this.selectboxDay=te("bldc-select-box",{class:"bld_callmeback_select_day",name:"desiredday",placeholder:this.wcmFormText.selectDay.placeholder,required:"true"},e.outerHTML),t.append(this.selectboxDay),t}createTimeColumn(){const t=te("bldc-grid-column",{col:"contact-op-maat"===this.callmebackComponent.callmebackType?"7.28":"4",md:"12"}),e=te("span",{slot:"label"},this.wcmFormText.selectTime.label);return this.selectboxTime=te("bldc-select-box",{class:"bld_callmeback_select_time",name:"desiredtime",placeholder:this.wcmFormText.selectTime.placeholderInit,required:"true",disabled:"true"},e.outerHTML),t.append(this.selectboxTime),t}createAvgRow(){const t=te("bldc-grid-row",{class:"avg_row"}),e=te("bldc-grid-column",{col:"9",md:"12"}),n=ee(te("bldc-paragraph",{},this.wcmFormText.avgText));return e.append(n),t.append(e),t}createButtonRow(){const t=te("bldc-grid-row",{class:"button_row"}),e=te("bldc-grid-column"),n=te("div",{class:"bld_callmeback_btn_container"});return this.submitButton=te("bldc-button",{class:"bld_callmeback_btn_submit","elem-title":this.wcmFormText.buttonSend.title,icon:"verzend","html-type":"button",type:"primary"}),n.append(this.submitButton),e.append(n),t.append(e),t}setEvents(){this.inputPhoneNumber.addEventListener("bldcBlur",(t=>{this.callmebackComponent.dataPayload._customer_number=t.detail.bldcValue})),this.inputLastName.addEventListener("bldcBlur",(t=>{this.callmebackComponent.dataPayload.lastname=t.detail.bldcValue})),this.selectboxDay.addEventListener("bldcValueChange",(t=>{this.setAvailableTimesOfChosenDay(t.detail.bldcValue)})),this.selectboxTime.addEventListener("bldcValueChange",(t=>{this.callmebackComponent.dataPayload._desired_time=t.detail.bldcValue})),this.submitButton.addEventListener("bldcClick",this.submitForm)}getAvailableDays(){const t=this.callmebackComponent.availableTimes,e=Object.keys(t).map((t=>new Date(t).toISOString().split("T")[0]));return[...new Set(e)].map((t=>({title:this.getDateInFullText(new Date(t)),value:t})))}
1getDateInFullText(t=new Date){const e=t.toLocaleString("nl-NL",{weekday:"long",day:"numeric",month:"long",year:"numeric"});return e.charAt(0).toUpperCase()+e.slice(1)}setAvailableTimesOfChosenDay(t){const{availableTimes:e}=this.callmebackComponent,n=Object.keys(e).filter((e=>e.includes(t))).map((t=>({title:this.getTimeForText(new Date(t)),value:t})));this.selectboxTime.data=n,this.selectboxTime.removeAttribute("disabled"),this.selectboxTime.placeholder=this.wcmFormText.selectTime.placeholder}getTimeForText(t=new Date){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}autoFillForm(){return Je(this,void 0,void 0,(function*(){var t,e;const n="06"+Math.random().toString().slice(2,10)||"",o="Auwto Fihl";yield this.inputPhoneNumber.bldcSetBldcValue(n),yield this.inputLastName.bldcSetBldcValue(o);const i=(null===(t=this.selectboxDay.data[0])||void 0===t?void 0:t.value)||"";this.selectboxDay.bldcValue=i,this.setAvailableTimesOfChosenDay(this.selectboxDay.bldcValue);const r=(null===(e=this.selectboxTime.data[0])||void 0===e?void 0:e.value)||"";this.selectboxTime.bldcValue=r,this.callmebackComponent.dataPayload._customer_number=n,this.callmebackComponent.dataPayload.lastname=o,this.callmebackComponent.dataPayload._desired_time=r}))}dispatchMetrixStandardElements(){const t={boldComponent:this.callmebackComponent.shadowRoot,selectors:"a"};window.dispatchBldMetrixDynamic(this.callmebackComponent.tagName.toLowerCase(),"metrixDynamicContent",t)}setLoadingState(t){const e="callmeback-post-spinner",n=this.callmebackComponent.shadowRoot.getElementById(e);if(n&&n.remove(),t){const t=te("bldc-spinner",{id:e});this.submitButton.insertAdjacentElement("afterend",t)}[this.inputPhoneNumber,this.inputLastName,this.selectboxDay,this.selectboxTime,this.submitButton].forEach((e=>e.setAttribute("disabled",t.toString())))}}var Qe=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class Ze{constructor(t){this.callmebackComponent=t,this.wcmIntroText=this.callmebackComponent.wcmTexts.introduction,this.container=te("div",{class:"bld_callmeback_intro"}),this.heading=this.createBldcHeading(),this.button=this.createButton(),this.paragraph=this.createParagraph();const e=te("bldc-grid",{"disable-padding":"true"}),n=te("bldc-grid-row"),o=te("bldc-grid-column",{col:"9"}),i=te("div",{class:"bld_callmeback_btn_container"});i.append(this.button),o.append(this.heading,this.paragraph,i),n.appendChild(o),e.append(n),this.container.appendChild(e),this.initListeners()}render(){const t=this.callmebackComponent.shadowRoot.querySelector("section");t&&!t.contains(this.container)&&t.appendChild(this.container)}createBldcHeading(){const t={bold:"true",color:qe("--bldc-text-heading"),disableMargin:"false",level:"2",size:"xl"},e=te("bldc-heading",t,this.wcmIntroText.title);return ee(e)}createParagraph(){const t=te("bldc-paragraph",{},this.wcmIntroText.paragraph);return ee(t)}createButton(){const t={class:"bld_callmeback-btn-show-form",name:"bld_callmeback-btn-show-form",icon:"smartphone","elem-title":this.wcmIntroText.buttonConfirm,"html-type":"button",type:"primary"};return te("bldc-button",t)}callbackEventHandler(){return Qe(this,void 0,void 0,(function*(){this.setLoadingState();const t=yield Ge.getAvailableTimes(this.callmebackComponent.skillGroup);this.callmebackComponent.availableTimes=t,this.callmebackComponent.viewController.setView("form")}))}initListeners(){this.button.addEventListener("bldcClick",(()=>Qe(this,void 0,void 0,(function*(){return yield this.callbackEventHandler()}))))}setLoadingState(){const t=te("bldc-spinner",{id:"callmeback-intro-spinner"});this.button.insertAdjacentElement("afterend",t),this.button.setAttribute("disabled","true")}}class Ye{constructor(t){this.callmebackComponent=t,this.views={}}init(){this.views.intro=new Ze(this.callmebackComponent),this.views.form=new Ke(this.callmebackComponent),this.views.error=new Be(this.callmebackComponent),this.views.confirmation=new Ie(this.callmebackComponent)}setView(t){if(!this.callmebackComponent.availableTimes&&"intro"===t&&"default"===this.callmebackComponent.callmebackType)return;this.cleanView();let e=this.views[t];e&&(this.callmebackComponent.availableTimes||(e=this.views.error),e.render()),"intro"!==t&&"form"!==t||this.dispatchMetrixBoldEvents()}dispatchMetrixBoldEvents(){window.dispatchBldMetrixDynamic(this.callmebackComponent.tagName.toLowerCase(),"metrixBoldEvents",{context:this.callmebackComponent.shadowRoot})}cleanView(){this.callmebackComponent.shadowRoot.querySelector("section.bld_callmeback").innerHTML=""}}const Xe=()=>Array.from(document.body.classList).find((t=>t.includes("toeslagen")))?"toeslagen":"belastingdienst",tn=t=>{const e=window.location.search;return new URLSearchParams(e).get(t)};
1var en=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class nn{getTexts(t){return en(this,void 0,void 0,(function*(){const e=this.getUrl(t);if(!e)return;const{sessionId:n}=t;if(n&&sessionStorage.getItem(n))return JSON.parse(sessionStorage.getItem(n));const o=yield(new Ue).getJSON(e);return null===sessionStorage||void 0===sessionStorage||sessionStorage.setItem(n,JSON.stringify(o)),o}))}getUrl(t){if(!this.isValidConfig(t))throw new Error("Config is not valid");const e=new URL(window.location.href),n=this.getBaseUrl(e);if("localhost"===e.hostname)return`${n}/${t.jsonPathLocal.replace(/^\//,"")}`;if(e.hostname.endsWith(".belastingdienst.nl")){const o=`${n}${this.extractWcmPath(e.pathname)}${t.jsonPathWcm.replace(/^\//,"")}`;return t.projectId?`${o}?projectid=${t.projectId}`:o}return null}isValidConfig(t){var e,n;return!(!(null===(e=t.jsonPathLocal)||void 0===e?void 0:e.length)||!(null===(n=t.jsonPathWcm)||void 0===n?void 0:n.length))}getBaseUrl(t){const{protocol:e,hostname:n,port:o}=t;return n.includes("beta")?"https://dxp-content.belastingdienst.nl":`${e}//${n}${o?`:${o}`:""}`}extractWcmPath(t){const e=t.match(/^\/wps\/wcm\/(?:my)?connect\//);return(null==e?void 0:e.length)?e[0]:""}}var on=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class rn{constructor(t,e){this.subject=t,this.dienstOnderdeel=e}getWcmTexts(t){return on(this,void 0,void 0,(function*(){return yield(new nn).getTexts(t).then((t=>this.replaceVarsInWcmTexts(t)))}))}replaceVarsInWcmTexts(t){var e;const n=null===(e=t.form)||void 0===e?void 0:e.title;n&&(t.form.title=n.replace("[[page-subject]]",this.subject));const{avgText:o,avgLink:i,avgLinkToeslagen:r}=t.form;if(o){let e;return"belastingdienst"===this.dienstOnderdeel&&(e=i.link),"toeslagen"===this.dienstOnderdeel&&(e=r.link),t.form.avgText=o.replace("[[avgLink]]",e),t}}}class an{static validate(t,e){const{validationType:n,message:o}=e;return"rejected"===n?{valid:!1,message:o||"Terugbellen op dit nummer is niet toegestaan. Probeer het opnieuw met een ander telefoonnummer."}:{valid:!0}}}an.NAME="custom:phoneNumberRejected";var sn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class cn extends HTMLElement{constructor(t="default"){super(),this.createStyle=()=>{const t=document.createElement("style");return t.innerHTML=`@import '${(()=>{const{basePaths:t}=Oe,[e]=window.location.host.split(".");return e.includes("dxp")?e.includes("dxp-content")||e.includes("dxp-staging")?t.www:t.beta:""})()}${Oe.cssPath}'`,t},this.version="3.0.0",this.callmebackType=t,this.attachShadow({mode:"open"}),this.viewController=new Ye(this)}connectedCallback(){return sn(this,void 0,void 0,(function*(){if(this.initProperties(),!this.skillGroup)return;this.debug={postResponse:tn("bld-post-response"),autoFill:tn("bld-autofill")},this.addMainContainer();const t=Oe.wcmConfig;this.wcmTexts=yield new rn(this.subject,this.dienstOnderdeel).getWcmTexts(t),yield this.processGetRequest(),yield this.registerBoldValidators(),this.viewController.init(),"default"===this.callmebackType&&this.viewController.setView("intro"),"contact-op-maat"===this.callmebackType&&this.viewController.setView("form"),((t,e)=>{const n={detail:{layer:e,name:t||"#"}};je((()=>window.adobeDataLayer.some((t=>"page_loaded"===(null==t?void 0:t.event)))),3e3).then((()=>{const t=new CustomEvent("metrixImpressions",n);window.dispatchEvent(t)})).catch((()=>{console.warn("metrixImpression not set")}))})(this.wcmTexts.introduction.title,this.dataType)}))}registerBoldValidators(){return sn(this,void 0,void 0,(function*(){if(!(yield M("BldcValidatorService.register",3e3)))return;
1[an].forEach((t=>{var e;return null===(e=window.BldcValidatorService)||void 0===e?void 0:e.register(t)}))}))}processGetRequest(){return sn(this,void 0,void 0,(function*(){const t=yield Ge.getAvailableTimes(this.skillGroup);(null==t?void 0:t.phrase)?this.responsePhrase=t.phrase:this.availableTimes=t}))}initProperties(){this.skillGroup=this.skillGroup||this.getSkillgroupThroughAttribute(),this.subject=this.subject||this.getAttribute("subject"),this.dataType=this.dataType||"callmeback",this.dienstOnderdeel=Xe(),this.dataPayload={_customer_number:"",lastname:"",SUBJECT:this.subject,_desired_time:""}}getSkillgroupThroughAttribute(){const t=this.getAttribute("skill-group");if(!t)return;const[e]=t.split("(");return e}addMainContainer(){const t=this.createStyle(),e=this.createSection();this.shadowRoot.append(t,e)}createSection(){var t;const e=document.createElement("section"),n=null!==(t=this.getAttribute("data-type"))&&void 0!==t?t:"callmeback";return e.classList.add("bld_callmeback"),"default"===this.callmebackType&&e.classList.add("bld_callmeback_default"),"toeslagen"===this.dienstOnderdeel&&e.classList.add("toeslagen-light"),e.setAttribute("data-type",n),e}}class ln{constructor(t){this.contactOpMaatComponent=t,this.wcmFormTextContactOpMaat=t.wcmTexts.contactOpMaat,this.createTemplate()}render(){this.contactOpMaatComponent.section.append(this.form)}createTemplate(){this.form=te("bldc-form",{class:"bld_callmeback_form",name:"callmeback"});const t=te("bldc-grid",{"disable-padding":"true"}),e=te("bldc-grid-row",{style:"margin-bottom: 1rem"}),n=te("bldc-grid-column");this.radiobuttonGroup=this.createRadiobuttonGroup(),n.append(this.radiobuttonGroup),e.append(n),t.append(e),this.form.append(t)}createRadiobuttonGroup(){const t=te("bldc-radiobutton-group",{legend:this.wcmFormTextContactOpMaat.legendSkillgroupRadioButtongroup,name:"skillgroups"});return this.contactOpMaatComponent.skillgroups.forEach((({label:e,skillgroup:n})=>t.append(this.createRadiobutton(e,n)))),"contact-intermediairs"!==this.contactOpMaatComponent.presentationType&&t.append(this.createRadiobutton(this.wcmFormTextContactOpMaat.textSkillgroupRadioButtonSubjectNotInList,"no-subject")),t}createRadiobutton(t,e){return te("bldc-radiobutton",{value:e},t)}}var dn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function a(t){try{c(o.next(t))}catch(t){r(t)}}function s(t){try{c(o.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))};class un extends HTMLElement{constructor(){super(),this.version="2.0.0",this.attachShadow({mode:"open"}),this.presentationType=this.getAttribute("presentation-type"),this.skillgroups=this.getAllSkillgroups(),this.subject=this.getAttribute("subject"),this.dienstOnderdeel=Xe(),this.dataType="callmeback - contact op maat",this.section=this.createSection(),this.hrefBackToSubjectPage=this.getAttribute("parent-sitearea")}connectedCallback(){return dn(this,void 0,void 0,(function*(){yield this.initProperties(),this.render()}))}render(){this.view.render(),this.setEvents(),this.shadowRoot.append(this.section)}initProperties(){return dn(this,void 0,void 0,(function*(){const{wcmConfig:t}=Oe;this.wcmTexts=yield new rn(this.subject,this.dienstOnderdeel).getWcmTexts(t),this.view=new ln(this)}))}createSection(){return te("section",{name:"bld_section_callback_contact_op_maat",class:"bld_callmeback_contact_op_maat","data-type":this.dataType})}getAllSkillgroups(){const t=this.getAttribute("skill-group"),e=this.getAttribute("skill-group-titles");if(!t&&!e)return void console.warn("Skillgroups and/or titles are not valid");const n=t.split("|"),o=e.split("|");if(n.length===o.length)return n.map(((t,e)=>({skillgroup:t,label:o[e]})));console.warn("The number of skillgroups and the number of skillgroup titles are not equal")}setEvents(){[...this.view.radiobuttonGroup.children].forEach((t=>{t.addEventListener("bldcClick",(t=>this.placeCallmebackInDOM(t)))}))}placeCallmebackInDOM(t){const e=t.detail.value;if(this.cleanContainer(),"no-subject"===e)return void this.displayNotifcationNoSubject();const n=new cn("contact-op-maat"),[o]=e.split("(");n.skillGroup=o,n.subject=this.subject,n.dataType=this.dataType,this.shadowRoot.appendChild(n)}displayNotifcationNoSubject(){const{buttonBack:t,noSubject:e}=this.wcmTexts.contactOpMaat,n=this.createGridRowNotification(e),o=this.createGridRowButton(t);this.shadowRoot.querySelector("bldc-form bldc-grid").append(n,o)}createGridRowNotification(t){const{id:e,type:n,elemTitle:o,ariaLabel:i,content:r}=t,a=r.map((t=>t.richText)).join(""),s=te("bldc-grid-row",{class:"no-subject-row",style:"margin-bottom: 1rem;"}),c=te("bldc-grid-column"),l=te("bldc-notification",{id:e,type:n,"elem-title":o,"aria-label":i,"show-animation":"true"},a);return c.append(l),s.append(c),s}createGridRowButton(t){const e=te("bldc-grid-row",{class:"no-subject-row"}),n=te("bldc-grid-column"),o=te("bldc-button",{"elem-title":t.title,href:this.hrefBackToSubjectPage});return n.append(o),e.append(n),e}cleanContainer(){const t=this.shadowRoot.querySelectorAll("bld-callback-component, .no-subject-row");t.length&&t.forEach((t=>t.remove()))}}const hn=[{htmlTag:"bld-beltel-queue-time-component",componentClass:c},{htmlTag:"bld-survey-component",componentClass:E},{htmlTag:"bld-callback-component",componentClass:cn},{htmlTag:"bld-contact-op-maat-component",componentClass:un},{htmlTag:"bld-productenoverzicht",componentClass:be}
1,{htmlTag:"bld-video-component",componentClass:ze}];var mn;(mn=hn)&&mn.forEach((t=>{const{htmlTag:e,componentClass:n}=t;window.customElements.define(e,n)})),(t=>{if("object"!=typeof ReadSpeaker)return;if(!t)return;const e=D(t);if(0===e.length)return;const n=ReadSpeaker?.cfg?.c?.ui?.disableShortcutSelector;n&&(ReadSpeaker.cfg.c.ui.disableShortcutSelector=e.join())})(hn),F(void 0,void 0,void 0,(function*(){const t=[z,N];(yield M("BldcValidatorService.register",3e3))&&t.forEach((t=>{window.BldcValidatorService.register(t)}))}))}()}();

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.