"use strict";var BT50=window.BT50||{};BT50&&BT50.Widget||(BT50.Widget=function(o){if((o=Object.assign({elementID:"#BT50Widget",billSheet:"00000000-0000-0000-0000-000000000000",height:"400px",width:"100%",rows:100,showPosition:!1,borderColor:"",fontFamily:"",fontSize:"",linkColor:"",tBackground:"",tForeground:"",title:"",stateFilter:"",sortBy:0,sortDir:"desc"},o)).rootUrl="https://www.billtrack50.com",r(o),!document.getElementById("bt50BillCss")){var t=document.getElementsByTagName("head")[0],e=document.createElement("link");e.id="bt50Css",e.rel="stylesheet",e.type="text/css",e.href="".concat(o.rootUrl,"/css/bt50.widget.bill.css"),t.appendChild(e)}function n(){var t=document.querySelector(o.elementID);t.classList.add("bt50Widget"),t.style.width=o.width,o.borderColor.length&&(t.style.borderColor=o.borderColor),o.fontFamily.length&&(t.style.fontFamily=o.fontFamily),o.fontSize.length&&(t.style.fontSize=o.fontSize),o.width.length&&(t.style.width=o.width);var e=document.createElement("div");e.classList.add("bt50Title","text-truncate"),e.innerHTML=o.title,o.tForeground.length&&(e.style.backgroundColor=o.tBackground),o.tForeground.length&&(e.style.color=o.tForeground);var n=document.createElement("div");n.classList.add("bt50BodyWrap"),n.style.height=o.height,n.innerHTML='
Loading...
',t.appendChild(e),t.appendChild(n),function(){var t=new URL("".concat(o.rootUrl,"/BT50Api/2.1/widget/bills"));return t.searchParams.append("billSheetGuid",o.billSheet),t.searchParams.append("showPosition",o.showPosition),t.searchParams.append("rowCount",o.rows),t.searchParams.append("stateFilter",o.stateFilter),t.searchParams.append("sortBy",o.sortBy),t.searchParams.append("sortDir",o.sortDir),fetch(t).then(function(t){if(!t.ok)throw Error(t.statusText);return t.text()})}().then(function(t){n.innerHTML=t,o.linkColor.length&&n.querySelectorAll("a.billTitle").forEach(function(t){t.style.color=o.linkColor})}).catch(function(t){n.innerHTML='
An error occurred retrieving bills.
'})}function r(t){"string"==typeof t.rows&&(t.rows=parseInt(t.rows)),"string"==typeof t.sortBy&&(t.sortBy=parseInt(t.sortBy)),t.height=t.height.toString(),t.height.includes("px")||(t.height="".concat(t.height,"px")),t.width=t.width.toString(),t.width.includes("px")||t.width.includes("%")||(t.width="".concat(t.width,"px")),t.fontSize=t.fontSize.toString(),t.fontSize.length&&!t.fontSize.includes("px")&&(t.fontSize="".concat(t.fontSize,"px"))}this.refresh=function(){document.querySelector(o.elementID).innerHTML="",n()},this.setOption=function(t,e){o[t]=e,r(o)},"complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?n():document.addEventListener("DOMContentLoaded",function(){n()})});