"use strict";document.addEventListener("readystatechange",()=>{if("complete"===document.readyState){refreshIndexState(),window.setInterval(refreshIndexState,5e3);const e=getNotifyAdapter();if(e){const t=`.${e.prefix}-bootstrap4-base`,n=`.${e.prefix}-wrapper`;e.api.addStyle("bootstrap4",{html:'<div>\n      <div class="card shadow" style="width: 18rem;">\n        <div class="card-body">\n          <div class="d-flex justify-content-between align-items-baseline">\n            <div>\n              <h5 class="card-title mb-2" data-notify-html="title"></h5>\n              <h6 class="card-subtitle mb-2 text-muted" data-notify-text="subtitle"></h6>\n            </div>\n            <button type="button" class="close no">\n              <span aria-hidden="true">&times;</span>\n            </button>\n          </div>\n          <p class="card-text" data-notify-text="text"></p>\n        </div>\n      </div>\n    </div>'}),$(document).on("click",`${t} .no`,function(){$(this).trigger("notify-hide")}),$(document).on("notify-show",n,function(){const n=$(t,$(this)).get(0);if(!n)return;const o=Array.from(n.classList).find(t=>t!==`${e.prefix}-bootstrap4-base`);if(!o)return;const d=o.split("-");$(".card",$(this)).addClass("bg-"+d[d.length-1])})}$("#includechildren_copy").prop("checked",$("#includechildren").prop("checked")),$("#includechildren_copy").on("click",function(){console.log($(this).prop("checked")),$("#includechildren").prop("checked",$(this).prop("checked")),$("button[type=submit]",$("#includechildren").closest("form")).click()}),$("#includechildren").closest(".form-group").addClass("d-none")}});const getNotifyAdapter=()=>$.notify&&"function"==typeof $.notify.addStyle?{api:$.notify,prefix:"notifyjs"}:$.enotify&&"function"==typeof $.enotify.addStyle?{api:$.enotify,prefix:"enotifyjs"}:null,refreshIndexState=()=>{const e=document.getElementById("indexState").dataset.src,t=new XMLHttpRequest;t.addEventListener("load",render),t.open("POST",e,!0),t.send()},render=e=>{const t=JSON.parse(e.currentTarget.response),n=document.querySelector("#indexState tbody");n.replaceChildren("");for(const[e,o]of Object.entries(t.stats)){const t=document.createElement("TR");if("total"!==e)appendColumn(t,o.cNameDeutsch),appendColumn(t,o.stats.documentCount),appendColumn(t,readableFileSizeString(o.stats.fileSize));else{const e=o.documentCountAcrossLanguages!==o.documentCount?`${o.documentCount} (Sprachen gesamt: ${o.documentCountAcrossLanguages})`:o.documentCount;appendColumn(t,"Gesamt"),appendColumn(t,e),appendColumn(t,readableFileSizeString(o.fileSize))}n.append(t)}},appendColumn=(e,t)=>{const n=document.createElement("TD");n.innerHTML=t,e.append(n)},readableFileSizeString=e=>{var t=-1;do{e/=1024,t++}while(e>1024);return Math.max(e,.1).toFixed(1)+[" kB"," MB"," GB"," TB","PB","EB","ZB","YB"][t]};