(function(){"use strict";BX.namespace("BX.Landing.UI.Note");var e="/kb/notes/?create=Y";var n="/kb/notes/";var t=null;var a=null;BX.addCustomEvent("Landing:onDemoCreateStart",function(){top.BX.SidePanel.Instance.closeAll();top.BX.onCustomEvent("Landing:onNoteKnowledgeSelect",[0,"knowledge"])});BX.addCustomEvent("Landing:onNoteKnowledgeSelect",function(e,n){BX.ajax({url:"/bitrix/services/main/ajax.php?action=landing.api.note.createNote",method:"POST",dataType:"json",data:{kbId:e,sourceType:a,sourceId:t,scope:n,sessid:BX.message("bitrix_sessid")},onsuccess:function(e){if(e.status==="success"){BX.UI.Notification.Center.notify({content:BX.message("LANDING_JS_NOTE_WIKI_CREATED_MESS").replace("#LINK#",e.data["PUBLIC_URL"])})}else{alert(e.errors[0]["message"])}}})});BX.Landing.UI.Note.Menu=function(){};BX.Landing.UI.Note.Menu.getMenuItem=function(s,o){t=o;a=s;return null;return{text:BX.message("LANDING_JS_NOTE_WIKI_CREATE"),onclick:function(t,a){var s=a.getLayout().item;var o=new BX.Loader({target:s,size:25});a.closeSubMenu();o.show();s.classList.add("menu-popup-item-disabled");BX.ajax({url:"/bitrix/services/main/ajax.php?action=landing.api.note.getTargets",method:"POST",dataType:"json",onsuccess:function(t){s.classList.remove("menu-popup-item-disabled");o.hide();if(t.data.list){if(t.data.list.length>0){var i=[];t.data.list.map(function(e){i.push({text:e["TITLE"],onclick:function(e){a.menuWindow.close();top.BX.onCustomEvent("Landing:onNoteKnowledgeSelect",[e["ID"],e["TYPE"]])}.bind(this,e)})});i.push({delimiter:true});i.push({text:BX.message("LANDING_JS_NOTE_WIKI_CREATE_SELECT"),onclick:function(){a.menuWindow.close();BX.SidePanel.Instance.open(n,{allowChangeHistory:false,cacheable:false})}});if(t.data.canCreateNew){i.push({text:BX.message("LANDING_JS_NOTE_WIKI_CREATE_NEW"),onclick:function(){a.menuWindow.close();BX.SidePanel.Instance.open(e,{allowChangeHistory:false,cacheable:false})}})}a.addSubMenu(i);a.showSubMenu()}else{a.menuWindow.close();BX.SidePanel.Instance.open(n,{allowChangeHistory:false,cacheable:false})}}}})}}}})();
//# sourceMappingURL=menu.map.js