@rongcloud/plugin-call-plus 2.22.0 → 2.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=require("@rongcloud/plugin-rtc"),r=function(e,t){return r=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])},r(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var n=function(){return n=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},n.apply(this,arguments)};function o(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{_(i.next(e))}catch(e){o(e)}}function l(e){try{_(i.throw(e))}catch(e){o(e)}}function _(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 a(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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(_){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&l[0]?i.return:l[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,l[1])).done)return n;switch(i=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,i=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){a.label=l[1];break}if(6===l[0]&&a.label<n[1]){a.label=n[1],n=l;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(l);break}n[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],i=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,_])}}}function l(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 _(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 s,c={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"}(s||(s={}));var u,C,d,L,E,T,S,g=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,exports.RCCallPlusMediaType.VIDEO),o=e._rtcModule.getRemoteTrack(r,exports.RCCallPlusMediaType.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 o(this,void 0,void 0,function(){var e,t,r,i;return a(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_T,"",e),this._startTime?[2,{code:c.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!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"errCode: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"success",e),this._startTime=i,[2,{code:c.SUCCESS,startTime:this._startTime}])}})})}}),Object.defineProperty(e.prototype,"getDuration",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,t,r,i;return a(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_T,"",e),this._duration?(this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(c.SUCCESS,", duration: ").concat(this._duration),e),[2,{code:c.SUCCESS,duration:this._duration}]):[4,this._callEngine.getCallTimeInfo(this._callId,e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(c.SUCCESS,", duration: ").concat(i.duration),e),this._duration=i.duration,[2,{code:c.SUCCESS,duration:this._duration}])}})})}}),e}();(u=exports.RCCallPlusType||(exports.RCCallPlusType={}))[u.SINGLE=0]="SINGLE",u[u.MULTI=1]="MULTI",(C=exports.RCCallPlusSessionUserState||(exports.RCCallPlusSessionUserState={}))[C.IDLE=0]="IDLE",C[C.CALLING=100]="CALLING",C[C.INVITED=101]="INVITED",C[C.RINGING=102]="RINGING",C[C.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",C[C.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",C[C.CONNECTING=200]="CONNECTING",C[C.ONCALL=300]="ONCALL",C[C.ONPHONE=301]="ONPHONE",C[C.ENDED=1e3]="ENDED",C[C.NO_ANSWER=1001]="NO_ANSWER",C[C.MISSED=1002]="MISSED",C[C.CANCELLED=1003]="CANCELLED",C[C.DECLINED=1004]="DECLINED",C[C.ERROR=2e3]="ERROR",(d=exports.RCCallPlusMediaType||(exports.RCCallPlusMediaType={}))[d.AUDIO=0]="AUDIO",d[d.AUDIO_VIDEO=1]="AUDIO_VIDEO",d[d.VIDEO=2]="VIDEO",(L=exports.RCCallPlusCallState||(exports.RCCallPlusCallState={}))[L.IDLE=0]="IDLE",L[L.CALLING=100]="CALLING",L[L.INVITED=101]="INVITED",L[L.RINGING=102]="RINGING",L[L.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",L[L.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",L[L.CONNECTING=200]="CONNECTING",L[L.ONCALL=300]="ONCALL",L[L.ENDED=1e3]="ENDED",L[L.NOANSWER=1001]="NOANSWER",L[L.MISSED=1002]="MISSED",L[L.CANCELED=1003]="CANCELED",L[L.DECLINED=1004]="DECLINED",L[L.ERROR=2e3]="ERROR",(E=exports.RCCallPlusMediaTypeChangeResult||(exports.RCCallPlusMediaTypeChangeResult={}))[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",(T=exports.RCCallPlusReason||(exports.RCCallPlusReason={}))[T.IDLE=0]="IDLE",T[T.CALLING=100]="CALLING",T[T.INVITED=101]="INVITED",T[T.RINGING=102]="RINGING",T[T.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",T[T.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",T[T.CONNECTING=200]="CONNECTING",T[T.ONCALL=300]="ONCALL",T[T.ON_PHONE=301]="ON_PHONE",T[T.ON_PHONE_END=302]="ON_PHONE_END",T[T.ON_DEVICE_DISABLE=303]="ON_DEVICE_DISABLE",T[T.ON_DEVICE_ENABLE=304]="ON_DEVICE_ENABLE",T[T.ABNORMAL_END=999]="ABNORMAL_END",T[T.ENDED=1e3]="ENDED",T[T.NO_ANSWER=1001]="NO_ANSWER",T[T.MISSED=1002]="MISSED",T[T.CANCELLED=1003]="CANCELLED",T[T.DECLINED=1004]="DECLINED",T[T.OTHER_CLIENT_CALLING=1010]="OTHER_CLIENT_CALLING",T[T.OTHER_CLIENT_ACCEPT=1011]="OTHER_CLIENT_ACCEPT",T[T.JOIN_ROOM_ERR=1105]="JOIN_ROOM_ERR",T[T.PUBLISH_ERR=1106]="PUBLISH_ERR",T[T.SUBSCRIBE_ERR=1107]="SUBSCRIBE_ERR",T[T.ACCEPT_CARRIER=1108]="ACCEPT_CARRIER",T[T.KICKED_BY_SERVER=1109]="KICKED_BY_SERVER",T[T.CONNECTION_ERR=1110]="CONNECTION_ERR",T[T.LOGOUT=1111]="LOGOUT",T[T.OTHER_CLIENT_LOGIN=1112]="OTHER_CLIENT_LOGIN",T[T.OTHER_CLIENT_JOINED=1113]="OTHER_CLIENT_JOINED",T[T.OTHER_CLIENT_IN_ROOM=1114]="OTHER_CLIENT_IN_ROOM",T[T.OTHER_CLIENT_HANGUP=1151]="OTHER_CLIENT_HANGUP",T[T.REMOTE_JOIN_RTC_ERROR=1205]="REMOTE_JOIN_RTC_ERROR",T[T.REMOTE_PUBLISH_ERROR=1206]="REMOTE_PUBLISH_ERROR",T[T.REMOTE_SUBSCRIBE_ERROR=1207]="REMOTE_SUBSCRIBE_ERROR",T[T.REMOTE_KICKED_BY_SERVER=1209]="REMOTE_KICKED_BY_SERVER",T[T.REMOTE_CONNECTION_ERROR=1210]="REMOTE_CONNECTION_ERROR",T[T.REMOTE_LOGOUT=1211]="REMOTE_LOGOUT",T[T.REMOTE_OTHER_CLIENT_LOGIN=1212]="REMOTE_OTHER_CLIENT_LOGIN",T[T.REMOTE_OTHER_JOINED_RTC=1213]="REMOTE_OTHER_JOINED_RTC",T[T.REMOTE_OTHER_CLIENT_IN_RTC=1214]="REMOTE_OTHER_CLIENT_IN_RTC",(S=exports.IGroupCallStatusMessageType||(exports.IGroupCallStatusMessageType={}))[S.START=1]="START",S[S.END=2]="END";var I,p=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.isNumber(t)||!e.isNumber(r)||r<=0||t<=0||r<t?(this._logger.error(s.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.isNumber(t)?(this._audioConfig.sampleRate=t,this):(this._logger.error(s.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}(),R=function(){function r(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:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}})}return Object.defineProperty(r.prototype,"setFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t.RCFrameRate[e]?(this._videoConfig.frameRate=e,this):(this._logger.error(s.L_CALLPLUS_VIDEO_CONFIG_SET_FRAME_RATE_O,"params error -> fps: ".concat(e)),this)}}),Object.defineProperty(r.prototype,"setVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t.RCResolution[e]?(this._videoConfig.resolution=e,this):(this._logger.error(s.L_CALLPLUS_VIDEO_CONFIG_SET_RESOLUTION_O,"params error -> resolution: ".concat(e)),this)}}),Object.defineProperty(r.prototype,"setDefaultCameraId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._videoConfig.cameraId=e,this}}),Object.defineProperty(r.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return!e.isNumber(t)||!e.isNumber(r)||r<=0||t<=0||r<t?(this._logger.error(s.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(r.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._videoConfig}}),r}(),f=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}},h=function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()},b=function(e){var t=e.voipCallInfo;return!!t&&1===JSON.parse(t).strategy},O=function(t,r){return!t&&0!==t||e.isNumber(t)&&!(t<=0)?!r&&0!==r||e.isNumber(r)&&!(r<=0)?t&&r&&r<t?{code:c.PARAM_ERROR,errorMsg:"params error -> maxBitrate: ".concat(r,", minBitrate: ").concat(t,", maxBitrate should > minBitrate")}:{code:c.SUCCESS}:{code:c.PARAM_ERROR,errorMsg:"params error -> maxBitrate: a number of > 0, value: ".concat(r)}:{code:c.PARAM_ERROR,errorMsg:"params error -> minBitrate: a number of > 0, value: ".concat(t)}},A=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},N=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,l=r.channelIdHW,_=r.channelIdOPPO,s=r.typeVivo,c=r.fcmChannelId,u=r.fcmCollapseKey,C=r.fcmImageUrl,d=r.importanceHW,L=r.categoryHW,E=r.imageUrlHW,T=r.categoryVivo,S=r.importanceHonor,g=r.imageUrlHonor,I={};i&&(I["thread-id"]=i),I["apns-collapse-id"]=n||e,o&&(I.richMediaUri=o);var p={};l&&(p.channelId=l),E&&(p.image=E),L&&(p.category=L),p.importance=d||"NORMAL";var R,f,h,b,O=[{HW:p},{APNS:I}];return(u||C||c)&&(R={},u&&(R.collapse_key=u),C&&(R.imageUrl=C),c&&(R.channelId=c),O[0].FCM=R),a&&(O[0].MI={channelId:a}),_&&((f={}).channelId=_,O[0].OPPO=f),(s||T)&&(h={},s&&(h.classification=s),T&&(h.category=T),O[0].VIVO=h),(S||g)&&(b={},S&&(b.importance=S),g&&(b.image=g),O[0].HONOR=b),JSON.stringify(O)},m=function(t,r){var i=t.pushTitle,n=void 0===i?"":i,o=t.iOSConfig,a=t.androidConfig,l=t.disablePushTitle,_=t.templateId,s={pushConfigs:N(r,o,a)};return e.isBoolean(l)&&(s.disableTitle=l),n&&(s.title=n),_&&(s.templateId=_),JSON.stringify(s)},v=function(t){var r=["pushTitle","pushContent","iOSConfig","androidConfig","disablePushTitle","templateId"],i=Object.keys(t).every(function(e){return r.includes(e)});if(!i)return{code:c.PARAM_ERROR,errorMsg:"right key: ".concat(r.join(","))};for(var n=0;n<r.length;n++){var o=r[n];if("disablePushTitle"===o){if(!e.isUndefined(t[o])&&!e.isBoolean(t[o]))return{code:c.PARAM_ERROR,errorMsg:"".concat(o," type is boolean")}}else if(("pushTitle"===o||"templateId"===o||"pushContent"===o)&&t[o]&&!e.isString(t[o]))return{code:c.PARAM_ERROR,errorMsg:"".concat(o," type is string")}}var a=t.iOSConfig,l=t.androidConfig,_=P(a||{});if(_.code!==c.SUCCESS)return _;var s=y(l||{});return s.code!==c.SUCCESS?s:{code:c.SUCCESS}},P=function(t){var r=t||{},i=r.threadId,n=r.richMediaUri;return i&&!e.isString(i)?{code:c.PARAM_ERROR,errorMsg:"iOSConfig.threadId type is string"}:n&&!e.isString(n)?{code:c.PARAM_ERROR,errorMsg:"iOSConfig.richMediaUri type is string"}:{code:c.SUCCESS}},y=function(t){var r=["channelIdMi","channelIdHW","categoryHW","importanceHW","imageUrlHW","channelIdOPPO","typeVivo","categoryVivo","fcmChannelId","fcmCollapseKey","fcmImageUrl","importanceHonor","imageUrlHonor"],i=Object.keys(t).every(function(e){return r.includes(e)});if(!i)return{code:c.PARAM_ERROR,errorMsg:"right key: ".concat(r.join(","))};for(var n=0;n<r.length;n++){var o=r[n];if("importanceHW"===o||"importanceHonor"===o){if(t[o]&&"LOW"!==t[o]&&"NORMAL"!==t[o])return{code:c.PARAM_ERROR,errorMsg:"androidConfig.".concat(o," value is NORMAL|LOW")}}else if(t[o]&&!e.isString(t[o]))return{code:c.PARAM_ERROR,errorMsg:"androidConfig.".concat(o," type is string")}}return{code:c.SUCCESS}},U=function(e,t){void 0===t&&(t="utf-8");return"utf-16"===t?M(e):D(e)},M=function(e){for(var t=0,r=0,i=e.length;r<i;r++)t+=e.charCodeAt(r)<=65535?2:4;return t},D=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},w=/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"}(I||(I={}));var j,G,V,x,H=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,o,a,l){var _=+new Date,s=i?{mediaType:i.getMediaType(),callType:i.getCallType(),callId:i.getCallId()}:l,c={cr:"unknown",net:"unknown",cod:t,mtp:s.mediaType,ctp:s.callType,cid:s.callId,time:_,uid:this._context.getCurrentId()};o&&Object.assign(c,{ccid:o});var u=null;switch(e){case I.L_QS_RECEIVE_CALL_S:u=n(n({},c),{rf:a});break;case I.L_QS_ABNORMAL_HANGUP_S:u=n({},c);break;default:u=n(n({},c),{dur:_-r})}this._logger.__statistics(e,JSON.stringify(u))}}),e}();!function(e){e.REQUEST="request",e.ACCEPT="accept",e.REFUSE="refuse",e.CANCEL="cancel",e.NOTICE="notice",e.TIMEOUT="timeout"}(j||(j={})),function(e){e[e.SWITCH_MEDIA_TYPE=1]="SWITCH_MEDIA_TYPE"}(G||(G={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.SECRET=1]="SECRET"}(V||(V={})),function(e){e.INVITER="inviter",e.INVITEE="invitee"}(x||(x={}));var k,B=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:l}),Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:_}),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 i(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,l=r._callUsers.findIndex(function(e){return e.userId===a});if(l<0)return r._callUsers.push(e),void i.push(e);var _,s,c,u,C=r._callUsers[l],d=C.stateTime,L=C.systemState,E=C.userState,T=(_=L,s=o,c=!1,u=[exports.RCCallPlusReason.INVITED,exports.RCCallPlusReason.RINGING,exports.RCCallPlusReason.BUSYLINE_RINGING,exports.RCCallPlusReason.BUSYLINE_WAIT,exports.RCCallPlusReason.CONNECTING,exports.RCCallPlusReason.ONCALL],_===exports.RCCallPlusReason.ONCALL&&u.includes(s)&&(c=!0),c),S=function(e,t){var r=!1,i=[exports.RCCallPlusSessionUserState.INVITED,exports.RCCallPlusSessionUserState.RINGING,exports.RCCallPlusSessionUserState.BUSYLINE_RINGING,exports.RCCallPlusSessionUserState.BUSYLINE_WAIT,exports.RCCallPlusSessionUserState.CONNECTING,exports.RCCallPlusSessionUserState.ONCALL];return e===exports.RCCallPlusSessionUserState.ONCALL&&i.includes(t)&&(r=!0),r}(E,t),g=o===exports.RCCallPlusReason.ON_PHONE_END&&L!==exports.RCCallPlusReason.ON_PHONE&&t!==exports.RCCallPlusSessionUserState.IDLE;n&&d&&n<d||T&&S||(r._callUsers[l]=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===x.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}(e.EventEmitter);!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"}(k||(k={}));var F,Y,J,W=function(e,t){return setTimeout(e,t)},K=[e.ErrorCode.RC_NET_CHANNEL_INVALID,e.ErrorCode.RC_NET_UNAVAILABLE,e.ErrorCode.RC_MSG_RESP_TIMEOUT,t.RCRTCCode.SIGNAL_DISCONNECTED,t.RCRTCCode.REQUEST_FAILED],Q=function(e){var t=e.asyncFn,r=e.fnArgs,i=e.currentRetryTime,n=void 0===i?Date.now():i,s=e.maxDuration,u=void 0===s?6e4:s,C=e.intervals,d=void 0===C?[2e3,4e3,8e3,16e3,32e3,64e3]:C,L=e.index,E=void 0===L?0:L,T=e.onError;return o(void 0,void 0,void 0,function(){var e;return a(this,function(i){switch(i.label){case 0:return[4,t.apply(void 0,_([],l(r),!1))];case 1:return e=i.sent(),e.code===c.SUCCESS||!K.includes(e.code)||Date.now()+2e3-n>u?[3,3]:(T&&T(e.code),[4,(o=2e3,new Promise(function(e){setTimeout(e,o)}))]);case 2:return i.sent(),[2,Q({asyncFn:t,fnArgs:r,currentRetryTime:n,maxDuration:u,intervals:d,index:E,onError:T})];case 3:return[2,e]}var o})})};!function(e){e.onBeforePublish="onBeforePublish",e.onPublishRes="onPublishRes",e.onPubInviteCall="onPubInviteCall",e.onPubInviteCallPullKv="onPubInviteCallPullKv",e.onPubInviteCallMiss="onPubInviteCallMiss"}(F||(F={})),function(e){e.NOT_CURRENT_DEVICEID="not current device id",e.SECRET_CALL="secret call",e.NOT_INVITEE="not an invitee"}(Y||(Y={})),function(e){e.PUB_INVITE="pubinvitecall",e.PULL_KV_INVITE="pullkv_invitecall",e.PUSH="system_pubsh"}(J||(J={}));var q,X,z=131072,Z="RC:CallPlusMiss",$="RC:CallGroupStatusMsg",ee=function(t){function r(r,i,n,o,a,l){var _=t.call(this)||this;return Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_timeCorrectioner",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_needRetryActions",{enumerable:!0,configurable:!0,writable:!0,value:[k.START_SINGLE_CALL,k.START_GROUP_CALL,k.ACCEPT_CALL,k.JOIN_CALL,k.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=e.getUUID22(),_}return i(r,t),Object.defineProperty(r.prototype,"_onMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!![Z,$].includes(e.messageType)&&(e.messageType===Z?this._dealMissMessage(e):this._dealGroupCallMessage(e),!0)}}),Object.defineProperty(r.prototype,"_dealMissMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=t.content,i=r.callId,n=r.mediaType,o=r.startTime,a=r.callSessionUsers,l=t.targetId,_=t.senderUserId,c=this._context.getCurrentId();if(!localStorage.getItem("missMessageMap-".concat(c,"-").concat(i))){var u={callId:i,callerUserId:_,targetId:l,mediaType:n,firstFrameTime:0,callStartTime:o-this._timeCorrectioner.getLocalDelayTime(),callEndTime:0,hangupReason:a.filter(function(e){return e.userId===c})[0].sessionStatus};this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_MISS_MESSAGE_O,"receive miss message: ".concat(JSON.stringify(t)));var C=Object.assign(t,{content:u,sentStatus:e.SentStatus.SENT});this._reportAppEventModule.onReceivedCallPlusSummaryMessage(C),localStorage.setItem("missMessageMap-".concat(c,"-").concat(i),i)}}}),Object.defineProperty(r.prototype,"_dealGroupCallMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportAppEventModule.onReceivedGroupCallStatusMessage(e)}}),Object.defineProperty(r.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(r.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return w?this._context.getDeviceId():this._sessionId}}),Object.defineProperty(r.prototype,"registerListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,c,u,C,d,L;return a(this,function(a){return r=e.clientCallId,i=e.callType,n=e.toUsers,o=e.mediaType,l=e.secretChat,_=e.targetType,s=e.targetId,c=e.nickName,u=e.oldRoomId,C=e.pushExt,d=e.pushContent,L=e.extra,i===exports.RCCallPlusType.SINGLE?[2,this.startSingleCall({clientCallId:r,toUserId:n[0].userId,mediaType:o,secretChat:l,targetType:_,targetId:s,oldRoomId:u,toOrgId:n[0].orgId||"",pushExt:C,pushContent:d,extra:L},t)]:[2,this.startGroupCall({clientCallId:r,toUsers:n,mediaType:o,targetType:_,targetId:s,nickName:c,oldRoomId:u,pushExt:C,pushContent:d,extra:L},t)]})})}}),Object.defineProperty(r.prototype,"startSingleCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_SINGLE_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),k.START_SINGLE_CALL,e)]})})}}),Object.defineProperty(r.prototype,"startGroupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GROUP_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),k.START_GROUP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"inviteCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_INVITE_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.INVITE_CALL,e)]})})}}),Object.defineProperty(r.prototype,"ringingCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_RING_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.RINGING_CALL,e)]})})}}),Object.defineProperty(r.prototype,"acceptCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_ACCEPT_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.ACCEPT_CALL,e)]})})}}),Object.defineProperty(r.prototype,"joinCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_JOIN_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.JOIN_CALL,e)]})})}}),Object.defineProperty(r.prototype,"hangupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return this._logger.info(s.L_SIGNAL_TRANSPORTER_HANGUP_T,"params: ".concat(JSON.stringify(e)),t),[4,this._sendCallSignal(e.callId,k.HANGUP_CALL,e)];case 1:return(r=i.sent().code)===c.NOT_IN_CALL?[2,{code:c.SUCCESS}]:[2,{code:r}]}})})}}),Object.defineProperty(r.prototype,"statusUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_STATUS_UP_T,"call status up params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.STATUS_UP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"eventUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_EVENT_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.EVENT_UP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"dialogUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_DIALOG_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.DIALOG_UP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"deleteCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return o(this,void 0,void 0,function(){return a(this,function(i){return this._logger.info(s.L_SIGNAL_TRANSPORTER_DELETE_CALL_RECORD_T,"callIds: ".concat(JSON.stringify(t)),r),[2,this._sendCallSignal(e,k.DEL_CALL_LOG,{callIds:t})]})})}}),Object.defineProperty(r.prototype,"syncCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_RECORD_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.userId,k.SYNC_CALL_LOG,e)]})})}}),Object.defineProperty(r.prototype,"queryUserHasCall",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e;return a(this,function(t){return e=this._context.getCurrentId(),[2,this._sendCallSignal(e,k.QRY_CALL_STATE,null)]})})}}),Object.defineProperty(r.prototype,"getCallServerTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_SERVER_TIME_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,k.QRY_SRV_TIMESTAMP,null)]})})}}),Object.defineProperty(r.prototype,"getCallTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_TIME_INFO_T,"callId: ".concat(e),t),[2,this._sendCallSignal(e,k.GET_CALL_TIME_INFO,{callId:e})]})})}}),Object.defineProperty(r.prototype,"getUserCallStateList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_AVAILABLE_CALL_LIST_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,k.GET_CALL_STATE_LIST,null)]})})}}),Object.defineProperty(r.prototype,"clearCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_CLEAR_CALL_RECORD_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,k.CLEAR_CALL_LOG,null)]})})}}),Object.defineProperty(r.prototype,"getCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_INFO_BY_CALLID_T,"callId: ".concat(e.callId),t),[2,this._sendCallSignal(e.callId,k.GET_CALL_SESSION,e)]})})}}),Object.defineProperty(r.prototype,"sysStatusUp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_USER_SYSTEM_STATE_UP_T,"opts: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.SYS_STATUS_UP,e)]})})}}),Object.defineProperty(r.prototype,"upCallLogReaded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),[2,this._sendCallSignal(t,k.UP_CALL_LOG_READED,e)]})})}}),Object.defineProperty(r.prototype,"endUserAbnormalCalls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){return a(this,function(t){return[2,this._sendCallSignal(this._context.getCurrentId(),k.END_ABNORMAL_CALL,e)]})})}}),Object.defineProperty(r.prototype,"_onIMConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this._logger.createTraceId();this._logger.info(s.L_SIGNAL_TRANSPORTER_IM_STATE_CHANGE_O,"state: ".concat(t),r),this._listener.onIMStateChange(t),t===e.RCConnectionStatus.CONNECTED?this._timeCorrectioner.start(r):this._timeCorrectioner.stop(r)}}),Object.defineProperty(r.prototype,"_sendCallSignal",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return o(this,void 0,void 0,function(){var o,l,_,s,u,C;return a(this,function(a){switch(a.label){case 0:return o="",i&&(o=w?JSON.stringify(i):JSON.stringify(n(n({},i),{sessionId:this._sessionId}))),this._needRetryActions.includes(r)?[4,Q({asyncFn:this._context.setCallInfo.bind(this._context),fnArgs:[t,r,o]})]:[3,2];case 1:return l=a.sent(),[3,4];case 2:return[4,this._context.setCallInfo(t,r,o)];case 3:l=a.sent(),a.label=4;case 4:return _=l.code,s=l.data,_!==e.ErrorCode.SUCCESS?[2,{code:_}]:(u=s.value,C=JSON.parse(u).data,[2,{code:c.SUCCESS,data:C}])}})})}}),Object.defineProperty(r.prototype,"_onRecvCallSignal",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=this._logger.createTraceId();this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_SIGNAL_DATA_O,"data: ".concat(e),r),JSON.parse(e).list.forEach(function(e){var i=e.key,n=JSON.parse(e.value);switch(i){case k.PUB_INVITE_CALL:t._onPubInviteCall(n,r,!0);break;case k.STATUS_DOWN_CALL:t._onStatusDownCall(n,r);break;case k.EVENT_DOWN_CALL:t._onEventDownCall(n,r);break;case k.DIALOG_DOWN_CALL:t._onDialogDownCall(n,r);break;case k.PUB_CALL_LOG:t._onPubCallLog(n,r);break;case k.PUB_CALL_LOG_READED:case k.PUB_NACK_SEQ_ID:break;default:t._onConpensationData(n,r)}})}}),Object.defineProperty(r.prototype,"isValidData",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.isNull(t))return!0;var r=t===this.getDeviceId();return!(!e.isString(t)||0!==(null==t?void 0:t.length)&&!r)}}),Object.defineProperty(r.prototype,"_onPubInviteCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){void 0===r&&(r=!0);try{var i=this._context.getCurrentId(),n=e.callSessionUsers.find(function(e){return e.userId===i}),o=this._context.getConnectionStatus();this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"currentUser: ".concat(JSON.stringify(n),", currentUserId: ").concat(i,", state: ").concat(o),t)}catch(e){this._logger.error(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"error: ".concat(e.message),t)}if(this.isValidData(e.toDeviceId||""))this._listener.onInvite(e,r,t),r?this.emit(F.onPubInviteCall,Object.assign(e,{extra:JSON.stringify(e)})):this.emit(F.onPubInviteCallPullKv,Object.assign(e,{extra:JSON.stringify(e)}));else{this._logger.warn(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"not current deviceId -> deviceInfo: ".concat(JSON.stringify({toDeviceId:e.toDeviceId,clientDeviceId:this._sessionId})),t);var a={extra:JSON.stringify(e),reason:Y.NOT_CURRENT_DEVICEID,refer:r?J.PUB_INVITE:J.PULL_KV_INVITE};this.emit(F.onPubInviteCallMiss,Object.assign(e,a))}}}),Object.defineProperty(r.prototype,"_onStatusDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e.callSessionUsers=e.callSessionUsers.filter(function(e){return Boolean(e.changed)}),this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O,"",t),!this.isValidData(e.toDeviceId||""))return this._logger.warn(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O,"not current deviceId -> deviceInfo: ".concat(JSON.stringify({toDeviceId:e.toDeviceId,clientDeviceId:this._sessionId})),t),void this._listener.onOtherClientStatusDown(e,t);this._listener.onStatusDown(e,t,this._sessionId)}}),Object.defineProperty(r.prototype,"_onEventDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._listener.onEventDown(e,t)}}),Object.defineProperty(r.prototype,"_onDialogDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.dialogType===G.SWITCH_MEDIA_TYPE&&this._listener.onSwitchMediaType(e,t)}}),Object.defineProperty(r.prototype,"_onPubCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALL_ENGINE_RECEIVE_CALL_RECORD_O,"call record: ".concat(JSON.stringify(e)),t),this._listener.onRecvCallEndLog(e,t)}}),Object.defineProperty(r.prototype,"_onConpensationData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._logger.info(s.L_CALL_ENGINE_RECEIVE_COMPLEMENTARY_DATA_O,"",t);var i=e.callId,n=e.callType,o=e.mediaType,a=e.secretChat,l=e.duration,_=e.callStatus,c=e.callingUserId,u=e.callSessionUsers,C=e.toDeviceId,d=e.callDialogEntitys,L=e.extra;u.some(function(e){return e.sessionStatus===exports.RCCallPlusSessionUserState.INVITED&&e.userId===r._context.getCurrentId()})?this._onPubInviteCall({callId:i,toDeviceId:C,callType:n,mediaType:o,inviteUserId:c,callingUserId:c,callSessionUsers:u,secretChat:a,extra:L},t,!0):this._onStatusDownCall({callId:i,toDeviceId:C,callStatus:_,duration:l,callSessionUsers:u},t),d.length>0&&d.forEach(function(e){return r._onDialogDownCall(e,t)},this)}}),r}(e.EventEmitter),te=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1,i=+e,n=[];do{var o=i%r;i=(i-o)/r,n.unshift(t[o])}while(i);return n.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},re=function(){function e(e,t){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_localStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._localStore=e.localStorage}return Object.defineProperty(e.prototype,"addAbnormallCallId",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}"),n=i[t];n?n.push(r):n=[r],i[t]=n,this._localStore.setItem(e._STORAGE_KEY,JSON.stringify(i))}catch(e){this._logger.error(s.L_ABNORMAL_ADD_CALL_ID_E,e.message),console.error(e)}}}),Object.defineProperty(e.prototype,"removeAbnormalCallIds",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}"),n=i[t];n&&((n=n.filter(function(e){return!r.includes(e)})).length>0?i[t]=n:delete i[t],this._localStore.setItem(e._STORAGE_KEY,JSON.stringify(i)))}catch(e){this._logger.error(s.L_ABNORMAL_REMOVE_CALL_IDS_E,e.message),console.error(e)}}}),Object.defineProperty(e.prototype,"getAbnormalCallIds",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=null;try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}")[t];i&&(r=i)}catch(e){this._logger.error(s.L_ABNORMAL_GET_CALL_IDS_E,e.message),console.error(e)}return Promise.resolve(r)}}),Object.defineProperty(e,"_STORAGE_KEY",{enumerable:!0,configurable:!0,writable:!0,value:"CallPlus_AbnormalCall"}),e}();!function(e){e[e.PROMPT=0]="PROMPT",e[e.CALL_DURATION=10]="CALL_DURATION",e[e.FIRST_FRAME=20]="FIRST_FRAME"}(q||(q={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.INVALID_RESPONSE_TIME=80170]="INVALID_RESPONSE_TIME",e[e.NONOPTIMAL_RES_TIME=80171]="NONOPTIMAL_RES_TIME"}(X||(X={}));var ie,ne,oe,ae=function(){function e(e,t,r){Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_singleCallDurationEv",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_RTT",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_validMinRTT",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"_validMaxRTT",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"_deltaTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_timerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_interval",{enumerable:!0,configurable:!0,writable:!0,value:2e3}),Object.defineProperty(this,"_maxRetryTimes",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(this,"_startTimes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_retryTimesInCall",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_maxRetryTimesInCall",{enumerable:!0,configurable:!0,writable:!0,value:3})}return Object.defineProperty(e.prototype,"getCallClientTimeByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_T,"callId: ".concat(e),t),!this._RTT||this._RTT>this._validMinRTT?[4,this._getDeltaTime(t)]:[3,2];case 1:a.sent(),a.label=2;case 2:return this._RTT>this._validMaxRTT&&this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(X.INVALID_RESPONSE_TIME),t),[4,this._callEngine.getCallTimeInfo(e,t)];case 3:return r=a.sent(),i=r.code,n=r.data,i!==c.SUCCESS?(this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(i),t),[2,{code:i}]):(o=n.startTime,l=Math.floor(o-this._deltaTime),_=Date.now(),(u=(_+this._deltaTime-o)/1e3)<0&&(this._logger.warn(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_P,"invalid duration: ".concat(u),t),u=0),u=Math.floor(u),this._RTT>this._validMinRTT&&this._RTT<=this._validMaxRTT&&this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(X.NONOPTIMAL_RES_TIME),t),this._logger.info(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime,serverStartTime:o,clientStartTime:l,duration:u}),t),[2,{code:i,duration:u,clientStartTime:o?l:o}])}})})}}),Object.defineProperty(e.prototype,"calcClientStartTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(this._logger.info(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_T,"callId: ".concat(e,", startTime: ").concat(t),r),this._RTT>this._validMaxRTT)return this._logger.error(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R,"code: ".concat(X.INVALID_RESPONSE_TIME),r),this._loopCorrectClientTime(e,r),{code:X.INVALID_RESPONSE_TIME};var i=Math.floor(t-this._deltaTime);return this._logger.info(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime,startT:t,clientStartTime:i}),r),this._RTT>this._validMinRTT&&(this._retryTimesInCall=0,this._loopCorrectClientTime(e,r)),{code:X.SUCCESS,clientStartTime:i}}}),Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._timerId||this._startTimes>=this._maxRetryTimes||(this._logger.info(s.L_TIME_CORRECT_START_O,"timerId: ".concat(this._timerId)),this._startTimes++,this._getDeltaTime(e),this._timerId=W(function(){t._timerId=null,t.start(e)},this._interval))}}),Object.defineProperty(e.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_TIME_CORRECT_STOP_O,"timerId: ".concat(this._timerId),e),this._timerId&&clearTimeout(this._timerId),this._timerId=null,this._startTimes=0}}),Object.defineProperty(e.prototype,"restart",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_TIME_CORRECT_RESTART_O,"legal rtt time, RTT: ".concat(this._RTT,", validMinRTT: ").concat(this._validMinRTT),e),this._RTT<this._validMinRTT||(this.stop(e),this.start(e))}}),Object.defineProperty(e.prototype,"getLocalDelayTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Math.round(this._deltaTime)}}),Object.defineProperty(e.prototype,"getRTT",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._RTT}}),Object.defineProperty(e.prototype,"_getDeltaTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o,l;return a(this,function(a){switch(a.label){case 0:return t=Date.now(),[4,this._callEngine.getCallServerTimestamp(e)];case 1:return r=a.sent(),i=r.code,n=r.data,o=Date.now(),i!==c.SUCCESS?[2,{code:i}]:(((l=o-t)<this._RTT||0===this._RTT)&&l<=this._validMaxRTT&&(this._RTT=l),l<this._validMinRTT&&this.stop(e),this._deltaTime=n-t-this._RTT/2,this._logger.info(s.L_TIME_CORRECT_SET_DELTA_TIME_O,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime}),e),[2,{code:i,delayTime:this._deltaTime}])}})})}}),Object.defineProperty(e.prototype,"_getDeltaTimeInCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u,C;return a(this,function(a){switch(a.label){case 0:return r=Date.now(),[4,this._callEngine.getCallTimeInfo(e,t)];case 1:return i=a.sent(),n=i.code,o=i.data,l=Date.now(),n!==c.SUCCESS?[2,{code:n}]:((_=l-r)<this._RTT&&(this._RTT=_),this._deltaTime=o.syncTime-r-this._RTT/2,this._logger.info(s.L_TIME_CORRECT_SET_DELTA_TIME_O,JSON.stringify({callId:e,rtt:this._RTT,deltaT:this._deltaTime}),t),u=Math.floor(o.startTime-this._deltaTime),C=Math.floor(o.firstFrametime-this._deltaTime),_<this._validMinRTT?[2,{code:X.SUCCESS,clientStartTime:u,clientFirstFrameTime:C}]:[2,{code:X.INVALID_RESPONSE_TIME,clientStartTime:u,clientFirstFrameTime:C}])}})})}}),Object.defineProperty(e.prototype,"_loopCorrectClientTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l=this;return a(this,function(a){switch(a.label){case 0:return this.stop(t),this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_T,"callId: ".concat(e),t),[4,this._getDeltaTimeInCall(e,t)];case 1:return r=a.sent(),i=r.code,n=r.clientStartTime,o=r.clientFirstFrameTime,i===X.SUCCESS?(this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R,"code: ".concat(c.SUCCESS),t),this._singleCallDurationEv(e,n,o,t),[2]):this._retryTimesInCall>this._maxRetryTimesInCall&&i===X.INVALID_RESPONSE_TIME?(this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R,"code: ".concat(X.INVALID_RESPONSE_TIME),t),this._singleCallDurationEv(e,n,o,t),[2]):(this._retryTimesInCall>this._maxRetryTimesInCall||(this._retryTimesInCall++,setTimeout(function(){l._loopCorrectClientTime(e,t)},this._interval)),[2])}})})}}),e}();!function(e){e[e.SOON_AFETER=0]="SOON_AFETER",e[e.CURRENT=1]="CURRENT"}(ie||(ie={})),function(e){e[e.PUB_INVITE_CALL=0]="PUB_INVITE_CALL",e[e.PULL_KV_INVITE_CALL=1]="PULL_KV_INVITE_CALL",e[e.SYSTEM_PUSH=2]="SYSTEM_PUSH"}(ne||(ne={})),function(e){e[e.OUT=-1]="OUT",e[e.GROUP=0]="GROUP",e[e.IN=1]="IN"}(oe||(oe={}));var le,_e=function(t){function r(e,r,i,n,o){var a=t.call(this)||this;return Object.defineProperty(a,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(a,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_mainSession",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_holdSessions",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_signalModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_abnormalModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_isUpFirstFrameTime",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_callStartMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(a,"_timeCorrectioner",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_clientCallId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(a,"_rtcModule",{enumerable:!0,configurable:!0,writable:!0,value:null}),a._timeCorrectioner=new ae(a,n,a._onRecvSinCallDuration.bind(a)),a._signalModule=new ee(e,r,i,a._timeCorrectioner,a._logger,a._reportAppEventModule),a._signalModule.registerListener({onInvite:a._onInvite.bind(a),onStatusDown:a._onStatusDown.bind(a),onOtherClientStatusDown:a._onOtherClientStatusDown.bind(a),onEventDown:a._onEventDown.bind(a),onSwitchMediaType:a._onSwitchMediaType.bind(a),onRecvCallEndLog:a._onRecvCallEndLog.bind(a),onIMStateChange:a._onIMStateChange.bind(a)}),a._abnormalModule=new re(r,n),a}return i(r,t),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,s,u,C,d,L,E,T,S,g,I,p,R,f,h,b,O,A,N=this;return a(this,function(a){switch(a.label){case 0:return r=this._context.getCurrentId(),i=e.callType,n=e.mediaType,o=e.toUsers,s=e.targetId,u=e.targetType,C=e.oldRoomId,d=e.pushConfig,L=e.extra,this._clientCallId=e.callId,E=d?m(d,this._clientCallId):"",[4,this._signalModule.startCall({clientCallId:this._clientCallId,callType:i,mediaType:n,toUsers:o,secretChat:V.NORMAL,targetType:u,targetId:s,oldRoomId:C,pushExt:E,pushContent:(null==d?void 0:d.pushContent)||"",extra:L},t)];case 1:return T=a.sent(),S=T.code,g=T.data,S!==c.SUCCESS?[2,{code:S}]:(p=(I=g).callId,R=I.busylineUsers,this._abnormalModule.addAbnormallCallId(r,p),this._mainSession=new B(p,exports.RCCallPlusCallState.INVITED,i,n,r,r,[],this._logger),i===exports.RCCallPlusType.SINGLE&&(f=this._startTimer(g.callId,exports.RCCallPlusSessionUserState.NO_ANSWER,t),this._mainSession.updateTimerId(x.INVITER,f)),h={userId:r,userState:exports.RCCallPlusSessionUserState.CALLING,systemState:exports.RCCallPlusReason.CALLING,targetType:u,targetId:s},b=o.map(function(e){var t=e.userId,r=e.targetType,i=e.targetId;return{userId:t,userState:exports.RCCallPlusSessionUserState.INVITED,systemState:exports.RCCallPlusReason.INVITED,targetType:r,targetId:i}}),O=[],R&&(O=R.map(function(e){var t=b.find(function(t){return t.userId===e.userId}),r=t.targetType,i=t.targetId;return{userId:e.userId,userState:e.sessionStatus,systemState:exports.RCCallPlusReason.BUSYLINE_RINGING,targetType:r,targetId:i}}),b=b.filter(function(e){var t=e.userId;return O.every(function(e){return e.userId!==t})})),A=this.updateUsersState(p,_(_([h],l(b),!1),l(O),!1),t),setTimeout(function(){A.length>0&&N.reportRemoteUserStateChange(p,A,t)}),[2,{code:S,data:g}])}})})}}),Object.defineProperty(r.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return o(this,void 0,void 0,function(){var i,n,o,s,u,C,d,L,E,T,S;return a(this,function(a){switch(a.label){case 0:return this._mainSession?(i=e.toUsers,n=e.pushConfig,o=e.extra,s=n?m(n,this._clientCallId):"",u=this._mainSession.getCallId(),[4,this._signalModule.inviteCall({callId:u,toUsers:i,pushExt:s,pushContent:(null==n?void 0:n.pushContent)||"",extra:o},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return C=a.sent(),d=C.code,L=C.data,d===c.SUCCESS&&(this._mainSession.getCallType()===exports.RCCallPlusType.SINGLE&&(this._mainSession.updateCallType(exports.RCCallPlusType.MULTI),this._onCallTypeChange(this._mainSession.getCallId(),exports.RCCallPlusType.MULTI,t)),E=i.map(function(e){var t=e.userId,r=e.targetType,i=e.targetId;return{userId:t,userState:exports.RCCallPlusSessionUserState.INVITED,systemState:exports.RCCallPlusReason.INVITED,targetType:r,targetId:i}}),T=[],L.busylineUsers&&(T=null===(r=L.busylineUsers)||void 0===r?void 0:r.map(function(e){var t=E.find(function(t){return t.userId===e.userId}),r=t.targetType,i=t.targetId;return{userId:e.userId,userState:e.sessionStatus,systemState:exports.RCCallPlusReason.BUSYLINE_RINGING,targetType:r,targetId:i}}),E=E.filter(function(e){var t=e.userId;return T.every(function(e){return e.userId!==t})})),(S=this.updateUsersState(u,_(_([],l(E),!1),l(T),!1),t)).length>0&&this.reportRemoteUserStateChange(u,S,t)),[2,{code:d,data:L}]}})})}}),Object.defineProperty(r.prototype,"clearAllTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;_([this._mainSession],l(this._holdSessions),!1).forEach(function(i){i&&i.getCallId()===e&&i.getAllTimerIds().forEach(function(e){return r._stopTimer.bind(r)(e,t)})})}}),Object.defineProperty(r.prototype,"hangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l;return a(this,function(a){switch(a.label){case 0:return r=e.callId,i=e.systemState,n=e.pushConfig,o=n?m(n,this._clientCallId):"",[4,this._signalModule.hangupCall({callId:r,sysStatus:i,pushExt:o,pushContent:(null==n?void 0:n.pushContent)||""},t)];case 1:return l=a.sent().code,this.endCurrentSession(e.systemState,r,t),[2,{code:l}]}})})}}),Object.defineProperty(r.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return this._mainSession?(r=e.callId,[4,this._signalModule.acceptCall({callId:r},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return i=n.sent().code,this._stopTimer(this._mainSession.getInviteeTimerId(),t),i!==c.SUCCESS?[2,{code:i}]:(this._clearMobileOnPhone(e.callId,t),this._mainSession.updateSessionState(exports.RCCallPlusCallState.CONNECTING),[2,{code:i}])}})})}}),Object.defineProperty(r.prototype,"joinCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._context.getCurrentId(),this._mainSession&&this._stopTimer(this._mainSession.getInviteeTimerId(),t),[4,this._signalModule.joinCall({callId:e.callId},t)];case 1:return(i=n.sent().code)!==c.SUCCESS?[2,{code:i}]:(this._abnormalModule.addAbnormallCallId(r,e.callId),this._mainSession?[3,3]:[4,this._createSessionByServer(e.callId,t,!0)]);case 2:return n.sent(),[3,4];case 3:this._clearMobileOnPhone(e.callId,t),n.label=4;case 4:return[2,{code:i}]}})})}}),Object.defineProperty(r.prototype,"requestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n;return a(this,function(o){switch(o.label){case 0:return this._mainSession?(r={mediaType:e.mediaType},this._mainSession.updateReqMediaType(e.mediaType),i=te(),[4,this._signalModule.dialogUpCall({transactionId:i,callId:this._mainSession.getCallId(),toUserIds:e.toUserIds,dialogType:G.SWITCH_MEDIA_TYPE,action:j.REQUEST,extraKeyVal:r},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return(n=o.sent().code)!==c.SUCCESS?[2,{code:n}]:[2,{code:c.SUCCESS,data:{transactionId:i}}]}})})}}),Object.defineProperty(r.prototype,"responseChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._mainSession?[2,this._signalModule.dialogUpCall({transactionId:e.transactionId,callId:this._mainSession.getCallId(),dialogType:G.SWITCH_MEDIA_TYPE,action:e.agree?j.ACCEPT:j.REFUSE},t)]:[2,{code:c.NOT_IN_CALL}]})})}}),Object.defineProperty(r.prototype,"cancelChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._mainSession?[2,this._signalModule.dialogUpCall({transactionId:e.transactionId,callId:this._mainSession.getCallId(),dialogType:G.SWITCH_MEDIA_TYPE,action:j.CANCEL},t)]:[2,{code:c.NOT_IN_CALL}]})})}}),Object.defineProperty(r.prototype,"getCallLogList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,u;return a(this,function(a){switch(a.label){case 0:return r=this._context.getCurrentId(),i=e.timestamp,n=e.count,o=e.order,[4,this._signalModule.syncCallLog({userId:r,syncTime:i,count:n,order:o},t)];case 1:return l=a.sent(),_=l.code,s=l.data,_!==c.SUCCESS?[2,{code:_}]:(u=s.callLogList.map(function(e){return f(e)}),[2,{code:c.SUCCESS,data:{hasMore:Boolean(null==s?void 0:s.hasMore),syncTime:0===o?s.maxTime:s.minTime,list:u}}])}})})}}),Object.defineProperty(r.prototype,"deleteCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r;return a(this,function(i){return r=this._context.getCurrentId(),[2,this._signalModule.deleteCallRecord(r,e,t)]})})}}),Object.defineProperty(r.prototype,"getCallServerTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i;return a(this,function(n){switch(n.label){case 0:return[4,this._signalModule.getCallServerTimestamp(e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?[2,{code:r}]:[2,{code:r,data:i.syncTime}]}})})}}),Object.defineProperty(r.prototype,"getCallTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return[2,this._signalModule.getCallTimeInfo(e,t)]})})}}),Object.defineProperty(r.prototype,"getOpenCallList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o,l=this;return a(this,function(a){switch(a.label){case 0:return t=this._context.getCurrentId(),[4,this._signalModule.getUserCallStateList(e)];case 1:return r=a.sent(),i=r.code,n=r.data,i!==c.SUCCESS?[2,{code:i}]:(o=n.callStateList.map(function(r){var i=r.callId,n=r.callType,o=r.mediaType,a=r.callingUserId,_=r.callUserIds,s=r.callStatus,c=r.crtTime,u=r.userSessionStatus,C=r.startTime,d=r.syncTime,L=a===t?oe.OUT:oe.IN,E=l._timeCorrectioner.calcClientStartTime(i,C,e).clientStartTime,T=void 0===E?C:E;return{callId:i,callType:n,callDirection:L,mediaType:o,callerUserId:a,callUserIds:_,sessionState:s,userState:u,startTimestamp:C,endTimestamp:0,duration:Math.floor((+new Date-T)/1e3),syncTimestamp:d,systemState:0,createTimestamp:c}}),[2,{code:i,data:o}])}})})}}),Object.defineProperty(r.prototype,"removeAllCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return[4,this._signalModule.clearCallRecord(e)];case 1:return[2,{code:t.sent().code}]}})})}}),Object.defineProperty(r.prototype,"getCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,u,C,d,L,E,T,S;return a(this,function(a){switch(a.label){case 0:return[4,this._signalModule.getCallSession(e,t)];case 1:return r=a.sent(),i=r.code,n=r.data,i!==c.SUCCESS?[2,{code:i}]:(l=(o=n).callId,_=o.callingUserId,s=o.callType,u=o.mediaType,C=o.callStatus,d=o.callSessionUsers,L=o.startTime,E=o.duration,T=o.syncTime,S=d.map(function(e){return{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,targetType:e.targetType,targetId:e.targetId,cameraEnable:!1,microphoneEnable:!1}}),[2,{code:i,data:{callId:l,startCallerId:_,callType:s,mediaType:u,sessionState:C,callSessionUsers:S,startTime:L,duration:E,syncTime:T}}])}})})}}),Object.defineProperty(r.prototype,"getHoldSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._holdSessions.find(function(t){return t&&t.getCallId()===e});return t?new g(t,this,this._logger,this._rtcModule,this._context):null}}),Object.defineProperty(r.prototype,"getLocalMainSession",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mainSession?new g(this._mainSession,this,this._logger,this._rtcModule,this._context):null}}),Object.defineProperty(r.prototype,"updateMainSessionState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._mainSession)||void 0===t||t.updateSessionState(e)}}),Object.defineProperty(r.prototype,"setIsLocalClientHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._mainSession)||void 0===t||t.setIsLocalClientHangup(e)}}),Object.defineProperty(r.prototype,"updateUsersState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALL_ENGINE_UPDATE_USERS_STATE_O,"updateUsersState -> users: ".concat(JSON.stringify(t)),r);var i=_([this._mainSession],l(this._holdSessions),!1).find(function(t){return(null==t?void 0:t.getCallId())===e}),n=[];return i?n.push.apply(n,_([],l(i.updateUserList(t,r)),!1)):n.push.apply(n,_([],l(t),!1)),n}}),Object.defineProperty(r.prototype,"getCallStaringTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return[2,this._timeCorrectioner.getCallClientTimeByServer(e.callId,t)]})})}}),Object.defineProperty(r.prototype,"systemStatusUp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return[2,this._signalModule.sysStatusUp(e,t)]})})}}),Object.defineProperty(r.prototype,"upFirstFrameTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return!this._mainSession||this._mainSession&&this._mainSession.getCallType()!==exports.RCCallPlusType.SINGLE||this._isUpFirstFrameTime?[2,{code:c.SUCCESS}]:(t=Date.now(),r=this._timeCorrectioner.getLocalDelayTime(),i=Math.floor(t+r),this._logger.info(s.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_T,"now: ".concat(t,"; delay: ").concat(r,"; streamReadyTime: ").concat(i),e),this._isUpFirstFrameTime=!0,n=this._mainSession.getCallId(),[4,this._signalModule.eventUpCall({callId:n,eventType:q.FIRST_FRAME,eventArgs:{streamReadyTime:i},eventTime:Date.now()},e)]);case 1:return o=a.sent().code,this._logger.info(s.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_R,"code: ".concat(o),e),[2,{code:o}]}})})}}),Object.defineProperty(r.prototype,"endCurrentSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,n=this._context.getCurrentId();if(this._mainSession&&this._mainSession.getCallId()===t){var o=this._mainSession.getUserList().map(function(t){var r=t.userId,o=t.systemState,a=t.targetType,l=t.targetId;return r===n&&(o=e),{userId:r,sessionStatus:exports.RCCallPlusSessionUserState.ENDED,statusTime:Date.now(),duration:0,changed:1,inviteUserId:i._mainSession.getStartCallerId(),sysStatus:o,targetType:a,targetId:l}}),a={callId:this._mainSession.getCallId(),toDeviceId:this._signalModule.getDeviceId(),callStatus:exports.RCCallPlusCallState.ENDED,duration:0,callSessionUsers:o};this._onStatusDown(a,r)}}}),Object.defineProperty(r.prototype,"startTimeCorrection",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._timeCorrectioner.restart(e)}}),Object.defineProperty(r.prototype,"getDelayTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{delayTime:this._timeCorrectioner.getLocalDelayTime(),rtt:this._timeCorrectioner.getRTT()}}}),Object.defineProperty(r.prototype,"upgradeMainSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=this._holdSessions.findIndex(function(t){return t.getCallId()===e});this._mainSession=null===(t=this._holdSessions.splice(r,1))||void 0===t?void 0:t[0]}}),Object.defineProperty(r.prototype,"endCurrentUserAbnormalCalls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o=this;return a(this,function(a){switch(a.label){case 0:return t=this._context.getCurrentId(),[4,this._abnormalModule.getAbnormalCallIds(t)];case 1:return(r=a.sent())?(i=r.filter(function(e){var t;return e!==(null===(t=o._mainSession)||void 0===t?void 0:t.getCallId())}),[4,this._signalModule.endUserAbnormalCalls({callIds:i,allDevice:e?1:0})]):[2,{code:c.SUCCESS}];case 2:return(n=a.sent().code)===c.SUCCESS&&this._abnormalModule.removeAbnormalCallIds(t,i),[2,{code:n}]}})})}}),Object.defineProperty(r.prototype,"setRTCModule",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._rtcModule=e}}),Object.defineProperty(r.prototype,"_onIMStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this,i=this._logger.createTraceId(),n=0;t===e.RCConnectionStatus.DISCONNECTED&&this._mainSession&&this._mainSession.getSessionState()!==exports.RCCallPlusCallState.ONCALL&&(n=W(function(){var e;r._logger.info(s.L_CALL_ENGINE_IM_STATE_CHANGE_O,"endCurrentSession, IM disconnected for more than 60s",i),r.endCurrentSession(exports.RCCallPlusReason.CONNECTION_ERR,null===(e=r._mainSession)||void 0===e?void 0:e.getCallId(),i)},6e4)),t===e.RCConnectionStatus.CONNECTED&&(n&&clearTimeout(n),this._initOpts.isAllowNewCallWhenRinging&&this.endCurrentUserAbnormalCalls(!0))}}),Object.defineProperty(r.prototype,"_handleCallTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(s.L_CALL_ENGINE_CALL_TIMEOUT_O,"call timeout callId: ".concat(e,", userState: ").concat(t),r);var i=_([this._mainSession],l(this._holdSessions),!1).find(function(t){return t&&t.getCallId()===e});if(i){var n=this._context.getCurrentId();this._onStatusDown({callId:e,toDeviceId:this._signalModule.getDeviceId(),callStatus:exports.RCCallPlusCallState.ENDED,duration:0,callSessionUsers:i.getUserList().map(function(e){var r,o,a=e.userId,l=e.targetType,_=e.targetId,s=e.stateTime;return a===n?(r=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusReason.MISSED:exports.RCCallPlusReason.NO_ANSWER,o=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusSessionUserState.MISSED:exports.RCCallPlusSessionUserState.NO_ANSWER):(r=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusReason.NO_ANSWER:exports.RCCallPlusReason.MISSED,o=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusSessionUserState.NO_ANSWER:exports.RCCallPlusSessionUserState.MISSED),{userId:a,sessionStatus:o,statusTime:s?s+1:Date.now(),duration:0,changed:1,inviteUserId:i.getCallerId(),sysStatus:r,targetType:l,targetId:_}})},r)}else this._logger.warn(s.L_CALL_ENGINE_CALL_TIMEOUT_O,"handleCallTimeout without session, callId: ".concat(e),r)}}),Object.defineProperty(r.prototype,"_startTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,n=W(function(){i._handleCallTimeout(e,t,r),i._signalModule.statusUpCall({callId:e,sessionStatus:t},r)},6e4);return this._logger.info(s.L_CALL_ENGINE_START_CALL_TIMER_O,"callId: ".concat(e,", timerId: ").concat(n),r),n}}),Object.defineProperty(r.prototype,"_stopTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){clearTimeout(e),this._logger.info(s.L_CALL_ENGINE_STOP_CALL_TIMER_O,"timerId: ".concat(e),t)}}),Object.defineProperty(r.prototype,"_onInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._clientCallId=e.getUUID();var n=this._context.getCurrentId(),o=t.callSessionUsers,a=t.secretChat,l=t.extra,_=void 0===l?"{}":l;a!==V.SECRET?(o.some(function(e){return e.userId===n})&&this._selfIsInviteeHandle(t,r,i,_),this._othersIsInviteeHandle(t,i)):this.emit(F.onPubInviteCallMiss,Object.assign(t,{extra:JSON.stringify(t),reason:Y.SECRET_CALL,refer:r?J.PUB_INVITE:J.PULL_KV_INVITE}))}}),Object.defineProperty(r.prototype,"_selfIsInviteeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,n){var o=e.callId,a=e.inviteUserId,l=e.callType,_=e.mediaType,s=e.callSessionUsers,c=this._context.getCurrentId();this._abnormalModule.addAbnormallCallId(c,o);var u=new B(o,exports.RCCallPlusCallState.RINGING,l,_,a,a,[],this._logger);this._signalModule.ringingCall({callId:o},i);var C=this._startTimer(o,exports.RCCallPlusSessionUserState.MISSED,i);u.updateTimerId(x.INVITEE,C),this._mainSession?(this._holdSessions.push(u),this._mainSession.updateSessionState(exports.RCCallPlusCallState.BUSYLINE_WAIT)):this._mainSession=u;var d=new g(u,this,this._logger,this._rtcModule,this._context),L=t?ne.PUB_INVITE_CALL:ne.PULL_KV_INVITE_CALL;this.emit(r.__INNER_INVITE__,d,L);var E=s.map(function(e){return{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,targetType:e.targetType,targetId:e.targetId,stateTime:e.statusTime}}),T=this.updateUsersState(o,E,i);this._reportAppEventModule.onReceivedCall(d,i,JSON.parse(n||"{}").extra),T.length>0&&this.reportRemoteUserStateChange(o,T,i)}}),Object.defineProperty(r.prototype,"_othersIsInviteeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,o=e.callId,a=e.inviteUserId,l=e.callSessionUsers,_=this._context.getCurrentId(),s=l.filter(function(e){return e.userId!==_&&e.userId!==a&&e.sessionStatus===exports.RCCallPlusSessionUserState.INVITED});if(s.length){(null===(r=this._mainSession)||void 0===r?void 0:r.getCallType())===exports.RCCallPlusType.SINGLE&&(null===(i=this._mainSession)||void 0===i?void 0:i.getCallId())===o&&(this._onCallTypeChange(this._mainSession.getCallId(),exports.RCCallPlusType.MULTI,t),null===(n=this._mainSession)||void 0===n||n.updateCallType(exports.RCCallPlusType.MULTI));var c=[],u=[];s.forEach(function(e){var t=e.userId,r=e.sessionStatus,i=e.sysStatus;c.push({callId:o,userId:t,userState:r}),u.push({userId:t,userState:r,systemState:i})}),this._onOtherMemberInvite(c);var C=this.updateUsersState(o,u,t);C.length>0&&this.reportRemoteUserStateChange(o,C,t)}}}),Object.defineProperty(r.prototype,"_onHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this;this._mainSession&&e.forEach(function(e){e.callId===i._mainSession.getCallId()&&(e.userState===exports.RCCallPlusSessionUserState.CANCELLED?i._stopTimer(i._mainSession.getInviteeTimerId(),r):i._stopTimer(i._mainSession.getInviterTimerId(),r))})}}),Object.defineProperty(r.prototype,"_onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,n,o,a,l=null===(i=this._mainSession)||void 0===i?void 0:i.getSessionState(),_=[exports.RCCallPlusCallState.CONNECTING,exports.RCCallPlusCallState.ONCALL,exports.RCCallPlusCallState.BUSYLINE_WAIT];if((null===(n=this._mainSession)||void 0===n?void 0:n.getCallType())!==exports.RCCallPlusType.SINGLE||!l||!_.includes(l)){var s=this._mainSession.getStartCallerId(),c=this._context.getCurrentId();if((null===(o=this._mainSession)||void 0===o?void 0:o.getCallType())===exports.RCCallPlusType.SINGLE&&s===c)e.filter(function(e){return e.fromUserId!==c})&&this.emit(r.__INNER_SESSION_CONNECT__,this.getLocalMainSession().getCallId(),t);null===(a=this._mainSession)||void 0===a||a.updateSessionState(exports.RCCallPlusCallState.CONNECTING),this._stopTimer(this._mainSession.getInviterTimerId(),t)}}}),Object.defineProperty(r.prototype,"_onStatusDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i;return o(this,void 0,void 0,function(){var n,o,l,_,s,c,u,C,d,L,E,T,S,g;return a(this,function(a){return n=e.callStatus,o=e.startTime,(l=e.callId)!==(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())?[2]:(this._callStartMap[l]=this._callStartMap[l]||{},this._callStartMap[l].isReceiveCallStartTime||n!==exports.RCCallPlusCallState.ONCALL||(this._callStartMap[l].isReceiveCallStartTime=!0,_=this._timeCorrectioner.calcClientStartTime(l,o,t),s=_.code,c=_.clientStartTime,s===X.SUCCESS&&(this._callStartMap[l].callStartTime=c,this._reportAppEventModule.onReceivedCallStartTime({callId:l,callStartTime:c},t))),u=!1,C=this._context.getCurrentId(),(d=e.callSessionUsers.map(function(e){return[exports.RCCallPlusSessionUserState.IDLE,exports.RCCallPlusSessionUserState.DECLINED,exports.RCCallPlusSessionUserState.MISSED,exports.RCCallPlusSessionUserState.NO_ANSWER,exports.RCCallPlusSessionUserState.CANCELLED].includes(e.sessionStatus)&&e.sysStatus!==exports.RCCallPlusReason.CANCELLED&&e.userId===C&&(u=!0),{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,stateTime:e.statusTime}})).length&&(L=this.updateUsersState(l,d,t)).length>0&&this.reportRemoteUserStateChange(l,L,t),this._mainSession||this._holdSessions.length?(E=function(e){var t=e.callId,r=[],i=[],n=[],o=[];return e.callSessionUsers.forEach(function(e){var a=e.userId,l=e.sessionStatus,_=e.sysStatus;switch(l){case exports.RCCallPlusSessionUserState.INVITED:o.push({callId:t,userId:a,userState:l});break;case exports.RCCallPlusSessionUserState.RINGING:r.push({callId:t,fromUserId:a});break;case exports.RCCallPlusSessionUserState.CONNECTING:n.push({fromUserId:a});break;case exports.RCCallPlusSessionUserState.CANCELLED:case exports.RCCallPlusSessionUserState.DECLINED:case exports.RCCallPlusSessionUserState.ENDED:case exports.RCCallPlusSessionUserState.IDLE:i.push({callId:t,fromUserId:a,userState:l,systemState:_})}}),{ringingData:r,hangupData:i,acceptData:n,otherInvitedData:o}}(e),T=E.hangupData,S=E.acceptData,g=E.otherInvitedData,T.length>0&&this._onHangup(T,e.callStatus,t),S.length>0&&this._onAccept(S,t),g.length>0&&(null===(i=this._mainSession)||void 0===i?void 0:i.getCallType())===exports.RCCallPlusType.MULTI&&this._onOtherMemberInvite(g),(e.callStatus===exports.RCCallPlusCallState.ENDED||u)&&this._onSessionClose(e,t,u),[2]):[2])})})}}),Object.defineProperty(r.prototype,"_onOtherClientStatusDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,o=e.callId,a=e.callSessionUsers,l=this._context.getCurrentId(),_=a.find(function(e){return e.userId===l});if(_&&(this._mainSession||this._holdSessions.length)){var s=_.userId,c=_.sessionStatus,u=_.statusTime;if(c===exports.RCCallPlusSessionUserState.CONNECTING){var C=[exports.RCCallPlusSessionUserState.ONCALL,exports.RCCallPlusSessionUserState.CONNECTING],d=(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())===o,L=null===(n=null===(i=this._mainSession)||void 0===i?void 0:i.getUserList().find(function(e){return e.userId===l}))||void 0===n?void 0:n.userState;if(!(d&&L&&C.includes(L))){var E=this.updateUsersState(o,[{userId:s,userState:c,systemState:exports.RCCallPlusReason.OTHER_CLIENT_ACCEPT,stateTime:u}],t);E.length>0&&this.reportRemoteUserStateChange(o,E,t),this._onSessionClose(e,t,!1)}}}}}),Object.defineProperty(r.prototype,"_onEventDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return o(this,void 0,void 0,function(){var i,n,o,l,_,c,u;return a(this,function(a){return i=e.callId,n=e.eventArgs,o=e.eventType,i!==(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())||this._mainSession.getSessionState()!==exports.RCCallPlusCallState.ONCALL||o===q.CALL_DURATION&&(l=n.firstFrameTime,_=this._timeCorrectioner.calcClientStartTime(i,l,t),c=_.code,u=_.clientStartTime,this._logger.info(s.L_CALL_ENGINE_RECEIVE_FIRST_FRAME_TIME_O,"clientFirstFrameTime: ".concat(u),t),c===X.SUCCESS&&(this._callStartMap[i].firstFrameTime=u,this._reportAppEventModule.onReceivedCallFirstFrameTime(i,u,t))),[2]})})}}),Object.defineProperty(r.prototype,"_onRecvSinCallDuration",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var o;(null===(o=this._mainSession)||void 0===o?void 0:o.getCallId())===e&&(this._callStartMap[e].callStartTime=t,this._callStartMap[e].firstFrameTime=r,this._reportAppEventModule.onReceivedCallStartTime(n({callId:e},{callStartTime:t}),i),this._reportAppEventModule.onReceivedCallFirstFrameTime(e,r,i))}}),Object.defineProperty(r.prototype,"_onSwitchMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,o,a,l=e.callId,_=e.action,c=e.extraKeyVal,u=e.transactionId,C=e.promoterId,d=c.mediaType,L=c.reason,E=null===(r=this._mainSession)||void 0===r?void 0:r.getCallId();if(l===E){var T=(null===(i=this._mainSession)||void 0===i?void 0:i.getOldDialogData())||{},S=T.transactionId,g=T.action,I=T.mediaType;if(S!==u||g!==_||I!==d){if(this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"action: ".concat(_,", reason: ").concat(L),t),null===(n=this._mainSession)||void 0===n||n.setOldDialogData({transactionId:u,action:_,mediaType:d}),_===j.REQUEST)this._onRequestChangeMediaType({transactionId:u,userId:C,mediaType:d},t);else{var p=null;switch(L){case j.CANCEL:p=exports.RCCallPlusMediaTypeChangeResult.CANCEL_CHANGE_MEDIA_TYPE;break;case j.ACCEPT:p=exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE,null===(o=this._mainSession)||void 0===o||o.updateMediaType(this._mainSession.getReqMediaType()),null===(a=this._mainSession)||void 0===a||a.updateReqMediaType(null);break;case j.REFUSE:p=exports.RCCallPlusMediaTypeChangeResult.REFUSE_CHANGE_MEDIA_TYPE;break;case j.TIMEOUT:p=exports.RCCallPlusMediaTypeChangeResult.CHANGE_MEDIA_TYPE_TIMEOUT}exports.RCCallPlusMediaTypeChangeResult[p]&&this._receiveMediaTypeChangeResult({transactionId:u,userId:C,mediaType:d},p,t)}_!==j.NOTICE||d!==exports.RCCallPlusMediaType.AUDIO||L||this._receiveMediaTypeChangeResult({transactionId:u,userId:C,mediaType:d},exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE,t)}else this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"duplicate dialog data",t)}else this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"not current session callId: ".concat(E,", recvCallId: ").concat(l),t)}}),Object.defineProperty(r.prototype,"_onRecvCallEndLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=f(e);this._reportAppEventModule.onReceivedCallRecord(r,t)}}),Object.defineProperty(r.prototype,"_onSessionClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){var n=this,o=e.callId,a=this._context.getCurrentId();this._abnormalModule.removeAbnormalCallIds(a,[o]);var c=_([this._mainSession],l(this._holdSessions),!1).find(function(e){return e&&e.getCallId()===o});if(c){this._logger.warn(s.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O,"callId: ".concat(o),t),this.emit(r.__INNER_SESSION_CLOSE__,o,t);var u,C=c.getUserList().find(function(e){return e.userId===a});u=i&&e.toDeviceId!==this._signalModule.getDeviceId()?c.getIsLocalClientHangup()?C.systemState:exports.RCCallPlusReason.OTHER_CLIENT_HANGUP:C.systemState,this._reportAppEventModule.onCallEnded(new g(c,this,this._logger,this._rtcModule,this._context),u,t),this._reportCallPlusSummaryMessage(c,o,u),this._mainSession&&this._mainSession.getCallId()===o&&(this._mainSession.getAllTimerIds().forEach(function(e){return n._stopTimer.bind(n)(e,t)}),c.getCallType()===exports.RCCallPlusType.SINGLE&&(this._isUpFirstFrameTime=!1),delete this._callStartMap[o]),this._removeSession(o)}else this._logger.warn(s.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O,"unexpect session callId -> ".concat(o),t)}}),Object.defineProperty(r.prototype,"_reportCallPlusSummaryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n,o,a,l=this._context.getCurrentId(),_=t.getUserList().filter(function(e){return e.userId!==l})[0].userId,s=t.getStartCallerId();if(!localStorage.getItem("missMessageMap-".concat(l,"-").concat(r))){var c={callId:r,callerUserId:s,targetId:_,mediaType:t.getMediaType(),firstFrameTime:(null===(n=this._callStartMap[r])||void 0===n?void 0:n.firstFrameTime)||0,callStartTime:(null===(o=this._callStartMap[r])||void 0===o?void 0:o.callStartTime)||0,callEndTime:(null===(a=this._callStartMap[r])||void 0===a?void 0:a.callStartTime)?+new Date-this._timeCorrectioner.getLocalDelayTime():0,hangupReason:i};this._reportAppEventModule.onReceivedCallPlusSummaryMessage({messageType:"RC:CallPlusSummary",content:c,senderUserId:s,targetId:_,channelId:"",conversationType:e.ConversationType.PRIVATE,sentTime:+new Date-this._timeCorrectioner.getLocalDelayTime(),receivedTime:+new Date-this._timeCorrectioner.getLocalDelayTime(),messageUId:r,messageDirection:s===l?e.MessageDirection.SEND:e.MessageDirection.RECEIVE,isPersited:!0,isCounted:!1,isOffLineMessage:!1,canIncludeExpansion:!1,receivedStatus:e.ReceivedStatus.READ,isStatusMessage:!1,isMentioned:!1,expansion:null,disableNotification:!1,sentStatus:e.SentStatus.SENT}),localStorage.setItem("missMessageMap-".concat(l,"-").concat(r),r)}}}),Object.defineProperty(r.prototype,"_removeSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;if(e===(null===(t=this._mainSession)||void 0===t?void 0:t.getCallId()))this._mainSession=null;else{var r=this._holdSessions.findIndex(function(t){return(null==t?void 0:t.getCallId())===e});this._holdSessions.splice(r,1)}}}),Object.defineProperty(r.prototype,"_createSessionByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),o(this,void 0,void 0,function(){var i,n,o,l,_,u,C,d,L;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_T,"callId: ".concat(e),t),[4,this.getCallSession({callId:e},t)];case 1:return i=a.sent(),n=i.code,o=i.data,n!==c.SUCCESS?(this._logger.error(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R,"errcode: ".concat(n),t),[2]):(this._logger.info(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R,"code: ".concat(n,", data: ").concat(JSON.stringify(o)),t),_=(l=o).callType,u=l.mediaType,C=l.callSessionUsers,d=l.startCallerId,this._mainSession=new B(e,exports.RCCallPlusCallState.CONNECTING,_,u,d,d,[],this._logger),r&&this._clearMobileOnPhone(e,t),(L=this.updateUsersState(e,C,t)).length>0&&this.reportRemoteUserStateChange(e,L,t),[2])}})})}}),Object.defineProperty(r.prototype,"_clearMobileOnPhone",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return(r=_([this._mainSession],l(this._holdSessions),!1).find(function(t){return(null==t?void 0:t.getCallId())===e}))&&r.getCallType()===exports.RCCallPlusType.MULTI?(this._logger.info(s.L_CALL_ENGINE_UP_ON_PHONE_END_T,"callId: ".concat(e),t),[4,this.systemStatusUp({callId:e,sysStatus:exports.RCCallPlusReason.ON_PHONE_END,forward:ie.CURRENT},t)]):[3,2];case 1:(i=n.sent().code)===c.SUCCESS?this._logger.info(s.L_CALL_ENGINE_UP_ON_PHONE_END_R,"callId: ".concat(e),t):this._logger.warn(s.L_CALL_ENGINE_UP_ON_PHONE_END_R,"callId: ".concat(e,", errCode: ").concat(i),t),n.label=2;case 2:return[2]}})})}}),Object.defineProperty(r.prototype,"reportRemoteUserStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){var n=this,o=this._context.getCurrentId();t.forEach(function(t){var r=t.userId,a=t.userState,l=t.systemState;r!==o&&n._reportAppEventModule.onRemoteUserStateChanged({callId:e,userId:r,userState:a,reason:l},i)}),t.forEach(function(t){var a=t.userId,l=t.systemState;a===o&&l===exports.RCCallPlusReason.ABNORMAL_END&&n.emit(r.__INNER_SESSION_CLOSE__,e,i)})}}),Object.defineProperty(r.prototype,"_onOtherMemberInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach(function(e){var r,i=e.userId,n=e.callId,o=null===(r=t.getLocalMainSession())||void 0===r?void 0:r.getInviterUserId();t._reportAppEventModule.onRemoteUserInvited([i],o,n)})}}),Object.defineProperty(r.prototype,"_onRequestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i=e.userId,n=e.transactionId,o=e.mediaType;null===(r=this._mainSession)||void 0===r||r.updateReqMediaType(o),this._reportAppEventModule.onReceivedChangeMediaTypeRequest(i,n,o,t)}}),Object.defineProperty(r.prototype,"_receiveMediaTypeChangeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){t===exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE&&this.emit(r.__INNER_CHANGE_MEDIA_TYPE__,e.mediaType,i),this._reportAppEventModule.onReceivedChangeMediaTypeResult(n(n({},e),{code:t}),i)}}),Object.defineProperty(r.prototype,"_onCallTypeChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._reportAppEventModule.onCallTypeChanged(t,e,r)}}),Object.defineProperty(r,"__INNER_SESSION_CLOSE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-session-close"}),Object.defineProperty(r,"__INNER_SESSION_CONNECT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-session-connect"}),Object.defineProperty(r,"__INNER_CHANGE_MEDIA_TYPE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-change-media-type"}),Object.defineProperty(r,"__INNER_INVITE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-invite"}),r}(e.EventEmitter);!function(e){e.NORMAL="RongCloudRTC",e.SCREEN="ScreenShare"}(le||(le={}));var se,ce=function(r){function u(e,i,n,o,a,l){var _=r.call(this)||this;return Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"_rtcClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(_,"_room",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(_,"_callMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}}),Object.defineProperty(_,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(_,"_isPubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_audioOutputDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(_,"_videoConfigIsChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_audioConfigIsChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_userViewMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(_,"_callPlusStatusReportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_remoteAudioEnable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),_._rtcClient=null==n?void 0:n.rtcClient,_._isPubTiny=n.isPubTiny||!1,_}return i(u,r),Object.defineProperty(u.prototype,"setCallPlusStatusReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callPlusStatusReportListener=e}}),Object.defineProperty(u.prototype,"getCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return!(t=this.getLocalVideoTrack())||this._videoConfigIsChange?[3,1]:(o={track:t,code:c.SUCCESS},[3,3]);case 1:return[4,this._createVideoTrack(e)];case 2:o=a.sent(),a.label=3;case 3:return i=(r=o).code,n=r.track,this._videoConfigIsChange=!1,i!==c.SUCCESS?[2,{code:i}]:[2,{code:c.SUCCESS,track:n}]}})})}}),Object.defineProperty(u.prototype,"getMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return!(t=this.getLocalAudioTrack())||this._audioConfigIsChange?[3,1]:(o={track:t,code:c.SUCCESS},[3,3]);case 1:return[4,this._createAudioTrack(e)];case 2:o=a.sent(),a.label=3;case 3:return i=(r=o).code,n=r.track,this._audioConfigIsChange=!1,i!==c.SUCCESS?[2,{code:i}]:[2,{code:c.SUCCESS,track:n}]}})})}}),Object.defineProperty(u.prototype,"createCallMediaTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return this._callMediaType=e,[4,this.getMicrophoneAudioTrack(t)];case 1:return(r=n.sent().code)!==c.SUCCESS?[2,{code:r}]:e!==exports.RCCallPlusMediaType.AUDIO_VIDEO?[3,3]:[4,this.getCameraVideoTrack(t)];case 2:(i=n.sent().code)!==c.SUCCESS&&this._logger.warn(s.L_RTC_MODULE_CREATE_CALL_MEDIA_TRACKS_P,"get camera video track error code: ".concat(i),t),n.label=3;case 3:return[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(u.prototype,"setVideoConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._videoConfigIsChange=!0,this._videoConfig=e}}),Object.defineProperty(u.prototype,"setAudioConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioConfigIsChange=!0,this._audioConfig=e}}),Object.defineProperty(u.prototype,"setAudioOutputDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){return a(this,function(t){return"string"!=typeof e||0===e.length?[2,{code:c.PARAM_ERROR}]:(this._audioOutputDeviceId===e||(this._audioOutputDeviceId=e,this._room&&this._room.getRemoteTracks().filter(function(e){return e.isAudioTrack()}).forEach(function(t){t.isSubscribed()&&t.play(void 0,{audioDeviceId:e})})),[2,{code:c.SUCCESS}])})})}}),Object.defineProperty(u.prototype,"destroyAllTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_RTC_MODULE_DESTROY_ALL_TRACKS_O,"",e),this._localTracks.forEach(function(e){e.destroy()}),this._localTracks.length=0}}),Object.defineProperty(u.prototype,"setAllRemoteAudioEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return this._logger.info(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_T,"enable: ".concat(t),r),e.isBoolean(t)?(this._remoteAudioEnable=t,this._room?(this._room.getRemoteTracks().filter(function(e){return e.isAudioTrack()}).forEach(function(e){t?e.unmute():e.mute()}),this._logger.info(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R,"success",r),{code:c.SUCCESS}):{code:c.SUCCESS}):(this._logger.error(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R,"param error, enable: type is boolean, value: ".concat(t)),{code:c.PARAM_ERROR})}}),Object.defineProperty(u.prototype,"destroyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return e.destroy(),t=this._localTracks.findIndex(function(t){return t.getTrackId()===e.getTrackId()}),this._localTracks.splice(t,1),[2]})})}}),Object.defineProperty(u.prototype,"sessionConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_SESSION_CONNECT_T,"callId: ".concat(e),t),this._room?[3,2]:[4,this.joinRTCRoom(e,t)];case 1:if(r=a.sent(),o=r.code,i=r.room,o!==c.SUCCESS)return[2];this._room=i,a.label=2;case 2:return this._callId=e,this._regRTCListeners(),this._localTracks.length>0?(this.emit(F.onBeforePublish),n=this._isPubTiny?this._localTracks.map(function(e){return e.isVideoTrack()?{track:e,isPubTiny:!0}:e}):this._localTracks,[4,this.publish(n,t)]):[3,4];case 3:return o=a.sent().code,this.emit(F.onPublishRes,o),[3,5];case 4:this._logger.warn(s.L_RTC_MODULE_SESSION_CONNECT_P,"sessionConnected local tracks is empty",t),a.label=5;case 5:return this._logger.info(s.L_RTC_MODULE_SESSION_CONNECT_R,"code: ".concat(c.SUCCESS),t),[2]}})})}}),Object.defineProperty(u.prototype,"sessionClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var i;return o(this,void 0,void 0,function(){var n,o;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_SESSION_CLOSE_T,"callId: ".concat(e),r),this.destroyAllTracks(r),n=null===(i=this._room)||void 0===i?void 0:i.getRoomId(),this._room&&e===n?[4,this._rtcClient.leaveRoom(this._room)]:[3,2];case 1:return o=a.sent().code,this._releaseStoredData(),o!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom failed, code: ".concat(o),r),[2]):(this._logger.info(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom success",r),[3,3]);case 2:this._logger.warn(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom throw exception: not in room",r),a.label=3;case 3:return[2]}})})}}),Object.defineProperty(u.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return(e=this.getLocalVideoTrack())?[4,e.mute()]:[2,{code:c.CAMERA_CLOSED}];case 1:return[2,{code:t.sent(),track:e}]}})})}}),Object.defineProperty(u.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return(e=this.getLocalVideoTrack())?e.isOwnerMuted()?[4,e.unmute()]:[2,{code:c.SUCCESS}]:[2,{code:c.CAMERA_CLOSED}];case 1:return[2,{code:t.sent()}]}})})}}),Object.defineProperty(u.prototype,"changeVideoDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,u,C,d;return a(this,function(a){switch(a.label){case 0:return r=[],i=[],[4,this._rtcClient.createCameraVideoTrack(le.NORMAL,this._videoConfig)];case 1:return n=a.sent(),o=n.code,l=n.track,o!==t.RCRTCCode.SUCCESS?[2,{code:o}]:(_=this._videoConfig,s=_.minBitrate,u=_.maxBitrate,(s||u)&&l.setBitrate(u,s),this._localTracks&&this._localTracks.forEach(function(e){e.isVideoTrack()?(e.destroy(),C=e):i.push(e)}),this._localTracks=this._localTracks.filter(function(e){return C&&e.getTrackId()!==C.getTrackId()}),r.push(l),i.push(l),this._localTracks=i,this._onLocalTrackReady(r,e),this._room?[4,this._room.publish(r)]:[3,3]);case 2:if((d=a.sent().code)!==t.RCRTCCode.SUCCESS)return[2,{code:d}];a.label=3;case 3:return[2,{code:c.SUCCESS,track:l}]}})})}}),Object.defineProperty(u.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,o,l,_,s,u;return a(this,function(a){switch(a.label){case 0:return r=[],i=[],o=n(n({},this._audioConfig),{micphoneId:this._audioConfig.microphoneId}),[4,this._rtcClient.createMicrophoneAudioTrack(le.NORMAL,o)];case 1:return l=a.sent(),_=l.code,s=l.track,_!==t.RCRTCCode.SUCCESS?[2,{code:_}]:(this._localTracks&&this._localTracks.forEach(function(e){e.isAudioTrack()||i.push(e)}),r.push(s),i.push(s),this._localTracks=i,this._onLocalTrackReady(r,e),this._room?[4,this._room.publish(r)]:[3,3]);case 2:if((u=a.sent().code)!==t.RCRTCCode.SUCCESS)return[2,{code:u}];a.label=3;case 3:return[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(u.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return(e=this.getLocalAudioTrack())?[4,e.mute()]:[2,{code:c.MICROPHONE_CLOSED}];case 1:return[2,{code:t.sent(),track:e}]}})})}}),Object.defineProperty(u.prototype,"changeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return this._logger.info(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_T,"mediaType: ".concat(e),t),e!==exports.RCCallPlusMediaType.AUDIO_VIDEO?[3,2]:[4,this._upgradeMediaType(t)];case 1:return r=i.sent(),[3,4];case 2:return[4,this._downgradeMediaType(t)];case 3:r=i.sent(),i.label=4;case 4:return r.code===c.SUCCESS&&this._logger.info(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"success",t),[2]}})})}}),Object.defineProperty(u.prototype,"_upgradeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o,l,_,u,C;return a(this,function(a){switch(a.label){case 0:return(t=this.getLocalVideoTrack())?[3,2]:[4,this._createVideoTrack(e)];case 1:if(r=a.sent(),i=r.code,n=r.track,i!==c.SUCCESS)return this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"create video track errCode: ".concat(i),e),[2,{code:i}];t=n,o=this._videoConfig,l=o.minBitrate,_=o.maxBitrate,(l||_)&&t.setBitrate(_,l),a.label=2;case 2:return u=this._isPubTiny?{track:t,isPubTiny:!0}:t,[4,this.publish([u],e)];case 3:return(C=a.sent().code)!==c.SUCCESS&&this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"publish errCode: ".concat(C),e),[2,{code:C}]}})})}}),Object.defineProperty(u.prototype,"_downgradeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return(r=this.getLocalVideoTrack())?[4,this._room.unpublish([r])]:[3,2];case 1:if((i=n.sent().code)!==t.RCRTCCode.SUCCESS)return this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"unpublish errCode: ".concat(i),e),[2,{code:i}];this.destroyTrack(r),n.label=2;case 2:return[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(u.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(r,i){return o(this,void 0,void 0,function(){var n,o,l,_,u;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_JOIN_RTC_ROOM_T,"call: ".concat(r),i),[4,Q({asyncFn:this._rtcClient.joinRTCRoomWithOptions.bind(this._rtcClient),fnArgs:[r,{mode:e.RTCMode.CALL}]})];case 1:return n=a.sent(),o=n.code,l=n.room,_=n.tracks,o!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_JOIN_RTC_ROOM_R,"callId: ".concat(r,", errCode: ").concat(o),i),this._onRTCMethodFail(exports.RCCallPlusReason.JOIN_ROOM_ERR,i),[2,{code:o}]):(this._logger.info(s.L_RTC_MODULE_JOIN_RTC_ROOM_R,"success",i),this._room=l,u=this._room.getRemoteUserIds(),this._onSelfJoined(r,u,i),(null==_?void 0:_.length)&&this._onRemoteTrackPublish(_),this._callId=r,[2,{code:c.SUCCESS,room:l,tracks:_}])}})})}}),Object.defineProperty(u.prototype,"subscribeTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return o(this,void 0,void 0,function(){var i;return a(this,function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_SUBSCRIBE_T,JSON.stringify({params:e.map(function(e){var t=e.track,r=e.subTiny;return{trackId:t.getTrackId(),subTiny:r}})}),r),this._room?[4,Q({asyncFn:this._room.subscribe.bind(this._room),fnArgs:[e],onError:function(e){}})]:[2,{code:c.SUCCESS}];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._reportAppEventModule.onFetchRemoteMediaError(e,i),this._onRTCMethodFail(exports.RCCallPlusReason.SUBSCRIBE_ERR,r),this._logger.error(s.L_RTC_MODULE_SUBSCRIBE_R,"errorCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_SUBSCRIBE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(u.prototype,"unsubscribeTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return o(this,void 0,void 0,function(){var i;return a(this,function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_UNSUBSCRIBE_T,JSON.stringify({trackIds:e.map(function(e){return e.getTrackId()})}),r),this._room?[4,this._room.unsubscribe(e)]:[2,{code:c.SUCCESS}];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_UNSUBSCRIBE_R,"errorCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_UNSUBSCRIBE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(u.prototype,"_releaseStoredData",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._room=null,this._remoteAudioEnable=!0,this._userViewMap={}}}),Object.defineProperty(u.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t={};return this._room?(this._room.getRemoteUserIds().forEach(function(r){t[r]=e._room.getRemoteTracksByUserId(r)}),t):t}}),Object.defineProperty(u.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return null===(r=this._room)||void 0===r?void 0:r.getRemoteTracksByUserId(e).find(function(e){return t===exports.RCCallPlusMediaType.AUDIO?e.isAudioTrack():e.isVideoTrack()})}}),Object.defineProperty(u.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._room?this._room.getSessionId():null}}),Object.defineProperty(u.prototype,"_regRTCListeners",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._room.registerRoomEventListener({onKickOff:function(t,r){e._onKickOff(t,e._room.getRoomId(),r),e._releaseStoredData()},onUserJoin:function(t){var r=t.map(function(t){return{callId:e._callId,userId:t}}),i=e._logger.createTraceId();e._onOtherMemJoined(r,i)},onUserLeave:function(t){t.forEach(function(t){delete e._userViewMap[t]})},onTrackPublish:this._onRemoteTrackPublish.bind(this),onTrackUnpublish:this._onTrackUnpublish.bind(this),onTrackReady:function(t){e._onRemoteTrackReady([t])},onVideoMuteChange:function(t){e._onVideoMuteChagne({fromUserId:t.getUserId(),muted:t.isOwnerMuted(),trackId:t.getTrackId()})},onAudioMuteChange:function(t){e._onAudioMuteChange({fromUserId:t.getUserId(),muted:t.isOwnerMuted(),trackId:t.getTrackId()})},onRTCPeerConnectionCloseByException:this._onRTCPeerConnectionCloseByException.bind(this)}),this._room.registerReportListener({onStateReport:this._onRTCStateReport.bind(this)}),this._room.onAudioLevelChange(function(t){e._reportAppEventModule.onUserAudioLevelChanged(t)})}}),Object.defineProperty(u.prototype,"_onLocalTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._reportAppEventModule.onUserMediaAvailable(e,t)}}),Object.defineProperty(u.prototype,"_onRemoteTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportAppEventModule.onUserMediaAvailable(e),this.emit(u.__INNER_RECEIVE_FIRST_FRAME__)}}),Object.defineProperty(u.prototype,"_onKickOff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n){this._logger.info(s.L_RTC_MODULE_RECEIVE_KICK_OFF_O,"roonId: ".concat(r,", byServer: ").concat(e,", state: ").concat(i,", kickExtra: ").concat(JSON.stringify(n)));var o=exports.RCCallPlusReason.CONNECTION_ERR;if(e)if(n)o=n.kickReasonCode;else switch(i){case t.RCKickReason.SERVER_KICK:o=exports.RCCallPlusReason.KICKED_BY_SERVER;break;case t.RCKickReason.OTHER_KICK:o=exports.RCCallPlusReason.OTHER_CLIENT_JOINED;break;case t.RCKickReason.IM_DISCONNECTED:o=exports.RCCallPlusReason.CONNECTION_ERR;break;case t.RCKickReason.IM_LOGOUT:o=exports.RCCallPlusReason.LOGOUT;break;case t.RCKickReason.OTHER_CLIENT_IM_CONNECTED:o=exports.RCCallPlusReason.OTHER_CLIENT_LOGIN}this.emit(u.__INNER_ON_KICKOFF__,o,r)}}),Object.defineProperty(u.prototype,"_onRTCPeerConnectionCloseByException",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_PEERCONNECTION_EXCEPT_CLOSE_O,"",e),this.emit(u.__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__,e)}}),Object.defineProperty(u.prototype,"_onSelfJoined",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return o(this,void 0,void 0,function(){return a(this,function(i){return this.emit(u.__INNER_ON_SELF_JOINED__,e,t,r),[2]})})}}),Object.defineProperty(u.prototype,"_onRemoteTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_PUBLISH_O,JSON.stringify({callId:this._callId,trackIds:e.map(function(e){return e.getTrackId()})}),r);var i=[];e.forEach(function(e){var r,n=e.getUserId();if(e.isAudioTrack())i.push({track:e,subTiny:!1}),t._reportAppEventModule.onRemoteMicrophoneStateChanged(t._callId,e);else if(t._reportAppEventModule.onRemoteCameraStateChanged(t._callId,e),null===(r=t._userViewMap[n])||void 0===r?void 0:r.videoView){var o=t._userViewMap[n].isTiny;i.push({track:e,subTiny:o})}}),i.length&&this.subscribeTracks(i,r)}}),Object.defineProperty(u.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_UNPUBLISH_O,JSON.stringify({callId:this._callId,trackIds:e.map(function(e){return e.getTrackId()})}),t),[4,this.unsubscribeTracks(e,t)];case 1:return r.sent(),[2]}})})}}),Object.defineProperty(u.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O,JSON.stringify({info:e}),t);var r=this._room.getRemoteTrack(e.trackId);this._reportAppEventModule.onRemoteMicrophoneStateChanged(this._callId,r)}}),Object.defineProperty(u.prototype,"_onVideoMuteChagne",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O,JSON.stringify({info:e}),t);var r=this._room.getRemoteTrack(e.trackId);this._reportAppEventModule.onRemoteCameraStateChanged(this._callId,r)}}),Object.defineProperty(u.prototype,"_onRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this,i=e.senders,n=e.receivers;i.forEach(function(e){var t,i=e.kind,n=e.packetsLostRate,o=e.rtt;r._callMediaType===exports.RCCallPlusMediaType.AUDIO_VIDEO&&"audio"===i||null===(t=r._callPlusStatusReportListener)||void 0===t||t.onSendPacketLoss(n||0,o||0)}),n.forEach(function(e){var i,n=e.trackId,o=e.kind,a=e.packetsLostRate,l=e.bitrate;if(r._callMediaType!==exports.RCCallPlusMediaType.AUDIO_VIDEO||"audio"!==o){var _={};_[t.helper.parseTrackId(n).userId]={packetLostRate:a||0,bitRate:l},null===(i=r._callPlusStatusReportListener)||void 0===i||i.onReceivePacketLoss(_)}})}}),Object.defineProperty(u.prototype,"_onRTCMethodFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(u.__INNER_RTC_PROCESS_FAILED__,e,t)}}),Object.defineProperty(u.prototype,"_onOtherMemJoined",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(u.__INNER_ON_OTHER_JOINED__,e,t)}}),Object.defineProperty(u.prototype,"_createAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_T,"",e),r=Object.assign(this._audioConfig,{micphoneId:this._audioConfig.microphoneId}),[4,this._rtcClient.createMicrophoneAudioTrack(le.NORMAL,r)];case 1:return i=a.sent(),n=i.code,o=i.track,n!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_R,"errCode: ".concat(n),e),[2,{code:n}]):(this._logger.info(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_R,"success",e),l=this._audioConfig,_=l.minBitrate,u=l.maxBitrate,(_||u)&&o.setBitrate(u,_),this._localTracks.push(o),this._onLocalTrackReady([o],e),[2,{code:c.SUCCESS,track:o}])}})})}}),Object.defineProperty(u.prototype,"_createVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,n,o,l,_;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_T,"",e),[4,this._rtcClient.createCameraVideoTrack(le.NORMAL,this._videoConfig)];case 1:return r=a.sent(),i=r.code,n=r.track,i!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_R,"errCode: ".concat(i),e),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_R,"success",e),o=this._videoConfig,l=o.minBitrate,_=o.maxBitrate,(l||_)&&n.setBitrate(_,l),this._localTracks.push(n),this._onLocalTrackReady([n],e),[2,{code:c.SUCCESS,track:n}])}})})}}),Object.defineProperty(u.prototype,"getLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return this._localTracks&&(e=l(this._localTracks.filter(function(e){return e.isVideoTrack()}),1)[0]),e}}),Object.defineProperty(u.prototype,"getLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return this._localTracks&&(e=l(this._localTracks.filter(function(e){return e.isAudioTrack()}),1)[0]),e}}),Object.defineProperty(u.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return o(this,void 0,void 0,function(){var i;return a(this,function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_PUBLISH_T,"tracksIds: ".concat(e.map(function(e){return e instanceof t.RCLocalTrack?e.getTrackId():e.track.getTrackId()})),r),[4,Q({asyncFn:this._room.publish.bind(this._room),fnArgs:[e],onError:function(e){}})];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._onRTCMethodFail(exports.RCCallPlusReason.PUBLISH_ERR,r),this._logger.error(s.L_RTC_MODULE_PUBLISH_R,"errCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_PUBLISH_R,"code: ".concat(c.SUCCESS),r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(u.prototype,"publishVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getLocalVideoTrack(),t=this._isPubTiny?{track:e,isPubTiny:!0}:e;return this._room.publish([t])}}),Object.defineProperty(u.prototype,"setVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];e.forEach(function(e){var t=e.userId,n=e.videoElement,o=e.isTiny,a=void 0!==o&&o;if(r._userViewMap[t]={videoView:n,isTiny:a},t!==r._context.getCurrentId()&&r._room){var s=(r.getRemoteTracks()[t]||[]).map(function(e){return{track:e,subTiny:a}});i.push.apply(i,_([],l(s),!1))}}),this._logger.info(s.L_RTC_MODULE_SET_VIDEO_VIEW_O,JSON.stringify({userViewMap:A(this._userViewMap),needSubTrackIds:i.map(function(e){return e.track.getTrackId()})}),t),i.length&&this.subscribeTracks(i,t)}}),Object.defineProperty(u.prototype,"removeVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];e.forEach(function(e){var t=r.getRemoteTracks()[e];if(t&&t.length){var n=t.filter(function(e){return e.isVideoTrack()});n.length&&i.push(n[0])}delete r._userViewMap[e]}),this._logger.info(s.L_RTC_MODULE_REMOVE_VIDEO_VIEW_O,JSON.stringify({userViewMap:A(this._userViewMap),unsubTracks:i.map(function(e){return e.getTrackId()})}),t),i.length&&this.unsubscribeTracks(i,t)}}),Object.defineProperty(u.prototype,"getUserViewMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userViewMap}}),Object.defineProperty(u.prototype,"playMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n){var l;return o(this,void 0,void 0,function(){var o,_,u,C,d;return a(this,function(a){switch(a.label){case 0:if(this._logger.info(s.L_RTC_MODULE_PLAY_MEDIA_T,"userId: ".concat(e,", mediaType: ").concat(r,", videoView: ").concat(null==i?void 0:i.nodeName),n),o=this._context.getCurrentId(),e===o&&r===exports.RCCallPlusMediaType.AUDIO)return this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"please avoid playing local audio to prevent echoes.",n),[2,{code:c.PLAY_MEDIA_FAILED}];if(_=null,!(_=e===o?r===exports.RCCallPlusMediaType.AUDIO?null:this.getLocalVideoTrack():null===(l=this.getRemoteTracks()[e])||void 0===l?void 0:l.filter(function(e){return r===exports.RCCallPlusMediaType.AUDIO?e.isAudioTrack():e.isVideoTrack()})[0]))return this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"error code: ".concat(c.MEDIA_RESOURCE_INVALIED),n),[2,{code:c.MEDIA_RESOURCE_INVALIED}];a.label=1;case 1:return a.trys.push([1,6,,7]),_.isAudioTrack()?[4,_.play(void 0,{audioDeviceId:this._audioOutputDeviceId||void 0})]:[3,3];case 2:return C=a.sent(),[3,5];case 3:return[4,_.play(i)];case 4:C=a.sent(),a.label=5;case 5:return u=C.code,_.isAudioTrack()&&!this._remoteAudioEnable&&_.mute(),u!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"errCode: ".concat(u),n),[2,{code:u}]):(this._logger.info(s.L_RTC_MODULE_PLAY_MEDIA_R,"success",n),[2,{code:c.SUCCESS}]);case 6:return d=a.sent(),this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"errCode: ".concat(c.PLAY_MEDIA_FAILED,", message: ").concat(d.message,","),n),[2,{code:c.PLAY_MEDIA_FAILED}];case 7:return[2]}})})}}),Object.defineProperty(u,"__INNER_RTC_PROCESS_FAILED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-rtc-process-failed"}),Object.defineProperty(u,"__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-rtc-peerconnection-abnormal-close"}),Object.defineProperty(u,"__INNER_ON_SELF_JOINED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-on-self-joined"}),Object.defineProperty(u,"__INNER_ON_OTHER_JOINED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-on-other-joined"}),Object.defineProperty(u,"__INNER_RECEIVE_FIRST_FRAME__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-receive-first-frame"}),Object.defineProperty(u,"__INNER_ON_KICKOFF__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-kickoff-frame"}),u}(e.EventEmitter),ue=function(){function e(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"registerEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){switch(o.label){case 0:if(!(i=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.apply(void 0,_([],l(r),!1))];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),console.error(n),this._logger.error(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({name:n.name,message:n.message})),[3,4];case 4:return[2]}})})}}),Object.defineProperty(e.prototype,"onReceivedCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCall",callId:e.getCallId()}),t),this._callAppListener("onReceivedCall",e,r)}}),Object.defineProperty(e.prototype,"onRemoteUserInvited",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteUserInvited",inviteeUserList:e,inviterUserId:t,callId:r})),this._callAppListener("onRemoteUserInvited",e,t,r)}}),Object.defineProperty(e.prototype,"onCallConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallConnected",callId:e.getCallId()})),this._callAppListener("onCallConnected",e)}}),Object.defineProperty(e.prototype,"onCallTypeChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallTypeChanged",callId:t,callType:e}),r),this._callAppListener("onCallTypeChanged",e,t)}}),Object.defineProperty(e.prototype,"onRemoteUserStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.callId,i=e.userId,n=e.userState,o=e.reason;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteUserStateChanged",callId:r,userId:i,userState:n,reason:o}),t),this._callAppListener("onRemoteUserStateChanged",r,i,n,o)}}),Object.defineProperty(e.prototype,"onCallEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallEnded",callId:e.getCallId(),closeReason:t}),r),this._callAppListener("onCallEnded",e,t)}}),Object.defineProperty(e.prototype,"onRemoteCameraStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteCameraStateChanged",callId:e,trackId:null==t?void 0:t.getTrackId(),enable:null==t?void 0:t.isOwnerMuted()}));var r=null==t?void 0:t.getUserId();this._callAppListener("onRemoteCameraStateChanged",e,r,null==t?void 0:t.isOwnerMuted())}}),Object.defineProperty(e.prototype,"onRemoteMicrophoneStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteMicrophoneStateChanged",callId:e,trackId:null==t?void 0:t.getTrackId(),enable:null==t?void 0:t.isOwnerMuted()}));var r=null==t?void 0:t.getUserId();this._callAppListener("onRemoteMicrophoneStateChanged",e,r,null==t?void 0:t.isOwnerMuted())}}),Object.defineProperty(e.prototype,"onReceivedCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallRecord",record:e}),t),this._callAppListener("onReceivedCallRecord",e)}}),Object.defineProperty(e.prototype,"onReceivedChangeMediaTypeRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedChangeMediaTypeRequest",userId:e,transactionId:t}),i),this._callAppListener("onReceivedChangeMediaTypeRequest",e,t,r)}}),Object.defineProperty(e.prototype,"onReceivedChangeMediaTypeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.userId,i=e.transactionId,n=e.mediaType,o=e.code;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedChangeMediaTypeResult",userId:r,mediaType:n}),t),this._callAppListener("onReceivedChangeMediaTypeResult",{userId:r,transactionId:i,mediaType:n,code:o})}}),Object.defineProperty(e.prototype,"onReceivedCallStartTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallStartTime",info:e}),t),this._callAppListener("onReceivedCallStartTime",e)}}),Object.defineProperty(e.prototype,"onReceivedCallFirstFrameTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallFirstFrameTime",callId:e,callFirstFrameTime:t}),r),this._callAppListener("onReceivedCallFirstFrameTime",e,t)}}),Object.defineProperty(e.prototype,"onUserMediaAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onUserMediaAvailable",trackIds:e.map(function(e){return e.getTrackId()})}),t),e.forEach(function(e){var t=e.getUserId(),i=e.isAudioTrack()?exports.RCCallPlusMediaType.AUDIO:exports.RCCallPlusMediaType.VIDEO;r._callAppListener("onUserMediaAvailable",t,i)})}}),Object.defineProperty(e.prototype,"onFetchRemoteMediaError",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach(function(e){var i=e.track.getUserId();r._callAppListener("onFetchRemoteMediaError",i,t)})}}),Object.defineProperty(e.prototype,"onUserAudioLevelChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach(function(e){var r=e.track,i=e.audioLevel,n=r.getUserId();t._callAppListener("onUserAudioLevelChanged",n,i)})}}),Object.defineProperty(e.prototype,"onReceivedCallPlusSummaryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callAppListener("onReceivedCallPlusSummaryMessage",e)}}),Object.defineProperty(e.prototype,"onReceivedGroupCallStatusMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callAppListener("onReceivedGroupCallStatusMessage",e)}}),e}();!function(e){e[e.UNKNOW_ERR=41e3]="UNKNOW_ERR",e[e.DB_ERR=41001]="DB_ERR",e[e.JSON_ERR=41002]="JSON_ERR",e[e.INVALID_JSON_ERR=41003]="INVALID_JSON_ERR",e[e.MISSING_PARAMS=41004]="MISSING_PARAMS",e[e.PARAMS_REQUIRED=41005]="PARAMS_REQUIRED",e[e.DATA_FORMAT_ERR=41006]="DATA_FORMAT_ERR",e[e.METHOD_NOT_IMPLEMENTED=41007]="METHOD_NOT_IMPLEMENTED",e[e.CALL_NOT_EXIST=41010]="CALL_NOT_EXIST",e[e.SINGAL_EXCEED_TWO_INVITEE=41011]="SINGAL_EXCEED_TWO_INVITEE",e[e.GROUP_EXCEEDS_QUORUM=41012]="GROUP_EXCEEDS_QUORUM",e[e.OPERATION_EXPIRED=41013]="OPERATION_EXPIRED",e[e.DEVICE_IS_CALLING=41014]="DEVICE_IS_CALLING",e[e.REPORT_STREAM_READY_TIME_IS_INVALID=41018]="REPORT_STREAM_READY_TIME_IS_INVALID",e[e.NOT_CALL_YOURSELF=41019]="NOT_CALL_YOURSELF",e[e.SESSION_STATUS_NOT_EXIST=41020]="SESSION_STATUS_NOT_EXIST",e[e.HANGUP_NOT_ALLOW=41021]="HANGUP_NOT_ALLOW",e[e.ACCEPT_NOT_ALLOW=41022]="ACCEPT_NOT_ALLOW",e[e.OPERATION_NOT_ALLOW=41025]="OPERATION_NOT_ALLOW",e[e.TRANSACTION_ID_ERR=41100]="TRANSACTION_ID_ERR",e[e.UP_VIDEO_CANCELED=41050]="UP_VIDEO_CANCELED",e[e.CURRENT_CALL_IS_AUDIO=41051]="CURRENT_CALL_IS_AUDIO",e[e.CURRENT_CALL_IS_VIDEO=41052]="CURRENT_CALL_IS_VIDEO"}(se||(se={}));var Ce=function(){function t(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_androidPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(t.prototype,"setChannelIdMi",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdMi=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdMi type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setMiLargeIconUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._logger.warn(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"`setMiLargeIconUrl` has been deprecated."),this}}),Object.defineProperty(t.prototype,"setChannelIdHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setCategoryHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.categoryHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: categoryHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setImportanceHW",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"LOW"!==e&&"NORMAL"!==e?(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: importanceHW value is NORMAL|LOW, value: ".concat(e)),this):(this._androidPushConfig.importanceHW=e,this)}}),Object.defineProperty(t.prototype,"setImageUrlHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.imageUrlHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: imageUrlHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setChannelIdOPPO",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdOPPO=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdOPPO type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setTypeVivo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.typeVivo=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: typeVivo type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setCategoryVivo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.categoryVivo=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: categoryVivo type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmChannelId=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmChannelId type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmCollapseKey",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmCollapseKey=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmCollapseKey type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmImageUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmImageUrl=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmImageUrl type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setimportanceHonor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"LOW"!==e&&"NORMAL"!==e?(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: importanceHonor value is NORMAL|LOW, value: ".concat(e)),this):(this._androidPushConfig.importanceHonor=e,this)}}),Object.defineProperty(t.prototype,"setimageUrlHonor",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.imageUrlHonor=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: imageUrlHonor type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._androidPushConfig}}),t}(),de=function(){function r(e,r,i,n){var o=this;Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}}),Object.defineProperty(this,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_callPlusStatistics",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clientCallId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_isLaunchHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_needHangupCallId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rtcModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._context.registerMessageType("RC:CallPlusMiss",!0,!1,[]),this._reportAppEventModule=new ue(r),this._callPlusStatistics=new H(this._logger,this._context),this._callEngine=new _e(this._context,this._runtime,this._initOpts,this._logger,this._reportAppEventModule),this._rtcModule=new ce(this._context,this._runtime,this._initOpts,this._logger,this._callEngine,this._reportAppEventModule),this._callEngine.setRTCModule(this._rtcModule),this._rtcModule.on(ce.__INNER_RTC_PROCESS_FAILED__,this._rtcProcessFailHandle.bind(this)),this._rtcModule.on(ce.__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__,this._peerConnectionAbnormalClose.bind(this)),this._rtcModule.on(ce.__INNER_ON_SELF_JOINED__,this._selfJoinedHandle.bind(this)),this._rtcModule.on(ce.__INNER_ON_OTHER_JOINED__,this._otherJoinedHandle.bind(this)),this._rtcModule.on(ce.__INNER_RECEIVE_FIRST_FRAME__,this._receiveFirstFrameHandle.bind(this)),this._rtcModule.on(ce.__INNER_ON_KICKOFF__,this._kickoffHandle.bind(this)),this._callEngine.on(_e.__INNER_SESSION_CONNECT__,this._rtcModule.sessionConnected.bind(this._rtcModule)),this._callEngine.on(_e.__INNER_SESSION_CLOSE__,this._sessionCloseHandle.bind(this)),this._callEngine.on(_e.__INNER_CHANGE_MEDIA_TYPE__,this._rtcModule.changeMediaType.bind(this._rtcModule)),this._callEngine.on(_e.__INNER_INVITE__,function(e,t){o._callPlusStatistics.reportStatisticsData(I.L_QS_RECEIVE_CALL_S,c.SUCCESS,+new Date,e,"",t)})}return Object.defineProperty(r.prototype,"_rtcProcessFailHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._callEngine.getLocalMainSession();if(r){var i=r.getCallId();this._callEngine.systemStatusUp({callId:i,sysStatus:e,forward:ie.CURRENT},t),this._callPlusStatistics.reportStatisticsData(I.L_QS_ABNORMAL_HANGUP_S,c.SUCCESS,+new Date,r),this.__innerHangup({callId:i,systemState:e},t)}}}),Object.defineProperty(r.prototype,"_peerConnectionAbnormalClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callEngine.getLocalMainSession();t&&(this._callEngine.systemStatusUp({callId:t.getCallId(),sysStatus:exports.RCCallPlusReason.CONNECTION_ERR,forward:ie.CURRENT},e),this._callEngine.endCurrentSession(exports.RCCallPlusReason.CONNECTION_ERR,t.getCallId(),e))}}),Object.defineProperty(r.prototype,"_selfJoinedHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return o(this,void 0,void 0,function(){var i,n,o,s;return a(this,function(a){return i=this._context.getCurrentId(),((null==(n=this._callEngine.getLocalMainSession())?void 0:n.getCallType())===exports.RCCallPlusType.MULTI||t.length)&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL),o=_([i],l(t),!1).map(function(e){return{userId:e,userState:exports.RCCallPlusSessionUserState.ONCALL,systemState:exports.RCCallPlusReason.ONCALL}}),s=this._callEngine.updateUsersState(e,o,r),this._reportAppEventModule.onCallConnected(n),s.length>0&&this._callEngine.reportRemoteUserStateChange(e,s,r),this._callEngine.startTimeCorrection(r),[2]})})}}),Object.defineProperty(r.prototype,"_otherJoinedHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i="",n=e.map(function(e){return i=e.callId,{userId:e.userId,userState:exports.RCCallPlusSessionUserState.ONCALL,systemState:exports.RCCallPlusReason.ONCALL}}),o=this._callEngine.updateUsersState(i,n,t);o.length>0&&this._callEngine.reportRemoteUserStateChange(i,o,t),(null===(r=this._callEngine.getLocalMainSession())||void 0===r?void 0:r.getState())!==exports.RCCallPlusCallState.ONCALL&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL)}}),Object.defineProperty(r.prototype,"_receiveFirstFrameHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(null===(t=this._callEngine.getLocalMainSession())||void 0===t?void 0:t.getState())!==exports.RCCallPlusCallState.ONCALL&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL),this._callEngine.upFirstFrameTime(e)}}),Object.defineProperty(r.prototype,"_kickoffHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(e!==exports.RCCallPlusReason.CONNECTION_ERR){var i=this._callEngine.getLocalMainSession();if(i){var n=i.getCallId();this._callPlusStatistics.reportStatisticsData(I.L_QS_ABNORMAL_HANGUP_S,c.SUCCESS,+new Date,i,this._clientCallId),this._callEngine.systemStatusUp({callId:n,sysStatus:e,forward:ie.CURRENT},r),this._callEngine.endCurrentSession(e,t,r)}}else this._callEngine.endCurrentSession(e,t,r)}}),Object.defineProperty(r.prototype,"_sessionCloseHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._isLaunchHangup||(this._clientCallId=""),this._isLaunchHangup=!1,this._rtcModule.sessionClose(e,t)}}),Object.defineProperty(r.prototype,"setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._reportAppEventModule.registerEventListener(e)}}),Object.defineProperty(r.prototype,"setStatusReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_STATUS_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._rtcModule.setCallPlusStatusReportListener(e)}}),Object.defineProperty(r.prototype,"setVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,n=this._logger.createTraceId();if(this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_T,JSON.stringify({list:t.map(function(e){var t=e.userId,r=e.videoElement,i=e.isTiny;return{userId:t,elementName:null==r?void 0:r.nodeName,isTiny:i}})}),n),!e.notEmptyArray(t))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, list: not empty array, value: ".concat(JSON.stringify(t)),n),{code:c.PARAM_ERROR};try{for(var o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),a=o.next();!a.done;a=o.next()){var l=a.value,_=l.userId,u=l.videoElement;if(!e.notEmptyString(_))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, userId: not empty string, value: ".concat(_),n),{code:c.PARAM_ERROR};if(!h(u))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, videoElement: need a video element, value: ".concat(u instanceof HTMLElement?u.nodeName:u),n),{code:c.PARAM_ERROR}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"succes",n),this._rtcModule.setVideoView(t,n),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"removeVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this._logger.createTraceId();return this._logger.info(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_T,JSON.stringify({userIds:t}),r),e.notEmptyArray(t)&&t.every(function(t){return e.notEmptyString(t)})?(this._logger.info(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R,"succes",r),this._rtcModule.removeVideoView(t,r),{code:c.SUCCESS}):(this._logger.error(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),r),{code:c.PARAM_ERROR})}}),Object.defineProperty(r.prototype,"playMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){return i=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_T,JSON.stringify({userId:t,mediaType:r}),i),e.notEmptyString(t)?e.isUndefined(exports.RCCallPlusMediaType[r])?(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"params err, mediaType is illegal, value: ".concat(r),i),[2,{code:c.PARAM_ERROR}]):r===exports.RCCallPlusMediaType.AUDIO&&t===this._context.getCurrentId()?(this._logger.info(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"success",i),[2,{code:c.SUCCESS}]):(n=(this._rtcModule.getUserViewMap()[t]||{}).videoView,r===exports.RCCallPlusMediaType.AUDIO||n?[2,this._rtcModule.playMedia(t,r,n,i)]:(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"errCode: ".concat(c.VIDEO_VIEW_NOT_SET,", video view not set"),i),[2,{code:c.VIDEO_VIEW_NOT_SET}])):(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"params err, userId: not empty string, value: ".concat(t),i),[2,{code:c.PARAM_ERROR}])})})}}),Object.defineProperty(r.prototype,"createVideoConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new R(this._logger)}}),Object.defineProperty(r.prototype,"setVideoConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_T,JSON.stringify(e));var r=e.frameRate,i=e.resolution,o=e.maxBitrate,a=e.minBitrate;if(!t.RCFrameRate[r])return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"param error, frameRate is illegal, value: ".concat(r)),{code:c.PARAM_ERROR};if(!t.RCResolution[i])return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"param error, resolution is illegal, value: ".concat(i)),{code:c.PARAM_ERROR};var l=O(a,o),_=l.code,u=l.errorMsg;return _!==c.SUCCESS&&this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,u),this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"success"),this._videoConfig=n({},e),this._rtcModule.setVideoConfig(this._videoConfig),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"createAudioConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new p(this._logger)}}),Object.defineProperty(r.prototype,"createAndroidPushConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new Ce(this._logger)}}),Object.defineProperty(r.prototype,"setAudioConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_T,JSON.stringify(t));var r=t.sampleRate,i=t.minBitrate,o=t.maxBitrate;if(r&&!e.isNumber(r))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,"param error, sampleRate: type is number, value: ".concat(r)),{code:c.PARAM_ERROR};var a=O(i,o),l=a.code,_=a.errorMsg;return l!==c.SUCCESS&&this._logger.error(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,_),this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,"success"),this._audioConfig=n({},t),this._rtcModule.setAudioConfig(this._audioConfig),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"setAudioOutputDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_OUTPUT_DEVICE_ID_O,e),this._rtcModule.setAudioOutputDeviceId(e)}}),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n,l,_){return void 0===r&&(r=exports.RCCallPlusType.SINGLE),void 0===i&&(i=exports.RCCallPlusMediaType.AUDIO_VIDEO),o(this,void 0,void 0,function(){var o,u,C,d,L,E,T,S,g,p,R;return a(this,function(a){switch(a.label){case 0:if(this._clientCallId=e.getUUID(),o=+new Date,u=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_T,"userIds: ".concat(t.join(","),", callType: ").concat(r,", mediaType: ").concat(i,", pushConfig: ").concat(n,", extra: ").concat(l),u),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.SIGNAL_DISCONNECTED),u),[2,{code:c.SIGNAL_DISCONNECTED}];if(!(C=this._context.getNaviInfo())||!b(C))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.RTC_SERVICE_UNAVAILABLE),u),[2,{code:c.RTC_SERVICE_UNAVAILABLE}];if(!e.notEmptyArray(t)||!t.every(function(t){return e.notEmptyString(t)}))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),u),[2,{code:c.PARAM_ERROR}];if(e.isUndefined(exports.RCCallPlusType[r]))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, callType is illegal, value: ".concat(r),u),[2,{code:c.PARAM_ERROR}];if(e.isUndefined(exports.RCCallPlusMediaType[i]))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, mediaType is illegal, value: ".concat(i),u),[2,{code:c.PARAM_ERROR}];if(n&&(d=v(n)).code!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, pushConfig is illegal, msg: ".concat(d.errorMsg),u),[2,{code:c.PARAM_ERROR}];if(l){if(!e.isString(l))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, extra is illegal, type: string, value: ".concat(l),u),[2,{code:c.PARAM_ERROR}];if(U(l)>z)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, extra max size is 128KB",u),[2,{code:c.PARAM_ERROR}]}return t.length>1&&r===exports.RCCallPlusType.SINGLE?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, You can only call one person in a single call, userIds: ".concat(t.join(",")),u),[2,{code:c.PARAM_ERROR}]):_&&!e.isString(_)?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, targetId is illegal, type: string, value: ".concat(_),u),[2,{code:c.PARAM_ERROR}]):this._callEngine.getLocalMainSession()?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.SESSION_EXIST,", session exist"),u),[2,{code:c.SESSION_EXIST}]):[4,this._rtcModule.createCallMediaTracks(i,u)];case 1:return(L=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"create meida tracks error code: ".concat(L),u),[2,{code:L}]):[4,this._callEngine.startCall({toUsers:t.map(function(e){return{userId:e}}),callType:r,mediaType:i,callId:this._clientCallId,pushConfig:n,extra:JSON.stringify({userId:this._context.getCurrentId(),extra:l}),targetId:_},u)];case 2:return E=a.sent(),T=E.code,S=E.data,this._callPlusStatistics.reportStatisticsData(I.L_QS_START_CALL_S,T,o,null,this._clientCallId,null,{mediaType:i,callType:r,callId:(null==S?void 0:S.callId)||""}),T!==c.SUCCESS?(this._rtcModule.destroyAllTracks(u),this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"signal error code: ".concat(T),u),[2,{code:T}]):(p=(g=S).callId,R=g.clientCallId,this._needHangupCallId===R?(this._callEngine.clearAllTimer(p,u),this._callEngine.hangup({callId:p,systemState:exports.RCCallPlusReason.CANCELLED},u),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_R,"the ".concat(p," call has been hangup"),u),[2,{code:c.SUCCESS}]):(r===exports.RCCallPlusType.MULTI&&this._rtcModule.sessionConnected(p,u),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_R,JSON.stringify({data:S,code:T}),u),[2,{code:c.SUCCESS,callId:p}]))}})})}}),Object.defineProperty(r.prototype,"joinMultiCall",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u,C,d;return a(this,function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_T,"callId: ".concat(t),r),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.SIGNAL_DISCONNECTED),r),[2,{code:c.SIGNAL_DISCONNECTED}]):(i=this._context.getNaviInfo())&&b(i)?e.notEmptyString(t)?[4,this._callEngine.getCallSession({callId:t},r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"params err, callId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.RTC_SERVICE_UNAVAILABLE),r),[2,{code:c.RTC_SERVICE_UNAVAILABLE}]);case 1:return n=a.sent(),o=n.code,l=n.data,o!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"get call data error, code: ".concat(o),r),[2,{code:o}]):(_=l.mediaType,(u=this._callEngine.getLocalMainSession())&&u.getCallId()!==t?[2,{code:c.SESSION_EXIST}]:[4,this._rtcModule.createCallMediaTracks(_,r)]);case 2:return(C=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"create meida tracks error code: ".concat(C),r),[2,{code:C}]):[4,this._callEngine.joinCall({callId:t,mediaType:_},r)];case 3:return(d=a.sent().code)!==c.SUCCESS?(this._rtcModule.destroyAllTracks(r),this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"signal error code: ".concat(d),r),[2,{code:d}]):(this._logger.info(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.SUCCESS),r),[4,this._rtcModule.sessionConnected(t,r)]);case 4:return a.sent(),[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(r.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n;return o(this,void 0,void 0,function(){var o,u,C,d,L,E;return a(this,function(a){switch(a.label){case 0:if(o=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_INVITE_T,"callId: ".concat(t.join(","),", pushConfig: ").concat(r,", extra: ").concat(i),o),!e.notEmptyArray(t)||!t.every(function(t){return e.notEmptyString(t)}))return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),o),[2,{code:c.PARAM_ERROR}];if(r&&(u=v(r)).code!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, pushConfig is illegal, msg: ".concat(u.errorMsg),o),[2,{code:c.PARAM_ERROR}];if(i){if(!e.isString(i))return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, extra is illegal, value: ".concat(i),o),[2,{code:c.PARAM_ERROR}];if(U(i)>z)return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, extra max size is 128KB",o),[2,{code:c.PARAM_ERROR}]}return[4,this._callEngine.invite({toUsers:t.map(function(e){return{userId:e}}),pushConfig:r,extra:JSON.stringify({userId:this._context.getCurrentId(),extra:i})},o)];case 1:return C=a.sent(),d=C.code,L=C.data,d!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"signal error code: ".concat(d),o),[2,{code:d}]):(E=[],(null===(n=L.busylineUsers)||void 0===n?void 0:n.length)&&E.push.apply(E,_([],l(L.busylineUsers.map(function(e){return{userId:e.userId,state:e.sessionStatus}})),!1)),this._logger.info(s.L_CALLPLUS_CLIENT_INVITE_R,"success busyUsers: ".concat(JSON.stringify(E)),o),[2,{code:c.SUCCESS,busyUsers:E}])}})})}}),Object.defineProperty(r.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n,o,l,_,u,C,d,L,E;return a(this,function(a){switch(a.label){case 0:return i=+new Date,n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_ACCEPT_T,"callId: ".concat(t,", pushConfig: ").concat(r),n),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode: ".concat(c.SIGNAL_DISCONNECTED),n),[2,{code:c.SIGNAL_DISCONNECTED}]):(o=this._context.getNaviInfo())&&b(o)?e.notEmptyString(t)?r&&(l=v(r)).code!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"params err, pushConfig is illegal, msg: ".concat(l.errorMsg),n),[2,{code:c.PARAM_ERROR}]):(_=this._callEngine.getLocalMainSession(),u=this._callEngine.getHoldSession(t),_||u?t===(null==u?void 0:u.getCallId())?[4,this.hangup(_.getCallId())]:[3,2]:(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode : ".concat(c.NOT_IN_CALL,", session not exist"),n),[2,{code:c.NOT_IN_CALL}])):(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"params err, callId: not empty string, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode: ".concat(c.RTC_SERVICE_UNAVAILABLE),n),[2,{code:c.RTC_SERVICE_UNAVAILABLE}]);case 1:if((C=a.sent().code)!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"hangup mainSession error code: ".concat(C),n),[2,{code:C}];this._callEngine.upgradeMainSession(t),_=this._callEngine.getLocalMainSession(),a.label=2;case 2:return d=_.getMediaType(),[4,this._rtcModule.createCallMediaTracks(d,n)];case 3:return(L=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"create meida tracks error code: ".concat(L),n),[2,{code:L}]):[4,this._callEngine.accept({callId:t},n)];case 4:return E=a.sent().code,this._callPlusStatistics.reportStatisticsData(I.L_QS_ACCEPT_CALL_S,E,i,_),E!==c.SUCCESS?(this._rtcModule.destroyAllTracks(n),this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"signal error code: ".concat(E),n),[2,{code:E}]):(this._logger.info(s.L_CALLPLUS_CLIENT_ACCEPT_R,"success",n),this._rtcModule.sessionConnected(t,n),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"__innerHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){switch(o.label){case 0:return i=e.callId,this._callEngine.setIsLocalClientHangup(!0),this._callEngine.clearAllTimer(i,t),[4,this._callEngine.hangup(e,t)];case 1:return(n=o.sent().code)===se.CALL_NOT_EXIST?[2,{code:c.SUCCESS}]:n!==c.SUCCESS||i!==(null===(r=this._callEngine.getLocalMainSession())||void 0===r?void 0:r.getCallId())?[3,3]:[4,this._rtcModule.sessionClose(i,t)];case 2:o.sent(),o.label=3;case 3:return[2,{code:n}]}})})}}),Object.defineProperty(r.prototype,"hangup",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n,o,l,_,u,C,d,L,E,T,S;return a(this,function(a){switch(a.label){case 0:return i=+new Date,n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_HANGUP_T,"callId: ".concat(t,", pushConfig: ").concat(r),n),(o=this._callEngine.getLocalMainSession())?t&&!e.isString(t)?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, callId: type is string, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]):r&&(l=v(r)).code!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, pushConfig is illegal, msg: ".concat(l.errorMsg),n),[2,{code:c.PARAM_ERROR}]):(_=o.getCallId(),t&&t!==_&&!this._callEngine.getHoldSession(t)?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, callId is invalid, value: ".concat(t),n),[2,{code:c.CALL_ID_INVALID}]):(this._isLaunchHangup=!0,this._needHangupCallId=t||_,u=this._callEngine.getHoldSession(this._needHangupCallId),C=u||o,d=this._context.getCurrentId(),L=o.getUserList().filter(function(e){return e.userId===d})[0].state,E=[o.getCreatorUserId(),o.getInviterUserId()].includes(d),T=function(e,t){var r;switch(e){case exports.RCCallPlusSessionUserState.CALLING:r=exports.RCCallPlusReason.CANCELLED;break;case exports.RCCallPlusSessionUserState.RINGING:case exports.RCCallPlusSessionUserState.INVITED:r=exports.RCCallPlusReason.DECLINED;break;case exports.RCCallPlusSessionUserState.CONNECTING:r=t?exports.RCCallPlusReason.DECLINED:exports.RCCallPlusReason.CANCELLED;break;case exports.RCCallPlusSessionUserState.ONCALL:r=exports.RCCallPlusReason.ENDED}return r}(L,E)||exports.RCCallPlusReason.ENDED,[4,this.__innerHangup({callId:this._needHangupCallId,systemState:T,pushConfig:r},n)])):[2,{code:c.NOT_IN_CALL}];case 1:return S=a.sent().code,this._callPlusStatistics.reportStatisticsData(I.L_QS_HANGUP_CALL_S,S,i,C,this._clientCallId),S!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"signal error code : ".concat(S),n),[2,{code:S}]):(this._needHangupCallId=null,this._logger.info(s.L_CALLPLUS_CLIENT_HANGUP_R,"success",n),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"requestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u,C=this;return a(this,function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_T,"mediaType: ".concat(t),r),e.isUndefined(exports.RCCallPlusMediaType[t])?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"params err, mediaType is illegal, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]):(i=this.getCurrentCallSession(),n=null==i?void 0:i.getMediaType(),t===n?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"error code: ".concat(c.MEDIATYPE_INVALID),r),[2,{code:c.MEDIATYPE_INVALID}]):this._callEngine.getLocalMainSession()?(o=null==i?void 0:i.getUserList().filter(function(e){return e.userId!==C._context.getCurrentId()}).map(function(e){return e.userId}),[4,this._callEngine.requestChangeMediaType({mediaType:t,toUserIds:o||[]},r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),r),[2,{code:c.NOT_IN_CALL}]));case 1:return l=a.sent(),_=l.code,u=l.data,_!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"signal error code: ".concat(_),r),[2,{code:_}]):(this._logger.info(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"success transactionId: ".concat(u.transactionId),r),[2,{code:c.SUCCESS,transactionId:u.transactionId}])}})})}}),Object.defineProperty(r.prototype,"cancelChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_T,"transactionId: ".concat(t),r),e.notEmptyString(t)?this._callEngine.getLocalMainSession()?[4,this._callEngine.cancelChangeMediaType({transactionId:t},r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"param error, transactionId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"signal error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"replyChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){switch(o.label){case 0:return i=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_T,"transactionId: ".concat(t),i),e.notEmptyString(t)?e.isBoolean(r)?this._callEngine.getLocalMainSession()?[4,this._callEngine.responseChangeMediaType({transactionId:t,agree:r},i)]:(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),i),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"param error, isAgree: type is boolean, value: ".concat(r),i),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"param error, transactionId: not empty string, value: ".concat(t),i),[2,{code:c.PARAM_ERROR}]);case 1:return(n=o.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"signal error: ".concat(n),i),[2,{code:n}]):(this._logger.info(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"success",i),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"getCurrentCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callEngine.getLocalMainSession()}}),Object.defineProperty(r.prototype,"getAvailableCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,t,r,i;return a(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_T,"",e),[4,this._callEngine.getOpenCallList(e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R,"signal error code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R,"success, data: ".concat(JSON.stringify(i)),e),[2,{code:c.SUCCESS,records:i}])}})})}}),Object.defineProperty(r.prototype,"getCallRecords",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===i&&(i=0),o(this,void 0,void 0,function(){var n,o,l,_;return a(this,function(a){switch(a.label){case 0:return n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_T,"startTimestamp: ".concat(t,", count: ").concat(r),n),e.isNumber(t)&&t>=0?e.isNumber(r)&&r>0?[4,this._callEngine.getCallLogList({timestamp:t,count:r,order:i},n)]:(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"params error, count: is a number >= 0, value: ".concat(r),n),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"params error, startTimestamp: is a number >= 0, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]);case 1:return o=a.sent(),l=o.code,_=o.data,l!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"signal error code: ".concat(l),n),[2,{code:l}]):(this._logger.info(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"success",n),[2,{code:c.SUCCESS,result:_}])}})})}}),Object.defineProperty(r.prototype,"deleteCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_T,"callIds: ".concat(t.join(",")),r),e.notEmptyArray(t)&&t.every(function(t){return e.notEmptyString(t)})?[4,this._callEngine.deleteCallLog(t,r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"params err, callIds: not empty array, callId: not empty string, callIds: ".concat(JSON.stringify(t)),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"signal error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"deleteAllCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,t;return a(this,function(r){switch(r.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_T,"",e),[4,this._callEngine.removeAllCallLog(e)];case 1:return(t=r.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R,"signal error code: ".concat(t),e),[2,{code:t}]):(this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"startCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return o(this,void 0,void 0,function(){var r,i,n,o,l,_;return a(this,function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_T,"",r),[4,this._rtcModule.getCameraVideoTrack(r)];case 1:return i=a.sent(),n=i.code,o=i.track,n!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"create video track error code: ".concat(n),r),[2,{code:n}]):(null==o?void 0:o.isPublished())||(null===(e=this._callEngine.getLocalMainSession())||void 0===e?void 0:e.getState())!==exports.RCCallPlusCallState.ONCALL?[3,3]:[4,this._rtcModule.publishVideoTrack()];case 2:return(l=a.sent().code)!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"publish error code: ".concat(l),r),[2,{code:l}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"success",r),[2,{code:c.SUCCESS}]);case 3:return[4,this._rtcModule.enableVideoTrack(r)];case 4:return(_=a.sent().code)!==t.RCRTCCode.SUCCESS&&_!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"signal error code: ".concat(_),r),[2,{code:_}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"stopCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,r,i,n;return a(this,function(o){switch(o.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_CAMERA_T,"",e),[4,this._rtcModule.disableVideoTrack()];case 1:return r=o.sent(),i=r.code,n=r.track,i!==c.SUCCESS&&i!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_STOP_CAMERA_R,"error code: ".concat(i),e),[2,{code:i}]):(this._rtcModule.destroyTrack(n),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_CAMERA_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"switchCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i,n;return a(this,function(o){switch(o.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_T,"cameraId: ".concat(t),r),e.notEmptyString(t)?(i=this._callEngine.getLocalMainSession())?i.getMediaType()===exports.RCCallPlusMediaType.AUDIO?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"errCode: ".concat(c.NOT_VIDEO_CALL),r),[2,{code:c.NOT_VIDEO_CALL}]):(this._videoConfig.cameraId=t,this._rtcModule.setVideoConfig(this._videoConfig),[4,this._rtcModule.changeVideoDevice(r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"errCode: ".concat(c.NOT_IN_CALL),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"param error, cameraId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(n=o.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"call client changeVideoDevice error code: ".concat(n),r),[2,{code:n}]):(this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"startMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_T,"",e),[4,this._rtcModule.getMicrophoneAudioTrack(e)];case 1:return r=a.sent(),i=r.code,n=r.track,i!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"create microphone audio track error code: ".concat(i),e),[2,{code:i}]):n.isOwnerMuted()?[4,n.unmute()]:(this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}]);case 2:return(o=a.sent())!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"signal error code: ".concat(i),e),[2,{code:o}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"stopMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,r;return a(this,function(i){switch(i.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_T,"",e),[4,this._rtcModule.disableAudioTrack()];case 1:return(r=i.sent().code)!==c.SUCCESS&&r!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R,"signal error code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"isMicrophoneEnabled",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._rtcModule.getLocalAudioTrack();return!!e&&!e.isOwnerMuted()}}),Object.defineProperty(r.prototype,"setAllRemoteAudioEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._logger.createTraceId(),[2,this._rtcModule.setAllRemoteAudioEnable(e,t)]})})}}),Object.defineProperty(r.prototype,"getVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"2.22.0"}}),Object.defineProperty(r.prototype,"getCameras",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,t.device.getCameras()]})})}}),Object.defineProperty(r.prototype,"getMicrophones",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,t.device.getMicrophones()]})})}}),Object.defineProperty(r.prototype,"getSpeakers",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,t.device.getSpeakers()]})})}}),Object.defineProperty(r.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcModule.getRTCSessionId()}}),Object.defineProperty(r.prototype,"switchMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_T,"microphoneId: ".concat(t),r),e.notEmptyString(t)?this._callEngine.getLocalMainSession()?(this._audioConfig.microphoneId=t,this._rtcModule.setAudioConfig(this._audioConfig),[4,this._rtcModule.changeAudioDevice(r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"errCode: ".concat(c.NOT_IN_CALL),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"param error, microphoneId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"call client changeAudioDevice error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),r}();e.VersionManage.add("callplus","2.22.0");var Le={tag:"RCCallPlus",verify:function(t){return!!e.VersionManage.validEngine("5.22.0")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-call-plus required engine version at least '").concat("5.22.0","'.")),!1)},setup:function(t,r,i){var n,o=(n=i)?e.isObject(n)?Object.keys(n).includes("rtcClient")?e.isObject(n.rtcClient)?{isLegal:!0}:{isLegal:!1,msg:"Initialization 'rtcClient' parameter must be of type 'object'"}:{isLegal:!1,code:c.NOT_INSTALL_RTC_PLUGIN}:{isLegal:!1,msg:"Initialization options must be an object"}:{isLegal:!1,msg:"Initialization missing parameter -> options"};if(!o.isLegal)throw new Error("[CallPlusLib installer steup]".concat(o.msg));e.isUndefined(i.isAllowNewCallWhenRinging)&&(i.isAllowNewCallWhenRinging=!0);var a=t.createLogger("CallPlus","RTC"),l=e.isUndefined(i.logOutputLevel)?e.LogL.WARN:i.logOutputLevel;return a.setOutputLevel(l),a.warn(s.L_INDEX_INSTALL_CALL_PLUS_PLUGIN_O,"CallPlus Version: ".concat("2.22.0",", Commit: ").concat("05454d21ed11aa28fb89693c3e038bcd88cf0ddc",", isAllowNewCallWhenRinging: ").concat(i.isAllowNewCallWhenRinging)),new de(t,a,r,i)}};Object.defineProperty(exports,"RCCallPlusFrameRate",{enumerable:!0,get:function(){return t.RCFrameRate}}),Object.defineProperty(exports,"RCCallPlusResolution",{enumerable:!0,get:function(){return t.RCResolution}}),exports.RCAudioConfigBuilder=p,exports.RCCallPlusAndroidPushConfigBuilder=Ce,exports.RCCallPlusClient=de,exports.RCCallPlusCode=c,exports.RCCallPlusSession=g,exports.RCVideoConfigBuilder=R,exports.installer=Le;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=require("@rongcloud/plugin-rtc"),r=function(e,t){return r=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])},r(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var n=function(){return n=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},n.apply(this,arguments)};function o(e,t,r,i){return new(r||(r=Promise))(function(n,o){function a(e){try{_(i.next(e))}catch(e){o(e)}}function l(e){try{_(i.throw(e))}catch(e){o(e)}}function _(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 a(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:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(_){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&l[0]?i.return:l[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,l[1])).done)return n;switch(i=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,i=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){a.label=l[1];break}if(6===l[0]&&a.label<n[1]){a.label=n[1],n=l;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(l);break}n[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],i=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,_])}}}function l(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 _(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 s,c={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"}(s||(s={}));var u,C,d,L,E,T,S,g=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,exports.RCCallPlusMediaType.VIDEO),o=e._rtcModule.getRemoteTrack(r,exports.RCCallPlusMediaType.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 o(this,void 0,void 0,function(){var e,t,r,i;return a(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_T,"",e),this._startTime?[2,{code:c.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!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"errCode: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_SESSION_GET_CREATE_TIME_R,"success",e),this._startTime=i,[2,{code:c.SUCCESS,startTime:this._startTime}])}})})}}),Object.defineProperty(e.prototype,"getDuration",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,t,r,i;return a(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_T,"",e),this._duration?(this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(c.SUCCESS,", duration: ").concat(this._duration),e),[2,{code:c.SUCCESS,duration:this._duration}]):[4,this._callEngine.getCallTimeInfo(this._callId,e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_SESSION_GET_DURATION_R,"code: ".concat(c.SUCCESS,", duration: ").concat(i.duration),e),this._duration=i.duration,[2,{code:c.SUCCESS,duration:this._duration}])}})})}}),e}();(u=exports.RCCallPlusType||(exports.RCCallPlusType={}))[u.SINGLE=0]="SINGLE",u[u.MULTI=1]="MULTI",(C=exports.RCCallPlusSessionUserState||(exports.RCCallPlusSessionUserState={}))[C.IDLE=0]="IDLE",C[C.CALLING=100]="CALLING",C[C.INVITED=101]="INVITED",C[C.RINGING=102]="RINGING",C[C.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",C[C.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",C[C.CONNECTING=200]="CONNECTING",C[C.ONCALL=300]="ONCALL",C[C.ONPHONE=301]="ONPHONE",C[C.ENDED=1e3]="ENDED",C[C.NO_ANSWER=1001]="NO_ANSWER",C[C.MISSED=1002]="MISSED",C[C.CANCELLED=1003]="CANCELLED",C[C.DECLINED=1004]="DECLINED",C[C.ERROR=2e3]="ERROR",(d=exports.RCCallPlusMediaType||(exports.RCCallPlusMediaType={}))[d.AUDIO=0]="AUDIO",d[d.AUDIO_VIDEO=1]="AUDIO_VIDEO",d[d.VIDEO=2]="VIDEO",(L=exports.RCCallPlusCallState||(exports.RCCallPlusCallState={}))[L.IDLE=0]="IDLE",L[L.CALLING=100]="CALLING",L[L.INVITED=101]="INVITED",L[L.RINGING=102]="RINGING",L[L.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",L[L.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",L[L.CONNECTING=200]="CONNECTING",L[L.ONCALL=300]="ONCALL",L[L.ENDED=1e3]="ENDED",L[L.NOANSWER=1001]="NOANSWER",L[L.MISSED=1002]="MISSED",L[L.CANCELED=1003]="CANCELED",L[L.DECLINED=1004]="DECLINED",L[L.ERROR=2e3]="ERROR",(E=exports.RCCallPlusMediaTypeChangeResult||(exports.RCCallPlusMediaTypeChangeResult={}))[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",(T=exports.RCCallPlusReason||(exports.RCCallPlusReason={}))[T.IDLE=0]="IDLE",T[T.CALLING=100]="CALLING",T[T.INVITED=101]="INVITED",T[T.RINGING=102]="RINGING",T[T.BUSYLINE_RINGING=103]="BUSYLINE_RINGING",T[T.BUSYLINE_WAIT=104]="BUSYLINE_WAIT",T[T.CONNECTING=200]="CONNECTING",T[T.ONCALL=300]="ONCALL",T[T.ON_PHONE=301]="ON_PHONE",T[T.ON_PHONE_END=302]="ON_PHONE_END",T[T.ON_DEVICE_DISABLE=303]="ON_DEVICE_DISABLE",T[T.ON_DEVICE_ENABLE=304]="ON_DEVICE_ENABLE",T[T.ABNORMAL_END=999]="ABNORMAL_END",T[T.ENDED=1e3]="ENDED",T[T.NO_ANSWER=1001]="NO_ANSWER",T[T.MISSED=1002]="MISSED",T[T.CANCELLED=1003]="CANCELLED",T[T.DECLINED=1004]="DECLINED",T[T.OTHER_CLIENT_CALLING=1010]="OTHER_CLIENT_CALLING",T[T.OTHER_CLIENT_ACCEPT=1011]="OTHER_CLIENT_ACCEPT",T[T.JOIN_ROOM_ERR=1105]="JOIN_ROOM_ERR",T[T.PUBLISH_ERR=1106]="PUBLISH_ERR",T[T.SUBSCRIBE_ERR=1107]="SUBSCRIBE_ERR",T[T.ACCEPT_CARRIER=1108]="ACCEPT_CARRIER",T[T.KICKED_BY_SERVER=1109]="KICKED_BY_SERVER",T[T.CONNECTION_ERR=1110]="CONNECTION_ERR",T[T.LOGOUT=1111]="LOGOUT",T[T.OTHER_CLIENT_LOGIN=1112]="OTHER_CLIENT_LOGIN",T[T.OTHER_CLIENT_JOINED=1113]="OTHER_CLIENT_JOINED",T[T.OTHER_CLIENT_IN_ROOM=1114]="OTHER_CLIENT_IN_ROOM",T[T.OTHER_CLIENT_HANGUP=1151]="OTHER_CLIENT_HANGUP",T[T.REMOTE_JOIN_RTC_ERROR=1205]="REMOTE_JOIN_RTC_ERROR",T[T.REMOTE_PUBLISH_ERROR=1206]="REMOTE_PUBLISH_ERROR",T[T.REMOTE_SUBSCRIBE_ERROR=1207]="REMOTE_SUBSCRIBE_ERROR",T[T.REMOTE_KICKED_BY_SERVER=1209]="REMOTE_KICKED_BY_SERVER",T[T.REMOTE_CONNECTION_ERROR=1210]="REMOTE_CONNECTION_ERROR",T[T.REMOTE_LOGOUT=1211]="REMOTE_LOGOUT",T[T.REMOTE_OTHER_CLIENT_LOGIN=1212]="REMOTE_OTHER_CLIENT_LOGIN",T[T.REMOTE_OTHER_JOINED_RTC=1213]="REMOTE_OTHER_JOINED_RTC",T[T.REMOTE_OTHER_CLIENT_IN_RTC=1214]="REMOTE_OTHER_CLIENT_IN_RTC",(S=exports.IGroupCallStatusMessageType||(exports.IGroupCallStatusMessageType={}))[S.START=1]="START",S[S.END=2]="END";var I,p=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.isNumber(t)||!e.isNumber(r)||r<=0||t<=0||r<t?(this._logger.error(s.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.isNumber(t)?(this._audioConfig.sampleRate=t,this):(this._logger.error(s.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}(),R=function(){function r(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:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}})}return Object.defineProperty(r.prototype,"setFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t.RCFrameRate[e]?(this._videoConfig.frameRate=e,this):(this._logger.error(s.L_CALLPLUS_VIDEO_CONFIG_SET_FRAME_RATE_O,"params error -> fps: ".concat(e)),this)}}),Object.defineProperty(r.prototype,"setVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return t.RCResolution[e]?(this._videoConfig.resolution=e,this):(this._logger.error(s.L_CALLPLUS_VIDEO_CONFIG_SET_RESOLUTION_O,"params error -> resolution: ".concat(e)),this)}}),Object.defineProperty(r.prototype,"setDefaultCameraId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._videoConfig.cameraId=e,this}}),Object.defineProperty(r.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return!e.isNumber(t)||!e.isNumber(r)||r<=0||t<=0||r<t?(this._logger.error(s.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(r.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._videoConfig}}),r}(),f=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}},h=function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()},b=function(e){var t=e.voipCallInfo;return!!t&&1===JSON.parse(t).strategy},O=function(t,r){return!t&&0!==t||e.isNumber(t)&&!(t<=0)?!r&&0!==r||e.isNumber(r)&&!(r<=0)?t&&r&&r<t?{code:c.PARAM_ERROR,errorMsg:"params error -> maxBitrate: ".concat(r,", minBitrate: ").concat(t,", maxBitrate should > minBitrate")}:{code:c.SUCCESS}:{code:c.PARAM_ERROR,errorMsg:"params error -> maxBitrate: a number of > 0, value: ".concat(r)}:{code:c.PARAM_ERROR,errorMsg:"params error -> minBitrate: a number of > 0, value: ".concat(t)}},A=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},N=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,l=r.channelIdHW,_=r.channelIdOPPO,s=r.typeVivo,c=r.fcmChannelId,u=r.fcmCollapseKey,C=r.fcmImageUrl,d=r.importanceHW,L=r.categoryHW,E=r.imageUrlHW,T=r.categoryVivo,S=r.importanceHonor,g=r.imageUrlHonor,I={};i&&(I["thread-id"]=i),I["apns-collapse-id"]=n||e,o&&(I.richMediaUri=o);var p={};l&&(p.channelId=l),E&&(p.image=E),L&&(p.category=L),p.importance=d||"NORMAL";var R,f,h,b,O=[{HW:p},{APNS:I}];return(u||C||c)&&(R={},u&&(R.collapse_key=u),C&&(R.imageUrl=C),c&&(R.channelId=c),O[0].FCM=R),a&&(O[0].MI={channelId:a}),_&&((f={}).channelId=_,O[0].OPPO=f),(s||T)&&(h={},s&&(h.classification=s),T&&(h.category=T),O[0].VIVO=h),(S||g)&&(b={},S&&(b.importance=S),g&&(b.image=g),O[0].HONOR=b),JSON.stringify(O)},m=function(t,r){var i=t.pushTitle,n=void 0===i?"":i,o=t.iOSConfig,a=t.androidConfig,l=t.disablePushTitle,_=t.templateId,s={pushConfigs:N(r,o,a)};return e.isBoolean(l)&&(s.disableTitle=l),n&&(s.title=n),_&&(s.templateId=_),JSON.stringify(s)},v=function(t){var r=["pushTitle","pushContent","iOSConfig","androidConfig","disablePushTitle","templateId"],i=Object.keys(t).every(function(e){return r.includes(e)});if(!i)return{code:c.PARAM_ERROR,errorMsg:"right key: ".concat(r.join(","))};for(var n=0;n<r.length;n++){var o=r[n];if("disablePushTitle"===o){if(!e.isUndefined(t[o])&&!e.isBoolean(t[o]))return{code:c.PARAM_ERROR,errorMsg:"".concat(o," type is boolean")}}else if(("pushTitle"===o||"templateId"===o||"pushContent"===o)&&t[o]&&!e.isString(t[o]))return{code:c.PARAM_ERROR,errorMsg:"".concat(o," type is string")}}var a=t.iOSConfig,l=t.androidConfig,_=P(a||{});if(_.code!==c.SUCCESS)return _;var s=y(l||{});return s.code!==c.SUCCESS?s:{code:c.SUCCESS}},P=function(t){var r=t||{},i=r.threadId,n=r.richMediaUri;return i&&!e.isString(i)?{code:c.PARAM_ERROR,errorMsg:"iOSConfig.threadId type is string"}:n&&!e.isString(n)?{code:c.PARAM_ERROR,errorMsg:"iOSConfig.richMediaUri type is string"}:{code:c.SUCCESS}},y=function(t){var r=["channelIdMi","channelIdHW","categoryHW","importanceHW","imageUrlHW","channelIdOPPO","typeVivo","categoryVivo","fcmChannelId","fcmCollapseKey","fcmImageUrl","importanceHonor","imageUrlHonor"],i=Object.keys(t).every(function(e){return r.includes(e)});if(!i)return{code:c.PARAM_ERROR,errorMsg:"right key: ".concat(r.join(","))};for(var n=0;n<r.length;n++){var o=r[n];if("importanceHW"===o||"importanceHonor"===o){if(t[o]&&"LOW"!==t[o]&&"NORMAL"!==t[o])return{code:c.PARAM_ERROR,errorMsg:"androidConfig.".concat(o," value is NORMAL|LOW")}}else if(t[o]&&!e.isString(t[o]))return{code:c.PARAM_ERROR,errorMsg:"androidConfig.".concat(o," type is string")}}return{code:c.SUCCESS}},U=function(e,t){void 0===t&&(t="utf-8");return"utf-16"===t?M(e):D(e)},M=function(e){for(var t=0,r=0,i=e.length;r<i;r++)t+=e.charCodeAt(r)<=65535?2:4;return t},D=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},w=/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"}(I||(I={}));var j,G,V,x,H=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,o,a,l){var _=+new Date,s=i?{mediaType:i.getMediaType(),callType:i.getCallType(),callId:i.getCallId()}:l,c={cr:"unknown",net:"unknown",cod:t,mtp:s.mediaType,ctp:s.callType,cid:s.callId,time:_,uid:this._context.getCurrentId()};o&&Object.assign(c,{ccid:o});var u=null;switch(e){case I.L_QS_RECEIVE_CALL_S:u=n(n({},c),{rf:a});break;case I.L_QS_ABNORMAL_HANGUP_S:u=n({},c);break;default:u=n(n({},c),{dur:_-r})}this._logger.__statistics(e,JSON.stringify(u))}}),e}();!function(e){e.REQUEST="request",e.ACCEPT="accept",e.REFUSE="refuse",e.CANCEL="cancel",e.NOTICE="notice",e.TIMEOUT="timeout"}(j||(j={})),function(e){e[e.SWITCH_MEDIA_TYPE=1]="SWITCH_MEDIA_TYPE"}(G||(G={})),function(e){e[e.NORMAL=0]="NORMAL",e[e.SECRET=1]="SECRET"}(V||(V={})),function(e){e.INVITER="inviter",e.INVITEE="invitee"}(x||(x={}));var k,B=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:l}),Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:_}),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 i(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,l=r._callUsers.findIndex(function(e){return e.userId===a});if(l<0)return r._callUsers.push(e),void i.push(e);var _,s,c,u,C=r._callUsers[l],d=C.stateTime,L=C.systemState,E=C.userState,T=(_=L,s=o,c=!1,u=[exports.RCCallPlusReason.INVITED,exports.RCCallPlusReason.RINGING,exports.RCCallPlusReason.BUSYLINE_RINGING,exports.RCCallPlusReason.BUSYLINE_WAIT,exports.RCCallPlusReason.CONNECTING,exports.RCCallPlusReason.ONCALL],_===exports.RCCallPlusReason.ONCALL&&u.includes(s)&&(c=!0),c),S=function(e,t){var r=!1,i=[exports.RCCallPlusSessionUserState.INVITED,exports.RCCallPlusSessionUserState.RINGING,exports.RCCallPlusSessionUserState.BUSYLINE_RINGING,exports.RCCallPlusSessionUserState.BUSYLINE_WAIT,exports.RCCallPlusSessionUserState.CONNECTING,exports.RCCallPlusSessionUserState.ONCALL];return e===exports.RCCallPlusSessionUserState.ONCALL&&i.includes(t)&&(r=!0),r}(E,t),g=o===exports.RCCallPlusReason.ON_PHONE_END&&L!==exports.RCCallPlusReason.ON_PHONE&&t!==exports.RCCallPlusSessionUserState.IDLE;n&&d&&n<d||T&&S||(r._callUsers[l]=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===x.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}(e.EventEmitter);!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"}(k||(k={}));var F,Y,J,W=function(e,t){return setTimeout(e,t)},K=[e.ErrorCode.RC_NET_CHANNEL_INVALID,e.ErrorCode.RC_NET_UNAVAILABLE,e.ErrorCode.RC_MSG_RESP_TIMEOUT,t.RCRTCCode.SIGNAL_DISCONNECTED,t.RCRTCCode.REQUEST_FAILED],Q=function(e){var t=e.asyncFn,r=e.fnArgs,i=e.currentRetryTime,n=void 0===i?Date.now():i,s=e.maxDuration,u=void 0===s?6e4:s,C=e.intervals,d=void 0===C?[2e3,4e3,8e3,16e3,32e3,64e3]:C,L=e.index,E=void 0===L?0:L,T=e.onError;return o(void 0,void 0,void 0,function(){var e;return a(this,function(i){switch(i.label){case 0:return[4,t.apply(void 0,_([],l(r),!1))];case 1:return e=i.sent(),e.code===c.SUCCESS||!K.includes(e.code)||Date.now()+2e3-n>u?[3,3]:(T&&T(e.code),[4,(o=2e3,new Promise(function(e){setTimeout(e,o)}))]);case 2:return i.sent(),[2,Q({asyncFn:t,fnArgs:r,currentRetryTime:n,maxDuration:u,intervals:d,index:E,onError:T})];case 3:return[2,e]}var o})})};!function(e){e.onBeforePublish="onBeforePublish",e.onPublishRes="onPublishRes",e.onPubInviteCall="onPubInviteCall",e.onPubInviteCallPullKv="onPubInviteCallPullKv",e.onPubInviteCallMiss="onPubInviteCallMiss"}(F||(F={})),function(e){e.NOT_CURRENT_DEVICEID="not current device id",e.SECRET_CALL="secret call",e.NOT_INVITEE="not an invitee"}(Y||(Y={})),function(e){e.PUB_INVITE="pubinvitecall",e.PULL_KV_INVITE="pullkv_invitecall",e.PUSH="system_pubsh"}(J||(J={}));var q,X,z=131072,Z="RC:CallPlusMiss",$="RC:CallGroupStatusMsg",ee=function(t){function r(r,i,n,o,a,l){var _=t.call(this)||this;return Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_timeCorrectioner",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_needRetryActions",{enumerable:!0,configurable:!0,writable:!0,value:[k.START_SINGLE_CALL,k.START_GROUP_CALL,k.ACCEPT_CALL,k.JOIN_CALL,k.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=e.getUUID22(),_}return i(r,t),Object.defineProperty(r.prototype,"_onMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!![Z,$].includes(e.messageType)&&(e.messageType===Z?this._dealMissMessage(e):this._dealGroupCallMessage(e),!0)}}),Object.defineProperty(r.prototype,"_dealMissMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=t.content,i=r.callId,n=r.mediaType,o=r.startTime,a=r.callSessionUsers,l=t.targetId,_=t.senderUserId,c=this._context.getCurrentId();if(!localStorage.getItem("missMessageMap-".concat(c,"-").concat(i))){var u={callId:i,callerUserId:_,targetId:l,mediaType:n,firstFrameTime:0,callStartTime:o-this._timeCorrectioner.getLocalDelayTime(),callEndTime:0,hangupReason:a.filter(function(e){return e.userId===c})[0].sessionStatus};this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_MISS_MESSAGE_O,"receive miss message: ".concat(JSON.stringify(t)));var C=Object.assign(t,{content:u,sentStatus:e.SentStatus.SENT});this._reportAppEventModule.onReceivedCallPlusSummaryMessage(C),localStorage.setItem("missMessageMap-".concat(c,"-").concat(i),i)}}}),Object.defineProperty(r.prototype,"_dealGroupCallMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportAppEventModule.onReceivedGroupCallStatusMessage(e)}}),Object.defineProperty(r.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(r.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return w?this._context.getDeviceId():this._sessionId}}),Object.defineProperty(r.prototype,"registerListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,c,u,C,d,L;return a(this,function(a){return r=e.clientCallId,i=e.callType,n=e.toUsers,o=e.mediaType,l=e.secretChat,_=e.targetType,s=e.targetId,c=e.nickName,u=e.oldRoomId,C=e.pushExt,d=e.pushContent,L=e.extra,i===exports.RCCallPlusType.SINGLE?[2,this.startSingleCall({clientCallId:r,toUserId:n[0].userId,mediaType:o,secretChat:l,targetType:_,targetId:s,oldRoomId:u,toOrgId:n[0].orgId||"",pushExt:C,pushContent:d,extra:L},t)]:[2,this.startGroupCall({clientCallId:r,toUsers:n,mediaType:o,targetType:_,targetId:s,nickName:c,oldRoomId:u,pushExt:C,pushContent:d,extra:L},t)]})})}}),Object.defineProperty(r.prototype,"startSingleCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_SINGLE_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),k.START_SINGLE_CALL,e)]})})}}),Object.defineProperty(r.prototype,"startGroupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GROUP_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(this._context.getCurrentId(),k.START_GROUP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"inviteCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_INVITE_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.INVITE_CALL,e)]})})}}),Object.defineProperty(r.prototype,"ringingCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_RING_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.RINGING_CALL,e)]})})}}),Object.defineProperty(r.prototype,"acceptCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_ACCEPT_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.ACCEPT_CALL,e)]})})}}),Object.defineProperty(r.prototype,"joinCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_JOIN_CALL_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.JOIN_CALL,e)]})})}}),Object.defineProperty(r.prototype,"hangupCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return this._logger.info(s.L_SIGNAL_TRANSPORTER_HANGUP_T,"params: ".concat(JSON.stringify(e)),t),[4,this._sendCallSignal(e.callId,k.HANGUP_CALL,e)];case 1:return(r=i.sent().code)===c.NOT_IN_CALL?[2,{code:c.SUCCESS}]:[2,{code:r}]}})})}}),Object.defineProperty(r.prototype,"statusUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_STATUS_UP_T,"call status up params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.STATUS_UP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"eventUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_EVENT_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.EVENT_UP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"dialogUpCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_CALL_DIALOG_UP_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.DIALOG_UP_CALL,e)]})})}}),Object.defineProperty(r.prototype,"deleteCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return o(this,void 0,void 0,function(){return a(this,function(i){return this._logger.info(s.L_SIGNAL_TRANSPORTER_DELETE_CALL_RECORD_T,"callIds: ".concat(JSON.stringify(t)),r),[2,this._sendCallSignal(e,k.DEL_CALL_LOG,{callIds:t})]})})}}),Object.defineProperty(r.prototype,"syncCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_RECORD_T,"params: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.userId,k.SYNC_CALL_LOG,e)]})})}}),Object.defineProperty(r.prototype,"queryUserHasCall",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e;return a(this,function(t){return e=this._context.getCurrentId(),[2,this._sendCallSignal(e,k.QRY_CALL_STATE,null)]})})}}),Object.defineProperty(r.prototype,"getCallServerTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_SERVER_TIME_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,k.QRY_SRV_TIMESTAMP,null)]})})}}),Object.defineProperty(r.prototype,"getCallTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_TIME_INFO_T,"callId: ".concat(e),t),[2,this._sendCallSignal(e,k.GET_CALL_TIME_INFO,{callId:e})]})})}}),Object.defineProperty(r.prototype,"getUserCallStateList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_AVAILABLE_CALL_LIST_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,k.GET_CALL_STATE_LIST,null)]})})}}),Object.defineProperty(r.prototype,"clearCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),this._logger.info(s.L_SIGNAL_TRANSPORTER_CLEAR_CALL_RECORD_T,"userId: ".concat(t),e),[2,this._sendCallSignal(t,k.CLEAR_CALL_LOG,null)]})})}}),Object.defineProperty(r.prototype,"getCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_GET_CALL_INFO_BY_CALLID_T,"callId: ".concat(e.callId),t),[2,this._sendCallSignal(e.callId,k.GET_CALL_SESSION,e)]})})}}),Object.defineProperty(r.prototype,"sysStatusUp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._logger.info(s.L_SIGNAL_TRANSPORTER_USER_SYSTEM_STATE_UP_T,"opts: ".concat(JSON.stringify(e)),t),[2,this._sendCallSignal(e.callId,k.SYS_STATUS_UP,e)]})})}}),Object.defineProperty(r.prototype,"upCallLogReaded",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._context.getCurrentId(),[2,this._sendCallSignal(t,k.UP_CALL_LOG_READED,e)]})})}}),Object.defineProperty(r.prototype,"endUserAbnormalCalls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){return a(this,function(t){return[2,this._sendCallSignal(this._context.getCurrentId(),k.END_ABNORMAL_CALL,e)]})})}}),Object.defineProperty(r.prototype,"_onIMConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this._logger.createTraceId();this._logger.info(s.L_SIGNAL_TRANSPORTER_IM_STATE_CHANGE_O,"state: ".concat(t),r),this._listener.onIMStateChange(t),t===e.RCConnectionStatus.CONNECTED?this._timeCorrectioner.start(r):this._timeCorrectioner.stop(r)}}),Object.defineProperty(r.prototype,"_sendCallSignal",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return o(this,void 0,void 0,function(){var o,l,_,s,u,C;return a(this,function(a){switch(a.label){case 0:return o="",i&&(o=w?JSON.stringify(i):JSON.stringify(n(n({},i),{sessionId:this._sessionId}))),this._needRetryActions.includes(r)?[4,Q({asyncFn:this._context.setCallInfo.bind(this._context),fnArgs:[t,r,o]})]:[3,2];case 1:return l=a.sent(),[3,4];case 2:return[4,this._context.setCallInfo(t,r,o)];case 3:l=a.sent(),a.label=4;case 4:return _=l.code,s=l.data,_!==e.ErrorCode.SUCCESS?[2,{code:_}]:(u=s.value,C=JSON.parse(u).data,[2,{code:c.SUCCESS,data:C}])}})})}}),Object.defineProperty(r.prototype,"_onRecvCallSignal",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=this._logger.createTraceId();this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_SIGNAL_DATA_O,"data: ".concat(e),r),JSON.parse(e).list.forEach(function(e){var i=e.key,n=JSON.parse(e.value);switch(i){case k.PUB_INVITE_CALL:t._onPubInviteCall(n,r,!0);break;case k.STATUS_DOWN_CALL:t._onStatusDownCall(n,r);break;case k.EVENT_DOWN_CALL:t._onEventDownCall(n,r);break;case k.DIALOG_DOWN_CALL:t._onDialogDownCall(n,r);break;case k.PUB_CALL_LOG:t._onPubCallLog(n,r);break;case k.PUB_CALL_LOG_READED:case k.PUB_NACK_SEQ_ID:break;default:t._onConpensationData(n,r)}})}}),Object.defineProperty(r.prototype,"isValidData",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.isNull(t))return!0;var r=t===this.getDeviceId();return!(!e.isString(t)||0!==(null==t?void 0:t.length)&&!r)}}),Object.defineProperty(r.prototype,"_onPubInviteCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){void 0===r&&(r=!0);try{var i=this._context.getCurrentId(),n=e.callSessionUsers.find(function(e){return e.userId===i}),o=this._context.getConnectionStatus();this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"currentUser: ".concat(JSON.stringify(n),", currentUserId: ").concat(i,", state: ").concat(o),t)}catch(e){this._logger.error(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"error: ".concat(e.message),t)}if(this.isValidData(e.toDeviceId||""))this._listener.onInvite(e,r,t),r?this.emit(F.onPubInviteCall,Object.assign(e,{extra:JSON.stringify(e)})):this.emit(F.onPubInviteCallPullKv,Object.assign(e,{extra:JSON.stringify(e)}));else{this._logger.warn(s.L_SIGNAL_TRANSPORTER_RECEIVE_INVITE_O,"not current deviceId -> deviceInfo: ".concat(JSON.stringify({toDeviceId:e.toDeviceId,clientDeviceId:this._sessionId})),t);var a={extra:JSON.stringify(e),reason:Y.NOT_CURRENT_DEVICEID,refer:r?J.PUB_INVITE:J.PULL_KV_INVITE};this.emit(F.onPubInviteCallMiss,Object.assign(e,a))}}}),Object.defineProperty(r.prototype,"_onStatusDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e.callSessionUsers=e.callSessionUsers.filter(function(e){return Boolean(e.changed)}),this._logger.info(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O,"",t),!this.isValidData(e.toDeviceId||""))return this._logger.warn(s.L_SIGNAL_TRANSPORTER_RECEIVE_CALL_STATUS_O,"not current deviceId -> deviceInfo: ".concat(JSON.stringify({toDeviceId:e.toDeviceId,clientDeviceId:this._sessionId})),t),void this._listener.onOtherClientStatusDown(e,t);this._listener.onStatusDown(e,t,this._sessionId)}}),Object.defineProperty(r.prototype,"_onEventDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._listener.onEventDown(e,t)}}),Object.defineProperty(r.prototype,"_onDialogDownCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.dialogType===G.SWITCH_MEDIA_TYPE&&this._listener.onSwitchMediaType(e,t)}}),Object.defineProperty(r.prototype,"_onPubCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALL_ENGINE_RECEIVE_CALL_RECORD_O,"call record: ".concat(JSON.stringify(e)),t),this._listener.onRecvCallEndLog(e,t)}}),Object.defineProperty(r.prototype,"_onConpensationData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._logger.info(s.L_CALL_ENGINE_RECEIVE_COMPLEMENTARY_DATA_O,"",t);var i=e.callId,n=e.callType,o=e.mediaType,a=e.secretChat,l=e.duration,_=e.callStatus,c=e.callingUserId,u=e.callSessionUsers,C=e.toDeviceId,d=e.callDialogEntitys,L=e.extra;u.some(function(e){return e.sessionStatus===exports.RCCallPlusSessionUserState.INVITED&&e.userId===r._context.getCurrentId()})?this._onPubInviteCall({callId:i,toDeviceId:C,callType:n,mediaType:o,inviteUserId:c,callingUserId:c,callSessionUsers:u,secretChat:a,extra:L},t,!0):this._onStatusDownCall({callId:i,toDeviceId:C,callStatus:_,duration:l,callSessionUsers:u},t),d.length>0&&d.forEach(function(e){return r._onDialogDownCall(e,t)},this)}}),r}(e.EventEmitter),te=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)});return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1,i=+e,n=[];do{var o=i%r;i=(i-o)/r,n.unshift(t[o])}while(i);return n.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e},re=function(){function e(e,t){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_localStore",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._localStore=e.localStorage}return Object.defineProperty(e.prototype,"addAbnormallCallId",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}"),n=i[t];n?n.push(r):n=[r],i[t]=n,this._localStore.setItem(e._STORAGE_KEY,JSON.stringify(i))}catch(e){this._logger.error(s.L_ABNORMAL_ADD_CALL_ID_E,e.message),console.error(e)}}}),Object.defineProperty(e.prototype,"removeAbnormalCallIds",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}"),n=i[t];n&&((n=n.filter(function(e){return!r.includes(e)})).length>0?i[t]=n:delete i[t],this._localStore.setItem(e._STORAGE_KEY,JSON.stringify(i)))}catch(e){this._logger.error(s.L_ABNORMAL_REMOVE_CALL_IDS_E,e.message),console.error(e)}}}),Object.defineProperty(e.prototype,"getAbnormalCallIds",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=null;try{var i=JSON.parse(this._localStore.getItem(e._STORAGE_KEY)||"{}")[t];i&&(r=i)}catch(e){this._logger.error(s.L_ABNORMAL_GET_CALL_IDS_E,e.message),console.error(e)}return Promise.resolve(r)}}),Object.defineProperty(e,"_STORAGE_KEY",{enumerable:!0,configurable:!0,writable:!0,value:"CallPlus_AbnormalCall"}),e}();!function(e){e[e.PROMPT=0]="PROMPT",e[e.CALL_DURATION=10]="CALL_DURATION",e[e.FIRST_FRAME=20]="FIRST_FRAME"}(q||(q={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.INVALID_RESPONSE_TIME=80170]="INVALID_RESPONSE_TIME",e[e.NONOPTIMAL_RES_TIME=80171]="NONOPTIMAL_RES_TIME"}(X||(X={}));var ie,ne,oe,ae=function(){function e(e,t,r){Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_singleCallDurationEv",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_RTT",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_validMinRTT",{enumerable:!0,configurable:!0,writable:!0,value:200}),Object.defineProperty(this,"_validMaxRTT",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(this,"_deltaTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_timerId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_interval",{enumerable:!0,configurable:!0,writable:!0,value:2e3}),Object.defineProperty(this,"_maxRetryTimes",{enumerable:!0,configurable:!0,writable:!0,value:8}),Object.defineProperty(this,"_startTimes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_retryTimesInCall",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_maxRetryTimesInCall",{enumerable:!0,configurable:!0,writable:!0,value:3})}return Object.defineProperty(e.prototype,"getCallClientTimeByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_T,"callId: ".concat(e),t),!this._RTT||this._RTT>this._validMinRTT?[4,this._getDeltaTime(t)]:[3,2];case 1:a.sent(),a.label=2;case 2:return this._RTT>this._validMaxRTT&&this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(X.INVALID_RESPONSE_TIME),t),[4,this._callEngine.getCallTimeInfo(e,t)];case 3:return r=a.sent(),i=r.code,n=r.data,i!==c.SUCCESS?(this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(i),t),[2,{code:i}]):(o=n.startTime,l=Math.floor(o-this._deltaTime),_=Date.now(),(u=(_+this._deltaTime-o)/1e3)<0&&(this._logger.warn(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_P,"invalid duration: ".concat(u),t),u=0),u=Math.floor(u),this._RTT>this._validMinRTT&&this._RTT<=this._validMaxRTT&&this._logger.error(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,"code: ".concat(X.NONOPTIMAL_RES_TIME),t),this._logger.info(s.L_TIME_CORRECT_GET_CALL_CLIENT_TIME_BY_SERVER_R,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime,serverStartTime:o,clientStartTime:l,duration:u}),t),[2,{code:i,duration:u,clientStartTime:o?l:o}])}})})}}),Object.defineProperty(e.prototype,"calcClientStartTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(this._logger.info(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_T,"callId: ".concat(e,", startTime: ").concat(t),r),this._RTT>this._validMaxRTT)return this._logger.error(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R,"code: ".concat(X.INVALID_RESPONSE_TIME),r),this._loopCorrectClientTime(e,r),{code:X.INVALID_RESPONSE_TIME};var i=Math.floor(t-this._deltaTime);return this._logger.info(s.L_TIME_CORRECT_CALC_CLIENT_START_TIME_R,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime,startT:t,clientStartTime:i}),r),this._RTT>this._validMinRTT&&(this._retryTimesInCall=0,this._loopCorrectClientTime(e,r)),{code:X.SUCCESS,clientStartTime:i}}}),Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this._timerId||this._startTimes>=this._maxRetryTimes||(this._logger.info(s.L_TIME_CORRECT_START_O,"timerId: ".concat(this._timerId)),this._startTimes++,this._getDeltaTime(e),this._timerId=W(function(){t._timerId=null,t.start(e)},this._interval))}}),Object.defineProperty(e.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_TIME_CORRECT_STOP_O,"timerId: ".concat(this._timerId),e),this._timerId&&clearTimeout(this._timerId),this._timerId=null,this._startTimes=0}}),Object.defineProperty(e.prototype,"restart",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_TIME_CORRECT_RESTART_O,"legal rtt time, RTT: ".concat(this._RTT,", validMinRTT: ").concat(this._validMinRTT),e),this._RTT<this._validMinRTT||(this.stop(e),this.start(e))}}),Object.defineProperty(e.prototype,"getLocalDelayTime",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Math.round(this._deltaTime)}}),Object.defineProperty(e.prototype,"getRTT",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._RTT}}),Object.defineProperty(e.prototype,"_getDeltaTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o,l;return a(this,function(a){switch(a.label){case 0:return t=Date.now(),[4,this._callEngine.getCallServerTimestamp(e)];case 1:return r=a.sent(),i=r.code,n=r.data,o=Date.now(),i!==c.SUCCESS?[2,{code:i}]:(((l=o-t)<this._RTT||0===this._RTT)&&l<=this._validMaxRTT&&(this._RTT=l),l<this._validMinRTT&&this.stop(e),this._deltaTime=n-t-this._RTT/2,this._logger.info(s.L_TIME_CORRECT_SET_DELTA_TIME_O,JSON.stringify({rtt:this._RTT,deltaT:this._deltaTime}),e),[2,{code:i,delayTime:this._deltaTime}])}})})}}),Object.defineProperty(e.prototype,"_getDeltaTimeInCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u,C;return a(this,function(a){switch(a.label){case 0:return r=Date.now(),[4,this._callEngine.getCallTimeInfo(e,t)];case 1:return i=a.sent(),n=i.code,o=i.data,l=Date.now(),n!==c.SUCCESS?[2,{code:n}]:((_=l-r)<this._RTT&&(this._RTT=_),this._deltaTime=o.syncTime-r-this._RTT/2,this._logger.info(s.L_TIME_CORRECT_SET_DELTA_TIME_O,JSON.stringify({callId:e,rtt:this._RTT,deltaT:this._deltaTime}),t),u=Math.floor(o.startTime-this._deltaTime),C=Math.floor(o.firstFrametime-this._deltaTime),_<this._validMinRTT?[2,{code:X.SUCCESS,clientStartTime:u,clientFirstFrameTime:C}]:[2,{code:X.INVALID_RESPONSE_TIME,clientStartTime:u,clientFirstFrameTime:C}])}})})}}),Object.defineProperty(e.prototype,"_loopCorrectClientTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l=this;return a(this,function(a){switch(a.label){case 0:return this.stop(t),this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_T,"callId: ".concat(e),t),[4,this._getDeltaTimeInCall(e,t)];case 1:return r=a.sent(),i=r.code,n=r.clientStartTime,o=r.clientFirstFrameTime,i===X.SUCCESS?(this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R,"code: ".concat(c.SUCCESS),t),this._singleCallDurationEv(e,n,o,t),[2]):this._retryTimesInCall>this._maxRetryTimesInCall&&i===X.INVALID_RESPONSE_TIME?(this._logger.info(s.L_TIME_CORRECT_LOOP_CORRECT_CLINET_TIME_R,"code: ".concat(X.INVALID_RESPONSE_TIME),t),this._singleCallDurationEv(e,n,o,t),[2]):(this._retryTimesInCall>this._maxRetryTimesInCall||(this._retryTimesInCall++,setTimeout(function(){l._loopCorrectClientTime(e,t)},this._interval)),[2])}})})}}),e}();!function(e){e[e.SOON_AFETER=0]="SOON_AFETER",e[e.CURRENT=1]="CURRENT"}(ie||(ie={})),function(e){e[e.PUB_INVITE_CALL=0]="PUB_INVITE_CALL",e[e.PULL_KV_INVITE_CALL=1]="PULL_KV_INVITE_CALL",e[e.SYSTEM_PUSH=2]="SYSTEM_PUSH"}(ne||(ne={})),function(e){e[e.OUT=-1]="OUT",e[e.GROUP=0]="GROUP",e[e.IN=1]="IN"}(oe||(oe={}));var le,_e=function(t){function r(e,r,i,n,o){var a=t.call(this)||this;return Object.defineProperty(a,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(a,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_mainSession",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(a,"_holdSessions",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_signalModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_abnormalModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_isUpFirstFrameTime",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_callStartMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(a,"_timeCorrectioner",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_clientCallId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(a,"_rtcModule",{enumerable:!0,configurable:!0,writable:!0,value:null}),a._timeCorrectioner=new ae(a,n,a._onRecvSinCallDuration.bind(a)),a._signalModule=new ee(e,r,i,a._timeCorrectioner,a._logger,a._reportAppEventModule),a._signalModule.registerListener({onInvite:a._onInvite.bind(a),onStatusDown:a._onStatusDown.bind(a),onOtherClientStatusDown:a._onOtherClientStatusDown.bind(a),onEventDown:a._onEventDown.bind(a),onSwitchMediaType:a._onSwitchMediaType.bind(a),onRecvCallEndLog:a._onRecvCallEndLog.bind(a),onIMStateChange:a._onIMStateChange.bind(a)}),a._abnormalModule=new re(r,n),a}return i(r,t),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,s,u,C,d,L,E,T,S,g,I,p,R,f,h,b,O,A,N=this;return a(this,function(a){switch(a.label){case 0:return r=this._context.getCurrentId(),i=e.callType,n=e.mediaType,o=e.toUsers,s=e.targetId,u=e.targetType,C=e.oldRoomId,d=e.pushConfig,L=e.extra,this._clientCallId=e.callId,E=d?m(d,this._clientCallId):"",[4,this._signalModule.startCall({clientCallId:this._clientCallId,callType:i,mediaType:n,toUsers:o,secretChat:V.NORMAL,targetType:u,targetId:s,oldRoomId:C,pushExt:E,pushContent:(null==d?void 0:d.pushContent)||"",extra:L},t)];case 1:return T=a.sent(),S=T.code,g=T.data,S!==c.SUCCESS?[2,{code:S}]:(p=(I=g).callId,R=I.busylineUsers,this._abnormalModule.addAbnormallCallId(r,p),this._mainSession=new B(p,exports.RCCallPlusCallState.INVITED,i,n,r,r,[],this._logger),i===exports.RCCallPlusType.SINGLE&&(f=this._startTimer(g.callId,exports.RCCallPlusSessionUserState.NO_ANSWER,t),this._mainSession.updateTimerId(x.INVITER,f)),h={userId:r,userState:exports.RCCallPlusSessionUserState.CALLING,systemState:exports.RCCallPlusReason.CALLING,targetType:u,targetId:s},b=o.map(function(e){var t=e.userId,r=e.targetType,i=e.targetId;return{userId:t,userState:exports.RCCallPlusSessionUserState.INVITED,systemState:exports.RCCallPlusReason.INVITED,targetType:r,targetId:i}}),O=[],R&&(O=R.map(function(e){var t=b.find(function(t){return t.userId===e.userId}),r=t.targetType,i=t.targetId;return{userId:e.userId,userState:e.sessionStatus,systemState:exports.RCCallPlusReason.BUSYLINE_RINGING,targetType:r,targetId:i}}),b=b.filter(function(e){var t=e.userId;return O.every(function(e){return e.userId!==t})})),A=this.updateUsersState(p,_(_([h],l(b),!1),l(O),!1),t),setTimeout(function(){A.length>0&&N.reportRemoteUserStateChange(p,A,t)}),[2,{code:S,data:g}])}})})}}),Object.defineProperty(r.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return o(this,void 0,void 0,function(){var i,n,o,s,u,C,d,L,E,T,S;return a(this,function(a){switch(a.label){case 0:return this._mainSession?(i=e.toUsers,n=e.pushConfig,o=e.extra,s=n?m(n,this._clientCallId):"",u=this._mainSession.getCallId(),[4,this._signalModule.inviteCall({callId:u,toUsers:i,pushExt:s,pushContent:(null==n?void 0:n.pushContent)||"",extra:o},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return C=a.sent(),d=C.code,L=C.data,d===c.SUCCESS&&(this._mainSession.getCallType()===exports.RCCallPlusType.SINGLE&&(this._mainSession.updateCallType(exports.RCCallPlusType.MULTI),this._onCallTypeChange(this._mainSession.getCallId(),exports.RCCallPlusType.MULTI,t)),E=i.map(function(e){var t=e.userId,r=e.targetType,i=e.targetId;return{userId:t,userState:exports.RCCallPlusSessionUserState.INVITED,systemState:exports.RCCallPlusReason.INVITED,targetType:r,targetId:i}}),T=[],L.busylineUsers&&(T=null===(r=L.busylineUsers)||void 0===r?void 0:r.map(function(e){var t=E.find(function(t){return t.userId===e.userId}),r=t.targetType,i=t.targetId;return{userId:e.userId,userState:e.sessionStatus,systemState:exports.RCCallPlusReason.BUSYLINE_RINGING,targetType:r,targetId:i}}),E=E.filter(function(e){var t=e.userId;return T.every(function(e){return e.userId!==t})})),(S=this.updateUsersState(u,_(_([],l(E),!1),l(T),!1),t)).length>0&&this.reportRemoteUserStateChange(u,S,t)),[2,{code:d,data:L}]}})})}}),Object.defineProperty(r.prototype,"clearAllTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;_([this._mainSession],l(this._holdSessions),!1).forEach(function(i){i&&i.getCallId()===e&&i.getAllTimerIds().forEach(function(e){return r._stopTimer.bind(r)(e,t)})})}}),Object.defineProperty(r.prototype,"hangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l;return a(this,function(a){switch(a.label){case 0:return r=e.callId,i=e.systemState,n=e.pushConfig,o=n?m(n,this._clientCallId):"",[4,this._signalModule.hangupCall({callId:r,sysStatus:i,pushExt:o,pushContent:(null==n?void 0:n.pushContent)||""},t)];case 1:return l=a.sent().code,this.endCurrentSession(e.systemState,r,t),[2,{code:l}]}})})}}),Object.defineProperty(r.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return this._mainSession?(r=e.callId,[4,this._signalModule.acceptCall({callId:r},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return i=n.sent().code,this._stopTimer(this._mainSession.getInviteeTimerId(),t),i!==c.SUCCESS?[2,{code:i}]:(this._clearMobileOnPhone(e.callId,t),this._mainSession.updateSessionState(exports.RCCallPlusCallState.CONNECTING),[2,{code:i}])}})})}}),Object.defineProperty(r.prototype,"joinCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._context.getCurrentId(),this._mainSession&&this._stopTimer(this._mainSession.getInviteeTimerId(),t),[4,this._signalModule.joinCall({callId:e.callId},t)];case 1:return(i=n.sent().code)!==c.SUCCESS?[2,{code:i}]:(this._abnormalModule.addAbnormallCallId(r,e.callId),this._mainSession?[3,3]:[4,this._createSessionByServer(e.callId,t,!0)]);case 2:return n.sent(),[3,4];case 3:this._clearMobileOnPhone(e.callId,t),n.label=4;case 4:return[2,{code:i}]}})})}}),Object.defineProperty(r.prototype,"requestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n;return a(this,function(o){switch(o.label){case 0:return this._mainSession?(r={mediaType:e.mediaType},this._mainSession.updateReqMediaType(e.mediaType),i=te(),[4,this._signalModule.dialogUpCall({transactionId:i,callId:this._mainSession.getCallId(),toUserIds:e.toUserIds,dialogType:G.SWITCH_MEDIA_TYPE,action:j.REQUEST,extraKeyVal:r},t)]):[2,{code:c.NOT_IN_CALL}];case 1:return(n=o.sent().code)!==c.SUCCESS?[2,{code:n}]:[2,{code:c.SUCCESS,data:{transactionId:i}}]}})})}}),Object.defineProperty(r.prototype,"responseChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._mainSession?[2,this._signalModule.dialogUpCall({transactionId:e.transactionId,callId:this._mainSession.getCallId(),dialogType:G.SWITCH_MEDIA_TYPE,action:e.agree?j.ACCEPT:j.REFUSE},t)]:[2,{code:c.NOT_IN_CALL}]})})}}),Object.defineProperty(r.prototype,"cancelChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return this._mainSession?[2,this._signalModule.dialogUpCall({transactionId:e.transactionId,callId:this._mainSession.getCallId(),dialogType:G.SWITCH_MEDIA_TYPE,action:j.CANCEL},t)]:[2,{code:c.NOT_IN_CALL}]})})}}),Object.defineProperty(r.prototype,"getCallLogList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,u;return a(this,function(a){switch(a.label){case 0:return r=this._context.getCurrentId(),i=e.timestamp,n=e.count,o=e.order,[4,this._signalModule.syncCallLog({userId:r,syncTime:i,count:n,order:o},t)];case 1:return l=a.sent(),_=l.code,s=l.data,_!==c.SUCCESS?[2,{code:_}]:(u=s.callLogList.map(function(e){return f(e)}),[2,{code:c.SUCCESS,data:{hasMore:Boolean(null==s?void 0:s.hasMore),syncTime:0===o?s.maxTime:s.minTime,list:u}}])}})})}}),Object.defineProperty(r.prototype,"deleteCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r;return a(this,function(i){return r=this._context.getCurrentId(),[2,this._signalModule.deleteCallRecord(r,e,t)]})})}}),Object.defineProperty(r.prototype,"getCallServerTimestamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i;return a(this,function(n){switch(n.label){case 0:return[4,this._signalModule.getCallServerTimestamp(e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?[2,{code:r}]:[2,{code:r,data:i.syncTime}]}})})}}),Object.defineProperty(r.prototype,"getCallTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return[2,this._signalModule.getCallTimeInfo(e,t)]})})}}),Object.defineProperty(r.prototype,"getOpenCallList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o,l=this;return a(this,function(a){switch(a.label){case 0:return t=this._context.getCurrentId(),[4,this._signalModule.getUserCallStateList(e)];case 1:return r=a.sent(),i=r.code,n=r.data,i!==c.SUCCESS?[2,{code:i}]:(o=n.callStateList.map(function(r){var i=r.callId,n=r.callType,o=r.mediaType,a=r.callingUserId,_=r.callUserIds,s=r.callStatus,c=r.crtTime,u=r.userSessionStatus,C=r.startTime,d=r.syncTime,L=a===t?oe.OUT:oe.IN,E=l._timeCorrectioner.calcClientStartTime(i,C,e).clientStartTime,T=void 0===E?C:E;return{callId:i,callType:n,callDirection:L,mediaType:o,callerUserId:a,callUserIds:_,sessionState:s,userState:u,startTimestamp:C,endTimestamp:0,duration:Math.floor((+new Date-T)/1e3),syncTimestamp:d,systemState:0,createTimestamp:c}}),[2,{code:i,data:o}])}})})}}),Object.defineProperty(r.prototype,"removeAllCallLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return[4,this._signalModule.clearCallRecord(e)];case 1:return[2,{code:t.sent().code}]}})})}}),Object.defineProperty(r.prototype,"getCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,u,C,d,L,E,T,S;return a(this,function(a){switch(a.label){case 0:return[4,this._signalModule.getCallSession(e,t)];case 1:return r=a.sent(),i=r.code,n=r.data,i!==c.SUCCESS?[2,{code:i}]:(l=(o=n).callId,_=o.callingUserId,s=o.callType,u=o.mediaType,C=o.callStatus,d=o.callSessionUsers,L=o.startTime,E=o.duration,T=o.syncTime,S=d.map(function(e){return{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,targetType:e.targetType,targetId:e.targetId,cameraEnable:!1,microphoneEnable:!1}}),[2,{code:i,data:{callId:l,startCallerId:_,callType:s,mediaType:u,sessionState:C,callSessionUsers:S,startTime:L,duration:E,syncTime:T}}])}})})}}),Object.defineProperty(r.prototype,"getHoldSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._holdSessions.find(function(t){return t&&t.getCallId()===e});return t?new g(t,this,this._logger,this._rtcModule,this._context):null}}),Object.defineProperty(r.prototype,"getLocalMainSession",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._mainSession?new g(this._mainSession,this,this._logger,this._rtcModule,this._context):null}}),Object.defineProperty(r.prototype,"updateMainSessionState",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._mainSession)||void 0===t||t.updateSessionState(e)}}),Object.defineProperty(r.prototype,"setIsLocalClientHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._mainSession)||void 0===t||t.setIsLocalClientHangup(e)}}),Object.defineProperty(r.prototype,"updateUsersState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALL_ENGINE_UPDATE_USERS_STATE_O,"updateUsersState -> users: ".concat(JSON.stringify(t)),r);var i=_([this._mainSession],l(this._holdSessions),!1).find(function(t){return(null==t?void 0:t.getCallId())===e}),n=[];return i?n.push.apply(n,_([],l(i.updateUserList(t,r)),!1)):n.push.apply(n,_([],l(t),!1)),n}}),Object.defineProperty(r.prototype,"getCallStaringTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return[2,this._timeCorrectioner.getCallClientTimeByServer(e.callId,t)]})})}}),Object.defineProperty(r.prototype,"systemStatusUp",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){return a(this,function(r){return[2,this._signalModule.sysStatusUp(e,t)]})})}}),Object.defineProperty(r.prototype,"upFirstFrameTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return!this._mainSession||this._mainSession&&this._mainSession.getCallType()!==exports.RCCallPlusType.SINGLE||this._isUpFirstFrameTime?[2,{code:c.SUCCESS}]:(t=Date.now(),r=this._timeCorrectioner.getLocalDelayTime(),i=Math.floor(t+r),this._logger.info(s.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_T,"now: ".concat(t,"; delay: ").concat(r,"; streamReadyTime: ").concat(i),e),this._isUpFirstFrameTime=!0,n=this._mainSession.getCallId(),[4,this._signalModule.eventUpCall({callId:n,eventType:q.FIRST_FRAME,eventArgs:{streamReadyTime:i},eventTime:Date.now()},e)]);case 1:return o=a.sent().code,this._logger.info(s.L_CALL_ENGINE_UP_FIRST_FRAME_TIME_R,"code: ".concat(o),e),[2,{code:o}]}})})}}),Object.defineProperty(r.prototype,"endCurrentSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,n=this._context.getCurrentId();if(this._mainSession&&this._mainSession.getCallId()===t){var o=this._mainSession.getUserList().map(function(t){var r=t.userId,o=t.systemState,a=t.targetType,l=t.targetId;return r===n&&(o=e),{userId:r,sessionStatus:exports.RCCallPlusSessionUserState.ENDED,statusTime:Date.now(),duration:0,changed:1,inviteUserId:i._mainSession.getStartCallerId(),sysStatus:o,targetType:a,targetId:l}}),a={callId:this._mainSession.getCallId(),toDeviceId:this._signalModule.getDeviceId(),callStatus:exports.RCCallPlusCallState.ENDED,duration:0,callSessionUsers:o};this._onStatusDown(a,r)}}}),Object.defineProperty(r.prototype,"startTimeCorrection",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._timeCorrectioner.restart(e)}}),Object.defineProperty(r.prototype,"getDelayTimeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{delayTime:this._timeCorrectioner.getLocalDelayTime(),rtt:this._timeCorrectioner.getRTT()}}}),Object.defineProperty(r.prototype,"upgradeMainSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=this._holdSessions.findIndex(function(t){return t.getCallId()===e});this._mainSession=null===(t=this._holdSessions.splice(r,1))||void 0===t?void 0:t[0]}}),Object.defineProperty(r.prototype,"endCurrentUserAbnormalCalls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o=this;return a(this,function(a){switch(a.label){case 0:return t=this._context.getCurrentId(),[4,this._abnormalModule.getAbnormalCallIds(t)];case 1:return(r=a.sent())?(i=r.filter(function(e){var t;return e!==(null===(t=o._mainSession)||void 0===t?void 0:t.getCallId())}),[4,this._signalModule.endUserAbnormalCalls({callIds:i,allDevice:e?1:0})]):[2,{code:c.SUCCESS}];case 2:return(n=a.sent().code)===c.SUCCESS&&this._abnormalModule.removeAbnormalCallIds(t,i),[2,{code:n}]}})})}}),Object.defineProperty(r.prototype,"setRTCModule",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._rtcModule=e}}),Object.defineProperty(r.prototype,"_onIMStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this,i=this._logger.createTraceId(),n=0;t===e.RCConnectionStatus.DISCONNECTED&&this._mainSession&&this._mainSession.getSessionState()!==exports.RCCallPlusCallState.ONCALL&&(n=W(function(){var e;r._logger.info(s.L_CALL_ENGINE_IM_STATE_CHANGE_O,"endCurrentSession, IM disconnected for more than 60s",i),r.endCurrentSession(exports.RCCallPlusReason.CONNECTION_ERR,null===(e=r._mainSession)||void 0===e?void 0:e.getCallId(),i)},6e4)),t===e.RCConnectionStatus.CONNECTED&&(n&&clearTimeout(n),this._initOpts.isAllowNewCallWhenRinging&&this.endCurrentUserAbnormalCalls(!0))}}),Object.defineProperty(r.prototype,"_handleCallTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(s.L_CALL_ENGINE_CALL_TIMEOUT_O,"call timeout callId: ".concat(e,", userState: ").concat(t),r);var i=_([this._mainSession],l(this._holdSessions),!1).find(function(t){return t&&t.getCallId()===e});if(i){var n=this._context.getCurrentId();this._onStatusDown({callId:e,toDeviceId:this._signalModule.getDeviceId(),callStatus:exports.RCCallPlusCallState.ENDED,duration:0,callSessionUsers:i.getUserList().map(function(e){var r,o,a=e.userId,l=e.targetType,_=e.targetId,s=e.stateTime;return a===n?(r=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusReason.MISSED:exports.RCCallPlusReason.NO_ANSWER,o=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusSessionUserState.MISSED:exports.RCCallPlusSessionUserState.NO_ANSWER):(r=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusReason.NO_ANSWER:exports.RCCallPlusReason.MISSED,o=t===exports.RCCallPlusSessionUserState.MISSED?exports.RCCallPlusSessionUserState.NO_ANSWER:exports.RCCallPlusSessionUserState.MISSED),{userId:a,sessionStatus:o,statusTime:s?s+1:Date.now(),duration:0,changed:1,inviteUserId:i.getCallerId(),sysStatus:r,targetType:l,targetId:_}})},r)}else this._logger.warn(s.L_CALL_ENGINE_CALL_TIMEOUT_O,"handleCallTimeout without session, callId: ".concat(e),r)}}),Object.defineProperty(r.prototype,"_startTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,n=W(function(){i._handleCallTimeout(e,t,r),i._signalModule.statusUpCall({callId:e,sessionStatus:t},r)},6e4);return this._logger.info(s.L_CALL_ENGINE_START_CALL_TIMER_O,"callId: ".concat(e,", timerId: ").concat(n),r),n}}),Object.defineProperty(r.prototype,"_stopTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){clearTimeout(e),this._logger.info(s.L_CALL_ENGINE_STOP_CALL_TIMER_O,"timerId: ".concat(e),t)}}),Object.defineProperty(r.prototype,"_onInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._clientCallId=e.getUUID();var n=this._context.getCurrentId(),o=t.callSessionUsers,a=t.secretChat,l=t.extra,_=void 0===l?"{}":l;a!==V.SECRET?(o.some(function(e){return e.userId===n})&&this._selfIsInviteeHandle(t,r,i,_),this._othersIsInviteeHandle(t,i)):this.emit(F.onPubInviteCallMiss,Object.assign(t,{extra:JSON.stringify(t),reason:Y.SECRET_CALL,refer:r?J.PUB_INVITE:J.PULL_KV_INVITE}))}}),Object.defineProperty(r.prototype,"_selfIsInviteeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i,n){var o=e.callId,a=e.inviteUserId,l=e.callType,_=e.mediaType,s=e.callSessionUsers,c=this._context.getCurrentId();this._abnormalModule.addAbnormallCallId(c,o);var u=new B(o,exports.RCCallPlusCallState.RINGING,l,_,a,a,[],this._logger);this._signalModule.ringingCall({callId:o},i);var C=this._startTimer(o,exports.RCCallPlusSessionUserState.MISSED,i);u.updateTimerId(x.INVITEE,C),this._mainSession?(this._holdSessions.push(u),this._mainSession.updateSessionState(exports.RCCallPlusCallState.BUSYLINE_WAIT)):this._mainSession=u;var d=new g(u,this,this._logger,this._rtcModule,this._context),L=t?ne.PUB_INVITE_CALL:ne.PULL_KV_INVITE_CALL;this.emit(r.__INNER_INVITE__,d,L);var E=s.map(function(e){return{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,targetType:e.targetType,targetId:e.targetId,stateTime:e.statusTime}}),T=this.updateUsersState(o,E,i);this._reportAppEventModule.onReceivedCall(d,i,JSON.parse(n||"{}").extra),T.length>0&&this.reportRemoteUserStateChange(o,T,i)}}),Object.defineProperty(r.prototype,"_othersIsInviteeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,o=e.callId,a=e.inviteUserId,l=e.callSessionUsers,_=this._context.getCurrentId(),s=l.filter(function(e){return e.userId!==_&&e.userId!==a&&e.sessionStatus===exports.RCCallPlusSessionUserState.INVITED});if(s.length){(null===(r=this._mainSession)||void 0===r?void 0:r.getCallType())===exports.RCCallPlusType.SINGLE&&(null===(i=this._mainSession)||void 0===i?void 0:i.getCallId())===o&&(this._onCallTypeChange(this._mainSession.getCallId(),exports.RCCallPlusType.MULTI,t),null===(n=this._mainSession)||void 0===n||n.updateCallType(exports.RCCallPlusType.MULTI));var c=[],u=[];s.forEach(function(e){var t=e.userId,r=e.sessionStatus,i=e.sysStatus;c.push({callId:o,userId:t,userState:r}),u.push({userId:t,userState:r,systemState:i})}),this._onOtherMemberInvite(c);var C=this.updateUsersState(o,u,t);C.length>0&&this.reportRemoteUserStateChange(o,C,t)}}}),Object.defineProperty(r.prototype,"_onHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this;this._mainSession&&e.forEach(function(e){e.callId===i._mainSession.getCallId()&&(e.userState===exports.RCCallPlusSessionUserState.CANCELLED?i._stopTimer(i._mainSession.getInviteeTimerId(),r):i._stopTimer(i._mainSession.getInviterTimerId(),r))})}}),Object.defineProperty(r.prototype,"_onAccept",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var i,n,o,a,l=null===(i=this._mainSession)||void 0===i?void 0:i.getSessionState(),_=[exports.RCCallPlusCallState.CONNECTING,exports.RCCallPlusCallState.ONCALL,exports.RCCallPlusCallState.BUSYLINE_WAIT];if((null===(n=this._mainSession)||void 0===n?void 0:n.getCallType())!==exports.RCCallPlusType.SINGLE||!l||!_.includes(l)){var s=this._mainSession.getStartCallerId(),c=this._context.getCurrentId();if((null===(o=this._mainSession)||void 0===o?void 0:o.getCallType())===exports.RCCallPlusType.SINGLE&&s===c)e.filter(function(e){return e.fromUserId!==c})&&this.emit(r.__INNER_SESSION_CONNECT__,this.getLocalMainSession().getCallId(),t);null===(a=this._mainSession)||void 0===a||a.updateSessionState(exports.RCCallPlusCallState.CONNECTING),this._stopTimer(this._mainSession.getInviterTimerId(),t)}}}),Object.defineProperty(r.prototype,"_onStatusDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i;return o(this,void 0,void 0,function(){var n,o,l,_,s,c,u,C,d,L,E,T,S,g;return a(this,function(a){return n=e.callStatus,o=e.startTime,(l=e.callId)!==(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())?[2]:(this._callStartMap[l]=this._callStartMap[l]||{},this._callStartMap[l].isReceiveCallStartTime||n!==exports.RCCallPlusCallState.ONCALL||(this._callStartMap[l].isReceiveCallStartTime=!0,_=this._timeCorrectioner.calcClientStartTime(l,o,t),s=_.code,c=_.clientStartTime,s===X.SUCCESS&&(this._callStartMap[l].callStartTime=c,this._reportAppEventModule.onReceivedCallStartTime({callId:l,callStartTime:c},t))),u=!1,C=this._context.getCurrentId(),(d=e.callSessionUsers.map(function(e){return[exports.RCCallPlusSessionUserState.IDLE,exports.RCCallPlusSessionUserState.DECLINED,exports.RCCallPlusSessionUserState.MISSED,exports.RCCallPlusSessionUserState.NO_ANSWER,exports.RCCallPlusSessionUserState.CANCELLED].includes(e.sessionStatus)&&e.sysStatus!==exports.RCCallPlusReason.CANCELLED&&e.userId===C&&(u=!0),{userId:e.userId,userState:e.sessionStatus,systemState:e.sysStatus,stateTime:e.statusTime}})).length&&(L=this.updateUsersState(l,d,t)).length>0&&this.reportRemoteUserStateChange(l,L,t),this._mainSession||this._holdSessions.length?(E=function(e){var t=e.callId,r=[],i=[],n=[],o=[];return e.callSessionUsers.forEach(function(e){var a=e.userId,l=e.sessionStatus,_=e.sysStatus;switch(l){case exports.RCCallPlusSessionUserState.INVITED:o.push({callId:t,userId:a,userState:l});break;case exports.RCCallPlusSessionUserState.RINGING:r.push({callId:t,fromUserId:a});break;case exports.RCCallPlusSessionUserState.CONNECTING:n.push({fromUserId:a});break;case exports.RCCallPlusSessionUserState.CANCELLED:case exports.RCCallPlusSessionUserState.DECLINED:case exports.RCCallPlusSessionUserState.ENDED:case exports.RCCallPlusSessionUserState.IDLE:i.push({callId:t,fromUserId:a,userState:l,systemState:_})}}),{ringingData:r,hangupData:i,acceptData:n,otherInvitedData:o}}(e),T=E.hangupData,S=E.acceptData,g=E.otherInvitedData,T.length>0&&this._onHangup(T,e.callStatus,t),S.length>0&&this._onAccept(S,t),g.length>0&&(null===(i=this._mainSession)||void 0===i?void 0:i.getCallType())===exports.RCCallPlusType.MULTI&&this._onOtherMemberInvite(g),(e.callStatus===exports.RCCallPlusCallState.ENDED||u)&&this._onSessionClose(e,t,u),[2]):[2])})})}}),Object.defineProperty(r.prototype,"_onOtherClientStatusDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,o=e.callId,a=e.callSessionUsers,l=this._context.getCurrentId(),_=a.find(function(e){return e.userId===l});if(_&&(this._mainSession||this._holdSessions.length)){var s=_.userId,c=_.sessionStatus,u=_.statusTime;if(c===exports.RCCallPlusSessionUserState.CONNECTING){var C=[exports.RCCallPlusSessionUserState.ONCALL,exports.RCCallPlusSessionUserState.CONNECTING],d=(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())===o,L=null===(n=null===(i=this._mainSession)||void 0===i?void 0:i.getUserList().find(function(e){return e.userId===l}))||void 0===n?void 0:n.userState;if(!(d&&L&&C.includes(L))){var E=this.updateUsersState(o,[{userId:s,userState:c,systemState:exports.RCCallPlusReason.OTHER_CLIENT_ACCEPT,stateTime:u}],t);E.length>0&&this.reportRemoteUserStateChange(o,E,t),this._onSessionClose(e,t,!1)}}}}}),Object.defineProperty(r.prototype,"_onEventDown",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return o(this,void 0,void 0,function(){var i,n,o,l,_,c,u;return a(this,function(a){return i=e.callId,n=e.eventArgs,o=e.eventType,i!==(null===(r=this._mainSession)||void 0===r?void 0:r.getCallId())||this._mainSession.getSessionState()!==exports.RCCallPlusCallState.ONCALL||o===q.CALL_DURATION&&(l=n.firstFrameTime,_=this._timeCorrectioner.calcClientStartTime(i,l,t),c=_.code,u=_.clientStartTime,this._logger.info(s.L_CALL_ENGINE_RECEIVE_FIRST_FRAME_TIME_O,"clientFirstFrameTime: ".concat(u),t),c===X.SUCCESS&&(this._callStartMap[i].firstFrameTime=u,this._reportAppEventModule.onReceivedCallFirstFrameTime(i,u,t))),[2]})})}}),Object.defineProperty(r.prototype,"_onRecvSinCallDuration",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var o;(null===(o=this._mainSession)||void 0===o?void 0:o.getCallId())===e&&(this._callStartMap[e].callStartTime=t,this._callStartMap[e].firstFrameTime=r,this._reportAppEventModule.onReceivedCallStartTime(n({callId:e},{callStartTime:t}),i),this._reportAppEventModule.onReceivedCallFirstFrameTime(e,r,i))}}),Object.defineProperty(r.prototype,"_onSwitchMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n,o,a,l=e.callId,_=e.action,c=e.extraKeyVal,u=e.transactionId,C=e.promoterId,d=c.mediaType,L=c.reason,E=null===(r=this._mainSession)||void 0===r?void 0:r.getCallId();if(l===E){var T=(null===(i=this._mainSession)||void 0===i?void 0:i.getOldDialogData())||{},S=T.transactionId,g=T.action,I=T.mediaType;if(S!==u||g!==_||I!==d){if(this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"action: ".concat(_,", reason: ").concat(L),t),null===(n=this._mainSession)||void 0===n||n.setOldDialogData({transactionId:u,action:_,mediaType:d}),_===j.REQUEST)this._onRequestChangeMediaType({transactionId:u,userId:C,mediaType:d},t);else{var p=null;switch(L){case j.CANCEL:p=exports.RCCallPlusMediaTypeChangeResult.CANCEL_CHANGE_MEDIA_TYPE;break;case j.ACCEPT:p=exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE,null===(o=this._mainSession)||void 0===o||o.updateMediaType(this._mainSession.getReqMediaType()),null===(a=this._mainSession)||void 0===a||a.updateReqMediaType(null);break;case j.REFUSE:p=exports.RCCallPlusMediaTypeChangeResult.REFUSE_CHANGE_MEDIA_TYPE;break;case j.TIMEOUT:p=exports.RCCallPlusMediaTypeChangeResult.CHANGE_MEDIA_TYPE_TIMEOUT}exports.RCCallPlusMediaTypeChangeResult[p]&&this._receiveMediaTypeChangeResult({transactionId:u,userId:C,mediaType:d},p,t)}_!==j.NOTICE||d!==exports.RCCallPlusMediaType.AUDIO||L||this._receiveMediaTypeChangeResult({transactionId:u,userId:C,mediaType:d},exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE,t)}else this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"duplicate dialog data",t)}else this._logger.info(s.L_CALL_ENGINE_RECEIVE_MEDIATYPE_CHANGE_O,"not current session callId: ".concat(E,", recvCallId: ").concat(l),t)}}),Object.defineProperty(r.prototype,"_onRecvCallEndLog",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=f(e);this._reportAppEventModule.onReceivedCallRecord(r,t)}}),Object.defineProperty(r.prototype,"_onSessionClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){var n=this,o=e.callId,a=this._context.getCurrentId();this._abnormalModule.removeAbnormalCallIds(a,[o]);var c=_([this._mainSession],l(this._holdSessions),!1).find(function(e){return e&&e.getCallId()===o});if(c){this._logger.warn(s.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O,"callId: ".concat(o),t),this.emit(r.__INNER_SESSION_CLOSE__,o,t);var u,C=c.getUserList().find(function(e){return e.userId===a});u=i&&e.toDeviceId!==this._signalModule.getDeviceId()?c.getIsLocalClientHangup()?C.systemState:exports.RCCallPlusReason.OTHER_CLIENT_HANGUP:C.systemState,this._reportAppEventModule.onCallEnded(new g(c,this,this._logger,this._rtcModule,this._context),u,t),this._reportCallPlusSummaryMessage(c,o,u),this._mainSession&&this._mainSession.getCallId()===o&&(this._mainSession.getAllTimerIds().forEach(function(e){return n._stopTimer.bind(n)(e,t)}),c.getCallType()===exports.RCCallPlusType.SINGLE&&(this._isUpFirstFrameTime=!1),delete this._callStartMap[o]),this._removeSession(o)}else this._logger.warn(s.L_CALL_ENGINE_RECEIVE_CLOSE_SESSION_O,"unexpect session callId -> ".concat(o),t)}}),Object.defineProperty(r.prototype,"_reportCallPlusSummaryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n,o,a,l=this._context.getCurrentId(),_=t.getUserList().filter(function(e){return e.userId!==l})[0].userId,s=t.getStartCallerId();if(!localStorage.getItem("missMessageMap-".concat(l,"-").concat(r))){var c={callId:r,callerUserId:s,targetId:_,mediaType:t.getMediaType(),firstFrameTime:(null===(n=this._callStartMap[r])||void 0===n?void 0:n.firstFrameTime)||0,callStartTime:(null===(o=this._callStartMap[r])||void 0===o?void 0:o.callStartTime)||0,callEndTime:(null===(a=this._callStartMap[r])||void 0===a?void 0:a.callStartTime)?+new Date-this._timeCorrectioner.getLocalDelayTime():0,hangupReason:i};this._reportAppEventModule.onReceivedCallPlusSummaryMessage({messageType:"RC:CallPlusSummary",content:c,senderUserId:s,targetId:_,channelId:"",conversationType:e.ConversationType.PRIVATE,sentTime:+new Date-this._timeCorrectioner.getLocalDelayTime(),receivedTime:+new Date-this._timeCorrectioner.getLocalDelayTime(),messageUId:r,messageDirection:s===l?e.MessageDirection.SEND:e.MessageDirection.RECEIVE,isPersited:!0,isCounted:!1,isOffLineMessage:!1,canIncludeExpansion:!1,receivedStatus:e.ReceivedStatus.READ,isStatusMessage:!1,isMentioned:!1,expansion:null,disableNotification:!1,sentStatus:e.SentStatus.SENT}),localStorage.setItem("missMessageMap-".concat(l,"-").concat(r),r)}}}),Object.defineProperty(r.prototype,"_removeSession",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;if(e===(null===(t=this._mainSession)||void 0===t?void 0:t.getCallId()))this._mainSession=null;else{var r=this._holdSessions.findIndex(function(t){return(null==t?void 0:t.getCallId())===e});this._holdSessions.splice(r,1)}}}),Object.defineProperty(r.prototype,"_createSessionByServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return void 0===r&&(r=!1),o(this,void 0,void 0,function(){var i,n,o,l,_,u,C,d,L;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_T,"callId: ".concat(e),t),[4,this.getCallSession({callId:e},t)];case 1:return i=a.sent(),n=i.code,o=i.data,n!==c.SUCCESS?(this._logger.error(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R,"errcode: ".concat(n),t),[2]):(this._logger.info(s.L_CALL_ENGINE_CREATE_SESSION_BY_SERVER_R,"code: ".concat(n,", data: ").concat(JSON.stringify(o)),t),_=(l=o).callType,u=l.mediaType,C=l.callSessionUsers,d=l.startCallerId,this._mainSession=new B(e,exports.RCCallPlusCallState.CONNECTING,_,u,d,d,[],this._logger),r&&this._clearMobileOnPhone(e,t),(L=this.updateUsersState(e,C,t)).length>0&&this.reportRemoteUserStateChange(e,L,t),[2])}})})}}),Object.defineProperty(r.prototype,"_clearMobileOnPhone",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return(r=_([this._mainSession],l(this._holdSessions),!1).find(function(t){return(null==t?void 0:t.getCallId())===e}))&&r.getCallType()===exports.RCCallPlusType.MULTI?(this._logger.info(s.L_CALL_ENGINE_UP_ON_PHONE_END_T,"callId: ".concat(e),t),[4,this.systemStatusUp({callId:e,sysStatus:exports.RCCallPlusReason.ON_PHONE_END,forward:ie.CURRENT},t)]):[3,2];case 1:(i=n.sent().code)===c.SUCCESS?this._logger.info(s.L_CALL_ENGINE_UP_ON_PHONE_END_R,"callId: ".concat(e),t):this._logger.warn(s.L_CALL_ENGINE_UP_ON_PHONE_END_R,"callId: ".concat(e,", errCode: ").concat(i),t),n.label=2;case 2:return[2]}})})}}),Object.defineProperty(r.prototype,"reportRemoteUserStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){var n=this,o=this._context.getCurrentId();t.forEach(function(t){var r=t.userId,a=t.userState,l=t.systemState;r!==o&&n._reportAppEventModule.onRemoteUserStateChanged({callId:e,userId:r,userState:a,reason:l},i)}),t.forEach(function(t){var a=t.userId,l=t.systemState;a===o&&l===exports.RCCallPlusReason.ABNORMAL_END&&n.emit(r.__INNER_SESSION_CLOSE__,e,i)})}}),Object.defineProperty(r.prototype,"_onOtherMemberInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach(function(e){var r,i=e.userId,n=e.callId,o=null===(r=t.getLocalMainSession())||void 0===r?void 0:r.getInviterUserId();t._reportAppEventModule.onRemoteUserInvited([i],o,n)})}}),Object.defineProperty(r.prototype,"_onRequestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i=e.userId,n=e.transactionId,o=e.mediaType;null===(r=this._mainSession)||void 0===r||r.updateReqMediaType(o),this._reportAppEventModule.onReceivedChangeMediaTypeRequest(i,n,o,t)}}),Object.defineProperty(r.prototype,"_receiveMediaTypeChangeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,i){t===exports.RCCallPlusMediaTypeChangeResult.SERVER_ALLOW_MEDIA_TYPE&&this.emit(r.__INNER_CHANGE_MEDIA_TYPE__,e.mediaType,i),this._reportAppEventModule.onReceivedChangeMediaTypeResult(n(n({},e),{code:t}),i)}}),Object.defineProperty(r.prototype,"_onCallTypeChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._reportAppEventModule.onCallTypeChanged(t,e,r)}}),Object.defineProperty(r,"__INNER_SESSION_CLOSE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-session-close"}),Object.defineProperty(r,"__INNER_SESSION_CONNECT__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-session-connect"}),Object.defineProperty(r,"__INNER_CHANGE_MEDIA_TYPE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-change-media-type"}),Object.defineProperty(r,"__INNER_INVITE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-invite"}),r}(e.EventEmitter);!function(e){e.NORMAL="RongCloudRTC",e.SCREEN="ScreenShare"}(le||(le={}));var se,ce=function(r){function u(e,i,n,o,a,l){var _=r.call(this)||this;return Object.defineProperty(_,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(_,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(_,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(_,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(_,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(_,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:l}),Object.defineProperty(_,"_rtcClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(_,"_room",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_callId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(_,"_callMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(_,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}}),Object.defineProperty(_,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(_,"_isPubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_audioOutputDeviceId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(_,"_videoConfigIsChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_audioConfigIsChange",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(_,"_userViewMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(_,"_callPlusStatusReportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(_,"_remoteAudioEnable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(_,"_preHangupCallId",{enumerable:!0,configurable:!0,writable:!0,value:null}),_._rtcClient=null==n?void 0:n.rtcClient,_._isPubTiny=n.isPubTiny||!1,_}return i(u,r),Object.defineProperty(u.prototype,"setCallPlusStatusReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callPlusStatusReportListener=e}}),Object.defineProperty(u.prototype,"getCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return!(t=this.getLocalVideoTrack())||this._videoConfigIsChange?[3,1]:(o={track:t,code:c.SUCCESS},[3,3]);case 1:return[4,this._createVideoTrack(e)];case 2:o=a.sent(),a.label=3;case 3:return i=(r=o).code,n=r.track,this._videoConfigIsChange=!1,i!==c.SUCCESS?[2,{code:i}]:[2,{code:c.SUCCESS,track:n}]}})})}}),Object.defineProperty(u.prototype,"getMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return!(t=this.getLocalAudioTrack())||this._audioConfigIsChange?[3,1]:(o={track:t,code:c.SUCCESS},[3,3]);case 1:return[4,this._createAudioTrack(e)];case 2:o=a.sent(),a.label=3;case 3:return i=(r=o).code,n=r.track,this._audioConfigIsChange=!1,i!==c.SUCCESS?[2,{code:i}]:[2,{code:c.SUCCESS,track:n}]}})})}}),Object.defineProperty(u.prototype,"createCallMediaTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return this._callMediaType=e,[4,this.getMicrophoneAudioTrack(t)];case 1:return(r=n.sent().code)!==c.SUCCESS?[2,{code:r}]:e!==exports.RCCallPlusMediaType.AUDIO_VIDEO?[3,3]:[4,this.getCameraVideoTrack(t)];case 2:(i=n.sent().code)!==c.SUCCESS&&this._logger.warn(s.L_RTC_MODULE_CREATE_CALL_MEDIA_TRACKS_P,"get camera video track error code: ".concat(i),t),n.label=3;case 3:return[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(u.prototype,"setVideoConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._videoConfigIsChange=!0,this._videoConfig=e}}),Object.defineProperty(u.prototype,"setAudioConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioConfigIsChange=!0,this._audioConfig=e}}),Object.defineProperty(u.prototype,"setAudioOutputDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){return a(this,function(t){return"string"!=typeof e||0===e.length?[2,{code:c.PARAM_ERROR}]:(this._audioOutputDeviceId===e||(this._audioOutputDeviceId=e,this._room&&this._room.getRemoteTracks().filter(function(e){return e.isAudioTrack()}).forEach(function(t){t.isSubscribed()&&t.play(void 0,{audioDeviceId:e})})),[2,{code:c.SUCCESS}])})})}}),Object.defineProperty(u.prototype,"destroyAllTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_RTC_MODULE_DESTROY_ALL_TRACKS_O,"",e),this._localTracks.forEach(function(e){e.destroy()}),this._localTracks.length=0}}),Object.defineProperty(u.prototype,"setAllRemoteAudioEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return this._logger.info(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_T,"enable: ".concat(t),r),e.isBoolean(t)?(this._remoteAudioEnable=t,this._room?(this._room.getRemoteTracks().filter(function(e){return e.isAudioTrack()}).forEach(function(e){t?e.unmute():e.mute()}),this._logger.info(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R,"success",r),{code:c.SUCCESS}):{code:c.SUCCESS}):(this._logger.error(s.L_RTC_MODULE_SET_ALL_REMOTE_AUDIO_ENABLE_R,"param error, enable: type is boolean, value: ".concat(t)),{code:c.PARAM_ERROR})}}),Object.defineProperty(u.prototype,"destroyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return e.destroy(),t=this._localTracks.findIndex(function(t){return t.getTrackId()===e.getTrackId()}),this._localTracks.splice(t,1),[2]})})}}),Object.defineProperty(u.prototype,"sessionConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_;return a(this,function(a){switch(a.label){case 0:return this._preHangupCallId=null,this._logger.info(s.L_RTC_MODULE_SESSION_CONNECT_T,"callId: ".concat(e),t),this._room?[3,2]:[4,this.joinRTCRoom(e,t)];case 1:if(r=a.sent(),_=r.code,i=r.room,_!==c.SUCCESS)return[2];if(this._room=i,this._preHangupCallId&&this._room.getRoomId()===this._preHangupCallId)return this._rtcClient.leaveRoom(this._room),this._releaseStoredData(),[2];n=this._room.getRemoteUserIds(),this._onSelfJoined(e,n,t),a.label=2;case 2:return this._callId=e,this._regRTCListeners(),(o=this._room.getRemoteTracks())&&o.length&&this._onRemoteTrackPublish(o),this._localTracks.length>0?(this.emit(F.onBeforePublish),l=this._isPubTiny?this._localTracks.map(function(e){return e.isVideoTrack()?{track:e,isPubTiny:!0}:e}):this._localTracks,[4,this.publish(l,t)]):[3,4];case 3:return _=a.sent().code,this.emit(F.onPublishRes,_),[3,5];case 4:this._logger.warn(s.L_RTC_MODULE_SESSION_CONNECT_P,"sessionConnected local tracks is empty",t),a.label=5;case 5:return this._logger.info(s.L_RTC_MODULE_SESSION_CONNECT_R,"code: ".concat(c.SUCCESS),t),[2]}})})}}),Object.defineProperty(u.prototype,"sessionClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){var i;return o(this,void 0,void 0,function(){var n,o;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_SESSION_CLOSE_T,"callId: ".concat(e),r),this._preHangupCallId=e,this.destroyAllTracks(r),n=null===(i=this._room)||void 0===i?void 0:i.getRoomId(),this._room&&e===n?[4,this._rtcClient.leaveRoom(this._room)]:[3,2];case 1:return o=a.sent().code,this._releaseStoredData(),o!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom failed, code: ".concat(o),r),[2]):(this._logger.info(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom success",r),[3,3]);case 2:this._logger.warn(s.L_RTC_MODULE_SESSION_CLOSE_R,"leaveRoom throw exception: not in room",r),a.label=3;case 3:return[2]}})})}}),Object.defineProperty(u.prototype,"disableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return(e=this.getLocalVideoTrack())?[4,e.mute()]:[2,{code:c.CAMERA_CLOSED}];case 1:return[2,{code:t.sent(),track:e}]}})})}}),Object.defineProperty(u.prototype,"enableVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return(e=this.getLocalVideoTrack())?e.isOwnerMuted()?[4,e.unmute()]:[2,{code:c.SUCCESS}]:[2,{code:c.CAMERA_CLOSED}];case 1:return[2,{code:t.sent()}]}})})}}),Object.defineProperty(u.prototype,"changeVideoDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,s,u,C,d;return a(this,function(a){switch(a.label){case 0:return r=[],i=[],[4,this._rtcClient.createCameraVideoTrack(le.NORMAL,this._videoConfig)];case 1:return n=a.sent(),o=n.code,l=n.track,o!==t.RCRTCCode.SUCCESS?[2,{code:o}]:(_=this._videoConfig,s=_.minBitrate,u=_.maxBitrate,(s||u)&&l.setBitrate(u,s),this._localTracks&&this._localTracks.forEach(function(e){e.isVideoTrack()?(e.destroy(),C=e):i.push(e)}),this._localTracks=this._localTracks.filter(function(e){return C&&e.getTrackId()!==C.getTrackId()}),r.push(l),i.push(l),this._localTracks=i,this._onLocalTrackReady(r,e),this._room?[4,this._room.publish(r)]:[3,3]);case 2:if((d=a.sent().code)!==t.RCRTCCode.SUCCESS)return[2,{code:d}];a.label=3;case 3:return[2,{code:c.SUCCESS,track:l}]}})})}}),Object.defineProperty(u.prototype,"changeAudioDevice",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,o,l,_,s,u;return a(this,function(a){switch(a.label){case 0:return r=[],i=[],o=n(n({},this._audioConfig),{micphoneId:this._audioConfig.microphoneId}),[4,this._rtcClient.createMicrophoneAudioTrack(le.NORMAL,o)];case 1:return l=a.sent(),_=l.code,s=l.track,_!==t.RCRTCCode.SUCCESS?[2,{code:_}]:(this._localTracks&&this._localTracks.forEach(function(e){e.isAudioTrack()||i.push(e)}),r.push(s),i.push(s),this._localTracks=i,this._onLocalTrackReady(r,e),this._room?[4,this._room.publish(r)]:[3,3]);case 2:if((u=a.sent().code)!==t.RCRTCCode.SUCCESS)return[2,{code:u}];a.label=3;case 3:return[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(u.prototype,"disableAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return(e=this.getLocalAudioTrack())?[4,e.mute()]:[2,{code:c.MICROPHONE_CLOSED}];case 1:return[2,{code:t.sent(),track:e}]}})})}}),Object.defineProperty(u.prototype,"changeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return o(this,void 0,void 0,function(){var r;return a(this,function(i){switch(i.label){case 0:return this._logger.info(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_T,"mediaType: ".concat(e),t),e!==exports.RCCallPlusMediaType.AUDIO_VIDEO?[3,2]:[4,this._upgradeMediaType(t)];case 1:return r=i.sent(),[3,4];case 2:return[4,this._downgradeMediaType(t)];case 3:r=i.sent(),i.label=4;case 4:return r.code===c.SUCCESS&&this._logger.info(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"success",t),[2]}})})}}),Object.defineProperty(u.prototype,"_upgradeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t,r,i,n,o,l,_,u,C;return a(this,function(a){switch(a.label){case 0:return(t=this.getLocalVideoTrack())?[3,2]:[4,this._createVideoTrack(e)];case 1:if(r=a.sent(),i=r.code,n=r.track,i!==c.SUCCESS)return this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"create video track errCode: ".concat(i),e),[2,{code:i}];t=n,o=this._videoConfig,l=o.minBitrate,_=o.maxBitrate,(l||_)&&t.setBitrate(_,l),a.label=2;case 2:return u=this._isPubTiny?{track:t,isPubTiny:!0}:t,[4,this.publish([u],e)];case 3:return(C=a.sent().code)!==c.SUCCESS&&this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"publish errCode: ".concat(C),e),[2,{code:C}]}})})}}),Object.defineProperty(u.prototype,"_downgradeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return(r=this.getLocalVideoTrack())?[4,this._room.unpublish([r])]:[3,2];case 1:if((i=n.sent().code)!==t.RCRTCCode.SUCCESS)return this._logger.error(s.L_RTC_MODULE_CHANGE_MEDIA_TYPE_R,"unpublish errCode: ".concat(i),e),[2,{code:i}];this.destroyTrack(r),n.label=2;case 2:return[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(u.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(r,i){return o(this,void 0,void 0,function(){var n,o,l,_;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_JOIN_RTC_ROOM_T,"call: ".concat(r),i),[4,Q({asyncFn:this._rtcClient.joinRTCRoomWithOptions.bind(this._rtcClient),fnArgs:[r,{mode:e.RTCMode.CALL}]})];case 1:return n=a.sent(),o=n.code,l=n.room,_=n.tracks,o!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_JOIN_RTC_ROOM_R,"callId: ".concat(r,", errCode: ").concat(o),i),this._onRTCMethodFail(exports.RCCallPlusReason.JOIN_ROOM_ERR,i),[2,{code:o}]):(this._logger.info(s.L_RTC_MODULE_JOIN_RTC_ROOM_R,"success",i),this._callId=r,[2,{code:c.SUCCESS,room:l,tracks:_}])}})})}}),Object.defineProperty(u.prototype,"subscribeTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return o(this,void 0,void 0,function(){var i;return a(this,function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_SUBSCRIBE_T,JSON.stringify({params:e.map(function(e){var t=e.track,r=e.subTiny;return{trackId:t.getTrackId(),subTiny:r}})}),r),this._room?[4,Q({asyncFn:this._room.subscribe.bind(this._room),fnArgs:[e],onError:function(e){}})]:[2,{code:c.SUCCESS}];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._reportAppEventModule.onFetchRemoteMediaError(e,i),this._onRTCMethodFail(exports.RCCallPlusReason.SUBSCRIBE_ERR,r),this._logger.error(s.L_RTC_MODULE_SUBSCRIBE_R,"errorCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_SUBSCRIBE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(u.prototype,"unsubscribeTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return o(this,void 0,void 0,function(){var i;return a(this,function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_UNSUBSCRIBE_T,JSON.stringify({trackIds:e.map(function(e){return e.getTrackId()})}),r),this._room?[4,this._room.unsubscribe(e)]:[2,{code:c.SUCCESS}];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_UNSUBSCRIBE_R,"errorCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_UNSUBSCRIBE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(u.prototype,"_releaseStoredData",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._room=null,this._remoteAudioEnable=!0,this._userViewMap={},this._preHangupCallId=null}}),Object.defineProperty(u.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t={};return this._room?(this._room.getRemoteUserIds().forEach(function(r){t[r]=e._room.getRemoteTracksByUserId(r)}),t):t}}),Object.defineProperty(u.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return null===(r=this._room)||void 0===r?void 0:r.getRemoteTracksByUserId(e).find(function(e){return t===exports.RCCallPlusMediaType.AUDIO?e.isAudioTrack():e.isVideoTrack()})}}),Object.defineProperty(u.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._room?this._room.getSessionId():null}}),Object.defineProperty(u.prototype,"_regRTCListeners",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._room.registerRoomEventListener({onKickOff:function(t,r){e._onKickOff(t,e._room.getRoomId(),r),e._releaseStoredData()},onUserJoin:function(t){var r=t.map(function(t){return{callId:e._callId,userId:t}}),i=e._logger.createTraceId();e._onOtherMemJoined(r,i)},onUserLeave:function(t){t.forEach(function(t){delete e._userViewMap[t]})},onTrackPublish:this._onRemoteTrackPublish.bind(this),onTrackUnpublish:this._onTrackUnpublish.bind(this),onTrackReady:function(t){e._onRemoteTrackReady([t])},onVideoMuteChange:function(t){e._onVideoMuteChagne({fromUserId:t.getUserId(),muted:t.isOwnerMuted(),trackId:t.getTrackId()})},onAudioMuteChange:function(t){e._onAudioMuteChange({fromUserId:t.getUserId(),muted:t.isOwnerMuted(),trackId:t.getTrackId()})},onRTCPeerConnectionCloseByException:this._onRTCPeerConnectionCloseByException.bind(this)}),this._room.registerReportListener({onStateReport:this._onRTCStateReport.bind(this)}),this._room.onAudioLevelChange(function(t){e._reportAppEventModule.onUserAudioLevelChanged(t)})}}),Object.defineProperty(u.prototype,"_onLocalTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._reportAppEventModule.onUserMediaAvailable(e,t)}}),Object.defineProperty(u.prototype,"_onRemoteTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportAppEventModule.onUserMediaAvailable(e),this.emit(u.__INNER_RECEIVE_FIRST_FRAME__)}}),Object.defineProperty(u.prototype,"_onKickOff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n){this._logger.info(s.L_RTC_MODULE_RECEIVE_KICK_OFF_O,"roonId: ".concat(r,", byServer: ").concat(e,", state: ").concat(i,", kickExtra: ").concat(JSON.stringify(n)));var o=exports.RCCallPlusReason.CONNECTION_ERR;if(e)if(n)o=n.kickReasonCode;else switch(i){case t.RCKickReason.SERVER_KICK:o=exports.RCCallPlusReason.KICKED_BY_SERVER;break;case t.RCKickReason.OTHER_KICK:o=exports.RCCallPlusReason.OTHER_CLIENT_JOINED;break;case t.RCKickReason.IM_DISCONNECTED:o=exports.RCCallPlusReason.CONNECTION_ERR;break;case t.RCKickReason.IM_LOGOUT:o=exports.RCCallPlusReason.LOGOUT;break;case t.RCKickReason.OTHER_CLIENT_IM_CONNECTED:o=exports.RCCallPlusReason.OTHER_CLIENT_LOGIN}this.emit(u.__INNER_ON_KICKOFF__,o,r)}}),Object.defineProperty(u.prototype,"_onRTCPeerConnectionCloseByException",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_PEERCONNECTION_EXCEPT_CLOSE_O,"",e),this.emit(u.__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__,e)}}),Object.defineProperty(u.prototype,"_onSelfJoined",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return o(this,void 0,void 0,function(){return a(this,function(i){return this.emit(u.__INNER_ON_SELF_JOINED__,e,t,r),[2]})})}}),Object.defineProperty(u.prototype,"_onRemoteTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_PUBLISH_O,JSON.stringify({callId:this._callId,trackIds:e.map(function(e){return e.getTrackId()})}),r);var i=[];e.forEach(function(e){var r,n=e.getUserId();if(e.isAudioTrack())i.push({track:e,subTiny:!1}),t._reportAppEventModule.onRemoteMicrophoneStateChanged(t._callId,e);else if(t._reportAppEventModule.onRemoteCameraStateChanged(t._callId,e),null===(r=t._userViewMap[n])||void 0===r?void 0:r.videoView){var o=t._userViewMap[n].isTiny;i.push({track:e,subTiny:o})}}),i.length&&this.subscribeTracks(i,r)}}),Object.defineProperty(u.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_UNPUBLISH_O,JSON.stringify({callId:this._callId,trackIds:e.map(function(e){return e.getTrackId()})}),t),[4,this.unsubscribeTracks(e,t)];case 1:return r.sent(),[2]}})})}}),Object.defineProperty(u.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O,JSON.stringify({info:e}),t);var r=this._room.getRemoteTrack(e.trackId);this._reportAppEventModule.onRemoteMicrophoneStateChanged(this._callId,r)}}),Object.defineProperty(u.prototype,"_onVideoMuteChagne",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._logger.createTraceId();this._logger.info(s.L_RTC_MODULE_RECEIVE_TRACK_ENABLE_CHANGE_O,JSON.stringify({info:e}),t);var r=this._room.getRemoteTrack(e.trackId);this._reportAppEventModule.onRemoteCameraStateChanged(this._callId,r)}}),Object.defineProperty(u.prototype,"_onRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this,i=e.senders,n=e.receivers;i.forEach(function(e){var t,i=e.kind,n=e.packetsLostRate,o=e.rtt;r._callMediaType===exports.RCCallPlusMediaType.AUDIO_VIDEO&&"audio"===i||null===(t=r._callPlusStatusReportListener)||void 0===t||t.onSendPacketLoss(n||0,o||0)}),n.forEach(function(e){var i,n=e.trackId,o=e.kind,a=e.packetsLostRate,l=e.bitrate;if(r._callMediaType!==exports.RCCallPlusMediaType.AUDIO_VIDEO||"audio"!==o){var _={};_[t.helper.parseTrackId(n).userId]={packetLostRate:a||0,bitRate:l},null===(i=r._callPlusStatusReportListener)||void 0===i||i.onReceivePacketLoss(_)}})}}),Object.defineProperty(u.prototype,"_onRTCMethodFail",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(u.__INNER_RTC_PROCESS_FAILED__,e,t)}}),Object.defineProperty(u.prototype,"_onOtherMemJoined",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(u.__INNER_ON_OTHER_JOINED__,e,t)}}),Object.defineProperty(u.prototype,"_createAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_T,"",e),r=Object.assign(this._audioConfig,{micphoneId:this._audioConfig.microphoneId}),[4,this._rtcClient.createMicrophoneAudioTrack(le.NORMAL,r)];case 1:return i=a.sent(),n=i.code,o=i.track,n!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_R,"errCode: ".concat(n),e),[2,{code:n}]):(this._logger.info(s.L_RTC_MODULE_CREATE_AUDIO_TRACK_R,"success",e),l=this._audioConfig,_=l.minBitrate,u=l.maxBitrate,(_||u)&&o.setBitrate(u,_),this._localTracks.push(o),this._onLocalTrackReady([o],e),[2,{code:c.SUCCESS,track:o}])}})})}}),Object.defineProperty(u.prototype,"_createVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var r,i,n,o,l,_;return a(this,function(a){switch(a.label){case 0:return this._logger.info(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_T,"",e),[4,this._rtcClient.createCameraVideoTrack(le.NORMAL,this._videoConfig)];case 1:return r=a.sent(),i=r.code,n=r.track,i!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_R,"errCode: ".concat(i),e),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_CREATE_VIDEO_TRACK_R,"success",e),o=this._videoConfig,l=o.minBitrate,_=o.maxBitrate,(l||_)&&n.setBitrate(_,l),this._localTracks.push(n),this._onLocalTrackReady([n],e),[2,{code:c.SUCCESS,track:n}])}})})}}),Object.defineProperty(u.prototype,"getLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return this._localTracks&&(e=l(this._localTracks.filter(function(e){return e.isVideoTrack()}),1)[0]),e}}),Object.defineProperty(u.prototype,"getLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return this._localTracks&&(e=l(this._localTracks.filter(function(e){return e.isAudioTrack()}),1)[0]),e}}),Object.defineProperty(u.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r){return o(this,void 0,void 0,function(){var i;return a(this,function(n){switch(n.label){case 0:return this._logger.info(s.L_RTC_MODULE_PUBLISH_T,"tracksIds: ".concat(e.map(function(e){return e instanceof t.RCLocalTrack?e.getTrackId():e.track.getTrackId()})),r),[4,Q({asyncFn:this._room.publish.bind(this._room),fnArgs:[e],onError:function(e){}})];case 1:return(i=n.sent().code)!==t.RCRTCCode.SUCCESS?(this._onRTCMethodFail(exports.RCCallPlusReason.PUBLISH_ERR,r),this._logger.error(s.L_RTC_MODULE_PUBLISH_R,"errCode: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_RTC_MODULE_PUBLISH_R,"code: ".concat(c.SUCCESS),r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(u.prototype,"publishVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getLocalVideoTrack(),t=this._isPubTiny?{track:e,isPubTiny:!0}:e;return this._room.publish([t])}}),Object.defineProperty(u.prototype,"setVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];e.forEach(function(e){var t=e.userId,n=e.videoElement,o=e.isTiny,a=void 0!==o&&o;if(r._userViewMap[t]={videoView:n,isTiny:a},t!==r._context.getCurrentId()&&r._room){var s=(r.getRemoteTracks()[t]||[]).map(function(e){return{track:e,subTiny:a}});i.push.apply(i,_([],l(s),!1))}}),this._logger.info(s.L_RTC_MODULE_SET_VIDEO_VIEW_O,JSON.stringify({userViewMap:A(this._userViewMap),needSubTrackIds:i.map(function(e){return e.track.getTrackId()})}),t),i.length&&this.subscribeTracks(i,t)}}),Object.defineProperty(u.prototype,"removeVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=[];e.forEach(function(e){var t=r.getRemoteTracks()[e];if(t&&t.length){var n=t.filter(function(e){return e.isVideoTrack()});n.length&&i.push(n[0])}delete r._userViewMap[e]}),this._logger.info(s.L_RTC_MODULE_REMOVE_VIDEO_VIEW_O,JSON.stringify({userViewMap:A(this._userViewMap),unsubTracks:i.map(function(e){return e.getTrackId()})}),t),i.length&&this.unsubscribeTracks(i,t)}}),Object.defineProperty(u.prototype,"getUserViewMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userViewMap}}),Object.defineProperty(u.prototype,"playMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n){var l;return o(this,void 0,void 0,function(){var o,_,u,C,d;return a(this,function(a){switch(a.label){case 0:if(this._logger.info(s.L_RTC_MODULE_PLAY_MEDIA_T,"userId: ".concat(e,", mediaType: ").concat(r,", videoView: ").concat(null==i?void 0:i.nodeName),n),o=this._context.getCurrentId(),e===o&&r===exports.RCCallPlusMediaType.AUDIO)return this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"please avoid playing local audio to prevent echoes.",n),[2,{code:c.PLAY_MEDIA_FAILED}];if(_=null,!(_=e===o?r===exports.RCCallPlusMediaType.AUDIO?null:this.getLocalVideoTrack():null===(l=this.getRemoteTracks()[e])||void 0===l?void 0:l.filter(function(e){return r===exports.RCCallPlusMediaType.AUDIO?e.isAudioTrack():e.isVideoTrack()})[0]))return this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"error code: ".concat(c.MEDIA_RESOURCE_INVALIED),n),[2,{code:c.MEDIA_RESOURCE_INVALIED}];a.label=1;case 1:return a.trys.push([1,6,,7]),_.isAudioTrack()?[4,_.play(void 0,{audioDeviceId:this._audioOutputDeviceId||void 0})]:[3,3];case 2:return C=a.sent(),[3,5];case 3:return[4,_.play(i)];case 4:C=a.sent(),a.label=5;case 5:return u=C.code,_.isAudioTrack()&&!this._remoteAudioEnable&&_.mute(),u!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"errCode: ".concat(u),n),[2,{code:u}]):(this._logger.info(s.L_RTC_MODULE_PLAY_MEDIA_R,"success",n),[2,{code:c.SUCCESS}]);case 6:return d=a.sent(),this._logger.error(s.L_RTC_MODULE_PLAY_MEDIA_R,"errCode: ".concat(c.PLAY_MEDIA_FAILED,", message: ").concat(d.message,","),n),[2,{code:c.PLAY_MEDIA_FAILED}];case 7:return[2]}})})}}),Object.defineProperty(u,"__INNER_RTC_PROCESS_FAILED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-rtc-process-failed"}),Object.defineProperty(u,"__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-rtc-peerconnection-abnormal-close"}),Object.defineProperty(u,"__INNER_ON_SELF_JOINED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-on-self-joined"}),Object.defineProperty(u,"__INNER_ON_OTHER_JOINED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-on-other-joined"}),Object.defineProperty(u,"__INNER_RECEIVE_FIRST_FRAME__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-receive-first-frame"}),Object.defineProperty(u,"__INNER_ON_KICKOFF__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-kickoff-frame"}),u}(e.EventEmitter),ue=function(){function e(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_listener",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}return Object.defineProperty(e.prototype,"registerEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._listener=e}}),Object.defineProperty(e.prototype,"_callAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){switch(o.label){case 0:if(!(i=null===(t=this._listener)||void 0===t?void 0:t[e]))return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,i.apply(void 0,_([],l(r),!1))];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),console.error(n),this._logger.error(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({name:n.name,message:n.message})),[3,4];case 4:return[2]}})})}}),Object.defineProperty(e.prototype,"onReceivedCall",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCall",callId:e.getCallId()}),t),this._callAppListener("onReceivedCall",e,r)}}),Object.defineProperty(e.prototype,"onRemoteUserInvited",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteUserInvited",inviteeUserList:e,inviterUserId:t,callId:r})),this._callAppListener("onRemoteUserInvited",e,t,r)}}),Object.defineProperty(e.prototype,"onCallConnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallConnected",callId:e.getCallId()})),this._callAppListener("onCallConnected",e)}}),Object.defineProperty(e.prototype,"onCallTypeChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallTypeChanged",callId:t,callType:e}),r),this._callAppListener("onCallTypeChanged",e,t)}}),Object.defineProperty(e.prototype,"onRemoteUserStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.callId,i=e.userId,n=e.userState,o=e.reason;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteUserStateChanged",callId:r,userId:i,userState:n,reason:o}),t),this._callAppListener("onRemoteUserStateChanged",r,i,n,o)}}),Object.defineProperty(e.prototype,"onCallEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onCallEnded",callId:e.getCallId(),closeReason:t}),r),this._callAppListener("onCallEnded",e,t)}}),Object.defineProperty(e.prototype,"onRemoteCameraStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteCameraStateChanged",callId:e,trackId:null==t?void 0:t.getTrackId(),enable:null==t?void 0:t.isOwnerMuted()}));var r=null==t?void 0:t.getUserId();this._callAppListener("onRemoteCameraStateChanged",e,r,null==t?void 0:t.isOwnerMuted())}}),Object.defineProperty(e.prototype,"onRemoteMicrophoneStateChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onRemoteMicrophoneStateChanged",callId:e,trackId:null==t?void 0:t.getTrackId(),enable:null==t?void 0:t.isOwnerMuted()}));var r=null==t?void 0:t.getUserId();this._callAppListener("onRemoteMicrophoneStateChanged",e,r,null==t?void 0:t.isOwnerMuted())}}),Object.defineProperty(e.prototype,"onReceivedCallRecord",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallRecord",record:e}),t),this._callAppListener("onReceivedCallRecord",e)}}),Object.defineProperty(e.prototype,"onReceivedChangeMediaTypeRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedChangeMediaTypeRequest",userId:e,transactionId:t}),i),this._callAppListener("onReceivedChangeMediaTypeRequest",e,t,r)}}),Object.defineProperty(e.prototype,"onReceivedChangeMediaTypeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.userId,i=e.transactionId,n=e.mediaType,o=e.code;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedChangeMediaTypeResult",userId:r,mediaType:n}),t),this._callAppListener("onReceivedChangeMediaTypeResult",{userId:r,transactionId:i,mediaType:n,code:o})}}),Object.defineProperty(e.prototype,"onReceivedCallStartTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallStartTime",info:e}),t),this._callAppListener("onReceivedCallStartTime",e)}}),Object.defineProperty(e.prototype,"onReceivedCallFirstFrameTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onReceivedCallFirstFrameTime",callId:e,callFirstFrameTime:t}),r),this._callAppListener("onReceivedCallFirstFrameTime",e,t)}}),Object.defineProperty(e.prototype,"onUserMediaAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;this._logger.info(s.L_CALLPLUS_CLIENT_CALL_EVENT_LISTENER_O,JSON.stringify({eventType:"onUserMediaAvailable",trackIds:e.map(function(e){return e.getTrackId()})}),t),e.forEach(function(e){var t=e.getUserId(),i=e.isAudioTrack()?exports.RCCallPlusMediaType.AUDIO:exports.RCCallPlusMediaType.VIDEO;r._callAppListener("onUserMediaAvailable",t,i)})}}),Object.defineProperty(e.prototype,"onFetchRemoteMediaError",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach(function(e){var i=e.track.getUserId();r._callAppListener("onFetchRemoteMediaError",i,t)})}}),Object.defineProperty(e.prototype,"onUserAudioLevelChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach(function(e){var r=e.track,i=e.audioLevel,n=r.getUserId();t._callAppListener("onUserAudioLevelChanged",n,i)})}}),Object.defineProperty(e.prototype,"onReceivedCallPlusSummaryMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callAppListener("onReceivedCallPlusSummaryMessage",e)}}),Object.defineProperty(e.prototype,"onReceivedGroupCallStatusMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._callAppListener("onReceivedGroupCallStatusMessage",e)}}),e}();!function(e){e[e.UNKNOW_ERR=41e3]="UNKNOW_ERR",e[e.DB_ERR=41001]="DB_ERR",e[e.JSON_ERR=41002]="JSON_ERR",e[e.INVALID_JSON_ERR=41003]="INVALID_JSON_ERR",e[e.MISSING_PARAMS=41004]="MISSING_PARAMS",e[e.PARAMS_REQUIRED=41005]="PARAMS_REQUIRED",e[e.DATA_FORMAT_ERR=41006]="DATA_FORMAT_ERR",e[e.METHOD_NOT_IMPLEMENTED=41007]="METHOD_NOT_IMPLEMENTED",e[e.CALL_NOT_EXIST=41010]="CALL_NOT_EXIST",e[e.SINGAL_EXCEED_TWO_INVITEE=41011]="SINGAL_EXCEED_TWO_INVITEE",e[e.GROUP_EXCEEDS_QUORUM=41012]="GROUP_EXCEEDS_QUORUM",e[e.OPERATION_EXPIRED=41013]="OPERATION_EXPIRED",e[e.DEVICE_IS_CALLING=41014]="DEVICE_IS_CALLING",e[e.REPORT_STREAM_READY_TIME_IS_INVALID=41018]="REPORT_STREAM_READY_TIME_IS_INVALID",e[e.NOT_CALL_YOURSELF=41019]="NOT_CALL_YOURSELF",e[e.SESSION_STATUS_NOT_EXIST=41020]="SESSION_STATUS_NOT_EXIST",e[e.HANGUP_NOT_ALLOW=41021]="HANGUP_NOT_ALLOW",e[e.ACCEPT_NOT_ALLOW=41022]="ACCEPT_NOT_ALLOW",e[e.OPERATION_NOT_ALLOW=41025]="OPERATION_NOT_ALLOW",e[e.TRANSACTION_ID_ERR=41100]="TRANSACTION_ID_ERR",e[e.UP_VIDEO_CANCELED=41050]="UP_VIDEO_CANCELED",e[e.CURRENT_CALL_IS_AUDIO=41051]="CURRENT_CALL_IS_AUDIO",e[e.CURRENT_CALL_IS_VIDEO=41052]="CURRENT_CALL_IS_VIDEO"}(se||(se={}));var Ce=function(){function t(e){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_androidPushConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(t.prototype,"setChannelIdMi",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdMi=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdMi type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setMiLargeIconUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._logger.warn(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"`setMiLargeIconUrl` has been deprecated."),this}}),Object.defineProperty(t.prototype,"setChannelIdHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setCategoryHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.categoryHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: categoryHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setImportanceHW",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"LOW"!==e&&"NORMAL"!==e?(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: importanceHW value is NORMAL|LOW, value: ".concat(e)),this):(this._androidPushConfig.importanceHW=e,this)}}),Object.defineProperty(t.prototype,"setImageUrlHW",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.imageUrlHW=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: imageUrlHW type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setChannelIdOPPO",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.channelIdOPPO=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: channelIdOPPO type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setTypeVivo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.typeVivo=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: typeVivo type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setCategoryVivo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.categoryVivo=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: categoryVivo type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmChannelId",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmChannelId=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmChannelId type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmCollapseKey",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmCollapseKey=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmCollapseKey type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setFcmImageUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.fcmImageUrl=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: fcmImageUrl type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"setimportanceHonor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"LOW"!==e&&"NORMAL"!==e?(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: importanceHonor value is NORMAL|LOW, value: ".concat(e)),this):(this._androidPushConfig.importanceHonor=e,this)}}),Object.defineProperty(t.prototype,"setimageUrlHonor",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isString(t)?(this._androidPushConfig.imageUrlHonor=t,this):(this._logger.error(s.L_CALLPLUS_SET_ANDROID_PUSH_CONFIG_O,"errorMsg: imageUrlHonor type is string, value: ".concat(t)),this)}}),Object.defineProperty(t.prototype,"build",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._androidPushConfig}}),t}(),de=function(){function r(e,r,i,n){var o=this;Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_initOpts",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_videoConfig",{enumerable:!0,configurable:!0,writable:!0,value:{resolution:t.RCResolution.W640_H480,frameRate:t.RCFrameRate.FPS_15}}),Object.defineProperty(this,"_audioConfig",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_callPlusStatistics",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clientCallId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_isLaunchHangup",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_needHangupCallId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_callEngine",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rtcModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportAppEventModule",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._context.registerMessageType("RC:CallPlusMiss",!0,!1,[]),this._reportAppEventModule=new ue(r),this._callPlusStatistics=new H(this._logger,this._context),this._callEngine=new _e(this._context,this._runtime,this._initOpts,this._logger,this._reportAppEventModule),this._rtcModule=new ce(this._context,this._runtime,this._initOpts,this._logger,this._callEngine,this._reportAppEventModule),this._callEngine.setRTCModule(this._rtcModule),this._rtcModule.on(ce.__INNER_RTC_PROCESS_FAILED__,this._rtcProcessFailHandle.bind(this)),this._rtcModule.on(ce.__INNER_RTC_PEERCONNECTION_ABNORMAL_CLOSE__,this._peerConnectionAbnormalClose.bind(this)),this._rtcModule.on(ce.__INNER_ON_SELF_JOINED__,this._selfJoinedHandle.bind(this)),this._rtcModule.on(ce.__INNER_ON_OTHER_JOINED__,this._otherJoinedHandle.bind(this)),this._rtcModule.on(ce.__INNER_RECEIVE_FIRST_FRAME__,this._receiveFirstFrameHandle.bind(this)),this._rtcModule.on(ce.__INNER_ON_KICKOFF__,this._kickoffHandle.bind(this)),this._callEngine.on(_e.__INNER_SESSION_CONNECT__,this._rtcModule.sessionConnected.bind(this._rtcModule)),this._callEngine.on(_e.__INNER_SESSION_CLOSE__,this._sessionCloseHandle.bind(this)),this._callEngine.on(_e.__INNER_CHANGE_MEDIA_TYPE__,this._rtcModule.changeMediaType.bind(this._rtcModule)),this._callEngine.on(_e.__INNER_INVITE__,function(e,t){o._callPlusStatistics.reportStatisticsData(I.L_QS_RECEIVE_CALL_S,c.SUCCESS,+new Date,e,"",t)})}return Object.defineProperty(r.prototype,"_rtcProcessFailHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._callEngine.getLocalMainSession();if(r){var i=r.getCallId();this._callEngine.systemStatusUp({callId:i,sysStatus:e,forward:ie.CURRENT},t),this._callPlusStatistics.reportStatisticsData(I.L_QS_ABNORMAL_HANGUP_S,c.SUCCESS,+new Date,r),this.__innerHangup({callId:i,systemState:e},t)}}}),Object.defineProperty(r.prototype,"_peerConnectionAbnormalClose",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._callEngine.getLocalMainSession();t&&(this._callEngine.systemStatusUp({callId:t.getCallId(),sysStatus:exports.RCCallPlusReason.CONNECTION_ERR,forward:ie.CURRENT},e),this._callEngine.endCurrentSession(exports.RCCallPlusReason.CONNECTION_ERR,t.getCallId(),e))}}),Object.defineProperty(r.prototype,"_selfJoinedHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return o(this,void 0,void 0,function(){var i,n,o,s;return a(this,function(a){return i=this._context.getCurrentId(),((null==(n=this._callEngine.getLocalMainSession())?void 0:n.getCallType())===exports.RCCallPlusType.MULTI||t.length)&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL),o=_([i],l(t),!1).map(function(e){return{userId:e,userState:exports.RCCallPlusSessionUserState.ONCALL,systemState:exports.RCCallPlusReason.ONCALL}}),s=this._callEngine.updateUsersState(e,o,r),this._reportAppEventModule.onCallConnected(n),s.length>0&&this._callEngine.reportRemoteUserStateChange(e,s,r),this._callEngine.startTimeCorrection(r),[2]})})}}),Object.defineProperty(r.prototype,"_otherJoinedHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i="",n=e.map(function(e){return i=e.callId,{userId:e.userId,userState:exports.RCCallPlusSessionUserState.ONCALL,systemState:exports.RCCallPlusReason.ONCALL}}),o=this._callEngine.updateUsersState(i,n,t);o.length>0&&this._callEngine.reportRemoteUserStateChange(i,o,t),(null===(r=this._callEngine.getLocalMainSession())||void 0===r?void 0:r.getState())!==exports.RCCallPlusCallState.ONCALL&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL)}}),Object.defineProperty(r.prototype,"_receiveFirstFrameHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(null===(t=this._callEngine.getLocalMainSession())||void 0===t?void 0:t.getState())!==exports.RCCallPlusCallState.ONCALL&&this._callEngine.updateMainSessionState(exports.RCCallPlusCallState.ONCALL),this._callEngine.upFirstFrameTime(e)}}),Object.defineProperty(r.prototype,"_kickoffHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){if(e!==exports.RCCallPlusReason.CONNECTION_ERR){var i=this._callEngine.getLocalMainSession();if(i){var n=i.getCallId();this._callPlusStatistics.reportStatisticsData(I.L_QS_ABNORMAL_HANGUP_S,c.SUCCESS,+new Date,i,this._clientCallId),this._callEngine.systemStatusUp({callId:n,sysStatus:e,forward:ie.CURRENT},r),this._callEngine.endCurrentSession(e,t,r)}}else this._callEngine.endCurrentSession(e,t,r)}}),Object.defineProperty(r.prototype,"_sessionCloseHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._isLaunchHangup||(this._clientCallId=""),this._isLaunchHangup=!1,this._rtcModule.sessionClose(e,t)}}),Object.defineProperty(r.prototype,"setCallPlusEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._reportAppEventModule.registerEventListener(e)}}),Object.defineProperty(r.prototype,"setStatusReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_STATUS_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._rtcModule.setCallPlusStatusReportListener(e)}}),Object.defineProperty(r.prototype,"setVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,n=this._logger.createTraceId();if(this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_T,JSON.stringify({list:t.map(function(e){var t=e.userId,r=e.videoElement,i=e.isTiny;return{userId:t,elementName:null==r?void 0:r.nodeName,isTiny:i}})}),n),!e.notEmptyArray(t))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, list: not empty array, value: ".concat(JSON.stringify(t)),n),{code:c.PARAM_ERROR};try{for(var o=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(t),a=o.next();!a.done;a=o.next()){var l=a.value,_=l.userId,u=l.videoElement;if(!e.notEmptyString(_))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, userId: not empty string, value: ".concat(_),n),{code:c.PARAM_ERROR};if(!h(u))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"params err, videoElement: need a video element, value: ".concat(u instanceof HTMLElement?u.nodeName:u),n),{code:c.PARAM_ERROR}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_VIEW_R,"succes",n),this._rtcModule.setVideoView(t,n),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"removeVideoView",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this._logger.createTraceId();return this._logger.info(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_T,JSON.stringify({userIds:t}),r),e.notEmptyArray(t)&&t.every(function(t){return e.notEmptyString(t)})?(this._logger.info(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R,"succes",r),this._rtcModule.removeVideoView(t,r),{code:c.SUCCESS}):(this._logger.error(s.L_CALLPLUS_CLIENT_REMOVE_VIDEO_VIEW_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),r),{code:c.PARAM_ERROR})}}),Object.defineProperty(r.prototype,"playMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){return i=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_T,JSON.stringify({userId:t,mediaType:r}),i),e.notEmptyString(t)?e.isUndefined(exports.RCCallPlusMediaType[r])?(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"params err, mediaType is illegal, value: ".concat(r),i),[2,{code:c.PARAM_ERROR}]):r===exports.RCCallPlusMediaType.AUDIO&&t===this._context.getCurrentId()?(this._logger.info(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"success",i),[2,{code:c.SUCCESS}]):(n=(this._rtcModule.getUserViewMap()[t]||{}).videoView,r===exports.RCCallPlusMediaType.AUDIO||n?[2,this._rtcModule.playMedia(t,r,n,i)]:(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"errCode: ".concat(c.VIDEO_VIEW_NOT_SET,", video view not set"),i),[2,{code:c.VIDEO_VIEW_NOT_SET}])):(this._logger.error(s.L_CALLPLUS_CLIENT_PLAY_MEDIA_R,"params err, userId: not empty string, value: ".concat(t),i),[2,{code:c.PARAM_ERROR}])})})}}),Object.defineProperty(r.prototype,"createVideoConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new R(this._logger)}}),Object.defineProperty(r.prototype,"setVideoConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_T,JSON.stringify(e));var r=e.frameRate,i=e.resolution,o=e.maxBitrate,a=e.minBitrate;if(!t.RCFrameRate[r])return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"param error, frameRate is illegal, value: ".concat(r)),{code:c.PARAM_ERROR};if(!t.RCResolution[i])return this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"param error, resolution is illegal, value: ".concat(i)),{code:c.PARAM_ERROR};var l=O(a,o),_=l.code,u=l.errorMsg;return _!==c.SUCCESS&&this._logger.error(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,u),this._logger.info(s.L_CALLPLUS_CLIENT_SET_VIDEO_CONFIG_R,"success"),this._videoConfig=n({},e),this._rtcModule.setVideoConfig(this._videoConfig),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"createAudioConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new p(this._logger)}}),Object.defineProperty(r.prototype,"createAndroidPushConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return new Ce(this._logger)}}),Object.defineProperty(r.prototype,"setAudioConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_T,JSON.stringify(t));var r=t.sampleRate,i=t.minBitrate,o=t.maxBitrate;if(r&&!e.isNumber(r))return this._logger.error(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,"param error, sampleRate: type is number, value: ".concat(r)),{code:c.PARAM_ERROR};var a=O(i,o),l=a.code,_=a.errorMsg;return l!==c.SUCCESS&&this._logger.error(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,_),this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_CONFIG_R,"success"),this._audioConfig=n({},t),this._rtcModule.setAudioConfig(this._audioConfig),{code:c.SUCCESS}}}),Object.defineProperty(r.prototype,"setAudioOutputDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._logger.info(s.L_CALLPLUS_CLIENT_SET_AUDIO_OUTPUT_DEVICE_ID_O,e),this._rtcModule.setAudioOutputDeviceId(e)}}),Object.defineProperty(r.prototype,"startCall",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n,l,_){return void 0===r&&(r=exports.RCCallPlusType.SINGLE),void 0===i&&(i=exports.RCCallPlusMediaType.AUDIO_VIDEO),o(this,void 0,void 0,function(){var o,u,C,d,L,E,T,S,g,p,R;return a(this,function(a){switch(a.label){case 0:if(this._clientCallId=e.getUUID(),o=+new Date,u=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_T,"userIds: ".concat(t.join(","),", callType: ").concat(r,", mediaType: ").concat(i,", pushConfig: ").concat(n,", extra: ").concat(l),u),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.SIGNAL_DISCONNECTED),u),[2,{code:c.SIGNAL_DISCONNECTED}];if(!(C=this._context.getNaviInfo())||!b(C))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.RTC_SERVICE_UNAVAILABLE),u),[2,{code:c.RTC_SERVICE_UNAVAILABLE}];if(!e.notEmptyArray(t)||!t.every(function(t){return e.notEmptyString(t)}))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),u),[2,{code:c.PARAM_ERROR}];if(e.isUndefined(exports.RCCallPlusType[r]))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, callType is illegal, value: ".concat(r),u),[2,{code:c.PARAM_ERROR}];if(e.isUndefined(exports.RCCallPlusMediaType[i]))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, mediaType is illegal, value: ".concat(i),u),[2,{code:c.PARAM_ERROR}];if(n&&(d=v(n)).code!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, pushConfig is illegal, msg: ".concat(d.errorMsg),u),[2,{code:c.PARAM_ERROR}];if(l){if(!e.isString(l))return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, extra is illegal, type: string, value: ".concat(l),u),[2,{code:c.PARAM_ERROR}];if(U(l)>z)return this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, extra max size is 128KB",u),[2,{code:c.PARAM_ERROR}]}return t.length>1&&r===exports.RCCallPlusType.SINGLE?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, You can only call one person in a single call, userIds: ".concat(t.join(",")),u),[2,{code:c.PARAM_ERROR}]):_&&!e.isString(_)?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"params err, targetId is illegal, type: string, value: ".concat(_),u),[2,{code:c.PARAM_ERROR}]):this._callEngine.getLocalMainSession()?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"errCode: ".concat(c.SESSION_EXIST,", session exist"),u),[2,{code:c.SESSION_EXIST}]):[4,this._rtcModule.createCallMediaTracks(i,u)];case 1:return(L=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"create meida tracks error code: ".concat(L),u),[2,{code:L}]):[4,this._callEngine.startCall({toUsers:t.map(function(e){return{userId:e}}),callType:r,mediaType:i,callId:this._clientCallId,pushConfig:n,extra:JSON.stringify({userId:this._context.getCurrentId(),extra:l}),targetId:_},u)];case 2:return E=a.sent(),T=E.code,S=E.data,this._callPlusStatistics.reportStatisticsData(I.L_QS_START_CALL_S,T,o,null,this._clientCallId,null,{mediaType:i,callType:r,callId:(null==S?void 0:S.callId)||""}),T!==c.SUCCESS?(this._rtcModule.destroyAllTracks(u),this._logger.error(s.L_CALLPLUS_CLIENT_START_CALL_R,"signal error code: ".concat(T),u),[2,{code:T}]):(p=(g=S).callId,R=g.clientCallId,this._needHangupCallId===R?(this._callEngine.clearAllTimer(p,u),this._callEngine.hangup({callId:p,systemState:exports.RCCallPlusReason.CANCELLED},u),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_R,"the ".concat(p," call has been hangup"),u),[2,{code:c.SUCCESS}]):(r===exports.RCCallPlusType.MULTI&&this._rtcModule.sessionConnected(p,u),this._logger.info(s.L_CALLPLUS_CLIENT_START_CALL_R,JSON.stringify({data:S,code:T}),u),[2,{code:c.SUCCESS,callId:p}]))}})})}}),Object.defineProperty(r.prototype,"joinMultiCall",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u,C,d;return a(this,function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_T,"callId: ".concat(t),r),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.SIGNAL_DISCONNECTED),r),[2,{code:c.SIGNAL_DISCONNECTED}]):(i=this._context.getNaviInfo())&&b(i)?e.notEmptyString(t)?[4,this._callEngine.getCallSession({callId:t},r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"params err, callId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.RTC_SERVICE_UNAVAILABLE),r),[2,{code:c.RTC_SERVICE_UNAVAILABLE}]);case 1:return n=a.sent(),o=n.code,l=n.data,o!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"get call data error, code: ".concat(o),r),[2,{code:o}]):(_=l.mediaType,(u=this._callEngine.getLocalMainSession())&&u.getCallId()!==t?[2,{code:c.SESSION_EXIST}]:[4,this._rtcModule.createCallMediaTracks(_,r)]);case 2:return(C=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"create meida tracks error code: ".concat(C),r),[2,{code:C}]):[4,this._callEngine.joinCall({callId:t,mediaType:_},r)];case 3:return(d=a.sent().code)!==c.SUCCESS?(this._rtcModule.destroyAllTracks(r),this._logger.error(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"signal error code: ".concat(d),r),[2,{code:d}]):(this._logger.info(s.L_CALLPLUS_CLIENT_JOIN_MULTI_CALL_R,"code: ".concat(c.SUCCESS),r),[4,this._rtcModule.sessionConnected(t,r)]);case 4:return a.sent(),[2,{code:c.SUCCESS}]}})})}}),Object.defineProperty(r.prototype,"invite",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n;return o(this,void 0,void 0,function(){var o,u,C,d,L,E;return a(this,function(a){switch(a.label){case 0:if(o=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_INVITE_T,"callId: ".concat(t.join(","),", pushConfig: ").concat(r,", extra: ").concat(i),o),!e.notEmptyArray(t)||!t.every(function(t){return e.notEmptyString(t)}))return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, userIds: not empty array, userId: not empty string, value: ".concat(JSON.stringify(t)),o),[2,{code:c.PARAM_ERROR}];if(r&&(u=v(r)).code!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, pushConfig is illegal, msg: ".concat(u.errorMsg),o),[2,{code:c.PARAM_ERROR}];if(i){if(!e.isString(i))return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, extra is illegal, value: ".concat(i),o),[2,{code:c.PARAM_ERROR}];if(U(i)>z)return this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"params err, extra max size is 128KB",o),[2,{code:c.PARAM_ERROR}]}return[4,this._callEngine.invite({toUsers:t.map(function(e){return{userId:e}}),pushConfig:r,extra:JSON.stringify({userId:this._context.getCurrentId(),extra:i})},o)];case 1:return C=a.sent(),d=C.code,L=C.data,d!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_INVITE_R,"signal error code: ".concat(d),o),[2,{code:d}]):(E=[],(null===(n=L.busylineUsers)||void 0===n?void 0:n.length)&&E.push.apply(E,_([],l(L.busylineUsers.map(function(e){return{userId:e.userId,state:e.sessionStatus}})),!1)),this._logger.info(s.L_CALLPLUS_CLIENT_INVITE_R,"success busyUsers: ".concat(JSON.stringify(E)),o),[2,{code:c.SUCCESS,busyUsers:E}])}})})}}),Object.defineProperty(r.prototype,"accept",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n,o,l,_,u,C,d,L,E;return a(this,function(a){switch(a.label){case 0:return i=+new Date,n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_ACCEPT_T,"callId: ".concat(t,", pushConfig: ").concat(r),n),this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode: ".concat(c.SIGNAL_DISCONNECTED),n),[2,{code:c.SIGNAL_DISCONNECTED}]):(o=this._context.getNaviInfo())&&b(o)?e.notEmptyString(t)?r&&(l=v(r)).code!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"params err, pushConfig is illegal, msg: ".concat(l.errorMsg),n),[2,{code:c.PARAM_ERROR}]):(_=this._callEngine.getLocalMainSession(),u=this._callEngine.getHoldSession(t),_||u?t===(null==u?void 0:u.getCallId())?[4,this.hangup(_.getCallId())]:[3,2]:(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode : ".concat(c.NOT_IN_CALL,", session not exist"),n),[2,{code:c.NOT_IN_CALL}])):(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"params err, callId: not empty string, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"errCode: ".concat(c.RTC_SERVICE_UNAVAILABLE),n),[2,{code:c.RTC_SERVICE_UNAVAILABLE}]);case 1:if((C=a.sent().code)!==c.SUCCESS)return this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"hangup mainSession error code: ".concat(C),n),[2,{code:C}];this._callEngine.upgradeMainSession(t),_=this._callEngine.getLocalMainSession(),a.label=2;case 2:return d=_.getMediaType(),[4,this._rtcModule.createCallMediaTracks(d,n)];case 3:return(L=a.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"create meida tracks error code: ".concat(L),n),[2,{code:L}]):[4,this._callEngine.accept({callId:t},n)];case 4:return E=a.sent().code,this._callPlusStatistics.reportStatisticsData(I.L_QS_ACCEPT_CALL_S,E,i,_),E!==c.SUCCESS?(this._rtcModule.destroyAllTracks(n),this._logger.error(s.L_CALLPLUS_CLIENT_ACCEPT_R,"signal error code: ".concat(E),n),[2,{code:E}]):(this._logger.info(s.L_CALLPLUS_CLIENT_ACCEPT_R,"success",n),this._rtcModule.sessionConnected(t,n),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"__innerHangup",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){switch(o.label){case 0:return i=e.callId,this._callEngine.setIsLocalClientHangup(!0),this._callEngine.clearAllTimer(i,t),[4,this._callEngine.hangup(e,t)];case 1:return(n=o.sent().code)===se.CALL_NOT_EXIST?[2,{code:c.SUCCESS}]:n!==c.SUCCESS||i!==(null===(r=this._callEngine.getLocalMainSession())||void 0===r?void 0:r.getCallId())?[3,3]:[4,this._rtcModule.sessionClose(i,t)];case 2:o.sent(),o.label=3;case 3:return[2,{code:n}]}})})}}),Object.defineProperty(r.prototype,"hangup",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n,o,l,_,u,C,d,L,E,T,S;return a(this,function(a){switch(a.label){case 0:return i=+new Date,n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_HANGUP_T,"callId: ".concat(t,", pushConfig: ").concat(r),n),(o=this._callEngine.getLocalMainSession())?t&&!e.isString(t)?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, callId: type is string, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]):r&&(l=v(r)).code!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, pushConfig is illegal, msg: ".concat(l.errorMsg),n),[2,{code:c.PARAM_ERROR}]):(_=o.getCallId(),t&&t!==_&&!this._callEngine.getHoldSession(t)?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"params err, callId is invalid, value: ".concat(t),n),[2,{code:c.CALL_ID_INVALID}]):(this._isLaunchHangup=!0,this._needHangupCallId=t||_,u=this._callEngine.getHoldSession(this._needHangupCallId),C=u||o,d=this._context.getCurrentId(),L=o.getUserList().filter(function(e){return e.userId===d})[0].state,E=[o.getCreatorUserId(),o.getInviterUserId()].includes(d),T=function(e,t){var r;switch(e){case exports.RCCallPlusSessionUserState.CALLING:r=exports.RCCallPlusReason.CANCELLED;break;case exports.RCCallPlusSessionUserState.RINGING:case exports.RCCallPlusSessionUserState.INVITED:r=exports.RCCallPlusReason.DECLINED;break;case exports.RCCallPlusSessionUserState.CONNECTING:r=t?exports.RCCallPlusReason.DECLINED:exports.RCCallPlusReason.CANCELLED;break;case exports.RCCallPlusSessionUserState.ONCALL:r=exports.RCCallPlusReason.ENDED}return r}(L,E)||exports.RCCallPlusReason.ENDED,[4,this.__innerHangup({callId:this._needHangupCallId,systemState:T,pushConfig:r},n)])):[2,{code:c.NOT_IN_CALL}];case 1:return S=a.sent().code,this._callPlusStatistics.reportStatisticsData(I.L_QS_HANGUP_CALL_S,S,i,C,this._clientCallId),S!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_HANGUP_R,"signal error code : ".concat(S),n),[2,{code:S}]):(this._needHangupCallId=null,this._logger.info(s.L_CALLPLUS_CLIENT_HANGUP_R,"success",n),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"requestChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i,n,o,l,_,u,C=this;return a(this,function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_T,"mediaType: ".concat(t),r),e.isUndefined(exports.RCCallPlusMediaType[t])?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"params err, mediaType is illegal, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]):(i=this.getCurrentCallSession(),n=null==i?void 0:i.getMediaType(),t===n?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"error code: ".concat(c.MEDIATYPE_INVALID),r),[2,{code:c.MEDIATYPE_INVALID}]):this._callEngine.getLocalMainSession()?(o=null==i?void 0:i.getUserList().filter(function(e){return e.userId!==C._context.getCurrentId()}).map(function(e){return e.userId}),[4,this._callEngine.requestChangeMediaType({mediaType:t,toUserIds:o||[]},r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),r),[2,{code:c.NOT_IN_CALL}]));case 1:return l=a.sent(),_=l.code,u=l.data,_!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"signal error code: ".concat(_),r),[2,{code:_}]):(this._logger.info(s.L_CALLPLUS_CLIENT_REQUEST_CHANGE_MEDIA_TYPE_R,"success transactionId: ".concat(u.transactionId),r),[2,{code:c.SUCCESS,transactionId:u.transactionId}])}})})}}),Object.defineProperty(r.prototype,"cancelChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_T,"transactionId: ".concat(t),r),e.notEmptyString(t)?this._callEngine.getLocalMainSession()?[4,this._callEngine.cancelChangeMediaType({transactionId:t},r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"param error, transactionId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"signal error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_CANCEL_CHANGE_MEDIA_TYPE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"replyChangeMediaType",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return o(this,void 0,void 0,function(){var i,n;return a(this,function(o){switch(o.label){case 0:return i=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_T,"transactionId: ".concat(t),i),e.notEmptyString(t)?e.isBoolean(r)?this._callEngine.getLocalMainSession()?[4,this._callEngine.responseChangeMediaType({transactionId:t,agree:r},i)]:(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"error code : ".concat(c.NOT_IN_CALL,", session not exist"),i),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"param error, isAgree: type is boolean, value: ".concat(r),i),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"param error, transactionId: not empty string, value: ".concat(t),i),[2,{code:c.PARAM_ERROR}]);case 1:return(n=o.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"signal error: ".concat(n),i),[2,{code:n}]):(this._logger.info(s.L_CALLPLUS_CLIENT_REPLY_CHANGE_MEDIA_TYPE_R,"success",i),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"getCurrentCallSession",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._callEngine.getLocalMainSession()}}),Object.defineProperty(r.prototype,"getAvailableCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,t,r,i;return a(this,function(n){switch(n.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_T,"",e),[4,this._callEngine.getOpenCallList(e)];case 1:return t=n.sent(),r=t.code,i=t.data,r!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R,"signal error code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_CLIENT_GET_AVAILABLE_CALL_RECORDS_FROM_SERVER_R,"success, data: ".concat(JSON.stringify(i)),e),[2,{code:c.SUCCESS,records:i}])}})})}}),Object.defineProperty(r.prototype,"getCallRecords",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===i&&(i=0),o(this,void 0,void 0,function(){var n,o,l,_;return a(this,function(a){switch(a.label){case 0:return n=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_T,"startTimestamp: ".concat(t,", count: ").concat(r),n),e.isNumber(t)&&t>=0?e.isNumber(r)&&r>0?[4,this._callEngine.getCallLogList({timestamp:t,count:r,order:i},n)]:(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"params error, count: is a number >= 0, value: ".concat(r),n),[2,{code:c.PARAM_ERROR}]):(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"params error, startTimestamp: is a number >= 0, value: ".concat(t),n),[2,{code:c.PARAM_ERROR}]);case 1:return o=a.sent(),l=o.code,_=o.data,l!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"signal error code: ".concat(l),n),[2,{code:l}]):(this._logger.info(s.L_CALLPLUS_CLIENT_GET_CALL_RECORDS_R,"success",n),[2,{code:c.SUCCESS,result:_}])}})})}}),Object.defineProperty(r.prototype,"deleteCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_T,"callIds: ".concat(t.join(",")),r),e.notEmptyArray(t)&&t.every(function(t){return e.notEmptyString(t)})?[4,this._callEngine.deleteCallLog(t,r)]:(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"params err, callIds: not empty array, callId: not empty string, callIds: ".concat(JSON.stringify(t)),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"signal error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_CALL_RECORDS_BY_CALLID_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"deleteAllCallRecordsFromServer",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,t;return a(this,function(r){switch(r.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_T,"",e),[4,this._callEngine.removeAllCallLog(e)];case 1:return(t=r.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R,"signal error code: ".concat(t),e),[2,{code:t}]):(this._logger.info(s.L_CALLPLUS_CLIENT_DELETE_ALL_CALL_RECORDS_FROM_SERVER_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"startCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return o(this,void 0,void 0,function(){var r,i,n,o,l,_;return a(this,function(a){switch(a.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_T,"",r),[4,this._rtcModule.getCameraVideoTrack(r)];case 1:return i=a.sent(),n=i.code,o=i.track,n!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"create video track error code: ".concat(n),r),[2,{code:n}]):(null==o?void 0:o.isPublished())||(null===(e=this._callEngine.getLocalMainSession())||void 0===e?void 0:e.getState())!==exports.RCCallPlusCallState.ONCALL?[3,3]:[4,this._rtcModule.publishVideoTrack()];case 2:return(l=a.sent().code)!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"publish error code: ".concat(l),r),[2,{code:l}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"success",r),[2,{code:c.SUCCESS}]);case 3:return[4,this._rtcModule.enableVideoTrack(r)];case 4:return(_=a.sent().code)!==t.RCRTCCode.SUCCESS&&_!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"signal error code: ".concat(_),r),[2,{code:_}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_CAMERA_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"stopCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,r,i,n;return a(this,function(o){switch(o.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_CAMERA_T,"",e),[4,this._rtcModule.disableVideoTrack()];case 1:return r=o.sent(),i=r.code,n=r.track,i!==c.SUCCESS&&i!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_STOP_CAMERA_R,"error code: ".concat(i),e),[2,{code:i}]):(this._rtcModule.destroyTrack(n),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_CAMERA_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"switchCamera",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i,n;return a(this,function(o){switch(o.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_T,"cameraId: ".concat(t),r),e.notEmptyString(t)?(i=this._callEngine.getLocalMainSession())?i.getMediaType()===exports.RCCallPlusMediaType.AUDIO?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"errCode: ".concat(c.NOT_VIDEO_CALL),r),[2,{code:c.NOT_VIDEO_CALL}]):(this._videoConfig.cameraId=t,this._rtcModule.setVideoConfig(this._videoConfig),[4,this._rtcModule.changeVideoDevice(r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"errCode: ".concat(c.NOT_IN_CALL),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"param error, cameraId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(n=o.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"call client changeVideoDevice error code: ".concat(n),r),[2,{code:n}]):(this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_CAMERA_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"startMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,r,i,n,o;return a(this,function(a){switch(a.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_T,"",e),[4,this._rtcModule.getMicrophoneAudioTrack(e)];case 1:return r=a.sent(),i=r.code,n=r.track,i!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"create microphone audio track error code: ".concat(i),e),[2,{code:i}]):n.isOwnerMuted()?[4,n.unmute()]:(this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}]);case 2:return(o=a.sent())!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"signal error code: ".concat(i),e),[2,{code:o}]):(this._logger.info(s.L_CALLPLUS_CLIENT_START_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"stopMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){var e,r;return a(this,function(i){switch(i.label){case 0:return e=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_T,"",e),[4,this._rtcModule.disableAudioTrack()];case 1:return(r=i.sent().code)!==c.SUCCESS&&r!==t.RCRTCCode.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R,"signal error code: ".concat(r),e),[2,{code:r}]):(this._logger.info(s.L_CALLPLUS_CLIENT_STOP_MICROPHONE_R,"success",e),[2,{code:c.SUCCESS}])}})})}}),Object.defineProperty(r.prototype,"isMicrophoneEnabled",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._rtcModule.getLocalAudioTrack();return!!e&&!e.isOwnerMuted()}}),Object.defineProperty(r.prototype,"setAllRemoteAudioEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return o(this,void 0,void 0,function(){var t;return a(this,function(r){return t=this._logger.createTraceId(),[2,this._rtcModule.setAllRemoteAudioEnable(e,t)]})})}}),Object.defineProperty(r.prototype,"getVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"2.24.0"}}),Object.defineProperty(r.prototype,"getCameras",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,t.device.getCameras()]})})}}),Object.defineProperty(r.prototype,"getMicrophones",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,t.device.getMicrophones()]})})}}),Object.defineProperty(r.prototype,"getSpeakers",{enumerable:!1,configurable:!0,writable:!0,value:function(){return o(this,void 0,void 0,function(){return a(this,function(e){return[2,t.device.getSpeakers()]})})}}),Object.defineProperty(r.prototype,"getRTCSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcModule.getRTCSessionId()}}),Object.defineProperty(r.prototype,"switchMicrophone",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return o(this,void 0,void 0,function(){var r,i;return a(this,function(n){switch(n.label){case 0:return r=this._logger.createTraceId(),this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_T,"microphoneId: ".concat(t),r),e.notEmptyString(t)?this._callEngine.getLocalMainSession()?(this._audioConfig.microphoneId=t,this._rtcModule.setAudioConfig(this._audioConfig),[4,this._rtcModule.changeAudioDevice(r)]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"errCode: ".concat(c.NOT_IN_CALL),r),[2,{code:c.NOT_IN_CALL}]):(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"param error, microphoneId: not empty string, value: ".concat(t),r),[2,{code:c.PARAM_ERROR}]);case 1:return(i=n.sent().code)!==c.SUCCESS?(this._logger.error(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"call client changeAudioDevice error code: ".concat(i),r),[2,{code:i}]):(this._logger.info(s.L_CALLPLUS_CLIENT_SWITCH_MICROPHONE_R,"success",r),[2,{code:c.SUCCESS}])}})})}}),r}();e.VersionManage.add("callplus","2.24.0");var Le={tag:"RCCallPlus",verify:function(t){return!!e.VersionManage.validEngine("5.24.0")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-call-plus required engine version at least '").concat("5.24.0","'.")),!1)},setup:function(t,r,i){var n,o=(n=i)?e.isObject(n)?Object.keys(n).includes("rtcClient")?e.isObject(n.rtcClient)?{isLegal:!0}:{isLegal:!1,msg:"Initialization 'rtcClient' parameter must be of type 'object'"}:{isLegal:!1,code:c.NOT_INSTALL_RTC_PLUGIN}:{isLegal:!1,msg:"Initialization options must be an object"}:{isLegal:!1,msg:"Initialization missing parameter -> options"};if(!o.isLegal)throw new Error("[CallPlusLib installer steup]".concat(o.msg));e.isUndefined(i.isAllowNewCallWhenRinging)&&(i.isAllowNewCallWhenRinging=!0);var a=t.createLogger("CallPlus","RTC"),l=e.isUndefined(i.logOutputLevel)?e.LogL.WARN:i.logOutputLevel;return a.setOutputLevel(l),a.warn(s.L_INDEX_INSTALL_CALL_PLUS_PLUGIN_O,"CallPlus Version: ".concat("2.24.0",", Commit: ").concat("5f224140da330e67dad7c51921b244ec674211bc",", isAllowNewCallWhenRinging: ").concat(i.isAllowNewCallWhenRinging)),new de(t,a,r,i)}};Object.defineProperty(exports,"RCCallPlusFrameRate",{enumerable:!0,get:function(){return t.RCFrameRate}}),Object.defineProperty(exports,"RCCallPlusResolution",{enumerable:!0,get:function(){return t.RCResolution}}),exports.RCAudioConfigBuilder=p,exports.RCCallPlusAndroidPushConfigBuilder=Ce,exports.RCCallPlusClient=de,exports.RCCallPlusCode=c,exports.RCCallPlusSession=g,exports.RCVideoConfigBuilder=R,exports.installer=Le;