Your IP : 3.147.104.108


Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/im/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/im/mobile.min.js

(function(){if(BX.ImMobile)return;BX.ImMobile=function(e){BX.browser.addGlobalClass();if(typeof e.user_tz_offset!="undefined"){BX.message({USER_TZ_OFFSET:e.user_tz_offset})}else{if(typeof BX.message("USER_TZ_AUTO")=="undefined"||BX.message("USER_TZ_AUTO")=="Y")BX.message({USER_TZ_OFFSET:-(new Date).getTimezoneOffset()*60-parseInt(BX.message("SERVER_TZ_OFFSET"))})}if(typeof BX.MessengerCommon!="undefined")BX.MessengerCommon.setBxIm(this);this.mobileVersion=true;this.mobileAction=e.mobileAction?e.mobileAction:"none";this.mobileActionCache=false;this.mobileActionRun=false;this.revision=6;this.errorMessage="";this.isAdmin=e.isAdmin||false;this.bitrixNetwork=e.bitrixNetwork||false;this.bitrixNetwork2=e.bitrixNetwork2||false;this.bitrixOpenLines=e.bitrixOpenLines||false;this.bitrix24=e.bitrix24||false;this.bitrixIntranet=e.bitrixIntranet||false;this.bitrix24net=e.bitrix24net||false;this.bitrixXmpp=e.bitrixXmpp||false;this.ppStatus=e.ppStatus||false;this.ppServerStatus=this.ppStatus?e.ppServerStatus:false;this.updateStateInterval=e.updateStateInterval||90;this.desktopStatus=e.desktopStatus||false;this.desktopVersion=e.desktopVersion||0;this.xmppStatus=false;this.lastRecordId=0;this.userId=e.userId;this.userEmail=e.userEmail||"";this.userGender=e.userGender||"M";this.path=e.path||{};this.language=e.language||"en";this.options=e.options||{};this.init=typeof e.init!="undefined"?e.init:true;this.tryConnect=true;this.animationSupport=true;this.keyboardShow=false;this.sendAjaxTry=0;this.pathToRoot=BX.message("MobileSiteDir")?BX.message("MobileSiteDir"):"/";this.pathToAjax=this.pathToRoot+"mobile/ajax.php?mobile_action=im&";this.pathToCallAjax=this.pathToAjax+"call&";this.pathToFileAjax=this.pathToAjax+"upload&";this.pathToBlankImage="/bitrix/js/im/images/blank.gif";this.pathToCrmDeal=this.pathToRoot+"mobile/crm/deal/?page=view&deal_id=#ID#";this.pathToCrmLead=this.pathToRoot+"mobile/crm/lead/?page=view&lead_id=#ID#";this.pathToCrmCompany=this.pathToRoot+"mobile/crm/company/?page=view&company_id=#ID#";this.pathToCrmContact=this.pathToRoot+"mobile/crm/contact/?page=view&contact_id=#ID#";this.notifyCount=e.notifyCount||0;this.messageCount=e.messageCount||0;this.messageCountArray={};this.settings=e.settings||{};this.settingsNotifyBlocked=e.settingsNotifyBlocked||{};this.saveSettingsTimeout=[];this.timeoutUpdateCounters=null;this.timeoutUpdateStateLight=null;e.notify=e.notify||{};e.message=e.message||{};e.recent=e.recent||{};for(var t in e.notify){e.notify[t].date=new Date(e.notify[t].date);if(parseInt(t)>this.lastRecordId)this.lastRecordId=parseInt(t)}for(var t in e.message){e.message[t].date=new Date(e.message[t].date);if(parseInt(t)>this.lastRecordId)this.lastRecordId=parseInt(t)}for(var t in e.recent){e.recent[t].date=new Date(e.recent[t].date)}if(BX.ImNotifyMobile){this.notify=new BX.ImNotifyMobile(this,{counters:e.counters||{},notify:e.notify||{},unreadNotify:e.unreadNotify||{},flashNotify:e.flashNotify||{},countNotify:e.countNotify||0,loadNotify:e.loadNotify||false})}else{this.notify={}}this.disk=new BX.ImDiskManagerMobile(this,{notifyClass:this.notify,files:e.files||{},enable:e.disk&&e.disk.enable,enableExternal:e.disk&&e.disk.external});this.notify.disk=this.disk;this.messenger=new BX.ImMessengerMobile(this,{openChatEnable:e.openChatEnable||true,updateStateInterval:e.updateStateInterval,notifyClass:this.notify,diskClass:this.disk,recent:e.recent||{},users:e.users||{},businessUsers:e.businessUsers||false,openlines:e.openlines||false,groups:e.groups||{},userChatBlockStatus:e.userChatBlockStatus||{},userChatOptions:e.userChatOptions||{},userInGroup:e.userInGroup||{},currentTab:e.currentTab||0,generalChatId:e.generalChatId||0,canSendMessageGeneralChat:e.canSendMessageGeneralChat||false,chat:e.chat||{},userInChat:e.userInChat||{},userChat:e.userChat||{},hrphoto:e.hrphoto||{},message:e.message||{},showMessage:e.showMessage||{},unreadMessage:e.unreadMessage||{},flashMessage:e.flashMessage||{},countMessage:e.countMessage||0,bot:e.bot||{},smile:e.smile||false,smileSet:e.smileSet||false,history:e.history||{}});this.notify.messenger=this.messenger;this.disk.messenger=this.messenger;this.webrtc=new BX.ImWebRTCMobile(this,{callMethod:e.mobileCallMethod?e.mobileCallMethod:"device",desktopClass:this.desktop,phoneEnabled:e.webrtc&&e.webrtc.phoneEnabled||false,mobileSupport:e.webrtc&&e.webrtc.mobileSupport||false,phoneSipAvailable:e.webrtc&&e.webrtc.phoneSipAvailable||0,phoneDeviceActive:e.webrtc&&e.webrtc.phoneDeviceActive||"N",phoneDeviceCall:e.webrtc&&e.webrtc.phoneDeviceCall||"Y",phoneCrm:e.phoneCrm&&e.phoneCrm||{},turnServer:e.webrtc&&e.webrtc.turnServer||"",turnServerFirefox:e.webrtc&&e.webrtc.turnServerFirefox||"",turnServerLogin:e.webrtc&&e.webrtc.turnServerLogin||"",turnServerPassword:e.webrtc&&e.webrtc.turnServerPassword||""});this.messenger.webrtc=this.webrtc;this.desktop={ready:function(){return false},run:function(){return false}};this.messenger.desktop=this.desktop;if(this.init){BX.onCustomEvent(window,"onImMobileInit",[this]);app.pullDownLoadingStop();this.mobileActionPrepare(e)}if(this.mobileAction=="DIALOG"){BXMobileApp.UI.Page.TopBar.title.setText("");BXMobileApp.UI.Page.TopBar.title.setDetailText("")}this.mobileActionFromCache();this.mobileActionReady()};BX.ImMobile.prototype.saveSettings=function(e){var t="";for(var s in e){this.settings[s]=e[s];t=t+s}BX.localStorage.set("ims",JSON.stringify(this.settings),5);if(this.saveSettingsTimeout[t])clearTimeout(this.saveSettingsTimeout[t]);this.saveSettingsTimeout[t]=setTimeout(BX.delegate(function(){BX.ajax({url:this.pathToAjax+"?SETTINGS_SAVE&V="+this.revision,method:"POST",dataType:"json",timeout:30,data:{IM_SETTING_SAVE:"Y",IM_AJAX_CALL:"Y",SETTINGS:JSON.stringify(e),sessid:BX.bitrix_sessid()}});delete this.saveSettingsTimeout[t]},this),700)};BX.ImMobile.prototype.setLocalConfig=function(){};BX.ImMobile.prototype.getLocalConfig=function(){};BX.ImMobile.prototype.playSound=function(e){var t={ringtone:BX.MobileCallUI.form.sound.INCOMING,start:BX.MobileCallUI.form.sound.START_CALL};t[BX.MobileCallUI.form.sound.START_CALL]=BX.MobileCallUI.form.sound.START_CALL;t[BX.MobileCallUI.form.sound.INCOMING]=BX.MobileCallUI.form.sound.INCOMING;if(!t[e])return false;BX.MobileCallUI.form.playSound(t[e])};BX.ImMobile.prototype.stopSound=function(){BX.MobileCallUI.form.stopSound()};BX.ImMobile.prototype.repeatSound=function(e,t){this.playSound(e)};BX.ImMobile.prototype.stopRepeatSound=function(e,t){BX.MobileCallUI.form.stopSound()};BX.ImMobile.prototype.phoneTo=function(e,t){t=t?t:{};if(typeof t!="object"){try{t=JSON.parse(t)}catch(e){t={}}}if(!this.webrtc.phoneEnabled){t.callMethod="device"}if(this.mobileAction!="RECENT"){BX.MobileTools.phoneTo(e,t);return true}if(!t.callMethod){t.callMethod=this.webrtc.callMethod}if(t.callMethod=="telephony"){this.webrtc.phoneCall(e,t)}else{document.location.href="tel:"+this.correctPhoneNumber(e)}};BX.ImMobile.prototype.correctPhoneNumber=function(e){if(!BX.type.isNotEmptyString(e))return e;if(e.length<10)return e;if(e.substr(0,1)==="+")return e;if(e.substr(0,3)==="011")return e;if(e.substr(0,2)==="82")return"+"+e;else if(e.substr(0,1)==="8")return e;return"+"+e};BX.ImMobile.prototype.openConfirm=function(e,t){var s={};if(typeof e!="object"){s={title:"",text:e,params:{},buttons:[],actions:[]}}else{s.title=e.title||"";s.text=e.message||"";s.params=e.params||{};s.buttons=[];s.actions=[]}if(typeof t=="undefined"||typeof t=="object"&&t.length<=0){s.buttons=[BX.message("IM_MENU_CANCEL")];s.actions=[function(){}]}else{s.buttons=[];s.actions=[];for(var i=0;i<t.length;i++){s.buttons[i]=t[i].text;if(typeof t[i].callback=="function"){s.actions[i+1]=t[i].callback}else{s.actions[i+1]=function(){}}}}app.confirm({title:s.title,text:s.text,buttons:s.buttons,callback:function(e){if(typeof s.actions[e]=="function"){s.actions[e](s.params)}}})};BX.ImMobile.prototype.openRecentList=function(){BXMobileApp.UI.Slider.setState(BXMobileApp.UI.Slider.state.CENTER);setTimeout(function(){BXMobileApp.UI.Slider.setState(BXMobileApp.UI.Slider.state.RIGHT)},500)};BX.ImMobile.prototype.mobileActionPrepare=function(e){if(this.mobileAction=="RECENT"){}else if(this.mobileAction=="INIT"){this.initPageAction()}else if(this.mobileAction=="DIALOG"){this.dialogPageAction(e)}};BX.ImMobile.prototype.mobileActionFromCache=function(){if(this.mobileActionCache)return false;this.mobileActionCache=true;BX.addClass(document.body,"im-page-from-cache");if(this.mobileAction=="RECENT"){this.messenger.drawRecentList()}else if(this.mobileAction=="DIALOG"){this.messenger.currentTab=0;this.messenger.openChatFlag=false;this.messenger.openCallFlag=false;this.messenger.openLinesFlag=false;this.messenger.showMessage={};this.messenger.unreadMessage={}}this.mobileActionReady()};BX.ImMobile.prototype.mobileActionReady=function(){if(this.mobileActionRun)return false;this.mobileActionRun=true;BXMobileApp.UI.Page.LoadingScreen.hide();BX.removeClass(document.body,"im-page-from-cache");BX.MessengerCommon.pullEvent();if(this.mobileAction=="RECENT"){this.recentPageAction();if(!window.imRecentFastClick){window.imRecentFastClick=true;BitrixMobile.fastClick.bindDelegate(this.messenger.popupContactListElementsWrap,{className:"bx-messenger-cl-item"},BX.delegate(BX.MessengerCommon.contactListClickItem,BX.MessengerCommon));BitrixMobile.fastClick.bindDelegate(this.messenger.popupContactListElementsWrap,{className:"bx-messenger-cl-group-title"},BX.delegate(BX.MessengerCommon.contactListToggleGroup,BX.MessengerCommon));BitrixMobile.fastClick.bindDelegate(this.messenger.popupContactListElementsWrap,{className:"bx-messenger-chatlist-more-wrap"},BX.delegate(function(e){if(BX.hasClass(BX.proxy_context.parentNode,"bx-messenger-chatlist-show-all")){this.messenger.contactListShowed[BX.proxy_context.firstChild.getAttribute("data-id")]=false;BX.proxy_context.firstChild.innerHTML=BX.proxy_context.firstChild.getAttribute("data-text");BX.removeClass(BX.proxy_context.parentNode,"bx-messenger-chatlist-show-all");var t=BX.pos(BX.proxy_context);document.body.scrollTop=t.top-100}else{this.messenger.contactListShowed[BX.proxy_context.firstChild.getAttribute("data-id")]=true;BX.proxy_context.firstChild.innerHTML=BX.message("IM_CL_HIDE");BX.addClass(BX.proxy_context.parentNode,"bx-messenger-chatlist-show-all");BitrixMobile.LazyLoad.showImages()}},this));BitrixMobile.fastClick.bindDelegate(this.messenger.popupContactListElementsWrap,{className:"bx-messenger-chatlist-search-button"},BX.delegate(function(e){this.messenger.realSearch=true;this.messenger.popupContactListElementsWrap.appendChild(BX.create("div",{props:{className:"bx-messenger-cl-item-search"},html:BX.message("IM_M_CL_SEARCH")}));BX.remove(BX.proxy_context.parentNode);BX.MessengerCommon.contactListRealSearch(this.messenger.contactListSearchText)},this))}BXMobileApp.addCustomEvent("onImDialogOpen",BX.delegate(function(e){this.messenger.openMessenger(e.id,false,false)},this));BXMobileApp.addCustomEvent("onImDialogClose",BX.delegate(function(e){this.messenger.closeMessenger(e.id)},this));BX.addCustomEvent("onImDialogNetworkOpen",BX.delegate(function(e){for(var t=0;t<this.messenger.recent.length;t++){if(this.messenger.recent[t].userId==e.NETWORK_ID){this.messenger.recent[t].userId=e.USER_ID;this.messenger.recent[t].recipientId=e.USER_ID;this.messenger.recent[t].senderId=e.USER_ID}}e.USER.last_activity_date=new Date(e.USER.last_activity_date);e.USER.mobile_last_date=new Date(e.USER.mobile_last_date);e.users[t].idle=e.users[t].idle?new Date(e.users[t].idle):false;e.users[t].absent=e.users[t].absent?new Date(e.users[t].absent):false;this.messenger.users[e.USER_ID]=e.USER;this.messenger.currentTab=e.USER_ID;BX.MessengerCommon.userListRedraw()},this))}else if(this.mobileAction=="DIALOG"){BX.addCustomEvent("UIApplicationDidBecomeActiveNotification",BX.delegate(function(e){if(BX.MessengerCommon.isMobile()&&this.isBackground())return false;BX.MessengerCommon.readMessage(this.messenger.currentTab)},this));BX.addCustomEvent("onOpenPageAfter",BX.delegate(function(){if(BX.MessengerCommon.isMobile()&&this.isBackground())return false;BX.MessengerCommon.readMessage(this.messenger.currentTab);this.messenger.dialogStatusRedrawDelay();BXMobileApp.onCustomEvent("onImDialogOpen",{id:this.messenger.currentTab},true)},this));BX.addCustomEvent("onHidePageBefore",BX.delegate(function(){BXMobileApp.onCustomEvent("onImDialogClose",{id:this.messenger.currentTab},true)},this));BXMobileApp.UI.Page.TextPanel.setUseImageButton(true);var e={callback:BX.delegate(function(e){if(e.event&&e.event=="onKeyPress"){if(BX.util.trim(e.text).length>2){BX.MessengerCommon.sendWriting(this.messenger.currentTab)}this.messenger.textareaHistory[this.messenger.currentTab]=e.text}},this),smileButton:{},useImageButton:true,attachFileSettings:{resize:{quality:40,destinationType:1,sourceType:1,targetWidth:1e3,targetHeight:1e3,encodingType:0,mediaType:0,allowsEdit:false,correctOrientation:true,saveToPhotoAlbum:true,popoverOptions:false,cameraDirection:0},showAttachedFiles:true,sendLocalFileMethod:"base64",maxAttachedFilesCount:1},attachButton:{items:[{id:"disk",name:BX.message("IM_B24DISK"),dataSource:{multiple:false,url:"/mobile/?mobile_action=disk_folder_list&type=user&path=%2F&entityId="+BX.message("USER_ID"),TABLE_SETTINGS:{searchField:true,showtitle:true,modal:true,name:BX.message("IM_CHOOSE_FILE_TITLE")}}},{id:"mediateka",name:BX.message("IM_CHOOSE_PHOTO")},{id:"camera",name:BX.message("IM_CAMERA_ROLL")}]},placeholder:BX.message("IM_M_TEXTAREA"),mentionDataSource:{outsection:false,url:this.pathToRoot+"mobile/index.php?mobile_action=get_user_list&use_name_format=Y&with_bots"},button_name:BX.message("IM_M_MESSAGE_SEND"),action:BX.delegate(function(e){var t=null;var s="";if(typeof e=="object"){s=e.text;if(e.attachedFiles){t=e.attachedFiles}}else{s=e}if(t!=null&&t.length>0){var i=t[0];var a=typeof i["dataAttributes"]!="undefined";if(a){var n=i["dataAttributes"];var o={};o[n["ID"]]={name:n["NAME"],modifyDateInt:n["UPDATE_TIME"],sizeInt:n["SIZE"]?n["SIZE"]:0};this.disk.uploadFromDisk(o,s)}else{this.disk.uploadFromMobile(t[0].base64,s)}}else if(s){this.messenger.textareaHistory[this.messenger.currentTab]="";this.messenger.sendMessage(this.messenger.currentTab,s)}app.clearInput()},this)};if(!app.enableInVersion(17)){delete e["attachButton"];e["plusAction"]=!this.disk.enable?"":BX.delegate(function(){this.messenger.takePhotoMenu()},this)}BXMobileApp.UI.Page.TextPanel.setParams(e);BXMobileApp.UI.Page.TextPanel.show();this.messenger.textPanelShowed=true;app.enableCaptureKeyboard(true);BX.bind(window,"orientationchange",BX.delegate(function(){if(this.messenger.popupMessengerBody.scrollHeight-this.messenger.popupMessengerBody.scrollTop<window.screen.height)this.messenger.autoScroll()},this));BX.addCustomEvent("onKeyboardWillShow",BX.delegate(function(){this.keyboardShow=true;this.messenger.autoScroll()},this));BX.addCustomEvent("onKeyboardDidHide",BX.delegate(function(){this.keyboardShow=false},this));app.pullDown({enable:true,pulltext:BX.message("IM_M_DIALOG_PULLTEXT"),downtext:BX.message("IM_M_DIALOG_DOWNTEXT"),loadtext:BX.message("IM_M_DIALOG_LOADTEXT"),callback:BX.delegate(function(){BX.MessengerCommon.loadHistory(this.messenger.currentTab)},this)});BX.addCustomEvent("onPageParamsChanged",BX.delegate(function(e){this.messenger.openMessenger(e.dialogId)},this));if(BXMobileApp.apiVersion==1){this.messenger.openMessenger(this.messenger.currentTab)}else{BXMobileApp.UI.Page.params.get({callback:BX.delegate(function(e){this.messenger.openMessenger(e.dialogId)},this)})}BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-attach-block-spoiler"},BX.delegate(function(e){var t=BX.findChildByClassName(BX.proxy_context,"bx-messenger-attach-block-value");if(BX.hasClass(BX.proxy_context,"bx-messenger-attach-block-spoiler-show")){height=t.getAttribute("data-min-height");BX.removeClass(BX.proxy_context,"bx-messenger-attach-block-spoiler-show")}else{BX.addClass(BX.proxy_context,"bx-messenger-attach-block-spoiler-show");height=t.getAttribute("data-max-height")}t.style.maxHeight=height+"px"},this));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-content-item-avatar-button"},BX.delegate(function(e){BX.localStorage.set("impmh",true,1);var t=BX.proxy_context.parentNode.parentNode.getAttribute("data-senderId");if(this.messenger.currentTab.substr(0,4)=="chat"){var s=this.messenger.currentTab.substr(4);if(!BX.MessengerCommon.userInChat(s)){return false}if(this.messenger.generalChatId==s&&!this.messenger.canSendMessageGeneralChat){return false}}this.messenger.messageReply(t);return BX.PreventDefault(e)},this));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-ajax"},BX.delegate(function(e){BX.localStorage.set("impmh",true,1);if(BX.proxy_context.getAttribute("data-entity")=="user"){app.loadPageBlank({url:this.path.profileTemplate.replace("#user_id#",BX.proxy_context.getAttribute("data-userId")),bx24ModernStyle:true})}else if(BX.proxy_context.getAttribute("data-entity")=="chat"){BXMobileApp.PageManager.loadPageUnique({url:this.pathToRoot+"mobile/im/chat.php?chat_id="+BX.proxy_context.getAttribute("data-chatId")+"&actions=Y",bx24ModernStyle:true,data:{dialogId:this.currentTab}})}else if(BX.proxy_context.getAttribute("data-entity")=="phoneCallHistory"){app.alert({text:BX.message("IM_FILE_LISTEN_NA")})}return BX.PreventDefault(e)},this));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-command"},BX.delegate(function(e){BX.localStorage.set("impmh",true,1);if(BX.proxy_context.getAttribute("data-entity")=="send"){this.messenger.sendMessage(this.messenger.currentTab,BX.proxy_context.nextSibling.innerHTML)}else if(BX.proxy_context.getAttribute("data-entity")=="put"){var t=BX.proxy_context.nextSibling.innerHTML;BXMobileApp.UI.Page.TextPanel.getText(function(e){if(e){t=BX.util.trim(e)+" "+t}BXMobileApp.UI.Page.TextPanel.setText(t+" ");BXMobileApp.UI.Page.TextPanel.focus()})}else if(BX.proxy_context.getAttribute("data-entity")=="call"){this.BXIM.phoneTo(BX.proxy_context.getAttribute("data-command"))}return BX.PreventDefault(e)},this));BX.adjust(BX("im-dialog-invite"),{children:[BX.create("div",{props:{className:"bx-messenger-textarea-open-invite"},children:[BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text-box"},children:[BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text-box-element"},children:[this.popupMessengerTextareaOpenText=BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text"},html:BX.message("IM_O_INVITE_TEXT")})]})]}),this.popupMessengerTextareaOpenJoin=BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-join bx-notifier-item-button bx-notifier-item-button-confirm bx-notifier-item-button-accept"},html:BX.message("IM_O_INVITE_JOIN")})]}),BX.create("div",{props:{className:"bx-messenger-textarea-open-lines"},children:[BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text-box"},children:[BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text-box-element"},children:[this.popupMessengerTextareaOpenLinesText=BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text"},html:BX.message("IM_OL_INVITE_TEXT")})]})]}),BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-join-box"},children:[this.popupMessengerTextareaOpenLinesAnswer=BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-answer bx-notifier-item-button bx-notifier-item-button-confirm bx-notifier-item-button-accept"},html:BX.message("IM_OL_INVITE_ANSWER")}),this.popupMessengerTextareaOpenLinesSkip=BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-skip bx-notifier-item-button bx-notifier-item-button-confirm bx-notifier-item-button-cancel"},html:BX.message("IM_OL_INVITE_SKIP")}),BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-transfer bx-notifier-item-button bx-notifier-item-button-confirm bx-notifier-item-button-transfer"},html:BX.message("IM_OL_INVITE_TRANSFER"),events:{click:BX.delegate(function(e){this.messenger.linesTransfer(this.messenger.currentTab.toString().substr(4))},this)}})]})]}),BX.create("div",{props:{className:"bx-messenger-textarea-general-invite"},children:[BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text-box"},children:[BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-text-box-element"},children:[this.popupMessengerTextareaGeneralText=BX.create("div",{props:{id:"im-dialog-invite-text",className:"bx-messenger-textarea-open-invite-text"}})]})]}),this.popupMessengerTextareaGeneralJoin=BX.create("div",{props:{className:"bx-messenger-textarea-open-invite-join bx-notifier-item-button bx-notifier-item-button-confirm bx-notifier-item-button-accept"},html:BX.message("IM_G_JOIN_"+this.userGender)})]})]});BX.adjust(BX("im-dialog-form"),{children:[this.messenger.popupMessengerFileForm=BX.create("form",{attrs:{action:this.pathToFileAjax},props:{className:"bx-messenger-textarea-file-form"},children:[BX.create("input",{attrs:{type:"hidden",name:"IM_FILE_UPLOAD",value:"Y"}}),this.messenger.popupMessengerFileFormChatId=BX.create("input",{attrs:{type:"hidden",name:"CHAT_ID",value:0}}),this.messenger.popupMessengerFileFormRegChatId=BX.create("input",{attrs:{type:"hidden",name:"REG_CHAT_ID",value:0}}),this.messenger.popupMessengerFileFormRegMessageText=BX.create("input",{attrs:{type:"hidden",name:"REG_MESSAGE_TEXT",value:""}}),this.messenger.popupMessengerFileFormRegMessageId=BX.create("input",{attrs:{type:"hidden",name:"REG_MESSAGE_ID",value:0}}),this.messenger.popupMessengerFileFormRegParams=BX.create("input",{attrs:{type:"hidden",name:"REG_PARAMS",value:""}}),this.messenger.popupMessengerFileFormRegMessageHidden=BX.create("input",{attrs:{type:"hidden",name:"REG_MESSAGE_HIDDEN",value:"N"}}),BX.create("input",{attrs:{type:"hidden",name:"IM_AJAX_CALL",value:"Y"}}),this.messenger.popupMessengerFileFormInput=BX.create("input",{attrs:{type:"hidden",name:"FAKE_INPUT",value:"Y"}})]})]});this.disk.chatDialogInit();BX.bind(this.popupMessengerTextareaGeneralJoin,"click",BX.delegate(function(){this.settings.generalNotify=false;this.saveSettings({generalNotify:this.settings.generalNotify});this.messenger.dialogStatusRedrawDelay();setTimeout(BX.delegate(function(){this.messenger.autoScroll()},this),300);return true},this));BX.bind(this.popupMessengerTextareaOpenJoin,"click",BX.delegate(function(){if(this.messenger.currentTab.substr(0,4)!="chat")return false;var e=this.messenger.currentTab.substr(4);BX.MessengerCommon.joinToChat(e);return true},this));BX.bind(this.popupMessengerTextareaOpenLinesAnswer,"click",BX.delegate(function(){if(this.messenger.currentTab.substr(0,4)!="chat")return false;var e=this.messenger.currentTab.substr(4);if(!BX.MessengerCommon.userInChat(e)){var t=BX.MessengerCommon.linesGetSession(this.messenger.chat[e]);if(parseInt(t.id)<=0){BX.MessengerCommon.linesStartSession(e)}else{BX.MessengerCommon.linesJoinSession(e)}}else{BX.MessengerCommon.linesAnswer(e)}return true},this));BX.bind(this.popupMessengerTextareaOpenLinesSkip,"click",BX.delegate(function(){if(this.messenger.currentTab.substr(0,4)!="chat")return false;var e=this.messenger.currentTab.substr(4);if(!BX.MessengerCommon.userInChat(e))BX.MessengerCommon.dialogCloseCurrent(true);else BX.MessengerCommon.linesSkip(e);return true},this));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-keyboard-button-text"},BX.delegate(BX.MessengerCommon.clickButtonKeyboard,BX.MessengerCommon));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{tagName:"a"},BX.delegate(function(e){BX.localStorage.set("impmh",true,1)},this));BX.MobileUI.addCopyableDialog(this.messenger.popupMessengerBodyWrap,"bx-messenger-content-item-content","bx-messenger-message",BX.delegate(function(e){var t=e.id.replace("im-message-","");if(!this.messenger.message[t]){return false}var s=BX.MessengerCommon.prepareTextBack(this.messenger.message[t].text,true);if(this.messenger.message[t].params&&this.messenger.message[t].params["FILE_ID"]&&this.messenger.message[t].params["FILE_ID"].length>0){for(var i=0;i<this.messenger.message[t].params.FILE_ID.length;i++){var a=this.messenger.message[t].params.FILE_ID[i];var n=this.messenger.message[t].chatId;if(this.messenger.disk.files[n][a]){s+=" ["+BX.message("IM_F_FILE")+": "+this.messenger.disk.files[n][a].name+"]"}else{s+=" ["+BX.message("IM_F_FILE")+"]"}}}return BX.util.trim(s)},this));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-content-item-content"},BX.delegate(function(e){var t=BX.proxy_context.parentNode.getAttribute("data-blockmessageid");this.messenger.openMessageMenu(t)},this));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-content-reply"},BX.delegate(function(e){var t=BX.proxy_context.parentNode.getAttribute("data-chatid");var s=BX.proxy_context.parentNode.getAttribute("data-messageid");BX.MessengerCommon.joinParentChat(s,t)},this));BX.bindDelegate(this.messenger.popupMessengerBodyWrap,"click",{className:"bx-messenger-content-item-error"},BX.delegate(function(e){BX.localStorage.set("impmh",true,1);BX.MessengerCommon.sendMessageRetry();return BX.PreventDefault(e)},this))}};BX.ImMobile.prototype.recentPageAction=function(e){BXMobileApp.addCustomEvent("onPhoneTo",BX.delegate(function(e){this.phoneTo(e.number,e.params)},this));BX.addCustomEvent("UIApplicationDidBecomeActiveNotification",BX.delegate(function(e){setTimeout(BX.delegate(this.updateStateLight,this),1e3)},this));BXMobileApp.addCustomEvent("onPull-main",BX.delegate(function(e){if(typeof e.command!="undefined"&&e.command=="user_counter"&&typeof e.params!="undefined"&&typeof e.params[BX.message("SITE_ID")]!="undefined"){this.notify.updateNotifyCounters(e.params[BX.message("SITE_ID")]);this.updateCounter()}},this));this.show=false;BX.addCustomEvent("onNotificationsOpen",this.onNotificationsOpen.bind(this));BX.addCustomEvent("onNotificationsClose",this.onNotificationsClose.bind(this));var t=BX.delegate(function(t){e=t.params;command=t.command;if(command=="readMessage"){this.messageCountArray[e.userId]=0;this.updateCounter()}else if(command=="readMessageChat"){this.messageCountArray["chat"+e.chatId]=0;this.updateCounter()}else if(command=="chatUserLeave"){if(e.userId==BX.message("USER_ID")){this.messageCountArray["chat"+e.chatId]=0;this.updateCounter()}}else if(command=="message"||command=="messageChat"){var s=e.message.senderId;if(s==BX.message("USER_ID")){this.messageCountArray[e.message.recipientId]=0;this.updateCounter();return}if(command=="messageChat")s=e.message.recipientId;if(typeof this.messageCountArray[s]!="undefined")this.messageCountArray[s]++;else this.messageCountArray[s]=1;app.getVar({var:"PAGE_ID",from:"current",callback:BX.delegate(function(e){if(e=="DIALOG"+s)this.messageCountArray[s]=0;this.updateCounter()},this)})}else if(command=="notify"){this.notifyCount=e.counter;this.updateCounter();this.notifyRefresh()}else if(command=="readNotifyList"||command=="unreadNotifyList"||command=="confirmNotify"){this.notifyCount=e.counter;this.updateCounter();this.notifyRefresh()}},this);BXMobileApp.addCustomEvent("onPull-im",BX.delegate(function(e){if(e.data){for(var s in e.data){t(e.data[s])}}else{t(e)}},this));BXMobileApp.addCustomEvent("onImDialogOpen",BX.delegate(function(e){this.messageCountArray[e.id]=0;this.updateCounter()},this));this.updateStateLight()};BX.ImMobile.prototype.notifyRefresh=function(){clearTimeout(this.refreshTimeout);this.refreshTimeout=setTimeout(function(){app.refreshPanelPage("notifications");console.info("RecentList.notify: refresh")},200);return true};BX.ImMobile.prototype.notifyRead=function(e){e=parseInt(e);if(e<=0)return false;this.notify.notifyViewed(e);return true};BX.ImMobile.prototype.onNotificationsOpen=function(e){console.info("RecentList.notify: window is open",e);this.notifyCount=0;this.updateCounter()};BX.ImMobile.prototype.onNotificationsClose=function(e){console.info("RecentList.notify: window is close, message was read ("+e+" and higher)");this.notifyRead(e)};BX.ImMobile.prototype.initPageAction=function(e){BXMobileApp.addCustomEvent("onImError",BX.delegate(function(t){if(e=="AUTHORIZE_ERROR"){app.BasicAuth({success:BX.delegate(function(){setTimeout(BX.delegate(this.updateStateLight,this),1e3)},this)})}else if(e=="RECENT_RELOAD"){app.BasicAuth({success:BX.delegate(function(){setTimeout(BX.delegate(this.updateStateLight,this),1e3)},this)})}},this));var t=BX.delegate(function(e){var t=BXMobileApp.PushManager.prepareParams(e);if(t.TAG){t.ACTION=t.TAG}if(t.ACTION&&t.ACTION.substr(0,8)=="IM_MESS_"){var s=parseInt(t.ACTION.substr(8));if(s>0){BXMobileApp.PageManager.loadPageUnique({url:this.pathToRoot+"mobile/im/dialog.php"+(!app.enableInVersion(11)?"?id="+s:""),bx24ModernStyle:true,data:{dialogId:s}})}}else if(t.ACTION&&t.ACTION.substr(0,8)=="IM_CHAT_"){var i=parseInt(t.ACTION.substr(8));if(i>0){BXMobileApp.PageManager.loadPageUnique({url:this.pathToRoot+"mobile/im/dialog.php"+(!app.enableInVersion(11)?"?id=chat"+i:""),bx24ModernStyle:true,data:{dialogId:"chat"+i}})}}else if(t.ACTION&&t.ACTION.substr(0,6)=="IMINV_"){var a=t.ACTION.split("_");var s=parseInt(a[1]);var n=parseInt(a[2]);var o=a.length>=4&&a[3]=="Y";var r=function(){if(!mwebrtc.timesUp(n*1e3)){BX.ready(function(){setTimeout(function(){mwebrtc.callInvite(s,o)},1500)})}};if(BX.PULL.supportWebSocket()){if(BX.PULL.isWebSoketConnected()){r()}else{var l=function(e){if(e=="online"){r();BX.removeCustomEvent(window,"onPullStatus",l)}};BX.addCustomEvent(window,"onPullStatus",l);setTimeout(function(){BX.removeCustomEvent(window,"onPullStatus",l)},15e3)}}else{r()}}else if(t.ACTION&&t.ACTION.substr(0,8)=="VI_CALL_"){BX.localStorage.set("viInvite",t.PARAMS,30)}},this);var s=function(){if(BXMobileAppContext["getLastPhoneNumber"]){if(BXMobileAppContext.getLastPhoneNumber().length>0){BX.MobileTools.phoneTo(BXMobileAppContext.getLastPhoneNumber(),{callMethod:"telephony"});BXMobileAppContext.removeLastPhoneNumber()}}};if(app.enableInVersion(15)){BX.addCustomEvent("UIApplicationDidBecomeActiveNotification",function(){var e=BXMobileApp.PushManager.getLastNotification();if(e&&e!={})t(e);else{s()}});t(BXMobileApp.PushManager.getLastNotification());s()}else BX.addCustomEvent("onOpenPush",t);app.setPanelPages({messages_page:this.pathToRoot+"mobile/im/index.php?NEW",messages_open_empty:true,notifications_page:this.pathToRoot+"mobile/im/notify.php?v2",notifications_open_empty:true})};BX.ImMobile.prototype.dialogPageAction=function(e){BXMobileApp.addCustomEvent("onImError",BX.delegate(function(e){if(e=="AUTHORIZE_ERROR"){app.BasicAuth({success:function(){}})}},this));this.messenger.popupMessengerBody=document.body;this.messenger.popupMessengerBodyWrap=BX("im-dialog-wrap");BX.addClass(this.messenger.popupMessengerBodyWrap,"bx-messenger-dialog-wrap");this.messenger.dialogOpen=true;clearInterval(this.serviceInterval);this.serviceInterval=setInterval(function(){BX.MessengerCommon.checkProgessMessage()},1e3)};BX.ImMobile.prototype.updateStateLight=function(){clearTimeout(this.timeoutUpdateStateLight);if(this.isBackground()){return}this.timeoutUpdateStateLight=setTimeout(BX.delegate(function(){BX.ajax({url:this.pathToAjax,method:"POST",dataType:"json",skipAuthCheck:true,timeout:20,data:{IM_UPDATE_STATE_LIGHT:"Y",MOBILE:"Y",FOCUS:typeof BXMobileAppContext!="object"||BXMobileAppContext.isBackground()?"N":"Y",SITE_ID:BX.message("SITE_ID"),NOTIFY:"Y",MESSAGE:"Y",IM_AJAX_CALL:"Y",sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(e){BX.onCustomEvent("onUpdateStateDone",[true]);BXMobileApp.onCustomEvent("onUpdateStateDone",{result:true});if(e.ERROR.length==0){BX.message({SERVER_TIME:e.SERVER_TIME});if(BX.PULL&&e.PULL_CONFIG){BX.PULL.updateChannelID({METHOD:e.PULL_CONFIG.METHOD,CHANNEL_ID:e.PULL_CONFIG.CHANNEL_ID,CHANNEL_DT:e.PULL_CONFIG.CHANNEL_DT,PATH:e.PULL_CONFIG.PATH,LAST_ID:e.PULL_CONFIG.LAST_ID,PATH_WS:e.PULL_CONFIG.PATH_WS})}if(e.COUNTER_MESSAGES)this.messageCount=parseInt(e.COUNTER_MESSAGES);if(e.COUNTER_NOTIFICATIONS)this.notifyCount=parseInt(e.COUNTER_NOTIFICATIONS);if(e.NOTIFY_LAST_ID)this.notify.notifyLastId=parseInt(e.NOTIFY_LAST_ID);if(this.messageCount>0&&e.COUNTER_UNREAD_MESSAGES&&typeof e.COUNTER_UNREAD_MESSAGES=="object"){this.messageCount=0;this.messageCountArray={};for(var t in e.COUNTER_UNREAD_MESSAGES){this.messageCount+=e.COUNTER_UNREAD_MESSAGES[t].MESSAGE.counter;this.messageCountArray[t]=e.COUNTER_UNREAD_MESSAGES[t].MESSAGE.counter}BX.onCustomEvent("onUpdateUserCounters",[e.COUNTER_UNREAD_MESSAGES]);BXMobileApp.onCustomEvent("onUpdateUserCounters",e.COUNTER_UNREAD_MESSAGES)}else{this.messageCountArray={};BX.onCustomEvent("onUpdateUserCounters",[e.COUNTER_UNREAD_MESSAGES]);BXMobileApp.onCustomEvent("onUpdateUserCounters",e.COUNTER_UNREAD_MESSAGES)}this.updateCounter();if(e.COUNTERS&&typeof e.COUNTERS=="object"){var s=e.COUNTERS_ZERO_DATE&&typeof e.COUNTERS_ZERO_DATE=="object"?e.COUNTERS_ZERO_DATE:null;BX.onCustomEvent("onImUpdateCounter",[e.COUNTERS,s]);this.notify.updateNotifyCounters(e.COUNTERS);var i=BX.clone(e.COUNTERS);i.obZeroDate=s;i.SERVER_TIME=e.SERVER_TIME;setTimeout(function(){BXMobileApp.onCustomEvent("onImUpdateCounter",i)},3e3)}if(this.notifyCount>0){clearTimeout(this.notifyTimeout);this.notifyTimeout=setTimeout(BX.delegate(function(){this.notify.notifyLoadFlag=true;app.refreshPanelPage("notifications")},this),100)}this.sendAjaxTry=0;if(BX.PULL){if(!BX.PULL.tryConnect()){BX.PULL.updateState(true)}}clearTimeout(this.timeoutUpdateStateLight);this.timeoutUpdateStateLight=setTimeout(BX.delegate(function(){this.updateStateLight()},this),this.updateStateInterval*1e3)}else if(e.ERROR=="AUTHORIZE_ERROR"&&this.sendAjaxTry<=3){this.sendAjaxTry++;BX.onCustomEvent("onImError",[e.ERROR]);clearTimeout(this.timeoutUpdateStateLight);this.timeoutUpdateStateLight=setTimeout(BX.delegate(function(){this.updateStateLight()},this),2e3)}else if(e.ERROR=="SESSION_ERROR"&&this.sendAjaxTry<=3){this.sendAjaxTry++;BX.message({bitrix_sessid:e.BITRIX_SESSID});clearTimeout(this.timeoutUpdateStateLight);this.timeoutUpdateStateLight=setTimeout(BX.delegate(function(){this.updateStateLight()},this),1e3)}else{this.sendAjaxTry=0}},this),onfailure:BX.delegate(function(e){BX.onCustomEvent("onUpdateStateDone",[false]);BXMobileApp.onCustomEvent("onUpdateStateDone",{result:false});this.sendAjaxTry=0},this)})},this),300)};BX.ImMobile.prototype.updateCounter=function(){clearTimeout(this.timeoutUpdateCounters);this.timeoutUpdateCounters=setTimeout(BX.delegate(function(){this.messageCount=0;for(var e in this.messageCountArray)this.messageCount+=parseInt(this.messageCountArray[e]);this.logCount=0;if(typeof this.notify!="undefined"&&typeof this.notify.counters!="undefined"&&typeof this.notify.counters["**"]!="undefined"){this.logCount=parseInt(this.notify.counters["**"])}app.setBadge(parseInt(this.messageCount)+parseInt(this.notifyCount)+parseInt(this.logCount));app.setCounters({messages:parseInt(this.messageCount),notifications:parseInt(this.notifyCount)})},this),500)};BX.ImMobile.prototype.isFocus=function(){return false};BX.ImMobile.prototype.isBackground=function(){if(typeof BXMobileAppContext=="object"){if(typeof BXMobileAppContext.isAppActive=="function")return!BXMobileAppContext.isAppActive();else if(typeof BXMobileAppContext.isBackground=="function")return BXMobileAppContext.isBackground()}return false};BX.ImMobile.prototype.isFocusMobile=function(e){if(this.isBackground()){e(false)}else{BXMobileApp.UI.Page.isVisible({callback:BX.delegate(function(t){e(t.status=="visible")},this)})}return null};BX.ImMobile.prototype.isMobile=function(){return false};BX.ImMobile.prototype.checkRevision=function(e){if(typeof e=="number"&&this.revision<e){console.log("NOTICE: Window reload, because REVISION UP ("+this.revision+" -> "+e+")");location.reload();return false}return true}})();(function(){if(BX.ImMessengerMobile)return;BX.ImMessengerMobile=function(e,t){this.BXIM=e;this.settings={};this.params=t||{};this.notify=t.notifyClass;this.disk=t.diskClass;this.bot=t.bot;this.smile=t.smile;this.smileSet=t.smileSet;this.popupMessengerLikeBlock={};this.popupMessengerLikeBlockTimeout={};this.popupMessengerSendingTimeout={};this.sendAjaxTry=0;this.updateStateStepDefault=this.BXIM.ppStatus?parseInt(t.updateStateInterval):60;this.updateStateStep=this.updateStateStepDefault;this.updateStateTimeout=null;this.readMessageTimeout={};this.readMessageTimeoutSend=null;this.realSearchAvailable=!this.BXIM.userExtranet||!this.BXIM.bitrixIntranet&&!this.BXIM.bitrix24net;this.realSearch=false;this.realSearchFound=true;this.users=t.users;for(var s in this.users){this.users[s].absent=this.users[s].absent?new Date(this.users[s].absent):false;this.users[s].idle=this.users[s].idle?new Date(this.users[s].idle):false;this.users[s].mobile_last_date=new Date(this.users[s].mobile_last_date);this.users[s].last_activity_date=new Date(this.users[s].last_activity_date)}this.businessUsers=t.businessUsers;this.openlines=t.openlines;this.groups=t.groups;this.userInGroup=t.userInGroup;this.redrawTab={};this.loadLastMessageTimeout={};this.loadLastMessageClassTimeout={};this.showMessage=t.showMessage;this.unreadMessage=t.unreadMessage;this.flashMessage=t.flashMessage;this.history=t.history||{};this.openChatEnable=t.openChatEnable||true;this.chat=t.chat;for(var i in this.chat){this.chat[i].date_create=new Date(this.chat[i].date_create)}this.userChat=t.userChat;this.userInChat=t.userInChat;this.userChatBlockStatus=t.userChatBlockStatus;this.userChatOptions=t.userChatOptions;this.blockJoinChat={};this.hrphoto=t.hrphoto;this.chatPublicWatch=0;this.chatPublicWatchAdd=false;this.dialogStatusRedrawTimeout=null;this.chatHeaderRedrawTimeout=null;this.textareaHistory={};this.popupMessengerLiveChatDelayedFormMid=0;this.popupMessengerLiveChatActionTimeout=null;this.popupMessengerLiveChatDelayedForm=null;this.popupMessengerLiveChatFormStage=null;this.mentionList={};this.mentionListen=false;this.mentionDelimiter="";this.phones={};this.errorMessage={};this.message=t.message;for(var a in this.message){this.message[a].date=new Date(this.message[a].date)}this.messageTmpIndex=0;this.messageCount=t.countMessage;this.sendMessageFlag=0;this.sendMessageTmp={};this.sendMessageTmpTimeout={};this.popupMessenger={fake:true};this.popupMessengerTextarea=null;this.openChatFlag=false;this.popupMessengerLastMessage=0;this.readedList={};this.writingList={};this.writingListTimeout={};this.writingSendList={};this.writingSendListTimeout={};this.contactListPanelStatus=null;this.contactListSearchText="";this.contactListSearchLastText="";this.popupChatDialogContactListElementsType="";this.popupContactListElementsWrap=null;this.popupContactListSearchInput=null;this.popupContactListElementsSize=window.screen.height;this.popupMessengerConnectionStatusState="online";this.popupMessengerConnectionStatusStateText="online";this.popupMessengerConnectionStatus=null;this.popupMessengerConnectionStatusText=null;this.popupMessengerConnectionStatusTimeout=null;this.recent=t.recent?t.recent:[];this.recentListLoad=t.recent?true:false;this.recentListTab=null;this.recentListTabCounter=null;this.recentListIndex=[];this.currentTab=0;this.generalChatId=t.generalChatId;this.canSendMessageGeneralChat=t.canSendMessageGeneralChat;this.chatList=false;this.recentList=true;this.contactList=false;this.contactListShowed={};this.contactListTab=null;this.contactListLoad=false;this.redrawContactListTimeout={};this.redrawRecentListTimeout=null;this.enableGroupChat=this.BXIM.ppStatus?true:false;this.historySearch="";this.historyOpenPage={};this.historyLoadFlag={};this.historyEndOfList={};this.popupMessengerBody=null;this.popupMessengerBodyDialog=null;this.popupMessengerBodyAnimation=null;this.popupMessengerBodySize=295;this.popupMessengerBodyWrap=null;this.popupMessengerFileForm=null;this.popupMessengerFileDropZone=null;this.popupMessengerFileButton=null;this.popupMessengerFileFormChatId=null;this.popupMessengerFileFormInput=null;this.linesSilentMode={}};BX.ImMessengerMobile.prototype.tooltip=function(e,t,s){if(typeof t=="object"){t=t.outerHTML}new BXMobileApp.UI.NotificationBar({message:t,contentType:"html",color:"#af000000",textColor:"#ffffff",groupId:"im-tooltip",maxLines:4,align:"left",indicatorHeight:30,isGlobal:true,useCloseButton:true,hideOnTap:true},"im-tooltip").show()};BX.ImMessengerMobile.prototype.newMessage=function(){var e=[];var t=[];var s=0;var i={};for(var a in this.flashMessage){var n=false;var o=false;if(a==this.currentTab){n=true}else if(a.toString().substr(0,4)=="chat"&&this.userChatBlockStatus[a.substr(4)]&&this.userChatBlockStatus[a.substr(4)][this.BXIM.userId]){o=true}if(n||o){for(var r in this.flashMessage[a]){if(this.flashMessage[a][r]!==false){this.flashMessage[a][r]=false;s++}}continue}for(var r in this.flashMessage[a]){if(this.flashMessage[a][r]!==false){var l=this.message[r].recipientId.toString().substr(0,4)=="chat";var h=this.message[r].recipientId;var p=!l&&this.message[r].senderId==0?a:this.message[r].senderId;var u=this.message[r].text_mobile?this.message[r].text_mobile:this.message[r].text;if(a!=this.BXIM.userId){if(l){if(this.chat[h.substr(4)]){i[a]=this.chat[h.substr(4)].name}}else{if(this.users[p]){i[a]=this.users[p].name}}}u=u.replace(/------------------------------------------------------(.*?)------------------------------------------------------/gim,"["+BX.message("IM_M_QUOTE_BLOCK")+"]");if(u.length>150){u=u.substr(0,150);var m=u.lastIndexOf(" ");if(m<140)u=u.substr(0,m)+"...";else u=u.substr(0,140)+"..."}if(u==""&&this.message[r].params["FILE_ID"].length>0){u="["+BX.message("IM_F_FILE")+"]"}u=u.replace(/\[USER=([0-9]{1,})\](.*?)\[\/USER\]/gi,function(e,t,s){return s});u=u.replace(/\[PCH=([0-9]{1,})\](.*?)\[\/PCH\]/gi,function(e,t,s){return s});var c="private";var g=l?this.chat[h.substr(4)].avatar:this.users[p].avatar;if(l){if(h.substr(4)==this.generalChatId){c="general"}else{c=this.chat[h.substr(4)].type}}t.push({id:l?h:p,title:l?this.chat[h.substr(4)].name:this.users[p].name,text:(l&&p>0?this.users[p].name+": ":"")+u,icon:BX.MessengerCommon.isBlankAvatar(g)?BX.MessengerCommon.getDefaultAvatar(c):g,tag:"im-messenger-"+(l?h:p)});this.flashMessage[a][r]=false}}}if(t.length>2){var d=t.length;var f="";for(var a in i)f+=", <i>"+i[a]+"</i>";t=[];t.push({id:"im-common",title:BX.message("IM_NM_MESSAGE_1").replace("#COUNT#",d),icon:BX.MessengerCommon.getDefaultAvatar("notify"),text:BX.message("IM_NM_MESSAGE_2").replace("#USERS#",BX.util.htmlspecialcharsback(f.substr(2))).replace(/<\/?[^>]+>/gi,""),tag:"im-messenger"})}else if(t.length==0){return false}for(var a=0;a<t.length;a++){var M=function(){};if(t[a].tag=="im-messenger"){M=function(){BXMobileApp.UI.Slider.setState(BXMobileApp.UI.Slider.state.RIGHT)}}else{M=BX.proxy(function(e){this.openMessenger(e.extra.dialogId)},this)}new BXMobileApp.UI.NotificationBar({message:"<b>"+t[a].title+"</b><br>"+t[a].text,contentType:"html",color:"#af000000",textColor:"#ffffff",groupId:t[a].tag,maxLines:4,align:"left",imageURL:t[a].icon,imageBorderRadius:50,indicatorHeight:30,isGlobal:true,useCloseButton:true,autoHideTimeout:5e3,hideOnTap:true,onTap:M,extra:{dialogId:t[a].id}},t[a].id).show()}};BX.ImMessengerMobile.prototype.drawRecentList=function(){app.pullDown({enable:true,pulltext:BX.message("IM_PULLDOWN_RL_1"),downtext:BX.message("IM_PULLDOWN_RL_2"),loadtext:BX.message("IM_PULLDOWN_RL_3"),callback:function(){app.BasicAuth({success:function(){app.pullDownLoadingStop();BXMobileApp.UI.Page.reload()},failture:function(){app.pullDownLoadingStop()}})}});this.popupContactListWrap=BX("im-contact-list-search");this.popupContactListWrap.innerHTML="";BX.addClass(this.popupContactListWrap,"bx-messenger-cl-wrap");BX.unbindAll(this.popupContactListWrap);BX.adjust(this.popupContactListWrap,{children:[BX.create("div",{props:{className:"bx-messenger-cl-search"+(this.webrtc.phoneEnabled?" bx-messenger-cl-search-with-call":"")},children:[this.webrtc.phoneEnabled?this.popupContactListSearchCall=BX.create("span",{props:{className:"bx-messenger-cl-switcher-tab-wrap bx-messenger-input-search-call"},html:'<span class="bx-messenger-input-search-call-icon"></span>'}):null,BX.create("div",{props:{className:"bx-messenger-input-wrap bx-messenger-cl-search-wrap"},children:[this.popupContactListSearchClose=BX.create("span",{props:{className:"bx-messenger-input-close"}}),this.popupContactListSearchInput=BX.create("input",{attrs:{type:"text",placeholder:BX.message("IM_SEARCH_PLACEHOLDER_CP"),value:this.contactListSearchText},props:{className:"bx-messenger-input"}})]})]})]});BX.unbindAll(this.popupContactListSearchInput);BX.bind(this.popupContactListSearchInput,"focus",BX.delegate(function(){if(this.contactListSearchText.length==0&&!this.chatList){BX.MessengerCommon.chatListRedraw()}},this));BX.bind(this.popupContactListSearchInput,"keyup",BX.delegate(function(e){BX.MessengerCommon.contactListSearch(e)},this));if(this.webrtc.phoneEnabled){BX.unbindAll(this.popupContactListSearchCall);BX.bind(this.popupContactListSearchCall,"click",function(){BX.MobileCallUI.numpad.show()})}this.popupContactListElementsWrap=BX("im-contact-list-wrap");this.popupContactListElementsWrap.innerHTML="";BX.unbindAll(this.popupContactListElementsWrap);BX.addClass(this.popupContactListElementsWrap,"bx-messenger-recent-wrap");BX.unbindAll(this.popupContactListSearchClose);BX.bind(this.popupContactListSearchClose,"click",BX.delegate(BX.MessengerCommon.contactListSearchClear,BX.MessengerCommon));if(this.recent.length==0){BX.MessengerCommon.chatListRedraw()}else{BX.MessengerCommon.userListRedraw()}};BX.ImMessengerMobile.prototype.openPhotoGallery=function(e){var t=BX.findChildrenByClassName(this.BXIM.messenger.popupMessengerBodyWrap,"bx-messenger-file-image-src");var s=[];for(var i=0;i<t.length;i++){var a=t[i].getAttribute("data-chatId");var n=t[i].getAttribute("data-diskId");if(a&&n&&this.disk.files[a]&&this.disk.files[a][n]){var o=this.disk.files[a][n];if(o.type!="image")continue;s.push({url:o.urlShow,description:o.name})}else{var r=BX.findChildByClassName(t[i],"bx-messenger-file-image-text");s.push({url:r.getAttribute("src"),description:""})}}if(s.length>0){BX.localStorage.set("impmh",true,1);BXMobileApp.UI.Photo.show({photos:s,default_photo:e})}};BX.ImMessengerMobile.prototype.dialogStatusRedraw=function(e){if(this.BXIM.mobileAction!="DIALOG")return false;var t=e&&e.type?parseInt(e.type):"none";clearTimeout(this.dialogStatusRedrawTimeout);this.dialogStatusRedrawTimeout=setTimeout(BX.delegate(function(){this.dialogStatusRedrawDelay(e)},this),200)};BX.ImMessengerMobile.prototype.dialogStatusRedrawDelay=function(e){e=e||{};if(this.currentTab==0)return false;window.PAGE_ID="DIALOG"+this.currentTab;this.openChatFlag=false;this.openCallFlag=false;this.openLinesFlag=false;if(this.currentTab.toString().substr(0,4)=="chat"){this.openChatFlag=true;if(this.chat[this.currentTab.toString().substr(4)]&&this.chat[this.currentTab.toString().substr(4)].type=="call")this.openCallFlag=true;else if(this.chat[this.currentTab.toString().substr(4)]&&this.chat[this.currentTab.toString().substr(4)].type=="lines")this.openLinesFlag=true}if(this.openChatFlag){var t=this.currentTab.toString().substr(4);if(this.chat[t]&&this.chat[t].type!="call"){var s=this.userChatBlockStatus[t]&&this.userChatBlockStatus[t][this.BXIM.userId]?BX.message("IM_CHAT_MUTE_ON"):BX.message("IM_CHAT_MUTE_OFF");var i=[];if(!(this.chat[t].type=="lines"||this.chat[t].type=="livechat")&&BX.MessengerCommon.userInChat(t)){i.push({icon:"glasses",name:s,action:BX.delegate(function(){BX.MessengerCommon.muteMessageChat(this.currentTab)},this)})}i.push({icon:"user",name:BX.message("IM_M_MENU_USERS"),action:BX.delegate(function(){BXMobileApp.PageManager.loadPageUnique({url:this.BXIM.pathToRoot+"mobile/im/chat.php?chat_id="+this.currentTab.toString().substr(4),bx24ModernStyle:true,data:{dialogId:this.currentTab}})},this)});if(this.chat[t].type=="livechat"){}else if(this.chat[t].type=="lines"){var t=this.currentTab.toString().substr(4);var a=BX.MessengerCommon.linesGetSession(this.chat[t]);if(this.chat[t].owner>0){i.push({icon:"add",name:BX.message("IM_M_MENU_ADD"),action:BX.delegate(function(){this.extendChat(this.currentTab,true,true)},this)});if(this.chat[t].owner==this.BXIM.userId){i.push({icon:"transfer",name:BX.message("IM_OL_INVITE_TRANSFER"),action:BX.delegate(function(){this.linesTransfer(t)},this)})}i.push({name:BX.message(this.linesSilentMode[t]?"IM_M_OL_SILENT_OFF":"IM_M_OL_SILENT_ON"),action:BX.delegate(function(){this.linesToggleSilentMode()},this)})}if(this.chat[t].owner==this.BXIM.userId){i.push({icon:"pause",name:BX.message(a.pin=="Y"?"IM_M_OL_PAUSE_OFF":"IM_M_OL_PAUSE_ON"),action:BX.delegate(function(){this.linesTogglePinMode()},this)});if(a.crm!="Y"){i.push({name:BX.message("IM_M_OL_ADD_LEAD"),action:BX.delegate(function(){this.linesCreateLead()},this)})}i.push({name:BX.message("IM_M_OL_CLOSE"),action:BX.delegate(function(){this.linesCloseDialog()},this)})}if(a.crmLink){i.push({name:BX.message("IM_M_OL_GOTO_CRM"),action:BX.delegate(function(){var e=BX.MobileTools.getMobileUrlParams(a.crmLink);if(e){BXMobileApp.PageManager.loadPageBlank(e)}},this)})}if(this.chat[t].owner==0){i.push({name:BX.message("IM_M_OL_SPAM"),action:BX.delegate(function(){this.linesMarkAsSpam()},this)})}}else if(!BX.MessengerCommon.checkRestriction(t,"EXTEND")&&BX.MessengerCommon.userInChat(t)){i.push({icon:"add",name:BX.message("IM_M_MENU_ADD"),action:BX.delegate(function(){this.extendChat(this.currentTab,true)},this)})}i.push({icon:"reload",name:BX.message("IM_M_MENU_RELOAD"),action:function(){BXMobileApp.UI.Page.TopBar.title.setText("");BXMobileApp.UI.Page.TopBar.title.setDetailText("");location.reload()}});if(this.chat[t].type=="livechat"||BX.MessengerCommon.checkRestriction(t,"LEAVE")){}else if(this.chat[t].type=="lines"){if(this.chat[t].owner>0&&this.chat[t].owner!=this.BXIM.userId){i.push({icon:"cross",name:BX.message("IM_M_MENU_LEAVE"),action:BX.delegate(function(){this.BXIM.openConfirm({title:BX.message("IM_MENU_WARN"),message:BX.message("IM_MENU_LEAVE_CONFIRM"),params:{chatId:t}},[{text:BX.message("IM_MENU_MESS_DEL_YES"),callback:function(e){BX.MessengerCommon.leaveFromChat(e.chatId)}},{text:BX.message("IM_MENU_CANCEL")}])},this)})}}else if(BX.MessengerCommon.userInChat(t)){i.push({icon:"cross",name:BX.message("IM_M_MENU_LEAVE"),action:BX.delegate(function(){this.BXIM.openConfirm({title:BX.message("IM_MENU_WARN"),message:BX.message("IM_MENU_LEAVE_CONFIRM"),params:{chatId:t}},[{text:BX.message("IM_MENU_MESS_DEL_YES"),callback:function(e){BX.MessengerCommon.leaveFromChat(e.chatId)}},{text:BX.message("IM_MENU_CANCEL")}])},this)})}app.menuCreate({useNavigationBarColor:true,items:i})}else{app.menuCreate({useNavigationBarColor:true,items:[{icon:"audio",name:BX.message("IM_AUDIO_CALL"),action:BX.delegate(function(){this.BXIM.phoneTo(this.chat[t].call_number)},this)},{icon:"reload",name:BX.message("IM_M_MENU_RELOAD"),action:function(){BXMobileApp.UI.Page.TopBar.title.setText("");BXMobileApp.UI.Page.TopBar.title.setDetailText("");location.reload()}}]})}if(this.chat[t]){var n="";if(this.chat[t].type=="lines"){n="#16938b"}else{n=this.chat[t].extranet?"#e8a441":this.chat[t].color}}}else if(this.currentTab){var o=this.currentTab;var r=[];var l={};BX.MessengerCommon.getUserParam(this.BXIM.userId);if(this.users[this.BXIM.userId]){l[this.BXIM.userId]=BX.util.objectClone(this.users[this.BXIM.userId]);if(l[this.BXIM.userId].name){l[this.BXIM.userId].name=BX.util.htmlspecialcharsback(l[this.BXIM.userId].name)}if(l[this.BXIM.userId].last_name){l[this.BXIM.userId].last_name=BX.util.htmlspecialcharsback(l[this.BXIM.userId].last_name)}if(l[this.BXIM.userId].first_name){l[this.BXIM.userId].first_name=BX.util.htmlspecialcharsback(l[this.BXIM.userId].first_name)}if(l[this.BXIM.userId].work_position){l[this.BXIM.userId].work_position=BX.util.htmlspecialcharsback(l[this.BXIM.userId].work_position)}}BX.MessengerCommon.getUserParam(o);if(this.users[o]){l[o]=BX.util.objectClone(this.users[o]);if(l[o].name){l[o].name=BX.util.htmlspecialcharsback(l[o].name)}if(l[o].last_name){l[o].last_name=BX.util.htmlspecialcharsback(l[o].last_name)}if(l[o].first_name){l[o].first_name=BX.util.htmlspecialcharsback(l[o].first_name)}if(l[o].work_position){l[o].work_position=BX.util.htmlspecialcharsback(l[o].work_position)}}if(this.BXIM.userId!=o&&this.users[o]&&!this.users[o].bot&&!this.users[o].network){var h=BX.MessengerCommon.countObject(this.phones[o]);if(h>0){r.push({title:BX.message("IM_AUDIO_CALL"),callback:BX.delegate(function(){BXMobileApp.onCustomEvent("onCallInvite",{userId:o,video:false,userData:l},true)},this)});if(this.phones[o].PERSONAL_MOBILE){r.push({title:BX.message("IM_PHONE_MOB")+": "+this.phones[o].PERSONAL_MOBILE,callback:BX.delegate(function(){this.BXIM.phoneTo(this.phones[o].PERSONAL_MOBILE)},this)})}if(this.phones[o].WORK_PHONE){r.push({title:BX.message("IM_PHONE_WORK")+": "+this.phones[o].WORK_PHONE,callback:BX.delegate(function(){this.BXIM.phoneTo(this.phones[o].WORK_PHONE)},this)})}if(this.phones[o].PERSONAL_PHONE){r.push({title:BX.message("IM_PHONE_DEF")+": "+this.phones[o].PERSONAL_PHONE,callback:BX.delegate(function(){this.BXIM.phoneTo(this.phones[o].PERSONAL_PHONE)},this)})}if(this.phones[o].INNER_PHONE&&this.webrtc.phoneEnabled){r.push({title:BX.message("IM_PHONE_DEF")+": "+this.phones[o].INNER_PHONE,callback:BX.delegate(function(){this.BXIM.phoneTo(this.phones[o].INNER_PHONE,{callMethod:"telephony"})},this)})}}}var p=[];p.push({icon:"user",name:BX.message("IM_M_MENU_USER"),action:BX.delegate(function(){app.loadPageBlank({url:this.BXIM.path.profileTemplate.replace("#user_id#",this.currentTab),bx24ModernStyle:true})},this)});p.push({icon:"add",name:BX.message("IM_M_MENU_ADD"),action:BX.delegate(function(){this.extendChat(this.currentTab,false)},this)});if(this.BXIM.userId!=o&&this.users[o]&&!this.users[o].bot&&!this.users[o].network){if(r.length>1){var u=new BXMobileApp.UI.ActionSheet({buttons:r},"call_audio");p.push({icon:"audio",name:BX.message("IM_AUDIO_CALL"),action:BX.delegate(function(){u.show()},this)})}else{p.push({icon:"audio",name:BX.message("IM_AUDIO_CALL"),action:BX.delegate(function(){BXMobileApp.onCustomEvent("onCallInvite",{userId:o,video:false,userData:l},true)},this)})}p.push({icon:"video",name:BX.message("IM_VIDEO_CALL_LIST"),action:BX.delegate(function(){BXMobileApp.onCustomEvent("onCallInvite",{userId:this.currentTab,video:true,userData:l},true)},this)})}p.push({icon:"reload",name:BX.message("IM_M_MENU_RELOAD"),action:function(){BXMobileApp.UI.Page.TopBar.title.setText("");BXMobileApp.UI.Page.TopBar.title.setDetailText("");location.reload()}});app.menuCreate({useNavigationBarColor:true,items:p});if(this.users[o]){var n=this.users[o].extranet?"#e8a441":this.users[o].color}}if(app.enableInVersion(10)){clearInterval(this.popupMessengerPanelLastDateInterval);if(this.openChatFlag&&this.chat[t]){this.redrawChatHeaderDelay()}else if(this.users[o]){BXMobileApp.UI.Page.TopBar.title.setText(BX.util.htmlspecialcharsback(this.users[o].name));BXMobileApp.UI.Page.TopBar.title.setImage(BX.MessengerCommon.isBlankAvatar(this.users[o].avatar)?BX.MessengerCommon.getDefaultAvatar("private"):this.users[o].avatar);var m=BX.delegate(function(){var e=BX.MessengerCommon.getUserPosition(this.users[o],true);BXMobileApp.UI.Page.TopBar.title.setDetailText(e)},this);m();this.popupMessengerPanelLastDateInterval=setInterval(m,6e4)}BXMobileApp.UI.Page.TopBar.title.setCallback(function(){app.menuShow()});BXMobileApp.UI.Page.TopBar.title.show()}else{app.addButtons({addRefreshButton:{type:"context-menu",style:"custom",callback:function(){app.menuShow()}}})}if(this.popupMessengerFileFormChatId){if(this.openChatFlag)this.popupMessengerFileFormChatId.value=t;else this.popupMessengerFileFormChatId.value=this.userChat[this.currentTab]?this.userChat[this.currentTab]:0}var c=[];var g=[];if(this.openChatFlag){if(this.generalChatId==t){if(!this.BXIM.popupMessengerTextareaGeneralText){this.BXIM.popupMessengerTextareaGeneralText=BX("im-dialog-invite-text")}if(!this.canSendMessageGeneralChat){if(this.textPanelShowed){this.textPanelShowed=false;BXMobileApp.UI.Page.TextPanel.hide()}this.BXIM.popupMessengerTextareaGeneralText.innerHTML=BX.message("IM_G_ACCESS");c.push("bx-messenger-chat-general-access");g.push("bx-messenger-chat-general-first-open")}else if(this.BXIM.settings.generalNotify){if(this.textPanelShowed){this.textPanelShowed=false;BXMobileApp.UI.Page.TextPanel.hide()}this.BXIM.popupMessengerTextareaGeneralText.innerHTML=BX.message("IM_G_JOIN").replace("#LINK_START#",'<a href="'+BX.message("IM_G_JOIN_LINK")+'" target="_blank" style="margin-left: 10px; text-decoration: underline;">').replace("#LINK_END#","</a>").replace("#ICON#",'<span class="bx-messenger-icon-notify-mute" onclick="BX.MessengerCommon.muteMessageChat(\'chat'+this.generalChatId+"');\"></span>");g.push("bx-messenger-chat-general-access");c.push("bx-messenger-chat-general-first-open")}else{if(!this.textPanelShowed){this.textPanelShowed=true;BXMobileApp.UI.Page.TextPanel.show()}g.push("bx-messenger-chat-general-first-open");g.push("bx-messenger-chat-general-access")}g.push("bx-messenger-chat-guest");g.push("bx-messenger-chat-lines")}else{g.push("bx-messenger-chat-general-first-open");g.push("bx-messenger-chat-general-access");g.push("bx-messenger-chat-lines");if(this.chat[t]&&this.chat[t].fake){}else if(BX.MessengerCommon.userInChat(t)){if(this.chat[t].type=="lines"&&this.chat[t].owner==0){if(this.textPanelShowed){this.textPanelShowed=false;BXMobileApp.UI.Page.TextPanel.hide()}c.push("bx-messenger-chat-guest");c.push("bx-messenger-chat-lines")}else{if(!this.textPanelShowed){this.textPanelShowed=true;BXMobileApp.UI.Page.TextPanel.show()}g.push("bx-messenger-chat-guest")}}else{if(this.textPanelShowed){this.textPanelShowed=false;BXMobileApp.UI.Page.TextPanel.hide()}c.push("bx-messenger-chat-guest")}}}else{g.push("bx-messenger-chat-general-first-open");g.push("bx-messenger-chat-general-access");g.push("bx-messenger-chat-guest");g.push("bx-messenger-chat-lines");if(!this.textPanelShowed){this.textPanelShowed=true;BXMobileApp.UI.Page.TextPanel.show()}}BX.removeClass(BX("im-dialog-invite"),g.join(" "));BX.addClass(BX("im-dialog-invite"),c.join(" "))};BX.ImMessengerMobile.prototype.autoScroll=function(){if(document.body.scrollHeight<=window.innerHeight)return false;this.popupMessengerBody.scrollTop=this.popupMessengerBody.scrollHeight;return true};BX.ImMessengerMobile.prototype.takePhotoMenu=function(){var e=new BXMobileApp.UI.ActionSheet({buttons:[{title:BX.message("IM_MENU_UPLOAD_PHOTO"),callback:BX.delegate(function(){app.takePhoto({quality:80,source:1,correctOrientation:true,targetWidth:1024,targetHeight:1024,destinationType:Camera.DestinationType.DATA_URL,callback:BX.delegate(this.disk.uploadFromMobile,this.disk)})},this)},{title:BX.message("IM_MENU_UPLOAD_GALLERY"),callback:BX.delegate(function(){app.takePhoto({quality:80,targetWidth:1024,targetHeight:1024,destinationType:Camera.DestinationType.DATA_URL,callback:BX.delegate(this.disk.uploadFromMobile,this.disk)})},this)}]},"textPanelSheet");e.show()};BX.ImMessengerMobile.prototype.updateChatAvatar=function(e,t){if(!this.openChatFlag)return false;var s=this.currentTab.toString().substr(4);if(e!=s)return false;if(app.enableInVersion(10)){if(BX.MessengerCommon.isBlankAvatar(t)){this.redrawChatHeaderDelay()}else{BXMobileApp.UI.Page.TopBar.title.setImage(t)}}};BX.ImMessengerMobile.prototype.textareaIconDialogClick=function(){app.alert({text:BX.message("IM_FUNCTION_FOR_BROWSER")})};BX.ImMessengerMobile.prototype.redrawChatHeader=function(){clearTimeout(this.chatHeaderRedrawTimeout);this.chatHeaderRedrawTimeout=setTimeout(BX.delegate(function(){this.redrawChatHeaderDelay()},this),200)};BX.ImMessengerMobile.prototype.redrawChatHeaderDelay=function(){if(!this.openChatFlag)return false;var e=this.currentTab.toString().substr(4);if(!this.chat[e])return false;if(this.popupMessengerFileFormChatId){this.popupMessengerFileFormChatId.value=e}if(app.enableInVersion(10)){var t=this.chat[e].type;BXMobileApp.UI.Page.TopBar.title.setText(BX.util.htmlspecialcharsback(this.chat[e].name));if(this.chat[e].type=="call"){BXMobileApp.UI.Page.TopBar.title.setDetailText(BX.message("IM_VI_CALL"))}else if(this.chat[e].type=="lines"){BXMobileApp.UI.Page.TopBar.title.setDetailText(BX.message("IM_LINES"))}else if(this.chat[e].type=="livechat"){BXMobileApp.UI.Page.TopBar.title.setDetailText(BX.message("IM_LINES"))}else{if(this.generalChatId==e&&this.userInChat[e]){t="general";BXMobileApp.UI.Page.TopBar.title.setDetailText(BX.message("IM_M_MENU_USERS")+": "+this.userInChat[e].length)}else if(this.chat[e].type=="open"){BXMobileApp.UI.Page.TopBar.title.setDetailText(BX.message("IM_CL_OPEN_CHAT"))}else{BXMobileApp.UI.Page.TopBar.title.setDetailText(BX.message("IM_CL_CHAT_2"))}}BXMobileApp.UI.Page.TopBar.title.setImage(BX.MessengerCommon.isBlankAvatar(this.chat[e].avatar)?BX.MessengerCommon.getDefaultAvatar(t):this.chat[e].avatar)}var s="";if(this.chat[e].type=="lines"){s="#16938b"}else{s=this.chat[e].extranet?"#e8a441":this.chat[e].color}};BX.ImMessengerMobile.prototype.extraClose=function(){app.closeController()};BX.ImMessengerMobile.prototype.openMessenger=function(e,t,s){if(this.BXIM.mobileAction=="RECENT"){s=s!==false;if(this.currentTab!=e){var i=BX.findChild(this.popupContactListElementsWrap,{attribute:{"data-userId":this.currentTab}},false);if(i){BX.removeClass(i,"bx-messenger-cl-item-active")}if(!t){i=BX.findChild(this.popupContactListElementsWrap,{attribute:{"data-userId":e}},false);if(i){t=i}}if(t){BX.addClass(t,"bx-messenger-cl-item-active")}this.currentTab=e}if(s){BXMobileApp.PageManager.loadPageUnique({url:this.BXIM.pathToRoot+"mobile/im/dialog.php"+(!app.enableInVersion(11)?"?id="+this.currentTab:""),bx24ModernStyle:true,data:{dialogId:this.currentTab}})}}else if(this.BXIM.mobileAction=="DIALOG"){if(!this.BXIM.messenger.redrawTab[e]&&this.currentTab==e&&this.popupMessengerBodyWrap.innerHTML!="")return false;if(typeof e=="undefined"||e==null)e=0;if(this.currentTab==null)this.currentTab=0;this.openChatFlag=false;this.openNetworkFlag=false;this.openCallFlag=false;this.openLinesFlag=false;if(e.toString().substr(0,4)=="chat"){this.openChatFlag=true;BX.MessengerCommon.getUserParam(e);if(this.chat[e.toString().substr(4)]&&this.chat[e.toString().substr(4)].type=="call")this.openCallFlag=true;else if(this.chat[e.toString().substr(4)]&&this.chat[e.toString().substr(4)].type=="lines")this.openLinesFlag=true}else if(e.toString().substr(0,7)=="network"){this.openNetworkFlag=true;BX.MessengerCommon.getUserParam(e)}else if(this.users[e]&&this.users[e].id){e=parseInt(e)}else{e=parseInt(e);if(isNaN(e)){e=0}else{BX.MessengerCommon.getUserParam(e)}}if(this.openNetworkFlag){}else if(!this.openChatFlag&&typeof e!="number"){e=0}if(e==0){this.openChatFlag=false;app.closeController()}else if(this.openChatFlag||this.openNetworkFlag||e>0){this.currentTab=e;BX.MessengerCommon.openDialog(this.currentTab)}}};BX.ImMessengerMobile.prototype.closeMessenger=function(e){e=e?e:this.currentTab;this.currentTab=0;this.openChatFlag=false;var t=BX.findChild(this.popupContactListElementsWrap,{attribute:{"data-userId":e}},false);if(t){if(BX.hasClass(t,"bx-messenger-cl-item-active")){BX.removeClass(t,"bx-messenger-cl-item-active")}}};BX.ImMessengerMobile.prototype.closeMenuPopup=function(){};BX.ImMessengerMobile.prototype.sendMessage=function(e,t){e=typeof e=="string"||typeof e=="number"?e:this.currentTab;BX.MessengerCommon.endSendWriting(e);t=t.replace("    ","\t");t=BX.util.trim(t);if(t.length==0)return false;if(t.indexOf("/color")==0){var s=t.split(" ")[1];if(s&&this.openChatFlag){BX.MessengerCommon.setColor(s,e.substr(4))}return false}else if(t.indexOf("/rename")==0){var i=t.substr(7);if(i&&this.openChatFlag){BX.MessengerCommon.renameChat(e.substr(4),i)}return false}var a=e.toString().substr(0,4)=="chat"?e.toString().substr(4):this.userChat[e]?this.userChat[e]:0;if(this.errorMessage[e]){BX.MessengerCommon.sendMessageRetry();this.errorMessage[e]=false}var n=this.messageTmpIndex;this.message["temp"+n]={id:"temp"+n,chatId:a,senderId:this.BXIM.userId,recipientId:e,date:new Date,text:BX.MessengerCommon.prepareText(t,true)};if(!this.showMessage[e])this.showMessage[e]=[];this.showMessage[e].push("temp"+n);this.messageTmpIndex++;BX.localStorage.set("mti",this.messageTmpIndex,5);if(e!=this.currentTab)return false;clearTimeout(this.textareaHistoryTimeout);var o=BX.findChildByClassName(this.popupMessengerBodyWrap,"bx-messenger-content-load");if(o)BX.remove(o);var r=BX.findChildByClassName(this.popupMessengerBodyWrap,"bx-messenger-content-empty");if(r)BX.remove(r);if(e.toString().substr(0,4)=="chat"&&this.linesSilentMode&&this.linesSilentMode[e.toString().substr(4)]){if(!this.message["temp"+n].params){this.message["temp"+n].params={}}this.message["temp"+n].params.CLASS="bx-messenger-content-item-system"}BX.MessengerCommon.drawMessage(e,this.message["temp"+n]);this.textareaHistory[e]="";BX.MessengerCommon.sendMessageAjax(n,e,t,e.toString().substr(0,4)=="chat");return true};BX.ImMessengerMobile.prototype.textareaIconPrepare=function(){};BX.ImMessengerMobile.prototype.setUpdateStateStep=function(){};BX.ImMessengerMobile.prototype.setUpdateStateStepCount=function(){};BX.ImMessengerMobile.prototype.extendChat=function(e,t,s){app.openTable({url:this.BXIM.pathToRoot+"mobile/index.php?mobile_action=get_user_list&only_business="+(s?"Y":"N"),callback:BX.delegate(function(s){if(!(s&&s.a_users&&s.a_users[0]))return;var i=[];for(var a=0;a<s.a_users.length;a++)i.push(s.a_users[a]["ID"].toString());var s=false;if(!t){i.push(e);s={IM_CHAT_ADD:"Y",USERS:JSON.stringify(i),IM_AJAX_CALL:"Y",sessid:BX.bitrix_sessid()}}else{s={IM_CHAT_EXTEND:"Y",CHAT_ID:e.substr(4),USERS:JSON.stringify(i),IM_AJAX_CALL:"Y",sessid:BX.bitrix_sessid()}}if(!s)return false;BX.ajax({url:this.BXIM.pathToRoot+"mobile/ajax.php?mobile_action=im&"+(t?"CHAT_EXTEND":"CHAT_ADD"),method:"POST",dataType:"json",timeout:60,data:s,onsuccess:BX.delegate(function(e){if(e.ERROR==""){if(!t&&e.CHAT_ID){BXMobileApp.PageManager.loadPageUnique({url:this.BXIM.pathToRoot+"mobile/im/dialog.php"+(!app.enableInVersion(11)?"?id=chat"+e.CHAT_ID:""),bx24ModernStyle:true,data:{dialogId:"chat"+e.CHAT_ID}})}}else{app.alert({text:e.ERROR})}},this)})},this),set_focus_to_search:true,markmode:true,multiple:true,return_full_mode:true,modal:true,alphabet_index:true,outsection:false,okname:BX.message("IM_M_EXTEND")})};BX.ImMessengerMobile.prototype.linesTransfer=function(e){app.openTable({url:this.BXIM.pathToRoot+"mobile/index.php?mobile_action=get_user_list&only_business=Y",callback:BX.delegate(function(t){if(!(t&&t.a_users&&t.a_users[0]))return;var s=t.a_users[0];var i=s["ID"].toString();BX.ajax({url:this.BXIM.pathToAjax+"?LINES_TRANSFER&V="+this.BXIM.revision,method:"POST",dataType:"json",timeout:60,data:{COMMAND:"transfer",CHAT_ID:e,TRANSFER_ID:i,IM_OPEN_LINES:"Y",IM_AJAX_CALL:"Y",sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(){app.closeController()},this)})},this),set_focus_to_search:true,markmode:true,multiple:false,return_full_mode:true,modal:true,alphabet_index:true,outsection:false,okname:BX.message("IM_OL_INVITE_TRANSFER")})};BX.ImMessengerMobile.prototype.linesVoteHeadDialog=function(e,t,s){s=s||false;var i=e.getAttribute("data-rating")||0;var a=BX.MessengerCommon.linesVoteHeadNodes(t,i,true,s?null:e);if(s)return a;return false};BX.ImMessengerMobile.prototype.linesCreateLead=function(){var e=this.currentTab.toString().substr(4);var t=BX.MessengerCommon.linesGetSession(this.chat[e]);if(t.crm=="N"){BX.MessengerCommon.linesCreateLead(e)}};BX.ImMessengerMobile.prototype.linesMarkAsSpam=function(){var e=this.currentTab.toString().substr(4);var t=BX.MessengerCommon.linesGetSession(this.chat[e]);BX.MessengerCommon.linesMarkAsSpam(e)};BX.ImMessengerMobile.prototype.linesCloseDialog=function(){var e=this.currentTab.toString().substr(4);var t=BX.MessengerCommon.linesGetSession(this.chat[e]);BX.MessengerCommon.linesCloseDialog(e)};BX.ImMessengerMobile.prototype.linesTogglePinMode=function(){var e=this.currentTab.toString().substr(4);var t;var s=BX.MessengerCommon.linesGetSession(this.chat[e]);if(s.pin=="Y"){t="N"}else{t="Y"}this.dialogStatusRedraw();BX.MessengerCommon.linesActivatePinMode(e,t)};BX.ImMessengerMobile.prototype.linesToggleSilentMode=function(){var e=this.currentTab.toString().substr(4);var t;if(this.linesSilentMode[e]){t="N"}else{t="Y"}this.linesSilentMode[e]=t=="Y";this.dialogStatusRedraw()};BX.ImMessengerMobile.prototype.updateMessageCount=function(e){};BX.ImMessengerMobile.prototype.messageReply=function(e){if(!this.users[e]||this.users[e].fake)return false;var t=BX.util.htmlspecialcharsback(this.users[e].name);t="[USER="+e+"]"+t+"[/USER] ";if(!this.textareaHistory[this.currentTab])this.textareaHistory[this.currentTab]="";this.textareaHistory[this.currentTab]=this.textareaHistory[this.currentTab]+" "+t;BXMobileApp.UI.Page.TextPanel.setText(this.textareaHistory[this.currentTab]);BXMobileApp.UI.Page.TextPanel.focus()};BX.ImMessengerMobile.prototype.openMessageMenu=function(e){var t=window.app.enableInVersion(14)&&window.platform=="ios"?window.BXMobileAppContext.isKeyboardShown():this.BXIM.keyboardShow;if(!this.message[e]||t||BX.localStorage.get("impmh"))return false;if(this.chat[this.message[e].chatId]&&!BX.MessengerCommon.userInChat(this.message[e].chatId)){return false}var s=[];if(!(this.chat[this.message[e].chatId]&&this.chat[this.message[e].chatId].type=="call")){var i=BX.MessengerCommon.messageIsLike(e);s.push({title:BX.message(i?"IM_MENU_MESS_DISLIKE":"IM_MENU_MESS_LIKE"),callback:BX.delegate(function(){BX.MessengerCommon.messageLike(e)},this)})}var a=this.message[e].senderId;if(a>0){if(this.generalChatId==this.message[e].chatId&&!this.canSendMessageGeneralChat){}else{s.push({title:BX.message("IM_MENU_MESS_REPLY"),callback:BX.delegate(function(){this.messageReply(a)},this)})}}var n=0;var o=BX("im-message-"+e);if(o){var r=BX.findChildrenByClassName(o.parentNode.parentNode,"bx-messenger-message");for(var l=r.length-1;l>=0&&n==0;l--){if(!BX.hasClass(r[l],"bx-messenger-message-deleted")){n=r[l].id.substr(11)}}}if(BX.MessengerCommon.checkEditMessage(n,"edit")){if(app.enableInVersion(14)){s.push({title:BX.message("IM_MENU_MESS_EDIT"),callback:BX.delegate(function(){this.editMessage(n)},this)})}}if(!this.users[this.BXIM.userId].extranet){s.push({title:BX.message("IM_MENU_TO_TASK"),callback:BX.delegate(function(){BX.MessengerCommon.shareMessageAjax(e,"TASK")},this)});if(this.message[e].params&&this.message[e].params.DATE_TS&&this.message[e].params.DATE_TS.length>0){s.push({title:BX.message("IM_MENU_TO_CALEND"),callback:BX.delegate(function(){BX.MessengerCommon.shareMessageAjax(e,"CALEND")},this)})}s.push({title:BX.message("IM_MENU_TO_CHAT"),callback:BX.delegate(function(){BX.MessengerCommon.shareMessageAjax(e,"CHAT")},this)});s.push({title:BX.message("IM_MENU_TO_POST"),callback:BX.delegate(function(){BX.MessengerCommon.shareMessageAjax(e,"POST")},this)})}if(BX.MessengerCommon.checkEditMessage(n,"delete")){s.push({title:BX.message("IM_MENU_MESS_DEL"),callback:BX.delegate(function(){this.deleteMessage(n)},this)})}if(s.length>0){new BXMobileApp.UI.ActionSheet({buttons:s},"im-message-menu").show()}};BX.ImMessengerMobile.prototype.editMessage=function(e,t){if(!BX.MessengerCommon.checkEditMessage(e,"edit"))return false;var s={mentionButton:{dataSource:{return_full_mode:"YES",outsection:"NO",multiple:"NO",alphabet_index:"YES",url:BX.message("MobileSiteDir")+"mobile/index.php?mobile_action=get_user_list"}},smileButton:{},message:{text:BX.MessengerCommon.prepareTextBack(this.message[e].text,true)},okButton:{callback:function(t){BX.MessengerCommon.editMessageAjax(e,t.text)},name:BX.message("IM_MENU_SAVE")},cancelButton:{callback:BX.delegate(function(){this.editMessageCancel()},this),name:BX.message("IM_MENU_CANCEL")}};app.exec("showPostForm",s)};BX.ImMessengerMobile.prototype.editMessageCancel=function(){this.keyboardShow=false};BX.ImMessengerMobile.prototype.deleteMessage=function(e,t){if(!BX.MessengerCommon.checkEditMessage(e,"delete"))return false;if(t!==false){var s=this.message[e].text.length>50?this.message[e].text.substr(0,47)+"...":this.message[e].text;app.confirm({title:BX.message("IM_MENU_MESS_DEL_CONFIRM"),text:s?'"'+s+'"':"",buttons:[BX.message("IM_MENU_MESS_DEL_YES"),BX.message("IM_MENU_MESS_DEL_NO")],callback:function(t){if(t==1){BX.MessengerCommon.deleteMessageAjax(e)}}})}else{this.deleteMessageAjax(e)}}})();(function(){if(BX.ImNotifyMobile)return;BX.ImNotifyMobile=function(e,t){this.BXIM=e;this.sendAjaxTry=0;this.notifyLastId=0;this.notifyLoadFlag=false;this.counters={};this.timeoutNotifyViewedWait=null};BX.ImNotifyMobile.prototype.updateNotifyCounters=function(e){if(typeof e=="object"){for(var t in e)this.counters[t]=e[t]}};BX.ImNotifyMobile.prototype.notifyViewedWait=function(e){clearTimeout(this.timeoutNotifyViewedWait);if(!this.notifyLoadFlag){this.timeoutNotifyViewedWait=setTimeout(BX.delegate(function(){this.notifyViewed(e.lastId)},this),300);this.BXIM.notifyCount=0;this.BXIM.updateCounter()}else{clearTimeout(this.timeoutNotifyViewedWait);this.timeoutNotifyViewedWait=setTimeout(BX.delegate(function(){this.notifyViewedWait(e)},this),2e3)}};BX.ImNotifyMobile.prototype.notifyViewed=function(e){BX.ajax({url:this.BXIM.pathToAjax,method:"POST",dataType:"json",skipAuthCheck:true,data:{IM_NOTIFY_READ:"Y",ID:e,IM_AJAX_CALL:"Y",sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(e){if(e.ERROR.length==0){this.sendAjaxTry=0;this.notifyLastId=0}},this)});return true}})();(function(){if(BX.ImDiskManagerMobile)return;BX.ImDiskManagerMobile=function(e,t){this.BXIM=e;this.notify=t.notifyClass;this.enable=t.enable;this.enableExternal=t.enableExternal;this.lightVersion=false;this.formBlocked={};this.formAgents={};this.files=t.files;for(var s in this.files){this.files[s].date=new Date(this.files[s].date)}this.filesProgress={};this.filesMessage={};this.filesRegister={};this.messageBlock={};this.fileTmpId=1;this.timeout={};BX.garbage(function(){var e={};var t=0;for(var s in this.filesMessage){e[s]=this.filesMessage[s];if(this.messenger.message[e[s]]){t=this.messenger.message[e[s]].chatId}}if(t>0){BX.ajax({url:this.BXIM.pathToFileAjax+"?FILE_TERMINATE&V="+this.BXIM.revision,method:"POST",dataType:"json",timeout:30,async:false,data:{IM_FILE_UNREGISTER:"Y",CHAT_ID:t,FILES:JSON.stringify(this.filesProgress),MESSAGES:JSON.stringify(e),IM_AJAX_CALL:"Y",sessid:BX.bitrix_sessid()}})}},this)};BX.ImDiskManagerMobile.prototype.getChatId=function(){var e=this.BXIM.messenger.currentTab.toString().substr(0,4)=="chat";if(e){return this.BXIM.messenger.currentTab.toString().substr(4)}var t=this.BXIM.messenger.userChat[this.BXIM.messenger.currentTab];if(t){return t}return 0};BX.ImDiskManagerMobile.prototype.chatDialogInit=function(){this.formAgents["imDialog"]=BX.Uploader.getInstance({id:"imDialog",allowUpload:"A",uploadMethod:"deferred",uploadFormData:"Y",showImage:true,filesInputMultiple:true,uploadFileUrl:this.BXIM.pathToFileAjax,input:null,fields:{preview:{params:{width:500,height:500}}}});this.formAgents["imDialog"].form=this.messenger.popupMessengerFileForm;BX.addCustomEvent(this.formAgents["imDialog"],"onError",BX.delegate(BX.MessengerCommon.diskChatDialogUploadError,BX.MessengerCommon));BX.addCustomEvent(this.formAgents["imDialog"],"onFileIsInited",BX.delegate(function(e,t,s){BX.MessengerCommon.diskChatDialogFileInited(e,t,s);BX.addCustomEvent(t,"onUploadStart",BX.delegate(BX.MessengerCommon.diskChatDialogFileStart,BX.MessengerCommon));BX.addCustomEvent(t,"onUploadProgress",BX.delegate(BX.MessengerCommon.diskChatDialogFileProgress,BX.MessengerCommon));BX.addCustomEvent(t,"onUploadDone",BX.delegate(BX.MessengerCommon.diskChatDialogFileDone,BX.MessengerCommon));BX.addCustomEvent(t,"onUploadError",BX.delegate(BX.MessengerCommon.diskChatDialogFileError,BX.MessengerCommon))},this))};BX.ImDiskManagerMobile.prototype.uploadFromMobile=function(e,t){var s=BX.UploaderUtils.dataURLToBlob("data:image/jpg;base64,"+e);s.name="mobile_"+BX.date.format("Ymd_His")+".jpg";this.formAgents["imDialog"].messageText=t?t:"";this.formAgents["imDialog"].onChange([s])};BX.ImDiskManagerMobile.prototype.uploadFromDisk=function(e,t){t=t||"";var s=this.messenger.popupMessengerFileFormChatId.value;if(!this.files[s])this.files[s]={};var i=[];for(var a in e){this.files[s]["disk"+a]={id:"disk"+a,tempId:"disk"+a,chatId:s,date:new Date(e[a].modifyDateInt*1e3),type:"file",preview:"",name:e[a].name,size:e[a].sizeInt,status:"upload",progress:-1,authorId:this.BXIM.userId,authorName:this.messenger.users[this.BXIM.userId].name,urlPreview:"",urlShow:"",urlDownload:""};i.push("disk"+a)}var n=0;if(this.messenger.chat[s]){n="chat"+s}else{for(var o in this.messenger.userChat){if(this.messenger.userChat[o]==s){n=o;break}}}if(!n)return false;var r="N";if(n.toString().substr(0,4)=="chat"&&this.BXIM.messenger.linesSilentMode&&this.BXIM.messenger.linesSilentMode[s]){r="Y"}var l="tempFile"+this.fileTmpId;this.messenger.message[l]={id:l,chatId:s,senderId:this.BXIM.userId,recipientId:n,date:new Date,text:BX.MessengerCommon.prepareText(t,true),params:{FILE_ID:i,CLASS:r=="Y"?"bx-messenger-content-item-system":""}};if(!this.messenger.showMessage[n])this.messenger.showMessage[n]=[];this.messenger.showMessage[n].push(l);BX.MessengerCommon.drawMessage(n,this.messenger.message[l]);BX.MessengerCommon.drawProgessMessage(l);this.messenger.sendMessageFlag++;BX.ajax({url:this.BXIM.pathToFileAjax+"?FILE_UPLOAD_FROM_DISK&V="+this.BXIM.revision,method:"POST",dataType:"json",skipAuthCheck:true,timeout:30,data:{IM_FILE_UPLOAD_FROM_DISK:"Y",CHAT_ID:s,RECIPIENT_ID:n,MESSAGE:t,MESSAGE_TMP_ID:l,OL_SILENT:r,FILES:JSON.stringify(i),IM_AJAX_CALL:"Y",sessid:BX.bitrix_sessid()},onsuccess:BX.delegate(function(e){if(e.ERROR!=""){this.messenger.sendMessageFlag--;delete this.messenger.message[l];BX.MessengerCommon.drawTab(n);return false}this.messenger.sendMessageFlag--;var t=[];var s={};for(var i in e.FILES){var a=e.FILES[i];if(parseInt(a.id)>0){a.date=new Date(a.date);this.files[e.CHAT_ID][a.id]=a;delete this.files[e.CHAT_ID][i];if(BX("im-file-"+i)){BX("im-file-"+i).setAttribute("data-fileId",a.id);BX("im-file-"+i).id="im-file-"+a.id;BX.MessengerCommon.diskRedrawFile(e.CHAT_ID,a.id)}t.push(a.id)}else{this.files[e.CHAT_ID][i]["status"]="error";BX.MessengerCommon.diskRedrawFile(e.CHAT_ID,i)}}this.messenger.message[e.MESSAGE_ID]=BX.clone(this.messenger.message[e.MESSAGE_TMP_ID]);this.messenger.message[e.MESSAGE_ID]["id"]=e.MESSAGE_ID;this.messenger.message[e.MESSAGE_ID]["params"]["FILE_ID"]=t;if(this.messenger.popupMessengerLastMessage==e.MESSAGE_TMP_ID)this.messenger.popupMessengerLastMessage=e.MESSAGE_ID;delete this.messenger.message[e.MESSAGE_TMP_ID];var o=BX.util.array_search(""+e.MESSAGE_TMP_ID+"",this.messenger.showMessage[e.RECIPIENT_ID]);if(this.messenger.showMessage[e.RECIPIENT_ID][o])this.messenger.showMessage[e.RECIPIENT_ID][o]=""+e.MESSAGE_ID+"";if(BX("im-message-"+e.MESSAGE_TMP_ID)){BX("im-message-"+e.MESSAGE_TMP_ID).id="im-message-"+e.MESSAGE_ID;var r=BX.findChild(this.messenger.popupMessengerBodyWrap,{attribute:{"data-messageid":""+e.MESSAGE_TMP_ID}},true);if(r){r.setAttribute("data-messageid",""+e.MESSAGE_ID+"");if(r.getAttribute("data-blockmessageid")==""+e.MESSAGE_TMP_ID)r.setAttribute("data-blockmessageid",""+e.MESSAGE_ID+"")}else{var h=BX.findChild(this.messenger.popupMessengerBodyWrap,{attribute:{"data-blockmessageid":""+e.MESSAGE_TMP_ID}},true);if(h){h.setAttribute("data-blockmessageid",""+e.MESSAGE_ID+"")}}var p=BX.findChildByClassName(r,"bx-messenger-content-item-date");if(p)p.innerHTML=" &nbsp; "+BX.MessengerCommon.formatDate(this.messenger.message[e.MESSAGE_ID].date,BX.MessengerCommon.getDateFormatType("MESSAGE"))}BX.MessengerCommon.clearProgessMessage(e.MESSAGE_ID);if(this.messenger.history[e.RECIPIENT_ID])this.messenger.history[e.RECIPIENT_ID].push(e.MESSAGE_ID);else this.messenger.history[e.RECIPIENT_ID]=[e.MESSAGE_ID];this.messenger.popupMessengerFileFormInput.removeAttribute("disabled")},this),onfailure:BX.delegate(function(){this.messenger.sendMessageFlag--;delete this.messenger.message[l];BX.MessengerCommon.drawTab(n)},this)});this.fileTmpId++};BX.ImDiskManagerMobile.prototype.diskChatDialogFileInited=function(e,t,s){var i=s.form.CHAT_ID.value;if(!this.files[i])this.files[i]={};this.files[i][e]={id:e,tempId:e,chatId:i,date:new Date,type:t.isImage?"image":"file",preview:t.isImage?t.canvas:"",name:t.name,size:t.file.size,status:"upload",progress:-1,authorId:this.BXIM.userId,authorName:this.messenger.users[this.BXIM.userId].name,urlPreview:"",urlShow:"",urlDownload:""};if(!this.filesRegister[i])this.filesRegister[i]={};this.filesRegister[i][e]={id:e,type:this.files[i][e].type,mimeType:t.file.type,name:this.files[i][e].name,size:this.files[i][e].size};BX.MessengerCommon.diskChatDialogFileRegister(i)};BX.ImDiskManagerMobile.prototype.saveToDisk=function(){return true};BX.ImDiskManagerMobile.prototype.delete=function(){return true}})();(function(){if(BX.ImWebRTCMobile)return;BX.ImWebRTCMobile=function(e,t){this.BXIM=e;this.messenger=this.BXIM.messenger;this.desktop=this.BXIM.desktop;this.callMethod=t.callMethod;this.phoneSDKinit=false;this.phoneMicAccess=false;this.phoneIncoming=false;this.phoneCallId="";this.phoneCallTime=0;this.phoneCallConfig={};this.phoneCallExternal=false;this.phoneCallDevice="WEBRTC";this.phonePortalCall=false;this.phoneNumber="";this.phoneNumberUser="";this.phoneParams={};this.phoneAPI=null;this.phoneDisconnectAfterCallFlag=false;this.phoneCurrentCall=null;this.mobileSupport=t.mobileSupport;this.phoneCrm=t.phoneCrm?t.phoneCrm:{};this.phoneSpeakerEnable=false;this.phoneMicMuted=false;this.phoneHolded=false;this.phoneRinging=0;this.phoneTransferEnabled=false;this.phoneTransferUser=0;this.phoneConnectedInterval=null;this.phoneDeviceDelayTimeout=null;this.callNotify=null;this.debug=false;this.audioMuted=false;this.initiator=false;this.callUserId=0;this.callChatId=0;this.callInit=false;this.callInitUserId=0;this.callActive=false;this.turnServer=t.turnServer;this.turnServerFirefox=t.turnServerFirefox;this.turnServerLogin=t.turnServerLogin;this.turnServerPassword=t.turnServerPassword;this.phoneEnabled=t.phoneEnabled;this.phoneSipAvailable=t.phoneSipAvailable;this.phoneDeviceActive=t.phoneDeviceActive=="Y";this.phoneCallerID="";this.phoneLogin="";this.phoneServer="";this.phoneCheckBalance=false;this.phoneCallHistory={};this.callOverlayOptions={};this.debug=true;if(this.phoneSupport()&&this.BXIM.mobileAction=="RECENT"){BX.MobileCallUI.init();this.pullPhoneUiEvent();BX.MessengerCommon.pullPhoneEvent();var s=BX.delegate(function(e){var t=BXMobileApp.PushManager.prepareParams(e);if(t.ACTION&&t.ACTION.substr(0,8)=="VI_CALL_"){BX.onCustomEvent(window,"onPull-voximplant",[{command:"invite",params:t.PARAMS}])}},this);if(app.enableInVersion(15)){BX.addCustomEvent("UIApplicationDidBecomeActiveNotification",function(){var e=BXMobileApp.PushManager.getLastNotification();if(e&&e!={})s(e)});s(BXMobileApp.PushManager.getLastNotification())}else{BX.addCustomEvent("onOpenPush",s)}var i=0;this.viIntiveInterval=setInterval(BX.delegate(function(){var e=BX.localStorage.get("viInvite");if(e){BX.onCustomEvent(window,"onPull-voximplant",[{command:"invite",params:e}]);BX.localStorage.remove("viInvite");clearInterval(this.viIntiveInterval)}if(i==30){clearInterval(this.viIntiveInterval)}},this),1e3)}};BX.ImWebRTCMobile.prototype.setCallMethod=function(e){if(e=="telephony"){this.callMethod=e}else if(e=="combined"){this.callMethod=e}else{this.callMethod="device"}};BX.ImWebRTCMobile.prototype.pullPhoneUiEvent=function(){BX.MobileCallUI.setListener(BX.delegate(function(e,t){if(e==BX.MobileCallUI.events.onHangup){BX.MobileCallUI.form.cancelDelayedClosing();this.phoneCallFinish();this.callAbort();this.callOverlayClose()}else if(e==BX.MobileCallUI.events.onSpeakerphoneChanged){this.phoneToggleSpeaker(t.selected)}else if(e==BX.MobileCallUI.events.onMuteChanged){this.phoneToggleAudio(t.selected)}else if(e==BX.MobileCallUI.events.onPauseChanged){BX.MessengerCommon.phoneToggleHold(t.selected)}else if(e==BX.MobileCallUI.events.onCloseClicked){this.phoneCallFinish();this.callAbort()}else if(e==BX.MobileCallUI.events.onAnswerClicked){this.BXIM.stopRepeatSound("ringtone");this.phoneIncomingAnswer()}else if(e==BX.MobileCallUI.events.onSkipClicked){this.phoneCallFinish();this.callAbort();this.callOverlayClose()}else if(e==BX.MobileCallUI.events.onAnswerClicked){}else if(e==BX.MobileCallUI.events.onNumpadButtonClicked){BX.MessengerCommon.phoneSendDTMF(t)}else if(e==BX.MobileCallUI.events.onPhoneNumberReceived){this.phoneCall(t)}else if(e.substr(0,4)=="crm_"){e=e.substr(4).split("_");var s="";if(e[0]=="deal"){s=this.BXIM.pathToCrmDeal.replace("#ID#",e[1])}else if(e[0]=="company"){s=this.BXIM.pathToCrmCompany.replace("#ID#",e[1])}else if(e[0]=="contact"){s=this.BXIM.pathToCrmContact.replace("#ID#",e[1])}else if(e[0]=="lead"){s=this.BXIM.pathToCrmLead.replace("#ID#",e[1])}BXMobileApp.PageManager.loadPageBlank({url:s,bx24ModernStyle:true});BX.MobileCallUI.form.rollUp()}else if(e==BX.MobileCallUI.events.onContactListChoose){}else if(e==BX.MobileCallUI.events.onContactListMenuChoose){}else if(e==BX.MobileCallUI.events.onContactListMenuChoose){}},this))};BX.ImWebRTCMobile.prototype.phoneCall=function(e,t){if(!this.phoneSupport())return false;if(this.debug)this.phoneLog(e,t);this.phoneNumberUser=BX.util.htmlspecialchars(e);numberOriginal=e;e=BX.MessengerCommon.phoneCorrect(e);if(typeof t!="object")t={};if(e.length<=0){this.BXIM.openConfirm({title:BX.message("IM_PHONE_WRONG_NUMBER"),message:BX.message("IM_PHONE_WRONG_NUMBER_DESC")});return false}BX.MobileCallUI.numpad.close();if(this.callActive||this.callInit)return false;this.BXIM.playSound("start");this.initiator=true;this.callInitUserId=this.BXIM.userId;this.callInit=true;this.callActive=false;this.callUserId=0;this.callChatId=0;this.phoneNumber=e;this.phoneParams=t;this.callOverlayShow({toUserId:0,phoneNumber:this.phoneNumber,callTitle:this.phoneNumberUser,fromUserId:this.BXIM.userId,status:BX.message("IM_M_CALL_ST_CONNECT"),state:BX.MobileCallUI.form.state.OUTGOING});if(!this.phoneLogin||!this.phoneServer){BX.MessengerCommon.phoneAuthorize()}else{this.phoneApiInit()}};BX.ImWebRTCMobile.prototype.phoneOnIncomingCall=function(e){BX.MessengerCommon.phoneOnIncomingCall(e)};BX.ImWebRTCMobile.prototype.phoneIncomingWait=function(e){e.isCallback=!!e.isCallback;if(this.debug)this.phoneLog("incoming call",JSON.stringify(e));this.phoneNumberUser=BX.util.htmlspecialchars(e.callerId);e.callerId=e.callerId.replace(/[^a-zA-Z0-9\.]/g,"");if(!this.callActive&&!this.callInit){this.initiator=true;this.callInitUserId=0;this.callInit=true;this.callActive=false;this.callUserId=0;this.callChatId=0;this.phoneIncoming=true;this.phoneCallTime=0;this.phoneCallId=e.callId;this.phoneNumber=e.callerId;this.phoneParams={};this.callOverlayShow({toUserId:this.BXIM.userId,phoneNumber:this.phoneNumber,companyPhoneNumber:e.companyPhoneNumber,callTitle:this.phoneNumberUser,fromUserId:0,isCallback:e.isCallback,status:e.isCallback?BX.message("IM_PHONE_INVITE_CALLBACK"):BX.message("IM_PHONE_INVITE"),state:BX.MobileCallUI.form.state.INCOMING});this.callOverlayDrawCrm()}};BX.ImWebRTCMobile.prototype.phoneIncomingAnswer=function(){this.callOverlayState(BX.MobileCallUI.form.state.WAITING);this.callSelfDisabled=true;BX.MessengerCommon.phoneCommand(this.phoneTransferEnabled?"answerTransfer":"answer",{CALL_ID:this.phoneCallId});BX.MobileCallUI.numpad.close();if(!this.phoneLogin||!this.phoneServer){BX.MessengerCommon.phoneAuthorize()}else{this.phoneApiInit()}};BX.ImWebRTCMobile.prototype.phoneApiInit=function(){if(!this.phoneSupport())return false;if(!this.phoneLogin||!this.phoneServer){this.phoneCallFinish();this.callOverlayProgress("offline");this.callAbort(BX.message("IM_PHONE_ERROR"));return false}if(this.phoneAPI){if(this.phoneSDKinit){if(this.phoneIncoming){BX.MessengerCommon.phoneCommand(this.phoneTransferEnabled?"readyTransfer":"ready",{CALL_ID:this.phoneCallId})}else if(this.callInitUserId==this.BXIM.userId){this.phoneOnSDKReady()}}else{this.phoneOnSDKReady()}return true}this.phoneAPI=BX.MobileVoximplant.getInstance();this.phoneAPI.addEventListener(BX.MobileVoximplant.events.SDKReady,BX.delegate(this.phoneOnSDKReady,this));this.phoneAPI.addEventListener(BX.MobileVoximplant.events.ConnectionEstablished,BX.delegate(this.phoneOnConnectionEstablished,this));this.phoneAPI.addEventListener(BX.MobileVoximplant.events.ConnectionFailed,BX.delegate(this.phoneOnConnectionFailed,this));this.phoneAPI.addEventListener(BX.MobileVoximplant.events.ConnectionClosed,BX.delegate(this.phoneOnConnectionClosed,this));this.phoneAPI.addEventListener(BX.MobileVoximplant.events.IncomingCall,BX.delegate(this.phoneOnIncomingCall,this));this.phoneAPI.addEventListener(BX.MobileVoximplant.events.AuthResult,BX.delegate(this.phoneOnAuthResult,this));this.phoneAPI.addEventListener(BX.MobileVoximplant.events.MicAccessResult,BX.delegate(this.phoneOnMicResult,this));this.phoneAPI.addEventListener(BX.MobileVoximplant.events.NetStatsReceived,BX.delegate(this.phoneOnNetStatsReceived,this));this.phoneAPI.init();return true};BX.ImWebRTCMobile.prototype.phoneOnSDKReady=function(){this.phoneLog("SDK ready");if(!this.phoneAPI.connected()){this.callOverlayProgress("wait");this.callOverlayStatus(BX.message("IM_M_CALL_ST_WAIT_ACCESS"));this.phoneAPI.connect()}else{this.phoneLog("Connection exists");this.callOverlayProgress("connect");this.callOverlayStatus(BX.message("IM_M_CALL_ST_CONNECT"));this.phoneOnAuthResult({result:true})}};BX.ImWebRTCMobile.prototype.phoneOnConnectionEstablished=function(e){BX.MessengerCommon.phoneOnConnectionEstablished(e);this.phoneAPI.login()};BX.ImWebRTCMobile.prototype.phoneOnConnectionFailed=function(e){BX.MessengerCommon.phoneOnConnectionFailed(e)};BX.ImWebRTCMobile.prototype.phoneOnConnectionClosed=function(e){BX.MessengerCommon.phoneOnConnectionClosed(e)};BX.ImWebRTCMobile.prototype.phoneOnMicResult=function(e){BX.MessengerCommon.phoneOnMicResult(e)};BX.ImWebRTCMobile.prototype.phoneOnAuthResult=function(e){BX.MessengerCommon.phoneOnAuthResult(e)};BX.ImWebRTCMobile.prototype.phoneOnNetStatsReceived=function(e){BX.MessengerCommon.phoneOnNetStatsReceived(e)};BX.ImWebRTCMobile.prototype.phoneOnCallConnected=function(e){this.phoneLog("Call connected",e);this.callOverlayProgress("online");this.callOverlayStatus(BX.message("IM_M_CALL_ST_ONLINE"));this.callActive=true};BX.ImWebRTCMobile.prototype.phoneOnCallDisconnected=function(e){BX.MessengerCommon.phoneOnCallDisconnected(e)};BX.ImWebRTCMobile.prototype.phoneOnCallFailed=function(e){BX.MessengerCommon.phoneOnCallFailed(e)};BX.ImWebRTCMobile.prototype.phoneOnProgressToneStart=function(e){BX.MessengerCommon.phoneOnProgressToneStart(e)};BX.ImWebRTCMobile.prototype.phoneOnProgressToneStop=function(e){BX.MessengerCommon.phoneOnProgressToneStop()};BX.ImWebRTCMobile.prototype.callPhoneOverlayMeter=function(e){};BX.ImWebRTCMobile.prototype.callOverlayProgress=function(e){this.phoneLog("set progress: ",e);if(e==this.callOverlayOptions.progress)return false;this.callOverlayOptions.progress=e;if(e=="connect"){}else if(e=="wait"){this.callOverlayState(BX.MobileCallUI.form.state.WAITING)}else if(e=="online"){if(!this.phonePortalCall){var t={};if(this.phoneCallConfig.RECORDING=="Y"){t.thirdSmallHeader={text:BX.message("IM_PHONE_REC_NOW"),textColor:"#7fc62c"}}else{t.thirdSmallHeader={text:BX.message("IM_PHONE_REC_OFF"),textColor:"#ee423f"}}BX.MobileCallUI.form.updateHeader(t)}this.callOverlayState(BX.MobileCallUI.form.state.STARTED)}else if(e=="offline"||e=="error"){if(e=="offline"){if(!this.phonePortalCall){var t={};if(this.phoneCallConfig.RECORDING=="Y"&&this.phoneCallTime>0){t.thirdSmallHeader={text:BX.message("IM_PHONE_REC_DONE"),textColor:"#7fc62c"}}else{t.thirdSmallHeader={text:""}}BX.MobileCallUI.form.updateHeader(t);var s={};if(this.phoneCrm.LEAD_DATA&&!this.phoneCrm.CONTACT_DATA&&!this.phoneCrm.COMPANY_DATA&&this.phoneCallConfig.CRM_CREATE=="lead"){s.actionDoneHint={text:BX.message("IM_PHONE_LEAD_SAVED")}}else{s.actionDoneHint={text:""}}BX.MobileCallUI.form.updateFooter(s)}}else{var t={};t.thirdSmallHeader={text:""};BX.MobileCallUI.form.updateHeader(t);var s={};s.actionDoneHint={text:""};BX.MobileCallUI.form.updateFooter(s)}this.callOverlayState(BX.MobileCallUI.form.state.FINISHED);BX.MobileCallUI.form.expand();BX.MobileCallUI.numpad.close()}};BX.ImWebRTCMobile.prototype.callOverlayStatus=function(e){if(!e||this.callOverlayOptions.status==e)return false;this.phoneLog("callOverlayStatus",e);this.callOverlayOptions.status=e;BX.MobileCallUI.form.updateFooter({callStateLabel:{text:e}})};BX.ImWebRTCMobile.prototype.callOverlayDoneHint=function(e){if(!e||this.callOverlayOptions.hint==e)return false;this.phoneLog("callOverlayDoneHint",e);this.callOverlayOptions.hint=e;BX.MobileCallUI.form.updateFooter({actionDoneHint:{text:e}})};BX.ImWebRTCMobile.prototype.callOverlayState=function(e){if(!e||this.callOverlayOptions.state==e)return false;this.phoneLog("callOverlayState",e);this.callOverlayOptions.state=e;BX.MobileCallUI.form.updateFooter({},e)};BX.ImWebRTCMobile.prototype.callOverlayUpdatePhoto=function(){};BX.ImWebRTCMobile.prototype.callOverlayShow=function(e){BX.MobileCallUI.numpad.close();var t=e.toUserId==this.BXIM.userId;var s=t?e.fromUserId:e.toUserId;this.callToPhone=true;var i="";if(e.phoneNumber=="hidden"){i=BX.message("IM_PHONE_HIDDEN_NUMBER")}else{if(e.callTitle){i=e.callTitle.toString()}else{i=e.phoneNumber.toString()}if(i.substr(0,1)=="8"||i.substr(0,1)=="+"){}else if(!isNaN(parseInt(i))&&i.length>=10){i="+"+i}}var a="";if(t){a=e.companyPhoneNumber?BX.message("IM_PHONE_CALL_TO_PHONE").replace("#PHONE#",e.companyPhoneNumber):BX.message("IM_VI_CALL")}else{a=BX.message("IM_PHONE_OUTGOING")}this.callOverlayUserId=s;BX.MessengerCommon.getUserParam(this.messenger.currentTab);BX.MessengerCommon.getUserParam(this.BXIM.userId);this.messenger.openChatFlag=this.messenger.currentTab.toString().substr(0,4)=="chat";BX.MobileCallUI.form.show({headerLabels:{firstHeader:{text:i},firstSmallHeader:{text:a,textColor:"#999999"}},footerLabels:{},middleLabels:{imageStub:{backgroundColor:"#464f58",display:"visible"}},middleButtons:{}});if(e.status){this.callOverlayStatus(e.status)}if(e.state){this.callOverlayState(e.state)}};BX.ImWebRTCMobile.prototype.callOverlayTimer=function(e){e=typeof e=="undefined"?"start":e;if(this.callOverlayOptions.timerState==e)return false;this.phoneLog("callOverlayTimer",e);this.callOverlayOptions.timerState=e;if(e=="start"){this.phoneCallTimeInterval=setInterval(BX.delegate(function(){this.phoneCallTime++},this),1e3);BX.MobileCallUI.form.startTimer()}else if(e=="pause"){clearInterval(this.phoneCallTimeInterval);BX.MobileCallUI.form.pauseTimer()}else{clearInterval(this.phoneCallTimeInterval);BX.MobileCallUI.form.stopTimer()}};BX.ImWebRTCMobile.prototype.callOverlayDrawCrm=function(){if(!this.phoneCrm.FOUND)return false;if(this.phoneCrm.FOUND=="Y"){var e=this.phoneCrm.CONTACT&&this.phoneCrm.CONTACT.NAME?this.phoneCrm.CONTACT.NAME:"";var t=this.phoneCrm.CONTACT&&this.phoneCrm.CONTACT.PHOTO?this.phoneCrm.CONTACT.PHOTO:"";var s=this.phoneCrm.CONTACT&&this.phoneCrm.CONTACT.POST?this.phoneCrm.CONTACT.POST:"";var i=this.phoneCrm.COMPANY?this.phoneCrm.COMPANY:"";var a={};if(!this.phonePortalCall){if(this.phoneCallConfig.RECORDING=="Y"){a.thirdSmallHeader={text:BX.message("IM_PHONE_REC_ON"),textColor:"#ecd748"}}else{a.thirdSmallHeader={text:BX.message("IM_PHONE_REC_OFF"),textColor:"#ee423f"}}}if(e||s||i){if(e){a.firstHeader={text:e}}if(s){a.firstSmallHeader={text:s}}if(i){a.secondSmallHeader={text:i}}}BX.MobileCallUI.form.updateHeader(a);if(t){BX.MobileCallUI.form.updateHeader({},(t.substr(0,4)!="http"?location.origin:"")+t)}var n={};var o=false;if(this.phoneCrm.DEALS&&this.phoneCrm.DEALS.length>0){var r={infoTitle:{text:""},infoDesc:{text:this.phoneCrm.DEALS[0].TITLE},infoHeader:{text:this.phoneCrm.DEALS[0].STAGE,textColor:this.phoneCrm.DEALS[0].STAGE_COLOR},infoSum:{text:this.phoneCrm.DEALS[0].OPPORTUNITY}};if(this.phoneCrm.DEAL_URL){n["button1"]={text:BX.message("IM_PHONE_ACTION_T_DEAL"),sort:100,eventName:"crm_deal_"+this.phoneCrm.DEALS[0].ID}}o=true}var l=[];if(this.phoneCrm.COMPANY_DATA&&this.phoneCrm.CONTACT_DATA){l=["CONTACT_DATA","COMPANY_DATA","LEAD_DATA"]}else if(this.phoneCrm.CONTACT_DATA&&this.phoneCrm.LEAD_DATA){l=["CONTACT_DATA","LEAD_DATA"]}else if(this.phoneCrm.LEAD_DATA&&this.phoneCrm.COMPANY_DATA){l=["LEAD_DATA","COMPANY_DATA"]}else{if(this.phoneCrm.CONTACT_DATA){l=["CONTACT_DATA"]}else if(this.phoneCrm.COMPANY_DATA){l=["COMPANY_DATA"]}else if(this.phoneCrm.LEAD_DATA){l=["LEAD_DATA"]}}for(var h=0;h<l.length;h++){var p=l[h];if(this.phoneCrm[p]){if(p=="CONTACT_DATA"){n["buttonData"+h]={text:BX.message("IM_PHONE_ACTION_T_CONTACT"),sort:200+h,eventName:"crm_contact_"+this.phoneCrm[p].ID}}else if(p=="COMPANY_DATA"){n["buttonData"+h]={text:BX.message("IM_PHONE_ACTION_T_COMPANY"),sort:200+h,eventName:"crm_company_"+this.phoneCrm[p].ID}}else if(p=="LEAD_DATA"){n["buttonData"+h]={text:BX.message("IM_PHONE_ACTION_T_LEAD"),sort:200+h,eventName:"crm_lead_"+this.phoneCrm[p].ID}}o=true}}if(o){BX.MobileCallUI.form.updateMiddle(r,n)}}else{this.phoneLog("CRM NOT FOUND");var a={};if(this.phoneCallConfig.RECORDING=="Y"){a.thirdSmallHeader={text:BX.message("IM_PHONE_REC_ON"),textColor:"#ecd748"}}else{a.thirdSmallHeader={text:BX.message("IM_PHONE_REC_OFF"),textColor:"#ee423f"}}BX.MobileCallUI.form.updateHeader(a);var n={button1:{text:BX.message("IM_CRM_BTN_NEW_LEAD"),sort:100,eventName:"button1"},button2:{text:BX.message("IM_CRM_BTN_NEW_CONTACT"),sort:1,eventName:"button2"}}}};BX.ImWebRTCMobile.prototype.callOverlayClose=function(){BX.MobileCallUI.numpad.close();BX.MobileCallUI.form.close()};BX.ImWebRTCMobile.prototype.phoneToggleAudio=function(e){if(!this.phoneCurrentCall)return false;if(e){this.phoneCurrentCall.muteMicrophone()}else{this.phoneCurrentCall.unmuteMicrophone()}this.phoneMicMuted=e};BX.ImWebRTCMobile.prototype.phoneToggleSpeaker=function(e){if(!this.phoneCurrentCall)return false;this.phoneCurrentCall.setUseLoudSpeaker(e);this.phoneSpeakerEnable=e};BX.ImWebRTCMobile.prototype.phoneSupport=function(){return this.phoneEnabled&&app.enableInVersion(14)&&typeof BX.MobileVoximplant!="undefined"};BX.ImWebRTCMobile.prototype.callAbort=function(e){this.callOverlayDeleteEvents();if(e)this.callOverlayStatus(e)};BX.ImWebRTCMobile.prototype.phoneCallFinish=function(){BX.MessengerCommon.phoneCallFinish();this.callOverlayTimer("pause");this.initiator=false;this.callUserId=0;this.callChatId=0;this.callInit=false;this.callInitUserId=0;this.callActive=false;this.audioMuted=false};BX.ImWebRTCMobile.prototype.callOverlayDeleteEvents=function(){var e=null;if(this.phoneCallId){e=this.phoneCallId}else if(this.callToGroup){e="chat"+this.callChatId}else{e="user"+this.callUserId}BX.onCustomEvent(window,"onImCallEnd",[{CALL_ID:e}]);this.callToMobile=false;this.callToPhone=false;this.phoneCallFinish();clearTimeout(this.callInviteTimeout)};BX.ImWebRTCMobile.prototype.phoneLog=function(){console.log("Phone Log",JSON.stringify(arguments))}})();