Built files from Bizgaze WebServer
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

base.min.js 111KB

123456
  1. var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i{constructor(){this.isViewOnly=!1;this.editedTime=new Date;this.lastEditedTime=0;this.f2Edit=!1;this.showFormula=!1;this.fontFamilyRecent=[];this.isFormula=!1;this.isResizing=!1;this.rowwidthcount=0;this.isNewSheet=!1;this.reqCount=0;this.isInitial=!0;this.clicks=0;this.autofillDrag=!1;this.checkedIndexes=[];this.selectedIndexes=[null,null,null,null];this.isCtrlA=!1;this.isCreatingNewFile=!1;this.isDriveImport=!1;this.openJSON=!1}init(t,i,r,u){this.result=t.result;this.documentGroup=this.result.DocumentGroup;this.customresult=r.result;this.filedata=i.result;this.FileName=t.result.FileTitle;this.FileId=t.result.FileId;this.permissionLevel=t.result.UserPermission;this.lastEditedTime=t.result.LastUpdateTime;this.timePeriod=t.result.TimePeriod;this.username=t.result.LastUpdateByName;this.folderId=t.result.folderId;this.fileurl=t.result.FileUrl;this.Priority=t.result.Priority;this.newUpload=t.result.NewUpload;this.NewDocument=t.result.NewDocument;this.identity=n.Platform.Membership.Infos.Identity.getCurrentUser();this.unibaseusername=this.identity.name;this.hederText={};this.mouseDownHandlers=[];this.keyDownHandlers=[];this.render();u!=null&&u()}clickHandler(n){n.target.getAttribute("id")=="importdata-cancel-bt";n.target.getAttribute("id")=="importdata-select-btn"}removeListeners(){}unwireBootStrapKeyEvent(){let t=document.body.getElementsByClassName("_bizgaze_popup_container"),n=$._data($(t)[0],"events");n&&n.keydown&&$(t).off("keydown.dismiss.bs.modal",n.keydown[0].handler);n&&n.click&&n.click.filter(n=>n).forEach(n=>{$(t).off("click.dismiss.bs.modal",n.handler)})}clearFindReplace(){this.ssObj.element.querySelector(".e-find-dlg")||this.ssObj.element.querySelector(".e-findtool-dlg")||(this.ssObj.ribbonModule.findValue="",this.ssObj.findAndReplaceModule.shortValue="")}fullScreenHandler(){setTimeout(()=>{this.setHeightOnFullScreenChange()},0)}processSheetRender(){this.updateProps();this.renderMenuBar();this.refreshHeight();this.ssRender();this.ribbon.init(this.result);this.permissionLevel&&this.permissionLevel==n.Apps.Collaboration.Enums.Share.Viewer&&setTimeout(()=>{this.setViewonly(),this.ssObj.dataBind()},0);this.unwireBootStrapKeyEvent();this.priorityRender();this.eventListners();this.colourpicker()}connectHub(t,i){n.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/collaboration/components/docconnector.js","apps/collaboration/components/unidochub.js"],function(){n.Apps.Collaboration.Components.DocConnector.Instance().init(t,i)})}sheetColorRender(){this.NewDocument||n.Apps.Collaboration.DocumentManager.Instance().getCustomJsonData(this.FileId).then(n=>{var i=n.result.tabcolors,r,u,f,t;for(this.sheets=this.ssObj.element.querySelector(".e-sheet-tab").querySelectorAll(".e-toolbar-item"),this.sheetsName=this.ssObj.element.querySelector(".e-sheet-tab .e-active").querySelector(".e-tab-text"),t=0;t<this.sheets.length;t++)i.sheets[t].TabColor!==null&&i.sheets[t].TabColor!==undefined&&i.sheets[t].TabColor.Name!=="0"&&i.sheets[t].TabColor.Name!==null&&i.sheets[t].TabColor.Name!==undefined&&(r=i.sheets[t].TabColor.R==null||i.sheets[t].TabColor.R==""?0:i.sheets[t].TabColor.R,u=i.sheets[t].TabColor.G==null||i.sheets[t].TabColor.G==""?0:i.sheets[t].TabColor.G,f=i.sheets[t].TabColor.B==null||i.sheets[t].TabColor.B==""?0:i.sheets[t].TabColor.B,document.getElementById(this.sheets[t].id).style.borderBottom="4px solid rgb("+r+","+u+","+f+")",document.getElementById(this.sheets[t].id).firstElementChild.style.height="100%");document.getElementsByClassName("e-indicator e-ignore")[1].style.display="none"});document.getElementsByClassName("e-indicator e-ignore")[1].style.display="none"}sheetColorChange(t){var r=this.ssObj.activeSheetIndex,i,u,f;r!=null&&(i=[],t!="0"?(i=this.hexToRgb(t),u="#"+t):(i.push(0),i.push(0),i.push(0),u=t),f={FileId:this.FileId,TabColor:i,SheetIndex:r,SheetHexCode:u},n.Apps.Collaboration.DocumentManager.Instance().saveSheetColor(f).then(u=>{t!=0?(document.getElementById(this.sheets[r].id).style.borderBottom="4px solid rgb("+i[0]+","+i[1]+","+i[2]+")",document.getElementById(this.sheets[r].id).firstElementChild.style.height="100%"):document.getElementById(this.sheets[r].id).style.borderBottom="none";document.getElementsByClassName("e-indicator e-ignore")[1].style.display="none";this.customresult=u.result.tabcolor;this.editDetails();let f={origin:"biz",action:"colorchange",sheetIndex:this.getSheetIndex()};n.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(f)}))}hexToRgb(n){var t=n.match(/.{1,2}/g);return[parseInt(t[0],16),parseInt(t[1],16),parseInt(t[2],16),]}priorityRender(){this.Priority&&($(".biz_ss_star_icon_"+this.FileId).removeClass("fa-star-o"),$(".biz_ss_star_icon_"+this.FileId).addClass("fa-star"),$(".biz_ss_star_icon_"+this.FileId).removeClass("text-light"),$(".biz_ss_star_icon_"+this.FileId).css("color","orange"))}render(){this.renderPopup(this.processSheetRender.bind(this))}parseMatchValue(n){return n.trim().toLowerCase()=="true"||n.trim()=="1"?!0:!1}ssRender(){if(this.ssObj=new ej.spreadsheet.Spreadsheet(this.ssSettings),this.formatpainter.init(this),this.spellchecker.init(this),this.permissionLevel&&this.permissionLevel==n.Apps.Collaboration.Enums.Share.Viewer){this.initialLoadFn=this.initialLoad.bind(this);this.ssObj.on("initialLoad",this.initialLoadFn)}this.ssObj.on("initialLoad",this.addFormatsToToolbar.bind(this));this.ssObj.on("deleteImage",this.deleteImageHandler,this);this.ssObj.on("performUndoRedo",this.performBizUndoRedo.bind(this));setTimeout(()=>{this.fontFamilyObj=this.ssObj.element.querySelector("#"+this.ssObj.element.id+"_font_name").ej2_instances[0],this.fontFamilyObj.addEventListener("beforeOpen",this.fontFamilyBfOpen.bind(this)),this.fontFamilyObj.beforeItemRender=this.fontFamilyBfRender.bind(this),this.fontFamilyObj.addEventListener("select",this.fontFamilySelect.bind(this)),window.hlookupHandler=(n,t)=>{var i=this.ssObj.element.querySelector(".e-spreadsheet-edit").innerText;t=i.split("(")[1].split(")")[0].split(",")[1]},window.vlookupHandler=(n,t,i,r)=>{let s=this.ssObj.biz.getActiveSheet(),c=this.ssObj.element.querySelector(".e-spreadsheet-edit").innerText;t=c.split("(")[1].split(")")[0].split(",")[1];i=parseInt(i);n=n.replace(/['"]+/g,"");r=this.parseMatchValue(r);let u=ej.spreadsheet.getIndexesFromAddress(t),f,e,o;if(n.includes("#NAME"))return n;if(u[3]-u[1]+1<i||i<1)return"#REF!";for(f=u[0];f<=u[2];f++){if(o)break;for(e=u[1];e<=u[3];e++){let t=ej.spreadsheet.getCell(f,e,s);if(t&&t.value&&r?t.value.toString()===n:t.value.toString().toLowerCase()===n.toLowerCase()){o=!0;break}}}let h=ej.spreadsheet.getCell(f-1,u[1]+i-1,s);return o&&h?h.value||"":"#N/A"},window.hlookupHandler=(n,t,i,r)=>{let s=this.ssObj.biz.getActiveSheet(),c=this.ssObj.element.querySelector(".e-spreadsheet-edit").innerText;t=c.split("(")[1].split(")")[0].split(",")[1];i=parseInt(i);n=n.replace(/['"]+/g,"");r=this.parseMatchValue(r);let u=ej.spreadsheet.getIndexesFromAddress(t),e,f,o;if(n.includes("#NAME"))return n;if(u[2]-u[0]+1<i||i<1)return"#REF!";for(e=u[0];e<=u[2];e++){if(o)break;for(f=u[1];f<=u[3];f++){let t=ej.spreadsheet.getCell(e,f,s);if(t&&t.value&&r?t.value.toString()===n:t.value.toString().toLowerCase()===n.toLowerCase()){o=!0;break}}}let h=ej.spreadsheet.getCell(u[0]+i-1,f,s);return o&&h?h.value||"":"#N/A"},this.ssObj.addCustomFunction("hlookupHandler","hlookup"),this.ssObj.addCustomFunction("vlookupHandler","vlookup")},1e3);this.wireEvents();this.ssObj.appendTo(".DocumentViewer");this.ssObj.biz={};this.addUtilFn();n.Apps.Collaboration.Components.Documents.Instance()._openedfile=this.ssObj;this.initSetInterval();document.getElementsByClassName("e-spinner-pane")[0].style.display="none"}dialogOpenHandler(n){n.dialogName=="ValidationDialog"&&(n.element.ej2_instances[0].addEventListener("open",()=>{document.querySelector(".e-validation-dlg .e-allow input").ej2_instances[0].addEventListener("change",this.validationInputHandler.bind(this))}),n.element.ej2_instances[0].addEventListener("beforeClose",()=>{document.querySelector(".e-validation-dlg .e-allow input").ej2_instances[0].removeEventListener("change",this.validationInputHandler.bind(this))}))}validationInputHandler(n){let f="Note: date format should be MM/DD/YYYY",e="Note: time format should be HH:MM:SS AM/PM ",o="Note: List will be seperated by comma(,)",u=document.getElementsByClassName("e-validation-dlg")[0],i=document.createElement("div"),t=document.createElement("div");t.classList.add("biz-validation-note-wrapper");i.classList.add("biz-validation-note");t.append(i);let r=document.getElementsByClassName("biz-validation-note-wrapper");n.value=="Date"?r.length==0?(document.getElementsByClassName("e-cellrange")[0].before(t),i.textContent=f,u.style.marginTop="0",t.style.marginBottom="10px"):document.getElementsByClassName("biz-validation-note")[0].textContent=f:n.value=="Time"?r.length==0?(document.getElementsByClassName("e-cellrange")[0].before(t),i.textContent=e,u.style.marginTop="0",t.style.marginBottom="10px"):document.getElementsByClassName("biz-validation-note")[0].textContent=e:n.value=="List"?r.length==0?(document.getElementsByClassName("e-cellrange")[0].before(t),i.textContent=o,u.style.marginTop="0",t.style.marginBottom="10px"):document.getElementsByClassName("biz-validation-note")[0].textContent=o:(r.length!==0&&r[0].remove(),u.style.marginTop="",t.style.marginBottom="")}deleteImageHandler(n){let t=this.ssObj.getActiveSheet(),i=this.setSheetNameForInCell(t.name);if(!n.id.includes(i)&&document.getElementById(n.id)){let u=document.getElementById(n.id).style.backgroundImage;n.src=u.substring(5,u.length-2);let r=t.pictures.find(t=>t.imageId==n.id);setTimeout(()=>{if(r){let u=t.pictures.indexOf(r);n.id+="_"+i+"_"+r.row+"_"+r.col+"_import";u!=-1&&t.pictures.splice(u,1)}},150)}setTimeout(()=>{n.action=n.name,n.id.includes(i)&&this.download.ssAutoSave(n,this,!0)},200)}initSetInterval(){this.timePeriod==="Minutes"||this.timePeriod==="Minute"?this.intr=setInterval(()=>{if(this.lastEditedTime=this.lastEditedTime+1,this.username=this.username,this.timePeriod=this.timePeriod,this.lastEditedTime!=1)if(this.lastEditedTime>=59&&this.timePeriod==="Minutes")n.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then(t=>{if(this.identity=n.Platform.Membership.Infos.Identity.getCurrentUser(),this.unibaseusername=this.identity.name,this.lastEditedTime=t.result.Lastedittime,this.username=t.result.LastUpdatedByName,this.timePeriod=t.result.TimePeriod,this.unibaseusername===this.username){let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago"}else{let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago by "+this.username}});else if(this.identity=n.Platform.Membership.Infos.Identity.getCurrentUser(),this.unibaseusername=this.identity.name,this.unibaseusername===this.username){let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago"}else{let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago by "+this.username}},6e4):(this.timePeriod==="Hour"||this.timePeriod==="Hours")&&(this.intrhour=setInterval(()=>{if(this.lastEditedTime=this.lastEditedTime+1,this.username=this.username,this.timePeriod=this.timePeriod,this.lastEditedTime>=23&&this.timePeriod==="Hours")n.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then(t=>{if(this.identity=n.Platform.Membership.Infos.Identity.getCurrentUser(),this.unibaseusername=this.identity.name,this.lastEditedTime=t.result.Lastedittime,this.username=t.result.LastUpdatedByName,this.timePeriod=t.result.TimePeriod,this.unibaseusername===this.username){let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago"}else{let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago by "+this.username}});else if(this.identity=n.Platform.Membership.Infos.Identity.getCurrentUser(),this.unibaseusername=this.identity.name,this.unibaseusername===this.username){let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago"}else{let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago by "+this.username}},36e5))}activeUsers(t){var i=[];for(var r in t){let u=n.Platform.Membership.Infos.Identity.getCurrentUser(),f=u.unibaseId;f!=t[r].unibaseId&&i.push(t[r].firstName.trim())}return this.connecteduserfirstName=i,console.log(this.connecteduserfirstName),this.showActiveUsers(t),this.connecteduserfirstName}showActiveUsers(t){var a=document.getElementsByClassName("biz-ss-onlineusersintials")[0],r,e,u;let c=n.Platform.Membership.Infos.Identity.getCurrentUser(),i=c.unibaseId;r=[];for(e in this.connecteduserfirstName)r.push(this.connecteduserfirstName[e].charAt(0));u=document.getElementById("biz-ss-connected_users_container");typeof u!="undefined"&&u!=null&&u.remove();let o="",l=`<div id="biz-ss-connected_users_container"></div>`;$(".biz-ss-onlineusersintials").append(l);let s="",f,h=["#6640b2","#3a55b1","#0092ee","#00acf0","#1ebccd","#009b84","#22af47","#88c241","#d0d962","#fde335","#ffbf36","#ff9528","#ff6028","#7a5449","#c1993f","#9e9e9e","#5e7d8a","#324148","#f5f5f6","#f95851","#ef3975","#b642b5","#7a59bc","#536bbb","#21a0f0","#21b7f2"];for(let n=0;n<this.connecteduserfirstName.length;n++)f=h[Math.floor(Math.random()*h.length)],o=`<div id="biz-ss-connecteduser-`+i+`" class="d-flex flex-row border rounded-circle w-35p h-35p biz-ss-users-`+n+`" style="margin-right:-8px; background-color:`+f+`">
  2. <div id="biz-ss-connecteduser_`+i+`" class="biz-ss-connectedusersfirstletter m-auto" data-toggle="popover" data-placement="top" title = "`+this.connecteduserfirstName[n]+`">`+r[n]+`</div></div>`,n<=5&&$("#biz-ss-connected_users_container").append(o),s+='<a class="dropdown-item d-flex flex-row align-items-center p-1 my-1" href="javascript:void(0)"><div class="biz-ss-connectedusersfirstletter border mr-2 px-2 rounded-circle text-white" style="background-color:#'+f+'" title = "'+this.connecteduserfirstName[n]+'">'+r[n]+'<\/div><span class="font-13 font-weight-500">'+t[n].firstName+"<\/span><\/a>",n>5&&($("#biz-ss-connected_users_container").children().last().remove(),$("#biz-ss-connected_users_container").append('<div class="users-dropdown"><a href="javascript:void(0);" class="d-flex flex-row border rounded-circle w-35p h-35p text-dark biz-ss-users-'+n+'" role="button" id="biz-ss-connecteduser-'+i+'" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style=" background-color:lightgray;margin-right:-8px"><span class="m-auto font-14 font-weight-500"><span class="font-12 text-muted"><i class="la la-plus"><\/i><\/span>'+[n-4]+'<\/span><\/a><div class="dropdown-menu z-index-10 position-absolute bg-white h-275p scroll-bar" aria-labelledby="biz-ss-connecteduser-'+i+'"><\/div>'),$(".users-dropdown .dropdown-menu").append(s))}fontFamilyBfOpen(n){if(n.element.parentElement.classList.remove("e-font-family"),this.fontFamilyRecent.length){let n=this.ssObj.ribbonModule.getFontFamilyItems();delete n[5].iconCss;let i=this.ssObj.biz.getActiveSheet(),r=ej.spreadsheet.getIndexesFromAddress(i.activeCell),t=ej.spreadsheet.getCell(r[0],r[1],i),u=t&&t.style&&t.style.fontFamily||"Calibri";for(let t=0;t<n.length;t++)n[t].text===u&&(n[t].iconCss="e-icons e-selected-icon");let f=this.fontFamilyRecent.concat([{separator:!0}]).concat(n);this.fontFamilyObj.items=f;this.fontFamilyObj.dataBind()}}fontFamilyBfRender(n){n.element.style.fontFamily=n.item.text}fontFamilySelect(n){this.fontFamilyRecent=this.fontFamilyRecent.filter(t=>t.text!==n.item.text);this.fontFamilyRecent.unshift({text:n.item.text});this.fontFamilyRecent.length>5&&this.fontFamilyRecent.pop()}wireEvents(){this.permissionLevel!==n.Apps.Collaboration.Enums.Share.Viewer&&(document.body.addEventListener("mousedown",this.mouseDown.bind(this)),document.body.addEventListener("mouseup",this.mouseUp.bind(this)),document.body.querySelector(".DocumentViewer").addEventListener("keyup",this.keyUp.bind(this)),document.body.addEventListener("dblclick",this.bodyDblClick.bind(this)),document.body.querySelector(".DocumentViewer").addEventListener("keydown",this.keyDown.bind(this)));window.addEventListener("keydown",this.windowKeydown.bind(this));document.body.addEventListener("mouseup",this.viewOnlyMouseUp.bind(this));document.body.addEventListener("mousedown",this.viewOnlyMouseDown.bind(this));document.body.querySelector(".DocumentViewer").addEventListener("keydown",this.viewOnlyKeyDown.bind(this))}unwireEvents(){document.body.removeEventListener("mousedown",this.mouseDown.bind(this));document.body.removeEventListener("mousedown",this.mouseDown.bind(this));document.body.removeEventListener("mouseup",this.mouseUp.bind(this));document.body.querySelector(".DocumentViewer").removeEventListener("keydown",this.keyDown.bind(this));document.body.querySelector(".DocumentViewer").removeEventListener("keyup",this.keyUp.bind(this));document.body.removeEventListener("mouseup",this.viewOnlyMouseUp.bind(this));document.body.removeEventListener("mousedown",this.viewOnlyMouseDown.bind(this));document.body.querySelector(".DocumentViewer").removeEventListener("keydown",this.viewOnlyKeyDown.bind(this));document.body.removeEventListener("dblclick",this.bodyDblClick.bind(this));window.removeEventListener("keydown",this.windowKeydown.bind(this))}eventListners(){document.getElementsByClassName("biz-ss-cloudsave")[0].addEventListener("click",()=>{n.Apps.Collaboration.Components.Sheets.Ribbon.Instance().renderCloudSavedDialogue()});document.getElementsByClassName("biz-ss-cloudloading")[0].addEventListener("click",()=>{n.Apps.Collaboration.Components.Sheets.Ribbon.Instance().renderCloudSavingDialogue()});document.getElementsByClassName("biz-ss-filename")[0].addEventListener("focusout",()=>{this.FileId?this.fileNameChange():this.download.ssAutoSave({action:"createNewSpreadsheet",eventArgs:{}},this,!1)});document.getElementsByClassName("biz-ss-starred")[0].addEventListener("click",()=>{n.Apps.Collaboration.Components.UniCloud.Instance().priority(this.FileId,"file","ss",0)});this.ssObj.enableContextMenu&&this.ssObj.contextMenuModule.contextMenuInstance.addEventListener("beforeItemRender",n=>{var t=this.ssObj.biz.getIndexes();let u=this.ssObj.biz.getActiveSheet();if(n.item.text=="UnHide Rows"){var f=t[0],e=t[2],i=u.rows;i=i.slice(f,e+1);i.filter({hidden:n}=>n==!0).length==1&&(n.element.innerHTML="UnHide Row")}if(n.item.text=="UnHide Columns"){var o=t[1],s=t[3],r=u.columns;r=r.slice(o,s+1);r.filter({hidden:n}=>n==!0).length==1&&(n.element.innerHTML="UnHide Column")}});document.onpaste=()=>{var i,r;let t=this.ssObj.getActiveSheet(),n=ej.spreadsheet.getIndexesFromAddress(t.activeCell),u=(event.clipboardData||event.originalEvent.clipboardData).items;for(i=0;i<2;i++)if(r=u[i],r&&r.kind==="file"){let u=r.getAsFile(),i=new FileReader;i.onload=i=>{let o=this.setSheetNameForInCell(t.name);this.pastedImageDetails=i;let f=ej.spreadsheet.getCellPosition(t,[n[0],n[1]],t.frozenRows,t.frozenColumns),u={src:this.pastedImageDetails.target.result,top:f.top,left:f.left,id:"spreadsheet_overlay_picture_"+o+"_"+n[0]+"_"+n[1]},r=ej.spreadsheet.getCell(n[0],n[1],t);this.oldCellInfo=Object.assign({},r);r||(r={});this.setImageSize("top",u);this.setImageSize("left",u);r.image=[u];this.ssObj.biz.setCell(n[0],n[1],t,r);this.download.ssAutoSave({action:"cellSave",eventArgs:{address:"sheet!"+this.ssObj.biz.getRange()}},this,!0);let e={indexes:n,range:this.ssObj.biz.getRange(),cellInfo:r,action:"insertimage",origin:"biz",sheetIndex:this.getSheetIndex()};this.ssObj.updateUndoRedoCollection({name:"bizAction",args:{action:"bizImageInCell",options:e,oldCells:this.oldCellInfo}});this.bizSignalr(e)};i.readAsDataURL(u)}};window.onkeyup=n=>{if(n.keyCode==27&&this.fullscreen.ssMenuBarFullScreen){let n=document.getElementById("DocumentViewer_sheet_panel");this.ssObj.element.parentElement.nextElementSibling.style.display="inline-block";this.ssObj.element.parentElement.previousElementSibling.style.display="block";document.getElementById("DocumentViewer_ribbon").style.display="block";var t=n.previousElementSibling.previousElementSibling.offsetHeight,i=n.previousElementSibling.offsetHeight,r=n.nextElementSibling.offsetHeight,u=this.ssObj.element.offsetHeight;document.getElementById("DocumentViewer_sheet_panel").style.height=u-t-i-r+"px";this.fullscreen.ssMenuBarFullScreen=!1}};document.getElementsByClassName("biz-ss-filename")[0].addEventListener("input",()=>{this.setFileNameElementWidth()})}getTextWidth(n,t=this.getCanvasFontSize()){const r=this.getTextWidth.canvas||(this.getTextWidth.canvas=document.createElement("canvas")),i=r.getContext("2d");i.font=t;const u=i.measureText(n);return u.width}getCssStyle(n,t){return window.getComputedStyle(n,null).getPropertyValue(t)}getCanvasFontSize(n=document.body){const t=this.getCssStyle(n,"font-weight")||"normal",i=this.getCssStyle(n,"font-size")||"16px",r=this.getCssStyle(n,"font-family")||"Times New Roman";return`${t} ${i} ${r}`}setFileNameElementWidth(){let n=document.getElementsByClassName("biz-ss-filename")[0];n.style.width=this.getTextWidth(n.value)+8+"px"}mouseUp(){setTimeout(()=>{let n=document.getElementsByClassName("e-customsort-dlg")[0];if(n){let n=document.getElementsByClassName("e-sort-addbtn")[0],t=document.querySelector(".e-sort-field.e-control").ej2_instances[0].dataSource.length,i=document.querySelector(".e-list-sort.e-sort-template").firstElementChild.firstElementChild.children.length;t===i?(n.classList.add("e-disabled"),n.disabled=!0):(n.classList.remove("e-disabled"),n.disabled=!1)}},300)}viewOnlyMouseUp(n){this.fullscreen.ssMenuBarFullScreen&&setTimeout(()=>{if(n.toElement.title=="Expand Formula Bar"||n.toElement.title=="Collapse Formula Bar"){let n=document.getElementById("DocumentViewer_sheet_panel");var t=n.previousElementSibling.offsetHeight,i=n.nextElementSibling.offsetHeight;n.style.height=window.innerHeight-t-i+"px"}},200)}mouseDown(t){var u,i,r;let f=this.ssObj.biz.getActiveSheet();this.clearFindReplace();this.mouseDownHandlers.forEach(n=>{n.call(this,t)});u=this.ssObj.biz.getIndexes();this.cellRowStart=u[0];this.cellColStart=u[1];this.cellRowEnd=u[2];this.cellColEnd=u[3];let o=document.getElementsByClassName("copyto_dialog"),s=document.getElementsByClassName("biz-ss-import-dialog"),h=document.getElementById("biz-ss-resizetofit-dialog_dialog-header"),c=t.target.closest(".biz-ss-cloudsave-container"),e=t.target.closest(".e-tab-wrap"),l=t.target.closest(".biz-ss-cloudloading-container");if(this.clicks++,setTimeout(()=>{this.clicks=0},400),c||document.getElementById("biz-ss-cloudsave-container")&&this.ribbon.ssCloudSavedDialougObj.destroy(),l||document.getElementById("biz-ss-cloudloading-container")&&this.ribbon.ssCloudSavingDialougObj.destroy(),this.clicks===2){let n=[];if(this.clicks=0,t.target.classList.contains("e-autofill")){this.autofillDrag=!0;let t=this.ssObj.biz.getIndexes(),e=this.ssObj.getActiveSheet(),u=ej.spreadsheet.getCell(t[0],t[1],e),o=0,f,r;if(u&&u.formula){for(i=t[0]+1;i<1e14;i++){let n=ej.spreadsheet.getCell(i,t[1]-1,e);this.checkCellObjHasValue(n)?o++:i=1e14}if(u.formula.includes(":")&&u.formula.includes("(")){let s=u.formula.split(":"),h=Number(s[0].match(/\d/g).join("")),c=Number(s[1].match(/\d/g).join(""));for(i=t[0]+1;i<=t[0]+o;i++){s[0]=s[0].replace(h.toString(),(h+1).toString());s[1]=s[1].replace(c.toString(),(c+1).toString());f=s.join(":");r=ej.spreadsheet.getCell(i,t[1],e);r?r.formula=f:r={formula:f};this.ssObj.biz.setCell(i,t[1],e,r);let u={Row:i,cell:t[1],CellInfo:r};n.push(u);h++;c++}}else if(u.formula.includes("("))for(i=t[0]+1;i<=t[0]+o;i++){let o,s=u.formula.split("(");o=Number(s[1].match(/\d/g).join(""));f=u.formula.replace(o.toString(),i+1);r=ej.spreadsheet.getCell(i,t[1],e);r?r.formula=f:r={formula:f};this.ssObj.biz.setCell(i,t[1],e,r);let h={Row:i,cell:t[1],CellInfo:r};n.push(h)}else if(u.formula.includes(":")){let s=u.formula.split(":"),h=Number(s[0].match(/\d/g).join("")),c=Number(s[1].match(/\d/g).join(""));for(i=t[0]+1;i<=t[0]+o;i++){s[0]=s[0].replace(h.toString(),(h+1).toString());s[1]=s[1].replace(c.toString(),(c+1).toString());f=s.join(":");r=ej.spreadsheet.getCell(i,t[1],e);r?r.formula=f:r={formula:f};this.ssObj.biz.setCell(i,t[1],e,r);let u={Row:i,cell:t[1],CellInfo:r};n.push(u);h++;c++}}else{let s=Number(u.formula.match(/\d/g).join(""));for(i=t[0]+1;i<=t[0]+o;i++){f=u.formula.replace(s.toString(),i+1);r=ej.spreadsheet.getCell(i,t[1],e);r?r.formula=f:r={formula:f};this.ssObj.biz.setCell(i,t[1],e,r);let o={Row:i,cell:t[1],CellInfo:r};n.push(o)}}}n.length>0&&this.download.ssAutoSave({action:"imageincell",changedValues:n},this,!0);this.ssObj.selectRange(e.activeCell+":"+this.generateHeaderText(t[3]+1)+(n.pop().Row+1))}}if(o.length>0){let i=n.Apps.Collaboration.Components.UniCloud.Instance(),r=t.target.closest(".copyto_dialog");if(r||document.getElementsByClassName(".copyto_dialog")&&($("#_bizgaze_modal").modal("hide"),$("#_bizgaze_modal").empty()),this.selectFileEffectInDialog(t),t.target.id==="copyto_select_btn")if(i.copyToSelectedFileId!==0){n.Platform.Helpers.NavigationHelper.Instance().showLoading();let t=n.Apps.Collaboration.Components.Sheets.Base.Instance(),u=t.getSheetIndex(),r=t.ssObj.sheets[u];if($("#_bizgaze_modal").modal("hide"),$(".modal-backdrop")[$(".modal-backdrop").length-1].remove(),$("#moveToModal").empty(),i.copyToSelectedFileId===t.FileId){let u=0,f=t.ssObj.sheets,e=t.ssObj.sheets.map(n=>n.name),i;e.includes("Copy of "+r.name)?(f.forEach(n=>{n.name.startsWith("Copy of "+r.name)&&u++}),i="Copy of "+r.name+"("+u+")"):i="Copy of "+r.name;let o={FileId:t.FileId,sheetName:i,autosavetype:"insertsheetinsamewb",sheetIndex:n.Apps.Collaboration.Components.Sheets.Base.Instance().getSheetIndex(),requestId:n.Apps.Collaboration.Components.Common.Download.Instance().requestId+1};n.Apps.Collaboration.DocumentManager.Instance().ssAutoSave(o).then(()=>{n.Apps.Collaboration.DocumentManager.Instance().getJsonData(t.FileId).then(i=>{if(i.result!=null){let n=i.result;this.removeSheetIndexProp(n.Workbook);t.ssObj.openFromJson({file:n})}n.Platform.Helpers.NavigationHelper.Instance().hideLoading()})})}else{let r={FileId:t.FileId,copytofileid:i.copyToSelectedFileId,sheetIndex:t.getSheetIndex(),requestId:n.Apps.Collaboration.Components.Common.Download.Instance().requestId+1};n.Apps.Collaboration.DocumentManager.Instance().CopySheetInToExistingWorkbook(r).then(t=>{n.Platform.Helpers.NavigationHelper.Instance().hideLoading(),t.errors})}}else i.moveToFolderElement.firstElementChild.click()}if(t.target.parentElement.id==="DocumentViewer_currencyformat")for(let n=this.cellRowStart;n<=this.cellRowEnd;n++)for(let t=this.cellColStart;t<=this.cellColEnd;t++)r=ej.spreadsheet.getCell(n,t,f),r.format="$#,##0.00",this.ssObj.biz.setCell(n,t,f,r);if(t.target.parentElement.id==="DocumentViewer_percentageformat")for(let n=this.cellRowStart;n<=this.cellRowEnd;n++)for(let t=this.cellColStart;t<=this.cellColEnd;t++)r=ej.spreadsheet.getCell(n,t,f),r.format=".00%",this.ssObj.biz.setCell(n,t,f,r);if(t.target.classList.contains("biz-ss-fileshare-btn")&&n.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/collaboration/components/old_unicloud.js","platform/apps/managers/appmanager.js","platform/apps/enums/appconfigurationtypes.js"],()=>{n.Apps.Collaboration.Components.UniCloud.Instance().share(this.FileId,"file",0)}),s.length>0)if(this.selectFileEffectInDialog(t),t.target.id=="importfile-drive-cancel-btn")this.ribbon.ssImportDialougObj.hide(),setTimeout(()=>{this.ribbon.ssImportDialougObj&&this.ribbon.ssImportDialougObj.destroy(),this.ribbon.ssImportDialougObj=null},1e3);else if(t.target.id=="importfile-drive-select-btn"){this.isDriveImport=!0;let t={name:this.ribbon.driveSelectedLiElement.textContent.trim(),fileid:this.ribbon.driveSelectedFileId},n={upload:!1,existingfileid:this.ribbon.driveSelectedFileId,FileId:this.FileId,filedata:"",filetype:"",filename:"",FilePath:null,RefId:0};this.ribbon.spreadsheetImportedFileData=n;this.ribbon.spreadsheetImportedReplaceFileData=n;this.ribbon.importedFile={files:[t]};this.ribbon.ssImportDialougObj.destroy();this.ribbon.ssimportedFileDataDailog()}if(h&&(t.target.classList.contains("e-dlg-closeicon-btn")||t.target.classList.contains("e-icon-dlg-close"))&&this.dialogue.hideResizeDialog(),e){let n=e.querySelector(".e-tab-text").textContent;this.selectedSheetName=n&&t.which==3?e?e.textContent:null:null}}viewOnlyMouseDown(n){let t=document.getElementsByClassName("biz-ss-menubar-fullscreen"),i=n.target.closest(".biz-ss-requestaccess-dialog");if(t.length>0)n.target.classList.contains("biz-ss-menubarfullscreen-dismiss")&&this.dialogue.hideSsMenubarFullscreenDialog();else if(this.viewOnlyDialog){var r=ej.base.closest(n.target,".biz-ss-viewonly-dialog");r||(this.viewOnlyDialog.hide(),this.viewOnlyDialog.destroy())}this.requestAccessObj&&!i&&this.hideRequestAccess()}checkCellObjHasValue(n){return n?n&&n.value!=null&&n.value!=undefined&&n.value.toString()!=""&&n.value.toString()!=" "?!0:!1:!1}selectFileEffectInDialog(t){let r=n.Apps.Collaboration.Components.UniCloud.Instance(),o=t.target.closest(".copyto_list"),u=t.target.closest(".copyto_file"),f=t.target.closest(".copyto_folder"),i=document.getElementById("importfile-drive-select-btn"),e=document.getElementById("copyto_select_btn");if(o){document.getElementsByClassName("copyto_select")[0]&&document.getElementsByClassName("copyto_select")[0].classList.remove("copyto_select");let n=t.target.closest(".copyto_list");if(n.classList.add("copyto_select"),r.copyToSelectedFileId=0,u){let n=Number(u.id.split("_")[2]);r.copyToSelectedFileId=n;this.ribbon.driveSelectedFileId=n;this.ribbon.driveSelectedLiElement=u;i?i.classList.remove("disabled"):e.classList.remove("disabled")}i&&i.classList.contains("disabled")?i.classList.remove("disabled"):i&&i.classList.contains("e-disabled")&&i.classList.remove("e-disabled")}f&&(r.moveToFolderElement=f,i&&i.classList.add("e-disabled"),i?i.classList.add("disabled"):e.classList.add("disabled"))}addUtilFn(){this.ssObj.biz.getRange=()=>this.ssObj.getActiveSheet().selectedRange;this.ssObj.biz.getIndexes=()=>this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.ssObj.biz.getRange()));this.ssObj.biz.setCell=(n,t,i,r)=>{this.ssObj.clipboardModule.setCell(n,t,i,r,!1,!1,!1)};this.ssObj.biz.getCell=(n,t,i)=>ej.spreadsheet.getCell(n,t,i);this.ssObj.biz.isRowAvailable=(n,t)=>t.rows[n]?!0:!1;this.ssObj.biz.getActiveSheet=()=>this.ssObj.biz.sheetIndex>-1?this.ssObj.sheets[this.ssObj.biz.sheetIndex]:this.ssObj.getActiveSheet();this.ssObj.biz.isRowsSelected=n=>{n||(n=this.ssObj.biz.getIndexes());let i=n[1],r=n[3],u=this.ssObj.getActiveSheet().colCount-1;for(var t=n[0];t<=n[2];t++)if(!(i===0&&r===u))return!1;return!0};this.ssObj.biz.isColsSelected=n=>{n||(n=this.ssObj.biz.getIndexes());let i=n[0],r=n[2],u=this.ssObj.getActiveSheet().rowCount-1;for(var t=n[1];t<=n[3];t++)if(!(i===0&&r===u))return!1;return!0};this.ssObj.biz.getSheetIndexByname=n=>{let t=this.ssObj.sheets.length;for(let i=0;i<t;i++)if(this.ssObj.sheets[i].name==n)return i;return-1};this.ssObj.biz.getSheetByName=n=>{let t=this.ssObj.sheets.length;for(let i=0;i<t;i++)if(this.ssObj.sheets[i].name==n)return this.ssObj.sheets[i]}}getIndexesFromAddress(n){return this.swapRange(ej.spreadsheet.getIndexesFromAddress(n))}getSheetIndex(n){n=n?n:this.ssObj.biz.getActiveSheet();let t=this.ssObj.sheets.length;for(let i=0;i<t;i++)if(this.ssObj.sheets[i].name==n.name)return i;return-1}getCellsFromIndexes(n,t){let i=[],u=this.ssObj.getActiveSheet(),r=0;for(let f=n[0];f<=n[2];f++){for(let e=n[1];e<=(t?n[1]+t[r].length:n[3]);e++)i.push(JSON.parse(JSON.stringify(ej.spreadsheet.getCell(f,e,u))));r++}return i}setCellObjects(n,t,i){let r=this.ssObj.getActiveSheet(),u=0;for(let f=n[0];f<=n[2];f++){for(let e=n[1];e<=(i?n[1]+i[u].length:n[3]);e++){let i=t.shift(),n=ej.spreadsheet.getCell(f,e,r);n&&n.image&&n.image[0]&&document.getElementById(n.image[0].id).remove();i?this.ssObj.biz.setCell(f,e,r,i):(this.ssObj.biz.setCell(f,e,r,undefined),delete r.rows[f].cells[e])}u++}}generateSheetName(n,t){let r;if(n.indexOf(t)<0)return t;r=t.lastIndexOf(" (")>-1?t.substr(0,t.lastIndexOf(" (")):t;let i=2;while(n.indexOf(r+"("+i+")")>-1)i++;return t+" ("+i+")"}clearCell(n,t,i){this.ssObj.biz.setCell(t,i,n,{});delete n.rows[t].cells[i]}updateCell(n,t,i,r){this.ssObj.biz.setCell(t,i,n,r)}clearRow(n,t){if(this.ssObj.biz.isRowAvailable(t,n)&&n.rows[t].cells){let i=n.rows[t].cells.length;for(let r=0;r<i;r++)this.ssObj.biz.setCell(t,r,n,{})}delete n.rows[t]}updateRow(n,t,i){for(var r=0;i&&i.cells&&r<=i.cells.length;r++){let u=i.cells[r];u&&this.ssObj.biz.setCell(t,r,n,u)}i&&(n.rows[t]=i)}swapRange(n){return n[0]>n[2]&&this.swap(n,0,2),n[1]>n[3]&&this.swap(n,1,3),n}swap(n,t,i){if(t!=i){let r=n[t];n[t]=n[i];n[i]=r}}generateHeaderText(n){if(this.hederText[n])return this.hederText[n];let t=this.generateText(n);return this.hederText[n]=t,t}generateText(n){let t="Z";return n/26>1?this.generateText(n%26==0?n/26-1:Math.floor(n/26))+String.fromCharCode(n%26==0?t.charCodeAt(t):64+n%26):String.fromCharCode(64+n)}updateProps(){this.element=document.getElementById("DocumentViewer");this.ribbon=n.Apps.Collaboration.Components.Sheets.Ribbon.Instance();this.dialogue=n.Apps.Collaboration.Components.Sheets.Dialogue.Instance();this.autofill=n.Apps.Collaboration.Components.Sheets.Autofill.Instance();this.formatpainter=n.Apps.Collaboration.Components.Sheets.FormatPainter.Instance();this.spellchecker=n.Apps.Collaboration.Components.Sheets.SpellChecker.Instance();this.util=n.Apps.Collaboration.Components.Common.Util.Instance();this.download=n.Apps.Collaboration.Components.Common.Download.Instance();this.fullscreen=n.Apps.Collaboration.Components.Fullscreen.Instance();this.ssSettings={contextMenuBeforeOpen:this.cmenuBfOpen.bind(this),contextMenuItemSelect:this.cmenuSelect.bind(this),actionComplete:this.actionComplete.bind(this),beforeCellRender:this.bfCellRender.bind(this),beforeSelect:this.beforeSelect.bind(this),actionBegin:this.actionBegin.bind(this),cellEdit:this.cellEdit.bind(this),sortComplete:this.sortComplete.bind(this),openComplete:this.openComplete.bind(this),cellSave:this.cellSave.bind(this),dataBound:this.dataBound.bind(this),beforeCellSave:this.beforeCellSave.bind(this),created:this.ssCreated.bind(this),sheets:this.filedata,allowSave:!0,saveUrl:_appsettings.server_url()+"/apis/v4/unibase/collaboration/documents/spreadsheetdownload"}}beforeSelect(){let n=document.getElementById("DocumentViewer_edit");n&&(n.textContent="");this.isCtrlA=!1}bfCellRender(n){if(this.openJSON&&(this.processCustomResponse(),this.openJSON=!1),this.showFormula){let t="";n.cell&&n.cell.value&&(t=n.cell.value);n.cell.formula&&n.cell.formula.length&&(t=n.cell.formula);n.element.innerHTML=t}if(n&&n.cell&&n.cell.image&&n.cell.image.length>0){let t=this.ssObj.getActiveSheet(),i=this.setSheetNameForInCell(t.name);t.pictures==undefined&&(t.pictures=[]);n.cell.image.forEach(r=>{r.id.includes(i)||t.pictures.find(n=>n.imageId==r.id)||t.pictures.push({imageId:r.id,row:n.rowIndex,col:n.colIndex})})}}setSheetNameForInCell(n){return n=n.replaceAll("(",""),n=n.replaceAll(")",""),n.includes(" ")?n.split(" ").join("-"):n}beforeCellSave(n){if(this.isInitial=!1,this.prevFormulaRange="",this.f2Edit=!1,this.prevFormulaRange="",this.formulaActiveCell="",n.value&&n.value.length&&n.value.length&&n.value[0]==="="&&this.lastKeyEvent.keyCode===13){let t=document.body.querySelector("#"+this.ssObj.element.id+"_ac_popup");t&&t.classList.contains("e-popup-open")&&(n.cancel=!0,this.ssObj.formulaModule.triggerKeyDownEvent(13),this.ssObj.formulaModule.hidePopUp(),t.classList.remove("e-popup-open"),t.classList.add("e-popup-close"))}this.removeCopyIndicator()}cellEdit(){this.isInitial=!1;var t=this.ssObj.biz.getIndexes();let i=this.ssObj.biz.getActiveSheet(),n=ej.spreadsheet.getCell(t[0],t[1],i);n&&n.image&&n.image[0]&&n.image[0].id.startsWith("biz_image_in_cell")&&(document.getElementById(n.image[0].id).style.display="none");this.autofillDrag&&(this.ssObj.endEdit(),this.autofillDrag=!1)}sortComplete(){}cellSave(n){var i=this.ssObj.biz.getIndexes();let r=this.ssObj.biz.getActiveSheet(),t=ej.spreadsheet.getCell(i[0],i[1],r);if(t&&t.value&&t.value!=""?t.image&&t.image.length>0&&(document.getElementById(t.image[0].id).remove(),t.image=[],this.download.ssAutoSave({action:"imageincell",changedValues:[{row:i[0],cell:i[1],cellinfo:t}]},this,!0)):t&&t.image&&t.image.length>0&&(document.getElementById(t.image[t.image.length-1].id).style.display=""),this.showFormula){let t="";n.value&&(t=n.value);n.formula&&n.formula.length&&(t=n.formula);n.element.innerHTML=t}this.removeCopyIndicator()}openComplete(){setTimeout(()=>{this.addImageClassToAllImages()},3e3)}ssCreated(){this.openJSON=!0;this.removeSheetIndexProp(this.filedata.Workbook);this.ssObj.openFromJson({file:this.filedata});this.container.addEventListener("fullscreenchange",this.fullScreenHandler.bind(this));this.ssObj.enableContextMenu&&this.ssObj.contextMenuModule.contextMenuInstance.addEventListener("beforeItemRender",this.cmenubfrender.bind(this));document.getElementsByClassName("e-formula-bar-panel")[0].firstElementChild.lastElementChild.remove();this.ssObj.element.querySelector(".e-sheet-tab").ej2_instances[0].addEventListener("selected",this.tabSelected.bind(this));this.focusDocumentViewer();this.setFileNameElementWidth();this.ssObj.addEventListener("dialogBeforeOpen",this.dialogOpenHandler.bind(this))}removeSheetIndexProp(n){if(n.sheets&&n.sheets.length>0)for(var t=0;t<n.sheets.length;t++)n.sheets[t]&&n.sheets[t].index&&delete n.sheets[t].index}processCustomResponse(){if(this.customresult.richtexts&&this.customresult.richtexts.sheets.length){let n=this.customresult.richtexts;for(let t=0;t<n.sheets.length;t++){let i=this.ssObj.biz.getSheetIndexByname(this.customresult.richtexts.sheets[t].name);this.ssObj.sheets[i].richtexts={rows:n.sheets[0].rows}}}}autoSave(t){t.action=="import"||t.action=="gotoSheets"||this.isInitial||n.Apps.Collaboration.Components.Common.Download.Instance().saveDocumentFile(this.FileId,"Excel",null,t,this).then(function(){})}cmenubfrender(n){var r,u;let t=document.createElement("span");t.classList.add("e-badge");t.classList.add("biz-contextmenu-badges");let i=this.ssObj.biz.getIndexes(),f=this.ssObj.biz.getActiveSheet();if(n.item.text==="Filter"){if(this.ssObj.filterCollection){let t=this.ssObj.filterCollection.map(n=>n.sheetIndex);t.includes(this.getSheetIndex())&&n.element.classList.contains("e-disabled")&&n.element.classList.add("e-disabled")}}else if(n.item.text==="Clear validation")for(r=i[0];r<=i[2];r++)for(u=i[1];u<=i[3];u++){let t=ej.spreadsheet.getCell(r,u,f);t&&!t.validation&&(n.element.classList.add("e-disabled"),r=i[2]+1,u=i[3]+1)}else n.item.text==="Cut"?t.textContent="Ctrl+X":n.item.text==="Copy"?t.textContent="Ctrl+C":n.item.text==="Paste"?t.textContent="Ctrl+V":n.item.text==="Values"?t.textContent="Ctrl+Shift+V":n.item.text==="Hyperlink"&&(t.textContent="Ctrl+K");if(n&&n.element&&!n.element.classList.contains("e-separator")&&n.element.id!=="DocumentViewer_cmenu_colorpallet"&&n.element.append(t),n.item.text==="Move Right"){let t=this.ssObj.biz.getSheetIndexByname(this.selectedSheetName||f.name);t===this.ssObj.sheets.length-1&&n.element.classList.add("e-disabled")}if(n.item.text==="Move Left"){let t=this.ssObj.biz.getSheetIndexByname(this.selectedSheetName||f.name);t===0&&n.element.classList.add("e-disabled")}}cmenuSelect(t){let i=this.ssObj.element.id+"_cmenu_",u=this.ssObj.sheets,f=this.getSheetIndex(),r=this.ssObj.biz.getRange();switch(t.item.id){case i+"insertrowabove":case i+"insertrow":this.ssObj.contextMenuModule.selectHandler({item:{id:this.ssObj.element.id+"_cmenu_insert_row_above"}});break;case i+"insertrowbelow":this.ssObj.contextMenuModule.selectHandler({item:{id:this.ssObj.element.id+"_cmenu_insert_row_below"}});break;case i+"insertcolright":this.ssObj.contextMenuModule.selectHandler({item:{id:this.ssObj.element.id+"_cmenu_insert_column_after"}});break;case i+"insertcolleft":case i+"insertcolumn":this.ssObj.contextMenuModule.selectHandler({item:{id:this.ssObj.element.id+"_cmenu_insert_column_before"}});break;case i+"shiftright":this.formatpainter.insertShiftRight(r);this.download.ssAutoSave({action:"insertCell"},this,!0);break;case i+"shiftdown":this.formatpainter.insertShiftDown(r);break;case i+"deleterow":this.ssObj.contextMenuModule.selectHandler({item:{id:this.ssObj.element.id+"_cmenu_delete_row"}});break;case i+"deletecolumn":this.ssObj.contextMenuModule.selectHandler({item:{id:this.ssObj.element.id+"_cmenu_delete_column"}});break;case i+"shiftleft":this.formatpainter.deleteShiftLeft(r);break;case i+"shiftup":this.formatpainter.deleteShiftUp(r);break;case i+"deletevalue":this.ssObj.editModule.editingHandler("delete");break;case i+"datvalidation":this.ssObj.notify("initiatedatavalidation",null);break;case i+"highlightinvaliddata":this.ssObj.addInvalidHighlight();break;case i+"clearhighlight":this.ssObj.removeInvalidHighlight();break;case i+"clearvalidation":this.ssObj.notify("removeDataValidation",null);break;case i+"delete_sheet":t.item.id="skipped";this.formatpainter.renderConfirmDlg();break;case i+"biz_insert":this.ssObj.element.querySelector(".e-add-sheet-tab").click();break;case i+"newspreadsheet":n.Apps.Collaboration.DocumentManager.Instance().CopySheetToNewSpreadsheet({FileId:this.FileId,sheetIndex:this.getSheetIndex()}).then(()=>{});break;case i+"removefilter":this.ssObj.applyFilter();let u=document.getElementById("DocumentViewer_sorting");u.firstElementChild.style.color="";break;case i+"insertnote":this.formatpainter.insertNote();break;case i+"clearnotes":this.formatpainter.clearComment();break;case i+"resizecolumns":case i+"resizecolumn":case i+"resizerows":case i+"resizerow":this.dialogue.renderResizeDialog()}}cmenuBfOpen(n){let e=this.ssObj.contextMenuModule.getTarget(n.event.target),t=this.ssObj.element.id+"_cmenu_",y=this.ssObj.contextMenuModule.contextMenuInstance,i=this.ssObj.contextMenuModule.getDataSource(e),o=this.ssObj.biz.getRange().split(":"),c=o[0].replace(/[0-9]/g,""),p=o[1].replace(/[0-9]/g,""),b=o[0].match(/\d+$/)[0],k=o[1].match(/\d+$/)[0],r=this.ssObj.biz.getIndexes(),s=this.ssObj.biz.isRowsSelected(r),h=this.ssObj.biz.isColsSelected(r),u=r[2]-r[0]+1,f=r[3]-r[1]+1,l=this.ssObj.biz.getActiveSheet(),a=this.ssObj.getActiveSheet().selectedRange,w=(a.match(/:/g)||[]).length,v=[{text:"Data validation",iconCss:"",id:t+"datvalidation"},{text:"Highlight invalid data",iconCss:"",id:t+"highlightinvaliddata"},{text:"Clear highlight",iconCss:"",id:t+"clearhighlight"},{text:"Clear validation",cssClass:"e-disabled",iconCss:"",id:t+"clearvalidation"},];switch(e){case"Content":w<=1&&(i.push({separator:!0}),s?(i.push({text:"Insert "+u+" above",iconCss:"",id:t+"insertrowabove"}),i.push({text:"Insert "+u+" below",iconCss:"",id:t+"insertrowbelow"})):h||i.push({text:"Insert "+u+" row"+(u>1?"s":""),iconCss:"",id:t+"insertrow"}),h?(i.push({text:"Insert "+f+" left",iconCss:"",id:t+"insertcolleft"}),i.push({text:"Insert "+f+" right",iconCss:"",id:t+"insertcolright"})):s||i.push({text:"Insert "+f+" column"+(f>1?"s":""),iconCss:"",id:t+"insertcolumn"}),i.push({text:"Insert cells",iconCss:"",id:t+"insertcells",items:[{text:"Shift right",iconCss:"",id:t+"shiftright"},{text:"Shift down",iconCss:"",id:t+"shiftdown"}]}),i.push({separator:!0}),h||i.push({text:u>1?"Delete selected rows":"Delete row",iconCss:"",id:t+"deleterow"}),s||i.push({text:c===p?"Delete column "+c:"Delete columns "+c+" - "+p,iconCss:"",id:t+"deletecolumn"}),i.push({text:"Delete cells",iconCss:"",id:t+"deletecells",items:[{text:"Shift left",iconCss:"",id:t+"shiftleft"},{text:"Shift up",iconCss:"",id:t+"shiftup"}]}),i.push({separator:!0}),i.push({text:"Insert note",iconCss:"",id:t+"insertnote"}),l.comments&&l.comments.rows[r[0]]&&l.comments.rows[r[0]].cells[r[1]]&&i.push({text:"Clear notes",iconCss:"",id:t+"clearnotes"}));i.push({text:"Validations",iconCss:"",id:t+"datvalidation",items:v});i.find(n=>n.text=="Filter").items.splice(2,0,{text:"Remove filter",id:t+"removefilter"});break;case"ColumnHeader":if(i.splice(5,1),h)if(i.splice(5,0,{text:"Insert "+f+" left",iconCss:"",id:t+"insertcolleft"}),i.splice(6,0,{text:"Insert "+f+" right",iconCss:"",id:t+"insertcolright"}),a.includes(" "))i.splice(9,0,{text:"Resize selected columns",iconCss:"",id:t+"resizecolumns"});else if(f>1){let n=this.generateText(r[1]+1)+" - "+this.generateText(r[3]+1);i.splice(9,0,{text:"Resize Columns "+n,iconCss:"",id:t+"resizecolumns"})}else i.splice(9,0,{text:"Resize Column",iconCss:"",id:t+"resizecolumn"});else i.splice(5,0,{text:"Insert "+f+" column"+(f>1?"s":""),iconCss:"",id:t+"insertcolumn"});i.splice(i.length-1,0,{text:"Clear column"+(f>1?"s":""),iconCss:"",id:t+"deletevalue"});i.push({separator:!0});i.push({text:"Validations",iconCss:"",id:t+"datvalidation",items:v});break;case"RowHeader":i.splice(5,1);s?(i.splice(5,0,{text:"Insert "+u+" above",iconCss:"",id:t+"insertrowabove"}),i.splice(6,0,{text:"Insert "+u+" below",iconCss:"",id:t+"insertrowbelow"}),a.includes(" ")?i.splice(10,0,{text:"Resize selected rows",iconCss:"",id:t+"resizerows"}):u>1?i.splice(10,0,{text:"Resize rows "+(r[0]+1)+" - "+(r[2]+1),iconCss:"",id:t+"resizerows"}):i.splice(10,0,{text:"Resize row ",iconCss:"",id:t+"resizerow"})):i.splice(5,0,{text:"Insert "+u+" row"+(u>1?"s":""),iconCss:"",id:t+"insertrow"});i.splice(i.length-1,0,{text:"Clear row"+(u>1?"s":""),iconCss:"",id:t+"deletevalue"});i.push({separator:!0});i.push({text:"Validations",iconCss:"",id:t+"datvalidation",items:v});break;case"Footer":i[0].id=this.ssObj.element.id+"_cmenu_biz_insert";i.push({text:"Copy to",iconCss:"",id:t+"copyto",items:[{text:"New Spreadsheet",iconCss:"",id:t+"newspreadsheet"},{text:"Existing Spreadsheet",iconCss:"",id:t+"existingspreadsheet"}]});i.push({text:"Change Color",iconCss:"",id:t+"changecolor",items:[{id:t+"colorpallet"}]})}if(e.length&&(y.items=i,y.dataBind(),e==="footer",e==="Content"),n.items&&n.items[0]&&n.items[0].id==t+"colorpallet"){document.getElementById(t+"colorpallet").appendChild(this.changecolor);n.element.style.height="225px";let i=window.innerHeight-400;n.element.style.top=n.element.style.top+i+"px";n.element.style.borderRadius="5px"}}tabSelected(){this.updateSheetIcon()}colourpicker(){var u;this.changecolor=document.createElement("div");this.changecolor.setAttribute("id","changecolor_"+this.FileId);document.body.appendChild(this.changecolor);this.ModalHtml=` <div id ="colorpalettecointiner"><div class='list-group' id='colourpalette'><button id="biz-ss-colorpalletreset" style="border: none;text-align: left;font-weight: 400;padding: 0px;cursor: pointer;" onclick="Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().sheetColorChange('0')"><span><i class="la la-tint-slash"></i></span>Reset</button></div></div>`;$("#changecolor_"+this.FileId).html(this.ModalHtml);var t=["000000","434343","666666","999999","b7b7b7","cccccc","d9d9d9","efefef","f3f3f3","ffffff","980000","ff0000","ff9900","ffff00","00ff00","00ffff","4a86e8","0000ff","9900ff","ff00ff","e6b8af","f4cccc","fce5cd","fff2cc","d9ead3","d0e0e3","c9daf8","cfe2f3","d9d2e9","ead1dc","dd7e6b","ea9999","f9cb9c","ffe599","b6d7a8","a2c4c9","a4c2f4","9fc5e8","b4a7d6","d5a6bd","cc4125","e06666","f6b26b","ffd966","93c47d","76a5af","6d9eeb","6fa8dc","8e7cc3","c27ba0","a61c00","cc0000","e69138","f1c232","6aa84f","45818e","3c78d8","3d85c6","674ea7","a64d79","85200c","990000","b45f06","bf9000","38761d","134f5c","1155cc","0b5394","351c75","741b47","5b0f00","660000","783f04","7f6000","274e13","0c343d","1c4587","073763","20124d","4c1130",],n=0,i="",r="";for(let f=0;f<8;f++){i=`<div id="biz-ss-colorpallet-`+f+`" class="list-group" style="display: flex;flex-direction: row;">`;$("#colourpalette").append(i);u=10;let e=0;for(e;e<u;e++)r=`<span class="colorpalettegrid border rounded-circle" role="gridcell" id="id_`+t[n]+`" aria-label="`+t[n]+`" style="background-color:#`+t[n]+`;width: 20px;height: 20px;"" onclick="Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().sheetColorChange('`+t[n]+`')"></span>`,$("#biz-ss-colorpallet-"+f).append(r),n++;$("#biz-ss-colorpallet-"+f).append("<\/div>")}}updatePadding(n){let t=this.ssObj.element.querySelector(".e-sheet-tab").querySelector(".biz-dd-active");if(t){let i=t.parentElement;n?i.classList.add("biz-dd-parent"):i.classList.remove("biz-dd-parent")}}updateSheetIcon(){let t=this.ssObj.sheets,i=this.ssObj.getActiveSheet(),n=this.ssObj.element.querySelector(".e-sheet-tab").querySelectorAll(".e-text-wrap");for(let r=0;r<t.length;r++){if(n[r]&&!n[r].querySelectorAll(".biz-dd-wrap").length){let t=ej.base.createElement("div",{className:"biz-dd-wrap"}),i=ej.base.createElement("span",{className:"e-icons biz-dd-icon"});t.appendChild(i);n[r].appendChild(t)}let t=n[r].querySelector(".biz-dd-wrap");t.classList.remove("biz-dd-active");i.name===n[r].querySelector(".e-tab-text").innerText&&t.classList.add("biz-dd-active")}}dataBound(){this.isInitial&&(this.reqCount++,this.reqCount==2&&(this.isInitial=!1));setTimeout(()=>{this.ssObj.sheetTabsModule.refreshSheetTab(),this.sheetColorRender()},50);this.updateSheetIcon();this.formatpainter.updateEdgesOnBound()}actionBegin(n){if(this.prevFormulaRange="",this.formulaActiveCell="",this.isFormula=!1,n.action==="filter")this.sortingBtn=document.getElementById("DocumentViewer_sorting"),this.sortingBtn.firstElementChild.style.color="rgb(12 143 11)";else if(n.action==="renameSheet"){let n=this.ssObj.element.querySelector(".e-sheet-tab").querySelector(".biz-dd-active");this.updatePadding(!0);n.remove()}else if(n.action==="beforeInsertImage"){var t=this.ssObj.biz.getIndexes();let n=this.ssObj.biz.getActiveSheet();this.oldCellInfo=Object.assign({},ej.spreadsheet.getCell(t[0],t[1],n))}else n.action==="clipboard"&&n.args&&n.args.eventArgs&&n.args.eventArgs.copiedInfo&&n.args.eventArgs.copiedInfo.isCut&&this.removeInCellImage(n.args.eventArgs.pastedRange)}actionComplete(t){var r,i;if(this.prevFormulaRange="",this.formulaActiveCell="",t.action==="cellSave"&&(this.f2Edit=!1,this.isFormula=!1),t.eventArgs&&t.eventArgs.modelType&&(t.eventArgs.modelType=="Sheet"||t.eventArgs.modelType=="Row"||t.eventArgs.modelType=="Column")&&(t.action=="insert"||t.action=="delete")&&(t.eventArgs.sheet=[],this.focusDocumentViewer()),t.action=="resizeToFit"&&(this.ribbon.imageInCell=!0),t.action!=="import"&&n.Apps.Collaboration.Components.Documents.Instance()._openedfile.signalrData!=JSON.stringify(t)){r=(window.navigator.onLine?"on":"off")+"line";window.addEventListener("online",()=>document.getElementsByClassName("biz-ss-cloudsave")[0].style.display="inline-block");window.addEventListener("online",()=>document.getElementsByClassName("biz-ss-cloudoff")[0].style.display="none");window.addEventListener("offline",()=>document.getElementsByClassName("biz-ss-cloudsave")[0].style.display="none");window.addEventListener("offline",()=>document.getElementsByClassName("biz-ss-cloudoff")[0].style.display="inline-block");try{n.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().invoke("ChangeDoc",n.Apps.Collaboration.Components.Sheets.Base.Instance().FileId,JSON.stringify(t))}catch(u){}}if(t.eventArgs&&t.eventArgs.modelType&&t.eventArgs.modelType=="Row"&&t.action=="delete"&&this.removeInCellImage("",[t.eventArgs.startIndex,0,t.eventArgs.endIndex,this.ssObj.biz.getActiveSheet().usedRange.colIndex]),t.eventArgs&&t.eventArgs.modelType&&t.eventArgs.modelType=="Column"&&t.action=="delete"&&this.removeInCellImage("",[0,t.eventArgs.startIndex,this.ssObj.biz.getActiveSheet().usedRange.rowIndex,t.eventArgs.endIndex]),t.action==="renameSheet"&&(this.updateSheetIcon(),this.updatePadding(!1),this.sheetColorRender()),t.action==="moveSheet"&&(this.ssObj.sheets[t.position].index=t.position,this.ssObj.sheets[t.sheetIndexes[0]].index=t.sheetIndexes[0],i={FileId:this.FileId,PreviousSheetIndex:t.sheetIndexes[0],PresentSheetIndex:t.position},n.Apps.Collaboration.DocumentManager.Instance().updateSheetColorIndex(i).then(n=>{this.customresult=n.result,this.sheetColorRender()}),this.focusDocumentViewer()),t.action==="insert"&&(t.eventArgs.insertType==="Row"&&this.ssObj.insertRow(t.eventArgs.index,t.eventArgs.index),t.eventArgs.insertType==="Column"&&this.ssObj.insertColumn([{index:t.eventArgs.index,width:95}],t.eventArgs.index)),t.action=="insertImage"&&this.actionInsertImage(t),t.action==="imageRefresh"&&t&&t.eventArgs&&t.eventArgs.id&&this.imageRefresh(t),t.action!=="resize"||this.isResizing||(this.resizeImagesOnActionResize(t),this.isResizing=!0,this.adjustRowsAndColumnWidth(t),this.isResizing=!1),t.action==="cellDelete"&&this.removeInCellImage(t.eventArgs.address.split("!")[1]),t.action==="format"&&setTimeout(()=>{this.setIncellImageHeightOnFontChange(t)},100),t.action==="resize"||t.action==="format"&&t.eventArgs.style&&t.eventArgs.style.fontSize)if(t.eventArgs.isCol){let n=parseInt(t.eventArgs.width)-parseInt(t.eventArgs.oldWidth);this.formatpainter.refreshEdges(!1,undefined,t.eventArgs.index,n)}else if(t.eventArgs.isCol===!1){let n=parseInt(t.eventArgs.height)-parseInt(t.eventArgs.oldHeight);this.formatpainter.refreshEdges(!1,t.eventArgs.index,undefined,n)}else this.formatpainter.refreshEdges(!1);t.action==="clipboard"&&(this.removeCopyIndicator(),this.clipboardBizImages(t),t.eventArgs&&t.eventArgs.copiedInfo&&t.eventArgs.copiedInfo.isCut&&this.removeInCellImage(t.eventArgs.pastedRange.split("!")[1]));t.action==="gotoSheet"&&(this.sortingBtn=document.getElementById("DocumentViewer_sorting"),this.sortingBtn.firstElementChild.style.color="",this.ssObj.filterCollection&&this.ssObj.filterCollection.find(n=>n.sheetIndex===t.eventArgs.currentSheetIndex)&&(this.sortingBtn.firstElementChild.style.color="rgb(12 143 11)"),setTimeout(()=>{this.addImageClassToAllImages()},1e3),this.focusDocumentViewer());t.action!=="filter"||this.isInitial||this.updateFilters(t);t.action=="import"&&this.updateFilterIcon();this.removeCopyIndicator();t.action=="gotoSheet"&&setTimeout(()=>{this.addImageClassToAllImages()},1e3);this.ribbon.imageInCell?this.ribbon.imageInCell=!1:this.autoSave(t)}updateFilterIcon(){setTimeout(()=>{this.sortingBtn=document.getElementById("DocumentViewer_sorting"),this.sortingBtn.firstElementChild.style.color=this.ssObj.filterModule.filterCollection.has(this.getSheetIndex())?"rgb(12 143 11)":""})}focusDocumentViewer(){setTimeout(()=>{document.getElementById("DocumentViewer").focus()},100)}removeInCellImage(n,t){var r,u;let i;i=t?t:ej.spreadsheet.getIndexesFromAddress(n);let f=this.ssObj.biz.getActiveSheet(),e=this.setSheetNameForInCell(f.name);for(r=i[0];r<=i[2];r++)for(u=i[1];u<=i[3];u++){let t=e+"_"+r+"_"+u,n=ej.spreadsheet.getCell(r,u,f);if(n&&n.image&&n.image[0]&&n.image[0].id.startsWith("biz_image_in_cell")){let t=document.getElementById(n.image[0].id);t&&t.remove()}else if(document.querySelector(`[id$= ${t}]`)){let n=document.querySelector(`[id$= ${t}]`);n&&n.remove()}}}removeCopyIndicator(){document.getElementsByClassName("e-copy-indicator")[0]&&(document.getElementsByClassName("e-copy-indicator")[0].style.display="none");document.getElementsByClassName("e-formularef-indicator")[0]&&document.getElementsByClassName("e-formularef-indicator")[0].remove()}updateFilters(n){var i,r;this.ribbon.imageInCell=!0;let t=this.getSheetIndex();if(n.eventArgs.filterOptions){let i={sheetIdx:t,column:[],criteria:[],dataType:[],filterRange:n.eventArgs.range,hasFilter:!0,predicates:[],value:[]};this.download.ssAutoSave({action:"applyFilter",collection:i},this,!0)}else if(n.eventArgs.predicates){let u=n.eventArgs.predicates.map(n=>n.field),f={sheetIdx:t,column:u.map(this.lettersToNumber),criteria:n.eventArgs.predicates.map(n=>n.operator),dataType:n.eventArgs.predicates.map(n=>n.type),filterRange:n.eventArgs.range,hasFilter:!0,predicates:n.eventArgs.predicates.map(n=>n.predicate),value:n.eventArgs.predicates.map(n=>n.value)};if(this.download.ssAutoSave({action:"updateFilter",collection:f},this,!0),this.ssObj.sheets[t]&&this.ssObj.sheets[t].rows)for(i=0;i<this.ssObj.sheets[t].rows.length;i++)if(this.ssObj.sheets[t].rows[i]&&this.ssObj.sheets[t].rows[i].hidden&&this.ssObj.sheets[t].rows[i].cells){for(r=0;r<this.ssObj.sheets[t].rows[i].cells.length;r++)if(this.ssObj.sheets[t].rows[i].cells[r]&&this.ssObj.sheets[t].rows[i].cells[r].image&&this.ssObj.sheets[t].rows[i].cells[r].image[0]&&this.ssObj.sheets[t].rows[i].cells[r].image[0].id.startsWith("biz_image_in_cell")){let n=document.getElementById(this.ssObj.sheets[t].rows[i].cells[r].image[0].id);n&&(n.style.display="none")}}else if(this.ssObj.sheets[t].rows[i].cells)for(r=0;r<this.ssObj.sheets[t].rows[i].cells.length;r++)if(this.ssObj.sheets[t].rows[i].cells[r]&&this.ssObj.sheets[t].rows[i].cells[r].image&&this.ssObj.sheets[t].rows[i].cells[r].image[0]&&this.ssObj.sheets[t].rows[i].cells[r].image[0].id.startsWith("biz_image_in_cell")){let n=document.getElementById(this.ssObj.sheets[t].rows[i].cells[r].image[0].id);n.style.display=""}}else if(!n.eventArgs.filterOptions&&!n.eventArgs.predicates){if(this.ssObj.sheets[t]&&this.ssObj.sheets[t].rows)for(i=0;i<this.ssObj.sheets[t].rows.length;i++)if(this.ssObj.sheets[t].rows[i]&&this.ssObj.sheets[t].rows[i].hidden&&this.ssObj.sheets[t].rows[i].hidden==!1&&this.ssObj.sheets[t].rows[i].cells)for(r=0;r<this.ssObj.sheets[t].rows[i].cells.length;r++)if(this.ssObj.sheets[t].rows[i].cells[r]&&this.ssObj.sheets[t].rows[i].cells[r].image&&this.ssObj.sheets[t].rows[i].cells[r].image[0]&&this.ssObj.sheets[t].rows[i].cells[r].image[0].id.startsWith("biz_image_in_cell")){let n=document.getElementById(this.ssObj.sheets[t].rows[i].cells[r].image[0].id);n.style.display=""}this.download.ssAutoSave({action:"removeFilter",sheetIndex:this.getSheetIndex()},this,!0)}}setIncellImageHeightOnFontChange(n){if(n.eventArgs&&n.eventArgs.style&&n.eventArgs.style.fontSize){let i=this.ssObj.biz.getIndexes(),o=this.getSheetIndex(),n=this.ssObj.biz.getActiveSheet(),f=this.ssObj.frozenRowCount(n),e=this.ssObj.frozenColCount(n),r=[],u=[];if(n.rows[i[0]].cells){let u=[];for(var t=i[0];t<=i[2];t++)u=u.concat(n.rows[t].cells.filter(n=>n&&n.image).map(n=>n&&n.image[0]));u.forEach(t=>{if((t&&t.id&&t.id).startsWith("biz_image_in_cell")){let i=Number(t.id.split("_")[5]),s=Number(t.id.split("_")[6]),h=this.ssObj.sheets[o].rows[i].height||19,c=ej.spreadsheet.getCellPosition(n,[i,s],f,e);document.getElementById(t.id)&&(document.getElementById(t.id).style.top=c.top+"px",document.getElementById(t.id).style.height=h+"px");let u=ej.spreadsheet.getCell(i,s,n);u.image[0].height=h-2;this.setImageSize("top",u.image[0]);this.setImageSize("left",u.image[0]);r.push({row:i,cell:s,cellinfo:u})}})}for(let t=i[2]+1;t<n.rows.length;t++){let i=n.rows[t]&&n.rows[t].cells&&n.rows[t].cells.filter(n=>n&&n.image).map(n=>n&&n.image[0]);i&&(u=u.concat(i))}u.forEach(t=>{if((t&&t.id&&t.id).startsWith("biz_image_in_cell")){let u=parseInt(t.id.split("_")[5]),o=parseInt(t.id.split("_")[6]),i=ej.spreadsheet.getCell(u,o,n),s=ej.spreadsheet.getCellPosition(n,[u,o],f,e);document.getElementById(t.id)&&(document.getElementById(t.id).style.top=s.top+"px");i.image[0].top=s.top;this.setImageSize("top",i.image[0]);this.setImageSize("left",i.image[0]);r.push({row:u,cell:o,cellinfo:i})}});this.ribbon.imageInCell=!0;r.length>0&&this.download.ssAutoSave({action:"imageincell",changedValues:r},this,!0)}}setColumnIncellImageSize(n){var t,i;let r=this.ssObj.biz.getActiveSheet(),u=[],f=this.swapRange(ej.spreadsheet.getIndexesFromAddress(n));for(t=0;t<=r.usedRange.rowIndex;t++)for(i=f[1];i<=r.usedRange.colIndex;i++)u=u.concat(this.performImageResize(r,t,i));return u}setRowIncellImageSize(n){var t,i;let r=this.ssObj.biz.getActiveSheet(),u=[],f=this.swapRange(ej.spreadsheet.getIndexesFromAddress(n));for(t=f[0];t<=r.usedRange.rowIndex;t++)for(i=0;i<=r.usedRange.colIndex;i++)u=u.concat(this.performImageResize(r,t,i));return u}performImageResize(n,t,i){let u=[],r=ej.spreadsheet.getCell(t,i,n);if(r&&r.image&&r.image.find(n=>n.id.startsWith("biz_image_in_cell"))){let f=r.image.find(n=>n.id.startsWith("biz_image_in_cell")),h=r.image.indexOf(f),o=(n.rows[t].height||19)-2,s=(n.columns[i].width||64)-1,e=ej.spreadsheet.getCellPosition(n,[t,i],n.frozenRows,n.frozenColumns);document.getElementById(f.id)&&(document.getElementById(f.id).style.top=e.top+"px",document.getElementById(f.id).style.left=e.left+"px",document.getElementById(f.id).style.height=o+"px",document.getElementById(f.id).style.width=s+"px");r.image[0].top=e.top;r.image[0].left=e.left;r.image[0].height=o;r.image[0].width=s;this.setImageSize("top",r.image[0]);this.setImageSize("left",r.image[0]);u.push({row:t,cell:i,cellinfo:r})}return u}imageRefresh(n){let i=this.ssObj.getActiveSheet(),o=n.eventArgs.id.split("_"),r=n.eventArgs.currentRowIdx,u=n.eventArgs.currentColIdx,t=ej.spreadsheet.getCell(r,u,i),f=this.setSheetNameForInCell(i.name),e=t.image.find(t=>t.id==n.eventArgs.id);if(t&&t.image&&e){let c;if(e.id.includes(f))for(var s=0;s<3;s++)o.pop();else if(!e.id.includes(f)&&i.pictures){let t=i.pictures.findIndex(t=>t.imageId==n.eventArgs.id);t!=-1&&i.pictures.splice(t,1)}c=o.join("_")+"_"+f+"_"+r+"_"+u;let h=document.getElementById(n.eventArgs.id);h&&(h.id=c);t.image[0].id=c;t.image[0].left=n.eventArgs.currentLeft;t.image[0].top=n.eventArgs.currentTop;t.image[0].height=parseInt(h.style.height);t.image[0].width=parseInt(h.style.width);this.setImageSize("top",t.image[0]);this.setImageSize("left",t.image[0]);this.setImageSize("height",t.image[0]);this.setImageSize("width",t.image[0]);let l=[{row:n.eventArgs.prevRowIdx,cell:n.eventArgs.prevColIdx,cellInfo:ej.spreadsheet.getCell(n.eventArgs.prevRowIdx,n.eventArgs.prevColIdx,i)},{row:r,cell:u,cellInfo:t}];this.ribbon.imageInCell=!0;l.length>0&&this.download.ssAutoSave({action:"imageRefresh",changedValues:l},this,!0)}}clipboardBizImages(n){var i,r,t;let e,s=this.getSheetIndex(),u=this.ssObj.biz.getActiveSheet(),h=this.ssObj.frozenRowCount(u),c=this.ssObj.frozenColCount(u),o=[],f;for(f=n.action=="cellDrag"?n.pastedCellIdxs:this.ssObj.biz.getIndexes(n.eventArgs.pastedRange.split("!")[1]),i=f[0];i<=f[2];i++)for(r=f[1];r<=f[3];r++){let f=ej.spreadsheet.getCell(i,r,u);if(e=this.setSheetNameForInCell(u.name),f&&f.image&&f.image[0].id.startsWith("biz_image_in_cell_")){let a=ej.spreadsheet.getCellPosition(u,[i,r],h,c),l=f.image[0],v,y;if(v=(this.ssObj.sheets[s].rows[i].height||19)-1,y=(this.ssObj.sheets[s].columns[r].width||64)-1,n.eventArgs.copiedInfo.isCut){let n=document.getElementById(f.image[0].id);l.id="biz_image_in_cell_"+e+"_"+i+"_"+r;n.id=l.id;n.style.height=v+"px";n.style.width=y+"px";n.style.top=a.top+"px";n.style.left=a.left+"px"}else{let n=document.getElementById(f.image[0].id);t=document.createElement("div");t.id="biz_image_in_cell_"+e+"_"+i+"_"+r;t.style.top=a.top+"px";t.style.left=a.left+"px";t.style.height=v+"px";t.style.width=y+"px";t.style.backgroundImage="url("+f.image[0].src+")";t.classList.add("e-ss-overlay");t.classList.add("biz_image_in_cell");n.after(t);l.id=t.id}l.left=a.left;l.top=a.top;l.width=y;l.height=v;this.setImageSize("top",l);this.setImageSize("left",l);f.image[0]=l;o.push({row:i,cell:r,cellinfo:f});this.ribbon.imageInCell=!0}}o.length>0&&this.download.ssAutoSave({action:"imageincell",changedValues:o},this,!0)}actionInsertImage(n){let f=n.sheetIndex?n.sheetIndex:this.getSheetIndex();var t=n.indexes?n.indexes:this.ssObj.biz.getIndexes();let e=this.ssObj.biz.getActiveSheet(),i=n.cellInfo?n.cellInfo:ej.spreadsheet.getCell(t[0],t[1],e);if(n.origin=="biz"){this.ssObj.biz.setCell(t[0],t[1],e,i);this.download.ssAutoSave({action:"imageincell",changedValues:[{row:t[0],cell:t[1],cellinfo:i}]},this,!0);return}let o=this.setSheetNameForInCell(e.name),r=i.image.find(t=>t.id==n.eventArgs.id),u=document.getElementById(n.eventArgs.id);if(this.ribbon.imageInCell){if(i.image&&i.image.find(n=>n.id.startsWith("biz_image_in_cell"))){let n=i.image.find(n=>n.id.startsWith("biz_image_in_cell"));document.getElementById(n.id).remove();let t=i.image.indexOf(n);~t&&i.image.splice(t,1)}r.id="biz_image_in_cell_"+o+"_"+t[0]+"_"+t[1];let n,e;n=(this.ssObj.sheets[f].rows[t[0]].height||19)-1;u.style.height=n+"px";r.height=n;e=(this.ssObj.sheets[f].columns[t[1]].width||64)-1;u.style.width=e+"px";r.width=e;i.value="";u.classList.add("biz_image_in_cell")}else r.id="spreadsheet_overlay_picture_"+o+"_"+t[0]+"_"+t[1];this.setImageSize("top",r);this.setImageSize("left",r);u.id=r.id;i.image[i.image.length-1]=r;this.download.ssAutoSave({action:"imageincell",changedValues:[{row:t[0],cell:t[1],cellinfo:i}]},this,!0);let s={indexes:t,range:this.ssObj.biz.getRange(),cellInfo:i,action:"insertimage",origin:"biz",sheetIndex:f};this.ribbon.imageInCell&&this.ssObj.updateUndoRedoCollection({name:"bizAction",args:{action:"bizImageInCell",options:s,oldCells:this.oldCellInfo}});this.oldCellInfo={};this.ribbon.imageInCell=!0;this.bizSignalr(s);setTimeout(()=>{const n=this.ssObj.undoredoModule.undoCollection.indexOf(this.ssObj.undoredoModule.undoCollection.filter(n=>n.name=="bizAction").pop());this.ssObj.undoredoModule.undoCollection.splice(n+1,1)},500)}setImageSize(n,t){t[n]=t[n]%1!=0?parseInt(t[n].toString().split(".")[1])<50?parseInt(t[n].toString().split(".")[0]):parseInt(t[n].toString().split(".")[0])+1:parseInt(t[n])}resizeImagesOnActionResize(n){var r,t;let i=this.ssObj.biz.getActiveSheet();if(n.eventArgs.isCol){if(i.rows&&i.rows.length>0){let u=[],f=i.rows.length;for(t=0;t<f;t++){let r=ej.spreadsheet.getCell(t,n.eventArgs.index,i);r&&r.image&&r.image.length>0&&r.image[0].id.startsWith("biz_image_in_cell")&&(document.getElementById(r.image[0].id).style.width=n.eventArgs.width,r.image[0].width=parseInt(n.eventArgs.width),u.push({row:t,cell:n.eventArgs.index,cellinfo:r}))}for(t=0;t<f;t++)for(r=n.eventArgs.index+1;r<i.columns.length;r++){let f=ej.spreadsheet.getCell(t,r,i);if(f&&f.image&&f.image.length>0&&f.image[0].id.startsWith("biz_image_in_cell")){let s=f.image[0].left,i=Number(n.eventArgs.width.split("p")[0])-Number(n.eventArgs.oldWidth.split("p")[0]),e=parseInt(i.toString().split(".")[0]);i%1!=0&&parseInt(i.toString().split(".")[1])>50&&(Math.sign(i)===-1?i=e-1:Math.sign(i)===1&&(i=e+1));let o=s+i;document.getElementById(f.image[0].id)&&(document.getElementById(f.image[0].id).style.left=o+"px");f.image[0].left=o;u.push({row:t,cell:r,cellinfo:f})}}u.length>0&&this.download.ssAutoSave({action:"imageincell",changedValues:u},this,!0)}}else{let r=[],u=[];if(i.rows[n.eventArgs.index]&&i.rows[n.eventArgs.index].cells){let t=i.rows[n.eventArgs.index].cells.filter(n=>n&&n.image).map(n=>n&&n.image[0]);t.forEach(t=>{if((t&&t.id&&t.id).startsWith("biz_image_in_cell")){document.getElementById(t.id).style.height=parseInt(n.eventArgs.height)-2+"px";let u=parseInt(t.id.split("_")[6]),f=n.eventArgs.index,e=ej.spreadsheet.getCell(f,u,i);e.image[0].height=parseInt(n.eventArgs.height)-2;r.push({row:f,cell:u,cellinfo:e})}})}for(t=parseInt(n.eventArgs.index)+1;t<i.rows.length;t++){let n=i.rows[t]&&i.rows[t].cells&&i.rows[t].cells.filter(n=>n&&n.image).map(n=>n&&n.image[0]);n&&(u=u.concat(n))}u.forEach(t=>{if((t&&t.id&&t.id).startsWith("biz_image_in_cell")){let e=parseInt(t.id.split("_")[5]),o=parseInt(t.id.split("_")[6]),f=ej.spreadsheet.getCell(e,o,i),c=f.image[0].top,u=Number(n.eventArgs.height.split("p")[0])-Number(n.eventArgs.oldHeight.split("p")[0]),s=parseInt(u.toString().split(".")[0]);u%1!=0&&parseInt(u.toString().split(".")[1])>50&&(Math.sign(u)===-1?u=s-1:Math.sign(u)===1&&(u=s+1));let h=c+u;document.getElementById(t.id)&&(document.getElementById(t.id).style.top=h+"px");f.image[0].top=h;r.push({row:e,cell:o,cellinfo:f})}});r.length>0&&this.download.ssAutoSave({action:"imageincell",changedValues:r},this,!0)}}addImageClassToAllImages(){let n=document.querySelectorAll("[id^=biz_image_in_cell]");n.forEach(n=>n.classList.add("biz_image_in_cell"))}bizSignalr(t){var i=(window.navigator.onLine?"on":"off")+"line";window.addEventListener("online",()=>document.getElementsByClassName("biz-ss-cloudsave")[0].style.display="inline-block");window.addEventListener("online",()=>document.getElementsByClassName("biz-ss-cloudoff")[0].style.display="none");window.addEventListener("offline",()=>document.getElementsByClassName("biz-ss-cloudsave")[0].style.display="none");window.addEventListener("offline",()=>document.getElementsByClassName("biz-ss-cloudoff")[0].style.display="inline-block");try{n.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().invoke("ChangeDoc",n.Apps.Collaboration.Components.Sheets.Base.Instance().FileId,JSON.stringify(t))}catch(r){}}refreshHeight(){var n=this.element.parentElement.parentElement.offsetHeight,t=this.ribbonElem.offsetHeight;this.element.parentElement.style.height=n-t+"px"}adjustRowsAndColumnWidth(n){return __awaiter(this,void 0,void 0,function*(){var t,u,f,e,r,o,i;let s=this.ssObj.getActiveSheet().selectedRange;if(t=n.indexes!=null?n.indexes:this.ssObj.biz.getIndexes(),n.undo){let t=n.eventArgs.range[0],i=n.eventArgs.range[1],r=n.eventArgs.range[2],u=n.eventArgs.range[3];if(n.eventArgs.width)for(let t=i;t<=u;t++)yield this.dialogue.setColWidth(n.eventArgs.width[t].width,t);if(n.eventArgs.height)for(let i=t;i<=r;i++)yield this.dialogue.setRowHeight(n.eventArgs.height[i].height,i)}else if(s.includes(" ")||t[3]-t[1]>0||t[2]-t[0]>0){n.eventArgs.width&&(u="Column",f=n.eventArgs.width,e=this.ssObj.getActiveSheet().columns,r=n.eventArgs.width.replace(/[^0-9]/g,""),parseInt(r)<=30&&(n.eventArgs.width="30px"));n.eventArgs.height&&(u="Row",f=n.eventArgs.height,e=this.ssObj.getActiveSheet().rows,r=n.eventArgs.height.replace(/[^0-9]/g,""),parseInt(r)<=21&&(n.eventArgs.height="21px"));this.ssObj.updateUndoRedoCollection({name:"bizAction",args:{action:"resize",eventArgs:{index:n.eventArgs.index,newSize:f,type:u,sheetIdx:n.eventArgs.sheetIdx,oldSize:e,range:t}}});o=s.split(" ");for(let r=0;r<o.length;r++){i=ej.spreadsheet.getIndexesFromAddress(o[r]);let u=i[0],f=i[1],e=i[2],s=i[3];if(n.eventArgs.width)for(let t=f;t<=s;t++)yield this.dialogue.setColWidth(n.eventArgs.width,t);if(n.eventArgs.height)for(let t=u;t<=e;t++)yield this.dialogue.setRowHeight(n.eventArgs.height,t);n.indexes||(n.origin="biz",n.indexes=t,this.bizSignalr(n),this.autoSave(n))}this.ribbon.imageInCell=!0;setTimeout(()=>{const n=this.ssObj.undoredoModule.undoCollection.indexOf(this.ssObj.undoredoModule.undoCollection.filter(n=>n.name=="bizAction").pop());this.ssObj.undoredoModule.undoCollection.splice(n+1,1)},500)}})}fileNameChange(){var t=$(".biz-ss-filename").val(),i={Title:t,Id:this.FileId,Type:"File"};n.Apps.Collaboration.DocumentManager.Instance().renameFileTitle(i)}renderPopup(t){n.Apps.Collaboration.Components.Documents.Instance().loadForm(0,this.FileId,0,t,this.documentGroup)}renderMenuBar(){let i=document.body.getElementsByClassName("_bizgaze_popup_container");this.container=i[i.length-1];this.container.insertBefore(this.util.createElement("div","class","biz-ss-ribbon"),this.container.firstElementChild);this.util.appendChildren("DocumentViewer",0);this.util.appendChildren("biz-ss-ribbon",0,this.util.createElement("div","class","biz-ss-sheetlogo"),this.util.createElement("div","class","biz-ss-tooolbar"),this.util.createElement("div","class","biz-ss-userdetails e-ribbon e-collapsed"),this.util.createElement("div","class","biz-ss-username-wrapper"));this.util.appendChildren("biz-ss-sheetlogo",0,this.util.createElement("img","class","biz-ss-logo"));this.util.appendChildren("biz-ss-tooolbar",0,this.util.createElement("div","class","biz-ss-fileinfo"),this.util.createElement("div","class","biz-ss-fileshare-wrapper"),this.util.createElement("div","class","biz-ss-onlineusers"),this.util.createElement("div","class","biz-ss-toolbarmenu"));this.util.appendChildren("biz-ss-fileshare-wrapper",0,this.util.createElement("div","class","biz-ss-fileshare"));this.util.appendChildren("biz-ss-onlineusers",0,this.util.createElement("div","class","biz-ss-onlineusersintials d-flex flex-row text-white mx-35 pull-right"));this.util.appendChildren("biz-ss-fileshare",0,this.util.createElement("button","class","biz-ss-fileshare-btn"));this.util.appendChildren("biz-ss-fileinfo",0,this.util.createElement("input","class","biz-ss-filename"),this.util.createElement("div","class","biz-ss-starred"),this.util.createElement("div","class","biz-ss-autosave"));this.util.appendChildren("biz-ss-starred",0,this.util.createElement("span","id","biz-ss-star"),this.util.createElement("i","class","fa fa-star-o text-light font-7 biz_ss_star_icon_"+this.FileId));this.util.appendChildren("biz-ss-autosave",0,this.util.createElement("img","class","biz-ss-saveicon biz-ss-cloudsave"),this.util.createElement("img","class","biz-ss-saveicon biz-ss-cloudoff"),this.util.createElement("div","class","biz-ss-cloudloading e-icons"),this.util.createElement("div","class","biz-ss-saving"));this.util.appendChildren("biz-ss-userdetails",0,this.util.createElement("div","class","biz-ss-userinitial"));this.util.appendChildren("biz-ss-toolbarmenu",0,this.util.createElement("ul","id","menu"),this.util.createElement("input","class","biz-ss-lastedited"));document.getElementsByClassName("biz-ss-logo")[0].setAttribute("src","imgs/BizgazeSheetsIcon.svg");document.getElementsByClassName("biz-ss-cloudsave")[0].setAttribute("src","imgs/cloud-computing.svg");document.getElementsByClassName("biz-ss-cloudsave")[0].setAttribute("title","See document status");document.getElementsByClassName("biz-ss-cloudoff")[0].setAttribute("src","imgs/cloud-off.svg");document.getElementsByClassName("biz-ss-cloudoff")[0].style.display="none";let r=document.getElementsByClassName("biz-ss-filename")[0];this.util.addAttributes(r,{value:this.FileName,type:"text"});this.userInitial=document.getElementsByClassName("biz-ss-userinitial")[0];let t=n.Platform.Membership.Infos.Identity.getCurrentUser();if(t.photoUrl?(this.userInitial.classList.add("biz-ss-initial-img"),this.userInitial.style.backgroundImage="url("+t.photoUrl+")"):(this.userInitial.textContent+=t.name.trim().slice(0,1),this.userInitial.classList.add("biz-ss-initial-text")),!this.newUpload)if(this.lastEditedTime!=0)if(this.unibaseusername===this.username){let n=document.getElementsByClassName("biz-ss-lastedited")[0];this.util.addAttributes(n,{value:"last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago",type:"span"})}else{let n=document.getElementsByClassName("biz-ss-lastedited")[0];this.util.addAttributes(n,{value:"last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago by "+this.username,type:"span"})}else if(this.unibaseusername===this.username){let n=document.getElementsByClassName("biz-ss-lastedited")[0];this.util.addAttributes(n,{value:"last edit was made seconds ago ",type:"span"})}else{let n=document.getElementsByClassName("biz-ss-lastedited")[0];this.util.addAttributes(n,{value:"last edit was made seconds ago by "+this.username,type:"span"})}let u=document.getElementsByClassName("biz-ss-saving")[0];this.util.addAttributes(u,{type:"span"});document.getElementsByClassName("biz-ss-lastedited")[0].setAttribute("disabled","");document.getElementsByClassName("biz-ss-saving")[0].style.display="none";document.getElementsByClassName("biz-ss-saving")[0].innerText="Saving...";document.getElementsByClassName("biz-ss-fileshare-btn")[0].style.backgroundColor="#049503";var f=new ej.buttons.Button({cssClass:`e-primary`,content:`Share`,iconCss:"biz-ss-fileshare-icon icon-ss-lockopen"});f.appendTo(".biz-ss-fileshare-btn");document.getElementsByClassName("biz-ss-userinitial")[0].setAttribute("title",t.name.trim());let e=this.util.colorHash(t.name.trim());document.getElementsByClassName("biz-ss-userinitial")[0].style.backgroundColor=e.hex;this.ribbonElem=document.body.getElementsByClassName("biz-ss-ribbon")[0]}editDetails(){this.FileId!=0&&n.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then(t=>{if(this.identity=n.Platform.Membership.Infos.Identity.getCurrentUser(),this.unibaseusername=this.identity.name,this.lastEditedTime=t.result.Lastedittime,this.username=t.result.LastUpdatedByName,this.timePeriod=t.result.TimePeriod,this.unibaseusername===this.username&&this.lastEditedTime===0){let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made seconds ago"}else if(this.unibaseusername===this.username&&this.lastEditedTime!==0){let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made "+this.lastEditedTime+" "+this.timePeriod+" ago"}else{let n=document.getElementsByClassName("biz-ss-lastedited")[0];n.value="last edit was made seconds ago by "+this.username}});clearInterval(this.intr);clearInterval(this.intrhour);this.initSetInterval()}windowKeydown(n){n.keyCode===116&&this.fileurl&&(window.location.href=window.origin+"#/documents/"+this.fileurl+"/Excel/0");this.ctrl_Shift_S(n)}keyDown(t){var h,c,v;let f=this.ssObj.biz.getActiveSheet(),l=this.ssObj.biz.getIndexes(),s=document.getElementById("DocumentViewer_edit");this.lastKeyEvent=t;this.cellRowStart=l[0];this.cellColStart=l[1];this.cellRowEnd=l[2];this.cellColEnd=l[3];let y=this.getSheetIndex(),e=f.rows.length,o=f.columns.length,u=[],i=[],a=ej.spreadsheet.getCell(this.cellRowStart,this.cellColStart,f),r=window.event?event:t;document.getElementById("DocumentViewer_text_align")&&(h=document.getElementById("DocumentViewer_text_align").ej2_instances[0]);document.getElementById("DocumentViewer_vertical_align")&&(c=document.getElementById("DocumentViewer_vertical_align").ej2_instances[0]);let p=document.body.querySelector("#"+this.ssObj.element.id+"_ac_popup");if(s&&s.textContent)if(this.ssObj.isEdit&&s.textContent.startsWith("=")){if(this.isFormula=!0,!p){if(!r.ctrlKey&&!r.shiftKey)if(t.keyCode==37){if(this.prevFormulaRange)this.setFormlaActiveCell(this.prevFormulaRange),i=ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange),this.prevFormulaRange=i[3]==0?this.generateHeaderText(i[1]+1)+(i[0]+1):this.generateHeaderText(i[1])+(i[0]+1);else if(i=this.ssObj.biz.getIndexes(),i[3]>=0){let n="";n=i[3]==0?this.generateHeaderText(i[1]+1)+(i[0]+1):this.generateHeaderText(i[1])+(i[0]+1);this.prevFormulaRange=n}this.formulaActiveCell=this.prevFormulaRange}else if(t.keyCode==39){if(this.prevFormulaRange)this.setFormlaActiveCell(this.prevFormulaRange),i=ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange),this.prevFormulaRange=this.generateHeaderText(i[1]+2)+(i[0]+1);else{i=this.ssObj.biz.getIndexes();let n=this.generateHeaderText(i[1]+2)+(i[0]+1);this.prevFormulaRange=n}this.formulaActiveCell=this.prevFormulaRange}else if(t.keyCode==38){if(this.prevFormulaRange)this.setFormlaActiveCell(this.prevFormulaRange),i=ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange),this.prevFormulaRange=i[2]==0?this.generateHeaderText(i[1]+1)+(i[0]+1):this.generateHeaderText(i[1]+1)+i[0];else{i=this.ssObj.biz.getIndexes();let n="";n=i[2]==0?this.generateHeaderText(i[1]+1)+(i[0]+1):this.generateHeaderText(i[1]+1)+i[0];this.prevFormulaRange=n}this.formulaActiveCell=this.prevFormulaRange}else if(t.keyCode==40){if(this.prevFormulaRange)this.setFormlaActiveCell(this.prevFormulaRange),i=ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange),this.prevFormulaRange=this.generateHeaderText(i[1]+1)+(i[0]+2);else{i=this.ssObj.biz.getIndexes();let n=this.generateHeaderText(i[1]+1)+(i[0]+2);this.prevFormulaRange=n}this.formulaActiveCell=this.prevFormulaRange}if(!r.ctrlKey&&r.shiftKey&&(t.keyCode==40?this.prevFormulaRange?(i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange)),this.prevFormulaRange=this.formulaActiveCell==this.generateHeaderText(i[1]+1)+(i[0]+1)||this.formulaActiveCell==this.generateHeaderText(i[3]+1)+(i[0]+1)?this.generateHeaderText(i[1]+1)+(i[0]+1)+":"+this.generateHeaderText(i[3]+1)+(i[2]+2):this.generateHeaderText(i[1]+1)+(i[0]+2)+":"+this.generateHeaderText(i[3]+1)+(i[2]+1)):(this.formulaActiveCell=f.activeCell,this.prevFormulaRange=this.formulaActiveCell+":"+this.generateHeaderText(this.cellColEnd+1)+(this.cellRowEnd+2)):t.keyCode==39?this.prevFormulaRange?(i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange)),this.prevFormulaRange=this.formulaActiveCell==this.generateHeaderText(i[1]+1)+(i[0]+1)||this.formulaActiveCell==this.generateHeaderText(i[1]+1)+(i[2]+1)?this.generateHeaderText(i[1]+1)+(i[0]+1)+":"+this.generateHeaderText(i[3]+2)+(i[2]+1):this.generateHeaderText(i[1]+2)+(i[0]+1)+":"+this.generateHeaderText(i[3]+1)+(i[2]+1)):(this.formulaActiveCell=f.activeCell,this.prevFormulaRange=this.formulaActiveCell+":"+this.generateHeaderText(this.cellColEnd+2)+(this.cellRowEnd+1)):t.keyCode==38?this.prevFormulaRange?(i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange)),this.prevFormulaRange=(this.formulaActiveCell==this.generateHeaderText(i[1]+1)+(i[0]+1)||this.formulaActiveCell==this.generateHeaderText(i[3]+1)+(i[0]+1))&&i[2]-i[0]>0?this.generateHeaderText(i[1]+1)+(i[0]+1)+":"+this.generateHeaderText(i[3]+1)+i[2]:this.generateHeaderText(i[1]+1)+i[0]+":"+this.generateHeaderText(i[3]+1)+(i[2]+1)):(this.formulaActiveCell=f.activeCell,this.prevFormulaRange=this.generateHeaderText(this.cellColStart+1)+this.cellRowStart+":"+this.generateHeaderText(this.cellColEnd+1)+(this.cellRowEnd+1)):t.keyCode==37&&(this.prevFormulaRange?(i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange)),this.prevFormulaRange=this.formulaActiveCell==this.generateHeaderText(i[1]+1)+(i[0]+1)||this.formulaActiveCell==this.generateHeaderText(i[1]+1)+(i[2]+1)?this.generateHeaderText(i[1]+1)+(i[0]+1)+":"+this.generateHeaderText(i[3])+(i[2]+1):this.generateHeaderText(i[1])+(i[0]+1)+":"+this.generateHeaderText(i[3]+1)+(i[2]+1)):(this.formulaActiveCell=f.activeCell,this.prevFormulaRange=this.generateHeaderText(this.cellColStart)+(this.cellRowStart+1)+":"+this.generateHeaderText(this.cellColEnd+1)+(this.cellRowEnd+1)))),r.ctrlKey&&r.shiftKey){let n,s;if(t.keyCode==40)if(this.prevFormulaRange){i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange));let t={evtobj:r,indexes:i,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(t);s=ej.spreadsheet.getIndexesFromAddress(this.formulaActiveCell);n=this.swapRange([s[0]+1,s[1]+1,u[1],u[0]]);this.prevFormulaRange=this.generateHeaderText(n[1])+n[0]+":"+this.generateHeaderText(n[3])+n[2]}else{this.formulaActiveCell=f.activeCell;let n={evtobj:r,indexes:l,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(n);let t=this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1)+":"+this.generateHeaderText(u[0])+u[1];this.prevFormulaRange=t}else if(t.keyCode==39)if(this.prevFormulaRange){i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange));let t={evtobj:r,indexes:i,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(t);s=ej.spreadsheet.getIndexesFromAddress(this.formulaActiveCell);n=this.swapRange([s[0]+1,s[1]+1,u[1],u[0]]);this.prevFormulaRange=this.generateHeaderText(n[1])+n[0]+":"+this.generateHeaderText(n[3])+n[2]}else{this.formulaActiveCell=f.activeCell;i=this.ssObj.biz.getIndexes();let n={evtobj:r,indexes:i,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(n);let t=this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1)+":"+this.generateHeaderText(u[0])+u[1];this.prevFormulaRange=t}else if(t.keyCode==38){if(this.prevFormulaRange){i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange));let t={evtobj:r,indexes:i,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(t);s=ej.spreadsheet.getIndexesFromAddress(this.formulaActiveCell);n=this.swapRange([s[0]+1,s[1]+1,u[1],u[0]]);this.prevFormulaRange=this.generateHeaderText(n[1])+n[0]+":"+this.generateHeaderText(n[3])+n[2]}else if(this.formulaActiveCell=f.activeCell,i=this.ssObj.biz.getIndexes(),i[0]>0){let n={evtobj:r,indexes:i,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(n);let t=this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1)+":"+this.generateHeaderText(u[0])+u[1];this.prevFormulaRange=t}}else if(t.keyCode==37)if(this.prevFormulaRange){i=this.swapRange(ej.spreadsheet.getIndexesFromAddress(this.prevFormulaRange));let t={evtobj:r,indexes:i,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(t);s=ej.spreadsheet.getIndexesFromAddress(this.formulaActiveCell);n=this.swapRange([s[0]+1,s[1]+1,u[1],u[0]]);this.prevFormulaRange=this.generateHeaderText(n[1])+n[0]+":"+this.generateHeaderText(n[3])+n[2]}else if(this.formulaActiveCell=f.activeCell,i=this.ssObj.biz.getIndexes(),i[2]>0){let n={evtobj:r,indexes:i,activeCell:this.formulaActiveCell,availableRows:e,availableCols:o};u=this.getIndexesOnCtrlShifArrows(n);let t=this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1)+":"+this.generateHeaderText(u[0])+u[1];this.prevFormulaRange=t}}if((t.keyCode==37||t.keyCode==38||t.keyCode==39||t.keyCode==40)&&this.isFormula){if(s.textContent.includes("(")){let n=s.textContent.split("(");s.textContent=n[0]+"("+this.prevFormulaRange}else s.textContent="="+this.prevFormulaRange;let n={formulaSheetIdx:y,name:"initiateFormulaReference",range:this.prevFormulaRange};this.ssObj.selectionModule.initiateFormulaSelection(n);setTimeout(()=>{let n=document.createRange();var t=this.ssObj.element.querySelector("#"+this.ssObj.element.id+"_edit"),i=window.getSelection();n=document.createRange();i.removeAllRanges();n.selectNodeContents(t);n.collapse(!1);i.addRange(n);t.focus()},0)}}}else this.isFormula=!1;else this.isFormula=!1;if(r.ctrlKey&&r.shiftKey&&!this.isFormula&&!this.ssObj.isEdit&&(r.keyCode==76&&(t.preventDefault(),t.stopImmediatePropagation(),h.trigger("select",{item:h.items[0]})),r.keyCode==69&&(t.preventDefault(),t.stopImmediatePropagation(),h.trigger("select",{item:h.items[1]})),r.keyCode==82&&(t.preventDefault(),h.trigger("select",{item:h.items[2]})),r.keyCode==84&&(t.preventDefault(),t.stopImmediatePropagation(),c.trigger("select",{item:c.items[0]})),r.keyCode==77&&(t.preventDefault(),c.trigger("select",{item:c.items[1]})),r.keyCode==66&&(t.preventDefault(),t.stopImmediatePropagation(),c.trigger("select",{item:c.items[2]}))),t.keyCode==113&&this.ssObj.isEdit&&(this.f2Edit=!0),t.keyCode==113&&t.shiftKey&&(t.preventDefault(),this.formatpainter.insertNote()),this.ssObj.isEdit&&(this.isFormula||this.f2Edit||r.shiftKey||r.ctrlKey||t.keyCode!=37&&t.keyCode!=38&&t.keyCode!=39&&t.keyCode!=40||(v=document.getElementsByClassName("e-spreadsheet-edit")[0].innerText,a==null&&(a={}),a.value=v,this.ssObj.biz.setCell(this.cellRowStart,this.cellColStart,f,a),this.ssObj.endEdit(),this.f2Edit=!1)),!r.shiftKey&&r.ctrlKey&&(t.keyCode==68||t.keyCode==82||t.keyCode==13)){t.preventDefault();let i={origin:"biz",action:"shortcuts",range:l,e:t,evtobj:r,sheet:f,sheetIndex:this.getSheetIndex()};this.ssObj.updateUndoRedoCollection({name:"bizAction",args:{action:"shortcuts",options:i,oldCells:this.getCellsFromIndexes(i.range)}});this.shortcuts(i);n.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(i);this.download.ssAutoSave({action:"shortcuts"},this,!0)}this.clearFindReplace()}viewOnlyKeyDown(n){let i=this.ssObj.biz.getActiveSheet(),u=this.ssObj.biz.getIndexes(),f=i.rows.length,e=i.columns.length,t=window.event?event:n,o=i.activeCell,s=this.getSheetIndex(),r=[],h=document.getElementById("menubar-fullscreen-container");if(t.ctrlKey&&t.shiftKey&&!this.isFormula&&!this.ssObj.isEdit){let n={evtobj:t,indexes:u,activeCell:o,availableCols:e,availableRows:f};r=this.getIndexesOnCtrlShifArrows(n)}h&&n.keyCode==27&&this.dialogue.hideSsMenubarFullscreenDialog();t.ctrlKey&&n.keyCode==65&&!this.ssObj.isEdit&&this.ctrlA_Function();n.keyCode==122&&(n.preventDefault(),this.openFullscreen(this.container));(t.keyCode==37||t.keyCode==39||t.keyCode==38||t.keyCode==40)&&this.ssObj.selectRange(this.ssObj.sheets[s].activeCell+":"+this.generateHeaderText(r[0])+r[1]);this.ctrl_Shift_S(n)}ctrl_Shift_S(n){n.keyCode==83&&(n.ctrlKey&&!n.shiftKey||n.ctrlKey&&n.shiftKey)&&(n.preventDefault(),n.stopImmediatePropagation())}ctrlA_Function(){var n,t,i,r;if(this.isCtrlA)this.isCtrlA=!1,i=document.body.querySelector(".e-selectall"),r=i.getBoundingClientRect(),this.ssObj.selectionModule.mouseDownHandler({target:i,shiftKey:!1,ctrlKey:!1,type:"mousedown",clientY:r.top,clientX:r.left}),this.checkedIndexes=[],this.selectedIndexes=[null,null,null,null];else{for(this.isCtrlA=!0,n=this.cellRowStart;n<=this.cellRowEnd;n++)for(t=this.cellColStart;t<=this.cellColEnd;t++)this.checksForCellsWithValues([n,t]);this.selectedIndexes[0]!==this.cellRowStart||this.selectedIndexes[1]!==this.cellColStart||this.selectedIndexes[2]!==this.cellRowEnd||this.selectedIndexes[3]!==this.cellColEnd?(this.ssObj.selectRange(this.generateHeaderText(this.selectedIndexes[1]+1)+(this.selectedIndexes[0]+1)+":"+this.generateHeaderText(this.selectedIndexes[3]+1)+(this.selectedIndexes[2]+1)),this.isCtrlA=!0):this.ctrlA_Function();this.checkedIndexes=[];this.selectedIndexes=[null,null,null,null]}}getIndexesOnCtrlShifArrows(n){var u,e;let t,i,r=[],f=this.ssObj.biz.getActiveSheet();if(this.cellRowStart=n.indexes[0],this.cellColStart=n.indexes[1],this.cellRowEnd=n.indexes[2],this.cellColEnd=n.indexes[3],n.evtobj.keyCode==40)if(n.evtobj.preventDefault(),n.evtobj.stopImmediatePropagation(),n.activeCell===this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1))for(t=ej.spreadsheet.getCell(this.cellRowEnd+1,this.cellColStart,f),u=this.cellRowEnd+1;u<1e7;u++)for(e=this.cellColStart;e<=this.cellColStart;e++)i=ej.spreadsheet.getCell(u,e,f),e==this.cellColStart&&(this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColEnd+1,u,u,e,this.cellRowEnd,this.cellColEnd),u=1e7):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(this.cellColEnd+1,u+1,u,e,this.cellRowEnd,this.cellColEnd),u=1e7));else if(n.activeCell===this.generateHeaderText(this.cellColStart+1)+(this.cellRowEnd+1))for(t=ej.spreadsheet.getCell(this.cellRowStart+1,this.cellColStart,f),u=this.cellRowStart+1;u<1e7;u++)for(e=this.cellColStart;e<=this.cellColStart;e++)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColEnd+1,u,u,e,this.cellRowEnd,this.cellColEnd),u=1e7):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(this.cellColEnd+1,u+1,u,e,this.cellRowEnd,this.cellColEnd),u=1e7);else if(n.activeCell===this.generateHeaderText(this.cellColEnd+1)+(this.cellRowEnd+1))for(t=ej.spreadsheet.getCell(this.cellRowStart+1,this.cellColEnd,f),u=this.cellRowStart+1;u<1e7;u++)for(e=this.cellColEnd;e<=this.cellColEnd;e++)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColStart+1,u,u,e,this.cellRowEnd,this.cellColEnd),u=1e7):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(this.cellColStart+1,u+1,u,e,this.cellRowEnd,this.cellColEnd),u=1e7);else{t=ej.spreadsheet.getCell(this.cellRowEnd+1,this.cellColEnd,f);for(let u=this.cellRowEnd+1;u<1e7;u++)for(let e=this.cellColEnd;e<=this.cellColEnd;e++)i=ej.spreadsheet.getCell(u,e,f),e==this.cellColEnd&&(this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColStart+1,u,u,e,this.cellRowEnd,this.cellColEnd),u=1e7):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(this.cellColStart+1,u+1,u,e,this.cellRowEnd,this.cellColEnd),u=1e7))}else if(n.evtobj.keyCode==38)if(n.evtobj.preventDefault(),n.evtobj.stopImmediatePropagation(),n.activeCell===this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1)){t=ej.spreadsheet.getCell(this.cellRowEnd-1,this.cellColStart,f);for(let u=this.cellRowEnd-1;u<1e9;u--)for(let e=this.cellColStart;e<=this.cellColStart;e++)i=ej.spreadsheet.getCell(u,e,f),e==this.cellColStart&&(this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColEnd+1,u+2,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColEnd+1,u+1,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):u==-1&&(r.push(this.cellColEnd+1,1),u=1000000001))}else if(n.activeCell==this.generateHeaderText(this.cellColStart+1)+(this.cellRowEnd+1)){t=ej.spreadsheet.getCell(this.cellRowStart-1,this.cellColStart,f);for(let u=this.cellRowStart-1;u<1e9;u--)for(let e=this.cellColStart;e<=this.cellColStart;e++)i=ej.spreadsheet.getCell(u,e,f),e==this.cellColStart&&(this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColEnd+1,u+2,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColEnd+1,u+1,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):u==-1&&(r.push(this.cellColEnd+1,1),u=1000000001))}else if(n.activeCell==this.generateHeaderText(this.cellColEnd+1)+(this.cellRowEnd+1)){t=ej.spreadsheet.getCell(this.cellRowStart-1,this.cellColEnd,f);for(let u=this.cellRowStart-1;u<1e9;u--)for(let e=this.cellColEnd;e<=this.cellColEnd;e++)i=ej.spreadsheet.getCell(u,e,f),e==this.cellColEnd&&(this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColStart+1,u+2,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColStart+1,u+1,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):u==-1&&(r.push(this.cellColStart+1,1),u=1000000001))}else{t=ej.spreadsheet.getCell(this.cellRowEnd-1,this.cellColEnd,f);for(let u=this.cellRowEnd-1;u<1e9;u--)for(let e=this.cellColEnd;e<=this.cellColEnd;e++)i=ej.spreadsheet.getCell(u,e,f),e==this.cellColEnd&&(this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColStart+1,u+2,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(this.cellColStart+1,u+1,u,e,this.cellRowStart,this.cellColEnd),u=1000000001):u==-1&&(r.push(this.cellColStart+1,1),u=1000000001))}else if(n.evtobj.keyCode==39)if(n.evtobj.preventDefault(),n.evtobj.stopImmediatePropagation(),n.activeCell===this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1)){t=ej.spreadsheet.getCell(this.cellRowStart,this.cellColEnd+1,f);for(let u=this.cellRowStart;u<=this.cellRowStart;u++)for(let e=this.cellColEnd+1;e<1000000001;e++)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e,this.cellRowEnd+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(e+1,this.cellRowEnd+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001)}else if(n.activeCell===this.generateHeaderText(this.cellColStart+1)+(this.cellRowEnd+1)){t=ej.spreadsheet.getCell(this.cellRowEnd,this.cellColEnd+1,f);for(let u=this.cellRowEnd;u<=this.cellRowEnd;u++)for(let e=this.cellColEnd+1;e<1000000001;e++)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e,this.cellRowStart+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(e+1,this.cellRowStart+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001)}else if(n.activeCell===this.generateHeaderText(this.cellColEnd+1)+(this.cellRowEnd+1)){t=ej.spreadsheet.getCell(this.cellRowEnd,this.cellColStart+1,f);for(let u=this.cellRowEnd;u<=this.cellRowEnd;u++)for(let e=this.cellColStart+1;e<1000000001;e++)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e,this.cellRowStart+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(e+1,this.cellRowStart+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001)}else{t=ej.spreadsheet.getCell(this.cellRowStart,this.cellColStart+1,f);for(let u=this.cellRowStart;u<=this.cellRowStart;u++)for(let e=this.cellColStart+1;e<1000000001;e++)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e,this.cellRowEnd+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001):(!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols)&&(r.push(e+1,this.cellRowEnd+1,this.cellRowStart,this.cellColStart,u,e),e=1000000001)}else if(n.evtobj.keyCode==37)if(n.evtobj.preventDefault(),n.evtobj.stopImmediatePropagation(),n.activeCell===this.generateHeaderText(this.cellColStart+1)+(this.cellRowStart+1)){t=ej.spreadsheet.getCell(this.cellRowStart,this.cellColEnd-1,f);for(let u=this.cellRowStart;u<=this.cellRowStart;u++)for(let e=this.cellColEnd-1;e<1e9;e--)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+2,this.cellRowEnd+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+1,this.cellRowEnd+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):e==-1&&(r.push(1,this.cellRowEnd+1),e=1000000001)}else if(n.activeCell===this.generateHeaderText(this.cellColStart+1)+(this.cellRowEnd+1)){t=ej.spreadsheet.getCell(this.cellRowEnd,this.cellColEnd-1,f);for(let u=this.cellRowEnd;u<=this.cellRowEnd;u++)for(let e=this.cellColEnd-1;e<1e9;e--)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+2,this.cellRowStart+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+1,this.cellRowStart+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):e==-1&&(r.push(1,this.cellRowStart+1),e=1000000001)}else if(n.activeCell===this.generateHeaderText(this.cellColEnd+1)+(this.cellRowEnd+1)){t=ej.spreadsheet.getCell(this.cellRowEnd,this.cellColStart-1,f);for(let u=this.cellRowEnd;u<=this.cellRowEnd;u++)for(let e=this.cellColStart-1;e<1e9;e--)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+2,this.cellRowStart+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+1,this.cellRowStart+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):e==-1&&(r.push(1,this.cellRowStart+1),e=1000000001)}else{t=ej.spreadsheet.getCell(this.cellRowStart,this.cellColStart-1,f);for(let u=this.cellRowStart;u<=this.cellRowStart;u++)for(let e=this.cellColStart-1;e<1e9;e--)i=ej.spreadsheet.getCell(u,e,f),this.checkCellObjHasValue(t)&&!this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+2,this.cellRowEnd+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):!this.checkCellObjHasValue(t)&&this.checkCellObjHasValue(i)||u>=n.availableRows||e>=n.availableCols?(r.push(e+1,this.cellRowEnd+1,u,e=0,this.cellRowStart,this.cellColStart+1),e=1000000001):e==-1&&(r.push(1,this.cellRowEnd+1),e=1000000001)}return r}checksForCellsWithValues(n){if(this.checkedIndexes.findIndex(t=>t[0]==n[0]&&t[1]==n[1])===-1){this.checkedIndexes.push(n);let t=this.ssObj.getActiveSheet(),i=ej.spreadsheet.getCell(n[0]+1,n[1],t),r=ej.spreadsheet.getCell(n[0]-1,n[1],t),u=ej.spreadsheet.getCell(n[0],n[1]-1,t),f=ej.spreadsheet.getCell(n[0],n[1]+1,t);(this.selectedIndexes[0]==null||this.selectedIndexes[2]==null)&&(this.selectedIndexes[0]=n[0],this.selectedIndexes[2]=n[0]);(this.selectedIndexes[1]==null||this.selectedIndexes[3]==null)&&(this.selectedIndexes[1]=n[1],this.selectedIndexes[3]=n[1]);this.selectedIndexes[0]>n[0]&&(this.selectedIndexes[0]=n[0]);this.selectedIndexes[2]<n[0]&&(this.selectedIndexes[2]=n[0]);this.selectedIndexes[1]>n[1]&&(this.selectedIndexes[1]=n[1]);this.selectedIndexes[3]<n[1]&&(this.selectedIndexes[3]=n[1]);this.checkCellObjHasValue(i)&&this.checksForCellsWithValues([n[0]+1,n[1]]);this.checkCellObjHasValue(r)&&this.checksForCellsWithValues([n[0]-1,n[1]]);this.checkCellObjHasValue(u)&&this.checksForCellsWithValues([n[0],n[1]-1]);this.checkCellObjHasValue(f)&&this.checksForCellsWithValues([n[0],n[1]+1])}}setFormlaActiveCell(n){if(n.includes(":")){let t=n.split(":")[0];this.formulaActiveCell=t}else this.formulaActiveCell=n}keyUp(n){n.keyCode==113&&this.ssObj.isEdit&&(this.f2Edit=!0)}bodyDblClick(t){let i=document.getElementsByClassName("biz-ss-import-dialog");if(this.ssObj.isEdit&&(this.f2Edit=!0),i.length>0&&t.target.classList.contains("copyto_folder")){let i=Number(t.target.id.split("_")[2]),r=t.target.firstElementChild.textContent.trim();n.Apps.Collaboration.Components.Sheets.Ribbon.Instance().getFolderItems(i,r,!0)}}shortcuts(n){var t=n.range,u,i,r;if(this.cellRowStart=t[0],this.cellColStart=t[1],this.cellRowEnd=t[2],this.cellColEnd=t[3],u=ej.spreadsheet.getCell(this.cellRowStart,this.cellColStart,n.sheet),n.evtobj.ctrlKey&&n.e.keyCode==13&&!n.evtobj.shiftKey)for(n.e.preventDefault(),n.e.stopImmediatePropagation(),n.e.stopPropagation(),i=this.cellRowStart;i<=this.cellRowEnd;i++)for(r=this.cellColStart;r<=this.cellColEnd;r++)this.ssObj.biz.setCell(i,r,n.sheet,u)}scroll(n){let u=this.ssObj.getActiveSheet(),f=this.ssObj.frozenRowCount(u),e=this.ssObj.frozenColCount(u);var t=ej.spreadsheet.getCellPosition(u,[n[2],n[3]],f,e);let i=this.ssObj.element.querySelector(".e-main-panel");(!(t.top>i.scrollTop&&t.top<i.scrollTop+i.offsetHeight)||i.offsetHeight+i.scrollTop<ej.spreadsheet.getCellPosition(this.ssObj.getActiveSheet(),[n[2],n[3]],f,e).top)&&(i.scrollTop=t.top-i.offsetHeight+20);t=ej.spreadsheet.getCellPosition(u,[n[4],n[5]],f,e);let r=this.ssObj.getScrollElement();(!(t.left>r.scrollLeft&&t.left<r.scrollLeft+r.offsetWidth)||r.offsetWidth+r.scrollLeft<ej.spreadsheet.getCellPosition(this.ssObj.getActiveSheet(),[n[4],n[5]],f,e).left)&&(r.scrollLeft=t.left-r.offsetWidth+20)}openFullscreen(n){n.requestFullscreen?n.requestFullscreen():n.webkitRequestFullscreen?n.webkitRequestFullscreen():n.msRequestFullscreen&&n.msRequestFullscreen()}setHeightOnFullScreenChange(){let n=document.getElementById("DocumentViewer_sheet_panel");var t=this.element.parentElement.previousElementSibling.offsetHeight,i=this.element.parentElement.nextElementSibling.offsetHeight,r=n.previousElementSibling.previousElementSibling.offsetHeight,u=n.nextElementSibling.offsetHeight,f=n.previousElementSibling.offsetHeight,e=t+i+f+u+r;this.element.parentElement.style.height=window.innerHeight-t-i+"px";n.style.height=window.innerHeight-e+"px"}setViewonly(){this.ssObj.allowEditing=!1;this.ssObj.allowResizing=!1;this.ssObj.enableContextMenu=!1;this.ssObj.allowAutoFill=!1;document.getElementsByClassName("biz-ss-fileshare-icon")[0].classList.remove("icon-ss-lockopen");document.getElementsByClassName("biz-ss-fileshare-icon")[0].classList.add("icon-ss-lockclose");this.ribbon.ssMenubarObj.enableItems(["Import","Make A Copy","Edit","Insert","Format","Formulas","Data","Freeze Panes","Freeze Rows","Freeze Columns","Tools"],!1);document.getElementById("DocumentViewer_sheet_tab_panel").firstElementChild.setAttribute("disabled","true");document.getElementById("DocumentViewer_ribbon").classList.add("biz-ss-toolbar-wrapper");document.getElementById("biz-ss-viewonly-btn").addEventListener("click",()=>{document.getElementById("viewonly-container")||(this.viewOnlyDialog=new ej.popups.Dialog({header:"",content:`<div id='viewonly-container'>
  3. <p>you can only view this document. To make changes, ask the owner for edit access</p>
  4. </div>`,width:"240px",height:"135px",buttons:[{click:this.processAccessDailog.bind(this),buttonModel:{content:"Request Edit Access",isPrimary:!0}}],position:{X:12,Y:95},cssClass:"biz-ss-viewonly-dialog"}),this.viewOnlyDialog.appendTo("#dialog"))})}getElem(){var n=document.createElement("button");n.setAttribute("id","biz-ss-viewonly-btn");let t=new ej.buttons.Button;return t.appendTo(n),n.innerHTML="View Only",n}initialLoad(){let n=this.ssObj.ribbonModule.getRibbonItems.bind(this.ssObj.ribbonModule);this.ssObj.ribbonModule.getRibbonItems=()=>{let t=n(),i=t[0].content,r={template:this.getElem(),cssClass:"biz-ss-viewonly-wrapper",id:this.ssObj.element.id+"_viewonly",tooltipText:"View Only"};return i.splice(t[0].content.length,0,r),t}}performBizUndoRedo(t,i){let u=this.ssObj.undoredoModule,r;if(r=i?t.isUndo?u.undoCollection.pop():u.redoCollection.pop():t.isUndo?u.undoCollection[u.undoCollection.length-1]:u.redoCollection[u.redoCollection.length-1],r&&r.action=="resize"){var f=r;r=[];r.args=f}if(r&&r.args){switch(r.args.action){case"autofill":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.oldCells));this.setCellObjects(r.args.options.fillRange,n)}else this.autofill.applyAutofill(r.args.options,r.args.direction);break;case"formatpaint":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.oldCells));this.setCellObjects(r.args.options.destIndexes,n)}else this.formatpainter.applyFormatPaint(r.args.options.srcRange,r.args.options.destRange,r.args.options.srcSheetIndex);break;case"trim":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.oldCells));this.setCellObjects(r.args.range,n)}else this.ribbon.processTrim(r.args.range);break;case"removeDuplicates":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.oldCells));this.setCellObjects(r.args.options.indexes,n)}else this.dialogue.removeDuplicate(r.args.options.range,r.args.options.header,r.args.options.colSelected);break;case"splittext":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.oldCells));this.setCellObjects(r.args.range,n,r.args.stValues)}else this.formatpainter.applySplitText(r.args.range,r.args.stValues);break;case"shiftcells":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.dragCells)),t=JSON.parse(JSON.stringify(r.args.dropCells));this.setCellObjects(r.args.options.ranges,n);this.setCellObjects(r.args.options.dropRange,t)}else{let n=JSON.parse(JSON.stringify(r.args.dragCells));this.setCellObjects(r.args.options.ranges,[]);this.setCellObjects(r.args.options.dropRange,n)}break;case"deleteshiftup":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.oldCells));this.formatpainter.applyInsertShiftDown(r.args.range,r);this.setCellObjects(r.args.indexes,n)}else this.formatpainter.applyDeleteShiftUp(r.args.range,r);break;case"deleteshiftleft":if(t.isUndo){let n=JSON.parse(JSON.stringify(r.args.oldCells));this.formatpainter.applyInsertShiftRight(r.args.range);this.setCellObjects(r.args.indexes,n)}else this.formatpainter.applyDeleteShiftLeft(r.args.range);break;case"insertshiftdown":t.isUndo?this.formatpainter.applyDeleteShiftUp(r.args.range,r):this.formatpainter.applyInsertShiftDown(r.args.range,r);break;case"insertshiftright":t.isUndo?this.formatpainter.applyDeleteShiftLeft(r.args.range):this.formatpainter.applyInsertShiftRight(r.args.range);break;case"shortcuts":if(t.isUndo){let n=[...r.args.oldCells];this.setCellObjects(r.args.options.range,n)}else this.shortcuts(r.args.options);break;case"bizImageInCell":if(t.isUndo){let n=r.args.oldCells;n?"":n={};let t=r.args.options.indexes;this.setCellObjects(t,[n]);this.download.ssAutoSave({action:"imageincell",changedValues:[{row:t[0],cell:t[1],cellinfo:n}]},this,!0)}else this.actionInsertImage(r.args.options);break;case"resize":if(t.isUndo){let n;r.args.eventArgs.type==="Column"&&(n={args:{undo:!0,eventArgs:{index:r.args.eventArgs.index,width:r.args.eventArgs.oldSize,sheetIdx:r.args.eventArgs.sheetIdx,oldWidth:r.args.eventArgs.newSize,range:r.args.eventArgs.range},action:"resize",name:"actionComplete"}});r.args.eventArgs.type==="Row"&&(n={args:{undo:!0,eventArgs:{index:r.args.eventArgs.index,height:r.args.eventArgs.oldSize,sheetIdx:r.args.eventArgs.sheetIdx,oldHeight:r.args.eventArgs.newSize,range:r.args.eventArgs.range},action:"resize",name:"actionComplete"}});this.adjustRowsAndColumnWidth(n.args)}else this.adjustRowsAndColumnWidth(r.args);break;case"spell":if(t.isUndo){let n=[...r.args.oldCells];this.setCellObjects(r.args.options.indexes,n)}else this.adjustRowsAndColumnWidth(r.args)}let e={origin:"biz",action:"undoredo",sheetIndex:this.getSheetIndex(),isUndo:t.isUndo};i||n.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(e)}}addFormatsToToolbar(){let n=this.ssObj.ribbonModule.getRibbonItems.bind(this.ssObj.ribbonModule);this.ssObj.ribbonModule.getRibbonItems=()=>{let t=n(),i=t[0].content,r=[{prefixIcon:"icon-ss-currency",cssClass:"biz-ss-currencyformat",id:this.ssObj.element.id+"_currencyformat",tooltipText:"Format as currency"},{prefixIcon:"icon-ss-percentage",cssClass:"biz-ss-percentageformat",id:this.ssObj.element.id+"_percentageformat",tooltipText:"Format as percentage"},{template:this.ribbon.getFormulaBtnDdb(),id:this.ssObj.element.id+"_sumformula",tooltipText:"Sum Function"}];i.splice(8,0,r[0],r[1]);i.splice(t[0].content.length-1,0,r[2]);let u=i.find(n=>n.id=="DocumentViewer_sorting").template.ej2_instances[0];u.addEventListener("select",this.sortingBtnSelect.bind(this));u.addEventListener("beforeItemRender",this.sortingBtnBfRender.bind(this));let f=t[0].content.find(n=>n.id=="DocumentViewer_sorting");return f.template.firstElementChild.classList.remove("e-sort-filter-icon"),f.template.firstElementChild.classList.add("biz-sort-filter-icon"),t}}sortingBtnBfRender(n){if(n.item.text==="Filter"&&this.ssObj.filterModule.filterCollection.has(this.getSheetIndex())){var t=n.element.firstElementChild;n.element.innerHTML=t.outerHTML+"Remove Filter";n.element.firstElementChild.classList.remove("e-filter-apply");n.element.firstElementChild.classList.add("e-filter-clear")}}sortingBtnBeforeOpen(n){this.ssObj.filterModule.filterCollection.has(this.getSheetIndex())?n.element.lastElementChild.classList.contains("e-disabled")&&n.element.lastElementChild.classList.remove("e-disabled"):n.element.lastElementChild.classList.contains("e-disabled")||n.element.lastElementChild.classList.add("e-disabled")}sortingBtnSelect(n){this.ssObj.filterCollection&&n.item.text==="Filter"&&setTimeout(()=>{this.ssObj.filterModule.filterCollection.has(this.getSheetIndex())||(this.sortingBtn=document.getElementById("DocumentViewer_sorting"),this.sortingBtn.firstElementChild.style.color="")},500)}processAccessDailog(){this.viewOnlyDialog.hide();this.viewOnlyDialog.destroy();this.renderAccessDailog()}renderAccessDailog(){this.requestAccessObj=new ej.popups.Dialog({header:"Ask the owner to access for edit",content:`<div id='requestaccess-container'>
  5. <textarea id="requestaccess-textarea"> </textarea>
  6. </div>`,width:"400px",buttons:[{click:this.hideRequestAccess.bind(this),buttonModel:{content:"cancel"}},{click:this.hideRequestAccess.bind(this),buttonModel:{content:"send",isPrimary:!0}}],cssClass:"biz-ss-requestaccess-dialog",target:this.container,isModal:!0});this.requestAccessObj.appendTo("#dialog");var n=new ej.inputs.TextBox({placeholder:"Enter your message",floatLabelType:"Auto",rows:4});n.appendTo("#requestaccess-textarea");n.element.setAttribute("rows","4")}hideRequestAccess(){this.requestAccessObj.hide();this.requestAccessObj.destroy()}lettersToNumber(n){let r="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t,i,u=0;for(t=0,i=n.length-1;t<n.length;t+=1,i-=1)u+=Math.pow(r.length,i)*(r.indexOf(n[t])+1);return u}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.Base=i})(i=t.Sheets||(t.Sheets={}))})(i=t.Components||(t.Components={}))})(i=t.Collaboration||(t.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));