(()=>{functione(e,t){for(vara=0;a<t.length;a++){varn=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"inn&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}(new(function(){functiont(){!function(e,t){if(!(einstanceoft))thrownewTypeError("Cannot call a class as a function")}(this,t),this.url=newURL(document.querySelector("meta[name=pdf-url]").content),this.startDate="",this.endDate="",this.showPaymentsTable=!1,this.showAgingTable=!1,this.status=""}vara,n,r;returna=t,(n=[{key:"bindEventListeners",value:function(){vare=this;["#date-from","#date-to","#show-payments-table","#show-aging-table","#status"].forEach((function(t){document.querySelector(t).addEventListener("change",(function(t){returne.handleValueChange(t)}))}))}},{key:"handleValueChange",value:function(e){"checkbox"===e.target.type?this[e.target.dataset.field]=e.target.checked:this[e.target.dataset.field]=e.target.value,this.updatePdf()}},{key:"composedUrl",get:function(){returnthis.url.search="",this.startDate.length>0&&this.url.searchParams.append("start_date",this.startDate),this.endDate.length>0&&this.url.searchParams.append("end_date",this.endDate),this.url.searchParams.append("status",document.getElementById("status").value),this.url.searchParams.append("show_payments_table",+this.showPaymentsTable),this.url.searchParams.append("show_aging_table",+this.showAgingTable),this.url.href}},{key:"updatePdf",value:function(){document.querySelector("meta[name=pdf-url]").content=this.composedUrl;vare=document.querySelector("#pdf-iframe");e&&(e.src=this.composedUrl),document.querySelector("meta[name=pdf-url]").dispatchEvent(newEvent("change"))}},{key:"handle",value:function(){vare=this;this.bindEventListeners(),document.querySelector("#pdf-download").addEventListener("click",(function(){vart=newURL(e.composedUrl);t.searchParams.append("download",1),window.location.href=t.href}))}}])&&e(a.prototype,n),r&&e(a,r),Object.defineProperty(a,"prototype",{writable:!1}),t}())).handle()})();