File manager - Edit - /home/web/vm-3fadc827.na4u.ru/www/bitrix/modules/im/install/js/im/application/conference/dist/conference.bundle.min.js
Back
this.BX=this.BX||{};this.BX.Messenger=this.BX.Messenger||{};(function(e,t,r,n,i,a,l,s,o,c,u,d,h,C,f,m,g,p,v,S,w,y,B,k,V,b,U){"use strict";var I=Object.freeze({guest:"guest"});var E=function(){function e(t){babelHelpers.classCallCheck(this,e);this.queryAuthRestore=false;this.setAuthId(I.guest);this.restClient=new b.RestClient({endpoint:t.endpoint,queryParams:this.queryParams,cors:true})}babelHelpers.createClass(e,[{key:"setAuthId",value:function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:"";if(babelHelpers["typeof"](this.queryParams)!=="object"){this.queryParams={}}if(t==I.guest||typeof t==="string"&&t.match(/^[a-f0-9]{32}$/)){this.queryParams.call_auth_id=t}else{console.error("%CallRestClient.setAuthId: auth is not correct (%c".concat(t,"%c)"),"color: black;","font-weight: bold; color: red","color: black");return false}if(t==I.guest&&typeof r==="string"&&r.match(/^[a-f0-9]{32}$/)){this.queryParams.call_custom_auth_id=r}return true}},{key:"setChatId",value:function e(t){if(babelHelpers["typeof"](this.queryParams)!=="object"){this.queryParams={}}this.queryParams.call_chat_id=t}},{key:"setConfId",value:function e(t){if(babelHelpers["typeof"](this.queryParams)!=="object"){this.queryParams={}}this.queryParams.videoconf_id=t}},{key:"setPassword",value:function e(t){if(babelHelpers["typeof"](this.queryParams)!=="object"){this.queryParams={}}this.queryParams.videoconf_password=t}},{key:"callMethod",value:function e(t,r,n,i){var a=this;var l=arguments.length>4&&arguments[4]!==undefined?arguments[4]:null;if(!l){l=U.Utils.getLogTrackingParams({name:t})}var s=new BX.Promise;this.restClient.callMethod(t,r,null,i,l).then((function(e){a.queryAuthRestore=false;s.fulfill(e)}))["catch"]((function(e){var n=e.error();if(n.ex.error=="LIVECHAT_AUTH_WIDGET_USER"){a.setAuthId(n.ex.hash);if(t===RestMethod.widgetUserRegister){console.warn("BX.LiveChatRestClient: ".concat(n.ex.error_description," (").concat(n.ex.error,")"));a.queryAuthRestore=false;s.reject(e);return false}if(!a.queryAuthRestore){console.warn("BX.LiveChatRestClient: your auth-token has expired, send query with a new token");a.queryAuthRestore=true;a.restClient.callMethod(t,r,null,i,l).then((function(e){a.queryAuthRestore=false;s.fulfill(e)}))["catch"]((function(e){a.queryAuthRestore=false;s.reject(e)}));return false}}a.queryAuthRestore=false;s.reject(e)}));return s}},{key:"callBatch",value:function e(t,r,n,i,a){var l=this;var s=function e(s){for(var o in t){if(!t.hasOwnProperty(o)){continue}var c=s[o].error();if(c&&c.ex.error=="LIVECHAT_AUTH_WIDGET_USER"){l.setAuthId(c.ex.hash);if(o===RestMethod.widgetUserRegister){console.warn("BX.LiveChatRestClient: ".concat(c.ex.error_description," (").concat(c.ex.error,")"));l.queryAuthRestore=false;r(s);return false}if(!l.queryAuthRestore){console.warn("BX.LiveChatRestClient: your auth-token has expired, send query with a new token");l.queryAuthRestore=true;l.restClient.callBatch(t,r,n,i,a);return false}}}l.queryAuthRestore=false;r(s);return true};return this.restClient.callBatch(t,s,n,i,a)}}]);return e}();var R,M,X;var P=function(){function e(){var t=this;var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);this.inited=false;this.hardwareInited=false;this.dialogInited=false;this.initPromise=new BX.Promise;this.params=r;this.params.userId=this.params.userId?parseInt(this.params.userId):0;this.params.siteId=this.params.siteId||"";this.params.chatId=this.params.chatId?parseInt(this.params.chatId):0;this.params.dialogId=this.params.chatId?"chat"+this.params.chatId.toString():"0";this.params.passwordRequired=!!this.params.passwordRequired;this.params.isBroadcast=!!this.params.isBroadcast;BX.Messenger.Lib.Logger.setConfig(r.loggerConfig);this.messagesQueue=[];this.template=null;this.rootNode=this.params.node||document.createElement("div");this.event=new p.VueVendorV2;this.callContainer=null;this.callView=null;this.preCall=null;this.currentCall=null;this.videoStrategy=null;this.callDetails={};this.showFeedback=true;this.featureConfig={};(r.featureConfig||[]).forEach((function(e){t.featureConfig[e.id]=e}));this.localVideoStream=null;this.conferencePageTagInterval=null;this.onCallUserInvitedHandler=this.onCallUserInvited.bind(this);this.onCallUserStateChangedHandler=this.onCallUserStateChanged.bind(this);this.onCallUserMicrophoneStateHandler=this.onCallUserMicrophoneState.bind(this);this.onCallUserCameraStateHandler=this.onCallUserCameraState.bind(this);this.onCallUserVideoPausedHandler=this.onCallUserVideoPaused.bind(this);this.onCallLocalMediaReceivedHandler=BX.debounce(this.onCallLocalMediaReceived.bind(this),1e3);this.onCallRemoteMediaReceivedHandler=this.onCallRemoteMediaReceived.bind(this);this.onCallRemoteMediaStoppedHandler=this.onCallRemoteMediaStopped.bind(this);this.onCallUserVoiceStartedHandler=this.onCallUserVoiceStarted.bind(this);this.onCallUserVoiceStoppedHandler=this.onCallUserVoiceStopped.bind(this);this.onCallUserScreenStateHandler=this.onCallUserScreenState.bind(this);this.onCallUserRecordStateHandler=this.onCallUserRecordState.bind(this);this.onCallUserFloorRequestHandler=this.onCallUserFloorRequest.bind(this);this.onMicrophoneLevelHandler=this.onMicrophoneLevel.bind(this);this._onCallJoinHandler=this.onCallJoin.bind(this);this.onCallLeaveHandler=this.onCallLeave.bind(this);this.onCallDestroyHandler=this.onCallDestroy.bind(this);this.onInputFocusHandler=this.onInputFocus.bind(this);this.onInputBlurHandler=this.onInputBlur.bind(this);this.onPreCallDestroyHandler=this.onPreCallDestroy.bind(this);this.onPreCallUserStateChangedHandler=this.onPreCallUserStateChanged.bind(this);this.waitingForCallStatus=false;this.waitingForCallStatusTimeout=null;this.callEventReceived=false;this.callRecordState=BX.Call.View.RecordState.Stopped;this.desktop=null;this.floatingScreenShareWindow=null;this.webScreenSharePopup=null;this.mutePopup=null;this.allowMutePopup=true;this.initDesktopEvents().then((function(){return t.initRestClient()})).then((function(){return t.subscribePreCallChanges()})).then((function(){return t.initPullClient()})).then((function(){return t.initCore()})).then((function(){return t.setModelData()})).then((function(){return t.initComponent()})).then((function(){return t.initCallInterface()})).then((function(){return t.initHardware()})).then((function(){return t.initUserComplete()}))["catch"]((function(e){console.error("Init error",e)}))}babelHelpers.createClass(e,[{key:"initDesktopEvents",value:function e(){var t=this;if(!U.Utils.platform.isBitrixDesktop()){return new Promise((function(e,t){return e()}))}this.desktop=new d.Desktop;this.floatingScreenShareWindow=new BX.Call.FloatingScreenShare({desktop:this.desktop,onBackToCallClick:this.onFloatingScreenShareBackToCallClick.bind(this),onStopSharingClick:this.onFloatingScreenShareStopClick.bind(this),onChangeScreenClick:this.onFloatingScreenShareChangeScreenClick.bind(this)});if(this.floatingScreenShareWindow){this.desktop.addCustomEvent("BXScreenMediaSharing",(function(e,r,n,i,a,l,s){t.floatingScreenShareWindow.setSharingData({title:r,x:n,y:i,width:a,height:l,app:s}).then((function(){t.floatingScreenShareWindow.show()}))["catch"]((function(e){c.Logger.error("setSharingData error",e)}))}));window.addEventListener("focus",(function(){t.onWindowFocus()}));window.addEventListener("blur",(function(){t.onWindowBlur()}))}this.desktop.addCustomEvent("bxImUpdateCounterMessage",(function(e){if(!t.controller){return false}t.controller.getStore().commit("conference/common",{messageCount:e})}));B.EventEmitter.subscribe(h.EventType.textarea.focus,this.onInputFocusHandler);B.EventEmitter.subscribe(h.EventType.textarea.blur,this.onInputBlurHandler);B.EventEmitter.subscribe(h.EventType.conference.userRenameFocus,this.onInputFocusHandler);B.EventEmitter.subscribe(h.EventType.conference.userRenameBlur,this.onInputBlurHandler);return new Promise((function(e,t){return e()}))}},{key:"initRestClient",value:function e(){this.restClient=new E({endpoint:this.getHost()+"/rest"});this.restClient.setConfId(this.params.conferenceId);return new Promise((function(e,t){return e()}))}},{key:"subscribePreCallChanges",value:function e(){BX.addCustomEvent(window,"CallEvents::callCreated",this.onCallCreated.bind(this))}},{key:"initPullClient",value:function e(){if(!this.params.isIntranetOrExtranet){this.pullClient=new k.PullClient({serverEnabled:true,userId:this.params.userId,siteId:this.params.siteId,restClient:this.restClient,skipStorageInit:true,configTimestamp:0,skipCheckRevision:true,getPublicListMethod:"im.call.channel.public.list"});return new Promise((function(e,t){return e()}))}else{this.pullClient=BX.PULL;return this.pullClient.start().then((function(){return new Promise((function(e,t){return e()}))}))}}},{key:"initCore",value:function e(){var t=this;this.controller=new l.Controller({host:this.getHost(),siteId:this.params.siteId,userId:this.params.userId,languageId:this.params.language,pull:{client:this.pullClient},rest:{client:this.restClient},vuexBuilder:{database:!U.Utils.browser.isIe(),databaseName:"imol/call",databaseType:v.VuexBuilder.DatabaseType.localStorage,models:[a.ConferenceModel.create(),a.CallModel.create()]}});return new Promise((function(e,r){t.controller.ready().then((function(){return e()}))}))}},{key:"setModelData",value:function e(){var t=this;this.controller.getStore().commit("application/set",{dialog:{chatId:this.getChatId(),dialogId:this.getDialogId()},options:{darkBackground:true}});var r=this.params.presenters.map((function(e){return e["id"]}));this.controller.getStore().dispatch("conference/setBroadcastMode",{broadcastMode:this.params.isBroadcast});this.controller.getStore().dispatch("conference/setPresenters",{presenters:r});this.params.presenters.forEach((function(e){t.controller.getStore().dispatch("users/set",e)}));if(this.params.passwordRequired){this.controller.getStore().commit("conference/common",{passChecked:false})}if(this.params.conferenceTitle){this.controller.getStore().dispatch("conference/setConferenceTitle",{conferenceTitle:this.params.conferenceTitle})}if(this.params.alias){this.controller.getStore().commit("conference/setAlias",{alias:this.params.alias})}return new Promise((function(e,t){return e()}))}},{key:"initComponent",value:function e(){var t=this;if(this.getStartupErrorCode()){this.setError(this.getStartupErrorCode())}return new Promise((function(e,r){t.controller.createVue(t,{el:t.rootNode,data:function e(){return{dialogId:t.getDialogId()}},template:'<bx-im-component-conference-public :dialogId="dialogId"/>'}).then((function(r){t.template=r;e()}))["catch"]((function(e){return r(e)}))}))}},{key:"initCallInterface",value:function t(){var r=this;return new Promise((function(t,n){r.callContainer=document.getElementById("bx-im-component-call-container");var i=["document"];if(r.isViewerMode()){i=["camera","microphone","screen","record","floorRequest","document"]}if(!r.params.isIntranetOrExtranet){i.push("record")}r.callView=new BX.Call.View({container:r.callContainer,showChatButtons:true,showUsersButton:true,showShareButton:r.getFeatureState("screenSharing")!==e.FeatureState.Disabled,showRecordButton:r.getFeatureState("record")!==e.FeatureState.Disabled,userLimit:BX.Call.Util.getUserLimit(),isIntranetOrExtranet:!!r.params.isIntranetOrExtranet,language:r.params.language,layout:U.Utils.device.isMobile()?BX.Call.View.Layout.Mobile:BX.Call.View.Layout.Centered,uiState:BX.Call.View.UiState.Preparing,blockedButtons:["camera","microphone","floorRequest","screen","record"],localUserState:BX.Call.UserState.Idle,hiddenTopButtons:!r.isBroadcast()||r.getBroadcastPresenters().length>1?[]:["grid"],hiddenButtons:i,broadcastingMode:r.isBroadcast(),broadcastingPresenters:r.getBroadcastPresenters()});r.callView.subscribe(BX.Call.View.Event.onButtonClick,r.onCallButtonClick.bind(r));r.callView.subscribe(BX.Call.View.Event.onReplaceCamera,r.onCallReplaceCamera.bind(r));r.callView.subscribe(BX.Call.View.Event.onReplaceMicrophone,r.onCallReplaceMicrophone.bind(r));r.callView.subscribe(BX.Call.View.Event.onReplaceSpeaker,r.onCallReplaceSpeaker.bind(r));r.callView.subscribe(BX.Call.View.Event.onChangeHdVideo,r.onCallViewChangeHdVideo.bind(r));r.callView.subscribe(BX.Call.View.Event.onChangeMicAutoParams,r.onCallViewChangeMicAutoParams.bind(r));r.callView.subscribe(BX.Call.View.Event.onChangeFaceImprove,r.onCallViewChangeFaceImprove.bind(r));r.callView.subscribe(BX.Call.View.Event.onUserRename,r.onCallViewUserRename.bind(r));r.callView.subscribe(BX.Call.View.Event.onUserPinned,r.onCallViewUserPinned.bind(r));r.callView.blockAddUser();r.callView.blockHistoryButton();if(!U.Utils.device.isMobile()){r.callView.show()}t()}))["catch"]((function(e){console.warn(e);reject(e)}))}},{key:"initUserComplete",value:function e(){var t=this;return new Promise((function(e,r){t.initUser().then((function(){return t.startPageTagInterval()})).then((function(){return t.tryJoinExistingCall()})).then((function(){return t.initCall()})).then((function(){return t.initPullHandlers()})).then((function(){return t.subscribeToStoreChanges()})).then((function(){return t.initComplete()})).then((function(){return e}))["catch"]((function(e){return r(e)}))}))}},{key:"initUser",value:function e(){var t=this;return new Promise((function(e,r){if(t.getStartupErrorCode()||!t.getConference().common.passChecked){return r()}if(t.params.userId>0){t.controller.setUserId(t.params.userId);if(t.params.isIntranetOrExtranet){t.switchToSessAuth();t.controller.getStore().commit("conference/user",{id:t.params.userId})}else{var n=t.getUserHashCookie();if(n){t.restClient.setAuthId(n);t.restClient.setChatId(t.getChatId());t.controller.getStore().commit("conference/user",{id:t.params.userId,hash:n});t.pullClient.start()}}t.controller.getStore().commit("conference/common",{inited:true});return e()}else{t.restClient.setAuthId("guest");t.restClient.setChatId(t.getChatId());if(typeof BX.SidePanel!=="undefined"){BX.SidePanel.Instance.disableAnchorBinding()}return t.restClient.callMethod("im.call.user.register",{alias:t.params.alias,user_hash:t.getUserHashCookie()||""}).then((function(r){BX.message["USER_ID"]=r.data().id;t.controller.getStore().commit("conference/user",{id:r.data().id,hash:r.data().hash});t.controller.setUserId(r.data().id);t.callView.setLocalUserId(r.data().id);if(r.data().created){t.params.userCount++}t.controller.getStore().commit("conference/common",{inited:true});t.restClient.setAuthId(r.data().hash);t.pullClient.start();return e()}))}}))}},{key:"startPageTagInterval",value:function e(){var t=this;return new Promise((function(e){clearInterval(t.conferencePageTagInterval);t.conferencePageTagInterval=setInterval((function(){o.LocalStorage.set(t.params.siteId,t.params.userId,BX.CallEngine.getConferencePageTag(t.params.dialogId),"Y",2)}),1e3);e()}))}},{key:"tryJoinExistingCall",value:function e(){var t=this;this.restClient.callMethod("im.call.tryJoinCall",{entityType:"chat",entityId:this.params.dialogId,provider:BX.Call.Provider.Voximplant,type:BX.Call.Type.Permanent}).then((function(e){c.Logger.warn("tryJoinCall",e.data());if(e.data().success){t.waitingForCallStatus=true;t.waitingForCallStatusTimeout=setTimeout((function(){t.waitingForCallStatus=false;if(!t.callEventReceived){t.setConferenceStatus(false)}t.callEventReceived=false}),5e3)}else{t.setConferenceStatus(false)}}))}},{key:"initCall",value:function e(){BX.CallEngine.setRestClient(this.restClient);BX.CallEngine.setPullClient(this.pullClient);BX.CallEngine.setCurrentUserId(this.controller.getUserId());this.callView.unblockButtons(["chat"])}},{key:"initPullHandlers",value:function e(){this.pullClient.subscribe(new V.ImCallPullHandler({store:this.controller.getStore(),application:this,controller:this.controller}));return new Promise((function(e,t){return e()}))}},{key:"subscribeToStoreChanges",value:function e(){var t=this;this.controller.getStore().subscribe((function(e,r){var n=e.payload,i=e.type;if(i==="users/update"&&n.fields.name){if(!t.callView){return false}t.callView.updateUserData(babelHelpers.defineProperty({},n.id,{name:n.fields.name}))}else if(i==="dialogues/set"){if(n[0].dialogId!==t.getDialogId()){return false}if(!U.Utils.platform.isBitrixDesktop()){t.callView.setButtonCounter("chat",n[0].counter)}}else if(i==="dialogues/update"){if(n.dialogId!==t.getDialogId()){return false}if(typeof n.fields.counter==="number"&&t.callView){if(U.Utils.platform.isBitrixDesktop()){if(n.actionName==="decreaseCounter"&&!n.dialogMuted&&typeof n.fields.previousCounter==="number"){var a=n.fields.counter;if(t.getConference().common.messageCount){a=t.getConference().common.messageCount-(n.fields.previousCounter-a);if(a<0){a=0}}t.callView.setButtonCounter("chat",a)}}else{t.callView.setButtonCounter("chat",n.fields.counter)}}if(typeof n.fields.name!=="undefined"){document.title=n.fields.name.toString()}}else if(i==="conference/common"&&typeof n.messageCount==="number"){if(t.callView){t.callView.setButtonCounter("chat",n.messageCount)}}else if(i==="conference/common"&&typeof n.userCount==="number"){if(t.callView){t.callView.setButtonCounter("users",n.userCount)}}}))}},{key:"initComplete",value:function e(){this.controller.getStore().commit("conference/common",{userCount:this.params.userCount});this.callView.setButtonCounter("users",this.params.userCount);if(this.isExternalUser()){this.callView.localUser.userModel.allowRename=true}if(this.getConference().common.inited){this.inited=true;this.initPromise.resolve(this)}if(U.Utils.platform.isBitrixDesktop()){this.desktop.onCustomEvent("bxConferenceLoadComplete",[])}return new Promise((function(e,t){return e()}))}},{key:"initHardware",value:function e(){var t=this;return new Promise((function(e,r){BX.Call.Hardware.init().then((function(){if(t.hardwareInited){e();return true}if(Object.values(BX.Call.Hardware.microphoneList).length===0){t.setError(h.ConferenceErrorCode.missingMicrophone)}if(!t.isViewerMode()){t.callView.unblockButtons(["camera","microphone"]);t.callView.enableMediaSelection()}t.hardwareInited=true;e()}))["catch"]((function(e){if(e==="NO_WEBRTC"&&t.isHttps()){t.setError(h.ConferenceErrorCode.unsupportedBrowser)}else if(e==="NO_WEBRTC"&&!t.isHttps()){t.setError(h.ConferenceErrorCode.unsafeConnection)}c.Logger.error("Init hardware error",e);r(e)}))}))}},{key:"startCall",value:function e(t){var r=this;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var i=BX.Call.Provider.Voximplant;if(U.Utils.device.isMobile()){this.callView.show();this.callView.setButtonCounter("chat",this.getDialogData().counter);this.callView.setButtonCounter("users",this.getConference().common.userCount)}else{this.callView.setLayout(BX.Call.View.Layout.Grid)}this.callView.setUiState(BX.Call.View.UiState.Calling);if(this.localVideoStream){if(t){this.callView.setLocalStream(this.localVideoStream,BX.Call.Hardware.enableMirroring)}else{this.stopLocalVideoStream()}}if(!t){this.callView.setCameraState(false)}this.controller.getStore().commit("conference/startCall");BX.Call.Engine.getInstance().createCall({type:BX.Call.Type.Permanent,entityType:"chat",entityId:this.getDialogId(),provider:i,videoEnabled:t,enableMicAutoParameters:BX.Call.Hardware.enableMicAutoParameters,joinExisting:true}).then((function(e){c.Logger.warn("call created",e);r.currentCall=e.call;r.currentCall.useHdVideo(true);if(BX.Call.Hardware.defaultMicrophone){r.currentCall.setMicrophoneId(BX.Call.Hardware.defaultMicrophone)}if(BX.Call.Hardware.defaultCamera){r.currentCall.setCameraId(BX.Call.Hardware.defaultCamera)}if(!U.Utils.device.isMobile()){r.callView.setLayout(BX.Call.View.Layout.Grid)}r.callView.appendUsers(r.currentCall.getUsers());BX.Call.Util.getUsers(r.currentCall.id,r.getCallUsers(true)).then((function(e){r.controller.getStore().dispatch("users/set",Object.values(e));r.controller.getStore().dispatch("conference/setUsers",{users:Object.keys(e)});r.callView.updateUserData(e)}));r.releasePreCall();r.bindCallEvents();if(r.callView.isMuted){r.currentCall.setMuted(true)}if(e.isNew){r.currentCall.setVideoEnabled(t);r.currentCall.inviteUsers()}else{r.currentCall.answer({useVideo:t,joinAsViewer:n})}}))["catch"]((function(e){c.Logger.error("creating call error",e)}))}},{key:"joinCall",value:function e(t,r){var n=this;var i=BX.prop.getBoolean(r,"video",false);var a=BX.prop.getBoolean(r,"joinAsViewer",false);if(U.Utils.device.isMobile()){this.callView.show()}else{this.callView.setLayout(BX.Call.View.Layout.Grid)}if(a){this.callView.setLocalUserDirection(BX.Call.EndpointDirection.RecvOnly)}else{this.callView.setLocalUserDirection(BX.Call.EndpointDirection.SendRecv)}this.callView.setUiState(BX.Call.View.UiState.Calling);BX.CallEngine.getCallWithId(t).then((function(e){n.currentCall=e.call;n.releasePreCall();n.bindCallEvents();n.controller.getStore().commit("conference/startCall");n.callView.appendUsers(n.currentCall.getUsers());BX.Call.Util.getUsers(n.currentCall.id,n.getCallUsers(true)).then((function(e){n.controller.getStore().dispatch("users/set",Object.values(e));n.controller.getStore().dispatch("conference/setUsers",{users:Object.keys(e)});n.callView.updateUserData(e)}));if(!a){n.currentCall.useHdVideo(true);if(BX.Call.Hardware.defaultMicrophone){n.currentCall.setMicrophoneId(BX.Call.Hardware.defaultMicrophone)}if(BX.Call.Hardware.defaultCamera){n.currentCall.setCameraId(BX.Call.Hardware.defaultCamera)}if(n.callView.isMuted){n.currentCall.setMuted(true)}}n.currentCall.answer({useVideo:!!i,joinAsViewer:a})}))["catch"]((function(e){return console.error(e)}))}},{key:"endCall",value:function e(){if(this.currentCall){this.showFeedback=this.currentCall.wasConnected;this.callDetails={id:this.currentCall.id,provider:this.currentCall.provider,userCount:this.currentCall.users.length,browser:BX.Call.Util.getBrowserForStatistics(),isMobile:BX.browser.IsMobile(),isConference:true};this.removeCallEvents();this.currentCall.hangup()}if(this.isRecording()){BXDesktopSystem.CallRecordStop()}this.callRecordState=BX.Call.View.RecordState.Stopped;if(U.Utils.platform.isBitrixDesktop()){if(this.floatingScreenShareWindow){this.floatingScreenShareWindow.destroy();this.floatingScreenShareWindow=null}window.close()}else{this.callView.releaseLocalMedia();this.callView.close();this.setError(h.ConferenceErrorCode.userLeftCall);this.controller.getStore().commit("conference/endCall")}B.EventEmitter.unsubscribe(h.EventType.textarea.focus,this.onInputFocusHandler);B.EventEmitter.unsubscribe(h.EventType.textarea.blur,this.onInputBlurHandler);B.EventEmitter.unsubscribe(h.EventType.conference.userRenameFocus,this.onInputFocusHandler);B.EventEmitter.unsubscribe(h.EventType.conference.userRenameBlur,this.onInputBlurHandler)}},{key:"restart",value:function e(){console.trace("restart");if(this.currentCall){this.removeCallEvents();this.currentCall=null}if(this.callView){this.callView.releaseLocalMedia();this.callView.close();this.callView.destroy();this.callView=null}this.initCallInterface();this.initCall();this.controller.getStore().commit("conference/endCall")}},{key:"kickFromCall",value:function e(){this.setError(h.ConferenceErrorCode.kickedFromCall);this.pullClient.disconnect();this.endCall()}},{key:"getCallUsers",value:function e(t){var r=Object.keys(this.currentCall.getUsers());if(t){r.push(this.currentCall.userId)}return r}},{key:"setLocalVideoStream",value:function e(t){this.localVideoStream=t}},{key:"stopLocalVideoStream",value:function e(){if(this.localVideoStream){this.localVideoStream.getTracks().forEach((function(e){return e.stop()}))}this.localVideoStream=null}},{key:"setSelectedCamera",value:function e(t){if(this.callView){this.callView.setCameraId(t)}}},{key:"setSelectedMic",value:function e(t){if(this.callView){this.callView.setMicrophoneId(t)}}},{key:"getFeature",value:function t(r){if(typeof this.featureConfig[r]==="undefined"){return{id:r,state:e.FeatureState.Enabled,articleCode:""}}return this.featureConfig[r]}},{key:"getFeatureState",value:function e(t){return this.getFeature(t).state}},{key:"canRecord",value:function e(){return U.Utils.platform.isBitrixDesktop()&&U.Utils.platform.getDesktopVersion()>=54}},{key:"isRecording",value:function e(){return this.canRecord()&&this.callRecordState!=BX.Call.View.RecordState.Stopped}},{key:"showFeatureLimitSlider",value:function e(t){var r=this.getFeature(t).articleCode;if(!r||!window.BX.UI.InfoHelper){console.warn("Limit article not found",t);return false}window.BX.UI.InfoHelper.show(r);return true}},{key:"showMicMutedNotification",value:function e(){var t=this;if(this.mutePopup||!this.callView){return}this.mutePopup=new BX.Call.MicMutedPopup({bindElement:this.callView.buttons.microphone.elements.icon,targetContainer:this.callView.container,onClose:function e(){t.allowMutePopup=false;t.mutePopup.destroy();t.mutePopup=null},onUnmuteClick:function e(){t.onCallViewToggleMuteButtonClick({data:{muted:false}});t.mutePopup.destroy();t.mutePopup=null}});this.mutePopup.show()}},{key:"showWebScreenSharePopup",value:function e(){if(this.webScreenSharePopup){this.webScreenSharePopup.show();return}this.webScreenSharePopup=new BX.Call.WebScreenSharePopup({bindElement:this.callView.buttons.screen.elements.root,targetContainer:this.callView.container,onClose:function(){this.webScreenSharePopup.destroy();this.webScreenSharePopup=null}.bind(this),onStopSharingClick:function(){this.onCallViewToggleScreenSharingButtonClick();this.webScreenSharePopup.destroy();this.webScreenSharePopup=null}.bind(this)});this.webScreenSharePopup.show()}},{key:"isViewerMode",value:function e(){var t=false;var r=this.isBroadcast();if(r){var n=this.getBroadcastPresenters();var i=this.controller.getStore().state.application.common.userId;var a=n.includes(i);t=r&&!a}return t}},{key:"onCallCreated",value:function e(t){var r=this;c.Logger.warn("we got event onCallCreated",t);if(this.preCall||this.currentCall){return}var n=t.call;if(n.associatedEntity.type==="chat"&&n.associatedEntity.id===this.params.dialogId){this.preCall=t.call;this.updatePreCallCounter();this.preCall.addEventListener(BX.Call.Event.onUserStateChanged,this.onPreCallUserStateChangedHandler);this.preCall.addEventListener(BX.Call.Event.onDestroy,this.onPreCallDestroyHandler);if(this.waitingForCallStatus){this.callEventReceived=true}this.setConferenceStatus(true);this.setConferenceStartDate(t.call.startDate)}var i=this.getConference().common.userReadyToJoin;if(i){var a=this.isViewerMode();var l=this.getConference().common.joinWithVideo;c.Logger.warn("ready to join call after waiting",l,a);setTimeout((function(){BX.Call.Hardware.init().then((function(){if(a&&r.preCall){r.joinCall(r.preCall.id,{joinAsViewer:true})}else{r.startCall(l)}}))}),1e3)}}},{key:"releasePreCall",value:function e(){if(this.preCall){this.preCall.removeEventListener(BX.Call.Event.onUserStateChanged,this.onPreCallUserStateChangedHandler);this.preCall.removeEventListener(BX.Call.Event.onDestroy,this.onPreCallDestroyHandler);this.preCall=null}}},{key:"onPreCallDestroy",value:function e(t){if(this.waitingForCallStatusTimeout){clearTimeout(this.waitingForCallStatusTimeout)}this.setConferenceStatus(false);this.releasePreCall()}},{key:"onPreCallUserStateChanged",value:function e(t){this.updatePreCallCounter()}},{key:"updatePreCallCounter",value:function e(){if(this.preCall){this.controller.getStore().commit("conference/common",{userInCallCount:this.preCall.getParticipatingUsers().length})}else{this.controller.getStore().commit("conference/common",{userInCallCount:0})}}},{key:"createVideoStrategy",value:function e(){if(this.videoStrategy){this.videoStrategy.destroy()}var t=U.Utils.device.isMobile()?BX.Call.VideoStrategy.Type.OnlySpeaker:BX.Call.VideoStrategy.Type.AllowAll;this.videoStrategy=new BX.Call.VideoStrategy({call:this.currentCall,callView:this.callView,strategyType:t})}},{key:"removeVideoStrategy",value:function e(){if(this.videoStrategy){this.videoStrategy.destroy()}this.videoStrategy=null}},{key:"onCallReplaceCamera",value:function e(t){var r=t.data.deviceId;BX.Call.Hardware.defaultCamera=r;if(this.currentCall){this.currentCall.setCameraId(r)}else{this.template.$emit("cameraSelected",r)}}},{key:"onCallReplaceMicrophone",value:function e(t){var r=t.data.deviceId;BX.Call.Hardware.defaultMicrophone=r.deviceId;if(this.callView){this.callView.setMicrophoneId(r)}if(this.currentCall){this.currentCall.setMicrophoneId(r)}else{this.template.$emit("micSelected",t.data.deviceId)}}},{key:"onCallReplaceSpeaker",value:function e(t){BX.Call.Hardware.defaultSpeaker=t.data.deviceId}},{key:"onCallViewChangeHdVideo",value:function e(t){BX.Call.Hardware.preferHdQuality=t.data.allowHdVideo}},{key:"onCallViewChangeMicAutoParams",value:function e(t){BX.Call.Hardware.enableMicAutoParameters=t.data.allowMicAutoParams}},{key:"onCallViewChangeFaceImprove",value:function e(t){if(typeof BX.desktop==="undefined"){return}BX.desktop.cameraSmoothingStatus(t.data.faceImproveEnabled)}},{key:"onCallViewUserRename",value:function e(t){var r=t.data.newName;if(!this.isExternalUser()){return false}if(U.Utils.device.isMobile()){this.renameGuestMobile(r)}else{this.renameGuest(r)}}},{key:"onCallViewUserPinned",value:function e(t){if(t.data.userId){this.updateCallUser(t.data.userId,{pinned:true});return true}this.controller.getStore().dispatch("call/unpinUser");return true}},{key:"renameGuest",value:function e(t){var r=this;this.callView.localUser.userModel.renameRequested=true;this.setUserName(t).then((function(){r.callView.localUser.userModel.wasRenamed=true;c.Logger.log("setting name to",t)}))["catch"]((function(e){c.Logger.error("error setting name",e)}))}},{key:"renameGuestMobile",value:function e(t){var r=this;this.setUserName(t).then((function(){c.Logger.log("setting mobile name to",t);if(r.callView.renameSlider){r.callView.renameSlider.close()}}))["catch"]((function(e){c.Logger.error("error setting name",e)}))}},{key:"onCallButtonClick",value:function e(t){var r=t.data.buttonName;c.Logger.warn("Button clicked!",r);var n={hangup:this.onCallViewHangupButtonClick.bind(this),close:this.onCallViewCloseButtonClick.bind(this),toggleMute:this.onCallViewToggleMuteButtonClick.bind(this),toggleScreenSharing:this.onCallViewToggleScreenSharingButtonClick.bind(this),record:this.onCallViewRecordButtonClick.bind(this),toggleVideo:this.onCallViewToggleVideoButtonClick.bind(this),showChat:this.onCallViewShowChatButtonClick.bind(this),toggleUsers:this.onCallViewToggleUsersButtonClick.bind(this),share:this.onCallViewShareButtonClick.bind(this),fullscreen:this.onCallViewFullScreenButtonClick.bind(this),floorRequest:this.onCallViewFloorRequestButtonClick.bind(this)};if(n[r]){n[r](t)}else{c.Logger.error("Button handler not found!",r)}}},{key:"onCallViewHangupButtonClick",value:function e(t){this.endCall()}},{key:"onCallViewCloseButtonClick",value:function e(t){this.endCall()}},{key:"onCallViewToggleMuteButtonClick",value:function e(t){if(this.currentCall){this.currentCall.setMuted(t.data.muted)}else{this.template.$emit("setMicState",!t.data.muted)}if(this.isRecording()){BXDesktopSystem.CallRecordMute(t.data.muted)}this.callView.setMuted(t.data.muted)}},{key:"onCallViewToggleScreenSharingButtonClick",value:function t(){if(this.getFeatureState("screenSharing")===e.FeatureState.Limited){this.showFeatureLimitSlider("screenSharing");return}if(this.getFeatureState("screenSharing")===e.FeatureState.Disabled){return}if(this.currentCall.isScreenSharingStarted()){this.currentCall.stopScreenSharing();if(this.isRecording()){BXDesktopSystem.CallRecordStopSharing()}if(this.floatingScreenShareWindow){this.floatingScreenShareWindow.close()}if(this.webScreenSharePopup){this.webScreenSharePopup.close()}}else{this.restClient.callMethod("im.call.onShareScreen",{callId:this.currentCall.id});this.currentCall.startScreenSharing()}}},{key:"onCallViewRecordButtonClick",value:function t(r){if(r.data.recordState===BX.Call.View.RecordState.Started){if(this.getFeatureState("record")===e.FeatureState.Limited){this.showFeatureLimitSlider("record");return}if(this.getFeatureState("record")===e.FeatureState.Disabled){return}if(this.canRecord()){this.callView.setButtonActive("record",true)}else{if(window.BX.Helper){window.BX.Helper.show("redirect=detail&code=12398134")}return}}else if(r.data.recordState===BX.Call.View.RecordState.Paused){if(this.canRecord()){BXDesktopSystem.CallRecordPause(true)}}else if(r.data.recordState===BX.Call.View.RecordState.Resumed){if(this.canRecord()){BXDesktopSystem.CallRecordPause(false)}}else if(r.data.recordState===BX.Call.View.RecordState.Stopped){this.callView.setButtonActive("record",false)}this.currentCall.sendRecordState({action:r.data.recordState,date:new Date});this.callRecordState=r.data.recordState}},{key:"onCallViewToggleVideoButtonClick",value:function e(t){if(this.currentCall){if(!BX.Call.Hardware.initialized){return}if(t.data.video&&Object.values(BX.Call.Hardware.cameraList).length===0){return}if(!t.data.video){this.callView.releaseLocalMedia()}this.currentCall.setVideoEnabled(t.data.video)}else{this.template.$emit("setCameraState",t.data.video)}}},{key:"onCallViewShareButtonClick",value:function e(){var t=400;if(U.Utils.device.isMobile()&&document.body.clientWidth<400){t=document.body.clientWidth-40}BX.UI.Notification.Center.notify({content:S.Loc.getMessage("BX_IM_VIDEOCONF_LINK_COPY_DONE"),autoHideDelay:4e3,width:t});u.Clipboard.copy(this.getDialogData()["public"].link)}},{key:"onCallViewFullScreenButtonClick",value:function e(){this.toggleFullScreen()}},{key:"onFloatingScreenShareBackToCallClick",value:function e(){BXDesktopWindow.ExecuteCommand("show.active");if(this.floatingScreenShareWindow){this.floatingScreenShareWindow.hide()}}},{key:"onFloatingScreenShareStopClick",value:function e(){BXDesktopWindow.ExecuteCommand("show.active");this.onCallViewToggleScreenSharingButtonClick()}},{key:"onFloatingScreenShareChangeScreenClick",value:function e(){if(this.currentCall){this.currentCall.startScreenSharing(true)}}},{key:"onWindowFocus",value:function e(){if(this.floatingScreenShareWindow){this.floatingScreenShareWindow.hide()}}},{key:"onWindowBlur",value:function e(){if(this.floatingScreenShareWindow&&this.currentCall&&this.currentCall.isScreenSharingStarted()){this.floatingScreenShareWindow.show()}}},{key:"isFullScreen",value:function e(){if("webkitFullscreenElement"in document){return!!document.webkitFullscreenElement}else if("fullscreenElement"in document){return!!document.fullscreenElement}return false}},{key:"toggleFullScreen",value:function e(){if(this.isFullScreen()){this.exitFullScreen()}else{this.enterFullScreen()}}},{key:"enterFullScreen",value:function e(){if(BX.browser.IsChrome()||BX.browser.IsSafari()){document.body.webkitRequestFullScreen()}else if(BX.browser.IsFirefox()){document.body.requestFullscreen()}}},{key:"exitFullScreen",value:function e(){if(document.cancelFullScreen){document.cancelFullScreen()}else if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}else if(document.document.exitFullscreen()){document.exitFullscreen()}}},{key:"onCallViewShowChatButtonClick",value:function e(){this.toggleChat()}},{key:"onCallViewToggleUsersButtonClick",value:function e(){this.toggleUserList()}},{key:"onCallViewFloorRequestButtonClick",value:function e(){var t=this;var r=this.callView.getUserFloorRequestState(BX.CallEngine.getCurrentUserId());var n=this.callView.getUserTalking(BX.CallEngine.getCurrentUserId());this.callView.setUserFloorRequestState(BX.CallEngine.getCurrentUserId(),!r);if(this.currentCall){this.currentCall.requestFloor(!r)}clearTimeout(this.callViewFloorRequestTimeout);if(n&&!r){this.callViewFloorRequestTimeout=setTimeout((function(){if(t.currentCall){t.currentCall.requestFloor(false)}}),1500)}}},{key:"bindCallEvents",value:function e(){this.currentCall.addEventListener(BX.Call.Event.onUserInvited,this.onCallUserInvitedHandler);this.currentCall.addEventListener(BX.Call.Event.onDestroy,this.onCallDestroyHandler);this.currentCall.addEventListener(BX.Call.Event.onUserStateChanged,this.onCallUserStateChangedHandler);this.currentCall.addEventListener(BX.Call.Event.onUserMicrophoneState,this.onCallUserMicrophoneStateHandler);this.currentCall.addEventListener(BX.Call.Event.onUserCameraState,this.onCallUserCameraStateHandler);this.currentCall.addEventListener(BX.Call.Event.onUserVideoPaused,this.onCallUserVideoPausedHandler);this.currentCall.addEventListener(BX.Call.Event.onLocalMediaReceived,this.onCallLocalMediaReceivedHandler);this.currentCall.addEventListener(BX.Call.Event.onRemoteMediaReceived,this.onCallRemoteMediaReceivedHandler);this.currentCall.addEventListener(BX.Call.Event.onRemoteMediaStopped,this.onCallRemoteMediaStoppedHandler);this.currentCall.addEventListener(BX.Call.Event.onUserVoiceStarted,this.onCallUserVoiceStartedHandler);this.currentCall.addEventListener(BX.Call.Event.onUserVoiceStopped,this.onCallUserVoiceStoppedHandler);this.currentCall.addEventListener(BX.Call.Event.onUserScreenState,this.onCallUserScreenStateHandler);this.currentCall.addEventListener(BX.Call.Event.onUserRecordState,this.onCallUserRecordStateHandler);this.currentCall.addEventListener(BX.Call.Event.onUserFloorRequest,this.onCallUserFloorRequestHandler);this.currentCall.addEventListener(BX.Call.Event.onMicrophoneLevel,this.onMicrophoneLevelHandler);this.currentCall.addEventListener(BX.Call.Event.onJoin,this._onCallJoinHandler);this.currentCall.addEventListener(BX.Call.Event.onLeave,this.onCallLeaveHandler)}},{key:"removeCallEvents",value:function e(){this.currentCall.removeEventListener(BX.Call.Event.onUserInvited,this.onCallUserInvitedHandler);this.currentCall.removeEventListener(BX.Call.Event.onDestroy,this.onCallDestroyHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserStateChanged,this.onCallUserStateChangedHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserMicrophoneState,this.onCallUserMicrophoneStateHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserCameraState,this.onCallUserCameraStateHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserVideoPaused,this.onCallUserVideoPausedHandler);this.currentCall.removeEventListener(BX.Call.Event.onLocalMediaReceived,this.onCallLocalMediaReceivedHandler);this.currentCall.removeEventListener(BX.Call.Event.onRemoteMediaReceived,this.onCallRemoteMediaReceivedHandler);this.currentCall.removeEventListener(BX.Call.Event.onRemoteMediaStopped,this.onCallRemoteMediaStoppedHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserVoiceStarted,this.onCallUserVoiceStartedHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserVoiceStopped,this.onCallUserVoiceStoppedHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserScreenState,this.onCallUserScreenStateHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserRecordState,this.onCallUserRecordStateHandler);this.currentCall.removeEventListener(BX.Call.Event.onUserFloorRequest,this.onCallUserFloorRequestHandler);this.currentCall.removeEventListener(BX.Call.Event.onMicrophoneLevel,this.onMicrophoneLevelHandler);this.currentCall.removeEventListener(BX.Call.Event.onLeave,this.onCallLeaveHandler)}},{key:"onCallUserInvited",value:function e(t){var r=this;this.callView.addUser(t.userId);BX.Call.Util.getUsers(this.currentCall.id,[t.userId]).then((function(e){r.controller.getStore().dispatch("users/set",Object.values(e));r.controller.getStore().dispatch("conference/setUsers",{users:Object.keys(e)});r.callView.updateUserData(e)}))}},{key:"onCallUserStateChanged",value:function e(t){this.callView.setUserState(t.userId,t.state);this.updateCallUser(t.userId,{state:t.state})}},{key:"onCallUserMicrophoneState",value:function e(t){this.callView.setUserMicrophoneState(t.userId,t.microphoneState);this.updateCallUser(t.userId,{microphoneState:t.microphoneState})}},{key:"onCallUserCameraState",value:function e(t){this.callView.setUserCameraState(t.userId,t.cameraState);this.updateCallUser(t.userId,{cameraState:t.cameraState})}},{key:"onCallUserVideoPaused",value:function e(t){this.callView.setUserVideoPaused(t.userId,t.videoPaused)}},{key:"onCallLocalMediaReceived",value:function e(t){this.stopLocalVideoStream();var r=t.tag=="main"?BX.Call.Hardware.enableMirroring:false;this.callView.setLocalStream(t.stream,r);this.callView.setButtonActive("screen",t.tag=="screen");if(t.tag=="screen"){if(!U.Utils.platform.isBitrixDesktop()){this.showWebScreenSharePopup()}this.callView.blockSwitchCamera();this.callView.updateButtons()}else{if(this.webScreenSharePopup){this.webScreenSharePopup.close()}if(!this.currentCall.callFromMobile&&!this.isViewerMode()){this.callView.unblockSwitchCamera();this.callView.updateButtons()}}}},{key:"onCallRemoteMediaReceived",value:function e(t){if(this.callView){if("track"in t){this.callView.setUserMedia(t.userId,t.kind,t.track)}if("mediaRenderer"in t&&t.mediaRenderer.kind==="audio"){this.callView.setUserMedia(t.userId,"audio",t.mediaRenderer.stream.getAudioTracks()[0])}if("mediaRenderer"in t&&(t.mediaRenderer.kind==="video"||t.mediaRenderer.kind==="sharing")){this.callView.setVideoRenderer(t.userId,t.mediaRenderer)}}}},{key:"onCallRemoteMediaStopped",value:function e(t){if(this.callView){if("mediaRenderer"in t){if(t.kind==="video"||t.kind==="sharing"){this.callView.setVideoRenderer(t.userId,null)}}else{this.callView.setUserMedia(t.userId,t.kind,null)}}}},{key:"onCallUserVoiceStarted",value:function e(t){if(t.local){if(this.currentCall.muted&&this.allowMutePopup){this.showMicMutedNotification()}return}this.callView.setUserTalking(t.userId,true);this.callView.setUserFloorRequestState(t.userId,false);this.updateCallUser(t.userId,{talking:true,floorRequestState:false})}},{key:"onCallUserVoiceStopped",value:function e(t){this.callView.setUserTalking(t.userId,false);this.updateCallUser(t.userId,{talking:false})}},{key:"onCallUserScreenState",value:function e(t){if(this.callView){this.callView.setUserScreenState(t.userId,t.screenState)}this.updateCallUser(t.userId,{screenState:t.screenState})}},{key:"onCallUserRecordState",value:function e(t){this.callRecordState=t.recordState.state;this.callView.setRecordState(t.recordState);if(!this.canRecord()||t.userId!=this.controller.getUserId()){return true}if(t.recordState.state===BX.Call.View.RecordState.Started&&t.recordState.userId==this.controller.getUserId()){var r=window.bxdWindowId||window.document.title;var n=BX.message("IM_CALL_RECORD_NAME");var i=this.currentCall.associatedEntity.id;var a=this.currentCall.associatedEntity.name;var l=this.currentCall.id;var s=BX.Main.Date.format(this.params.formatRecordDate||"d.m.Y");if(n){n=n.replace("#CHAT_TITLE#",a).replace("#CALL_ID#",l).replace("#DATE#",s)}else{n="call_record_"+this.currentCall.id}BX.CallEngine.getRestClient().callMethod("im.call.onStartRecord",{callId:this.currentCall.id});BXDesktopSystem.CallRecordStart({windowId:r,fileName:n,callId:l,callDate:s,dialogId:i,dialogName:a,muted:this.currentCall.isMuted(),cropTop:72,cropBottom:73,shareMethod:"im.disk.record.share"})}else if(t.recordState.state===BX.Call.View.RecordState.Stopped){BXDesktopSystem.CallRecordStop()}return true}},{key:"onCallUserFloorRequest",value:function e(t){this.callView.setUserFloorRequestState(t.userId,t.requestActive);this.updateCallUser(t.userId,{floorRequestState:t.requestActive})}},{key:"onMicrophoneLevel",value:function e(t){this.callView.setMicrophoneLevel(t.level)}},{key:"onCallJoin",value:function e(t){if(!t.local){return}if(!this.isViewerMode()){this.callView.unblockButtons(["camera","floorRequest","screen","record"])}this.callView.setUiState(BX.Call.View.UiState.Connected)}},{key:"onCallLeave",value:function e(t){if(!t.local){return}if(this.webScreenSharePopup){this.webScreenSharePopup.close()}this.endCall()}},{key:"onCallDestroy",value:function e(t){this.currentCall=null;if(this.floatingScreenShareWindow){this.floatingScreenShareWindow.close}if(this.webScreenSharePopup){this.webScreenSharePopup.close()}this.restart()}},{key:"onCheckDevicesSave",value:function e(t){if(t["camera"]){BX.Call.Hardware.defaultCamera=t["camera"]}if(t["microphone"]){BX.Call.Hardware.defaultMicrophone=t["microphone"]}if(t["audioOutput"]){BX.Call.Hardware.defaultSpeaker=t["audioOutput"]}if(t["preferHDQuality"]){BX.Call.Hardware.preferHdQuality=t["preferHDQuality"]}if(t["enableMicAutoParameters"]){BX.Call.Hardware.enableMicAutoParameters=t["enableMicAutoParameters"]}}},{key:"setCameraState",value:function e(t){this.callView.setCameraState(t)}},{key:"isChatShowed",value:function e(){return this.getConference().common.showChat}},{key:"toggleChat",value:function e(){var t=this.getConference().common.rightPanelMode;if(t===h.ConferenceRightPanelMode.hidden){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.chat});this.callView.setButtonActive("chat",true)}else if(t===h.ConferenceRightPanelMode.chat){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.hidden});this.callView.setButtonActive("chat",false)}else if(t===h.ConferenceRightPanelMode.users){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.split});this.callView.setButtonActive("chat",true)}else if(t===h.ConferenceRightPanelMode.split){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.users});this.callView.setButtonActive("chat",false)}}},{key:"toggleUserList",value:function e(){var t=this.getConference().common.rightPanelMode;if(t===h.ConferenceRightPanelMode.hidden){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.users});this.callView.setButtonActive("users",true)}else if(t===h.ConferenceRightPanelMode.users){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.hidden});this.callView.setButtonActive("users",false)}else if(t===h.ConferenceRightPanelMode.chat){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.split});this.callView.setButtonActive("users",true)}else if(t===h.ConferenceRightPanelMode.split){this.controller.getStore().dispatch("conference/changeRightPanelMode",{mode:h.ConferenceRightPanelMode.chat});this.callView.setButtonActive("users",false)}}},{key:"pinUser",value:function e(t){if(!this.callView){return false}this.callView.pinUser(t.id);this.callView.setLayout(BX.Call.View.Layout.Centered)}},{key:"unpinUser",value:function e(){if(!this.callView){return false}this.callView.unpinUser()}},{key:"changeBackground",value:function e(){if(!BX.Call.Hardware){return false}BX.Call.Hardware.BackgroundDialog.open()}},{key:"openChat",value:function e(t){this.desktop.onCustomEvent("bxConferenceOpenChat",[t.id])}},{key:"openProfile",value:function e(t){this.desktop.onCustomEvent("bxConferenceOpenProfile",[t.id])}},{key:"setDialogInited",value:function e(){this.dialogInited=true;var t=this.getDialogData();document.title=t.name}},{key:"changeVideoconfUrl",value:function e(t){window.history.pushState("","",t)}},{key:"sendNewMessageNotify",value:function e(t){var r=this;var n=40;var i=4e3;if(!this.checkIfMessageNotifyIsNeeded(t)){return false}var a=U.Utils.text.purify(t.message.text,t.message.params,t.files);if(a.length>n){a=a.substring(0,n-1)+"..."}var l="";var s="";if(t.message.senderId>0&&t.message.system!=="Y"){var o=this.controller.getStore().getters["users/get"](t.message.senderId,true);s=S.Tag.render(R||(R=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t<div class="bx-im-application-call-notify-new-message-username">',":</div>\n\t\t\t\t"])),o.name);if(o.avatar){l=S.Tag.render(M||(M=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t\t\t<div class="bx-im-application-call-notify-new-message-avatar-wrap">\n\t\t\t\t\t\t\t<img class="bx-im-application-call-notify-new-message-avatar" src="','" alt=""/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t'])),o.avatar)}}var c=S.Tag.render(X||(X=babelHelpers.taggedTemplateLiteral(['\n\t\t\t\t<div class="bx-im-application-call-notify-new-message">\n\t\t\t\t\t<div class="bx-im-application-call-notify-new-message-text">',"</div>\n\t\t\t\t</div>\n\t\t\t"])),a);if(l){S.Dom.prepend(l,c)}else if(s){S.Dom.prepend(s,c)}var u=BX.UI.Notification.Center.notify({content:c,width:"auto",autoHideDelay:i});u.getContent().addEventListener("click",(function(){u.close();r.toggleChat()}));return true}},{key:"checkIfMessageNotifyIsNeeded",value:function e(t){var r=this.getConference().common.rightPanelMode;return!U.Utils.device.isMobile()&&t.chatId===this.getChatId()&&(r!==h.ConferenceRightPanelMode.chat||r!==h.ConferenceRightPanelMode.split)&&t.message.senderId!==this.controller.getUserId()&&!this.getConference().common.error}},{key:"onInputFocus",value:function e(t){this.callView.setHotKeyTemporaryBlock(true)}},{key:"onInputBlur",value:function e(t){this.callView.setHotKeyTemporaryBlock(false)}},{key:"setUserWasRenamed",value:function e(){if(this.callView){this.callView.localUser.userModel.wasRenamed=true}}},{key:"setError",value:function e(t){var r=this.getConference().common.error;if(r&&r===h.ConferenceErrorCode.kickedFromCall){return}this.controller.getStore().commit("conference/setError",{errorCode:t})}},{key:"toggleSmiles",value:function e(){this.controller.getStore().commit("conference/toggleSmiles")}},{key:"setJoinType",value:function e(t){this.controller.getStore().commit("conference/setJoinType",{joinWithVideo:t})}},{key:"setConferenceStatus",value:function e(t){this.controller.getStore().commit("conference/setConferenceStatus",{conferenceStarted:t})}},{key:"setConferenceStartDate",value:function e(t){this.controller.getStore().commit("conference/setConferenceStartDate",{conferenceStartDate:t})}},{key:"setUserReadyToJoin",value:function e(){this.controller.getStore().commit("conference/setUserReadyToJoin")}},{key:"updateCallUser",value:function e(t,r){this.controller.getStore().dispatch("call/updateUser",{id:t,fields:r})}},{key:"setUserName",value:function e(t){var r=this;return new Promise((function(e,n){r.restClient.callMethod("im.call.user.update",{name:t,chat_id:r.getChatId()}).then((function(){e()}))["catch"]((function(e){n(e)}))}))}},{key:"checkPassword",value:function e(t){var r=this;return new Promise((function(e,n){r.restClient.callMethod("im.videoconf.password.check",{password:t,alias:r.params.alias}).then((function(i){if(i.data()===true){r.restClient.setPassword(t);r.controller.getStore().commit("conference/common",{passChecked:true});r.initUserComplete();e()}else{n()}}))["catch"]((function(e){console.error("Password check error",e)}))}))}},{key:"changeLink",value:function e(){var t=this;return new Promise((function(e,r){t.restClient.callMethod("im.videoconf.share.change",{dialog_id:t.getDialogId()}).then((function(){e()}))["catch"]((function(e){r(e)}))}))}},{key:"ready",value:function e(){if(this.inited){var t=new BX.Promise;t.resolve(this);return t}return this.initPromise}},{key:"getConference",value:function e(){return this.controller.getStore().state.conference}},{key:"isBroadcast",value:function e(){return this.getConference().common.isBroadcast}},{key:"getBroadcastPresenters",value:function e(){return this.getConference().common.presenters}},{key:"isExternalUser",value:function e(){return!!this.getUserHash()}},{key:"getChatId",value:function e(){return parseInt(this.params.chatId)}},{key:"getDialogId",value:function e(){return this.params.dialogId}},{key:"getDialogData",value:function e(){if(!this.dialogInited){return false}return this.controller.getStore().getters["dialogues/get"](this.getDialogId())}},{key:"getHost",value:function e(){return location.origin||""}},{key:"getStartupErrorCode",value:function e(){return this.params.startupErrorCode?this.params.startupErrorCode:""}},{key:"isHttps",value:function e(){return location.protocol==="https:"}},{key:"getUserHash",value:function e(){return this.getConference().user.hash}},{key:"getUserHashCookie",value:function e(){var t="";var r=s.Cookie.get(null,"BITRIX_CALL_HASH");if(typeof r==="string"&&r.match(/^[a-f0-9]{32}$/)){t=r}return t}},{key:"switchToSessAuth",value:function e(){this.restClient.restClient.queryParams=undefined;return true}}]);return e}();P.FeatureState={Enabled:"enabled",Disabled:"disabled",Limited:"limited"};e.ConferenceApplication=P})(this.BX.Messenger.Application=this.BX.Messenger.Application||{},BX,BX,BX.Messenger.Application,BX.Messenger,BX.Messenger.Model,BX.Messenger,BX.Messenger.Lib,BX.Messenger.Lib,BX.Messenger.Lib,BX.Messenger.Lib,BX.Messenger.Lib,BX.Messenger.Const,BX,BX.UI,BX.UI,BX,BX,BX,BX,BX,BX,BX.Event,BX,BX.Messenger.Provider.Pull,BX,BX.Messenger.Lib); //# sourceMappingURL=conference.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings