@rongcloud/plugin-call-plus
Version:
@rongcloud/plugin-call-plus
1 lines • 179 kB
JavaScript
import{isNumber as e,isBoolean as t,isUndefined as r,isString as i,EventEmitter as n,ErrorCode as o,SentStatus as a,RCConnectionStatus as _,isNull as l,getUUID22 as s,getUUID as c,ConversationType as u,MessageDirection as L,ReceivedStatus as d,RTCMode as E,notEmptyArray as C,notEmptyString as T,isObject as I,VersionManage as g,LogL as S}from"@rongcloud/engine";import{RCFrameRate as f,RCResolution as p,RCRTCCode as h,RCKickReason as R,helper as b,RCLocalTrack as O,device as A}from"@rongcloud/plugin-rtc";export{RCFrameRate as RCCallPlusFrameRate,RCResolution as RCCallPlusResolution}from"@rongcloud/plugin-rtc";var N=function(e,t){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},N(e,t)};function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}N(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var v=function(){return v=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},v.apply(this,arguments)};function y(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function _(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,_)}l((i=i.apply(e,t||[])).next())})}function P(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:_(0),throw:_(1),return:_(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function _(_){return function(l){return function(_){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,_[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&_[0]?i.return:_[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,_[1])).done)return n;switch(i=0,n&&(_=[2&_[0],n.value]),_[0]){case 0:case 1:n=_;break;case 4:return a.label++,{value:_[1],done:!1};case 5:a.label++,i=_[1],_=[0];continue;case 7:_=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==_[0]&&2!==_[0])){a=0;continue}if(3===_[0]&&(!n||_[1]>n[0]&&_[1]<n[3])){a.label=_[1];break}if(6===_[0]&&a.label<n[1]){a.label=n[1],n=_;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(_);break}n[2]&&a.ops.pop(),a.trys.pop();continue}_=t.call(e,a)}catch(e){_=[6,e],i=0}finally{r=n=0}if(5&_[0])throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}([_,l])}}}function U(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function M(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var D,w={SUCCESS:0,PARAM_ERROR:80001,SESSION_EXIST:80002,NOT_IN_CALL:80003,MEDIATYPE_INVALID:80004,NOT_VIDEO_CALL:80005,RTC_SERVICE_UNAVAILABLE:80006,USER_LIST_INVAILD:80007,CALL_ID_INVALID:80008,TRANSACTION_ID_INVALID:80009,USER_ID_INVALID:80010,SINGLE_CALL_NOT_SUPPORT_MULTI_PERSON:80011,SIGNAL_DISCONNECTED:80012,CAMERA_CLOSED:80100,MICROPHONE_CLOSED:80101,MEDIA_RESOURCE_INVALIED:80102,NOT_INSTALL_RTC_PLUGIN:80103,PLAY_MEDIA_FAILED:80104,VIDEO_VIEW_NOT_SET:80105};!function(e){e.L_INDEX_INSTALL_CALL_PLUS_PLUGIN_O="L-index_install_call_plus_plugin-O",e.L_CALLPLUS_CLIENT_SET_EVENT_LISTENER_O="L-callplus_client_set_event_listener-O",e.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O="L-callplus_client_call_event_listener-O",e.L_CALLPLUS_CLIENT_SET_STATUS_REPORT_LISTENER_O="L-callplus_client_set_status_report_listener-O",e.L_CALLPLUS_CLIENT_CALL_STATUS_REPORT_LISTENER_O="L-callplus_client_call_status_report_listener-O",e.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_T="L-callplus_client_set_video_config-T",e.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R="L-callplus_client_set_video_config-R",e.L_CALLPLUS_VIDEO_CONFIG_SET_FRAME_RATE_O="L-callplus_video_config_set_frame_rate-O",e.L_CALLPLUS_VIDEO_CONFIG_SET_RESOLUTION_O="L-callplus_video_config_set_resolution-O",e.L_CALLPLUS_VIDEO_CONFIG_SET_BITRATE_O="L-callplus_video_config_set_bitrate-O",e.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_T="L-callplus_client_set_audio_config-T",e.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R="L-callplus_client_set_audio_config-R",e.L_CALLPLUS_AUDIO_CONFIG_SET_BITRATE_O="L-callplus_audio_config_set_bitrate-O",e.L_CALLPLUS_AUDIO_CONFIG_SET_SAMPLE_RATE_O="L-callplus_audio_config_set_sample_rate-O",e.L_CALLPLUS_CLIENT_PREVIEW_T="L-callplus_client_preview-T",e.L_CALLPLUS_CLIENT_PREVIEW_R="L-callplus_client_preview-R",e.L_CALLPLUS_CLIENT_START_CALL_T="L-callplus_client_start_call-T",e.L_CALLPLUS_CLIENT_START_CALL_R="L-callplus_client_start_call-R",e.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_T="L-callplus_client_join_multi_call-T",e.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R="L-callplus_client_join_multi_call-R",e.L_CALLPLUS_CLIENT_ACCEPT_T="L-callplus_client_accept-T",e.L_CALLPLUS_CLIENT_ACCEPT_R="L-callplus_client_accept-R",e.L_CALLPLUS_CLIENT_HANGUP_T="L-callplus_client_hangup-T",e.L_CALLPLUS_CLIENT_HANGUP_R="L-callplus_client_hangup-R",e.L_CALLPLUS_CLIENT_INVITE_T="L-callplus_client_invite-T",e.L_CALLPLUS_CLIENT_INVITE_R="L-callplus_client_invite-R",e.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_T="L-callplus_client_request_change_media_type-T",e.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R="L-callplus_client_request_change_media_type-R",e.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_T="L-callplus_client_cancel_change_media_type-T",e.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R="L-callplus_client_cancel_change_media_type-R",e.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_T="L-callplus_client_reply_change_media_type-T",e.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R="L-callplus_client_reply_change_media_type-R",e.L_CALLPLUS_CLIENT_GET_CURRENT_CALL_SESSION_T="L-callplus_client_get_current_call_session-T",e.L_CALLPLUS_CLIENT_GET_CURRENT_CALL_SESSION_R="L-callplus_client_get_current_call_session-R",e.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_T="L-callplus_client_get_available_call_sessions_from_server-T",e.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R="L-callplus_client_get_available_call_sessions_from_server-R",e.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_T="L-callplus_client_get_call_records-T",e.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R="L-callplus_client_get_call_records-R",e.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_T="L-callplus_client_delete_call_records_by_callId-T",e.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R="L-callplus_client_delete_call_records_by_callId-R",e.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_T="L-callplus_client_delete_all_call_records_from_server-T",e.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R="L-callplus_client_delete_all_call_records_from_server-R",e.L_CALLPLUS_CLIENT_START_CAMERA_T="L-callplus_client_start_camera-T",e.L_CALLPLUS_CLIENT_START_CAMERA_R="L-callplus_client_start_camera-R",e.L_CALLPLUS_CLIENT_STOP_CAMERA_T="L-callplus_client_stop_camera-T",e.L_CALLPLUS_CLIENT_STOP_CAMERA_R="L-callplus_client_stop_camera-R",e.L_CALLPLUS_CLIENT_SWITCH_CAMERA_T="L-callplus_client_switch_camera-T",e.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R="L-callplus_client_switch_camera-R",e.L_CALLPLUS_CLIENT_START_MICROPHONE_T="L-callplus_client_start_microphone-T",e.L_CALLPLUS_CLIENT_START_MICROPHONE_R="L-callplus_client_start_microphone-R",e.L_CALLPLUS_CLIENT_STOP_MICROPHONE_T="L-callplus_client_stop_microphone-T",e.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R="L-callplus_client_stop_microphone-R",e.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_T="L-callplus_client_switch_microphone-T",e.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R="L-callplus_client_switch_microphone-R",e.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_T="L-callplus_client_set_video_view-T",e.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R="L-callplus_client_set_video_view-R",e.L_RTC_MODULE_SET_VIDEO_VIEW_O="L-rtc_module_set_video_view-O",e.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_T="L-callplus_client_remove_video_view-T",e.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R="L-callplus_client_remove_video_view-R",e.L_RTC_MODULE_REMOVE_VIDEO_VIEW_O="L-rtc_module_remove_video_view-O",e.L_CALLPLUS_CLIENT_PLAY_MEDIA_T="L-callplus_client_play_media-T",e.L_CALLPLUS_CLIENT_PLAY_MEDIA_R="L-callplus_client_play_media-R",e.L_RTC_MODULE_PLAY_MEDIA_T="L-rtc_module_play_media-T",e.L_RTC_MODULE_PLAY_MEDIA_R="L-rtc_module_play_media-R",e.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_T="L-rtc_module_set_all_remote_audio_enbale-T",e.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R="L-rtc_module_set_all_remote_audio_enable-R",e.L_RTC_MODULE_SUBSCRIBE_T="L-rtc_module_subscribe-T",e.L_RTC_MODULE_SUBSCRIBE_R="L-rtc_module_subscribe-R",e.L_RTC_MODULE_UNSUBSCRIBE_T="L-rtc_module_unsubscribe-T",e.L_RTC_MODULE_UNSUBSCRIBE_R="L-rtc_module_unsubscribe-R",e.L_RTC_MODULE_PUBLISH_T="L-rtc_module_publish-T",e.L_RTC_MODULE_PUBLISH_R="L-rtc_module_publish-R",e.L_RTC_MODULE_UNPUBLISH_T="L-rtc_module_unpublish-T",e.L_RTC_MODULE_UNPUBLISH_R="L-rtc_module_unpublish-R",e.L_RTC_MODULE_DESTROY_ALL_TRACKS_O="L-rtc_module_destroy_all_tracks-O",e.L_RTC_MODULE_SESSION_CONNECT_T="L-rtc_module_session_connect-T",e.L_RTC_MODULE_SESSION_CONNECT_P="L-rtc_module_session_connect-P",e.L_RTC_MODULE_SESSION_CONNECT_R="L-rtc_module_session_connect-R",e.L_RTC_MODULE_SESSION_CLOSE_T="L-rtc_module_session_close-T",e.L_RTC_MODULE_SESSION_CLOSE_P="L-rtc_module_session_close-P",e.L_RTC_MODULE_SESSION_CLOSE_R="L-rtc_module_session_close-R",e.L_RTC_MODULE_CREATE_VIDEO_TRACK_T="L-rtc_module_create_video_track-T",e.L_RTC_MODULE_CREATE_VIDEO_TRACK_R="L-rtc_module_create_video_track-R",e.L_RTC_MODULE_CREATE_AUDIO_TRACK_T="L-rtc_module_create_audio_track-T",e.L_RTC_MODULE_CREATE_AUDIO_TRACK_R="L-rtc_module_create_audio_track-R",e.L_RTC_MODULE_RECEIVE_TRACK_PUBLISH_O="L-rtc_module_receive_track_publish-O",e.L_RTC_MODULE_RECEIVE_TRACK_UNPUBLISH_O="L-rtc_module_receive_track_unpublish-O",e.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O="L-rtc_module_receive_track_enable_change-O",e.L_RTC_MODULE_RECEIVE_KICK_OFF_O="L-rtc_module_receive_kick_off-O",e.L_RTC_MODULE_RECEIVE_PEERCONNECTION_EXCEPT_CLOSE_O="L-rtc_module_receive_peerconnection_except_close-O",e.L_RTC_MODULE_CHANGE_MEDIA_TYPE_T="L-rtc_module_change_media_type-T",e.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R="L-rtc_module_change_media_type-R",e.L_RTC_MODULE_JOIN_RTC_ROOM_T="L-rtc_module_join_rtc_room-T",e.L_RTC_MODULE_JOIN_RTC_ROOM_R="L-rtc_module_join_rtc_room-R",e.L_RTC_MODULE_QUIT_RTC_ROOM_T="L-rtc_module_quit_rtc_room-T",e.L_RTC_MODULE_QUIT_RTC_ROOM_R="L-rtc_module_quit_rtc_room-R",e.L_RTC_MODULE_CREATE_CALL_MEDIA_TRACKS_P="L-rtc_module_create_call_media_tracks-P",e.L_SIGNAL_TRANSPORTER_SINGLE_CALL_T="L-signal_transporter_single_call-T",e.L_SIGNAL_TRANSPORTER_GROUP_CALL_T="L-signal_transporter_group_call-T",e.L_SIGNAL_TRANSPORTER_INVITE_T="L-signal_transporter_invite-T",e.L_SIGNAL_TRANSPORTER_RING_T="L-signal_transporter_ring-T",e.L_SIGNAL_TRANSPORTER_ACCEPT_T="L-signal_transporter_accept-T",e.L_SIGNAL_TRANSPORTER_ACCEPT_R="L-signal_transporter_accept-R",e.L_SIGNAL_TRANSPORTER_JOIN_CALL_T="L-signal_transporter_join_call-T",e.L_SIGNAL_TRANSPORTER_HANGUP_T="L-signal_transporter_hangup-T",e.L_SIGNAL_TRANSPORTER_CALL_STATUS_UP_T="L-signal_transporter_call_status_up-T",e.L_SIGNAL_TRANSPORTER_CALL_EVENT_UP_T="L-signal_transporter_call_event_up-T",e.L_SIGNAL_TRANSPORTER_CALL_DIALOG_UP_T="L-signal_transporter_call_dialog_up-T",e.L_SIGNAL_TRANSPORTER_DELETE_CALL_RECORD_T="L-signal_transporter_delete_call_record-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_RECORD_T="L-signal_transporter_get_call_record-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_SERVER_TIME_T="L-signal_transporter_get_call_server_time-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_TIME_INFO_T="L-signal_transporter_get_call_time_info-T",e.L_SIGNAL_TRANSPORTER_GET_AVAILABLE_CALL_LIST_T="L-signal_transporter_get_available_call_list-T",e.L_SIGNAL_TRANSPORTER_CLEAR_CALL_RECORD_T="L-signal_transporter_clear_call_record-T",e.L_SIGNAL_TRANSPORTER_GET_CALL_INFO_BY_CALLID_T="L-signal_transporter_get_call_info_by_callId-T",e.L_SIGNAL_TRANSPORTER_USER_SYSTEM_STATE_UP_T="L-signal_transporter_user_system_state_up-T",e.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_SIGNAL_DATA_O="L-signal_transporter_receive_call_signal_data-O",e.L_SIGNAL_TRANSPORTER_IM_STATE_CHANGE_O="L-signal_transporter_im_state_change-O",e.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O="L-signal_transporter_receive_invite-O",e.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O="L-signal_transporter_receive_call_status-O",e.L_SIGNAL_TRANSPORTER_RECEIVE_MISS_MESSAGE_O="L-signal_transporter_receive_miss_message-O",e.L_CALL_ENGINE_UPDATE_USERS_STATE_O="L-call_engine_update_users_state-O",e.L_CALL_ENGINE_IM_STATE_CHANGE_O="L-call_engine_im_state_change-O",e.L_CALL_ENGINE_CALL_TIMEOUT_O="L-call_engine_call_timeout-O",e.L_CALL_ENGINE_START_CALL_TIMER_O="L-call_engine_start_call_timer-O",e.L_CALL_ENGINE_STOP_CALL_TIMER_O="L-call_engine_stop_call_timer-O",e.L_CALL_ENGINE_UP_ON_PHONE_END_T="L-call_engine_up_on_phone_end-T",e.L_CALL_ENGINE_UP_ON_PHONE_END_R="L-call_engine_up_on_phone_end-R",e.L_CALL_ENGINE_RECEIVE_FIRST_FRAME_TIME_O="L-call_engine_receive_first_frame_time-O",e.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O="L-call_engine_receive_mediatype_change-O",e.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O="L-call_engine_receive_close_session-O",e.L_CALL_ENGINE_RECEIVE_CALL_RECORD_O="L-call_engine_receive_call_record-O",e.L_CALL_ENGINE_RECEIVE_COMPLEMENTARY_DATA_O="L-call_engine_receive_complementary_data-O",e.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_T="L-call_engine_create_session_by_server-T",e.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R="L-call_engine_create_session_by_server-R",e.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_T="L-call_engine_up_first_frame_time-T",e.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_R="L-call_engine_up_first_frame_time-R",e.L_TIME_CORRECT_START_O="L-time_correct_start-O",e.L_TIME_CORRECT_STOP_O="L-time_correct_stop-O",e.L_TIME_CORRECT_RESTART_O="L-time_correct_restart-O",e.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_T="L-time_correct_get_call_client_time_by_server-T",e.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_P="L-time_correct_get_call_client_time_by_server-P",e.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R="L-time_correct_get_call_client_time_by_server-R",e.L_TIME_CORRECT_CALC_CLIENT_START_TIME_T="L-time_correct_calc_client_start_time-T",e.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R="L-time_correct_calc_client_start_time-R",e.L_TIME_CORRECT_SET_DELTA_TIME_O="L-time_correct_set_delta_time-O",e.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_T="L-time_correct_loop_correct_client_time-T",e.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R="L-time_correct_loop_correct_client_time-R",e.L_INNER_SESSION_UPDATE_USER_STATE_O="L-inner_session_update_user_state-O",e.L_INNER_SESSION_SET_USER_DEVICE_ENABLE_O="L-inner_session_set_user_device_enable-O",e.L_CALLPLUS_SESSION_GET_CREATE_TIME_T="L-callplus_session_get_create_time-T",e.L_CALLPLUS_SESSION_GET_CREATE_TIME_R="L-callplus_session_get_create_time-R",e.L_CALLPLUS_SESSION_GET_DURATION_T="L-callplus_session_get_duration-T",e.L_CALLPLUS_SESSION_GET_DURATION_R="L-callplus_session_get_duration-R",e.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O="L-callplus_set_android_push_config-O",e.L_ABNORMAL_ADD_CALL_ID_E="L-ABNORMAL_ADD_CALL_ID-E",e.L_ABNORMAL_REMOVE_CALL_IDS_E="L-ABNORMAL_REMOVE_CALL_IDS-E",e.L_ABNORMAL_GET_CALL_IDS_E="L-ABNORMAL_GET_CALL_IDS-E",e.L_CALLPLUS_CLIENT_SET_AUDIO_OUTPUT_DEVICE_ID_O="L-set_audio_output_device_id-O"}(D||(D={}));var j,G,V,H,k,B,x,F=function(){function e(e,t,r,i,n){Object.defineProperty(this,"_session",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_rtcModule",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_startTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_duration",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._callId=this._session.getCallId()}return Object.defineProperty(e.prototype,"getCallId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(e.prototype,"getState",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getSessionState()}}),Object.defineProperty(e.prototype,"getCallType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getCallType()}}),Object.defineProperty(e.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getMediaType()}}),Object.defineProperty(e.prototype,"getUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this._session.getUserList().map(function(t){var r=t.userId,i=t.userState,n=null,o=null;return r===e._context.getCurrentId()?(n=e._rtcModule.getLocalVideoTrack(),o=e._rtcModule.getLocalAudioTrack()):(n=e._rtcModule.getRemoteTrack(r,V.VIDEO),o=e._rtcModule.getRemoteTrack(r,V.AUDIO)),{userId:r,state:i,cameraEnable:!!n&&!n.isOwnerMuted(),microphoneEnable:!!o&&!o.isOwnerMuted()}})}}),Object.defineProperty(e.prototype,"getCreatorUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getStartCallerId()}}),Object.defineProperty(e.prototype,"getInviterUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._session.getCallerId()}}),Object.defineProperty(e.prototype,"getCreateTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(){return y(this,void 0,void 0,function(){var e,t,r,i;return P(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(D.L_CALLPLUS_SESSION_GET_CREATE_TIME_T,"",e),this._startTime?[2,{code:w.SUCCESS,startTime:this._startTime}]:[4,this._callEngine.getCallStaringTime({callId:this._callId},e)];case 1:return t=n.sent(),r=t.code,i=t.clientStartTime,r!==w.SUCCESS?(this._logger.error(D.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"errCode: ".concat(r),e),[2,{code:r}]):(this._logger.info(D.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"success",e),this._startTime=i,[2,{code:w.SUCCESS,startTime:this._startTime}])}})})}}),Object.defineProperty(e.prototype,"getDuration",{enumerable:!1,configurable:!0,writable:!0,value:function(){return y(this,void 0,void 0,function(){var e,t,r,i;return P(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(D.L_CALLPLUS_SESSION_GET_DURATION_T,"",e),this._duration?(this._logger.info(D.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(w.SUCCESS,", duration: ").concat(this._duration),e),[2,{code:w.SUCCESS,duration:this._duration}]):[4,this._callEngine.getCallTimeInfo(this._callId,e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==w.SUCCESS?(this._logger.error(D.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(r),e),[2,{code:r}]):(this._logger.info(D.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(w.SUCCESS,", duration: ").concat(i.duration),e),this._duration=i.duration,[2,{code:w.SUCCESS,duration:this._duration}])}})})}}),e}();!function(e){e[e.SINGLE=0]="SINGLE",e[e.MULTI=1]="MULTI"}(j||(j={})),function(e){e[e.IDLE=0]="IDLE",e[e.CALLING=100]="CALLING",e[e.INVITED=101]="INVITED",e[e.RINGING=102]="RINGING",e[e.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",e[e.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",e[e.CONNECTING=200]="CONNECTING",e[e.ONCALL=300]="ONCALL",e[e.ONPHONE=301]="ONPHONE",e[e.ENDED=1e3]="ENDED",e[e.NO_ANSWER=1001]="NO_ANSWER",e[e.MISSED=1002]="MISSED",e[e.CANCELLED=1003]="CANCELLED",e[e.DECLINED=1004]="DECLINED",e[e.ERROR=2e3]="ERROR"}(G||(G={})),function(e){e[e.AUDIO=0]="AUDIO",e[e.AUDIO_VIDEO=1]="AUDIO_VIDEO",e[e.VIDEO=2]="VIDEO"}(V||(V={})),function(e){e[e.IDLE=0]="IDLE",e[e.CALLING=100]="CALLING",e[e.INVITED=101]="INVITED",e[e.RINGING=102]="RINGING",e[e.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",e[e.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",e[e.CONNECTING=200]="CONNECTING",e[e.ONCALL=300]="ONCALL",e[e.ENDED=1e3]="ENDED",e[e.NOANSWER=1001]="NOANSWER",e[e.MISSED=1002]="MISSED",e[e.CANCELED=1003]="CANCELED",e[e.DECLINED=1004]="DECLINED",e[e.ERROR=2e3]="ERROR"}(H||(H={})),function(e){e[e.CANCEL_CHANGE_MEDIA_TYPE=0]="CANCEL_CHANGE_MEDIA_TYPE",e[e.REFUSE_CHANGE_MEDIA_TYPE=1]="REFUSE_CHANGE_MEDIA_TYPE",e[e.SERVER_ALLOW_MEDIA_TYPE=2]="SERVER_ALLOW_MEDIA_TYPE",e[e.CHANGE_MEDIA_TYPE_TIMEOUT=3]="CHANGE_MEDIA_TYPE_TIMEOUT"}(k||(k={})),function(e){e[e.IDLE=0]="IDLE",e[e.CALLING=100]="CALLING",e[e.INVITED=101]="INVITED",e[e.RINGING=102]="RINGING",e[e.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",e[e.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",e[e.CONNECTING=200]="CONNECTING",e[e.ONCALL=300]="ONCALL",e[e.ON_PHONE=301]="ON_PHONE",e[e.ON_PHONE_END=302]="ON_PHONE_END",e[e.ON_DEVICE_DISABLE=303]="ON_DEVICE_DISABLE",e[e.ON_DEVICE_ENABLE=304]="ON_DEVICE_ENABLE",e[e.ABNORMAL_END=999]="ABNORMAL_END",e[e.ENDED=1e3]="ENDED",e[e.NO_ANSWER=1001]="NO_ANSWER",e[e.MISSED=1002]="MISSED",e[e.CANCELLED=1003]="CANCELLED",e[e.DECLINED=1004]="DECLINED",e[e.OTHER_CLIENT_CALLING=1010]="OTHER_CLIENT_CALLING",e[e.OTHER_CLIENT_ACCEPT=1011]="OTHER_CLIENT_ACCEPT",e[e.JOIN_ROOM_ERR=1105]="JOIN_ROOM_ERR",e[e.PUBLISH_ERR=1106]="PUBLISH_ERR",e[e.SUBSCRIBE_ERR=1107]="SUBSCRIBE_ERR",e[e.ACCEPT_CARRIER=1108]="ACCEPT_CARRIER",e[e.KICKED_BY_SERVER=1109]="KICKED_BY_SERVER",e[e.CONNECTION_ERR=1110]="CONNECTION_ERR",e[e.LOGOUT=1111]="LOGOUT",e[e.OTHER_CLIENT_LOGIN=1112]="OTHER_CLIENT_LOGIN",e[e.OTHER_CLIENT_JOINED=1113]="OTHER_CLIENT_JOINED",e[e.OTHER_CLIENT_IN_ROOM=1114]="OTHER_CLIENT_IN_ROOM",e[e.OTHER_CLIENT_HANGUP=1151]="OTHER_CLIENT_HANGUP",e[e.REMOTE_JOIN_RTC_ERROR=1205]="REMOTE_JOIN_RTC_ERROR",e[e.REMOTE_PUBLISH_ERROR=1206]="REMOTE_PUBLISH_ERROR",e[e.REMOTE_SUBSCRIBE_ERROR=1207]="REMOTE_SUBSCRIBE_ERROR",e[e.REMOTE_KICKED_BY_SERVER=1209]="REMOTE_KICKED_BY_SERVER",e[e.REMOTE_CONNECTION_ERROR=1210]="REMOTE_CONNECTION_ERROR",e[e.REMOTE_LOGOUT=1211]="REMOTE_LOGOUT",e[e.REMOTE_OTHER_CLIENT_LOGIN=1212]="REMOTE_OTHER_CLIENT_LOGIN",e[e.REMOTE_OTHER_JOINED_RTC=1213]="REMOTE_OTHER_JOINED_RTC",e[e.REMOTE_OTHER_CLIENT_IN_RTC=1214]="REMOTE_OTHER_CLIENT_IN_RTC"}(B||(B={})),function(e){e[e.START=1]="START",e[e.END=2]="END"}(x||(x={}));var Y,J=function(){function t(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(t.prototype,"setDefaultMicrophoneId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._audioConfig.microphoneId=e,this}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return!e(t)||!e(r)||r<=0||t<=0||r<t?(this._logger.error(D.L_CALLPLUS_AUDIO_CONFIG_SET_BITRATE_O,"params error -> max: ".concat(r,",min: ").concat(t,", max and min is a number > 0, max should > min")),this):(this._audioConfig.minBitrate=t,this._audioConfig.maxBitrate=r,this)}}),Object.defineProperty(t.prototype,"setSampleRate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e(t)?(this._audioConfig.sampleRate=t,this):(this._logger.error(D.L_CALLPLUS_AUDIO_CONFIG_SET_SAMPLE_RATE_O,"params error -> sampleRate: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._audioConfig}}),t}(),W=function(){function t(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:p.W640_H480,frameRate:f.FPS_15}})}return Object.defineProperty(t.prototype,"setFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return f[e]?(this._videoConfig.frameRate=e,this):(this._logger.error(D.L_CALLPLUS_VIDEO_CONFIG_SET_FRAME_RATE_O,"params error -> fps: ".concat(e)),this)}}),Object.defineProperty(t.prototype,"setVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return p[e]?(this._videoConfig.resolution=e,this):(this._logger.error(D.L_CALLPLUS_VIDEO_CONFIG_SET_RESOLUTION_O,"params error -> resolution: ".concat(e)),this)}}),Object.defineProperty(t.prototype,"setDefaultCameraId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._videoConfig.cameraId=e,this}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return!e(t)||!e(r)||r<=0||t<=0||r<t?(this._logger.error(D.L_CALLPLUS_VIDEO_CONFIG_SET_BITRATE_O,"params error -> max: ".concat(r,",min: ").concat(t,", max and min is a number > 0, max should > min")),this):(this._videoConfig.minBitrate=t,this._videoConfig.maxBitrate=r,this)}}),Object.defineProperty(t.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._videoConfig}}),t}(),K=function(e){return{callId:e.callId,callType:e.callType,callDirection:e.callDir,mediaType:e.mediaType,callerUserId:e.callingUserId,callUserIds:e.callUserIds,sessionState:e.callStatus,userState:e.sessionStatus,startTimestamp:e.startTime,endTimestamp:e.endTime,duration:e.duration,syncTimestamp:e.syncTime,systemState:e.sysStatus,createTimestamp:e.crtTime}},Q=function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()},q=function(e){var t=e.voipCallInfo;return!!t&&1===JSON.parse(t).strategy},X=function(t,r){return!t&&0!==t||e(t)&&!(t<=0)?!r&&0!==r||e(r)&&!(r<=0)?t&&r&&r<t?{code:w.PARAM_ERROR,errorMsg:"params error -> maxBitrate: ".concat(r,", minBitrate: ").concat(t,", maxBitrate should > minBitrate")}:{code:w.SUCCESS}:{code:w.PARAM_ERROR,errorMsg:"params error -> maxBitrate: a number of > 0, value: ".concat(r)}:{code:w.PARAM_ERROR,errorMsg:"params error -> minBitrate: a number of > 0, value: ".concat(t)}},z=function(e){var t=[];for(var r in e){var i=e[r],n=i.videoView,o=i.isTiny;t.push({userId:r,videoView:n.nodeName,isTiny:o})}return t},Z=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r={});var i=t.threadId,n=t.apnsCollapseId,o=t.richMediaUri,a=r.channelIdMi,_=r.channelIdHW,l=r.channelIdOPPO,s=r.typeVivo,c=r.fcmChannelId,u=r.fcmCollapseKey,L=r.fcmImageUrl,d=r.importanceHW,E=r.categoryHW,C=r.imageUrlHW,T=r.categoryVivo,I=r.importanceHonor,g=r.imageUrlHonor,S={};i&&(S["thread-id"]=i),S["apns-collapse-id"]=n||e,o&&(S.richMediaUri=o);var f={};_&&(f.channelId=_),C&&(f.image=C),E&&(f.category=E),f.importance=d||"NORMAL";var p,h,R,b,O=[{HW:f},{APNS:S}];return(u||L||c)&&(p={},u&&(p.collapse_key=u),L&&(p.imageUrl=L),c&&(p.channelId=c),O[0].FCM=p),a&&(O[0].MI={channelId:a}),l&&((h={}).channelId=l,O[0].OPPO=h),(s||T)&&(R={},s&&(R.classification=s),T&&(R.category=T),O[0].VIVO=R),(I||g)&&(b={},I&&(b.importance=I),g&&(b.image=g),O[0].HONOR=b),JSON.stringify(O)},$=function(e,r){var i=e.pushTitle,n=void 0===i?"":i,o=e.iOSConfig,a=e.androidConfig,_=e.disablePushTitle,l=e.templateId,s={pushConfigs:Z(r,o,a)};return t(_)&&(s.disableTitle=_),n&&(s.title=n),l&&(s.templateId=l),JSON.stringify(s)},ee=function(e){var n=["pushTitle","pushContent","iOSConfig","androidConfig","disablePushTitle","templateId"],o=Object.keys(e).every(function(e){return n.includes(e)});if(!o)return{code:w.PARAM_ERROR,errorMsg:"right key: ".concat(n.join(","))};for(var a=0;a<n.length;a++){var _=n[a];if("disablePushTitle"===_){if(!r(e[_])&&!t(e[_]))return{code:w.PARAM_ERROR,errorMsg:"".concat(_," type is boolean")}}else if(("pushTitle"===_||"templateId"===_||"pushContent"===_)&&e[_]&&!i(e[_]))return{code:w.PARAM_ERROR,errorMsg:"".concat(_," type is string")}}var l=e.iOSConfig,s=e.androidConfig,c=te(l||{});if(c.code!==w.SUCCESS)return c;var u=re(s||{});return u.code!==w.SUCCESS?u:{code:w.SUCCESS}},te=function(e){var t=e||{},r=t.threadId,n=t.richMediaUri;return r&&!i(r)?{code:w.PARAM_ERROR,errorMsg:"iOSConfig.threadId type is string"}:n&&!i(n)?{code:w.PARAM_ERROR,errorMsg:"iOSConfig.richMediaUri type is string"}:{code:w.SUCCESS}},re=function(e){var t=["channelIdMi","channelIdHW","categoryHW","importanceHW","imageUrlHW","channelIdOPPO","typeVivo","categoryVivo","fcmChannelId","fcmCollapseKey","fcmImageUrl","importanceHonor","imageUrlHonor"],r=Object.keys(e).every(function(e){return t.includes(e)});if(!r)return{code:w.PARAM_ERROR,errorMsg:"right key: ".concat(t.join(","))};for(var n=0;n<t.length;n++){var o=t[n];if("importanceHW"===o||"importanceHonor"===o){if(e[o]&&"LOW"!==e[o]&&"NORMAL"!==e[o])return{code:w.PARAM_ERROR,errorMsg:"androidConfig.".concat(o," value is NORMAL|LOW")}}else if(e[o]&&!i(e[o]))return{code:w.PARAM_ERROR,errorMsg:"androidConfig.".concat(o," type is string")}}return{code:w.SUCCESS}},ie=function(e,t){void 0===t&&(t="utf-8");return"utf-16"===t?ne(e):oe(e)},ne=function(e){for(var t=0,r=0,i=e.length;r<i;r++)t+=e.charCodeAt(r)<=65535?2:4;return t},oe=function(e){for(var t,r=0,i=0,n=e.length;i<n;i++)r+=(t=e.charCodeAt(i))<127?1:t<=2047?2:t<=65535?3:4;return r},ae=/Electron/.test(navigator.userAgent);!function(e){e.L_QS_START_CALL_S="Call-start-S",e.L_QS_ACCEPT_CALL_S="Call-accept-S",e.L_QS_HANGUP_CALL_S="Call-hangup-S",e.L_QS_RECEIVE_CALL_S="Call-recv-S",e.L_QS_ABNORMAL_HANGUP_S="Call-interrupt-S"}(Y||(Y={}));var _e,le,se,ce,ue=function(){function e(e,t){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t})}return Object.defineProperty(e.prototype,"reportStatisticsData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o,a){var _=+new Date,l=i?{mediaType:i.getMediaType(),callType:i.getCallType(),callId:i.getCallId()}:a,s={cr:"unknown",net:"unknown",cod:t,mtp:l.mediaType,ctp:l.callType,cid:l.callId,time:_,uid:this._context.getCurrentId()};n&&Object.assign(s,{ccid:n});var c=null;switch(e){case Y.L_QS_RECEIVE_CALL_S:c=v(v({},s),{rf:o});break;case Y.L_QS_ABNORMAL_HANGUP_S:c=v({},s);break;default:c=v(v({},s),{dur:_-r})}this._logger.__statistics(e,JSON.stringify(c))}}),e}();!function(e){e.REQUEST="request",e.ACCEPT="accept",e.REFUSE="refuse",e.CANCEL="cancel",e.NOTICE="notice",e.TIMEOUT="timeout"}(_e||(_e={})),function(e){e[e.SWITCH_MEDIA_TYPE=1]="SWITCH_MEDIA_TYPE"}(le||(le={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.SECRET=1]="SECRET"}(se||(se={})),function(e){e.INVITER="inviter",e.INVITEE="invitee"}(ce||(ce={}));var Le,de=function(e){function t(t,r,i,n,o,a,_,l){var s=e.call(this)||this;return Object.defineProperty(s,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(s,"_state",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_callType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_startCallerId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_callerId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_callUsers",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(s,"_reqMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_inviterTimerId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_inviteeTimerId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_oldDialogData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"isLocalClientHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s}return m(t,e),Object.defineProperty(t.prototype,"getCallId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callId}}),Object.defineProperty(t.prototype,"getSessionState",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._state}}),Object.defineProperty(t.prototype,"getCallType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callType}}),Object.defineProperty(t.prototype,"getMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mediaType}}),Object.defineProperty(t.prototype,"getStartCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._startCallerId}}),Object.defineProperty(t.prototype,"getCallerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callerId}}),Object.defineProperty(t.prototype,"getUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callUsers}}),Object.defineProperty(t.prototype,"getReqMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._reqMediaType}}),Object.defineProperty(t.prototype,"getInviterTimerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._inviterTimerId}}),Object.defineProperty(t.prototype,"getInviteeTimerId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._inviteeTimerId}}),Object.defineProperty(t.prototype,"getAllTimerIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return[this._inviterTimerId,this._inviteeTimerId]}}),Object.defineProperty(t.prototype,"updateUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];return e.forEach(function(e){var t=e.userState,n=e.stateTime,o=e.systemState,a=e.userId,_=r._callUsers.findIndex(function(e){return e.userId===a});if(_<0)return r._callUsers.push(e),void i.push(e);var l,s,c,u,L=r._callUsers[_],d=L.stateTime,E=L.systemState,C=L.userState,T=(l=E,s=o,c=!1,u=[B.INVITED,B.RINGING,B.BUSYLINE_RINGING,B.BUSYLINE_WAIT,B.CONNECTING,B.ONCALL],l===B.ONCALL&&u.includes(s)&&(c=!0),c),I=function(e,t){var r=!1,i=[G.INVITED,G.RINGING,G.BUSYLINE_RINGING,G.BUSYLINE_WAIT,G.CONNECTING,G.ONCALL];return e===G.ONCALL&&i.includes(t)&&(r=!0),r}(C,t),g=o===B.ON_PHONE_END&&E!==B.ON_PHONE&&t!==G.IDLE;n&&d&&n<d||T&&I||(r._callUsers[_]=e,!g&&i.push(e))}),i}}),Object.defineProperty(t.prototype,"setOldDialogData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._oldDialogData=e}}),Object.defineProperty(t.prototype,"updateSessionState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._state=e}}),Object.defineProperty(t.prototype,"updateCallType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callType=e}}),Object.defineProperty(t.prototype,"updateMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._mediaType=e}}),Object.defineProperty(t.prototype,"updateReqMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reqMediaType=e}}),Object.defineProperty(t.prototype,"updateTimerId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e===ce.INVITER?this._inviterTimerId=t:this._inviteeTimerId=t}}),Object.defineProperty(t.prototype,"getOldDialogData",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._oldDialogData}}),Object.defineProperty(t.prototype,"setIsLocalClientHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.isLocalClientHangup=e}}),Object.defineProperty(t.prototype,"getIsLocalClientHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.isLocalClientHangup}}),t}(n);!function(e){e.START_SINGLE_CALL="startSingleCall",e.START_GROUP_CALL="startGroupCall",e.INVITE_CALL="inviteCall",e.PUB_INVITE_CALL="pubInviteCall",e.RINGING_CALL="ringCall",e.ACCEPT_CALL="acceptCall",e.JOIN_CALL="joinCall",e.HANGUP_CALL="hangupCall",e.STATUS_UP_CALL="statusUpCall",e.STATUS_DOWN_CALL="statusDownCall",e.EVENT_UP_CALL="eventUpCall",e.EVENT_DOWN_CALL="eventDownCall",e.DIALOG_UP_CALL="dialogUpCall",e.DIALOG_DOWN_CALL="dialogDownCall",e.GET_CALL_USER_SESSION_LIST="getCallUSerSessionList",e.SYNC_CALL_LOG="syncCallLog",e.PUB_CALL_LOG="pubCallLog",e.DEL_CALL_LOG="deleteCallLog",e.QRY_CALL_STATE="queryUserHasCall",e.QRY_SRV_TIMESTAMP="getCallSrvTimeStamp",e.GET_CALL_STATE_LIST="getUserCallStateList",e.CLEAR_CALL_LOG="cleanCallLog",e.GET_CALL_SESSION="getCallSession",e.GET_CALL_TIME_INFO="getCallTimeInfo",e.END_ABNORMAL_CALL="endUserAbnormalCalls",e.SYS_STATUS_UP="sysStatusUp",e.UP_CALL_LOG_READED="upCallLogReaded",e.PUB_CALL_LOG_READED="pubCallLogReaded",e.PUB_NACK_SEQ_ID="pubNACKSeqId",e.GET_USER_CALL_SESSION_ID_LIST="getUserCallSessionIdList"}(Le||(Le={}));var Ee,Ce,Te,Ie=function(e,t){return setTimeout(e,t)},ge=[o.RC_NET_CHANNEL_INVALID,o.RC_NET_UNAVAILABLE,o.RC_MSG_RESP_TIMEOUT,h.SIGNAL_DISCONNECTED,h.REQUEST_FAILED],Se=function(e){var t=e.asyncFn,r=e.fnArgs,i=e.currentRetryTime,n=void 0===i?Date.now():i,o=e.maxDuration,a=void 0===o?6e4:o,_=e.intervals,l=void 0===_?[2e3,4e3,8e3,16e3,32e3,64e3]:_,s=e.index,c=void 0===s?0:s,u=e.onError;return y(void 0,void 0,void 0,function(){var e;return P(this,function(i){switch(i.label){case 0:return[4,t.apply(void 0,M([],U(r),!1))];case 1:return e=i.sent(),e.code===w.SUCCESS||!ge.includes(e.code)||Date.now()+2e3-n>a?[3,3]:(u&&u(e.code),[4,(o=2e3,new Promise(function(e){setTimeout(e,o)}))]);case 2:return i.sent(),[2,Se({asyncFn:t,fnArgs:r,currentRetryTime:n,maxDuration:a,intervals:l,index:c,onError:u})];case 3:return[2,e]}var o})})};!function(e){e.onBeforePublish="onBeforePublish",e.onPublishRes="onPublishRes",e.onPubInviteCall="onPubInviteCall",e.onPubInviteCallPullKv="onPubInviteCallPullKv",e.onPubInviteCallMiss="onPubInviteCallMiss"}(Ee||(Ee={})),function(e){e.NOT_CURRENT_DEVICEID="not current device id",e.SECRET_CALL="secret call",e.NOT_INVITEE="not an invitee"}(Ce||(Ce={})),function(e){e.PUB_INVITE="pubinvitecall",e.PULL_KV_INVITE="pullkv_invitecall",e.PUSH="system_pubsh"}(Te||(Te={}));var fe,pe,he=131072,Re="RC:CallPlusMiss",be="RC:CallGroupStatusMsg",Oe=function(e){function t(t,r,i,n,o,a){var _=e.call(this)||this;return Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(_,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"_timeCorrectioner",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_needRetryActions",{enumerable:!0,configurable:!0,writable:!0,value:[Le.START_SINGLE_CALL,Le.START_GROUP_CALL,Le.ACCEPT_CALL,Le.JOIN_CALL,Le.EVENT_UP_CALL]}),Object.defineProperty(_,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),_._context.onCallInfo=_._onRecvCallSignal.bind(_),_._context.onconnectionstatechange=_._onIMConnectionStateChange.bind(_),_._context.onmessage=_._onMessage.bind(_),_._sessionId=s(),_}return m(t,e),Object.defineProperty(t.prototype,"_onMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!![Re,be].includes(e.messageType)&&(e.messageType===Re?this._dealMissMessage(e):this._dealGroupCallMessage(e),!0)}}),Object.defineProperty(t.prototype,"_dealMissMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content,r=t.callId,i=t.mediaType,n=t.startTime,o=t.callSessionUsers,_=e.targetId,l=e.senderUserId,s=this._context.getCurrentId();if(!localStorage.getItem("missMessageMap-".concat(s,"-").concat(r))){var c={callId:r,callerUserId:l,targetId:_,mediaType:i,firstFrameTime:0,callStartTime:n-this._timeCorrectioner.getLocalDelayTime(),callEndTime:0,hangupReason:o.filter(function(e){return e.userId===s})[0].sessionStatus};this._logger.info(D.L_SIGNAL_TRANSPORTER_RECEIVE_MISS_MESSAGE_O,"receive miss message: ".concat(JSON.stringify(e)));var u=Object.assign(e,{content:c,sentStatus:a.SENT});this._reportAppEventModule.onReceivedCallPlusSummaryMessage(u),localStorage.setItem("missMessageMap-".concat(s,"-").concat(r),r)}}}),Object.defineProperty(t.prototype,"_dealGroupCallMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportAppEventModule.onReceivedGroupCallStatusMessage(e)}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(t.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return ae?this._context.getDeviceId():this._sessionId}}),Object.defineProperty(t.prototype,"registerListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(t.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){var r,i,n,o,a,_,l,s,c,u,L,d;return P(this,function(E){return r=e.clientCallId,i=e.callType,n=e.toUsers,o=e.mediaType,a=e.secretChat,_=e.targetType,l=e.targetId,s=e.nickName,c=e.oldRoomId,u=e.pushExt,L=e.pushContent,d=e.extra,i===j.SINGLE?[2,this.startSingleCall({clientCallId:r,toUserId:n[0].userId,mediaType:o,secretChat:a,targetType:_,targetId:l,oldRoomId:c,toOrgId:n[0].orgId||"",pushExt:u,pushContent:L,extra:d},t)]:[2,this.startGroupCall({clientCallId:r,toUsers:n,mediaType:o,targetType:_,targetId:l,nickName:s,oldRoomId:c,pushExt:u,pushContent:L,extra:d},t)]})})}}),Object.defineProperty(t.prototype,"startSingleCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_SINGLE_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),Le.START_SINGLE_CALL,e)]})})}}),Object.defineProperty(t.prototype,"startGroupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_GROUP_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),Le.START_GROUP_CALL,e)]})})}}),Object.defineProperty(t.prototype,"inviteCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_INVITE_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.INVITE_CALL,e)]})})}}),Object.defineProperty(t.prototype,"ringingCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_RING_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.RINGING_CALL,e)]})})}}),Object.defineProperty(t.prototype,"acceptCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_ACCEPT_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.ACCEPT_CALL,e)]})})}}),Object.defineProperty(t.prototype,"joinCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_JOIN_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.JOIN_CALL,e)]})})}}),Object.defineProperty(t.prototype,"hangupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){var r;return P(this,function(i){switch(i.label){case 0:return this._logger.info(D.L_SIGNAL_TRANSPORTER_HANGUP_T,"params: ".concat(JSON.stringify(e)),t),[4,this._sendCallSignal(e.callId,Le.HANGUP_CALL,e)];case 1:return(r=i.sent().code)===w.NOT_IN_CALL?[2,{code:w.SUCCESS}]:[2,{code:r}]}})})}}),Object.defineProperty(t.prototype,"statusUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_CALL_STATUS_UP_T,"call status up params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.STATUS_UP_CALL,e)]})})}}),Object.defineProperty(t.prototype,"eventUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_CALL_EVENT_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.EVENT_UP_CALL,e)]})})}}),Object.defineProperty(t.prototype,"dialogUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_CALL_DIALOG_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.DIALOG_UP_CALL,e)]})})}}),Object.defineProperty(t.prototype,"deleteCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return y(this,void 0,void 0,function(){return P(this,function(i){return this._logger.info(D.L_SIGNAL_TRANSPORTER_DELETE_CALL_RECORD_T,"callIds: ".concat(JSON.stringify(t)),r),[2,this._sendCallSignal(e,Le.DEL_CALL_LOG,{callIds:t})]})})}}),Object.defineProperty(t.prototype,"syncCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_GET_CALL_RECORD_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.userId,Le.SYNC_CALL_LOG,e)]})})}}),Object.defineProperty(t.prototype,"queryUserHasCall",{enumerable:!1,configurable:!0,writable:!0,value:function(){return y(this,void 0,void 0,function(){var e;return P(this,function(t){return e=this._context.getCurrentId(),[2,this._sendCallSignal(e,Le.QRY_CALL_STATE,null)]})})}}),Object.defineProperty(t.prototype,"getCallServerTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return y(this,void 0,void 0,function(){var t;return P(this,function(r){return t=this._context.getCurrentId(),this._logger.info(D.L_SIGNAL_TRANSPORTER_GET_CALL_SERVER_TIME_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,Le.QRY_SRV_TIMESTAMP,null)]})})}}),Object.defineProperty(t.prototype,"getCallTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_GET_CALL_TIME_INFO_T,"callId: ".concat(e),t),[2,this._sendCallSignal(e,Le.GET_CALL_TIME_INFO,{callId:e})]})})}}),Object.defineProperty(t.prototype,"getUserCallStateList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return y(this,void 0,void 0,function(){var t;return P(this,function(r){return t=this._context.getCurrentId(),this._logger.info(D.L_SIGNAL_TRANSPORTER_GET_AVAILABLE_CALL_LIST_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,Le.GET_CALL_STATE_LIST,null)]})})}}),Object.defineProperty(t.prototype,"clearCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return y(this,void 0,void 0,function(){var t;return P(this,function(r){return t=this._context.getCurrentId(),this._logger.info(D.L_SIGNAL_TRANSPORTER_CLEAR_CALL_RECORD_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,Le.CLEAR_CALL_LOG,null)]})})}}),Object.defineProperty(t.prototype,"getCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_GET_CALL_INFO_BY_CALLID_T,"callId: ".concat(e.callId),t),[2,this._sendCallSignal(e.callId,Le.GET_CALL_SESSION,e)]})})}}),Object.defineProperty(t.prototype,"sysStatusUp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return y(this,void 0,void 0,function(){return P(this,function(r){return this._logger.info(D.L_SIGNAL_TRANSPORTER_USER_SYSTEM_STATE_UP_T,"opts: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,Le.SYS_STATUS_UP,e)]})})}}),Object.defineProperty(t.prototype,"upCallLogReaded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return y(this,void 0,void 0,function(){var t;return P(this,function(r){return t=this._context.getCurrentId(),[2,this._sendCallSignal(t,Le.UP_CALL_LOG_READED,e)]})})}}),Object.defineProperty(t.prototype,"endUserAbnormalCalls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return y(this,void 0,void 0,function(){return P(this,function(t){return[2,this._sendCallSignal(this._context.getCurrentId(),Le.END_ABNORMAL_CALL,e)]})})}}),Object.defineProperty(t.prototype,"_onIMConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._logger.createTraceId();this._logger.info(D.L_SIGNAL_TRANSPORTER_IM_STATE_CHANGE_O,"state: ".concat(e),t),this._listener.onIMStateChange(e),e===_.CONNECTED?this._timeCorrectioner.start(t):this._timeCorrectioner.stop(t)}}),Object.defineProperty(t.prototype,"_sendCallSignal",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return y(this,void 0,void 0,function(){var i,n,a,_,l,s;return P(this,function(c){switch(c.label){case 0:return i="",r&&(i=ae?JSON.stringify(r):JSON.stringify(v(v({},r),{sessionId:this._sessionId}))),this._needRetryActions.includes(t)?[4,Se({asyncFn:this._context.setCallInfo.bind(this._context),fnArgs:[e,t,i]})]:[3,2];case 1:return n=c.sent(),[3,4];case 2:return[4,this._context.setCallInfo(e,t,i)];case 3:n