{"size": 27573, "ext": "js", "max_stars_repo_path": "Source/Translation.Client.Web/wwwroot/js/site.min.js", "max_stars_repo_name": "ilkerhalil/translation", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Source/Translation.Client.Web/wwwroot/js/site.min.js", "max_issues_repo_name": "ilkerhalil/translation", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Source/Translation.Client.Web/wwwroot/js/site.min.js", "max_forks_repo_name": "ilkerhalil/translation", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 27573.0, "max_line_length": 27573, "alphanum_fraction": 0.7460196569}
function getPathFromUrl(n){return n.split("?")[0]}function clearChildren(n){while(n.firstChild)n.removeChild(n.firstChild)}function createElement(n){return document.createElement(n)}function getElement(n){return document.getElementById(n)}function getValue(n){return document.getElementById(n).value}function getAntiForgeryTokenFromLayout(){return document.getElementsByName("__RequestVerificationToken")[0].value}function getLowerCase(n){return n.toLowerCase().replace(/ğ/gim,"g").replace(/ü/gim,"u").replace(/ş/gim,"s").replace(/ö/gim,"o").replace(/ç/gim,"c").replace(/ /gim,"_").replace(/-/gim,"_")}function createLink(n,t){let i=createElement("a");return i.innerText=n,i.href=t,i}function createButton(n,t){let i=createElement("button");return i.innerText=n,i.onclick=t,i}function hideElement(n){n.style.opacity=0;setTimeout(function(){n.style.display="none"},377)}function showElement(n,t){n.style.opacity=t;setTimeout(function(){n.style.display="block"},89)}function doGet(n,t){let i=new XMLHttpRequest;i.open("GET",n,!0);i.onreadystatechange=function(){i.readyState===XMLHttpRequest.DONE&&(199<i.status&&i.status<300?t(i):i.status!=404&&console.log("error",i.status.toString(),i))};i.send(null)}function doPostWithJsonContent(n,t,i,r){doPostRequest(n,"application/json",t,i,r)}function doPostWithFormUrlEncodedContent(n,t,i,r){doPostRequest(n,"application/x-www-form-urlencoded",t,i,r)}function doPostRequest(n,t,i,r,u){let f=new XMLHttpRequest;f.open("POST",n,!0);f.setRequestHeader("Content-type",t);f.setRequestHeader("RequestVerificationToken",getAntiForgeryTokenFromLayout());f.onreadystatechange=function(){f.readyState===XMLHttpRequest.DONE&&(199<f.status&&f.status<300?r(f):u(f))};f.send(i)}function doIfConfirmed(n,t){showPopup(n.dataset.confirmTitle,n.dataset.confirmContent,!0,t)}function doRedirectIfConfirmedSuccess(n,t){showPopup(n.dataset.confirmTitle,n.dataset.confirmContent,!0,function(){doPostWithFormUrlEncodedContent(n.dataset.url,n.dataset.prm,function(n){let i=JSON.parse(n.response);if(i.isOk===!0)window.location.href=t;else{let n=i.messages.join("<br/>");showPopupMessage(n)}},function(n){let t=JSON.parse(n.response).messages.join("<br/>");showPopupMessage(t)})})}function translateScreen(){translateElement(document.head);translateElement(document.body)}function translateElement(n){if(n!==null&&n!==undefined&&labels!==null&&labels!==undefined){let t="en";currentUser!==undefined&&currentUser!==null&&(t=currentUser.languageIsoCode2Char);let i=n.querySelectorAll("[placeholder]");i.forEach(function(n){for(let i=0;i<labels.length;i++){let r=labels[i];if(r.key===n.placeholder){r.translations.forEach(function(i){if(i.languageIsoCode2===t){n.setAttribute("placeholder",i.translation);return}});break}}});let r=n.querySelectorAll("[data-translation]");r.forEach(function(n){for(let i=0;i<labels.length;i++){let r=labels[i];if(r.key===n.dataset.translation){r.translations.forEach(function(i){if(i.languageIsoCode2===t){n.innerHTML=i.translation;return}});break}}})}}function hidePopup(){popupContent.innerHTML="";hideElement(popup);hideElement(overlay)}function hidePopupMessage(){popupMessageContent.innerHTML="";hideElement(popupMessage);hideElement(overlayMessage)}function showPopup(n,t,i,r){if(document.querySelector("#popup h1").innerHTML=n,popupContent.innerHTML=t,showElement(popup,1),showElement(overlay,.8),i){let t=createButton("ok",r);t.className="btnGreen";let i=createButton("cancel",hidePopup);i.className="btnRed";let n=createElement("div");n.style.marginTop="13px";n.appendChild(t);n.appendChild(i);popupContent.appendChild(n)}}function showPopupMessage(n){document.querySelector("#popupMessage h1").innerHTML=n;showElement(popupMessage,1);showElement(overlayMessage,.8);let i=createButton("ok",function(){hidePopupMessage();hidePopup()});i.className="btnGreen";let t=createElement("div");t.style.marginTop="13px";t.appendChild(i);popupMessageContent.appendChild(t)}function getSelect(n){return document.getElementById("select-"+n)}function hasClass(n,t){return(" "+n.className+" ").indexOf(" "+t+" ")>-1}function trimSearchTerm(n,t){let r=t.childNodes;for(var i=0,u=r.length;i<u;i++)if(r[i]&&r[i].innerText&&r[i].innerText.toLowerCase()===n.trim().toLowerCase())return"";return n.trim().toLowerCase().replace(/<br>/g,"").replace(/&nbsp;/g,"")}function onSelectChange(n,t){var i=typeof n=="string"?getSelect(n):n;i.addEventListener("theSelectChange",function(){(typeof n!="string"||n===i.dataset.valueField)&&t(i,i.dataset.value,i.dataset.text)})}function onSelectInit(n,t){var i=typeof n=="string"?getSelect(n):n;i.addEventListener("theSelectInit",function(){(typeof n!="string"||n===i.dataset.valueField)&&t(i,i.dataset.value,i.dataset.text)})}function createSelectElement(n,t,i,r,u,f,e,o){let s=document.createElement("div");return s.id="select-"+n,s.name="select-"+n,s.dataset.name=n,s.dataset.valueField=n+"Uid",s.dataset.textField=n+"Name",s.dataset.value=u||"",s.dataset.text=f||"",s.dataset.url=t,s.dataset.parent=o||"",s.dataset.setFirstItem=e===!0?theTrue:!1,s.dataset.type=r===undefined?"text":r,s.classList.add("select"),s.classList.add(i===undefined?"single-select":i),s}function fillTable(n,t){doGet(n,function(i){if(i!=undefined&&i.responseText!=undefined&&!(i.responseText.length<1)&&!(i.status>299)&&!(i.status<199)){let r=JSON.parse(i.responseText);appendHeader(r.headers,t);r.data.length>0&&(appendRows(r.data,t,n),r.data.length<r.pagingInfo.totalItemCount&&appendPaginationPanel(r.pagingInfo,t));translateElement(t)}})}function appendHeader(n,t){if(!t.firstChild||t.firstChild.tagName!="THEAD"){let i=createElement("tr");if(t.dataset.selectable==="true"){let n=createElement("input");n.type="checkbox";n.onchange=function(){var i=t.lastChild.childNodes;i.forEach(function(t){t.firstChild.firstChild.checked=n.checked})};let r=createElement("th");r.className="selectable";r.appendChild(n);i.appendChild(r)}n.forEach(function(n){let t=createElement("th");t.innerHTML=n.key;t.dataset.translation=n.key;i.appendChild(t)});let r=createElement("thead");r.appendChild(i);t.appendChild(r)}}function prepareRow(n,t){let r=n.split(",_,"),i=document.createElement("tr");if(i.dataset.uid=r[0],t.dataset.selectable==="true"){let t=createElement("input");t.type="checkbox";let n=createElement("td");n.className="selectable";n.appendChild(t);i.appendChild(n)}for(let n=1;n<r.length-1;n++){let f=r[n],u=document.createElement("td"),t=createElement("input");t.type="checkbox";t.disabled="disabled";f.toLowerCase()==="true"?(t.checked="checked",u.appendChild(t)):f.toLowerCase()==="false"?u.appendChild(t):u.innerHTML=f;i.appendChild(u)}return i}function appendRows(n,t){t.firstChild.nextElementSibling&&t.firstChild.nextElementSibling.tagName=="TBODY"&&t.firstChild.nextElementSibling.remove();let i=createElement("tbody");for(let r=0;r<n.length;r++){let u=prepareRow(n[r],t);i.appendChild(u)}t.appendChild(i)}function appendPaginationPanel(n,t){t.parentElement.lastElementChild.classList.contains("pagination")&&t.parentElement.lastElementChild.remove();let i=createElement("div");i.classList="pagination";let u=t.dataset.result,e="&lastUid="+n.lastUid,f="&take="+n.take,r=n.totalItemCount-n.totalItemCount%n.take;r===n.totalItemCount&&(r=(n.totalItemCount/n.take-1)*n.take);let o=r/n.take+1;n.isHavingPrevious&&(appendGotoFirst(i,function(){updateTableRows(u,t)}),appendGotoPrevious(i,function(){updateTableRows(u+"?skip="+(n.skip-n.take)+f+e,t)}));n.type==="page_numbers"&&appendCurrentPage(i,n.currentPage);n.isHavingNext&&appendGotoNext(i,function(){updateTableRows(u+"?skip="+(n.skip+n.take)+f+e,t)});n.type==="page_numbers"&&n.isHavingNext&&appendGotoLast(i,function(){updateTableRows(u+"?skip="+r+f,t)});appendGotoPage(i,function(){var h=i.getElementsByTagName("input")[0];let o=h.value;o<1&&(o=1);let s=(o-1)*n.take;r<=s&&(s=r);updateTableRows(u+"?skip="+s+f+e,t)});appendTotalItemCount(i,n.totalItemCount);t.parentElement.appendChild(i)}function updateTableRows(n,t){doGet(n,function(i){let r=JSON.parse(i.responseText);r.pagingInfo.skip>=r.pagingInfo.totalItemCount||r.data.length===0||(clearChildren(t.lastChild),appendRows(r.data,t,n),t.parentElement.lastChild.remove(),appendPaginationPanel(r.pagingInfo,t))})}function appendGotoFirst(n,t){n.appendChild(createButton("<<",t))}function appendGotoPrevious(n,t){n.appendChild(createButton("<",t))}function appendGotoNext(n,t){n.appendChild(createButton(">",t))}function appendGotoLast(n,t){n.appendChild(createButton(">>",t))}function appendCurrentPage(n,t){let i=createElement("span");i.innerHTML=t;n.appendChild(i)}function appendGotoPage(n,t){let i=createElement("input");i.onkeypress=function(n){n.keyCode===13&&(n.preventDefault(),t())};n.appendChild(i);n.appendChild(createButton("go",t))}function appendTotalItemCount(n,t){var i=createElement("span");i.innerHTML=t+" records";n.appendChild(i)}function handleSelectedRows(n){doIfConfirmed(n,function(){let i=n.parentElement.querySelectorAll("table tbody tr"),t="";if(i.forEach(function(n){let i=n.firstChild,r=i.firstChild;r.checked&&(t+="Uids="+i.parentElement.dataset.uid+"&")}),t.length<1){showPopupMessage("please_select_at_least_one_item");return}doPostWithFormUrlEncodedContent(n.dataset.url,t,function(n){let t=JSON.parse(n.response);if(t.isOk===!0)i.forEach(function(n){let t=n.firstChild,i=t.firstChild;i.checked&&n.remove()}),hidePopup();else{let n=t.messages.join("<br/>");showPopupMessage(n)}},function(n){let t=JSON.parse(n.response).join("<br/>");showPopupMessage(t)})})}function handleRow(n,t,i,r){doIfConfirmed(n,function(){doPostWithFormUrlEncodedContent(i,t,r,function(n){let t=JSON.parse(n.response).join("<br/>");showPopupMessage(t)})})}function handleDeleteRow(n,t){let i=n.parentElement.parentElement.dataset.uid;handleRow(n,"id="+i,t,function(t){let i=JSON.parse(t.response);if(i.isOk===!0)n.parentElement.parentElement.remove(),hidePopup();else{let n=i.messages.join("<br/>");showPopupMessage(n)}})}function handlePostAndAppendRow(n){showPopup(n.dataset.confirmTitle,n.dataset.confirmContent,!0,function(){doPostWithFormUrlEncodedContent(n.dataset.url,n.dataset.prm,function(t){let i=JSON.parse(t.response);if(i.isOk===!0){let t=n.nextElementSibling,r=prepareRow(i.item,t);t.lastChild.appendChild(r);hidePopup()}else{let n=i.messages.join("<br/>");showPopupMessage(n)}},function(n){if(n.status==500)showPopupMessage("server_error");else{let t=JSON.parse(n.response).messages.join("<br/>");showPopupMessage(t)}})})}function handleChangeActivationRow(n,t){let i=n.parentElement.parentElement,e=i.parentElement.parentElement,u=e.firstChild,f=0;for(var r=0;r<u.firstChild.childNodes.length;r++){if(u.firstChild.childNodes[r].dataset.translation==="is_active")break;f++}let o=i.dataset.uid;handleRow(n,"id="+o,t,function(n){let r=JSON.parse(n.response);if(r.isOk===!0){var t=i.children[f];let n=t.children[0].checked,r=n===!0;t.children[0].checked=!r;hidePopup()}else{let t=JSON.parse(n.response).join("<br/>");showPopupMessage(t)}})}function handleRestoreRow(n,t,i){var r,o;let u=n.parentElement.parentElement,h=u.parentElement.parentElement,f=h.firstChild,e=0;for(r=0;r<f.firstChild.childNodes.length;r++){if(f.firstChild.childNodes[r].dataset.translation==="revision")break;e++}o=u.children[e].innerText;let s=n.parentElement.parentElement.dataset.uid;handleRow(n,"id="+s+"&revision="+o,t,function(n){let t=JSON.parse(n.response);if(t.isOk===!0)window.location.href=i+"/"+s;else{let n=t.messages.join("<br/>");showPopupMessage(n)}})}function searchWork(){let i=document.getElementById("searchResults"),t=document.getElementById("txtSearch");t.addEventListener("keydown",onUpDownKeyPress);let n=t.value;n!==lastFilter&&(_index=-1,doGet("/Label/SearchData?search="+n,function(n){199<n.status&&n.status<300&&bindLabelSearchDropdown(n.responseText)}));lastFilter=n;n==""?(hide(i),t.removeEventListener("keydown",onUpDownKeyPress)):show(i)}function bindLabelSearchDropdown(n){let t=document.getElementById("searchResults");while(t.childElementCount>1)t.removeChild(t.firstChild);let i=JSON.parse(n);if(i!=null)for(let n=0;n<i.length;n++){let u=i[n],r=document.createElement("a");r.setAttribute("uid",u.uid);r.innerHTML=u.key;t.insertBefore(r,t.firstChild)}}function openLabelSearchListPage(){window.location.href="/Label/SearchList?search="+getLabelSearchTerm()}function openLabelDetailPage(n){window.location.href="/Label/Detail/"+n}function getLabelSearchTerm(){return document.getElementById("txtSearch").value}function show(n){n!=undefined&&n.classList.add("show")}function hide(n){n!=undefined&&n.classList.remove("show")}function onUpDownKeyPress(n){let r=document.getElementById("searchResults"),t=r.getElementsByTagName("a"),i=n.which||n.keyCode;i===KEY.DOWN&&_index<t.length-1?(n.preventDefault(),_index++):i===KEY.UP&&_index>0&&(n.preventDefault(),_index--);markSelected(t,_index);i===KEY.ENTER&&(n.target.id==="txtSearch"?openLabelSearchListPage():_index===t.length-1?openLabelSearchListPage():openLabelDetailPage(t[_index].getAttribute("uid")))}function markSelected(n,t){if(n.length!==1)for(i=0;i<n.length;i++)result=n[i],i===t?result.classList.add("list-item-selected"):result.classList.remove("list-item-selected")}let currentUser=null;doGet("/Data/GetCurrentUser",function(n){199<n.status&&n.status<300&&(n.status===200&&n.responseText!==null?(localStorage.setItem("currentUser",n.responseText),currentUser=JSON.parse(localStorage.getItem("currentUser"))):n.status===200&&n.responseText===null&&(currentUser=null,window.redirect("/Login")))});let labels=JSON.parse(localStorage.getItem("labels"));labels==null||labels.length===0?doGet("/Data/GetMainLabels",function(n){199<n.status&&n.status<300&&(labels=localStorage.setItem("labels",n.responseText),translateScreen())}):translateScreen();let overlay=getElement("overlay"),overlayMessage=getElement("overlayMessage"),popup=getElement("popup"),popupContent=getElement("popupContent"),popupMessage=getElement("popupMessage"),popupMessageContent=getElement("popupMessageContent");if(document.getElementById("overlay")){var popupOverlay=document.getElementById("overlay");popupOverlay.onclick=function(){hidePopup()}}let theSelectChangeEvent=new Event("theSelectChange");let theSelectInitEvent=new Event("theSelectInit");let urlArray=[];setInterval(function(){urlArray=[]},13e3);let theTrue="True",theValueSeparator=",",refreshSelect=()=>{},initSelects=()=>{},initSingleSelect=()=>{},resetSingleSelect=()=>{};(function(){function o(n,t){let i=[];t!=undefined&&(i=JSON.parse(t.responseText));hasClass(n,"single-select")?initSingleSelect(n,i):hasClass(n,"multiple-select")&&k(n,i)}function h(t){let i=t.closest(".select");if(hasClass(i,"show"))i.classList.remove("show");else if(!hasClass(i,"disabled")){i.classList.add("show");let t="";if(i.dataset.parent!==""&&i.dataset.parent!==undefined){let n=getSelect(i.dataset.parent);n!=undefined&&n.dataset.value!=undefined&&(t=n.dataset.value)}let u="";var r=i.lastElementChild.childElementCount;i.lastElementChild.childNodes!=undefined&&i.lastElementChild.childNodes[r]!=undefined&&r>0&&(u=i.lastElementChild.childNodes[r].getAttribute("value"));let f=i.dataset.url;f&&doGet(f+"?take="+n+"&parent="+t+"&lastUid="+u,function(n){let t=JSON.parse(n.responseText);s(i,t)})}}function r(n,t,i,r){var e=getElement(r.dataset.textField).getAttribute("value"),f,s;if(e&&e.indexOf(t.text)>=0)return null;let o=n.childNodes;for(f=0,s=o.length;f<s;f++)if(o[f].innerHTML===t.text)return null;let u=createElement("div");if(u.className="select-item",i==="content"){u.classList.add("content-item");let n=createElement("img");n.className="select-item-image";n.setAttribute("src",t.image);let i=createElement("label");i.className="select-item-text";i.innerHTML=t.text;u.appendChild(n);u.appendChild(i)}else u.innerHTML=t.text;return u.setAttribute("value",t.value),n.appendChild(u),u}function c(t,r){i.forEach(function(i){if(i.dataset.parent===r){let u=i.dataset.url+"?take="+n+"&parent="+t;urlArray.includes(u)||(urlArray.push(u),doGet(u,function(n){i.innerHTML="";o(i,n)}))}})}function l(t){if(t.offsetHeight+t.scrollTop>=t.scrollHeight){let i=t.closest(".select"),s=i.dataset.parent,c=trimSearchTerm(i.querySelector(".select-button-input").innerHTML,t),o=t.querySelectorAll(".select-item"),l=o.length,h=i.dataset.url;if(!h)return;let e=h+"?q="+c+"&take="+n;if(o.length>0){let n=o[l-1].getAttribute("value");e+="&lastUid="+n}if(s){let n=getSelect(s);n!=undefined&&(e+="&parent="+n.dataset.value)}urlArray.includes(e)||(urlArray.push(e),doGet(e,function(n){let e=JSON.parse(n.responseText),o=i.dataset.type;for(let n=0;n<e.length;n++){let s=r(t,e[n],o,i);s!=null&&(s.onclick=function(){hasClass(i,"single-select")?u(this):f(this)})}}))}}function s(n,t){let i=n.querySelector(".select-content");if(t.length===0&&i.childElementCount===0){i.innerHTML=" ";let n=createElement("div");n.style.padding="5px";n.style.color="grey";n.innerHTML="no_item";n.dataset.translation="no_item";i.appendChild(n)}for(let e=0;e<t.length;e++){let o=r(i,t[e],n.dataset.type,n);o!=null&&(o.onclick=function(){hasClass(n,"single-select")?u(this):hasClass(n,"multiple-select")&&f(this)})}}function a(i,r){let u=i.closest(".select"),h=u.querySelector(".select-button"),a=u.querySelector(".select-content"),c=u.dataset.parent,l=trimSearchTerm(i.innerHTML,a);if((t.length!=0||r.keyCode!=8)&&r.keyCode!=38&&r.keyCode!=40&&r.keyCode!=13&&l.length!=1){if(t==i.innerHTML){e=!0;return}t=i.innerHTML;e=!1;u.querySelector(".loader")&&u.querySelector(".loader").remove();let o=createElement("div");o.className="loader";o.style.right="-30px";h.insertBefore(o,h.firstChild);let f=u.dataset.url+"?q="+l+"&take="+n;if(c){let n=getSelect("select-"+c);n!=undefined&&n.dataset.value!=undefined&&(f+="&parent="+n.dataset.value)}urlArray.includes(f)||(urlArray.push(f),doGet(f,function(n){let t=JSON.parse(n.responseText);u.querySelector(".loader")&&u.querySelector(".loader").remove();tt(u);s(u,t)}))}}function y(n,i){let r=createElement("div");r.className="select-button";let f=createElement("input");f.setAttribute("type","hidden");f.id=n.dataset.valueField;f.name=n.dataset.valueField;let e=createElement("input");e.setAttribute("type","hidden");e.id=n.dataset.textField;e.name=n.dataset.textField;let u=createElement("div");u.className="select-button-input";u.setAttribute("contenteditable",theTrue);let o=createButton("x",b);if(o.className="clear-select-button",r.innerHTML="",r.appendChild(f),r.appendChild(e),r.appendChild(u),r.appendChild(o),n.appendChild(r),i==undefined&&n.dataset.value===""){r.classList.add("disabled");return}hasClass(r,"disabled")&&r.classList.remove("disabled");n.dataset.value!==""&&n.dataset.text!==""?(u.innerHTML=n.dataset.text,f.value=n.dataset.value,e.value=n.dataset.text):n.dataset.setFirstItem===theTrue&&i.length>0&&(u.innerHTML=i[0].text,f.value=i[0].value,e.value=i[0].text,n.dataset.value=i[0].value,n.dataset.text=i[0].text,n.dispatchEvent(theSelectChangeEvent),c(i[0].value,n.dataset.valueField));r.onclick=function(){h(this)};u.onkeydown=function(n){let i=this.closest(".select");return i.classList.add("show"),t=this.innerHTML,n.keyCode==13?(document.execCommand("insertHTML",!1,""),!1):void 0};u.onkeyup=function(n){n.preventDefault();a(this,n)}}function p(n){let i=createElement("button");i.className="select-item-info-btn";i.innerHTML="i";n.querySelector(".select-button").appendChild(i);let t=createElement("div");t.className="select-info-wrapper";let r=createElement("button");r.className="close-popover-btn";r.innerHTML="x";t.appendChild(r);r.onclick=function(){t.classList.remove("show")};let u=createElement("div");u.className="select-info-header";let f=createElement("img");f.className="select-info-img";let e=createElement("label");e.className="select-info-title";u.appendChild(f);u.appendChild(e);let o=createElement("div");o.className="select-info-desc";t.appendChild(u);t.appendChild(o);n.appendChild(t);i.onmouseover=function(){let i=n.querySelector(".select-button-input").innerHTML.toLowerCase();i&&(t.classList.add("show"),f.setAttribute("src","url"),e.innerHTML="select item text")};i.onclick=function(n){n.preventDefault();n.stopPropagation();t.classList.remove("show");let i='<div class="select-item-header">';i+='<img class="select-item-image" src="Sample">';i+='<label class="select-item-text">sample text<\/label>';i+="<\/div>";showPopup("Detail",i,!0,function(){})}}function w(n,t){let i=createElement("div");if(i.className="select-content",t!=undefined)for(let f=0;f<t.length;f++){let e=r(i,t[f],n.dataset.type,n);e!=null&&(e.onclick=function(){u(this)})}n.appendChild(i);i.onscroll=function(){l(this)}}function u(n){let t=n.closest(".select");var r=n.getAttribute("value"),i=n.innerHTML;t.dataset.type==="content"?(i=n.querySelector(".select-item-text").innerHTML,t.querySelector(".select-button-input").innerHTML=i):t.querySelector(".select-button-input").innerHTML=i;getElement(t.dataset.valueField).setAttribute("value",r);getElement(t.dataset.textField).setAttribute("value",i);t.dataset.value=r;t.dataset.text=i;c(r,t.dataset.valueField);t.dispatchEvent(theSelectChangeEvent);t.classList.remove("show")}function b(t){t.preventDefault();t.stopPropagation();let r=this.closest(".select"),e=r.querySelector(".select-button"),o=e.querySelector(".select-button-input");o.innerHTML="";r.dataset.value="";r.dataset.text="";getElement(r.dataset.valueField).value="";getElement(r.dataset.textField).value="";let u,h=r.dataset.valueField;i.forEach(function(n){n.dataset.valueField==r.dataset.parent&&(u=n.querySelector(r.dataset.valueField).getAttribute("value"));n.dataset.parent==h&&(n.querySelector(".select-button").classList.add("disabled"),n.querySelector(".select-button-input").innerHTML=" ",n.querySelector(".select-content").innerHTML=" ")});let f=r.dataset.url+"?q=&take="+n;u!=undefined&&(f+="&parent="+u);urlArray.includes(f)||doGet(f,function(n){let t=JSON.parse(n.responseText);s(r,t)})}function k(n,t){d(n);g(n,t)}function d(n){let i=createElement("div");i.className="select-button";let r=createElement("div");r.className="select-button-input";r.setAttribute("contenteditable",theTrue);i.appendChild(r);let u=createElement("input");u.setAttribute("type","hidden");u.id=n.dataset.valueField;u.name=n.dataset.valueField;u.value=n.dataset.value;let f=createElement("input");if(f.setAttribute("type","hidden"),f.id=n.dataset.textField,f.name=n.dataset.textField,f.value=n.dataset.text,i.appendChild(u),i.appendChild(f),n.appendChild(i),n.dataset.value!==""){let t=n.dataset.value.split(theValueSeparator),u=n.dataset.text.split(theValueSeparator);u.forEach(function(u,f){let e=createElement("div");e.className="active-item";e.setAttribute("draggable",theTrue);e.setAttribute("data-value",t[f]);let o=createElement("span");o.innerHTML=u;e.id=n.dataset.valueField+"-"+o.innerHTML;let s=createButton("x",v);s.className="remove-active-item";e.appendChild(o);e.appendChild(s);i.insertBefore(e,r)})}i.onclick=function(){h(this)};r.onkeydown=function(n){let i=this.closest(".select");if(i.classList.add("show"),t=this.innerHTML,n.keyCode===13)return document.execCommand("insertHTML",!1,""),!1;if(!this.innerHTML&&n.keyCode==8){let n=this.previousSibling;if(n&&n.className=="active-item"){let r=n.querySelector("span").innerHTML;n.remove();let u=i.dataset.type,t=i.querySelectorAll(".select-item");for(let n=0;n<t.length;n++)hasClass(t[n],"active")&&(u==="content"&&t[n].querySelector(".select-item-text").innerHTML===r?t[n].classList.remove("active"):t[n].innerHTML===r&&t[n].classList.remove("active"))}}};r.onkeyup=function(n){n.preventDefault();a(this,n)}}function g(n,t){let u=n.dataset.type,i=createElement("div");i.className="select-content";for(let e=0;e<t.length;e++){let o=r(i,t[e],u,n);o!=null&&(o.onmouseover=function(){let n=i.querySelectorAll(".select-item");for(let t=0;t<n.length;t++)hasClass(n[t],"hover")&&n[t].classList.remove("hover");this.classList.add("hover")},o.onclick=function(){f(this)})}n.appendChild(i);i.onscroll=function(){l(i)}}function f(n){n.classList.add("active");let i=n.closest(".select"),u=i.querySelector(".select-button"),e=u.querySelector(".select-button-input"),t=createElement("div");t.className="active-item";t.setAttribute("draggable",theTrue);let r=createElement("span");r.innerHTML=i.dataset.type==="content"?n.querySelector(".select-item-text").innerHTML:n.innerHTML;t.id=i.dataset.valueField+"-"+r.innerHTML;let f=createButton("x",v);f.className="remove-active-item";t.appendChild(r);t.appendChild(f);u.insertBefore(t,e);let o=n.getAttribute("value"),s=n.innerText;nt(i,o,s)}function nt(n,t,i){let r=getElement(n.dataset.valueField).getAttribute("value");r!=null&&(t=r+theValueSeparator+t);let u=getElement(n.dataset.textField).getAttribute("value");u!=null&&(i=u+theValueSeparator+i);getElement(n.dataset.valueField).setAttribute("value",t);getElement(n.dataset.textField).setAttribute("value",i)}function v(n){n.preventDefault();n.stopPropagation();let t=this.closest(".select"),r=this.closest(".active-item"),u=r.querySelector("span").innerHTML,f=r.getAttribute("data-value"),e=getElement(t.dataset.textField).getAttribute("value"),o=getElement(t.dataset.valueField).getAttribute("value");getElement(t.dataset.valueField).setAttribute("value",o.replace(f,""));getElement(t.dataset.textField).setAttribute("value",e.replace(u,""));r.remove();let i=t.querySelectorAll(".select-item");for(let n=0;n<i.length;n++)hasClass(i[n],"active")&&(t.dataset.type==="content"&&i[n].querySelector(".select-item-text").innerHTML===u?i[n].classList.remove("active"):i[n].innerHTML===u&&i[n].classList.remove("active"))}function tt(n){let t=n.querySelector(".select-content");t.innerHTML=""}let n=100,t="",e=!1,i=document.querySelectorAll("div.select");refreshSelect=function(t,i){t.dataset.value===""&&t.dataset.text===""&&t.dataset.setFirstItem===theTrue?doGet(t.dataset.url+"?take="+n,function(n){o(t,n);i&&i()}):(o(t),i&&i())};resetSingleSelect=function(n){n.dataset.value="";n.dataset.text="";let t=n.cloneNode(!1);return n.parentNode.replaceChild(t,n),t};initSingleSelect=function(n,t){n.querySelector("div.select-button")==null&&(y(n,t),n.dataset.detail===theTrue&&p(n,n.dataset.detailUrl),w(n,t))};document.addEventListener("click",function(n){let t=document.querySelector(".select.show");t&&t.contains(n.target)===!1&&t.classList.remove("show");let i=document.querySelector(".select-info-wrapper.show");i&&i.contains(n.target)===!1&&i.classList.remove("show")});document.addEventListener("keyup",function(n){let o;for(let n=0;n<i.length;n++)hasClass(i[n],"show")&&(o=i[n]);let s,t,r=-1;if(o){s=o.querySelector(".select-content");t=s.querySelectorAll(".select-item");for(let n=0;n<t.length;n++)hasClass(t[n],"hover")&&(r=n);n.keyCode==38&&(n.preventDefault(),r-1>=0&&(s.scrollTop-=t[r].offsetHeight,t[r].classList.remove("hover"),t[r-1].classList.add("hover")));n.keyCode==40&&(n.preventDefault(),r+1<t.length&&(r===-1?t[r+1].classList.add("hover"):(s.scrollTop+=t[r].offsetHeight,t[r].classList.remove("hover"),t[r+1].classList.add("hover"))));n.keyCode===13&&t[r]&&hasClass(t[r],"active")===!1&&e===!1&&(hasClass(o,"single-select")?u(t[r]):hasClass(o,"multiple-select")&&f(t[r]))}},!1);initSelects=function(){document.querySelectorAll("div.select").forEach(function(n){refreshSelect(n,()=>{n.dataset.is_init_done="true",n.dispatchEvent(theSelectInitEvent)})})};initSelects()})();let tables=document.querySelectorAll("table");tables.forEach(function(n){n.dataset.result!=undefined&&fillTable(n.dataset.result,n)});let _index=-1,lastFilter="";document.onclick=function(n){let t=n.target;if(t.id!=="searchResults"||t.id!=="txtSearch"){let n=document.getElementById("searchResults");hide(n)}};let KEY={UP:38,DOWN:40,ENTER:13};