function getChartColorsArray(e){if(null!==document.getElementById(e))return e=document.getElementById(e).getAttribute("data-colors"),(e=JSON.parse(e)).map(function(e){var t=e.replace(" ","");return-1===t.indexOf(",")?getComputedStyle(document.documentElement).getPropertyValue(t)||t:2==(e=e.split(",")).length?"rgba("+getComputedStyle(document.documentElement).getPropertyValue(e[0])+","+e[1]+")":t})}var options,chart,chartDonutBasicColors=getChartColorsArray("simple_dount_chart"),url=(chartDonutBasicColors&&(options={series:[27.01,20.87,33.54,37.58],chart:{height:330,type:"donut"},legend:{position:"bottom"},labels:["Documents","Media","Others","Free Space"],dataLabels:{dropShadow:{enabled:!1}},colors:chartDonutBasicColors},(chart=new ApexCharts(document.querySelector("#simple_dount_chart"),options)).render()),"assets/json/"),allFileList="",editFlag=!1,getJSON=function(e,t){var l=new XMLHttpRequest;l.open("GET",url+e,!0),l.responseType="json",l.onload=function(){var e=l.status;t(200===e?null:e,l.response)},l.send()};function loadFileData(e){document.querySelector("#file-list").innerHTML="",Array.from(e).forEach(function(e,t){var l=e.fileName.includes(".")?function(e){switch(e){case"png":case"jpg":return'';case"pdf":return'';default:return''}}(e.fileName.split(".")[1]):'',i=e.starred?"active":"";document.querySelector("#file-list").innerHTML+='
'+l+'
'+e.fileName+'
'+e.filetype+"
"+e.fileItem+' '+e.fileSize+' '+e.date+'
',favouriteBtn(),removeSingleItem(),editFileList(),fileDetailShow()})}function favouriteBtn(){Array.from(document.querySelectorAll(".favourite-btn")).forEach(function(e){e.addEventListener("click",function(){e.classList.contains("active")?e.classList.remove("active"):e.classList.add("active")})})}getJSON("filemanager-filelist.json",function(e,t){null!==e?console.log("Something went wrong: "+e):loadFileData(allFileList=t)}),favouriteBtn(),Array.from(document.querySelectorAll(".file-manager-menu a")).forEach(function(i){i.addEventListener("click",function(){var e,t=document.querySelector(".file-manager-menu a.active"),l=(t&&t.classList.remove("active"),i.classList.add("active"),i.querySelector(".file-list-link").innerHTML);document.getElementById("file-list").innerHTML="",document.getElementById("filetype-title").innerHTML="My Drive"!=l?l:"Recent file","My Drive"!=l&&"Important"!=l&&"Recents"!=l?(e=allFileList.filter(e=>e.filetype===l),document.getElementById("folder-list").style.display="none"):"Important"==l?(e=allFileList.filter(e=>1==e.starred),document.getElementById("folder-list").style.display="none"):(e=allFileList,document.getElementById("folder-list").style.display="block"),"Recents"==l&&(document.getElementById("folder-list").style.display="none"),loadFileData(e)})});var createFolderForms=document.querySelectorAll(".createfolder-form");function editFolderList(){Array.from(document.querySelectorAll(".folder-card")).forEach(function(l){Array.from(l.querySelectorAll(".edit-folder-list")).forEach(function(e){e.addEventListener("click",function(e){var t=l.querySelector(".card").getAttribute("id").split("-")[1];t==l.querySelector(".form-check .form-check-input").getAttribute("id").split("_")[1]&&(editFlag=!0,document.getElementById("addNewFolder").innerHTML="Save",document.getElementById("createFolderModalLabel").innerHTML="Folder Rename",document.getElementById("folderid-input").value="folder-"+t,document.getElementById("foldername-input").value=l.querySelector(".folder-name").innerHTML)})})})}Array.prototype.slice.call(createFolderForms).forEach(function(i){i.addEventListener("submit",function(e){var t,l;i.checkValidity()?(e.preventDefault(),t=document.getElementById("foldername-input").value,l=Math.floor(100*Math.random()),folderlisthtml='
'+t+'
0 Files 0GB
',""===t||editFlag?""!==t&&editFlag&&(l=0,l=document.getElementById("folderid-input").value,document.getElementById(l).querySelector(".folder-name").innerHTML=t,document.getElementById("addFolderBtn-close").click(),editFlag=!1,document.getElementById("addNewFolder").innerHTML="Add Folder",document.getElementById("createFolderModalLabel").innerHTML="Create Folder",document.getElementById("folderid-input").value="",document.getElementById("foldername-input").value=""):(document.getElementById("folderlist-data").insertAdjacentHTML("afterbegin",folderlisthtml),document.getElementById("addFolderBtn-close").click(),editFolderList()),document.getElementById("folderid-input").value="",document.getElementById("foldername-input").value=""):(e.preventDefault(),e.stopPropagation()),i.classList.add("was-validated")},!1)}),editFolderList();var removeProduct=document.getElementById("removeFolderModal"),date=(removeProduct&&removeProduct.addEventListener("show.bs.modal",function(t){document.getElementById("remove-folderList").addEventListener("click",function(e){t.relatedTarget.closest(".folder-card").remove(),document.getElementById("close-removeFoldermodal").click()})}),(new Date).toUTCString().slice(5,16));function editFileList(){var l;Array.from(document.querySelectorAll(".edit-list")).forEach(function(t){t.addEventListener("click",function(e){l=t.getAttribute("data-edit-id"),allFileList=allFileList.map(function(e){return e.id==l&&(editFlag=!0,document.getElementById("addNewFile").innerHTML="Save",document.getElementById("createFileModalLabel").innerHTML="File Rename",document.getElementById("filename-input").value=e.fileName,document.getElementById("fileid-input").value=e.id),e})})})}Array.from(document.querySelectorAll(".createFile-modal")).forEach(function(e){e.addEventListener("click",function(e){document.getElementById("addNewFile").innerHTML="Create",document.getElementById("createFileModalLabel").innerHTML="Create File",document.getElementById("filename-input").value="",document.getElementById("fileid-input").value="",document.getElementById("createfile-form").classList.remove("was-validated")})}),Array.from(document.querySelectorAll(".create-folder-modal")).forEach(function(e){e.addEventListener("click",function(e){document.getElementById("addNewFolder").innerHTML="Add Folder",document.getElementById("createFolderModalLabel").innerHTML="Create Folder",document.getElementById("folderid-input").value="",document.getElementById("foldername-input").value="",document.getElementById("createfolder-form").classList.remove("was-validated")})});var createFileForms=document.querySelectorAll(".createfile-form");function fetchIdFromObj(e){return parseInt(e.id)}function sortElementsById(){loadFileData(allFileList.sort(function(e,t){e=fetchIdFromObj(e),t=fetchIdFromObj(t);return t