text: BX.namespace("BX.Disk");BX.Disk.FolderListClass=function(){var FolderListClass=function(e){this.layout=e.layout||{};this.errors=e.errors||[];this.showSearchNotice=e.showSearchNotice;this.information=e.information||"";this.currentFolder=e.currentFolder||{};this.gridId=e.gridId;this.isTrashMode=e.isTrashMode;this.filterValueToSkipSearchUnderLinks=e.filterValueToSkipSearchUnderLinks||{};this.filterId=e.filterId;if(BX.Main.gridManager){this.commonGrid=new BX.Disk.Model.FolderList.CommonGrid({instance:BX.Main.gridManager.getById(this.gridId).instance})}else{this.commonGrid=new BX.Disk.Model.FolderList.CommonGrid({instance:BX.Main.tileGridManager.getById(this.gridId).instance})}this.filter=BX.Main.filterManager.getById(this.filterId);this.relativePath=e.relativePath;this.gridShowTreeButton=BX(e.gridShowTreeButton);this.rootObject=e.rootObject||{};this.storage=e.storage||{};this.storage.manage=this.storage.manage||{};this.enabledModZip=e.enabledModZip||false;this.enabledExternalLink=e.enabledExternalLink;this.enabledObjectLock=e.enabledObjectLock;this.getFilesCountAndSize=e.getFilesCountAndSize||{};this.cacheExternalLinks={};this.createBlankFileUrl=e.createBlankFileUrl;this.renameBlankFileUrl=e.renameBlankFileUrl;this.defaultService=e.defaultService;this.defaultServiceLabel=e.defaultServiceLabel;this.sortFields=e.sortFields;this.sort=e.sort;this.actionGroupButton=e.actionGroupButton||"move";this.isBitrix24=e.isBitrix24||false;this.destFormName=e.destFormName||"folder-list-destFormName";this.ajaxUrl="/bitrix/components/bitrix/disk.folder.list/ajax.php";BX.Disk.Page.changeFolder({id:this.currentFolder.id,name:this.currentFolder.name});BX.Disk.Page.changeStorage(this.storage);this.setEvents();if(this.shouldUseHistory()){window.history.replaceState({disk:true,folder:{id:this.currentFolder.id}},null,document.location.toString())}this.workWithLocationHash();this.processCommand();if(this.errors.length)this.showErrors();if(this.information.length)this.showInformation();if(!this.currentFolder.canAdd){this.blockCreateItemsButton()}if(this.needRunFilterUnderLinks()){this.rerunFilter()}};FolderListClass.prototype.rerunFilter=function(){var e=new BX.Promise;this.onFilterApply(this.filter.getParam("FILTER_ID"),{},this.filter,e);e.fulfill()};FolderListClass.prototype.showInformation=function(){BX.Disk.showModalWithStatusAction({status:"success",message:this.information})};FolderListClass.prototype.showErrors=function(){BX.Disk.showModalWithStatusAction({status:"error",errors:this.errors})};FolderListClass.prototype.onHashChange=function(){var e=document.location.hash.match(/hl-([0-9]+)/g);if(e){var t=(document.location.hash.match(/!([a-zA-Z]+)/g)||[]).pop();for(var i in e){if(!e.hasOwnProperty(i)){continue}var s=e[i];var o=s.match(/hl-([0-9]+)/);if(o&&o[1]){if(this.commonGrid.getItemById(o[1])){this.commonGrid.scrollTo(o[1]);this.commonGrid.selectItemById(o[1]);this.runCommandOnObjectId(t,o[1])}else if(t){if(window.BXIM&&BXIM.isOpenNotify()){document.location.reload();BXIM.closeMessenger()}}}}if(window.BXIM&&BXIM.isOpenNotify()){BXIM.closeMessenger()}}};FolderListClass.prototype.processCommand=function(){if(BX.Disk.getUrlParameter("cmd")==="openSliderBp"){if(this.storage.bpListLink){this.openSlider(this.storage.bpListLink)}}};FolderListClass.prototype.shouldUseHistory=function(){return top===window};FolderListClass.prototype.workWithLocationHash=function(){setTimeout(BX.delegate(function(){this.onHashChange()},this),350)};FolderListClass.prototype.setEvents=function(){BX.bind(this.getFilesCountAndSize.button,"click",BX.proxy(this.onClickGetFilesCountAndSizeButtonButton,this));BX.bind(window,"hashchange",BX.proxy(this.onHashChange,this));BX.bindDelegate(this.commonGrid.getContainer(),"click",{className:"js-disk-grid-open-folder"},this.openGridFolder.bind(this));BX.bind(this.sort.layout.label,"click",this.showGridSortingMenu.bind(this));for(var e=0;e<this.layout.changeViewButtons.length;++e){BX.bind(BX(this.layout.changeViewButtons[e]),"click",this.changeView.bind(this))}BX.SidePanel.Instance.bindAnchors({rules:[{condition:[this.storage.link,this.storage.trashLink],handler:function(e,t){if(BX.hasClass(t.anchor,"main-ui-pagination-page")||BX.hasClass(t.anchor,"main-ui-pagination-arrow")){return}if(this.onOpenFolderByAnchor(t.anchor)){e.preventDefault()}}.bind(this)},{condition:[this.storage.fileLinkPrefix,this.storage.trashFileLinkPrefix],handler:function(e,t){if(!t.anchor.dataset.bxViewer&&!t.anchor.dataset.viewer){BX.SidePanel.Instance.open(t.url);e.preventDefault()}}}]});BX.addCustomEvent("SidePanel.Slider:onMessage",this.onSliderMessage.bind(this));BX.bind(window,"popstate",this.onPopState.bind(this));BX.addCustomEvent("onIframeElementLoadDataToView",BX.proxy(this.onIframeElementLoadDataToView,this));BX.addCustomEvent("onBeforeElementShow",BX.proxy(this.onBeforeElementShow,this));BX.addCustomEvent("onCreateExtendedFolder",BX.proxy(this.onCreateExtendedFolder,this));BX.addCustomEvent("Grid::beforeRequest",this.onBeforeGridRequest.bind(this));BX.addCustomEvent("BX.TileGrid.Grid:beforeReload",this.onBeforeGridRequest.bind(this));if(this.commonGrid.isGrid()){BX.addCustomEvent(this.commonGrid.getContainer(),"Grid::optionsChanged",this.onGridOptionsChanged.bind(this))}BX.addCustomEvent("Grid::updated",this.onGridUpdated.bind(this));BX.addCustomEvent("BX.Main.Filter:beforeApply",this.onBeforeFilterApply.bind(this));BX.addCustomEvent("BX.Main.Filter:apply",this.onFilterApply.bind(this));BX.addCustomEvent("onPopupFileUploadClose",this.onPopupFileUploadClose.bind(this));if(this.isTrashMode){BX.addCustomEvent("onStepperProgress",this.onStepperHasBeenFinished.bind(this));BX.addCustomEvent("onStepperHasBeenFinished",this.onStepperHasBeenFinished.bind(this))}BX.addCustomEvent("Disk.Page:onChangeFolder",this.onChangeFolder.bind(this));BX.addCustomEvent("Disk.TileItem.Item:onItemDblClick",this.onItemDblClick.bind(this));BX.addCustomEvent("Disk.TileItem.Item:onItemEnter",this.onItemDblClick.bind(this));BX.addCustomEvent(this.commonGrid.instance,"TileGrid.Grid:onItemRemove",this.onItemRemove.bind(this));BX.addCustomEvent(this.commonGrid.instance,"TileGrid.Grid:onItemMove",this.onItemMove.bind(this));BX.addCustomEvent("Disk:onChangeDocumentService",this.onChangeDocumentService.bind(this))};FolderListClass.prototype.onBeforeFilterApply=function(e,t,i,s){if(e!==this.filterId){return}this.isFiltetedFolderList=true;s.then(function(){if(i.getSearch().getSearchString()||i.getSearch().getSquares().length){this.blockSorting()}else{this.unblockSorting()}}.bind(this))};FolderListClass.prototype.blockSorting=function(){if(this.commonGrid.isGrid()){this.commonGrid.instance.blockSorting()}this.sort.layout.label.style.pointerEvents="none"};FolderListClass.prototype.unblockSorting=function(){if(this.commonGrid.isGrid()){this.commonGrid.instance.unblockSorting()}this.sort.layout.label.style.pointerEvents=null};var _getSymlinksUnderObjectId=[];FolderListClass.prototype.getSymlinksUnderObjectId=function(e){var t=e.id;if(_getSymlinksUnderObjectId[t]!==undefined){var i=new BX.Promise;i.fulfill(_getSymlinksUnderObjectId[t]);return i}var s=new BX.Promise;BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","showSymlinks"),data:e,onsuccess:function(e){if(!e||!e.status||e.status!=="success"){return}_getSymlinksUnderObjectId[t]=e.items;s.fulfill(_getSymlinksUnderObjectId[t])}.bind(this)});return s};FolderListClass.prototype.needRunFilterUnderLinks=function(){if(!this.filter.getSearch().getSearchString()&&!this.filter.getSearch().getSquares().length){return false}for(var e in this.filterValueToSkipSearchUnderLinks){if(!this.filterValueToSkipSearchUnderLinks.hasOwnProperty(e)){continue}var t=this.filterValueToSkipSearchUnderLinks[e];var i=this.filter.getFilterFieldsValues();if(i[e]==t){return false}}return true};FolderListClass.prototype.showPopupWindowInfo=function(e){this.popupWindowInfo=new BX.PopupWindow("disk-folder-list-popup-info",e,{className:"disk-folder-list-popup-info",autoHide:true,zIndex:200,closeByEsc:true,offsetTop:5,width:e.offsetWidth-20,content:'<span class="disk-folder-list-popup-info-content">'+BX.message("DISK_FOLDER_LIST_SEARCH_INDEX_NOTICE_1")+"</span>"});this.popupWindowInfo.show()};FolderListClass.prototype.onFilterApply=function(e,t,i,s,o){if(this.showSearchNotice&&i.getSearch().getSearchString()){setTimeout(function(){this.showPopupWindowInfo(i.search.container)}.bind(this),200)}if(e!==this.filterId){return}if(this.commonGrid.isTile()){s=s.then(function(){return this.commonGrid.reload()}.bind(this))}if(!this.needRunFilterUnderLinks()){return}this.layout.fileListContainer.classList.add("disk-running-filter");this.runAfterFilterOpenFolder=this.resetFilter.bind(this);var n=BX.Disk.Page.getFolder();n.link=window.location.pathname.toString();var a=function(){var e=BX.Disk.Page.getFolder();return e&&e.id!=n.id};s.then(function(){if(!this.commonGrid.countItems()){if(this.commonGrid.isTile()){this.commonGrid.instance.removeEmptyBlock();this.commonGrid.instance.setMinHeightContainer()}this.commonGrid.fade()}this.getSymlinksUnderObjectId(n).then(function(e){var t=new BX.Promise;var i=t;e.forEach(function(i,s){t=t.then(function(){if(a()){return}var t=new BX.Promise;var o=this.commonGrid.instance;var n={viewGridStorageId:BX.Disk.Page.getStorage().id};if(e.length===s+1){this.removeSearchProcessInConnectedFolders()}else if(this.commonGrid.countItems()>0){this.showSearchProcessInConnectedFolders()}if(this.commonGrid.isGrid()){o.getData().request(i.link,"POST",n,null,function(){if(a()){return}var e=BX.Grid.Utils.getByClass(this.getResponse(),o.settings.get("classBodyRow"));if(BX.type.isArray(e)&&e.length===1&&BX.hasClass(e[0],o.settings.get("classEmptyRows"))){}else if(BX.type.isArray(e)&&e.length===0||!BX.type.isArray(e)){}else{BX.remove(BX.Grid.Utils.getByClass(o.getContainer(),o.settings.get("classEmptyRows"),true));o.adjustEmptyTable(e);o.getUpdater().appendBodyRows(e);o.getRows().reset();o.bindOnRowEvents();o.updateCounterDisplayed();o.updateCounterSelected();o.tableUnfade()}t.fulfill()})}else{var r=BX.ajax.promise({url:BX.util.add_url_param(i.link,{grid_id:this.commonGrid.getId(),internal:true}),method:"POST",dataType:"json",data:n});r.then(function(e){if(this.commonGrid.countItems()){this.commonGrid.unFade()}if(a()){return}e.data.tileGrid.items.forEach(function(e){this.commonGrid.instance.appendItem(e)},this);t.fulfill()}.bind(this))}return t}.bind(this))},this);t.then(function(){this.layout.fileListContainer.classList.remove("disk-running-filter");this.commonGrid.unFade();if(!this.commonGrid.countItems()&&this.commonGrid.isTile()){this.commonGrid.instance.setMinHeightContainer();this.commonGrid.instance.appendEmptyBlock()}}.bind(this));i.fulfill()}.bind(this))}.bind(this))};FolderListClass.prototype.resetFilter=function(){this.isFiltetedFolderList=false;this.filter.getApi().setFields({});this.filter.getSearch().clearForm();this.filter.getSearch().adjustPlaceholder()};FolderListClass.prototype.onChangeDocumentService=function(e){var t=e!=="l";this.commonGrid.getIds().forEach(function(e){var i=this.commonGrid.getActionById(e,"edit");if(!i){return}i.hide=t;var s=this.commonGrid.getActionsMenu(e);s.getMenuItem("edit").hide=t;if(t){BX.addClass(s.getMenuItem("edit").layout.item,"disk-popup-menu-hidden-item")}else{BX.removeClass(s.getMenuItem("edit").layout.item,"disk-popup-menu-hidden-item")}}.bind(this))};FolderListClass.prototype.onItemMove=function(e,t){if(this.isTrashMode){}else{BX.ajax.runAction("disk.api.commonActions.move",{analyticsLabel:"folder.list.dd",data:{objectId:e.getId(),toFolderId:t.getId()}})}};FolderListClass.prototype.onItemRemove=function(e){if(this.isTrashMode){}else{BX.ajax.runAction("disk.api.commonActions.markDeleted",{analyticsLabel:"folder.list.dd",data:{objectId:e.getId()}}).then(function(e){BX.addClass(this.layout.trashCanButton,"pashaPleaseUseSomeClassHere")}.bind(this))}};FolderListClass.prototype.onItemDblClick=function(e){if(e.isFolder){this.onOpenFolder({id:e.getId(),name:e.name,link:e.item.titleLink.href})}else{BX.fireEvent(e.item.titleLink,"click")}};FolderListClass.prototype.onChangeFolder=function(e,t){if(BX.type.isFunction(this.runAfterFilterOpenFolder)){this.runAfterFilterOpenFolder();this.runAfterFilterOpenFolder=null;var i=history.state.folder;i.link=window.location.pathname.toString();BX.onCustomEvent("Disk.FolderListClass:openFolderAfterFilter",[i])}};FolderListClass.prototype.onGridUpdated=function(){};FolderListClass.prototype.onGridOptionsChanged=function(e){var t=e.getUserOptions().getCurrentOptions();this.sort.sortBy=t.last_sort_by;this.sort.direction=t.last_sort_order;var i=this.sortFields.find(function(e){return e.field===this.sort.sortBy},this);if(i){BX.adjust(this.sort.layout.label,{text:i.label})}};FolderListClass.prototype.onBeforeGridRequest=function(e,t){if(this.gridId!==t.gridId){return}if(!t.url){t.url=window.location.pathname+window.location.search}if(t.data.controls){var i={};t.data.rows.forEach(function(e){i[e]={ID:e}});t.data.rows=i}if(t.data.FIELDS||t.data.ID){if(t.data.FIELDS){t.data.rows=t.data.FIELDS}else if(t.data.ID){var s={};t.data.ID.forEach(function(e){s[e]={ID:e}});t.data.rows=s}t.data.FIELDS=null;t.data.ID=null;t.data.controls=t.data.controls||{};if(this.commonGrid.isGrid()){t.data.controls=BX.mergeEx(t.data.controls,BX.clone(t.data))}}};FolderListClass.prototype.runCommandOnObjectId=function(command,objectId){if(!command){return}switch(command.toLowerCase()){case"!disconnect":case"!detach":var menuItem=this.commonGrid.getActionsMenu(objectId).getMenuItem(command.toLowerCase().substr(1));if(!menuItem||!menuItem.onclick){return}eval(menuItem.onclick);break;case"!share":var menuItem=this.commonGrid.getActionsMenu(objectId).getMenuItem("share-section");if(!menuItem||!menuItem.hasSubMenu()){return}menuItem.addSubMenu(menuItem._items);menuItem=menuItem.getSubMenu().getMenuItem(command.toLowerCase().substr(1));if(!menuItem||!menuItem.onclick){return}eval(menuItem.onclick);break;case"!show":var linkWithObject=BX("disk_obj_"+objectId);if(!!linkWithObject){BX.fireEvent(linkWithObject,"click")}break;default:break}};function getObjectDataId(e){var t=this.getRow(e);return{row:this.getRow(e),title:BX.findChild(t.node,{tagName:"a",className:"bx-disk-folder-title"},true),icon:BX.findChild(t.node,function(e){return BX.type.isElementNode(e)&&(BX.hasClass(e,"bx-disk-file-icon")||BX.hasClass(e,"bx-disk-folder-icon"))},true)}}function getIconElementByObjectId(e){var t=this.getRow(e);return BX.findChild(t.node,function(e){return BX.type.isElementNode(e)&&(BX.hasClass(e,"bx-disk-file-icon")||BX.hasClass(e,"bx-disk-folder-icon"))},true)}FolderListClass.prototype.scrollToObject=function(e){var t=this.getRow(e);this.scrollToRow(t)};FolderListClass.prototype.scrollToRow=function(e){var t=e.node;new BX.easing({duration:500,start:{scroll:window.pageYOffset||document.documentElement.scrollTop},finish:{scroll:BX.pos(t).top},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(e){window.scrollTo(0,e.scroll)}}).animate()};FolderListClass.prototype.openMenuWithServices=function(e){var t=new BX.CViewer({});BX.PopupMenu.show("disk_open_menu_with_services",BX(e),[{text:BX.message("DISK_FOLDER_TOOLBAR_LABEL_LOCAL_BDISK_EDIT"),className:"bx-viewer-popup-item item-b24",href:"#",onclick:BX.delegate(function(e){if(BX.CViewer.isEnableLocalEditInDesktop()){this.setEditService("l");BX.adjust(BX("bx-disk-default-service-label"),{text:BX.message("DISK_FOLDER_TOOLBAR_LABEL_LOCAL_BDISK_EDIT")});BX.PopupMenu.destroy("disk_open_menu_with_services")}else{this.helpDiskDialog()}return BX.PreventDefault(e)},t)},{text:t.getNameEditService("google"),className:"bx-viewer-popup-item item-gdocs",href:"#",onclick:BX.delegate(function(e){this.setEditService("google");BX.adjust(BX("bx-disk-default-service-label"),{text:this.getNameEditService("google")});BX.PopupMenu.destroy("disk_open_menu_with_services");return BX.PreventDefault(e)},t)},{text:t.getNameEditService("office365"),className:"bx-viewer-popup-item item-office365",href:"#",onclick:BX.delegate(function(e){this.setEditService("office365");BX.adjust(BX("bx-disk-default-service-label"),{text:this.getNameEditService("office365")});BX.PopupMenu.destroy("disk_open_menu_with_services");return BX.PreventDefault(e)},t)},{text:t.getNameEditService("skydrive"),className:"bx-viewer-popup-item item-office",href:"#",onclick:BX.delegate(function(e){this.setEditService("skydrive");BX.adjust(BX("bx-disk-default-service-label"),{text:this.getNameEditService("skydrive")});BX.PopupMenu.destroy("disk_open_menu_with_services");return BX.PreventDefault(e)},t)}],{angle:{position:"top",offset:45},autoHide:true,overlay:{opacity:.01}})};FolderListClass.prototype.blockFeatures=function(){BX.PopupWindowManager.create("bx-disk-business-tools-info",null,{content:BX("bx-bitrix24-business-tools-info"),closeIcon:true,onPopupClose:function(){this.destroy()},autoHide:true,zIndex:11e3}).show()};FolderListClass.prototype.runCreatingFile=function(e,t){if(BX.message("disk_restriction")){this.blockFeatures();return}if(t==="l"&&BX.Disk.Document.Local.Instance.isEnabled()){BX.Disk.Document.Local.Instance.createFile({type:e,targetFolderId:BX.Disk.Page.getFolder().id}).then(function(e){this.commonGrid.reload(BX.Disk.getUrlToShowObjectInGrid(e.object.id))}.bind(this));return}var i=new BX.Disk.Document.CreateProcess({typeFile:e,targetFolderId:BX.Disk.Page.getFolder().id,serviceCode:t,onAfterSave:function(e){if(e.status==="success"){window.document.location=BX.Disk.getUrlToShowObjectInGrid(e.objectId)}}});i.start()};FolderListClass.prototype.changeView=function(e){var t=BX.getEventTarget(e);if(t&&this.commonGrid.isTile()){e.preventDefault();this.commonGrid.instance.changeTileSize(t.dataset.viewTileSize);for(var i=0;i<this.layout.changeViewButtons.length;++i){this.layout.changeViewButtons[i].classList.remove("disk-folder-list-view-item-active")}t.classList.toggle("disk-folder-list-view-item-active");if(this.shouldUseHistory()){window.history.replaceState(null,null,BX.util.remove_url_param(document.location.toString(),"viewSize"))}BX.ajax.runComponentAction("bitrix:disk.folder.list","saveViewOptions",{analyticsLabel:"tile."+t.dataset.viewTileSize,mode:"class",data:{storageId:BX.Disk.Page.getStorage().id,viewMode:"tile",viewSize:t.dataset.viewTileSize}})}};FolderListClass.prototype.createFolder=function(){var e=this;var t=BX.Disk.modalWindow({modalId:"bx-disk-create-folder",title:BX.message("DISK_FOLDER_TITLE_CREATE_FOLDER"),contentClassName:"",contentStyle:{paddingTop:"30px",paddingBottom:"70px"},events:{onAfterPopupShow:function(){BX.focus(BX("disk-new-create-filename"))},onPopupClose:function(){this.destroy()}},content:[BX.create("label",{props:{className:"bx-disk-popup-label",for:"disk-new-create-filename"},children:[BX.create("span",{props:{className:"req"},text:"*"}),BX.message("DISK_FOLDER_LABEL_NAME_CREATE_FOLDER")]}),BX.create("input",{props:{id:"disk-new-create-filename",className:"bx-disk-popup-input",type:"text",value:""},style:{fontSize:"16px",marginTop:"10px"}})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_BTN_CREATE_FOLDER"),className:"ui-btn ui-btn-success",events:{click:function(){var i=BX("disk-new-create-filename");var s=i.value;if(!s||!s.replace(/\s+/g,"")){BX.addClass(i,"disk-animated disk-animate-shake");i.addEventListener("animationend",function(){BX.removeClass(i,"disk-animated disk-animate-shake")});BX.focus(i);return}this.addClassName("ui-btn-clock");var o=this;BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(e.ajaxUrl,"action","addFolder"),data:{targetFolderId:BX.Disk.Page.getFolder().id,name:s},onsuccess:function(e){if(!e){return}if(e.status&&e.status=="success"){t.close();this.commonGrid.reload(BX.Disk.getUrlToShowObjectInGrid(e.folder.id,{resetFilter:1}),{}).then(function(){this.resetFilter();this.commonGrid.selectItemById(e.folder.id);if(this.commonGrid.isGrid()){var t=this.getRow(e.folder.id);this.scrollToRow(t)}}.bind(this))}else{BX.Disk.showModalWithStatusAction(e);o.removeClassName("ui-btn-clock")}}.bind(e)})}}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CLOSE"),className:"ui-btn ui-btn-link",events:{click:function(){BX.PopupWindowManager.getCurrentPopup().close()}}})]})};FolderListClass.prototype.onClickManageConnectButton=function(e,t){if(e.getIcon()===BX.UI.Button.Icon.DISK){BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","connectToUserStorage"),data:{objectId:this.storage.rootObject.id},onsuccess:BX.delegate(function(t){BX.Disk.showModalWithStatusAction(t);if(t.status!="success"){return}e.setIcon(BX.UI.Button.Icon.DONE);e.setText(BX.message("DISK_FOLDER_LIST_LABEL_ALREADY_CONNECT_DISK"));if(!!t.manage.link){this.storage.manage.link=BX.clone(t.manage.link,true)}},this)})}else if(e.getIcon()===BX.UI.Button.Icon.DONE){this.openConfirmDetach({object:{id:this.storage.manage.link.object.id,name:this.storage.name,isFolder:true},onSuccess:function(t){if(t&&t.status=="success"){t.message=BX.message("DISK_FOLDER_LIST_LABEL_DISCONNECTED_DISK")}BX.Disk.showModalWithStatusAction(t);e.setIcon(BX.UI.Button.Icon.DISK);e.setText(BX.message("DISK_FOLDER_LIST_LABEL_CONNECT_DISK"))}})}};FolderListClass.prototype.showTree=function(e){var t=e.bindElement||null;var i=e.textElement||null;var s=e.valueElement||null;var o=e.onSelect||null;var n=null;var a=null;var r=new BX.Disk.Tree.Modal(this.rootObject,{enableKeyboardNavigation:false,events:{onSelectFolder:function(e,t){if(!e.getAttribute("data-can-add")){BX.removeClass(e,"selected");return}n=t;if(a){BX.removeClass(a,"selected")}a=e;if(n&&s){s.value=n}if(n&&BX.type.isFunction(o)){o(n)}},onUnSelectFolder:function(e){n=null;a=null;var t=BX("grid_group_action_target_object");t&&BX.remove(t)}},modalParameters:{bindElement:t,title:e.title,buttons:e.buttons}});r.show()};FolderListClass.prototype.onClickGetFilesCountAndSizeButtonButton=function(e){BX.Disk.ajax({url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","calculateFileSizeAndCount"),method:"POST",dataType:"json",data:{folderId:this.currentFolder.id},onsuccess:BX.delegate(function(e){if(!e||e.status!="success"){BX.Disk.showModalWithStatusAction(e);return}BX.adjust(this.getFilesCountAndSize.sizeContainer,{text:e.size});BX.adjust(this.getFilesCountAndSize.countContainer,{text:e.count})},this)})};FolderListClass.prototype.onSliderMessage=function(e){var t=e.getData();if(e.getEventId()==="Disk.File:onMarkDeleted"){if(t.objectId){setTimeout(function(){this.removeRow(t.objectId)}.bind(this),500)}}if(e.getEventId()==="Disk.File:onDelete"){if(t.objectId){setTimeout(function(){this.removeRow(t.objectId)}.bind(this),500)}}if(e.getEventId()==="Disk.File:onRestore"){if(t.objectId){setTimeout(function(){this.removeRow(t.objectId)}.bind(this),500)}}if(e.getEventId()==="Disk.File:onNewVersionUploaded"){this.commonGrid.reload(BX.SidePanel.Instance.getPageUrl())}if(e.getEventId()==="Disk.File:onAddSharing"){this.showSharingIcon(t.objectId)}};FolderListClass.prototype.onPopState=function(e){var t=e.state;if(!t||!t.disk||!t.folder){window.location.reload();return}if(!t.folder.link){t.folder.link=window.location.pathname.toString()}BX.onCustomEvent("Disk.FolderListClass:onPopState",[t.folder]);this.openFolder(t.folder.id,t.folder)};FolderListClass.prototype.openGridFolder=function(e){if(e.shiftKey||e.ctrlKey){return}var t=e.target||e.srcElement;if(!t.dataset.objectId){return}var i=this.getRow(t.dataset.objectId);var s=BX.findChildByClassName(i.node,"js-disk-grid-folder");BX.fireEvent(s,"click")};FolderListClass.prototype.onOpenFolderByAnchor=function(e){var t={id:e.dataset.objectId,canAdd:e.dataset.canAdd,link:e.href,name:e.textContent.trim(),node:e};return this.onOpenFolder(t)};FolderListClass.prototype.onOpenFolder=function(e){if(!e.id){return false}BX.onCustomEvent("Disk.FolderListClass:onFolderBeforeOpen",[e]);var t={disk:true,folder:{id:e.id,name:e.name}};if(this.shouldUseHistory()){window.history.pushState(t,null,e.link)}BX.onCustomEvent("Window:onPushState",[t,null,e.link]);this.openFolder(e.id,e);return true};FolderListClass.prototype.openFolderContextMenu=function(e,t,i,s){t.preventDefault();s.link=e.href;s.id=i;this.onOpenFolder(s)};FolderListClass.prototype.openFolder=function(e,t){this.commonGrid.reload(t.link,{resetFilter:1}).then(function(){BX.onCustomEvent("Disk.FolderListClass:onFolderOpen",[t,this.isFiltetedFolderList]);this.removeSearchProcessInConnectedFolders();BX.Disk.Page.changeFolder({id:t.id,name:t.name});if(t.canAdd===undefined){BX.ajax.runAction("disk.api.folder.getAllowedOperationsRights",{analyticsLabel:"folder.list",data:{folderId:t.id}}).then(function(e){var i=e.data.operations;i.disk_add?this.unblockCreateItemsButton():this.blockCreateItemsButton();t.canAdd=!!i.disk_add}.bind(this))}else{t.canAdd?this.unblockCreateItemsButton():this.blockCreateItemsButton()}window.scroll(0,0)}.bind(this))};FolderListClass.prototype.onClickDeleteGroup=function(e){if(!this.commonGrid.instance.IsActionEnabled())return false;var t=document.getElementById("actallrows_"+this.commonGrid.instance.table_id);this.openConfirmDeleteGroup({attemptDeleteAll:t&&t.checked});BX.PreventDefault(e);return false};FolderListClass.prototype.removeRow=function(e){this.commonGrid.removeItemById(e);BX.onCustomEvent("onRemoveRowFromDiskList",[e])};FolderListClass.prototype.getRow=function(e){return this.commonGrid.instance.getRows().getById(e)};FolderListClass.prototype.blockCreateItemsButton=function(){if(this.layout.createItemsButton){this.layout.createItemsButton.classList.add("ui-btn-disabled")}if(this.layout.emptyBlockUploadFileButtonId){BX.addClass(this.layout.emptyBlockUploadFileButtonId,"disk-folder-list-no-data-disabled")}if(this.layout.emptyBlockCreateFolderButtonId){BX.addClass(this.layout.emptyBlockCreateFolderButtonId,"disk-folder-list-no-data-disabled")}};FolderListClass.prototype.unblockCreateItemsButton=function(){if(this.layout.createItemsButton){this.layout.createItemsButton.classList.remove("ui-btn-disabled")}if(this.layout.emptyBlockUploadFileButtonId){BX.removeClass(this.layout.emptyBlockUploadFileButtonId,"disk-folder-list-no-data-disabled")}if(this.layout.emptyBlockCreateFolderButtonId){BX.removeClass(this.layout.emptyBlockCreateFolderButtonId,"disk-folder-list-no-data-disabled")}};FolderListClass.prototype.renameInline=function(e){if(this.commonGrid.isTile()){var t=this.commonGrid.instance.getItem(e);if(t){t.onRename()}return}this.commonGrid.instance.getRows().unselectAll();var i=this.commonGrid.instance.getRows().getById(e);i.select();this.commonGrid.instance.editSelected();var s=BX.Grid.Utils.getByClass(i.getNode(),"main-grid-editor-container",true);var o=BX.findChild(s,{tag:"input"},true);if(o){BX.bind(o,"keydown",function(e){if(e.key==="Enter"){e.stopPropagation();e.preventDefault();this.commonGrid.instance.editSelectedSave()}if(e.key==="Escape"){this.commonGrid.instance.editSelectedCancel()}}.bind(this));BX.focus(o)}};FolderListClass.prototype.processGridGroupActionRestore=function(){if(!this.commonGrid.isGrid()){return}var e=this.commonGrid.instance.getRows().getSelectedIds();if(!e.length){return}BX.ajax.runAction("disk.api.commonActions.restoreCollection",{analyticsLabel:"folder.list",data:{objectCollection:e}}).then(function(e){if(e.status==="success"){var t=e.data.restoredObjectIds.pop();window.document.location=BX.Disk.getUrlToShowObjectInGrid(t)}}.bind(this))};FolderListClass.prototype.openConfirmRestore=function(e){var t=e.object.name;var i=e.object.id;var s=e.object.isFolder;var o="";if(s){o=BX.message("DISK_TRASHCAN_TRASH_RESTORE_FOLDER_CONFIRM")}else{o=BX.message("DISK_TRASHCAN_TRASH_RESTORE_FILE_CONFIRM")}var n=this;var a=[new BX.PopupWindowCustomButton({text:BX.message("DISK_TRASHCAN_ACT_RESTORE"),className:"ui-btn ui-btn-success",events:{click:function(e){this.addClassName("ui-btn-clock");BX.ajax.runAction("disk.api.commonActions.restore",{analyticsLabel:"folder.list",data:{objectId:i}}).then(function(e){BX.PopupWindowManager.getCurrentPopup().close();this.commonGrid.selectItemById(i);window.document.location=BX.Disk.getUrlToShowObjectInGrid(e.data.object.id)}.bind(n))}}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})];BX.Disk.modalWindow({modalId:"bx-link-unlink-confirm",title:BX.message("DISK_TRASHCAN_TRASH_RESTORE_TITLE"),contentClassName:"tac",contentStyle:{paddingTop:"70px",paddingBottom:"70px"},content:o.replace("#NAME#",t),buttons:a})};FolderListClass.prototype.copyLinkInternalLink=function(e,t){t.classList.add("menu-popup-item-accept","disk-folder-list-context-menu-item-accept-animate");BX.clipboard.copy(e)};FolderListClass.prototype.openConfirmDelete=function(e){var t=e.object.name;var i=e.object.id;var s=e.object.isFolder;var o=e.object.isDeleted;var n=e.canDelete;var a="";if(s){a=BX.message(n?"DISK_FOLDER_LIST_TRASH_DELETE_DESTROY_FOLDER_CONFIRM":"DISK_FOLDER_LIST_TRASH_DELETE_FOLDER_CONFIRM")}else{a=BX.message(n?"DISK_FOLDER_LIST_TRASH_DELETE_DESTROY_FILE_CONFIRM":"DISK_FOLDER_LIST_TRASH_DELETE_FILE_CONFIRM")}if(o){a=s?BX.message("DISK_FOLDER_LIST_TRASH_DELETE_DESTROY_DELETED_FOLDER_CONFIRM"):BX.message("DISK_FOLDER_LIST_TRASH_DELETE_DESTROY_DELETED_FILE_CONFIRM")}var r=this;var d=[];if(!o){d.push(new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TRASH_DELETE_BUTTON"),className:"ui-btn ui-btn-success",events:{click:function(e){this.addClassName("ui-btn-clock");BX.ajax.runAction("disk.api.commonActions.markDeleted",{analyticsLabel:"folder.list",data:{objectId:i}}).then(function(e){BX.PopupWindowManager.getCurrentPopup().close();r.removeRow(i)})}}}))}if(n){d.push(new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TRASH_DESTROY_BUTTON"),className:"ui-btn ui-btn-light-border",events:{click:function(e){this.addClassName("ui-btn-clock");BX.ajax.runAction("disk.api.commonActions.delete",{analyticsLabel:"folder.list",data:{objectId:i}}).then(function(e){BX.PopupWindowManager.getCurrentPopup().close();r.removeRow(i)})}}}))}d.push(new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TRASH_CANCEL_DELETE_BUTTON"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}}));BX.Disk.modalWindow({modalId:"bx-link-unlink-confirm",title:BX.message("DISK_FOLDER_LIST_TRASH_DELETE_TITLE"),contentClassName:"disk-popup-text-content",content:a.replace("#NAME#",t),buttons:d})};FolderListClass.prototype.onPopupFileUploadClose=function(e,t){this.commonGrid.reload(BX.Disk.getUrlToShowObjectInGrid(t,{resetFilter:1})).then(function(){this.resetFilter();this.commonGrid.selectItemById(t);if(this.commonGrid.isGrid()){var e=this.getRow(t);this.scrollToRow(e)}}.bind(this))};FolderListClass.prototype.onStepperHasBeenFinished=function(e){this.commonGrid.reload()};var alreadyRunEmptyTrash=false;FolderListClass.prototype.openConfirmEmptyTrash=function(){var e=this.storage.id;var t=[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TITLE_EMPTY_TRASH"),className:"ui-btn ui-btn-success",events:{click:function(t){this.addClassName("ui-btn-clock");if(alreadyRunEmptyTrash){BX.PopupWindowManager.getCurrentPopup().close();return}alreadyRunEmptyTrash=true;BX.ajax.runAction("disk.api.trashcan.empty",{analyticsLabel:"folder.list",data:{storageId:e}}).then(function(e){BX.ajax.runComponentAction("bitrix:disk.folder.list","getSteppers",{mode:"class"}).then(function(e){if(e.data.html){var t=BX("disk-folder-list-place-for-stepper");if(t){BX.html(t,e.data.html)}}});BX.PopupWindowManager.getCurrentPopup().close()},function(e){BX.Disk.showModalWithStatusAction(e);BX.PopupWindowManager.getCurrentPopup().close()})}}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})];BX.Disk.modalWindow({modalId:"bx-link-empty-trash-confirm",title:BX.message("DISK_FOLDER_LIST_TITLE_EMPTY_TRASH_TITLE"),contentClassName:"disk-popup-text-content",content:BX.message("DISK_FOLDER_LIST_TRASH_EMPTY_TRASH_DESCRIPTION"),buttons:t})};FolderListClass.prototype.openConfirmDetach=function(e){var t=e.object.name;var i=e.object.id;var s=e.object.isFolder;var o=e.onSuccess;var n="";if(s){n=BX.message("DISK_FOLDER_LIST_DETACH_FOLDER_CONFIRM")}else{n=BX.message("DISK_FOLDER_LIST_DETACH_FILE_CONFIRM")}var a=[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_DETACH_BUTTON"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(e){BX.PopupWindowManager.getCurrentPopup().destroy();BX.PreventDefault(e);BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","detach"),data:{objectId:i},onsuccess:BX.delegate(function(e){if(!e){return}if(e.status=="success"){if(BX.type.isFunction(o)){BX.delegate(o,this)(e)}else{this.removeRow(i)}return}BX.Disk.showModalWithStatusAction(e)},this)});return false},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TRASH_CANCEL_DELETE_BUTTON"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})];BX.Disk.modalWindow({modalId:"bx-link-unlink-confirm",title:s?BX.message("DISK_FOLDER_LIST_DETACH_FOLDER_TITLE"):BX.message("DISK_FOLDER_LIST_DETACH_FILE_TITLE"),contentClassName:"tac",contentStyle:{paddingTop:"70px",paddingBottom:"70px"},content:n.replace("#NAME#",t),buttons:a})};FolderListClass.prototype.openConfirmDeleteGroup=function(){var e=BX.message("DISK_FOLDER_LIST_TRASH_DELETE_GROUP_CONFIRM");var t=[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TRASH_DELETE_BUTTON"),className:"ui-btn ui-btn-success",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy();var t={};t[this.commonGrid.getActionKey()]="delete";var i={rows:this.commonGrid.getSelectedIds(),controls:t};this.commonGrid.reload(null,i).then(function(){BX.PopupWindowManager.getCurrentPopup().destroy()})}.bind(this)}})];var i=false;if(i){t.push(new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TRASH_DESTROY_BUTTON"),events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy();var t={};t[this.commonGrid.getActionKey()]="destroy";var i={rows:this.commonGrid.getSelectedIds(),controls:t};this.commonGrid.reload(null,i).then(function(){BX.PopupWindowManager.getCurrentPopup().destroy()})}.bind(this)}}))}t.push(new BX.PopupWindowCustomButton({className:"ui-btn ui-btn-link",text:BX.message("DISK_FOLDER_LIST_TRASH_CANCEL_DELETE_BUTTON"),events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}}));BX.Disk.modalWindow({modalId:"bx-link-unlink-confirm",title:BX.message("DISK_FOLDER_LIST_TRASH_DELETE_TITLE"),contentClassName:"tac",contentStyle:{paddingTop:"70px",paddingBottom:"70px"},content:e,buttons:t})};FolderListClass.prototype.openConfirmDestroyGroup=function(){var e=BX.message("DISK_FOLDER_LIST_TRASH_DESTROY_GROUP_CONFIRM");var t=[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TRASH_DESTROY_BUTTON"),className:"ui-btn ui-btn-success",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy();var t={};t[this.commonGrid.getActionKey()]="destroy";var i={rows:this.commonGrid.getSelectedIds(),controls:t};this.commonGrid.reload(null,i).then(function(){BX.PopupWindowManager.getCurrentPopup().destroy()})}.bind(this)}}),new BX.PopupWindowCustomButton({className:"ui-btn ui-btn-link",text:BX.message("DISK_JS_BTN_CANCEL"),events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})];BX.Disk.modalWindow({modalId:"bx-link-unlink-confirm",title:BX.message("DISK_FOLDER_LIST_TRASH_DELETE_TITLE"),contentClassName:"disk-popup-text-content",content:e,buttons:t})};FolderListClass.prototype.downloadGroup=function(){var e=this.commonGrid.getSelectedIds();if(!e.length){return}BX.ajax.runAction("disk.api.commonActions.getArchiveLink",{analyticsLabel:"folder.list",data:{objectCollection:e}}).then(function(e){document.location=e.data.downloadArchiveUri}).catch(function(e){BX.Disk.showModalWithStatusAction(e)}.bind(this))};FolderListClass.prototype.openConfirmCopyGroup=function(){var e;var t=this;var i=[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TITLE_GRID_TOOLBAR_COPY_BUTTON"),className:"ui-btn ui-btn-success",events:{click:function(i){if(!e){return}this.addClassName("ui-btn-clock");var s={};s[t.commonGrid.getActionKey()]="copy";s["destinationFolderId"]=e;var o={rows:t.commonGrid.getSelectedIds(),controls:s};t.commonGrid.reload(null,o).then(function(){BX.PopupWindowManager.getCurrentPopup().destroy()})}}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})];this.showTree({title:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_MANY_COPY_TO"),buttons:i,onSelect:function(t){e=t}})};FolderListClass.prototype.openConfirmMoveGroup=function(){var e;var t=this;var i=[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TITLE_GRID_TOOLBAR_MOVE_BUTTON"),className:"ui-btn ui-btn-success",events:{click:function(i){if(!e){return}this.addClassName("ui-btn-clock");var s={};s[t.commonGrid.getActionKey()]="move";s["destinationFolderId"]=e;var o={rows:t.commonGrid.getSelectedIds(),controls:s};t.commonGrid.reload(null,o).then(function(){BX.PopupWindowManager.getCurrentPopup().destroy()})}}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})];this.showTree({title:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_MANY_MOVE_TO"),buttons:i,onSelect:function(t){e=t}})};FolderListClass.prototype.connectObjectToDisk=function(e){var t=e.object.name;var i=e.object.id;var s=e.object.isFolder;BX.Disk.ajaxPromise({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","connectToUserStorage"),data:{objectId:i}}).then(function(e){if(!e){return}if(e.status=="success"){this.commonGrid.getActionById(i,"connect").hide=true;var o=this.commonGrid.getActionsMenu(i);o.getMenuItem("connect").hide=true;BX.addClass(o.getMenuItem("connect").layout.item,"disk-popup-menu-hidden-item");BX.Disk.showModalWithStatusAction({status:"success",message:s?BX.message("DISK_FOLDER_LIST_SUCCESS_CONNECT_TO_DISK_FOLDER").replace("#NAME#",t):BX.message("DISK_FOLDER_LIST_SUCCESS_CONNECT_TO_DISK_FILE").replace("#NAME#",t)})}else{e.errors=e.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:e.errors.pop().message})}}.bind(this))};FolderListClass.prototype.unlockFile=function(e){var t=e.object.name;var i=e.object.id;BX.Disk.ajaxPromise({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","unlock"),data:{objectId:i}}).then(function(e){if(!e){return}if(e.status=="success"){this.commonGrid.getActionById(i,"lock").hide=false;this.commonGrid.getActionById(i,"unlock").hide=true;var t=this.commonGrid.getActionsMenu(i);t.getMenuItem("lock").hide=false;t.getMenuItem("unlock").hide=true;BX.removeClass(t.getMenuItem("lock").layout.item,"disk-popup-menu-hidden-item");BX.addClass(t.getMenuItem("unlock").layout.item,"disk-popup-menu-hidden-item");this.hideLockIcon(i)}else{e.errors=e.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:e.errors.pop().message})}}.bind(this))};FolderListClass.prototype.lockFile=function(e){var t=e.object.name;var i=e.object.id;BX.Disk.ajaxPromise({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","lock"),data:{objectId:i}}).then(function(e){if(!e){return}if(e.status=="success"){this.commonGrid.getActionById(i,"unlock").hide=false;this.commonGrid.getActionById(i,"lock").hide=true;var t=this.commonGrid.getActionsMenu(i);t.getMenuItem("unlock").hide=false;t.getMenuItem("lock").hide=true;BX.removeClass(t.getMenuItem("unlock").layout.item,"disk-popup-menu-hidden-item");BX.addClass(t.getMenuItem("lock").layout.item,"disk-popup-menu-hidden-item");this.showLockIcon(i)}else{e.errors=e.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:e.errors.pop().message})}}.bind(this))};FolderListClass.prototype.showSharingIcon=function(e){if(this.commonGrid.isTile()){var t=this.commonGrid.instance.getItem(e);t&&t.markAsShared()}else{var i=this.getRow(e);var s=BX.findChildByClassName(i.node,"bx-disk-file-icon",true)||BX.findChildByClassName(i.node,"bx-disk-folder-icon",true);if(s){BX.addClass(s,"icon-shared shared icon-shared_1 icon-shared_2")}}};FolderListClass.prototype.hideSharingIcon=function(e){if(this.commonGrid.isTile()){var t=this.commonGrid.instance.getItem(e);t&&t.unmarkAsShared()}else{var i=this.getRow(e);var s=BX.findChildByClassName(i.node,"bx-disk-file-icon",true)||BX.findChildByClassName(i.node,"bx-disk-folder-icon",true);if(s){BX.removeClass(s,"icon-shared shared icon-shared_1 icon-shared_2")}}};FolderListClass.prototype.showLockIcon=function(e){if(this.commonGrid.isGrid()){var t=this.getRow(e);var i=BX.findChildByClassName(t.node,"js-lock-icon",true);if(i){BX.show(i,"block")}}else{var s=this.commonGrid.instance.getItem(e);s.lock()}};FolderListClass.prototype.hideLockIcon=function(e){if(this.commonGrid.isGrid()){var t=this.getRow(e);var i=BX.findChildByClassName(t.node,"js-lock-icon",true);if(i){BX.hide(i,"block")}}else{var s=this.commonGrid.instance.getItem(e);s.unlock()}};FolderListClass.prototype.sortByColumn=function(e,t){t=t||"desc";this.sort.sortBy=e;this.sort.direction=t.toLowerCase();this.commonGrid.sortByColumn({sort_by:this.sort.sortBy,sort_order:this.sort.direction})};FolderListClass.prototype.showGridSortingMenu=function(e){var t=BX.getEventTarget(e);var i=function(e){if(t){BX.adjust(t,{text:e.text})}};var s=function(e){e.layout.item.classList.toggle("menu-popup-item-accept");e.layout.item.classList.toggle("menu-popup-no-icon")};var o=[];this.sortFields.forEach(function(e){o.push({title:e.label,text:e.label,field:e.field,onclick:function(e,t){this.sortByColumn(t.field,"desc");i(t);t.menuWindow.close()}.bind(this)})},this);o.push({delimiter:true},{title:BX.message("DISK_FOLDER_LIST_LABEL_SORT_INVERSE_DIRECTION"),text:BX.message("DISK_FOLDER_LIST_LABEL_SORT_INVERSE_DIRECTION"),className:this.sort.direction==="desc"?"menu-popup-item menu-popup-item-accept":"",onclick:function(e,t){this.inverseSortByColumn();s(t);t.menuWindow.close()}.bind(this)},{delimiter:true},{title:BX.message("DISK_FOLDER_LIST_LABEL_SORT_MIX_MODE"),text:BX.message("DISK_FOLDER_LIST_LABEL_SORT_MIX_MODE"),className:this.sort.mix?"menu-popup-item menu-popup-item-accept":"",onclick:function(e,t){this.toggleMixSort();s(t);t.menuWindow.close()}.bind(this)});BX.PopupMenu.create("disk-folder-list-sorting-menu",this.sort.layout.label,o,{autoHide:true,className:"disk-folder-list-sorting-menu",offsetTop:0,offsetLeft:35,angle:{offset:45},events:{onPopupClose:function(){BX.PopupMenu.destroy("disk-folder-list-sorting-menu");this.destroy()}}}).show()};FolderListClass.prototype.inverseSortByColumn=function(){var e=this.sort.direction==="desc"?"asc":"desc";this.sortByColumn(this.sort.sortBy,e)};FolderListClass.prototype.toggleMixSort=function(){if(this.sort.mix){this.disableMixSort()}else{this.enableMixSort()}};FolderListClass.prototype.enableMixSort=function(){this.sort.mix=true;this.commonGrid.reload("",{sortMode:"mix"})};FolderListClass.prototype.disableMixSort=function(){this.sort.mix=false;this.commonGrid.reload("",{sortMode:"ord"})};FolderListClass.prototype.openExternalLinkDetailSettingsWithEditing=function(e){BX.Disk.modalWindowActionLoader("disk.api.commonActions.generateExternalLink",{analyticsLabel:"folder.list",id:"bx-disk-external-link-loader",postData:{objectId:e},afterSuccessLoad:function(t){if(!t||t.status!="success"){BX.Disk.showModalWithStatusAction(t);return}var i=new BX.Disk.Model.ExternalLink.Input({state:t.data.externalLink,data:{objectId:e},models:{externalLinkSettings:new BX.Disk.Model.ExternalLink.Settings({state:t.data.externalLink}),externalLinkDescription:new BX.Disk.Model.ExternalLink.Description({state:t.data.externalLink})}});i.render();BX.Disk.modalWindow({modalId:"bx-disk-external-link",title:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_GET_EXT_LINK"),contentClassName:"disk-popup-external-link-config",contentStyle:{},events:{onPopupClose:function(){this.destroy()}},content:[i.getContainer()],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_BTN_SAVE"),className:"ui-btn ui-btn-success",events:{click:function(){i.externalLinkSettings.save();BX.PopupWindowManager.getCurrentPopup().close();setTimeout(function(){BX.Disk.showModalWithStatusAction({status:"success"})},300)}}}),new BX.PopupWindowCustomButton({className:"ui-btn ui-btn-link",text:BX.message("DISK_JS_BTN_CLOSE"),events:{click:function(){BX.PopupWindowManager.getCurrentPopup().close()}}})]})}})};FolderListClass.prototype.onBeforeElementShow=function(e,t,i){if(t.hasOwnProperty("image")||!BX.message("disk_restriction")){return}i.prevent=true;BX.PopupWindowManager.create("bx-disk-business-tools-info",null,{content:BX("bx-bitrix24-business-tools-info"),closeIcon:true,onPopupClose:function(){this.destroy()},autoHide:true,zIndex:11e3}).show()};FolderListClass.prototype.onIframeElementLoadDataToView=function(e,t){if(t&&t.status==="restriction"&&BX("bx-bitrix24-business-tools-info")){if(BX.CViewer&&BX.CViewer.objNowInShow){if(e.currentModalWindow){e.currentModalWindow.close()}BX.CViewer.objNowInShow.close()}BX.PopupWindowManager.create("bx-disk-business-tools-info",null,{content:BX("bx-bitrix24-business-tools-info"),closeIcon:true,onPopupClose:function(){this.destroy()},autoHide:true,zIndex:11e3}).show()}};FolderListClass.prototype.getExternalLink=function(e){var t=BX.delegate(getObjectDataId,this)(e);var i=BX.hasClass(t.icon,"bx-disk-folder-icon");var s=this.ajaxUrl;s=BX.Disk.addToLinkParam(s,"action","generateExternalLink");s=BX.Disk.addToLinkParam(s,"isFolder",i);BX.Disk.modalWindowLoader(s,{id:"bx-disk-external-link-loader",responseType:"json",postData:{objectId:e},afterSuccessLoad:BX.delegate(function(t){if(!t||t.status!="success"){BX.Disk.showModalWithStatusAction(t);return}this.cacheExternalLinks[e]=t.link;BX.Disk.modalWindow({modalId:"bx-disk-external-link",title:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_GET_EXT_LINK"),contentClassName:"tac",contentStyle:{},events:{onAfterPopupShow:function(){var e=BX("disk-get-external-link");BX.focus(e);e.setSelectionRange(0,e.value.length)},onPopupClose:function(){this.destroy()}},content:[BX.create("label",{props:{className:"bx-disk-popup-label",for:"disk-get-external-link"}}),BX.create("input",{style:{marginTop:"10px"},props:{id:"disk-get-external-link",className:"bx-viewer-inp",type:"text",value:t.link}})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CLOSE"),className:"ui-btn ui-btn-link",events:{click:function(){BX.PopupWindowManager.getCurrentPopup().close()}}})]})},this)});return false};FolderListClass.prototype.getInternalLink=function(e){BX.Disk.modalWindow({modalId:"bx-disk-internal-link",title:BX.message("DISK_FOLDER_LIST_ACT_COPY_INTERNAL_LINK"),contentClassName:"tac",contentStyle:{},events:{onAfterPopupShow:function(){var e=BX("disk-get-internal-link");BX.focus(e);e.setSelectionRange(0,e.value.length)},onPopupClose:function(){this.destroy()}},content:[BX.create("label",{props:{className:"bx-disk-popup-label",for:"disk-get-internal-link"}}),BX.create("input",{style:{marginTop:"10px"},props:{id:"disk-get-internal-link",className:"bx-viewer-inp",type:"text",value:e}})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CLOSE"),className:"ui-btn ui-btn-link",events:{click:function(){BX.PopupWindowManager.getCurrentPopup().close()}}})]})};FolderListClass.prototype.openCopyModalWindow=function(e,t){var i=null;var s=null;var o=new BX.Disk.Tree.Modal(this.rootObject,{events:{onSelectFolder:function(e,t){if(!e.getAttribute("data-can-add")){BX.removeClass(e,"selected");return}if(s){BX.removeClass(s,"selected")}i=t;s=e},onUnSelectFolder:function(){i=null;s=null}},modalParameters:{title:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_TREE"),contentTitle:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_COPY_TO").replace("#NAME#",t.name),buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_COPY_TO_BUTTON"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(e){if(!i){BX.PreventDefault(e);return false}BX.PopupWindowManager.getCurrentPopup().close();BX.PreventDefault(e);BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","copyTo"),data:{objectId:t.id,targetObjectId:i},onsuccess:function(e){if(!e){return}if(e.status=="success"){if(e.isFolder){e.message=BX.message("DISK_FOLDER_LIST_OK_FOLDER_COPIED").replace("#FOLDER#",e.name)}else{e.message=BX.message("DISK_FOLDER_LIST_OK_FILE_COPIED").replace("#FILE#",e.name)}e.message=e.message.replace("#TARGET_FOLDER#",e.destination.name);BX.Disk.showModalWithStatusAction(e);return}BX.Disk.showModalWithStatusAction(e)}});return false},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})]}});o.show()};FolderListClass.prototype.openMoveModalWindow=function(e,t){var i=null;var s=null;var o=new BX.Disk.Tree.Modal(this.rootObject,{events:{onSelectFolder:function(e,t){if(!e.getAttribute("data-can-add")){BX.removeClass(e,"selected");return}if(s){BX.removeClass(s,"selected")}i=t;s=e},onUnSelectFolder:function(){i=null;s=null}},modalParameters:{title:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_TREE"),contentTitle:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_MOVE_TO").replace("#NAME#",t.name),buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_TITLE_MODAL_MOVE_TO_BUTTON"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(e){if(!i){BX.PreventDefault(e);return false}BX.PopupWindowManager.getCurrentPopup().close();BX.PreventDefault(e);BX.Disk.ajaxPromise({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","moveTo"),data:{objectId:t.id,targetObjectId:i}}).then(function(e){if(this.commonGrid.isGrid()){this.commonGrid.instance.getRows().unselectAll()}this.commonGrid.selectItemById(t.id);this.commonGrid.reload();if(e.isFolder){e.message=BX.message("DISK_FOLDER_LIST_OK_FOLDER_MOVED").replace("#FOLDER#",e.name)}else{e.message=BX.message("DISK_FOLDER_LIST_OK_FILE_MOVED").replace("#FILE#",e.name)}e.message=e.message.replace("#TARGET_FOLDER#",e.destination.name);BX.Disk.showModalWithStatusAction(e)}.bind(this));return false},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})]}});o.show()};var isChangedRights=false;var storageNewRights={};var originalRights={};var detachedRights={};var moduleTasks={};var entityToNewShared={};var loadedReadOnlyEntityToNewShared={};var entityToNewSharedMaxTaskName="";FolderListClass.prototype.showSharingDetailWithChangeRights=function(e){entityToNewShared={};loadedReadOnlyEntityToNewShared={};e=e||{};var t=e.object.id;BX.Disk.modalWindowLoader(BX.Disk.addToLinkParam(this.ajaxUrl,"action","showSharingDetailChangeRights"),{id:"folder_list_sharing_detail_object_"+t,responseType:"json",postData:{objectId:t},afterSuccessLoad:BX.delegate(function(i){if(i.status!="success"){i.errors=i.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:i.errors.pop().message})}var s={name:i.owner.name,avatar:i.owner.avatar,link:i.owner.link};BX.Disk.modalWindow({modalId:"bx-disk-detail-sharing-folder-change-right",title:BX.message("DISK_FOLDER_LIST_SHARING_TITLE_MODAL_2"),contentClassName:"",contentStyle:{},events:{onAfterPopupShow:BX.delegate(function(){BX.addCustomEvent("onChangeRightOfSharing",BX.proxy(this.onChangeRightOfSharing,this));for(var e in i.members){if(!i.members.hasOwnProperty(e)){continue}entityToNewShared[i.members[e].entityId]={item:{id:i.members[e].entityId,name:i.members[e].name,avatar:i.members[e].avatar},type:i.members[e].type,right:i.members[e].right}}BX.SocNetLogDestination.init({name:this.destFormName,searchInput:BX("feed-add-post-destination-input"),bindMainPopup:{node:BX("feed-add-post-destination-container"),offsetTop:"5px",offsetLeft:"15px"},bindSearchPopup:{node:BX("feed-add-post-destination-container"),offsetTop:"5px",offsetLeft:"15px"},callback:{select:BX.proxy(this.onSelectDestination,this),unSelect:BX.proxy(this.onUnSelectDestination,this),openDialog:BX.proxy(this.onOpenDialogDestination,this),closeDialog:BX.proxy(this.onCloseDialogDestination,this),openSearch:BX.proxy(this.onOpenSearchDestination,this),closeSearch:BX.proxy(this.onCloseSearchDestination,this)},items:i.destination.items,itemsLast:i.destination.itemsLast,itemsSelected:i.destination.itemsSelected});var t=this.destFormName;BX.bind(BX("feed-add-post-destination-container"),"click",function(e){BX.SocNetLogDestination.openDialog(t);BX.PreventDefault(e)});BX.bind(BX("feed-add-post-destination-input"),"keyup",BX.proxy(this.onKeyUpDestination,this));BX.bind(BX("feed-add-post-destination-input"),"keydown",BX.proxy(this.onKeyDownDestination,this))},this),onPopupClose:BX.delegate(function(){if(BX.SocNetLogDestination&&BX.SocNetLogDestination.isOpenDialog()){BX.SocNetLogDestination.closeDialog()}BX.removeCustomEvent("onChangeRightOfSharing",BX.proxy(this.onChangeRightOfSharing,this));BX.proxy_context.destroy()},this)},content:[BX.create("div",{props:{className:"bx-disk-popup-content"},children:[BX.create("table",{props:{className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_OWNER")+"</td>"+"</tr>"}),BX.create("tr",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-col1" style="border-bottom: none;"><a class="bx-disk-filepage-used-people-link" href="'+s.link+'"><span class="bx-disk-filepage-used-people-avatar" style="background-image: url('+s.avatar+');"></span>'+BX.util.htmlspecialchars(s.name)+"</a></td>"+"</tr>"})]}),BX.create("table",{props:{id:"bx-disk-popup-shared-people-list",className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS_USER")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col2">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col3"></td>'+"</tr>"})]}),BX.create("div",{props:{id:"feed-add-post-destination-container",className:"feed-add-post-destination-wrap"},children:[BX.create("span",{props:{className:"feed-add-post-destination-item"}}),BX.create("span",{props:{id:"feed-add-post-destination-input-box",className:"feed-add-destination-input-box"},style:{background:"transparent"},children:[BX.create("input",{props:{type:"text",value:"",id:"feed-add-post-destination-input",className:"feed-add-destination-inp"}})]}),BX.create("a",{props:{href:"#",id:"bx-destination-tag",className:"feed-add-destination-link"},style:{background:"transparent"},text:BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_ADD_RIGHTS_USER"),events:{click:BX.delegate(function(){},this)}})]})]})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_BTN_SAVE"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(){BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","changeSharingAndRights"),data:{objectId:t,entityToNewShared:entityToNewShared},onsuccess:BX.delegate(function(i){if(!i){return}if(e.object.isFolder){i.message=BX.message("DISK_FOLDER_LIST_OK_FOLDER_SHARE_MODIFIED").replace("#FOLDER#",e.object.name)}else{i.message=BX.message("DISK_FOLDER_LIST_OK_FILE_SHARE_MODIFIED").replace("#FILE#",e.object.name)}BX.Disk.showModalWithStatusAction(i);this.showSharingIcon(t)},this)});BX.PopupWindowManager.getCurrentPopup().close()},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})]})},this)})};function showAccessCodeFullName(e){e=e||{};return(e.provider?e.provider+": ":"")+e.name}FolderListClass.prototype.showRights=function(e){e=e||{};var t=e.object.id;var i={};BX.Disk.modalWindowLoader(BX.Disk.addToLinkParam(this.ajaxUrl,"action","showRightsDetail"),{id:"folder_list_sharing_detail_object_"+t,responseType:"json",postData:{objectId:t},afterSuccessLoad:BX.delegate(function(e){if(e.status!="success"){e.errors=e.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:e.errors.pop().message})}for(var t in e.rights){if(!e.rights.hasOwnProperty(t)){continue}var s=e.rights[t];for(var o in s){if(!s.hasOwnProperty(o)){continue}i[t]={readOnly:true,item:{id:t,name:showAccessCodeFullName(e.accessCodeNames[t]),avatar:null},type:"group",right:{title:s[o].TASK.TITLE}}}}BX.Disk.modalWindow({modalId:"bx-disk-detail-sharing-folder-change-right",title:BX.message("DISK_FOLDER_LIST_SHARING_TITLE_MODAL_2"),contentClassName:"",contentStyle:{},events:{onAfterPopupShow:BX.delegate(function(){for(var e in i){if(!i.hasOwnProperty(e)){continue}BX.Disk.appendRight(i[e])}},this),onPopupClose:BX.delegate(function(){BX.proxy_context.destroy()},this)},content:[BX.create("div",{props:{className:"bx-disk-popup-content"},children:[BX.create("table",{props:{id:"bx-disk-popup-shared-people-list",className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS_USER")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col2">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col3"></td>'+"</tr>"})]}),BX.create("a",{text:BX.message("DISK_FOLDER_TOOLBAR_BTN_CREATE_FOLDER"),props:{id:"bx-disk-destination-object-modal",className:"bx-disk-btn bx-disk-btn-big bx-disk-btn-transparent border"},events:{click:BX.delegate(function(){},this)},children:[BX.create("span",{props:{className:"bx-disk-btn-icon bx-disk-btn-icon-plus"}}),BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_ADD_RIGHTS_USER")]}),BX.create("div",{html:'<span class="feed-add-destination-input-box" id="feed-add-post-destination-input-box">'+'<input autocomplete="nope" type="text" value="" class="feed-add-destination-inp" id="feed-add-post-destination-input"/>'+"</span>"})]})],buttons:[]})},this)})};FolderListClass.prototype.showRightsOnStorage=function(){storageNewRights={};var e=this.storage.id;var t={};BX.Disk.modalWindowLoader(BX.Disk.addToLinkParam(this.ajaxUrl,"action","showRightsOnStorageDetail"),{id:"folder_list_rights_detail_storage_"+e,responseType:"json",postData:{storageId:e},afterSuccessLoad:BX.delegate(function(i,s){s&&s.close();if(i.status!="success"){i.errors=i.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:i.errors.pop().message})}if(BX.Disk.isEmptyObject(moduleTasks)){moduleTasks=BX.clone(i.tasks,true);BX.Disk.setModuleTasks(moduleTasks)}for(var o in i.rights){if(!i.rights.hasOwnProperty(o)){continue}var n=i.rights[o];for(var a in n){if(!n.hasOwnProperty(a)){continue}t[o]={readOnly:!!n[a].READ_ONLY,item:{id:o,name:showAccessCodeFullName(i.accessCodeNames[o]),avatar:null},type:"group",right:{title:n[a].TASK.TITLE,id:n[a].TASK.ID}}}}var r=!!i.showExtendedRights;var d=BX.Disk.modalWindow({modalId:"bx-disk-detail-sharing-folder-change-right",title:BX.message("DISK_FOLDER_LIST_RIGHTS_TITLE_MODAL"),withoutWindowManager:true,contentClassName:"",contentStyle:{},events:{onAfterPopupShow:BX.delegate(function(){storageNewRights=BX.clone(t,true);isChangedRights=false;BX.Access.Init({groups:{disabled:this.isBitrix24}});var e={};for(var i in storageNewRights){if(!storageNewRights.hasOwnProperty(i))continue;storageNewRights[i].isBitrix24=this.isBitrix24;BX.Disk.appendSystemRight(storageNewRights[i])}BX.addCustomEvent("onChangeSystemRight",BX.proxy(this.onChangeSystemRight,this));BX.addCustomEvent("onDetachSystemRight",BX.proxy(this.onDetachSystemRight,this));BX.bind(BX("feed-add-post-destination-container"),"click",BX.delegate(function(e){var t={};for(var i in storageNewRights){if(!storageNewRights.hasOwnProperty(i))continue;t[i]=true}BX.Access.SetSelected(t);BX.Access.ShowForm({showSelected:true,callback:BX.delegate(function(e){var t=[];for(var i in e){for(var s in e[i]){t.push(e[i][s]);this.onSelectSystemRight(e[i][s],i)}}},this)});BX.Access.popup.getPopupContainer().style.zIndex=d.getZindex()+10;return BX.PreventDefault(e)},this))},this),onPopupClose:BX.delegate(function(){BX.removeCustomEvent("onChangeSystemRight",BX.proxy(this.onChangeRight,this))},this)},content:[BX.create("div",{props:{className:"bx-disk-popup-content"},children:[BX.create("table",{props:{id:"bx-disk-popup-shared-people-list",className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS_USER")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col2">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col3"></td>'+"</tr>"})]}),BX.create("div",{props:{id:"feed-add-post-destination-container",className:"feed-add-post-destination-wrap"},children:[BX.create("span",{props:{className:"feed-add-post-destination-item"}}),BX.create("span",{props:{id:"feed-add-post-destination-input-box",className:"feed-add-destination-input-box"},style:{background:"transparent"},children:[BX.create("input",{props:{type:"text",value:"",id:"feed-add-post-destination-input",className:"feed-add-destination-inp"}})]}),BX.create("a",{props:{href:"#",id:"bx-destination-tag",className:"feed-add-destination-link"},style:{background:"transparent"},text:BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_ADD_RIGHTS_USER"),events:{click:BX.delegate(function(){},this)}})]}),BX.create("div",{style:{marginTop:"27px",marginBottom:"20px"},html:'<input type="checkbox" '+(r?'checked="checked"':"")+' id="showExtendedRights"/><label for="showExtendedRights">'+BX.message("DISK_FOLDER_LIST_LABEL_SHOW_EXTENDED_RIGHTS")+"</label>"})]})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_BTN_SAVE"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(){BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","saveRightsOnStorage"),data:{isChangedRights:isChangedRights?1:0,showExtendedRights:BX("showExtendedRights").checked?1:0,storageId:e,storageNewRights:storageNewRights},onsuccess:BX.delegate(function(e){if(!e){return}BX.Disk.showModalWithStatusAction(e);document.location.reload()},this)});if(!!d){d.close()}},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){if(!!d){d.close()}}}})]})},this)})};FolderListClass.prototype.showRightsOnObjectDetail=function(e){storageNewRights={};var t=this.storage.id;var i={};e=e||{};var s=e.object.id;BX.Disk.modalWindowLoader(BX.Disk.addToLinkParam(this.ajaxUrl,"action","showRightsOnObjectDetail"),{id:"folder_list_rights_detail_object_"+s,responseType:"json",postData:{objectId:s,storageId:t},afterSuccessLoad:BX.delegate(function(t,o){o&&o.close();if(t.status!="success"){t.errors=t.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:t.errors.pop().message})}if(BX.Disk.isEmptyObject(moduleTasks)){moduleTasks=BX.clone(t.tasks,true);BX.Disk.setModuleTasks(moduleTasks)}for(var n in t.rights){if(!t.rights.hasOwnProperty(n)){continue}var a=t.rights[n];for(var r in a){if(!a.hasOwnProperty(r)){continue}i[n]={item:{id:n,name:showAccessCodeFullName(t.accessCodeNames[n]),avatar:null},type:"group",right:{title:a[r].TASK.TITLE,id:a[r].TASK.ID}}}}var d=BX.Disk.modalWindow({modalId:"bx-disk-detail-sharing-folder-change-right",title:BX.message("DISK_FOLDER_LIST_RIGHTS_TITLE_MODAL"),withoutWindowManager:true,contentClassName:"",contentStyle:{},events:{onAfterPopupShow:BX.delegate(function(){storageNewRights=BX.clone(i,true);originalRights=BX.clone(i,true);detachedRights={};BX.Access.Init({groups:{disabled:this.isBitrix24}});for(var e in storageNewRights){if(!storageNewRights.hasOwnProperty(e))continue;storageNewRights[e].isBitrix24=this.isBitrix24;BX.Disk.appendSystemRight(storageNewRights[e])}BX.addCustomEvent("onChangeSystemRight",BX.proxy(this.onChangeSystemRight,this));BX.addCustomEvent("onDetachSystemRight",BX.proxy(this.onDetachSystemRight,this));BX.bind(BX("feed-add-post-destination-container"),"click",BX.delegate(function(e){var t={};for(var i in storageNewRights){if(!storageNewRights.hasOwnProperty(i))continue;t[i]=true}BX.Access.SetSelected(t);BX.Access.ShowForm({showSelected:true,callback:BX.delegate(function(e){var t=[];for(var i in e){for(var s in e[i]){t.push(e[i][s]);this.onSelectSystemRight(e[i][s],i)}}},this)});BX.Access.popup.getPopupContainer().style.zIndex=d.getZindex()+10;return BX.PreventDefault(e)},this))},this),onPopupClose:BX.delegate(function(){BX.removeCustomEvent("onChangeSystemRight",BX.proxy(this.onChangeRight,this))},this)},content:[BX.create("div",{props:{className:"bx-disk-popup-content"},children:[BX.create("table",{props:{id:"bx-disk-popup-shared-people-list",className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS_USER")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col2">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col3"></td>'+"</tr>"})]}),BX.create("div",{props:{id:"feed-add-post-destination-container",className:"feed-add-post-destination-wrap"},children:[BX.create("span",{props:{className:"feed-add-post-destination-item"}}),BX.create("span",{props:{id:"feed-add-post-destination-input-box",className:"feed-add-destination-input-box"},style:{background:"transparent"},children:[BX.create("input",{props:{type:"text",value:"",id:"feed-add-post-destination-input",className:"feed-add-destination-inp"}})]}),BX.create("a",{props:{href:"#",id:"bx-destination-tag",className:"feed-add-destination-link"},style:{background:"transparent"},text:BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_ADD_RIGHTS_USER"),events:{click:BX.delegate(function(){},this)}})]})]})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_BTN_SAVE"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(){BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","saveRightsOnObject"),data:{objectId:s,objectNewRights:storageNewRights,detachedRights:detachedRights},onsuccess:BX.delegate(function(t){if(!t){return}if(e.object.isFolder){t.message=BX.message("DISK_FOLDER_LIST_OK_FOLDER_RIGHTS_MODIFIED").replace("#FOLDER#",e.object.name)}else{t.message=BX.message("DISK_FOLDER_LIST_OK_FILE_RIGHTS_MODIFIED").replace("#FILE#",e.object.name)}BX.Disk.showModalWithStatusAction(t)},this)});if(!!d){d.close()}},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){if(!!d){d.close()}}}})]})},this)})};FolderListClass.prototype.openSlider=function(e){BX.SidePanel.Instance.open(e,{allowChangeHistory:false})};FolderListClass.prototype.showSettingsOnBizproc=function(){var e=this.storage.id;var t="";BX.Disk.modalWindowLoader(BX.Disk.addToLinkParam(this.ajaxUrl,"action","showSettingsOnBizproc"),{responseType:"json",postData:{storageId:e},afterSuccessLoad:BX.delegate(function(i){if(i.status!="success"){i.errors=i.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:i.errors.pop().message})}if(i.statusBizProc){t="checked"}BX.Disk.modalWindow({modalId:"bx-disk-settings-bizproc",title:BX.message("DISK_FOLDER_LIST_BIZPROC_TITLE_MODAL"),contentClassName:"",events:{},content:[BX.create("table",{html:'<tr><td><label for="activationBizProc">'+BX.message("DISK_FOLDER_LIST_BIZPROC_LABEL")+"</label></td>"+'<td><input type="checkbox" id="activationBizProc" '+t+" /></td>"+"</tr>"})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_BTN_SAVE"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(){BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","saveSettingsOnBizproc"),data:{storageId:e,activationBizproc:BX("activationBizProc").checked?1:0},onsuccess:BX.delegate(function(e){if(!e){return}if(e.status!="success"){e.errors=e.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:e.errors.pop().message})}else{BX.Disk.showModalWithStatusAction(e)}location.reload()},this)})},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})]})},this)})};FolderListClass.prototype.openWindowForSelectDocumentService=function(){BX.Disk.InformationPopups.openWindowForSelectDocumentService({})};FolderListClass.prototype.showHiddenContent=function(e){e.style.display=e.style.display=="none"?"block":"none"};FolderListClass.prototype.hide=function(e){if(!e.getAttribute("displayOld")){e.setAttribute("displayOld",e.style.display)}e.style.display="none"};FolderListClass.prototype.showNetworkDriveConnect=function(e){e=e||{};var t=e.link,i=this.showHiddenContent,s=this.hide;i(BX("bx-disk-network-drive-full"));BX.Disk.modalWindow({modalId:"bx-disk-show-network-drive-connect",title:BX.message("DISK_FOLDER_LIST_PAGE_TITLE_NETWORK_DRIVE"),contentClassName:"tac",contentStyle:{},events:{onAfterPopupShow:function(){var e=BX("disk-get-network-drive-link");BX.focus(e);e.setSelectionRange(0,e.value.length)},onPopupClose:function(){s(BX("bx-disk-network-drive"));s(BX("bx-disk-network-drive-full"));document.body.appendChild(BX("bx-disk-network-drive-full"));this.destroy()}},content:[BX.create("label",{text:BX.message("DISK_FOLDER_LIST_PAGE_TITLE_NETWORK_DRIVE_DESCR_MODAL")+" :",props:{className:"bx-disk-popup-label",for:"disk-get-network-drive-link"}}),BX.create("input",{style:{marginTop:"10px"},props:{id:"disk-get-network-drive-link",className:"bx-disk-popup-input",type:"text",value:t}}),BX("bx-disk-network-drive-full")],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CLOSE"),className:"ui-btn ui-btn-link",events:{click:function(){BX.PopupWindowManager.getCurrentPopup().close()}}})]});if(BX("bx-disk-network-drive-secure-label")){s(BX.findChildByClassName(BX("bx-disk-show-network-drive-connect"),"bx-disk-popup-label"));s(BX.findChildByClassName(BX("bx-disk-show-network-drive-connect"),"bx-disk-popup-input"))}};FolderListClass.prototype.showSharingDetailWithSharing=function(e){entityToNewShared={};loadedReadOnlyEntityToNewShared={};e=e||{};var t=e.object.id;BX.Disk.modalWindowLoader(BX.Disk.addToLinkParam(this.ajaxUrl,"action","showSharingDetailAppendSharing"),{id:"folder_list_sharing_detail_object_"+t,responseType:"json",postData:{objectId:t},afterSuccessLoad:BX.delegate(function(e){if(e.status!="success"){e.errors=e.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:e.errors.pop().message})}var i={name:e.owner.name,avatar:e.owner.avatar,link:e.owner.link};entityToNewSharedMaxTaskName=e.owner.maxTaskName;BX.Disk.modalWindow({modalId:"bx-disk-detail-sharing-folder-change-right",title:BX.message("DISK_FOLDER_LIST_SHARING_TITLE_MODAL_2"),contentClassName:"",contentStyle:{},events:{onAfterPopupShow:BX.delegate(function(){BX.addCustomEvent("onChangeRightOfSharing",BX.proxy(this.onChangeRightOfSharing,this));for(var t in e.members){if(!e.members.hasOwnProperty(t)){continue}entityToNewShared[e.members[t].entityId]={item:{id:e.members[t].entityId,name:e.members[t].name,avatar:e.members[t].avatar},type:e.members[t].type,right:e.members[t].right}}loadedReadOnlyEntityToNewShared=BX.clone(entityToNewShared,true);BX.SocNetLogDestination.init({name:this.destFormName,searchInput:BX("feed-add-post-destination-input"),bindMainPopup:{node:BX("feed-add-post-destination-container"),offsetTop:"5px",offsetLeft:"15px"},bindSearchPopup:{node:BX("feed-add-post-destination-container"),offsetTop:"5px",offsetLeft:"15px"},callback:{select:BX.proxy(this.onSelectDestination,this),unSelect:BX.proxy(this.onUnSelectDestination,this),openDialog:BX.proxy(this.onOpenDialogDestination,this),closeDialog:BX.proxy(this.onCloseDialogDestination,this),openSearch:BX.proxy(this.onOpenSearchDestination,this),closeSearch:BX.proxy(this.onCloseSearchDestination,this)},items:e.destination.items,itemsLast:e.destination.itemsLast,itemsSelected:e.destination.itemsSelected});var i=this.destFormName;BX.bind(BX("feed-add-post-destination-container"),"click",function(e){BX.SocNetLogDestination.openDialog(i);BX.PreventDefault(e)});BX.bind(BX("feed-add-post-destination-input"),"keyup",BX.proxy(this.onKeyUpDestination,this));BX.bind(BX("feed-add-post-destination-input"),"keydown",BX.proxy(this.onKeyDownDestination,this))},this),onPopupClose:BX.delegate(function(){if(BX.SocNetLogDestination&&BX.SocNetLogDestination.isOpenDialog()){BX.SocNetLogDestination.closeDialog()}BX.removeCustomEvent("onChangeRightOfSharing",BX.proxy(this.onChangeRightOfSharing,this));BX.proxy_context.destroy()},this)},content:[BX.create("div",{props:{className:"bx-disk-popup-content"},children:[BX.create("table",{props:{className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_OWNER")+"</td>"+"</tr>"}),BX.create("tr",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-col1" style="border-bottom: none;"><a class="bx-disk-filepage-used-people-link" href="'+i.link+'"><span class="bx-disk-filepage-used-people-avatar" style="background-image: url('+i.avatar+');"></span>'+BX.util.htmlspecialchars(i.name)+"</a></td>"+"</tr>"})]}),BX.create("table",{props:{id:"bx-disk-popup-shared-people-list",className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS_USER")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col2">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col3"></td>'+"</tr>"})]}),BX.create("div",{props:{id:"feed-add-post-destination-container",className:"feed-add-post-destination-wrap"},children:[BX.create("span",{props:{className:"feed-add-post-destination-item"}}),BX.create("span",{props:{id:"feed-add-post-destination-input-box",className:"feed-add-destination-input-box"},style:{background:"transparent"},children:[BX.create("input",{props:{type:"text",value:"",id:"feed-add-post-destination-input",className:"feed-add-destination-inp"}})]}),BX.create("a",{props:{href:"#",id:"bx-destination-tag",className:"feed-add-destination-link"},style:{background:"transparent"},text:BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_ADD_RIGHTS_USER"),events:{click:BX.delegate(function(){},this)}})]})]})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_BTN_SAVE"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(){BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","appendSharing"),data:{objectId:t,entityToNewShared:entityToNewShared},onsuccess:BX.delegate(function(e){if(!e){return}BX.Disk.showModalWithStatusAction(e);var i=BX.delegate(getIconElementByObjectId,this)(t);if(i){if(!entityToNewShared||BX.Disk.isEmptyObject(entityToNewShared)){BX.removeClass(i,"icon-shared icon-shared_2 shared");BX.removeClass(i,"icon-shared_1")}else{BX.addClass(i,"icon-shared icon-shared_2 shared")}}},this)});BX.PopupWindowManager.getCurrentPopup().close()},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})]})},this)})};FolderListClass.prototype.onCreateExtendedFolder=function(){this.showCreateFolderWithSharing({})};FolderListClass.prototype.showCreateFolderWithSharing=function(){entityToNewShared={};storageNewRights={};var e=this.storage.id;var t={};BX.Disk.modalWindowLoader(BX.Disk.addToLinkParam(this.ajaxUrl,"action","showCreateFolderWithSharingInCommon"),{id:"folder_list_rights_detail_storage_"+e,responseType:"json",postData:{storageId:e},afterSuccessLoad:BX.delegate(function(i){if(i.status!="success"){i.errors=i.errors||[{}];BX.Disk.showModalWithStatusAction({status:"error",message:i.errors.pop().message})}if(BX.Disk.isEmptyObject(moduleTasks)){moduleTasks=BX.clone(i.tasks,true);BX.Disk.setModuleTasks(moduleTasks)}for(var s in i.rights){if(!i.rights.hasOwnProperty(s)){continue}var o=i.rights[s];for(var n in o){if(!o.hasOwnProperty(n)){continue}t[s]={detachOnly:true,item:{id:s,name:i.accessCodeNames[s].name,avatar:null},type:"group",right:{title:o[n].TASK.TITLE,id:o[n].TASK.ID}}}}BX.Disk.modalWindow({modalId:"bx-disk-detail-sharing-create-folder",title:BX.message("DISK_FOLDER_LIST_CREATE_FOLDER_MODAL"),contentClassName:"",contentStyle:{},events:{onAfterPopupShow:BX.delegate(function(){BX.focus(BX("disk-new-create-filename"));storageNewRights=BX.clone(t,true);for(var e in t){if(!t.hasOwnProperty(e)){continue}BX.Disk.appendRight(t[e])}BX.addCustomEvent("onChangeRightOfSharing",BX.proxy(this.onChangeRightOfSharing,this));BX.addCustomEvent("onChangeRight",BX.proxy(this.onChangeRight,this));BX.addCustomEvent("onDetachRight",BX.proxy(this.onDetachRight,this));BX.SocNetLogDestination.init({name:this.destFormName,searchInput:BX("feed-add-post-destination-input"),bindMainPopup:{node:BX("feed-add-post-destination-container"),offsetTop:"5px",offsetLeft:"15px"},bindSearchPopup:{node:BX("feed-add-post-destination-container"),offsetTop:"5px",offsetLeft:"15px"},callback:{select:BX.proxy(this.onSelectDestination,this),unSelect:BX.proxy(this.onUnSelectDestination,this),openDialog:BX.proxy(this.onOpenDialogDestination,this),closeDialog:BX.proxy(this.onCloseDialogDestination,this),openSearch:BX.proxy(this.onOpenSearchDestination,this),closeSearch:BX.proxy(this.onCloseSearchDestination,this)},items:i.destination.items,itemsLast:i.destination.itemsLast,itemsSelected:i.destination.itemsSelected});var s=this.destFormName;BX.bind(BX("feed-add-post-destination-container"),"click",function(e){BX.SocNetLogDestination.openDialog(s);BX.PreventDefault(e)});BX.bind(BX("feed-add-post-destination-input"),"keyup",BX.proxy(this.onKeyUpDestination,this));BX.bind(BX("feed-add-post-destination-input"),"keydown",BX.proxy(this.onKeyDownDestination,this))},this),onPopupClose:BX.delegate(function(){if(BX.SocNetLogDestination&&BX.SocNetLogDestination.isOpenDialog()){BX.SocNetLogDestination.closeDialog()}BX.removeCustomEvent("onChangeRight",BX.proxy(this.onChangeRight,this));BX.proxy_context.destroy()},this)},content:[BX.create("div",{props:{className:"bx-disk-popup-content-small"},children:[BX.create("label",{props:{className:"bx-disk-popup-label",for:"disk-new-create-filename"},children:[BX.create("span",{props:{className:"req"},text:"*"}),BX.message("DISK_FOLDER_LIST_LABEL_NAME_CREATE_FOLDER")]}),BX.create("input",{props:{id:"disk-new-create-filename",className:"bx-disk-popup-input",type:"text",value:""},style:{fontSize:"16px",marginTop:"10px"}})]}),BX.create("div",{props:{className:"bx-disk-popup-content"},children:[BX.create("table",{props:{id:"bx-disk-popup-shared-people-list",className:"bx-disk-popup-shared-people-list"},children:[BX.create("thead",{html:"<tr>"+'<td class="bx-disk-popup-shared-people-list-head-col1">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS_USER")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col2">'+BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_RIGHTS")+"</td>"+'<td class="bx-disk-popup-shared-people-list-head-col3"></td>'+"</tr>"})]}),BX.create("div",{props:{id:"feed-add-post-destination-container",className:"feed-add-post-destination-wrap"},children:[BX.create("span",{props:{className:"feed-add-post-destination-item"}}),BX.create("span",{props:{id:"feed-add-post-destination-input-box",className:"feed-add-destination-input-box"},style:{background:"transparent"},children:[BX.create("input",{props:{type:"text",value:"",id:"feed-add-post-destination-input",className:"feed-add-destination-inp"}})]}),BX.create("a",{props:{href:"#",id:"bx-destination-tag",className:"feed-add-destination-link"},style:{background:"transparent"},text:BX.message("DISK_FOLDER_LIST_SHARING_LABEL_NAME_ADD_RIGHTS_USER"),events:{click:BX.delegate(function(){},this)}})]})]})],buttons:[new BX.PopupWindowCustomButton({text:BX.message("DISK_FOLDER_LIST_BTN_SAVE"),className:"ui-btn ui-btn-success",events:{click:BX.delegate(function(){var t=BX("disk-new-create-filename").value;if(!t){BX.focus(BX("disk-new-create-filename"));return}BX.Disk.ajax({method:"POST",dataType:"json",url:BX.Disk.addToLinkParam(this.ajaxUrl,"action","createFolderWithSharing"),data:{name:t,storageId:e,storageNewRights:storageNewRights||{},entityToNewShared:entityToNewShared||{}},onsuccess:BX.delegate(function(e){if(!e){return}BX.Disk.showModalWithStatusAction(e);if(e.status&&e.status=="success"){window.document.location=BX.Disk.getUrlToShowObjectInGrid(e.folder.id)}},this)});BX.PopupWindowManager.getCurrentPopup().close()},this)}}),new BX.PopupWindowCustomButton({text:BX.message("DISK_JS_BTN_CANCEL"),className:"ui-btn ui-btn-link",events:{click:function(e){BX.PopupWindowManager.getCurrentPopup().destroy()}}})]})},this)})};FolderListClass.prototype.onSelectSystemRight=function(e,t){storageNewRights[e.id]=storageNewRights[e.id]||{};isChangedRights=true;var i=BX.Access.GetProviderPrefix(t,e.id);storageNewRights[e.id]={item:{avatar:null,id:e.id,name:(i?i+": ":"")+e.name},type:"user",right:"read"};storageNewRights[e.id].isBitrix24=this.isBitrix24;BX.Disk.appendSystemRight(storageNewRights[e.id])};FolderListClass.prototype.onSelectRightDestination=function(e,t,i){storageNewRights[e.id]=storageNewRights[e.id]||{};storageNewRights[e.id]={item:e,type:t,right:storageNewRights[e.id].right||{}};BX.Disk.appendRight({destFormName:this.destFormName,item:e,type:t,right:storageNewRights[e.id].right})};FolderListClass.prototype.onUnSelectRightDestination=function(e,t,i){var s=e.id;delete storageNewRights[s];var o=BX.findChild(BX("bx-disk-popup-shared-people-list"),{attribute:{"data-dest-id":""+s+""}},true);if(o){BX.remove(o)}};FolderListClass.prototype.onChangeSystemRight=function(e,t){if(storageNewRights[e]){isChangedRights=true;storageNewRights[e].right={id:t.ID,title:t.TITLE}}};FolderListClass.prototype.onDetachSystemRight=function(e){if(storageNewRights[e]){isChangedRights=true;BX.Access.DeleteSelected(e);detachedRights[e]=storageNewRights[e];delete storageNewRights[e]}};FolderListClass.prototype.onChangeRight=function(e,t){if(storageNewRights[e]){storageNewRights[e].right={id:t.ID,title:t.TITLE}}};FolderListClass.prototype.onDetachRight=function(e){if(storageNewRights[e]){delete storageNewRights[e]}};FolderListClass.prototype.onSelectDestination=function(e,t,i){entityToNewShared[e.id]=entityToNewShared[e.id]||{};BX.Disk.appendNewShared({maxTaskName:entityToNewSharedMaxTaskName,readOnly:!!loadedReadOnlyEntityToNewShared[e.id],destFormName:this.destFormName,item:e,type:t,right:entityToNewShared[e.id].right});entityToNewShared[e.id]={item:e,type:t,right:entityToNewShared[e.id].right||"disk_access_read"}};FolderListClass.prototype.onUnSelectDestination=function(e,t,i){var s=e.id;if(!!loadedReadOnlyEntityToNewShared[s]){return false}delete entityToNewShared[s];var o=BX.findChild(BX("bx-disk-popup-shared-people-list"),{attribute:{"data-dest-id":""+s+""}},true);if(o){BX.remove(o)}};FolderListClass.prototype.onChangeRightOfSharing=function(e,t){if(entityToNewShared[e]){entityToNewShared[e].right=t}};FolderListClass.prototype.onOpenDialogDestination=function(){BX.style(BX("feed-add-post-destination-input-box"),"display","inline-block");BX.style(BX("bx-destination-tag"),"display","none");BX.focus(BX("feed-add-post-destination-input"));if(BX.SocNetLogDestination.popupWindow)BX.SocNetLogDestination.popupWindow.adjustPosition({forceTop:true})};FolderListClass.prototype.onCloseDialogDestination=function(){var e=BX("feed-add-post-destination-input");if(!BX.SocNetLogDestination.isOpenSearch()&&e&&e.value.length<=0){BX.style(BX("feed-add-post-destination-input-box"),"display","none");BX.style(BX("bx-destination-tag"),"display","inline-block")}};FolderListClass.prototype.onOpenSearchDestination=function(){if(BX.SocNetLogDestination.popupSearchWindow)BX.SocNetLogDestination.popupSearchWindow.adjustPosition({forceTop:true})};FolderListClass.prototype.onCloseSearchDestination=function(){var e=BX("feed-add-post-destination-input");if(!BX.SocNetLogDestination.isOpenSearch()&&e&&e.value.length>0){BX.style(BX("feed-add-post-destination-input-box"),"display","none");BX.style(BX("bx-destination-tag"),"display","inline-block");BX("feed-add-post-destination-input").value=""}};FolderListClass.prototype.onKeyDownDestination=function(e){var t=this.destFormName;if(e.keyCode==8&&BX("feed-add-post-destination-input").value.length<=0){BX.SocNetLogDestination.sendEvent=false;BX.SocNetLogDestination.deleteLastItem(t)}return true};FolderListClass.prototype.onKeyUpDestination=function(e){var t=this.destFormName;if(e.keyCode==16||e.keyCode==17||e.keyCode==18||e.keyCode==20||e.keyCode==244||e.keyCode==224||e.keyCode==91)return false;if(e.keyCode==13){BX.SocNetLogDestination.selectFirstSearchItem(t);return BX.PreventDefault(e)}if(e.keyCode==27){BX("feed-add-post-destination-input").value=""}else{BX.SocNetLogDestination.search(BX("feed-add-post-destination-input").value,true,t)}if(BX.SocNetLogDestination.sendEvent&&BX.SocNetLogDestination.isOpenDialog())BX.SocNetLogDestination.closeDialog();if(e.keyCode==8){BX.SocNetLogDestination.sendEvent=true}return BX.PreventDefault(e)};FolderListClass.prototype.showSearchProcessInConnectedFolders=function(){if(this.layout.loader){return}this.layout.loader=BX.create("div",{props:{className:"bx-disk-interface-filelist-loader"},children:[BX.create("div",{props:{className:"bx-disk-interface-filelist-loader-wrapper"},children:[this.layout.loaderWrapper=BX.create("div",{props:{className:"bx-disk-interface-filelist-loader-container"}}),BX.create("div",{props:{className:"bx-disk-interface-filelist-loader-text"},text:BX.message("DISK_FOLDER_LIST_SEARCH_PROGRESS_LABEL")})]})]});var e=new BX.Loader({size:170});e.show(this.layout.loaderWrapper);if(this.commonGrid.isGrid()){document.querySelector(".main-grid-wrapper").appendChild(this.layout.loader)}else if(this.commonGrid.isTile()){this.commonGrid.getContainer().parentNode.appendChild(this.layout.loader)}};FolderListClass.prototype.removeSearchProcessInConnectedFolders=function(){if(!this.layout.loader)return;this.layout.loader.parentNode.removeChild(this.layout.loader);this.layout.loader=null};return FolderListClass}();(function(){"use strict";BX.namespace("BX.Disk.Model.FolderList");BX.Disk.Model.FolderList.SearchProgress=function(e){BX.Disk.Model.Item.apply(this,arguments);this.templateId="search-progress"};BX.Disk.Model.FolderList.SearchProgress.prototype={__proto__:BX.Disk.Model.Item.prototype,constructor:BX.Disk.Model.FolderList.SearchProgress,isTimeToShow:function(){return this.state.total>0&&this.state.total!==this.state.current},getDefaultStateValues:function(){return{isTimeToShow:this.isTimeToShow.bind(this)}}};BX.Disk.Model.FolderList.CommonGrid=function(e){this.instance=e.instance};BX.Disk.Model.FolderList.CommonGrid.prototype={constructor:BX.Disk.Model.FolderList.CommonGrid,getId:function(){return this.instance.getId()},isGrid:function(){return!this.isTile()},isTile:function(){return BX.TileGrid.Grid&&this.instance instanceof BX.TileGrid.Grid},getContainer:function(){return this.instance.getContainer()},fade:function(){if(this.isGrid()){this.instance.tableFade()}else{this.instance.setFadeContainer();this.instance.getLoader();this.instance.showLoader()}},unFade:function(){if(this.isGrid()){this.instance.tableUnfade()}else{this.instance.getLoader().hide();this.instance.unSetFadeContainer()}},getActionKey:function(){return"action_button_"+this.instance.getId()},getSelectedIds:function(){if(this.isGrid()){return this.instance.getRows().getSelectedIds()}else{return this.instance.getSelectedItems().map(function(e){return e.getId()})}},getIds:function(){if(this.isGrid()){return this.instance.getRows().getBodyChild().map(function(e){return e.getId()})}else{return this.instance.items.map(function(e){return e.id})}},countItems:function(){if(this.isGrid()){return this.instance.getRows().getBodyChild().length}else{return this.instance.countItems()}},reload:function(e,t){t=t||{};if(this.isGrid()){var i=new BX.Promise;this.instance.reloadTable("POST",t,function(){i.fulfill()},e);return i}else{return this.instance.reload(e,t)}},getActionsMenu:function(e){if(this.isGrid()){return this.instance.getRows().getById(e).getActionsMenu()}else{var t=this.instance.getItem(e);if(t){return t.getActionsMenu()}}},getItemById:function(e){if(this.isGrid()){return this.instance.getRows().getById(e)}else{return this.instance.getItem(e)}},scrollTo:function(e){var t;if(this.isGrid()){var i=this.instance.getRows().getById(e);if(i&&i.node){t=i.node}}else{var s=this.instance.getItem(e);if(i&&i.node){t=i.getContainer()}}if(t){new BX.easing({duration:500,start:{scroll:window.pageYOffset||document.documentElement.scrollTop},finish:{scroll:BX.pos(t).top},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:function(e){window.scrollTo(0,e.scroll)}}).animate()}},getActionById:function(e,t){var i=this.getItemById(e);if(i){var s=i.getActions();for(var o=0;o<s.length;o++){if(s[o].id&&s[o].id===t){return s[o]}}}return null},removeItemById:function(e){BX.fireEvent(document,"click");if(this.isGrid()){this.instance.removeRow(e)}else{var t=this.instance.getItem(e);if(t){this.instance.removeItem(t)}}},selectItemById:function(e){var t;if(this.isGrid()){t=this.instance.getRows().getById(e);if(t){t.select()}}else{t=this.instance.getItem(e);if(t){this.instance.selectItem(t)}}},removeSelected:function(){if(this.isGrid()){this.instance.removeSelected()}else{}},sortByColumn:function(e){this.instance.sortByColumn(e)}};BX.namespace("BX.Disk.TileGrid");BX.Disk.TileGrid.Item=function(e){BX.TileGrid.Item.apply(this,arguments);this.isDraggable=e.isDraggable;this.isDroppable=e.isDroppable;this.dblClickDelay=0;this.title=e.name;this.isFolder=e.isFolder;this.isFile=e.isFile;this.canAdd=e.canAdd;this.isLocked=e.isLocked;this.isSymlink=e.isSymlink;this.image=e.image;this.actions=e.actions;this.link=e.link;this.attributes=e.attributes;this.item={container:null,action:null,title:null,titleWrapper:null,titleLink:null,titleInput:null,lock:null,symlink:null,imageBlock:null,picture:null,fileType:null,icons:null};this.actionsMenu=null;this.imageItemHandler=null;BX.addCustomEvent(window,"TileGrid.Grid:onItemDragStart",function(){if(this.actionsMenu)this.actionsMenu.popupWindow.close()}.bind(this))};BX.Disk.TileGrid.Item.prototype={__proto__:BX.TileGrid.Item.prototype,constructor:BX.TileGrid.Item,handleDblClick:function(){BX.onCustomEvent("Disk.TileItem.Item:onItemDblClick",[this])},handleEnter:function(){BX.onCustomEvent("Disk.TileItem.Item:onItemEnter",[this])},getContent:function(){this.item.container=BX.create("div",{attrs:{className:this.isFile?"disk-folder-list-item":"disk-folder-list-item disk-folder-list-item-folder"},children:[this.getImage(),this.getActionBlock(),BX.create("div",{props:{className:!this.getLocked()&&!this.getSymlink()?"disk-folder-list-item-bottom disk-folder-list-item-bottom-without-icons":"disk-folder-list-item-bottom"},children:[this.getTitle(),this.getIconsContainer()]})],events:{contextmenu:function(e){if(e.ctrlKey){return}this.showActionsMenu(e);this.gridTile.resetSelection();this.gridTile.selectItem(this);e.preventDefault()}.bind(this)}});if(this.image){this.imageItemHandler=BX.throttle(this.appendImageItem,20,this);BX.bind(window,"resize",this.imageItemHandler);BX.bind(window,"scroll",this.imageItemHandler)}return this.item.container},appendImageItem:function(){if(this.isVisibleOnFolderList()){this.item.picture.setAttribute("src",this.image);BX.bind(this.item.container,"animationend",BX.proxy(this.appendImageItem,this));BX.unbind(this.item.container,"animationend",BX.proxy(this.appendImageItem,this));BX.unbind(window,"resize",this.imageItemHandler);BX.unbind(window,"scroll",this.imageItemHandler)}},lock:function(){this.item.lock.style.display=null},unlock:function(){this.item.lock.style.display="none"},getIconsContainer:function(){this.item.icons=BX.create("div",{props:{className:"disk-folder-list-item-icons"},children:[this.getLocked(),this.getSymlink()]});return this.item.icons},getLocked:function(){this.item.lock=BX.create("div",{attrs:{className:"disk-folder-list-item-locked"},style:{display:this.isLocked?null:"none"}});return this.item.lock},getSymlink:function(){this.item.symlink=BX.create("div",{attrs:{className:"disk-folder-list-item-shared"},style:{display:this.isSymlink?null:"none"}});return this.item.symlink},getTitle:function(){return this.item.title=BX.create("div",{props:{className:"disk-folder-list-item-title"},children:[this.item.titleWrapper=BX.create("div",{props:{className:"disk-folder-list-item-title-wrapper"},children:[this.getTitleInput(),this.item.titleLink=BX.create("a",{attrs:{className:"disk-folder-list-item-title-link",href:this.link,title:this.title,id:"disk_obj_"+this.id},text:this.title,dataset:BX.mergeEx({objectId:this.id,canAdd:this.canAdd},this.attributes)})]})]})},getTitleInput:function(){this.item.titleInput=BX.create("input",{attrs:{className:"disk-folder-list-item-title-input",type:"text",value:this.title}});BX.bind(this.item.titleInput,"click",function(e){e.stopPropagation()});BX.addCustomEvent(window,"BX.TileGrid.Grid:resetSelectAllItems",this.cancelRenaming.bind(this));BX.addCustomEvent(window,"BX.TileGrid.Grid:selectItem",this.cancelRenaming.bind(this));BX.bind(this.item.titleInput,"keydown",function(e){if(e.key==="Escape"){this.cancelRenaming();e.preventDefault()}if(e.key==="Enter"){this.cancelRenaming();this.runRename();e.preventDefault()}e.stopPropagation()}.bind(this));return this.item.titleInput},onRename:function(){this.gridTile.resetSelection();jsDD.Disable();this.item.titleInput.value=this.title;BX.addClass(this.item.title,"disk-folder-list-item-title-rename");this.item.titleInput.focus();if(this.isFile){this.item.titleInput.setSelectionRange(0,this.title.lastIndexOf("."))}else{this.item.titleInput.select()}},cancelRenaming:function(){BX.removeClass(this.item.title,"disk-folder-list-item-title-rename");this.item.titleInput.blur();jsDD.Enable()},rename:function(e){BX.addClass(this.item.titleLink,"disk-folder-list-item-title-link-renamed");this.item.titleLink.addEventListener("animationend",function(){BX.removeClass(this.item.titleLink,"disk-folder-list-item-title-link-renamed")}.bind(this));this.item.titleLink.textContent=e;this.item.titleLink.setAttribute("title",e);this.title=e;this.rebuildLinkAfterRename(e);jsDD.Enable()},rebuildLinkAfterRename:function(e){if(this.isFile){this.link=this.link.substring(0,this.link.lastIndexOf("/")+1)+encodeURIComponent(e)}else{this.link=this.link.substring(0,this.link.lastIndexOf("/",this.link.length-2)+1)+encodeURIComponent(e)+"/"}this.item.titleLink.href=this.link;this.actions.forEach(function(e){if(e.id==="open"&&e.href){e.href=this.link}},this);this.destroyActionsMenu()},runRename:function(){if(this.item.titleInput.value===this.title){return}var e=this.title;this.rename(this.item.titleInput.value);BX.ajax.runAction("disk.api.commonActions.rename",{analyticsLabel:"folder.list",data:{objectId:this.getId(),newName:this.title,autoCorrect:true}}).then(function(e){if(e.data.object.name!==this.title){this.rename(e.data.object.name)}}.bind(this)).catch(function(t){BX.Disk.showModalWithStatusAction(t);this.rename(e)}.bind(this))},afterRender:function(){if(!this.item.picture)return;if(this.isVisibleOnFolderList()){this.appendImageItem()}BX.bind(this.item.container,"animationend",BX.proxy(this.appendImageItem,this));this.item.picture.onload=function(){BX.show(this.item.picture);BX.hide(this.item.fileType)}.bind(this)},isVisibleOnFolderList:function(){var e=this.layout.container.getBoundingClientRect();var t=document.body.getBoundingClientRect();var i=this.layout.container.offsetHeight*2;if(e.top<0||e.bottom<0)return false;return t.height>e.top-i&&t.height>=e.bottom-i},getImage:function(){var e=this.getFileExtension(this.title);this.item.imageBlock=BX.create("div",{attrs:{className:"disk-folder-list-item-image"},children:[this.item.fileType=BX.create("div",{attrs:{className:"ui-icon ui-icon-file ui-icon-file-"+e},style:{width:this.isFolder?"85%":"70%"},html:"<i></i>"}),this.item.picture=this.image?BX.create("img",{attrs:{className:"disk-folder-list-item-image-img"},style:{display:"none"}}):null]});return this.item.imageBlock},markAsShared:function(){this.isSymlink=true;if(this.isFolder){this.item.fileType.classList.add("ui-icon-file-folder-shared")}else if(this.item.symlink){this.item.symlink.style.display=null}},unmarkAsShared:function(){this.isSymlink=false;if(this.isFolder){this.item.fileType.classList.remove("ui-icon-file-folder-shared")}else if(this.item.symlink){this.item.symlink.style.display="none"}},getFileExtension:function(e){var t=e.substring(e.lastIndexOf(".")+1);switch(t){case"mp4":case"mkv":case"mpeg":case"avi":case"3gp":case"flv":case"m4v":case"ogg":case"swf":case"wmv":t="mov";break;case"txt":t="txt";break;case"doc":case"docx":t="doc";break;case"xls":case"xlsx":t="xls";break;case"php":t="php";break;case"pdf":t="pdf";break;case"ppt":case"pptx":t="ppt";break;case"rar":t="rar";break;case"zip":t="zip";break;case"set":t="set";break;case"mov":t="mov";break;case"img":case"jpg":case"jpeg":case"gif":t="img";break;default:t="empty"}this.isFolder?t="folder":null;this.isSymlink&&this.isFolder?t="folder-shared":null;return t},getActionBlock:function(){if(!this.item.action){this.item.action=BX.create("div",{attrs:{className:"disk-folder-list-item-action"},events:{click:function(e){this.showActionsMenu(e,BX.getEventTarget(e))}.bind(this)}})}return this.item.action},getActions:function(){return this.actions},destroyActionsMenu:function(){if(this.actionsMenu){this.actionsMenu.destroy();this.actionsMenu=null}},getActionsMenu:function(e){if(this.actionsMenu){return this.actionsMenu}this.actionsMenu=BX.PopupMenu.create("-disk-folder-list-item-action-menu"+this.getId(),e,this.actions,{autoHide:true,offsetLeft:20,angle:true});BX.bind(this.actionsMenu.popupWindow.popupContainer,"click",function(e){var t=this.getActionsMenu();if(t){var i=BX.getEventTarget(e);var s=BX.findParent(i,{className:"menu-popup-item"},10);if(!s||!s.dataset.preventCloseContextMenu){t.close()}}}.bind(this));return this.actionsMenu},showActionsMenu:function(e,t){BX.fireEvent(document.body,"click");var i=this.getActionsMenu(t);i.show();if(!t){i.popupWindow.popupContainer.style.top=e.pageY+"px";i.popupWindow.popupContainer.style.left=e.pageX-35+"px"}else if(t){var s=BX.pos(t);s.forceBindPosition=true;i.popupWindow.setBindElement(t);i.popupWindow.adjustPosition(s)}}}})();
  //# sourceMappingURL=script.map.js