function json2tr(a){var e=[];return $.each(a,(function(a,t){var s="";$.each(this,(function(a,e){"url"===a?s+="":null===e?s+="<td>-</td>":$.isNumeric(e)&&e<0?s+="<td class='text-danger'>"+e+"</td>":e.length>40?s+="<td>"+e.substring(0,40)+"...</td>":s+="<td>"+e+"</td>"})),e.push("<tr class='clickableRow' data-href='"+t.url+"'>"+s+"</tr>")})),e}function reloadClickableRow(){$(".clickableRow").mousedown((function(a){if(1===a.which){var e=$(this).attr("data-href"),t=$(this).attr("data-bs-target");void 0!==e&&!1!==e&&(void 0!==t&&"_blank"===t?window.open($(this).attr("data-href")):parent.document.location=$(this).attr("data-href"))}}))}function appendSearchResults(a,e,t){$("#v-pills-tab").append("<a class='nav-link text-nowrap' id='v-pills-"+a+"-tab' data-bs-toggle='pill' href='#v-pills-"+a+"' role='tab' aria-controls='v-pills-"+a+"' aria-expanded='true'>\n        <i class='"+e.icon+" fa-fw me-1 d-none d-lg-inline-block'></i>\n        <span class='d-inline d-lg-inline'>"+e.title+"</span>\n        <span class='badge bg-secondary ms-1 mt-lg-1 mb-lg-1 float-lg-end'>"+t.length+"</span>\n    </a>");var s="<thead><tr>";$.each(e.columns,(function(a,e){s+="<th>"+e+"</th>"})),s+="<tr></thead>",$.each(t,(function(a,e){s+=e})),$("#v-pills-tabContent").append("<div class='tab-pane fade' id='v-pills-"+a+"' role='tabpanel' aria-labelledby='v-pills-"+a+"-tab'>\n        <div class='card shadow'><div class='table-responsive'>\n        <table class='table table-striped table-hover mb-0'>"+s+"</table>\n        </div>\n</div>\n</div>"),$("#v-pills-tab a:first").tab("show"),reloadClickableRow(),$("#no-data-msg").hide()}function updateSearchProgress(a,e){var t=$("#mega-search-progress");if(!(0===t.length||e<1)){var s=Math.round(a/e*100);$("#mega-search-progress-counter").text(a+" / "+e),t.attr("aria-valuenow",a),$("#mega-search-progress-bar").css("width",s+"%").attr("aria-valuenow",a),a>=e&&($("#mega-search-progress-bar").removeClass("progress-bar-animated"),$("#mega-search-progress-spinner").removeClass("spinner-border spinner-border-sm text-primary").addClass("fa-solid fa-check text-success"),0===$("#v-pills-tab a").length&&$("#no-data-msg").removeClass("d-none").show(),window.setTimeout((function(){$("#mega-search-status-row").fadeOut()}),400))}}function searchOnSection(a){$.getJSON(a,(function(a){$.each(a,(function(a,e){var t=json2tr(e.results);t.length>0&&appendSearchResults(a,e,t)}))}))}function searchOnSections(a){var e=Object.values(a),t=0,s=0,n=e.length;updateSearchProgress(s,n),function a(){if(t<e.length){var r=e[t];return t++,void $.getJSON(r,(function(a){$.each(a,(function(a,e){var t=json2tr(e.results);t.length>0&&appendSearchResults(a,e,t)}))})).always((function(){updateSearchProgress(++s,n),a()}))}updateSearchProgress(s,n)}()}