@rongcloud/plugin-rtc 5.7.10-enterprise-lz.50 → 5.16.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/dist/index.cjs.js CHANGED
@@ -1,25 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=function(e,r){return t=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])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n,i,o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function a(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function s(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function l(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.L_INDEX_INSTALL_RTC_PLUGIN_O="L-index_install_rtc_plugin-O",e.L_RTC_CLIENT_IM_CONNECTION_STATE_S="L-rtc_client_im_connection_state-S",e.L_RTC_CLIENT_IM_DISCONNECT_S="L-rtc_client_im_disconnect-S",e.L_RTC_CLIENT_MESSAGE_O="L-rtc_client_message-O",e.L_RTC_CLIENT_DESTROY_S="L-rtc_client_destroy-S",e.L_RTC_CLIENT_JOIN_RTC_ROOM_T="L-rtc_client_join_rtc_room-T",e.L_RTC_CLIENT_JOIN_RTC_ROOM_R="L-rtc_client_join_rtc_room-R",e.L_RTC_JOIN_MEETING_ROOM_T="L-join-meeting-room-T",e.L_RTC_JOIN_MEETING_ROOM_R="L-join-meeting-room-R",e.L_RTC_CLIENT_LEAVE_ROOM_T="L-rtc_client_leave_room-T",e.L_RTC_CLIENT_LEAVE_ROOM_R="L-rtc_client_leave_room-R",e.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O="L-rtc_client_create_microphone_audio_track-O",e.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O="L-rtc_client_create_camera_video_track-O",e.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O="L-rtc_client_create_microphone_and_camera_tracks-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O="L-rtc_client_create_screen_video_track-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O="L-rtc_client_create_screen_video_and_audio_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O="L-rtc_client_create_local_audio_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O="L-rtc_client_create_local_video_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O="L-rtc_client_create_local_file_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O="L-rtc_client_create_local_tracks-O",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T="L-rtc_client_get_joined_room_info-T",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R="L-rtc_client_get_joined_room_info-R",e.L_PINGER_START_O="L-pinger_start-O",e.L_PINGER_STOP_O="L-pinger_stop-O",e.L_PINGER_SEND_RTCPING_T="L-pinger_send_rtcping-T",e.L_PINGER_SEND_RTCPING_R="L-pinger_send_rtcping-R",e.L_PINGER_SEND_RTCPING_E="L-pinger_send_rtcping-E",e.L_ABSTRACT_ROOM_SEND_MESSAGE_T="L-abstract_room_send_message-T",e.L_ABSTRACT_ROOM_SEND_MESSAGE_R="L-abstract_room_send_message-R",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T="L-abstract_room_set_room_attribute-T",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R="L-abstract_room_set_room_attribute_R",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T="L-abstract_room_delete_room_attribute_T",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R="L-abstract_room_delete_room_attribute_R",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T="L-abstract_room_get_room_attribute_T",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R="L-abstract_room_get_room_attribute_R",e.L_ABSTRACT_ROOM_PUBLISH_T="L-abstract_room_publish-T",e.L_ABSTRACT_ROOM_PUBLISH_R="L-abstract_room_publish-R",e.L_ABSTRACT_ROOM_PUBLISH_P="L-abstract_room_publish-P",e.L_ABSTRACT_ROOM_PUBLISH_E="L-abstract_room_publish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_T="L-abstract_room_unpublish-T",e.L_ABSTRACT_ROOM_UNPUBLISH_R="L-abstract_room_unpublish-R",e.L_ABSTRACT_ROOM_UNPUBLISH_E="L-abstract_room_unpublish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_P="L-abstract_room_unpublish-P",e.L_ABSTRACT_ROOM_SUBSCRIBE_T="L-abstract_room_subscribe-T",e.L_ABSTRACT_ROOM_SUBSCRIBE_R="L-abstract_room_subscribe-R",e.L_ABSTRACT_ROOM_SUBSCRIBE_E="L-abstract_room_subscribe-E",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_T="L-abstract_room_unsubscribe-T",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_R="L-abstract_room_unsubscribe-R",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_E="L-abstract_room_unsubscribe-E",e.L_APP_CALL_UNSUBSCRIBE_O="L-app_call_unsubscribe-O",e.L_USER_LEFT_UNSUBSCRIBE_O="L-user_left_unsubscribe-O",e.L_RES_UNPUB_UNSUBSCRIBE_O="L-res_unpub_unsubscribe-O",e.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O="L-abstract_room_register_room_event_listener-O",e.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O="L-abstract_room_register_report_listener-O",e.L_ABSTRACT_ROOM_AUDIO_LEVEL_O="L-abstract_room_audio_level-O",e.L_ABSTRACT_ROOM_IM_RECONNECTED_T="L-abstract_room_im_reconnected-T",e.L_ABSTRACT_ROOM_IM_RECONNECTED_R="L-abstract_room_im_reconnected-R",e.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O="L-abstract_room_call_app_listener-O",e.L_ABSTRACT_ROOM_SETBITRATE_O="L-abstract_room_setBitrate-O",e.L_ABSTRACT_ROOM_ONTRACKREADY_O="L-abstract_room_onTrackReady-O",e.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O="L-abstract_room_receive_message-O",e.L_ABSTRACT_ROOM_ONKICKOFF_O="L-abstract_room_onKickoff-O",e.L_MEDIA_SERVICE_MSLIST_CHANGE_O="L-media_service_msList_change-O",e.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O="L-media_service_parse_navi_callvoip_info-O",e.L_MEDIA_SERVICE_REQUEST_T="L-media_service_request-T",e.L_MEDIA_SERVICE_REQUEST_R="L-media_service_request-R",e.L_LOCAL_TRACK_DESTROY_O="L-local_track_destroy-O",e.L_LOCAL_TRACK_SET_BITRATE_O="L-local_track_set_bitrate-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_O="L-local_track_set_local_muted-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T="L-local_track_set_local_muted_spread-T",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R="L-local_track_set_local_muted_spread-R",e.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_T="L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_T",e.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_R="L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_R",e.L_TRACK_PLAY_O="L-track_play-O",e.L_TRACK_PLAY_E="L-track_play-E",e.L_TRACK_LOAD_START_O="L-track_load_start-O",e.L_TRACK_DURATION_CHANGE_O="L-track_duration_change-O",e.L_TRACK_LOADED_META_DATA_O="L-track_loaded_meta_data-O",e.L_TRACK_LOADED_DATA_O="L-track_loaded_data-O",e.L_TRACK_ABORT_O="L-track_abort-O",e.L_TRACK_VOLUME_CHANGE_O="L-track_volume_change-O",e.L_TRACK_CANPLAY_O="L-track_canplay-O",e.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O="L-abstract_stat_parser_format_rtc_state_report-O",e.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O="L-a_sdp_strategy_set_sdp_semantics-O",e.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O="L-a_sdp_strategy_set_remote_answer-O",e.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O="L-rtc_peer_connection_add_local_track-O",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S="L-rtc_peer_connection_ice_connection_state-S",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R="L-rtc_peer_connection_ice_connection_state_report-R",e.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S="L-rtc_peer_connection_connection_state-S",e.L_RTC_PEER_CONNECTION_SET_BITRATE_O="L-rtc_peer_connection_set_bitrate-O",e.L_RTC_PEER_CONNECTION_CREATE_OFFER_O="L-rtc_peer_connection_create_offer-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O="L-rtc_peer_connection_remove_local_track_by_id-O",e.L_RTC_PEER_CONNECTION_REMOVE_ALL_LOCAL_TRACK_O="L-rtc_peer_connection_remove_all_local_track-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O="L-rtc_peer_connection_remove_local_track-O",e.L_RTC_PEER_CONNECTION_DESTROY_O="L-rtc_peer_connection_destroy-O",e.L_RTC_SET_RECOMMEND_BITRATE_O="L_rtc_set_recommend_bitrate_O",e.L_RTC_3ANOISE_NODE_O="L_RTC_AAAnoiseNode_O",e.L_RTC_3ANOISE_NODE_E="L_RTC_AAAnoiseNode_E",e.L_RTC_3ANOISE_NODE_STOP_O="L_RTC_AAAnoiseNode_Stop_O",e.L_QS_JOIN_ROOM_S="RTC-joinRoomRtc-S",e.L_QS_SUBSCRIBE_S="RTC-subscribe-S",e.L_QS_UNSUBSCRIBE_S="RTC-unsubscribe-S",e.L_QS_PUBLISH_S="RTC-publishRtc-S",e.L_QS_UNPUBLISH_S="RTC-unpublishRtc-S",e.L_QS_ICE_STATUS_S="RTC-iceStatus-S",e.L_QS_KICKED_S="RTC-forcedOffline-S",e.L_QS_PUB_ICE_STATUS_S="RTC-pubIceConnected-S",e.L_QS_SUB_ICE_STATUS_S="RTC-subIceConnected-S",e.L_QS_RECV_PUB_MSG_S="RTC-recvPubMsg-S",e.L_QS_MEIDA_PING_DETECT_S="RTC-mediaPingDetect-S",e.L_QS_LOCAL_STREAM_STATE_CHANGED_S="RTC-localStreamStateChanged-S",e.L_QS_LEAVE_RTC_ROOM_S="RTC-leaveRtcRoom-S",e.L_QS_DECODE_FIRST_S="RTC-decodeFirst-S",e.L_SET_ENCODER_PREFERENCES_S="RTC-set_Encoder_Preferences-S",e.L_RTCNTF_PULL_ROOM_STATUS_O="L-rtcntf_pull_room_status-O",e.L_RTCPING_PULL_ROOM_STATUS_O="L-rtcping_pull_room_status-O",e.L_PULL_ROOM_STATUS_T="L-pull_room_status-T",e.L_PULL_ROOM_STATUS_P="L-pull_room_status-P",e.L_PULL_ROOM_STATUS_R="L-pull_room_status-R",e.L_PARSE_REMOTE_RES_COMMAND_P="L-parse_remote_res_command-P",e.L_UPDATE_SUB_REMOTE_TRACKS_O="L_update_sub_remote_tracks_O",e.L_OLD_DAILY_RECORD_O="L-old_daily_record-O",e.L_REMOTE_USER_JOINED_RESOURCES_O="L-remote_user_joined_resources-O",e.L_REMOTE_USER_STATE_HANDLE_O="L-remote_user_state_handle-O",e.L_HTTP_POLARIS_REPORT_FAIL_O="L-http_polaris_report_fail-O",e.L_HTTP_POLARIS_REPORT_LOCAL_QOS_FAIL_O="L_HTTP_POLARIS_REPORT_LOCAL_QOS_FAIL_O",e.L_UPDATE_SUBSCRIBELIST_COMMAND_T="L-update_subscribeList_command-T",e.L_UPDATE_SUBSCRIBELIST_COMMAND_P="L-update_subscribeList_command-P",e.L_UPDATE_SUBSCRIBELIST_COMMAND_R="L-update_subscribeList_command-R",e.L_RTC_CLIENT_NAVI_CHANGE_O="L-rtc_client_navi_change-O",e.L_UNPUBLISH_PREV_COMMAND_T="L-unpublish_prev_command-T",e.L_UNPUBLISH_PREV_COMMAND_R="L-unpublish_prev_command-R",e.L_RETRY_EXCHANGE_COMMAND_T="L-retry_exchange_command-T",e.L_RETRY_EXCHANGE_SPREAD_T="L-retry_exchange_spread-T",e.L_RETRY_EXCHANGE_SPREAD_R="L-retry_exchange_spread-R",e.L_PARSE_USERSTATE_COMMAND_R="L-parse_userstate_command-R",e.L_RESUB_REPUB_RES_R="L-resub_repub_res-R",e.L_PARSE_ROOMDATA_URIS_R="L-parse_roomdata_uris-R",e.L_SET_AUDIO_CONSTRAINTS_O="L-set_audio_constraints-O",e.L_FUNCTION_IS_UNAVAILABLE="L-function_is_unavailable",e.L_CLEAR_UNSUBSCRIBE_LIST_O="L-clear_unsubscribe_list-O",e.L_INVOKER_PUSH_O="L-invoker_push-O",e.L_INVOKER_EXECUTE_T="L-invoker_execute-T",e.L_INVOKER_EXECUTE_R="L-invoker_execute-R",e.L_INVOKER_EXECUTE_E="L-invoker_execute-E",e.L_INVOKER_DESTROY_O="L-invoker_destroy-R",e.L_QOS_R3_DATA_O="L-qos_r3_data-O",e.L_QOS_R4_DATA_O="L-qos_r4_data-O",e.L_SDK_EXECUTE_E="L-sdk_execute-E",e.L_START_1V1_CALL_AND_JOIN_ROOM_T="L-start_1v1_call_and_join_room-T",e.L_START_1V1_CALL_AND_JOIN_ROOM_R="L-start_1v1_call_and_join_room-R",e.L_ACCEPT_1V1_CALL_AND_JOIN_ROOM_T="L-accept_1v1_call_and_join_room-T",e.L_ACCEPT_1V1_CALL_AND_JOIN_ROOM_R="L-accept_1v1_call_and_join_room-R",e.L_JOIN_CALL_AND_JOIN_ROOM_T="L-join_call_and_join_room-T",e.L_JOIN_CALL_AND_JOIN_ROOM_R="L-join_call_and_join_room-R",e.L_HANGUP_1V1_CALL_AND_EXIT_ROOM_T="L-hangup_1v1_call_and_exit_room-T",e.L_HANGUP_1V1_CALL_AND_EXIT_ROOM_R="L-hangup_1v1_call_and_exit_room-R",e.L_PUBLISH_AND_SUBSCRIBE_STREAMS_T="L-publish_and_subscribe_streams-T",e.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P="L-publish_and_subscribe_streams-P",e.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R="L-publish_and_subscribe_streams-R",e.L_PRE_PUB_AND_SUB_T="L_PRE_PUB_AND_SUB_T",e.L_PRE_PUB_AND_SUB_R="L_PRE_PUB_AND_SUB_R",e.L_UN_PRE_PUB_AND_SUB_T="L_UN_PRE_PUB_AND_SUB_T",e.L_UN_PRE_PUB_AND_SUB_R="L_UN_PRE_PUB_AND_SUB_R",e.L_JOIN_MEETING_AND_RTC_ROOM_T="L-join_meeting_and_rtc_room-T",e.L_JOIN_MEETING_AND_RTC_ROOM_R="L-join_meeting_and_rtc_room-R",e.L_JOIN_MEETING_AND_RTC_ROOM_P="L-join_meeting_and_rtc_room-P",e.L_QUICK_MEETING_AND_RTC_ROOM_T="L-quick_meeting_and_rtc_room-T",e.L_QUICK_MEETING_AND_RTC_ROOM_R="L-quick_meeting_and_rtc_room-R",e.L_QUICK_MEETING_AND_RTC_ROOM_P="L-quick_meeting_and_rtc_room-P",e.L_END_MEETING_AND_RTC_ROOM_T="L-end_meeting_and_rtc_room-T",e.L_END_MEETING_AND_RTC_ROOM_R="L-end_meeting_and_rtc_room-R",e.L_LEAVE_MEETING_AND_RTC_ROOM_R="L-leave_meeting_and_rtc_room-R",e.L_LEAVE_MEETING_AND_RTC_ROOM_T="L-leave_meeting_and_rtc_room-T",e.L_END_MEETING_ONLY_O="L_END_MEETING_ONLY_O",e.L_RTCNTF_PULL_MEETING_AND_ROOM_STATUS_O="L-rtcntf_pull_meeting_and_room_status-O",e.L_PULL_CONNECTION_STATUS_O="L-pull_connection_status-O",e.L_PULL_MEETING_AND_ROOM_STATUS_T="L-pull_meeting_and_room_status-T",e.L_PULL_MEETING_AND_ROOM_STATUS_R="L-pull_meeting_and_room_status-R",e.L_PULL_MEETING_AND_ROOM_STATUS_P="L-pull_meeting_and_room_status-P",e.L_PULL_JOIN_MEETING_STATUS_T="L-pull_join_meeting_status-T",e.L_PULL_JOIN_MEETING_STATUS_R="L-pull_join_meeting_status-R",e.L_PULL_JOIN_MEETING_STATUS_P="L-pull_join_meeting_status-P",e.L_DATACHANNEL_OPEN_O="L_DATACHANNEL_OPEN_O",e.L_DATACHANNEL_OPEN_FAILED_O="L_DATACHANNEL_OPEN_FAILED_O",e.L_DATACHANNEL_CLOSE_O="L_DATACHANNEL_CLOSE_O",e.L_DATACHANNEL_E="L_DATACHANNEL_E",e.L_DATACHANNEL_RECV_MSG_O="L_DATACHANNEL_RECV_MSG_O",e.L_SUB_PEER_SET_REMOTE_DESC_E="L_SUB_PEER_SET_REMOTE_DESC_E",e.L_SUB_PEER_CREATE_OFFER_E="L_SUB_PEER_CREATE_OFFER_E",e.L_SUB_PEER_SET_OFFER_O="L_SUB_PEER_SET_OFFER_O",e.L_SUB_PEER_SET_REMOTE_DESC_O="L_SUB_PEER_SET_REMOTE_DESC_O",e.L_SUB_PEER_SET_LOCAL_DESC_E="L_SUB_PEER_SET_LOCAL_DESC_E",e.L_PEER_SET_REMOTE_DESC_E="L_PEER_SET_REMOTE_DESC_E",e.L_PEER_CREATE_OFFER_E="L_PEER_CREATE_OFFER_E",e.L_PEER_SET_LOCAL_DESC_E="L_PEER_SET_LOCAL_DESC_E",e.L_SUB_ICE_CONNECTION_S="L_SUB_ICE_CONNECTION_S",e.L_SUB_CONNECTION_S="L_SUB_CONNECTION_S",e.L_SEND_VIDEO_SUB_REQ_T="L_SEND_VIDEO_SUB_REQ_T",e.L_SEND_VIDEO_SUB_REQ_R="L_SEND_VIDEO_SUB_REQ_R",e.L_SEND_VIDEO_SUB_REQ_E="L_SEND_VIDEO_SUB_REQ_E",e.L_RETRY_SUB_AUDIO_O="L_RETRY_SUB_AUDIO_O",e.L_REMOVE_SRC_OBJECT_O="L_REMOVE_SRC_OBJECT_O",e.L_AUDIO_LEVEL_O="L_AUDIO_LEVEL_O",e.L_COLLECT_VOLUME_O="L_COLLECT_VOLUME_O",e.L_SPEAKER_VOLUME_CHANGE_O="L_SPEAKER_VOLUME_CHANGE_O",e.L_DEVICE_CHANGED_O="L_DEVICE_CHANGED_O",e.L_MICPHONE_VOLUME_CHANGE_O="L_MICPHONE_VOLUME_CHANGE_O",e.L_SUB_ICE_CONNECTION_STATE_S="L_SUB_ICE_CONNECTION_STATE_S",e.L_LOCAL_SRFLX_ADDRESS_O="L_LOCAL_SRFLX_ADDRESS_O",e.L_GET_LOCAL_SRFLX_ADDRESS_PEER_E="L_GET_LOCAL_SRFLX_ADDRESS_PEER_E",e.L_GET_MEDIA_SERVICE_LIST_O="L_GET_MEDIA_SERVICE_LIST_O",e.L_FAST_MEDIA_URL="L_FAST_MEDIA_URL",e.L_GET_USER_MEDIA_E="L_GET_USER_MEDIA_E",e.L_VIDEO_FREEZED_O="L_VIDEO_FREEZED_O",e.L_AUDIO_FREEZED_O="L_AUDIO_FREEZED_O",e.L_CONNECTION_LOST_O="L_CONNECTION_LOST_O",e.L_SEND_CONNECTION_LOST_O="L_SEND_CONNECTION_LOST_O",e.L_RECV_CONNECTION_LOST_O="L_RECV_CONNECTION_LOST_O",e.L_OPEN_WZ264_O="L_OPEN_WZ264_O",e.L_PARSE_JSON_E="L_PARSE_JSON_E",e.L_DATA_BASE_E="L_DATA_BASE_E",e.L_DATA_BASE_O="L_DATA_BASE_O",e.L_PAUSE_VIDEO_T="L_PAUSE_VIDEO_T",e.L_PAUSE_VIDEO_R="L_PAUSE_VIDEO_R",e.L_QS_OPEN_DATA_CHANNEL_COST_S="RTC-openDataChannelCost-S",e.L_QS_DATA_CHANNEL_STATE_CHANGE_S="RTC-dataChannelStateChange-S",e.L_QS_DATA_CHANNEL_REQUEST_COST_S="RTC-dataChannelRequestCost-S",e.L_VIRTUAL_BG_LOAD_S="L-virtualBGLoad-S",e.L_ENABLE_VIRTUAL_BG_T="L-enableVirtualBG-T",e.L_ENABLE_VIRTUAL_BG_R="L-enableVirtualBG-R",e.L_ENABLE_VIRTUAL_BG_BLUR_T="L-enableVirtualBGBlur-T",e.L_ENABLE_VIRTUAL_BG_BLUR_R="L-enableVirtualBGBlur-R",e.L_SET_VIRTUAL_BG_IMAGE_PATH_O="L-setVirtualBGImagePath-O",e.L_QS_RENDER_S="RTC-render-S",e.L_QS_VIDEO_FIRST_CAPTURE_FRAME_S="RTC-videoFirstCaptureFrame-S",e.L_QS_ENCODE_FIRST_S="RTC-encodeFirst-S",e.L_QS_RCV_PACKET_S="RTC-rcvPacket-S",e.L_QS_SNT_PACKET_S="RTC-sntPacket-S",e.L_QS_AUDIO_FIRST_CAPTURE_S="RTC-audioFirstCapture-S",e.L_QS_AUDIO_ENCODER_CREATE_S="RTC-audioEncoderCreate-S",e.L_QS_AUDIO_DECODER_CREATE_S="RTC-audioDecoderCreate-S",e.L_QS_VIDEO_ENCODER_CREATE_S="RTC-videoEncoderCreate-S",e.L_QS_VIDEO_DECODER_CREATE_S="RTC-videoDecoderCreate-S",e.L_QS_RD_PACKET_S="RTC-rdPacket-S",e.L_BOTTOM_LOG_O="L_BOTTOM_LOG_O",e.L_QS_AUDIO_RECORD_STATUS_S="RTC-audioRecordStatus-S",e.L_QS_SRTP_ERROR_S="RTC-SrtpError-S",e.L_NOT_SUPPORT_AUDIO_LEVEL_MONITOR_O="L_NOT_SUPPORT_AUDIO_LEVEL_MONITOR_O",e.L_PARSE_VOIP_SERVER_CONF_E="L_PARSE_VOIP_SERVER_CONF_E",e.L_INNER_SET_TRACK_O="L_INNER_SET_TRACK_O",e.A_APPLY_3A_NOISE_WORKLET_T="A-apply_3a_noise_worklet-T",e.A_APPLY_3A_NOISE_WORKLET_R="A-apply_3a_noise_worklet-R",e.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_T="L-rtc_client_set_custom_extend_info-T",e.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R="L-rtc_client_set_custom_extend_info-R",e.L_ENCRYPTOR_ENCODE_E="L-encryptor_encode-E",e.L_ENCRYPTOR_DECODE_E="L-encryptor_decode-E"}(n||(n={})),function(e){e.FAILED="fail",e.SUCCEEDED="success",e.TIMEOUT="timeout",e.INFO="info"}(i||(i={}));let d=!0,p=!0;function _(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function f(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function b(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(d=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function m(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(p=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function h(){if("object"==typeof window){if(d)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function g(e,t){p&&console.warn(e+" is deprecated, please use "+t+" instead.")}function v(e){return"[object Object]"===Object.prototype.toString.call(e)}function R(e){return v(e)?Object.keys(e).reduce((function(t,r){const n=v(e[r]),i=n?R(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function C(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?C(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{C(e,e.get(t),r)}))})))}function T(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&C(e,r,i)}))})),i}const S=h;function y(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let a=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=n(e.video),S("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return S("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function E(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function O(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else f(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function I(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function L(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}function P(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>T(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),f(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>T(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function A(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function w(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return A(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function k(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function N(e,t){f(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var D=Object.freeze({__proto__:null,shimMediaStream:E,shimOnTrack:O,shimGetSendersWithDtmf:I,shimGetStats:L,shimSenderReceiverGetStats:P,shimAddTrackRemoveTrackWithNative:A,shimAddTrackRemoveTrack:w,shimPeerConnection:k,fixNegotiationNeeded:N,shimGetUserMedia:y,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var M,x,U=(M=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=l}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,n,i){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t},M(x={exports:{}},x.exports),x.exports);function j(e,t,r,n,i){var o=U.writeRtpDescription(e.kind,t);if(o+=U.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=U.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(n?n.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+U.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+U.localCName+"\r\n"),o}function B(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},i=function(e,t,r,i){var o=n(e.parameters.apt,r),a=n(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(n){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(n.name.toLowerCase()===a.name.toLowerCase()&&n.clockRate===a.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&a.parameters.apt&&!i(n,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(n.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter((function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var n=0;n<t.headerExtensions.length;n++){var i=t.headerExtensions[n];if(e.uri===i.uri){r.headerExtensions.push(i);break}}})),r}function V(e,t,r){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)}function F(e,t){var r=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return r||e.addRemoteCandidate(t),!r}function J(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}var H=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function n(t,r,n,i){var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=i,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var i=function(r){var n=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){n[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw J("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof n;return i&&(n=[n]),n=n.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||r?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)})),delete e.url,e.urls=i?n[0]:n,!!n.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=U.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();n.iceTransport=i.iceTransport,n.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(n),n},i.prototype.addTrack=function(t,r){if(this._isClosed)throw J("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find((function(e){return e.track===t})))throw J("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(n=this.transceivers[i]);return n||(n=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),n.track=t,n.stream=r,n.rtpSender=new e.RTCRtpSender(t,n.dtlsTransport),n.rtpSender},i.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var n=e.clone();e.getTracks().forEach((function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),n.getTracks().forEach((function(e){r.addTrack(e,n)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw J("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw J("InvalidAccessError","Sender was not created by this connection.");var n=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;i.state=r?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,r){var n=this,i=this.transceivers[r].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),i.onlocalcandidate=function(e){if(!(n.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=U.writeCandidate(a);o.candidate=Object.assign(o.candidate,U.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=U.getMediaSections(n._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",n._localDescription.sdp=U.getDescription(n._localDescription.sdp)+u.join("");var l=n.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),s||n._dispatchEvent("icecandidate",o),l&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:n}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,r,n){var i=B(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:U.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),n&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,r,n=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(J("TypeError",'Unsupported type "'+e.type+'"'));if(!V("setLocalDescription",e.type,n.signalingState)||n._isClosed)return Promise.reject(J("InvalidStateError","Can not set local "+e.type+" in state "+n.signalingState));if("offer"===e.type)t=U.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=U.parseRtpParameters(e);n.transceivers[t].localCapabilities=r})),n.transceivers.forEach((function(e,t){n._gather(e.mid,t)}));else if("answer"===e.type){t=U.splitSections(n._remoteDescription.sdp),r=t.shift();var i=U.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=n.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(U.isRejected(e)&&0===U.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var d=U.getIceParameters(e,r),p=U.getDtlsParameters(e,r);i&&(p.role="server"),n.usingBundle&&0!==t||(n._gather(o.mid,t),"new"===s.state&&s.start(a,d,i?"controlling":"controlled"),"new"===c.state&&c.start(p));var _=B(u,l);n._transceive(o,_.codecs.length>0,!1)}}))}return n._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(J("TypeError",'Unsupported type "'+i.type+'"'));if(!V("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(J("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=U.splitSections(i.sdp),u=c.shift(),l=U.matchPrefix(u,"a=ice-lite").length>0,d=U.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=d;var p=U.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!p&&p.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(n,c){var p=U.splitLines(n),_=U.getKind(n),f=U.isRejected(n)&&0===U.matchPrefix(n,"a=bundle-only").length,b=p[0].substr(2).split(" ")[2],m=U.getDirection(n,u),h=U.parseMsid(n),g=U.getMid(n)||U.generateIdentifier();if(f||"application"===_&&("DTLS/SCTP"===b||"UDP/DTLS/SCTP"===b))o.transceivers[c]={mid:g,kind:_,protocol:b,rejected:!0};else{var v,R,C,T,S,y,E,O,I;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(_,!0));var L,P,A=U.parseRtpParameters(n);f||(L=U.getIceParameters(n,u),(P=U.getDtlsParameters(n,u)).role="client"),E=U.parseRtpEncodingParameters(n);var w=U.parseRtcpParameters(n),k=U.matchPrefix(n,"a=end-of-candidates",u).length>0,N=U.matchPrefix(n,"a=candidate:").map((function(e){return U.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!f&&d&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||f){if("answer"===i.type&&!f){R=(v=o.transceivers[c]).iceGatherer,C=v.iceTransport,T=v.dtlsTransport,S=v.rtpReceiver,y=v.sendEncodingParameters,O=v.localCapabilities,o.transceivers[c].recvEncodingParameters=E,o.transceivers[c].remoteCapabilities=A,o.transceivers[c].rtcpParameters=w,N.length&&"new"===C.state&&(!l&&!k||d&&0!==c?N.forEach((function(e){F(v.iceTransport,e)})):C.setRemoteCandidates(N)),d&&0!==c||("new"===C.state&&C.start(R,L,"controlling"),"new"===T.state&&T.start(P)),!B(v.localCapabilities,v.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&v.sendEncodingParameters[0].rtx&&delete v.sendEncodingParameters[0].rtx,o._transceive(v,"sendrecv"===m||"recvonly"===m,"sendrecv"===m||"sendonly"===m),!S||"sendrecv"!==m&&"sendonly"!==m?delete v.rtpReceiver:(I=S.track,h?(a[h.stream]||(a[h.stream]=new e.MediaStream),r(I,a[h.stream]),s.push([I,S,a[h.stream]])):(a.default||(a.default=new e.MediaStream),r(I,a.default),s.push([I,S,a.default])))}}else{(v=o.transceivers[c]||o._createTransceiver(_)).mid=g,v.iceGatherer||(v.iceGatherer=o._createIceGatherer(c,d)),N.length&&"new"===v.iceTransport.state&&(!k||d&&0!==c?N.forEach((function(e){F(v.iceTransport,e)})):v.iceTransport.setRemoteCandidates(N)),O=e.RTCRtpReceiver.getCapabilities(_),t<15019&&(O.codecs=O.codecs.filter((function(e){return"rtx"!==e.name}))),y=v.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var D,M=!1;if("sendrecv"===m||"sendonly"===m){if(M=!v.rtpReceiver,S=v.rtpReceiver||new e.RTCRtpReceiver(v.dtlsTransport,_),M)I=S.track,h&&"-"===h.stream||(h?(a[h.stream]||(a[h.stream]=new e.MediaStream,Object.defineProperty(a[h.stream],"id",{get:function(){return h.stream}})),Object.defineProperty(I,"id",{get:function(){return h.track}}),D=a[h.stream]):(a.default||(a.default=new e.MediaStream),D=a.default)),D&&(r(I,D),v.associatedRemoteMediaStreams.push(D)),s.push([I,S,D])}else v.rtpReceiver&&v.rtpReceiver.track&&(v.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===v.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),v.associatedRemoteMediaStreams=[]);v.localCapabilities=O,v.remoteCapabilities=A,v.rtpReceiver=S,v.rtcpParameters=w,v.sendEncodingParameters=y,v.recvEncodingParameters=E,o._transceive(o.transceivers[c],!1,M)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===i.type?"active":"passive"),o._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(a).forEach((function(t){var r=a[t];if(r.getTracks().length){if(-1===o.remoteStreams.indexOf(r)){o.remoteStreams.push(r);var i=new Event("addstream");i.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];r.id===e[2].id&&n(o,t,i,[r])}))}})),s.forEach((function(e){e[2]||n(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},i.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(J("InvalidStateError","Can not call createOffer after close"));var n=r.transceivers.filter((function(e){return"audio"===e.kind})).length,i=r.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(n=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--n<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));n>0||i>0;)n>0&&(r._createTransceiver("audio"),n--),i>0&&(r._createTransceiver("video"),i--);var a=U.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(n,i){var o=n.track,a=n.kind,s=n.mid||U.generateIdentifier();n.mid=s,n.iceGatherer||(n.iceGatherer=r._createIceGatherer(i,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=n.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new e.RTCRtpReceiver(n.dtlsTransport,a)),n.localCapabilities=c,n.sendEncodingParameters=u})),"max-compat"!==r._config.bundlePolicy&&(a+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){a+=j(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,a+="a="+U.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},i.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(J("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(J("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var n=U.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(n+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),n+="a=ice-options:trickle\r\n";var i=U.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?n+="m=application 0 DTLS/SCTP 5000\r\n":n+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var a;if(e.stream)"audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=B(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,n+=j(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(n+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(n,i){if(!r._remoteDescription)return i(J("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<r.transceivers.length;a++)if(r.transceivers[a].mid===e.sdpMid){o=a;break}var s=r.transceivers[o];if(!s)return i(J("OperationError","Can not add ICE candidate"));if(s.rejected)return n();var c=Object.keys(e.candidate).length>0?U.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return n();if(c.component&&1!==c.component)return n();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!F(s.iceTransport,c))return i(J("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=U.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=U.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var l=0;l<r.transceivers.length&&(r.transceivers[l].rejected||(r.transceivers[l].iceTransport.addRemoteCandidate({}),(t=U.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=U.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);n()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw J("InvalidAccessError","Invalid selector.");return r.getStats()}var n=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&n.push(e[t].getStats())}))})),Promise.all(n).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var n=r.prototype.getStats;r.prototype.getStats=function(){return n.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var n;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(n=e[r]).type]||n.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function G(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch((e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e))))}}function K(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function q(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=H(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e){let t=!1;return(e=JSON.parse(JSON.stringify(e))).filter((e=>{if(e&&(e.urls||e.url)){let r=e.urls||e.url;e.url&&!e.urls&&g("RTCIceServer.url","RTCIceServer.urls");const n="string"==typeof r;return n&&(r=[r]),r=r.filter((e=>{if(0===e.indexOf("stun:"))return!1;const r=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return r&&!t?(t=!0,!0):r&&!t})),delete e.url,e.urls=n?r[0]:r,!!r.length}}))}(e.iceServers,t.version),h("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function W(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var z=Object.freeze({__proto__:null,shimPeerConnection:q,shimReplaceTrack:W,shimGetUserMedia:G,shimGetDisplayMedia:K});function Q(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){g("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function Y(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Z(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}function X(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function $(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),f(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function ee(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){g("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function te(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function re(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return n})}function ne(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function ie(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function oe(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var ae=Object.freeze({__proto__:null,shimOnTrack:Y,shimPeerConnection:Z,shimSenderGetStats:X,shimReceiverGetStats:$,shimRemoveStream:ee,shimRTCDataChannel:te,shimAddTransceiver:re,shimGetParameters:ne,shimCreateOffer:ie,shimCreateAnswer:oe,shimGetUserMedia:Q,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function se(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function ce(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function ue(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let s=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){const n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}function le(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(de(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function de(e){return e&&void 0!==e.video?Object.assign({},e,{video:R(e.video)}):e}function pe(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(g("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function _e(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function fe(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function be(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var me=Object.freeze({__proto__:null,shimLocalStreamsAPI:se,shimRemoteStreamsAPI:ce,shimCallbacksAPI:ue,shimGetUserMedia:le,shimConstraints:de,shimRTCIceServerUrls:pe,shimTrackEventTransceiver:_e,shimCreateOfferLegacy:fe,shimAudioContext:be});function he(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=U.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,f(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function ge(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=U.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=U.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),r=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r}(e),n=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=U.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n}(arguments[0],e);let i;i=0===r&&0===n?Number.POSITIVE_INFINITY:0===r||0===n?Math.max(r,n):Math.min(r,n);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>i}),this._sctp=o}return r.apply(this,arguments)}}function ve(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},f(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function Re(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function Ce(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Te(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var Se=Object.freeze({__proto__:null,shimRTCIceCandidate:he,shimMaxMessageSize:ge,shimSendThrowTypeError:ve,shimConnectionState:Re,removeExtmapAllowMixed:Ce,shimAddIceCandidateNullOrEmpty:Te});const ye=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=h,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=_(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=_(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=_(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=_(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),i={browserDetails:n,commonShim:Se,extractVersion:_,disableLog:b,disableWarnings:m};switch(n.browser){case"chrome":if(!D||!k||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=D,Te(e,n),y(e,n),E(e),k(e,n),O(e),w(e,n),I(e),L(e),P(e),N(e,n),he(e),Re(e),ge(e,n),ve(e),Ce(e,n);break;case"firefox":if(!ae||!Z||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=ae,Te(e,n),Q(e,n),Z(e,n),Y(e),ee(e),X(e),$(e),te(e),re(e),ne(e),ie(e),oe(e),he(e),Re(e),ge(e,n),ve(e);break;case"edge":if(!z||!q||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),i;r("adapter.js shimming edge."),i.browserShim=z,G(e),K(e),q(e,n),W(e),ge(e,n),ve(e);break;case"safari":if(!me||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=me,Te(e,n),pe(e),fe(e),ue(e),se(e),ce(e),_e(e),le(e),be(e),he(e),ge(e,n),ve(e),Ce(e,n);break;default:r("Unsupported browser!")}return i}({window:"undefined"==typeof window?void 0:window});var Ee,Oe,Ie;exports.RCFrameRate=void 0,(Ee=exports.RCFrameRate||(exports.RCFrameRate={})).FPS_10="FPS_10",Ee.FPS_15="FPS_15",Ee.FPS_24="FPS_24",Ee.FPS_30="FPS_30",exports.RCResolution=void 0,(Oe=exports.RCResolution||(exports.RCResolution={})).W176_H132="W176_H132",Oe.W176_H144="W176_H144",Oe.W180_H180="W180_H180",Oe.W240_H180="W240_H180",Oe.W240_H240="W240_H240",Oe.W256_H144="W256_H144",Oe.W320_H180="W320_H180",Oe.W320_H240="W320_H240",Oe.W360_H360="W360_H360",Oe.W480_H270="W480_H270",Oe.W480_H360="W480_H360",Oe.W480_H480="W480_H480",Oe.W640_H360="W640_H360",Oe.W640_H480="W640_H480",Oe.W720_H480="W720_H480",Oe.W848_H480="W848_H480",Oe.W960_H540="W960_H540",Oe.W960_H720="W960_H720",Oe.W1280_H720="W1280_H720",Oe.W1920_H1080="W1920_H1080";var Le,Pe=((Ie={})[exports.RCResolution.W176_H132]={width:176,height:132,maxBitrate:150,minBitrate:80},Ie[exports.RCResolution.W176_H144]={width:176,height:144,maxBitrate:150,minBitrate:80},Ie[exports.RCResolution.W180_H180]={width:180,height:180,maxBitrate:200,minBitrate:100},Ie[exports.RCResolution.W240_H180]={width:240,height:180,maxBitrate:240,minBitrate:120},Ie[exports.RCResolution.W240_H240]={width:240,height:240,maxBitrate:280,minBitrate:120},Ie[exports.RCResolution.W256_H144]={width:256,height:144,maxBitrate:240,minBitrate:120},Ie[exports.RCResolution.W320_H180]={width:320,height:180,maxBitrate:280,minBitrate:120},Ie[exports.RCResolution.W320_H240]={width:320,height:240,maxBitrate:400,minBitrate:120},Ie[exports.RCResolution.W360_H360]={width:360,height:360,maxBitrate:520,minBitrate:140},Ie[exports.RCResolution.W480_H270]={width:480,height:270,maxBitrate:500,minBitrate:150},Ie[exports.RCResolution.W480_H360]={width:480,height:360,maxBitrate:650,minBitrate:150},Ie[exports.RCResolution.W480_H480]={width:480,height:480,maxBitrate:800,minBitrate:180},Ie[exports.RCResolution.W640_H360]={width:640,height:360,maxBitrate:800,minBitrate:180},Ie[exports.RCResolution.W640_H480]={width:640,height:480,maxBitrate:900,minBitrate:200},Ie[exports.RCResolution.W720_H480]={width:720,height:480,maxBitrate:1e3,minBitrate:200},Ie[exports.RCResolution.W848_H480]={width:848,height:480,maxBitrate:1860,minBitrate:200},Ie[exports.RCResolution.W960_H540]={width:960,height:540,maxBitrate:1500,minBitrate:250},Ie[exports.RCResolution.W960_H720]={width:960,height:720,maxBitrate:2e3,minBitrate:250},Ie[exports.RCResolution.W1280_H720]={width:1280,height:720,maxBitrate:2200,minBitrate:250},Ie[exports.RCResolution.W1920_H1080]={width:1920,height:1080,maxBitrate:4e3,minBitrate:400},Ie),Ae=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},we={10:1,15:1,24:1.5,30:1.5};exports.RCRTCCode=void 0,(Le=exports.RCRTCCode||(exports.RCRTCCode={}))[Le.SUCCESS=1e4]="SUCCESS",Le[Le.PB_ERROR=40001]="PB_ERROR",Le[Le.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",Le[Le.PARAMS_ERROR=50001]="PARAMS_ERROR",Le[Le.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",Le[Le.NOT_IN_ROOM=50003]="NOT_IN_ROOM",Le[Le.SERVICE_INVALID=50004]="SERVICE_INVALID",Le[Le.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",Le[Le.SIGNAL_ERROR=53001]="SIGNAL_ERROR",Le[Le.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",Le[Le.REQUEST_FAILED=53004]="REQUEST_FAILED",Le[Le.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",Le[Le.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",Le[Le.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",Le[Le.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",Le[Le.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",Le[Le.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",Le[Le.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",Le[Le.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",Le[Le.INVALID_TAGS=53014]="INVALID_TAGS",Le[Le.INVALID_USER_ID=53015]="INVALID_USER_ID",Le[Le.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",Le[Le.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",Le[Le.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",Le[Le.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",Le[Le.TRACK_NOT_READY=53020]="TRACK_NOT_READY",Le[Le.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",Le[Le.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",Le[Le.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",Le[Le.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",Le[Le.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",Le[Le.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",Le[Le.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",Le[Le.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",Le[Le.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",Le[Le.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",Le[Le.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",Le[Le.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",Le[Le.JWT_TIME_OUT=1004]="JWT_TIME_OUT",Le[Le.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",Le[Le.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",Le[Le.COMMAND_EXCUTE_FAILED=53035]="COMMAND_EXCUTE_FAILED",Le[Le.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",Le[Le.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED",Le[Le.DATACHANNEL_OPEN_TIMEOUT=53038]="DATACHANNEL_OPEN_TIMEOUT",Le[Le.SUB_VIDEO_TIMEOUT=53039]="SUB_VIDEO_TIMEOUT",Le[Le.SET_LOCAL_DESCRIPTION_FAILED=53040]="SET_LOCAL_DESCRIPTION_FAILED",Le[Le.SUB_VIDEO_EXPIRED=53041]="SUB_VIDEO_EXPIRED";var ke={getCameras:function(){return a(void 0,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"videoinput"===e.kind}))]}}))}))},getMicrophones:function(){return a(void 0,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audioinput"===e.kind}))]}}))}))},getSpeakers:function(){return a(void 0,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audiooutput"===e.kind}))]}}))}))}},Ne=function(){function e(){}return Object.defineProperty(e,"getMemo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._memo||(this._memo={}),window.__memo__=this._memo,this._memo}}),Object.defineProperty(e,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._memo={}}}),Object.defineProperty(e,"_memo",{enumerable:!0,configurable:!0,writable:!0,value:{}}),e}();function De(e){let t=e.length;for(;--t>=0;)e[t]=0}const Me=256,xe=286,Ue=30,je=15,Be=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Ve=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Fe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Je=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),He=new Array(576);De(He);const Ge=new Array(60);De(Ge);const Ke=new Array(512);De(Ke);const qe=new Array(256);De(qe);const We=new Array(29);De(We);const ze=new Array(Ue);function Qe(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let Ye,Ze,Xe;function $e(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}De(ze);const et=e=>e<256?Ke[e]:Ke[256+(e>>>7)],tt=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},rt=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,tt(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},nt=(e,t,r)=>{rt(e,r[2*t],r[2*t+1])},it=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},ot=(e,t,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=je;i++)a=a+r[i-1]<<1,n[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=it(n[t]++,t))}},at=e=>{let t;for(t=0;t<xe;t++)e.dyn_ltree[2*t]=0;for(t=0;t<Ue;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},st=e=>{e.bi_valid>8?tt(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},ct=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},ut=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&ct(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!ct(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},lt=(e,t,r)=>{let n,i,o,a,s=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+s++],n+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===n?nt(e,i,t):(o=qe[i],nt(e,o+Me+1,t),a=Be[o],0!==a&&(i-=We[o],rt(e,i,a)),n--,o=et(n),nt(e,o,r),a=Ve[o],0!==a&&(n-=ze[o],rt(e,n,a)))}while(s<e.sym_next);nt(e,256,t)},dt=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(e.heap[++e.heap_len]=u=a,e.depth[a]=0):r[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)ut(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ut(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[2*c]=r[2*a]+r[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[2*a+1]=r[2*s+1]=c,e.heap[1]=c++,ut(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,d,p,_,f,b=0;for(p=0;p<=je;p++)e.bl_count[p]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],p=r[2*r[2*l+1]+1]+1,p>c&&(p=c,b++),r[2*l+1]=p,l>n||(e.bl_count[p]++,_=0,l>=s&&(_=a[l-s]),f=r[2*l],e.opt_len+=f*(p+_),o&&(e.static_len+=f*(i[2*l+1]+_)));if(0!==b){do{for(p=c-1;0===e.bl_count[p];)p--;e.bl_count[p]--,e.bl_count[p+1]+=2,e.bl_count[c]--,b-=2}while(b>0);for(p=c;0!==p;p--)for(l=e.bl_count[p];0!==l;)d=e.heap[--u],d>n||(r[2*d+1]!==p&&(e.opt_len+=(p-r[2*d+1])*r[2*d],r[2*d+1]=p),l--)}})(e,t),ot(r,u,e.bl_count)},pt=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))},_t=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{nt(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(nt(e,i,e.bl_tree),s--),nt(e,16,e.bl_tree),rt(e,s-3,2)):s<=10?(nt(e,17,e.bl_tree),rt(e,s-3,3)):(nt(e,18,e.bl_tree),rt(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}};let ft=!1;const bt=(e,t,r,n)=>{rt(e,0+(n?1:0),3),st(e),tt(e,r),tt(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var mt=(e,t,r,n)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<Me;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),dt(e,e.l_desc),dt(e,e.d_desc),a=(e=>{let t;for(pt(e,e.dyn_ltree,e.l_desc.max_code),pt(e,e.dyn_dtree,e.d_desc.max_code),dt(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Je[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?bt(e,t,r,n):4===e.strategy||o===i?(rt(e,2+(n?1:0),3),lt(e,He,Ge)):(rt(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(rt(e,t-257,5),rt(e,r-1,5),rt(e,n-4,4),i=0;i<n;i++)rt(e,e.bl_tree[2*Je[i]+1],3);_t(e,e.dyn_ltree,t-1),_t(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),lt(e,e.dyn_ltree,e.dyn_dtree)),at(e),n&&st(e)},ht={_tr_init:e=>{ft||((()=>{let e,t,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(We[n]=r,e=0;e<1<<Be[n];e++)qe[r++]=n;for(qe[r-1]=n,i=0,n=0;n<16;n++)for(ze[n]=i,e=0;e<1<<Ve[n];e++)Ke[i++]=n;for(i>>=7;n<Ue;n++)for(ze[n]=i<<7,e=0;e<1<<Ve[n]-7;e++)Ke[256+i++]=n;for(t=0;t<=je;t++)o[t]=0;for(e=0;e<=143;)He[2*e+1]=8,e++,o[8]++;for(;e<=255;)He[2*e+1]=9,e++,o[9]++;for(;e<=279;)He[2*e+1]=7,e++,o[7]++;for(;e<=287;)He[2*e+1]=8,e++,o[8]++;for(ot(He,287,o),e=0;e<Ue;e++)Ge[2*e+1]=5,Ge[2*e]=it(e,5);Ye=new Qe(He,Be,257,xe,je),Ze=new Qe(Ge,Ve,0,Ue,je),Xe=new Qe(new Array(0),Fe,0,19,7)})(),ft=!0),e.l_desc=new $e(e.dyn_ltree,Ye),e.d_desc=new $e(e.dyn_dtree,Ze),e.bl_desc=new $e(e.bl_tree,Xe),e.bi_buf=0,e.bi_valid=0,at(e)},_tr_stored_block:bt,_tr_flush_block:mt,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(qe[r]+Me+1)]++,e.dyn_dtree[2*et(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{rt(e,2,3),nt(e,256,He),(e=>{16===e.bi_valid?(tt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var gt=(e,t,r,n)=>{let i=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+t[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16};const vt=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var Rt=(e,t,r,n)=>{const i=vt,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return~e},Ct={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Tt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:St,_tr_stored_block:yt,_tr_flush_block:Et,_tr_tally:Ot,_tr_align:It}=ht,{Z_NO_FLUSH:Lt,Z_PARTIAL_FLUSH:Pt,Z_FULL_FLUSH:At,Z_FINISH:wt,Z_BLOCK:kt,Z_OK:Nt,Z_STREAM_END:Dt,Z_STREAM_ERROR:Mt,Z_DATA_ERROR:xt,Z_BUF_ERROR:Ut,Z_DEFAULT_COMPRESSION:jt,Z_FILTERED:Bt,Z_HUFFMAN_ONLY:Vt,Z_RLE:Ft,Z_FIXED:Jt,Z_DEFAULT_STRATEGY:Ht,Z_UNKNOWN:Gt,Z_DEFLATED:Kt}=Tt,qt=258,Wt=262,zt=42,Qt=113,Yt=666,Zt=(e,t)=>(e.msg=Ct[t],t),Xt=e=>2*e-(e>4?9:0),$t=e=>{let t=e.length;for(;--t>=0;)e[t]=0},er=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let tr=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const rr=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},nr=(e,t)=>{Et(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,rr(e.strm)},ir=(e,t)=>{e.pending_buf[e.pending++]=t},or=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},ar=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=gt(e.adler,t,i,r):2===e.state.wrap&&(e.adler=Rt(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},sr=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-Wt?e.strstart-(e.w_size-Wt):0,u=e.window,l=e.w_mask,d=e.prev,p=e.strstart+qt;let _=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,u[r+a]===f&&u[r+a-1]===_&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<p);if(n=qt-(p-o),o=p-qt,n>a){if(e.match_start=t,a=n,n>=s)break;_=u[o+a-1],f=u[o+a]}}}while((t=d[t&l])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead},cr=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Wt)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),er(e),n+=t),0===e.strm.avail_in)break;if(r=ar(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=tr(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=tr(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Wt&&0!==e.strm.avail_in)},ur=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==wt||t===Lt||r!==n+e.strm.avail_in))break;a=t===wt&&r===n+e.strm.avail_in?1:0,yt(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,rr(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(ar(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==Lt&&t!==wt&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(ar(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===wt)&&t!==Lt&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,a=t===wt&&0===e.strm.avail_in&&r===n?1:0,yt(e,e.block_start,r,a),e.block_start+=r,rr(e.strm)),a?3:1)},lr=(e,t)=>{let r,n;for(;;){if(e.lookahead<Wt){if(cr(e),e.lookahead<Wt&&t===Lt)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=tr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-Wt&&(e.match_length=sr(e,r)),e.match_length>=3)if(n=Ot(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=tr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=tr(e,e.ins_h,e.window[e.strstart+1]);else n=Ot(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(nr(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===wt?(nr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nr(e,!1),0===e.strm.avail_out)?1:2},dr=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<Wt){if(cr(e),e.lookahead<Wt&&t===Lt)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=tr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-Wt&&(e.match_length=sr(e,r),e.match_length<=5&&(e.strategy===Bt||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=Ot(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=tr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(nr(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=Ot(e,0,e.window[e.strstart-1]),n&&nr(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Ot(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===wt?(nr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nr(e,!1),0===e.strm.avail_out)?1:2};function pr(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const _r=[new pr(0,0,0,0,ur),new pr(4,4,8,4,lr),new pr(4,5,16,8,lr),new pr(4,6,32,32,lr),new pr(4,4,16,16,dr),new pr(8,16,32,32,dr),new pr(8,16,128,128,dr),new pr(8,32,128,256,dr),new pr(32,128,258,1024,dr),new pr(32,258,258,4096,dr)];function fr(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Kt,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),$t(this.dyn_ltree),$t(this.dyn_dtree),$t(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),$t(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),$t(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const br=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==zt&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Qt&&t.status!==Yt?1:0},mr=e=>{if(br(e))return Zt(e,Mt);e.total_in=e.total_out=0,e.data_type=Gt;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?zt:Qt,e.adler=2===t.wrap?0:1,t.last_flush=-2,St(t),Nt},hr=e=>{const t=mr(e);var r;return t===Nt&&((r=e.state).window_size=2*r.w_size,$t(r.head),r.max_lazy_match=_r[r.level].max_lazy,r.good_match=_r[r.level].good_length,r.nice_match=_r[r.level].nice_length,r.max_chain_length=_r[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},gr=(e,t,r,n,i,o)=>{if(!e)return Mt;let a=1;if(t===jt&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==Kt||n<8||n>15||t<0||t>9||o<0||o>Jt||8===n&&1!==a)return Zt(e,Mt);8===n&&(n=9);const s=new fr;return e.state=s,s.strm=e,s.status=zt,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=r,hr(e)};var vr={deflateInit:(e,t)=>gr(e,t,Kt,15,8,Ht),deflateInit2:gr,deflateReset:hr,deflateResetKeep:mr,deflateSetHeader:(e,t)=>br(e)||2!==e.state.wrap?Mt:(e.state.gzhead=t,Nt),deflate:(e,t)=>{if(br(e)||t>kt||t<0)return e?Zt(e,Mt):Mt;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===Yt&&t!==wt)return Zt(e,0===e.avail_out?Ut:Mt);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(rr(e),0===e.avail_out)return r.last_flush=-1,Nt}else if(0===e.avail_in&&Xt(t)<=Xt(n)&&t!==wt)return Zt(e,Ut);if(r.status===Yt&&0!==e.avail_in)return Zt(e,Ut);if(r.status===zt&&0===r.wrap&&(r.status=Qt),r.status===zt){let t=Kt+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=Vt||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,or(r,t),0!==r.strstart&&(or(r,e.adler>>>16),or(r,65535&e.adler)),e.adler=1,r.status=Qt,rr(e),0!==r.pending)return r.last_flush=-1,Nt}if(57===r.status)if(e.adler=0,ir(r,31),ir(r,139),ir(r,8),r.gzhead)ir(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ir(r,255&r.gzhead.time),ir(r,r.gzhead.time>>8&255),ir(r,r.gzhead.time>>16&255),ir(r,r.gzhead.time>>24&255),ir(r,9===r.level?2:r.strategy>=Vt||r.level<2?4:0),ir(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(ir(r,255&r.gzhead.extra.length),ir(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Rt(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(ir(r,0),ir(r,0),ir(r,0),ir(r,0),ir(r,0),ir(r,9===r.level?2:r.strategy>=Vt||r.level<2?4:0),ir(r,3),r.status=Qt,rr(e),0!==r.pending)return r.last_flush=-1,Nt;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=Rt(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,rr(e),0!==r.pending)return r.last_flush=-1,Nt;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=Rt(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Rt(e.adler,r.pending_buf,r.pending-n,n)),rr(e),0!==r.pending)return r.last_flush=-1,Nt;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,ir(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Rt(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=Rt(e.adler,r.pending_buf,r.pending-n,n)),rr(e),0!==r.pending)return r.last_flush=-1,Nt;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,ir(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=Rt(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(rr(e),0!==r.pending))return r.last_flush=-1,Nt;ir(r,255&e.adler),ir(r,e.adler>>8&255),e.adler=0}if(r.status=Qt,rr(e),0!==r.pending)return r.last_flush=-1,Nt}if(0!==e.avail_in||0!==r.lookahead||t!==Lt&&r.status!==Yt){let n=0===r.level?ur(r,t):r.strategy===Vt?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(cr(e),0===e.lookahead)){if(t===Lt)return 1;break}if(e.match_length=0,r=Ot(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(nr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===wt?(nr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nr(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===Ft?((e,t)=>{let r,n,i,o;const a=e.window;for(;;){if(e.lookahead<=qt){if(cr(e),e.lookahead<=qt&&t===Lt)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+qt;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=qt-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Ot(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Ot(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(nr(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===wt?(nr(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nr(e,!1),0===e.strm.avail_out)?1:2})(r,t):_r[r.level].func(r,t);if(3!==n&&4!==n||(r.status=Yt),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),Nt;if(2===n&&(t===Pt?It(r):t!==kt&&(yt(r,0,0,!1),t===At&&($t(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),rr(e),0===e.avail_out))return r.last_flush=-1,Nt}return t!==wt?Nt:r.wrap<=0?Dt:(2===r.wrap?(ir(r,255&e.adler),ir(r,e.adler>>8&255),ir(r,e.adler>>16&255),ir(r,e.adler>>24&255),ir(r,255&e.total_in),ir(r,e.total_in>>8&255),ir(r,e.total_in>>16&255),ir(r,e.total_in>>24&255)):(or(r,e.adler>>>16),or(r,65535&e.adler)),rr(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Nt:Dt)},deflateEnd:e=>{if(br(e))return Mt;const t=e.state.status;return e.state=null,t===Qt?Zt(e,xt):Nt},deflateSetDictionary:(e,t)=>{let r=t.length;if(br(e))return Mt;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==zt||n.lookahead)return Mt;if(1===i&&(e.adler=gt(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&($t(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,cr(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=tr(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,cr(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,n.wrap=i,Nt},deflateInfo:"pako deflate (from Nodeca project)"};const Rr=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Cr=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Rr(r,t)&&(e[t]=r[t])}}return e},Tr=e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r};let Sr=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Sr=!1}const yr=new Uint8Array(256);for(let e=0;e<256;e++)yr[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;yr[254]=yr[254]=1;var Er=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},Or=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let a=yr[t];if(a>4)o[i++]=65533,n+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&n<r;)t=t<<6|63&e[n++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Sr)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},Ir=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+yr[e[r]]>t?r:t};var Lr=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Pr=Object.prototype.toString,{Z_NO_FLUSH:Ar,Z_SYNC_FLUSH:wr,Z_FULL_FLUSH:kr,Z_FINISH:Nr,Z_OK:Dr,Z_STREAM_END:Mr,Z_DEFAULT_COMPRESSION:xr,Z_DEFAULT_STRATEGY:Ur,Z_DEFLATED:jr}=Tt;function Br(e){this.options=Cr({level:xr,method:jr,chunkSize:16384,windowBits:15,memLevel:8,strategy:Ur},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Lr,this.strm.avail_out=0;let r=vr.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Dr)throw new Error(Ct[r]);if(t.header&&vr.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Er(t.dictionary):"[object ArrayBuffer]"===Pr.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=vr.deflateSetDictionary(this.strm,e),r!==Dr)throw new Error(Ct[r]);this._dict_set=!0}}function Vr(e,t){const r=new Br(t);if(r.push(e,!0),r.err)throw r.msg||Ct[r.err];return r.result}Br.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Nr:Ar,"string"==typeof e?r.input=Er(e):"[object ArrayBuffer]"===Pr.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===wr||o===kr)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=vr.deflate(r,o),i===Mr)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=vr.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Dr;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Br.prototype.onData=function(e){this.chunks.push(e)},Br.prototype.onEnd=function(e){e===Dr&&(this.result=Tr(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var Fr={Deflate:Br,deflate:Vr,deflateRaw:function(e,t){return(t=t||{}).raw=!0,Vr(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,Vr(e,t)},constants:Tt};const Jr=16209;var Hr=function(e,t){let r,n,i,o,a,s,c,u,l,d,p,_,f,b,m,h,g,v,R,C,T,S,y,E;const O=e.state;r=e.next_in,y=e.input,n=r+(e.avail_in-5),i=e.next_out,E=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=O.dmax,c=O.wsize,u=O.whave,l=O.wnext,d=O.window,p=O.hold,_=O.bits,f=O.lencode,b=O.distcode,m=(1<<O.lenbits)-1,h=(1<<O.distbits)-1;e:do{_<15&&(p+=y[r++]<<_,_+=8,p+=y[r++]<<_,_+=8),g=f[p&m];t:for(;;){if(v=g>>>24,p>>>=v,_-=v,v=g>>>16&255,0===v)E[i++]=65535&g;else{if(!(16&v)){if(64&v){if(32&v){O.mode=16191;break e}e.msg="invalid literal/length code",O.mode=Jr;break e}g=f[(65535&g)+(p&(1<<v)-1)];continue t}for(R=65535&g,v&=15,v&&(_<v&&(p+=y[r++]<<_,_+=8),R+=p&(1<<v)-1,p>>>=v,_-=v),_<15&&(p+=y[r++]<<_,_+=8,p+=y[r++]<<_,_+=8),g=b[p&h];;){if(v=g>>>24,p>>>=v,_-=v,v=g>>>16&255,16&v){if(C=65535&g,v&=15,_<v&&(p+=y[r++]<<_,_+=8,_<v&&(p+=y[r++]<<_,_+=8)),C+=p&(1<<v)-1,C>s){e.msg="invalid distance too far back",O.mode=Jr;break e}if(p>>>=v,_-=v,v=i-o,C>v){if(v=C-v,v>u&&O.sane){e.msg="invalid distance too far back",O.mode=Jr;break e}if(T=0,S=d,0===l){if(T+=c-v,v<R){R-=v;do{E[i++]=d[T++]}while(--v);T=i-C,S=E}}else if(l<v){if(T+=c+l-v,v-=l,v<R){R-=v;do{E[i++]=d[T++]}while(--v);if(T=0,l<R){v=l,R-=v;do{E[i++]=d[T++]}while(--v);T=i-C,S=E}}}else if(T+=l-v,v<R){R-=v;do{E[i++]=d[T++]}while(--v);T=i-C,S=E}for(;R>2;)E[i++]=S[T++],E[i++]=S[T++],E[i++]=S[T++],R-=3;R&&(E[i++]=S[T++],R>1&&(E[i++]=S[T++]))}else{T=i-C;do{E[i++]=E[T++],E[i++]=E[T++],E[i++]=E[T++],R-=3}while(R>2);R&&(E[i++]=E[T++],R>1&&(E[i++]=E[T++]))}break}if(64&v){e.msg="invalid distance code",O.mode=Jr;break e}g=b[(65535&g)+(p&(1<<v)-1)]}}break}}while(r<n&&i<a);R=_>>3,r-=R,_-=R<<3,p&=(1<<_)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<a?a-i+257:257-(i-a),O.hold=p,O.bits=_};const Gr=15,Kr=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),qr=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Wr=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),zr=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Qr=(e,t,r,n,i,o,a,s)=>{const c=s.bits;let u,l,d,p,_,f,b=0,m=0,h=0,g=0,v=0,R=0,C=0,T=0,S=0,y=0,E=null;const O=new Uint16Array(16),I=new Uint16Array(16);let L,P,A,w=null;for(b=0;b<=Gr;b++)O[b]=0;for(m=0;m<n;m++)O[t[r+m]]++;for(v=c,g=Gr;g>=1&&0===O[g];g--);if(v>g&&(v=g),0===g)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(h=1;h<g&&0===O[h];h++);for(v<h&&(v=h),T=1,b=1;b<=Gr;b++)if(T<<=1,T-=O[b],T<0)return-1;if(T>0&&(0===e||1!==g))return-1;for(I[1]=0,b=1;b<Gr;b++)I[b+1]=I[b]+O[b];for(m=0;m<n;m++)0!==t[r+m]&&(a[I[t[r+m]]++]=m);if(0===e?(E=w=a,f=20):1===e?(E=Kr,w=qr,f=257):(E=Wr,w=zr,f=0),y=0,m=0,b=h,_=o,R=v,C=0,d=-1,S=1<<v,p=S-1,1===e&&S>852||2===e&&S>592)return 1;for(;;){L=b-C,a[m]+1<f?(P=0,A=a[m]):a[m]>=f?(P=w[a[m]-f],A=E[a[m]-f]):(P=96,A=0),u=1<<b-C,l=1<<R,h=l;do{l-=u,i[_+(y>>C)+l]=L<<24|P<<16|A}while(0!==l);for(u=1<<b-1;y&u;)u>>=1;if(0!==u?(y&=u-1,y+=u):y=0,m++,0==--O[b]){if(b===g)break;b=t[r+a[m]]}if(b>v&&(y&p)!==d){for(0===C&&(C=v),_+=h,R=b-C,T=1<<R;R+C<g&&(T-=O[R+C],!(T<=0));)R++,T<<=1;if(S+=1<<R,1===e&&S>852||2===e&&S>592)return 1;d=y&p,i[d]=v<<24|R<<16|_-o}}return 0!==y&&(i[_+y]=b-C<<24|64<<16),s.bits=v,0};const{Z_FINISH:Yr,Z_BLOCK:Zr,Z_TREES:Xr,Z_OK:$r,Z_STREAM_END:en,Z_NEED_DICT:tn,Z_STREAM_ERROR:rn,Z_DATA_ERROR:nn,Z_MEM_ERROR:on,Z_BUF_ERROR:an,Z_DEFLATED:sn}=Tt,cn=16180,un=16190,ln=16191,dn=16192,pn=16194,_n=16199,fn=16200,bn=16206,mn=16209,hn=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function gn(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const vn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<cn||t.mode>16211?1:0},Rn=e=>{if(vn(e))return rn;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=cn,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,$r},Cn=e=>{if(vn(e))return rn;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Rn(e)},Tn=(e,t)=>{let r;if(vn(e))return rn;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?rn:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Cn(e))},Sn=(e,t)=>{if(!e)return rn;const r=new gn;e.state=r,r.strm=e,r.window=null,r.mode=cn;const n=Tn(e,t);return n!==$r&&(e.state=null),n};let yn,En,On=!0;const In=e=>{if(On){yn=new Int32Array(512),En=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Qr(1,e.lens,0,288,yn,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Qr(2,e.lens,0,32,En,0,e.work,{bits:5}),On=!1}e.lencode=yn,e.lenbits=9,e.distcode=En,e.distbits=5},Ln=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var Pn={inflateReset:Cn,inflateReset2:Tn,inflateResetKeep:Rn,inflateInit:e=>Sn(e,15),inflateInit2:Sn,inflate:(e,t)=>{let r,n,i,o,a,s,c,u,l,d,p,_,f,b,m,h,g,v,R,C,T,S,y=0;const E=new Uint8Array(4);let O,I;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(vn(e)||!e.output||!e.input&&0!==e.avail_in)return rn;r=e.state,r.mode===ln&&(r.mode=dn),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,d=s,p=c,S=$r;e:for(;;)switch(r.mode){case cn:if(0===r.wrap){r.mode=dn;break}for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,E[0]=255&u,E[1]=u>>>8&255,r.check=Rt(r.check,E,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=mn;break}if((15&u)!==sn){e.msg="unknown compression method",r.mode=mn;break}if(u>>>=4,l-=4,T=8+(15&u),0===r.wbits&&(r.wbits=T),T>15||T>r.wbits){e.msg="invalid window size",r.mode=mn;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:ln,u=0,l=0;break;case 16181:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==sn){e.msg="unknown compression method",r.mode=mn;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=mn;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=Rt(r.check,E,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,E[2]=u>>>16&255,E[3]=u>>>24&255,r.check=Rt(r.check,E,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=Rt(r.check,E,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(E[0]=255&u,E[1]=u>>>8&255,r.check=Rt(r.check,E,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(_=r.length,_>s&&(_=s),_&&(r.head&&(T=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+_),T)),512&r.flags&&4&r.wrap&&(r.check=Rt(r.check,n,_,o)),s-=_,o+=_,r.length-=_),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;_=0;do{T=n[o+_++],r.head&&T&&r.length<65536&&(r.head.name+=String.fromCharCode(T))}while(T&&_<s);if(512&r.flags&&4&r.wrap&&(r.check=Rt(r.check,n,_,o)),s-=_,o+=_,T)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break e;_=0;do{T=n[o+_++],r.head&&T&&r.length<65536&&(r.head.comment+=String.fromCharCode(T))}while(T&&_<s);if(512&r.flags&&4&r.wrap&&(r.check=Rt(r.check,n,_,o)),s-=_,o+=_,T)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=mn;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=ln;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}e.adler=r.check=hn(u),u=0,l=0,r.mode=un;case un:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,tn;e.adler=r.check=1,r.mode=ln;case ln:if(t===Zr||t===Xr)break e;case dn:if(r.last){u>>>=7&l,l-=7&l,r.mode=bn;break}for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(In(r),r.mode=_n,t===Xr){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=mn}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=mn;break}if(r.length=65535&u,u=0,l=0,r.mode=pn,t===Xr)break e;case pn:r.mode=16195;case 16195:if(_=r.length,_){if(_>s&&(_=s),_>c&&(_=c),0===_)break e;i.set(n.subarray(o,o+_),a),s-=_,o+=_,c-=_,a+=_,r.length-=_;break}r.mode=ln;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=mn;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.lens[L[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,O={bits:r.lenbits},S=Qr(0,r.lens,0,19,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid code lengths set",r.mode=mn;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;y=r.lencode[u&(1<<r.lenbits)-1],m=y>>>24,h=y>>>16&255,g=65535&y,!(m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(g<16)u>>>=m,l-=m,r.lens[r.have++]=g;else{if(16===g){for(I=m+2;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(u>>>=m,l-=m,0===r.have){e.msg="invalid bit length repeat",r.mode=mn;break}T=r.lens[r.have-1],_=3+(3&u),u>>>=2,l-=2}else if(17===g){for(I=m+3;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=m,l-=m,T=0,_=3+(7&u),u>>>=3,l-=3}else{for(I=m+7;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=m,l-=m,T=0,_=11+(127&u),u>>>=7,l-=7}if(r.have+_>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=mn;break}for(;_--;)r.lens[r.have++]=T}}if(r.mode===mn)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=mn;break}if(r.lenbits=9,O={bits:r.lenbits},S=Qr(1,r.lens,0,r.nlen,r.lencode,0,r.work,O),r.lenbits=O.bits,S){e.msg="invalid literal/lengths set",r.mode=mn;break}if(r.distbits=6,r.distcode=r.distdyn,O={bits:r.distbits},S=Qr(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,O),r.distbits=O.bits,S){e.msg="invalid distances set",r.mode=mn;break}if(r.mode=_n,t===Xr)break e;case _n:r.mode=fn;case fn:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,Hr(e,p),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===ln&&(r.back=-1);break}for(r.back=0;y=r.lencode[u&(1<<r.lenbits)-1],m=y>>>24,h=y>>>16&255,g=65535&y,!(m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(h&&!(240&h)){for(v=m,R=h,C=g;y=r.lencode[C+((u&(1<<v+R)-1)>>v)],m=y>>>24,h=y>>>16&255,g=65535&y,!(v+m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,r.length=g,0===h){r.mode=16205;break}if(32&h){r.back=-1,r.mode=ln;break}if(64&h){e.msg="invalid literal/length code",r.mode=mn;break}r.extra=15&h,r.mode=16201;case 16201:if(r.extra){for(I=r.extra;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;y=r.distcode[u&(1<<r.distbits)-1],m=y>>>24,h=y>>>16&255,g=65535&y,!(m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(!(240&h)){for(v=m,R=h,C=g;y=r.distcode[C+((u&(1<<v+R)-1)>>v)],m=y>>>24,h=y>>>16&255,g=65535&y,!(v+m<=l);){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}u>>>=v,l-=v,r.back+=v}if(u>>>=m,l-=m,r.back+=m,64&h){e.msg="invalid distance code",r.mode=mn;break}r.offset=g,r.extra=15&h,r.mode=16203;case 16203:if(r.extra){for(I=r.extra;l<I;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=mn;break}r.mode=16204;case 16204:if(0===c)break e;if(_=p-c,r.offset>_){if(_=r.offset-_,_>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=mn;break}_>r.wnext?(_-=r.wnext,f=r.wsize-_):f=r.wnext-_,_>r.length&&(_=r.length),b=r.window}else b=i,f=a-r.offset,_=r.length;_>c&&(_=c),c-=_,r.length-=_;do{i[a++]=b[f++]}while(--_);0===r.length&&(r.mode=fn);break;case 16205:if(0===c)break e;i[a++]=r.length,c--,r.mode=fn;break;case bn:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=n[o++]<<l,l+=8}if(p-=c,e.total_out+=p,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?Rt(r.check,i,p,a-p):gt(r.check,i,p,a-p)),p=c,4&r.wrap&&(r.flags?u:hn(u))!==r.check){e.msg="incorrect data check",r.mode=mn;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===s)break e;s--,u+=n[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=mn;break}u=0,l=0}r.mode=16208;case 16208:S=en;break e;case mn:S=nn;break e;case 16210:return on;default:return rn}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,(r.wsize||p!==e.avail_out&&r.mode<mn&&(r.mode<bn||t!==Yr))&&Ln(e,e.output,e.next_out,p-e.avail_out),d-=e.avail_in,p-=e.avail_out,e.total_in+=d,e.total_out+=p,r.total+=p,4&r.wrap&&p&&(e.adler=r.check=r.flags?Rt(r.check,i,p,e.next_out-p):gt(r.check,i,p,e.next_out-p)),e.data_type=r.bits+(r.last?64:0)+(r.mode===ln?128:0)+(r.mode===_n||r.mode===pn?256:0),(0===d&&0===p||t===Yr)&&S===$r&&(S=an),S},inflateEnd:e=>{if(vn(e))return rn;let t=e.state;return t.window&&(t.window=null),e.state=null,$r},inflateGetHeader:(e,t)=>{if(vn(e))return rn;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,$r):rn},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return vn(e)?rn:(n=e.state,0!==n.wrap&&n.mode!==un?rn:n.mode===un&&(i=1,i=gt(i,t,r,0),i!==n.check)?nn:(o=Ln(e,t,r,r),o?(n.mode=16210,on):(n.havedict=1,$r)))},inflateInfo:"pako inflate (from Nodeca project)"};var An=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const wn=Object.prototype.toString,{Z_NO_FLUSH:kn,Z_FINISH:Nn,Z_OK:Dn,Z_STREAM_END:Mn,Z_NEED_DICT:xn,Z_STREAM_ERROR:Un,Z_DATA_ERROR:jn,Z_MEM_ERROR:Bn}=Tt;function Vn(e){this.options=Cr({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Lr,this.strm.avail_out=0;let r=Pn.inflateInit2(this.strm,t.windowBits);if(r!==Dn)throw new Error(Ct[r]);if(this.header=new An,Pn.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Er(t.dictionary):"[object ArrayBuffer]"===wn.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Pn.inflateSetDictionary(this.strm,t.dictionary),r!==Dn)))throw new Error(Ct[r])}Vn.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Nn:kn,"[object ArrayBuffer]"===wn.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=Pn.inflate(r,a),o===xn&&i&&(o=Pn.inflateSetDictionary(r,i),o===Dn?o=Pn.inflate(r,a):o===jn&&(o=xn));r.avail_in>0&&o===Mn&&r.state.wrap>0&&0!==e[r.next_in];)Pn.inflateReset(r),o=Pn.inflate(r,a);switch(o){case Un:case jn:case xn:case Bn:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===Mn))if("string"===this.options.to){let e=Ir(r.output,r.next_out),t=r.next_out-e,i=Or(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==Dn||0!==s){if(o===Mn)return o=Pn.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},Vn.prototype.onData=function(e){this.chunks.push(e)},Vn.prototype.onEnd=function(e){e===Dn&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Tr(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:Fn,deflate:Jn,deflateRaw:Hn,gzip:Gn}=Fr;var Kn=Gn;var qn,Wn=-1,zn=function(){function e(){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"setLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger=e}}),Object.defineProperty(e.prototype,"getLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._logger}}),Object.defineProperty(e.prototype,"createTraceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(null===(e=this._logger)||void 0===e?void 0:e.createTraceId())||"".concat(Date.now())}}),Object.defineProperty(e.prototype,"debug",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.debug(e,t,r)}}),Object.defineProperty(e.prototype,"info",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.info(e,t,r)}}),Object.defineProperty(e.prototype,"warn",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.warn(e,t,r)}}),Object.defineProperty(e.prototype,"error",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.error(e,t,r)}}),Object.defineProperty(e.prototype,"__statistics",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;null===(n=this._logger)||void 0===n||n.__statistics(e,t,r)}}),Object.defineProperty(e,"setLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger=e}}),Object.defineProperty(e,"getLogger",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._logger}}),Object.defineProperty(e,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:null}),e}(),Qn=new zn,Yn=function(){function e(){var e=this;Object.defineProperty(this,"_hostList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_iceCallback",{enumerable:!0,configurable:!0,writable:!0,value:function(t){return a(e,void 0,void 0,(function(){var e,r;return s(this,(function(n){if(t.candidate){if(""===t.candidate.candidate)return[2];e=t.candidate,r={type:e.type,foundation:e.foundation,protocol:e.protocol,address:e.address,port:e.port,priority:this._formatPriority(e.priority)},this._hostList.push(r)}return[2]}))}))}}),Object.defineProperty(this,"_gatheringStateChange",{enumerable:!0,configurable:!0,writable:!0,value:function(){var t,r;"complete"===(null===(t=e._peer)||void 0===t?void 0:t.iceGatheringState)&&(null===(r=e._peer)||void 0===r||r.close(),e._peer=null)}}),Object.defineProperty(this,"_iceCandidateError",{enumerable:!0,configurable:!0,writable:!0,value:function(t){var r;Qn.error(n.L_GET_LOCAL_SRFLX_ADDRESS_PEER_E,JSON.stringify({execute:"_iceCandidateError",stack:t.stack})),null===(r=e._peer)||void 0===r||r.close(),e._peer=null}})}return Object.defineProperty(e.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,o;return s(this,(function(a){switch(a.label){case 0:t={iceServers:[{urls:[e]}],iceTransportPolicy:"all"},r={offerToReceiveAudio:1},a.label=1;case 1:return a.trys.push([1,3,,4]),this._peer=new RTCPeerConnection(t),this._peer.onicecandidate=this._iceCallback,this._peer.onicegatheringstatechange=this._gatheringStateChange,this._peer.onicecandidateerror=this._iceCandidateError,[4,this._peer.createOffer(r)];case 2:return i=a.sent(),[3,4];case 3:return o=a.sent(),Qn.error(n.L_GET_LOCAL_SRFLX_ADDRESS_PEER_E,JSON.stringify({execute:"start",stack:o.stack})),[2];case 4:return this._peer.setLocalDescription(i),[2]}}))}))}}),Object.defineProperty(e.prototype,"_formatPriority",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[e>>24,e>>8&65535,255&e].join(" | ")}}),Object.defineProperty(e.prototype,"getSrflxAddress",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e=this;return s(this,(function(t){return[2,new Promise((function(t,r){e._getAsyncHostList(t,r)}))]}))}))}}),Object.defineProperty(e.prototype,"_getAsyncHostList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;setTimeout((function(){var n;if(r._peer)r._getAsyncHostList(e,t);else{var i=(null===(n=r._hostList.filter((function(e){return"srflx"===e.type&&"udp"===e.protocol}))[0])||void 0===n?void 0:n.address)||"";e(i)}}),100)}}),e}();!function(e){e[e.Debug=4]="Debug",e[e.Info=3]="Info",e[e.Warning=2]="Warning",e[e.Error=1]="Error"}(qn||(qn={}));var Zn,Xn,$n=new(function(){function e(){Object.defineProperty(this,"openedLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.openedLevel=window.localStorage.getItem("__rtc_debugger_opened__")}return Object.defineProperty(e.prototype,"debug",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=qn.Debug&&console.log.apply(console,l(["%c*====rtc debugger====* ","color: grey"],u(e),!1))}}),Object.defineProperty(e.prototype,"info",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=qn.Info&&console.log.apply(console,l(["%c*====rtc debugger====* ","color: blue"],u(e),!1))}}),Object.defineProperty(e.prototype,"warn",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=qn.Warning&&console.log.apply(console,l(["%c*====rtc debugger====* ","color: yellow"],u(e),!1))}}),Object.defineProperty(e.prototype,"error",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.openedLevel&&Number(this.openedLevel)>=qn.Error&&console.log.apply(console,l(["%c*====rtc debugger====* ","color: red"],u(e),!1))}}),e}()),ei=function(){return"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)}))},ti=function(t,r,i,o){return a(void 0,void 0,void 0,(function(){var c;return s(this,(function(u){switch(u.label){case 0:return c=[],[4,new Promise((function(t){setTimeout((function(){t({code:exports.RCRTCCode.SUCCESS})}),500);var n=0;r.map((function(u){return a(void 0,void 0,void 0,(function(){var a,l,d;return s(this,(function(s){switch(s.label){case 0:return a=u.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),l="".concat(a,"/rtc/detector/ping?t=").concat((_=9999,(p=1e3)+Math.floor(Math.random()*(_-p)))),d={jwt:o},[4,i.httpReq({url:l,body:JSON.stringify(d),timeout:5e3,method:e.HttpMethod.POST})];case 1:return 200===s.sent().status&&c.push(u.clusterId),++n>=r.length&&t({code:exports.RCRTCCode.SUCCESS}),[2]}var p,_}))}))}))})).catch((function(e){t.error(n.L_SDK_EXECUTE_E,JSON.stringify({execute:"getFastMediaUrl",error:e}))}))];case 1:return u.sent(),[2,c]}}))}))},ri=function(e){return e&&e.jwt||""},ni=function(t,r,i){return a(void 0,void 0,void 0,(function(){var a,c,u,l,d,p,_,f,b,m,h,g,v,R;return s(this,(function(s){switch(s.label){case 0:return a=function(e,t){var r,i;if(!t)return"";try{i=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(r){return e.warn(n.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===i.strategy)return"";var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return"";var a=o[0];return a.detectorManager?a.detectorManager:""}(r,i),c=ri(i),u=null,l=120,d=0,p="",(_=(i||{}).rtcStunServers)?(f=new Yn,b=null===(R=uo(_))||void 0===R?void 0:R[0],f.start("stun:".concat(b.host,":").concat(b.port)),[4,f.getSrflxAddress()]):[3,2];case 1:p=s.sent(),r.info(n.L_LOCAL_SRFLX_ADDRESS_O,p),s.label=2;case 2:return m={jwt:c},a?[4,t.httpReq({url:"".concat(a,"/rtc/detector/servers"),body:JSON.stringify(m),headers:o(o({},{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat($i.browser,"|").concat($i.version),ClientVersion:"5.7.10-enterprise-lz.50","Client-Session-Id":ei(),"Request-Id":Date.now().toString()}),{"Client-Ip":p}),method:e.HttpMethod.POST})]:[3,8];case 3:h=s.sent(),s.label=4;case 4:return s.trys.push([4,7,,8]),g=h.data&&JSON.parse(h.data).detectorAddrs,l=h.data&&JSON.parse(h.data).clientDetectMinute,d=h.data&&JSON.parse(h.data).resultCode,r.info(n.L_GET_MEDIA_SERVICE_LIST_O,h.data),g&&e.isArray(g)?[4,ti(r,g,t,c)]:[3,6];case 5:u=s.sent(),s.label=6;case 6:return[3,8];case 7:return v=s.sent(),r.error(n.L_SDK_EXECUTE_E,JSON.stringify({execute:"getDetectorUrls",error:v})),[3,8];case 8:return[2,{fastMediaUrl:u,clientDetectMinute:l,status:d}]}}))}))},ii=function(t,r,n){return void 0===n&&(n={platform:"PC",version:"1.0.1",device:co()}),a(void 0,void 0,void 0,(function(){var i,o;return s(this,(function(a){switch(a.label){case 0:return i=Ne.getMemo(),o=/Electron/.test(navigator.userAgent),[4,t.httpReq({url:"".concat("https://rtc-quantum-test.rongcloud.net/rtc/config/agent/sdk/v1","?platform=").concat(o?n.platform:"Web","&version=").concat(n.version,"&device=").concat(n.device,"&uid=").concat(r.getCurrentId()),method:e.HttpMethod.GET}).then((function(e){if($n.info("getRTCConfig: response",e),200===e.status){fo(e.data);var t=uo(e.data);return i.group=null==t?void 0:t.group,t}}))];case 1:return[2,a.sent()]}}))}))};!function(e){e.Exchange_KV="Exchange_KV",e.Exchange_SDP_Crypto="Exchange_SDP_Crypto",e.Exchange_SDP_Ext="Exchange_SDP_Ext",e.Exchange_SDP_SSRC="Exchange_SDP_SSRC",e.Exchange_SDP_Stream="Exchange_SDP_Stream",e.Exchange_SDP_Codec="Exchange_SDP_Codec",e.Exchange_SDP_Media="Exchange_SDP_Media",e.Exchange_SDP_Mid="Exchange_SDP_Mid",e.Exchange_SDP="Exchange_SDP",e.Exchange_Sub_Stream="Exchange_Sub_Stream",e.Exchange_Active_Audio="Exchange_Active_Audio",e.Exchange_Request="Exchange_Request",e.Exchange_Response="Exchange_Response"}(Xn||(Xn={}));var oi,ai,si=((Zn={})[Xn.Exchange_KV]=["key","value"],Zn[Xn.Exchange_SDP_Crypto]=["tp","line"],Zn[Xn.Exchange_SDP_Ext]=["sal","absts","tccno"],Zn[Xn.Exchange_SDP_SSRC]=["main","fec","fid"],Zn[Xn.Exchange_SDP_Stream]=["tag","mid","meid","ssrc"],Zn[Xn.Exchange_SDP_Codec]=["tp","payload","feedbackTypes","formatParameters"],Zn[Xn.Exchange_SDP_Media]=["ext","codecs","streams"],Zn[Xn.Exchange_SDP_Mid]=["id","status","mediaType"],Zn[Xn.Exchange_SDP]=["sid","ifrag","ipwd","setup","crypto","fingerprint","dataFormat","candidates","tag","mids","audioMedia","videoMedia"],Zn[Xn.Exchange_Sub_Stream]=["meid","userId","tag","audioSSRC","videoSSRC","videoSimulcast"],Zn[Xn.Exchange_Active_Audio]=["mslabel","ssrc"],Zn[Xn.Exchange_Request]=["sdp","subStreamList","roomType","xorMode","meid","snui"],Zn[Xn.Exchange_Response]=["code","msg","sdp","rtcFinger","xorMode","udpObfuscationKey","snui","clusterId","activeAudioList"],Zn),ci="\npackage Modules;\nmessage probuf {\n // KV 数据结构\n message ".concat(Xn.Exchange_KV,"\n {\n required string key=1;\n required string value=2;\n }\n\n // Crypto 数据结构\n message ").concat(Xn.Exchange_SDP_Crypto,"\n {\n optional int32 tp=1;\n optional string line=2;\n }\n\n // Crypto 数据结构\n message ").concat(Xn.Exchange_SDP_Ext,"\n {\n optional int32 sal=1;\n optional int32 absts=2;\n optional int32 tccno=3;\n }\n\n // SSRC 数据结构\n message ").concat(Xn.Exchange_SDP_SSRC,"\n {\n optional int64 main=1;\n optional int64 fec=2;\n optional int64 fid=3;\n }\n\n // Stream 数据结构\n message ").concat(Xn.Exchange_SDP_Stream,"\n {\n optional string tag=1; //默认值,不传\n optional string mid=2; //PC专有,Remote Stream 使用\n optional string meid=3; //Remote Stream 使用\n optional ").concat(Xn.Exchange_SDP_SSRC," ssrc=4;\n }\n\n // Codec 数据结构\n message ").concat(Xn.Exchange_SDP_Codec,"\n {\n optional int32 tp=1;\n optional string payload=2;\n repeated string feedbackTypes=3;\n repeated ").concat(Xn.Exchange_KV," formatParameters=4;\n }\n\n // Media 数据结构\n message ").concat(Xn.Exchange_SDP_Media,"\n {\n optional ").concat(Xn.Exchange_SDP_Ext," ext=1;\n repeated ").concat(Xn.Exchange_SDP_Codec," codecs=2;\n repeated ").concat(Xn.Exchange_SDP_Stream," streams=3;\n }\n\n // mid 数据结构,PC 专有\n message ").concat(Xn.Exchange_SDP_Mid,"\n {\n optional string id=1;\n optional string status=2;\n optional int32 mediaType=3;\n }\n\n // SDP\n message ").concat(Xn.Exchange_SDP,"\n {\n optional string sid=1; //local offer\n optional string ifrag=2; \n optional string ipwd=3;\n optional string setup=4; //PC专有\n optional ").concat(Xn.Exchange_SDP_Crypto," crypto=5;\n optional string fingerprint=6; //PC专有\n optional int32 dataFormat=7; \n repeated string candidates=8; //remote answer\n optional string tag=9; //传当默认流的tag, 没有下划线\n repeated ").concat(Xn.Exchange_SDP_Mid," mids=10; //PC专有\n optional ").concat(Xn.Exchange_SDP_Media," audioMedia=11;\n optional ").concat(Xn.Exchange_SDP_Media," videoMedia=12;\n }\n\n // 订阅流信息\n message ").concat(Xn.Exchange_Sub_Stream,"\n {\n optional string meid=1;\n optional string userId=2;\n optional string tag=3; //默认tag不传\n optional int32 audioSSRC=4;\n optional int32 videoSSRC=5;\n optional int32 videoSimulcast=6;\n }\n\n // Active Audio 信息\n message ").concat(Xn.Exchange_Active_Audio,"\n {\n optional string mslabel=1;\n optional int64 ssrc=2;\n }\n\n //Exchange Request\n message ").concat(Xn.Exchange_Request," {\n optional ").concat(Xn.Exchange_SDP," sdp=1;\n repeated ").concat(Xn.Exchange_Sub_Stream," subStreamList=2;\n optional int32 roomType=3;\n optional int32 xorMode=4;\n optional string meid=5;\n optional int32 snui=6;\n }\n\n //Exchange Response\n message ").concat(Xn.Exchange_Response," {\n optional int32 code = 1;\n optional string msg = 2;\n optional ").concat(Xn.Exchange_SDP," sdp=3;\n optional string rtcFinger=4; //Meeting\n optional int32 xorMode=5;\n optional string udpObfuscationKey=6;\n optional int32 snui=7;\n optional string clusterId=8;\n repeated ").concat(Xn.Exchange_Active_Audio," activeAudioList=9;\n }\n}\n");!function(e){e.GET="GET",e.POST="POST"}(oi||(oi={})),function(e){e[e.arrayBuffer=1]="arrayBuffer",e[e.blob=2]="blob",e[e.clone=3]="clone",e[e.formData=4]="formData",e[e.json=5]="json",e[e.text=6]="text"}(ai||(ai={}));var ui,li,di,pi,_i=function(e){if(!e)return $n.error("httpRequest: option not found"),Promise.reject("httpRequest: option not found");var t=e,r=t.url,n=t.method;t.query;var i=t.headers,o=t.body,c=t.timeout,u=t.dataType,l=t.cache,d=t.credentials,p=t.integrity,_=t.keepalive,f=t.mode;t.priority;var b=t.redirect,m=t.referrer,h=t.referrerPolicy,g=t.signal;if(!r)return $n.error("httpRequest: url invaild"),Promise.reject("httpRequest: url invaild");var v=new Promise((function(e,t){setTimeout((function(){t("timeout")}),c),fetch(r,{method:n,body:n===oi.GET?void 0:o,headers:i,cache:l,credentials:d,integrity:p,keepalive:_,mode:f,redirect:b,referrer:m,referrerPolicy:h,signal:g}).then((function(t){return a(void 0,void 0,void 0,(function(){var r,n;return s(this,(function(i){switch(i.label){case 0:if($n.debug("httpRequest response: ",t),r=t.status,!t.ok)return[3,15];switch(u){case ai.arrayBuffer:return[3,1];case ai.blob:return[3,3];case ai.clone:return[3,5];case ai.formData:return[3,7];case ai.text:return[3,9];case ai.json:return[3,11]}return[3,13];case 1:return[4,t.arrayBuffer()];case 2:case 4:case 6:case 8:case 10:case 12:case 14:return n=i.sent(),[3,15];case 3:return[4,t.blob()];case 5:return[4,t.clone()];case 7:return[4,t.formData()];case 9:return[4,t.text()];case 11:case 13:return[4,t.json()];case 15:return e({status:r,data:n}),[2]}}))}))})).catch((function(e){t(e)}))})).catch((function(e){return{status:0,data:e}}));return v},fi=function(e){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat($i.browser,"|").concat($i.version),ClientVersion:"5.7.10-enterprise-lz.50","Client-Session-Id":ei(),"Request-Id":Date.now().toString(),meid:zi(e)}},bi=function(){function t(r,n,i,o){void 0===o&&(o=5e3),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_msUrl",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_msInNavi",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_failedMs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clusterId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_msList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_refetchNaviInfoCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_qualityMsList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_customParams",{enumerable:!0,configurable:!0,writable:!0,value:""}),this._logger=this._context.logger;var a=localStorage.getItem("".concat(this._context.getAppkey(),"__fast_media_url__"));t.msInDetector=a?JSON.parse(a):[],t.isDetector||n.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED||this.detectorMediaSever()}return Object.defineProperty(t.prototype,"setCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._customParams=e}}),Object.defineProperty(t.prototype,"getCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._customParams}}),Object.defineProperty(t.prototype,"detectorMediaSever",{enumerable:!1,configurable:!0,writable:!0,value:function(r){void 0===r&&(r=!1);var n=this._context.getNaviInfo();if(t.jwtToken=(null==n?void 0:n.jwt)||"",!this._msUrl){var i=Date.now(),o=t.detectValidMinute+t.detectorTime>i;r&&(o=!1),t.isDetector=o,!o&&n&&e.notEmptyObject(n)&&(this._msList=[],this._getDetectorUrls(n))}}}),Object.defineProperty(t.prototype,"_getDetectorUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r;return a(this,void 0,void 0,(function(){var i,o,c,u=this;return s(this,(function(l){switch(l.label){case 0:return t.isDetector?[2]:(t.isDetector=!0,[4,ni(this._runtime,this._logger,e)]);case 1:return i=l.sent(),o=i.fastMediaUrl,c=i.clientDetectMinute,i.status===exports.RCRTCCode.JWT_TIME_OUT&&(this._refetchNaviInfoCount=this._refetchNaviInfoCount<10?this._refetchNaviInfoCount+1:10,setTimeout((function(){return a(u,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._context.getPluginContext().refetchNaviInfo()];case 1:return e.sent(),this.detectorMediaSever(),[2]}}))}))}),1e3*this._refetchNaviInfoCount)),this._refetchNaviInfoCount=0,null===(r=this._context.logger)||void 0===r||r.info(n.L_FAST_MEDIA_URL,JSON.stringify(o||[])),o&&o.length>0&&(localStorage.setItem("".concat(this._context.getAppkey(),"__fast_media_url__"),JSON.stringify(o)),t.msInDetector=o||[],t.detectorTime=Date.now(),t.detectValidMinute=60*c*1e3,this.setMediaServiceList()),[2]}}))}))}}),Object.defineProperty(t.prototype,"getNaviMS",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msUrl?[this._msUrl]:(e.notEmptyArray(this._msList)&&!this._clusterId||(this._msList=this.setMediaServiceList()),this._msList)}}),Object.defineProperty(t.prototype,"setMediaServiceList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var r,i,o,a=[];return this._clusterId&&(this._clusterId=this._clusterId.replace(/^(https?:\/\/)?/,"https://"),this._msList.push(this._clusterId)),e.notEmptyArray(t.msInDetector)&&(t.msInDetector=t.msInDetector.map((function(e){return e.replace(/^(https?:\/\/)?/,"https://")})),this._msList.push(t.msInDetector[0]),a=t.msInDetector.concat().splice(1,t.msInDetector.length-1)),0===this._msInNavi.length&&(0===this._failedMs.length?(r=this._msInNavi).push.apply(r,l([],u(function(e,t){var r,i;if(!e)return[];try{i=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(r){return t.warn(n.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===i.strategy)return[];var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return[];var a=o[0],s=[];return a.mediaServer&&s.push(a.mediaServer.replace(/^(https?:\/\/)?/,"https://")),a.backupMediaServer&&a.backupMediaServer.forEach((function(e){s.push(e.replace(/^(https?:\/\/)?/,"https://"))})),s}(this._context.getNaviInfo(),this._logger)),!1)):((i=this._msInNavi).push.apply(i,l([],u(this._failedMs),!1)),this._failedMs.length=0)),o=this._msInNavi.concat().splice(1,this._msInNavi.length-1),this._msList.push(this._msInNavi[0]),this._msList=l(l(l([],u(this._msList),!1),u(a),!1),u(o),!1),this._msList=l([],u(new Set(this._msList)),!1),this._logger.info(n.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList))),this._msList}}),Object.defineProperty(t.prototype,"clearCacheMsList",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._msList=[],this._clusterId="",t.msInDetector=[]}}),Object.defineProperty(t.prototype,"clearClusterId",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._clusterId="",this._msList=[]}}),Object.defineProperty(t.prototype,"_openGzip",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=JSON.stringify(t),n=r.length,i=new Uint8Array(n),a=0;a<n;a++)i[a]=r.charCodeAt(a);var s;return{headers:e=o(o({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=Kn(i,s)}}}),Object.defineProperty(t.prototype,"_dealRequestSuccessResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o){var a=uo(e);return a.rtcFinger&&(this._rtcFinger=a.rtcFinger),a.clusterId&&(this._clusterId=a.clusterId),this._logger.info(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:i.SUCCEEDED,url:t}),r),{code:exports.RCRTCCode.SUCCESS,data:a,qualityMsList:this._qualityMsList}}}),Object.defineProperty(t.prototype,"_request",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,c,d,p){return a(this,void 0,void 0,(function(){var a,_,f,b,m,h,g,v,R,C,T,S,y,E,O,I,L;return s(this,(function(s){switch(s.label){case 0:if(this._qualityMsList=[],a=this._context.getNaviInfo(),_=(null==a?void 0:a.openGzip)||!1,f=_?this._openGzip(r,c):{headers:r,body:c},b=f.headers,m=f.body,0===(h=this.getNaviMS()).length)return this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),d),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(m.rtcFinger=this._rtcFinger),g=0,s.label=1;case 1:return g<h.length?(v=Date.now(),R="",R=this._context.staticMediaServerUrl?"".concat(this._context.staticMediaServerUrl).concat(t):"".concat(h[g]).concat(t),C=fi(this._context.getCurrentId()),T=o(o({},C),b),S=/x-www-form-urlencoded/.test(T["Content-Type"])?m:JSON.stringify(m),y=C["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:R,"Request-Id":y}),d),[4,this._runtime.httpReq({url:R,body:S,headers:T,method:e.HttpMethod.POST,timeout:(null==a?void 0:a.timeOut)||this._timeout})]):[3,4];case 2:if(E=s.sent(),O=E.status,I=E.data,p&&this._qualityMsList.push({rsdur:Date.now()-v,rsid:y,rscod:200===O?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:R}),200===O)return[2,this._dealRequestSuccessResult(I,R,d)];(L=this._failedMs).push.apply(L,l([],u(this._msInNavi.splice(g,1)),!1)),this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:i.FAILED,msg:"request error -> Request-Id: ".concat(y,", status: ").concat(O,", url: ").concat(R),timeout:(null==a?void 0:a.timeOut)||this._timeout}),d),s.label=3;case 3:return g+=1,[3,1];case 4:return[2,{code:exports.RCRTCCode.REQUEST_FAILED,qualityMsList:this._qualityMsList}]}}))}))}}),Object.defineProperty(t.prototype,"_requestMini",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,c,d){var p,_;return a(this,void 0,void 0,(function(){var a,f,b,m,h,g,v,R,C,T,S,y,E;return s(this,(function(s){switch(s.label){case 0:if(this._qualityMsList=[],a=this._context.getNaviInfo(),0===(f=this.getNaviMS()).length)return this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),c),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(r.rtcFinger=this._rtcFinger),b=0,s.label=1;case 1:return b<f.length?(m=Date.now(),h="",h=this._context.staticMediaServerUrl?"".concat(this._context.staticMediaServerUrl).concat(e):"".concat(f[b]).concat(e),g=fi(this._context.getCurrentId()),v=o(o({},g),t),/x-www-form-urlencoded/.test(v["Content-Type"])||JSON.stringify(r),R=g["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:h,"Request-Id":R}),c),[4,_i({url:h,body:r,headers:{"Content-Type":"application/octet-stream","Cache-Control":"no-cache",Token:v.Token,Roomid:v.RoomId,"App-Key":v["App-Key"],"Request-Id":v["Request-Id"],ClientVersion:v.ClientVersion},method:oi.POST,timeout:(null==a?void 0:a.timeOut)||this._timeout,dataType:ai.arrayBuffer})]):[3,4];case 2:if(C=s.sent(),T=C.status,S=C.data,d&&this._qualityMsList.push({rsdur:Date.now()-m,rsid:R,rscod:200===T?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:h}),200===T)return y=null===(_=null===(p=this._context.miniSDPCodec)||void 0===p?void 0:p.decode(Xn.Exchange_Response,S))||void 0===_?void 0:_.encodeJSON(),[2,this._dealRequestSuccessResult(y,h,c,!0)];(E=this._failedMs).push.apply(E,l([],u(this._msInNavi.splice(b,1)),!1)),this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:i.FAILED,msg:"request error -> Request-Id: ".concat(R,", status: ").concat(T,", url: ").concat(h),timeout:(null==a?void 0:a.timeOut)||this._timeout}),c),s.label=3;case 3:return b+=1,[3,1];case 4:return[2,{code:exports.RCRTCCode.REQUEST_FAILED}]}}))}))}}),Object.defineProperty(t.prototype,"exchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return a(this,void 0,void 0,(function(){var i,o;return s(this,(function(a){switch(a.label){case 0:return(i=Ne.getMemo()).sendQos=!1,[4,this._request("/rtc/media/client/call/exchange",e,t,r,n)];case 1:return o=a.sent(),i.sendQos=!0,[2,o]}}))}))}}),Object.defineProperty(t.prototype,"meetingSubExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i;return s(this,(function(o){switch(o.label){case 0:return(n=Ne.getMemo()).sendQos=!1,[4,this._request("/rtc/media/client/bigroom/exchange",e,t,r)];case 1:return i=o.sent(),n.sendQos=!0,[2,i]}}))}))}}),Object.defineProperty(t.prototype,"miniSDPExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;return a(this,void 0,void 0,(function(){var i,o,a;return s(this,(function(s){switch(s.label){case 0:return(i=Ne.getMemo()).sendQos=!1,o=null===(n=this._context.miniSDPCodec)||void 0===n?void 0:n.encode(Xn.Exchange_Request,t),[4,this._requestMini("/rtc/media/v2/pb/call",e,o,r,void 0)];case 1:return a=s.sent(),i.sendQos=!0,[2,a]}}))}))}}),Object.defineProperty(t.prototype,"meetingSubExit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._request("/rtc/media/client/bigroom/exit",e,{})];case 1:return[2,t.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/rtc/media/exit",e,{},t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t,"isDetector",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(t,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),Object.defineProperty(t,"jwtToken",{enumerable:!0,configurable:!0,writable:!0,value:""}),t}();exports.RCRTCAudioRecordStatus=void 0,(ui=exports.RCRTCAudioRecordStatus||(exports.RCRTCAudioRecordStatus={}))[ui.Error=0]="Error",ui[ui.Resume=1]="Resume",exports.RCRTCStreamCode=void 0,(li=exports.RCRTCStreamCode||(exports.RCRTCStreamCode={}))[li.RCRTCStreamCodeDefault=0]="RCRTCStreamCodeDefault",li[li.RCRTCStreamCodeCantRecordAudioData=1]="RCRTCStreamCodeCantRecordAudioData",exports.RCRTCAudioRecordVolumeStatus=void 0,(di=exports.RCRTCAudioRecordVolumeStatus||(exports.RCRTCAudioRecordVolumeStatus={}))[di.Low=0]="Low",di[di.Normal=1]="Normal",function(e){e.AUDIO="audio",e.VIDEO="video"}(pi||(pi={}));var mi,hi,gi,vi=function(t){function o(e,r,n,i,o,a,s,c){void 0===c&&(c=ei());var u=t.call(this)||this;return Object.defineProperty(u,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(u,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"_meid",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"uuid",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"_localMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_remoteMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(u,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_streamId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"_msStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(u,"DataTrackId",{enumerable:!0,configurable:!0,writable:!0,value:"data-track-id"}),Object.defineProperty(u,"_code",{enumerable:!0,configurable:!0,writable:!0,value:exports.RCRTCStreamCode.RCRTCStreamCodeDefault}),Object.defineProperty(u,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u._streamId=[u._meid||u._userId||u._roomId,u._tag].join("_"),u._id=[u._streamId,u.isAudioTrack()?0:1].join("_"),u}return r(o,t),Object.defineProperty(o.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._streamId}}),Object.defineProperty(o.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._id}}),Object.defineProperty(o.prototype,"getUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userId}}),Object.defineProperty(o.prototype,"getMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._meid}}),Object.defineProperty(o.prototype,"__innerGetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msTrack}}),Object.defineProperty(o.prototype,"streamTrack",{get:function(){return this._msTrack},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"getTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._tag}}),Object.defineProperty(o.prototype,"isLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isLocalTrack}}),Object.defineProperty(o.prototype,"isVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"video"===this._kind}}),Object.defineProperty(o.prototype,"isAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"audio"===this._kind}}),Object.defineProperty(o.prototype,"isReady",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}}),Object.defineProperty(o.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;this._msTrack=e,this._localMuted=!(null==e?void 0:e.enabled),this._setLocalMuted(this._localMuted);var r=this._msStream=this._msStream||new MediaStream,i=r.getTracks()[0];i&&r.removeTrack(i),this._isLocalTrack||this._logger.warn(n.L_INNER_SET_TRACK_O,"trackId: ".concat(this._id,", track: ").concat(e?e.id:"undefined")),e?r.addTrack(e):this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(null===(t=this._logger)||void 0===t||t.info(n.L_REMOVE_SRC_OBJECT_O,"exec: __innerSetMediaStreamTrack -> ".concat(this.getTrackId())),this._element.pause(),this._element.srcObject=null,this._element=void 0)}}),Object.defineProperty(o.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,[2,exports.RCRTCCode.SUCCESS]}))}))}}),Object.defineProperty(o.prototype,"mute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this._setLocalMuted(!0)]}))}))}}),Object.defineProperty(o.prototype,"unmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this._setLocalMuted(!1)]}))}))}}),Object.defineProperty(o.prototype,"isLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._localMuted}}),Object.defineProperty(o.prototype,"isOwnerMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteMuted}}),Object.defineProperty(o.prototype,"isDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!0}}),Object.defineProperty(o.prototype,"updateDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._code=e}}),Object.defineProperty(o.prototype,"getDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return void 0===e&&(e=!1),e?this._code:exports.RCRTCStreamCode.RCRTCStreamCodeDefault}}),Object.defineProperty(o.prototype,"_validateVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(null==t?void 0:t.volume){if(!e.isNumber(null==t?void 0:t.volume))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:exports.RCRTCCode.PARAMS_ERROR};(null==t?void 0:t.volume)<0&&(t.volume=0,this._logger.warn(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,msg:"params error -> options.volume < 0",tips:"the valid range of options.volume is 0-100, the value of volume has been set 0"}))),(null==t?void 0:t.volume)>100&&(t.volume=100,this._logger.warn(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,msg:"params error -> options.volume > 100",tips:"the valid range of options.volume is 0-100, the value of volume has been set 100"})))}}}),Object.defineProperty(o.prototype,"_validatePlayOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,o;return s(this,(function(a){switch(a.label){case 0:return this._msTrack?("ended"===this._msTrack.readyState&&this._logger.warn(n.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),(r=this._validateVolume(t))?[2,r]:(null==t?void 0:t.audioDeviceId)?[4,ke.getSpeakers()]:[3,2]):(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]);case 1:if(o=a.sent().map((function(e){return e.deviceId})),!o.includes(t.audioDeviceId))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}];a.label=2;case 2:return!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))?[2]:(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),[2,{code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT}])}}))}))}}),Object.defineProperty(o.prototype,"_setPlayAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e?[3,2]:[4,this._element.setSinkId(t.audioDeviceId)];case 1:n.sent(),n.label=2;case 2:return e||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=t.volume/100),null===(r=this._element)||void 0===r||r.setAttribute(this.DataTrackId,this.getTrackId()),[2]}}))}))}}),Object.defineProperty(o.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,o,c;return a(this,void 0,void 0,(function(){var u,l,d,p,_,f=this;return s(this,(function(b){switch(b.label){case 0:return u=Ne.getMemo(),l=Fi(this._id).identifier,d=null===(r=u.meidToUserIdMap)||void 0===r?void 0:r[l],null===(o=this._logger)||void 0===o||o.info(n.L_TRACK_PLAY_O,JSON.stringify({elementId:null==e?void 0:e.id,kind:null!==(c=this._kind)&&void 0!==c?c:"",options:t,msg:"start play trackId: ".concat(this._id," by user: ").concat(d)})),[4,this._validatePlayOptions(e,t)];case 1:return(p=b.sent())?[2,p]:(_=this.isVideoTrack(),this._element=_?e:new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=function(e){var t,r,o;null===(t=f._logger)||void 0===t||t.info(n.L_TRACK_LOAD_START_O,JSON.stringify({status:i.INFO,kind:null!==(r=f._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(o=e.target)||void 0===o?void 0:o.id,", trackId: ").concat(f._id," by user: ").concat(d)}))},this._element.ondurationchange=function(e){var t,r,o;null===(t=f._logger)||void 0===t||t.info(n.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:i.INFO,kind:null!==(r=f._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(o=e.target)||void 0===o?void 0:o.id,", trackId: ").concat(f._id," by user: ").concat(d)}))},this._element.onloadedmetadata=function(e){var t,r,o;null===(t=f._logger)||void 0===t||t.info(n.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:i.INFO,kind:null!==(r=f._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(o=e.target)||void 0===o?void 0:o.id,", trackId: ").concat(f._id," by user: ").concat(d)}))},this._element.onloadeddata=function(e){var t,r,o;null===(t=f._logger)||void 0===t||t.info(n.L_TRACK_LOADED_DATA_O,JSON.stringify({status:i.INFO,kind:null!==(r=f._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(o=e.target)||void 0===o?void 0:o.id,", trackId: ").concat(f._id," by user: ").concat(d)}))},this._element.onabort=function(e){var t,r,o;null===(t=f._logger)||void 0===t||t.info(n.L_TRACK_ABORT_O,JSON.stringify({status:i.INFO,kind:null!==(r=f._kind)&&void 0!==r?r:"",msg:"HTMLMediaElement onabort -> id: ".concat(null===(o=e.target)||void 0===o?void 0:o.id,", trackId: ").concat(f._id," by user: ").concat(d)}))},this._element.oncanplay=function(e){return a(f,void 0,void 0,(function(){var r,o,a,c,u,l,p,f,b,m,h;return s(this,(function(s){switch(s.label){case 0:null===(o=this._logger)||void 0===o||o.info(n.L_TRACK_CANPLAY_O,JSON.stringify({status:i.INFO,kind:null!==(a=this._kind)&&void 0!==a?a:"",msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(c=e.target)||void 0===c?void 0:c.id,", trackId: ").concat(this._id," by user: ").concat(d)})),s.label=1;case 1:return s.trys.push([1,5,,6]),!(null==t?void 0:t.audioDeviceId)||_?[3,3]:[4,this._element.setSinkId(t.audioDeviceId)];case 2:s.sent(),s.label=3;case 3:return[4,null===(u=this._element)||void 0===u?void 0:u.play()];case 4:return s.sent(),[3,6];case 5:return"No permission to use requested device"===(r=s.sent()).message?(null===(l=this._logger)||void 0===l||l.error(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,kind:null!==(p=this._kind)&&void 0!==p?p:"",code:exports.RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(r.message," -> id: ").concat(null===(f=e.target)||void 0===f?void 0:f.id,", trackId: ").concat(this._id," by user: ").concat(d)})),[2]):(null===(b=this._logger)||void 0===b||b.error(n.L_TRACK_PLAY_E,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.TRACK_PLAY_ERROR,kind:null!==(m=this._kind)&&void 0!==m?m:"",msg:"play error, error msg: ".concat(r.message," -> id: ").concat(null===(h=e.target)||void 0===h?void 0:h.id,", trackId: ").concat(this._id," by user: ").concat(d)})),[3,6]);case 6:return[2]}}))}))},this._element.onvolumechange=function(e){var t,r,o,a=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));null===(r=f._logger)||void 0===r||r.info(n.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:i.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(o=e.target)||void 0===o?void 0:o.id,", volume: ").concat(a,", trackId: ").concat(f._id," by user: ").concat(d)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,[4,this._setPlayAttrs(_,t)]);case 2:return b.sent(),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(o.prototype,"__innerDestroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.__innerSetMediaStreamTrack(void 0)}}),Object.defineProperty(o.prototype,"__releaseMediaElement",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(null===(e=this._logger)||void 0===e||e.info(n.L_REMOVE_SRC_OBJECT_O,JSON.stringify({exec:"__releaseMediaElement",trackId:this.getTrackId(),dataTrackId:this.DataTrackId})),this._element.pause(),this._element.remove(),this._element.srcObject=null,this._element=void 0)}}),Object.defineProperty(o.prototype,"_validateVideoNodeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}),Object.defineProperty(o.prototype,"__updateStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._streamId=Hi(e,this._tag)}}),Object.defineProperty(o.prototype,"__updateId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._id=Gi(e,this._tag,this.isAudioTrack()?0:1)}}),Object.defineProperty(o.prototype,"__updateMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._meid=e}}),Object.defineProperty(o,"__INNER_DECODE_FIRST__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-decode-first"}),o}(e.EventEmitter);exports.RCAudioBitrate=void 0,(gi=exports.RCAudioBitrate||(exports.RCAudioBitrate={})).Speech="Speech",gi.Music="Music",gi.MusicHigh="MusicHigh";var Ri,Ci=((mi={})[exports.RCAudioBitrate.Music]={max:64,min:64},mi[exports.RCAudioBitrate.MusicHigh]={max:128,min:128},mi[exports.RCAudioBitrate.Speech]={max:32,min:32},mi);exports.RCVideoBitrate=void 0,(Ri=exports.RCVideoBitrate||(exports.RCVideoBitrate={})).LEVEL0="LEVEL0",Ri.LEVEL1="LEVEL1",Ri.LEVEL2="LEVEL2",Ri.LEVEL3="LEVEL3",Ri.LEVEL4="LEVEL4",Ri.LEVEL5="LEVEL5";var Ti,Si=((hi={})[exports.RCVideoBitrate.LEVEL0]={max:150,min:80},hi[exports.RCVideoBitrate.LEVEL1]={max:280,min:120},hi[exports.RCVideoBitrate.LEVEL2]={max:650,min:150},hi[exports.RCVideoBitrate.LEVEL3]={max:1e3,min:200},hi[exports.RCVideoBitrate.LEVEL4]={max:2200,min:250},hi[exports.RCVideoBitrate.LEVEL5]={max:4e3,min:400},hi),yi=function(){function e(){}return Object.defineProperty(e,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,n,i,o,a,c;return s(this,(function(s){switch(s.label){case 0:r=new AudioContext({sampleRate:44100}),s.label=1;case 1:return s.trys.push([1,5,,6]),[4,r.audioWorklet.addModule(e.SCRIPT_URL)];case 2:return s.sent(),[4,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"})];case 3:return[4,s.sent().arrayBuffer()];case 4:return n=s.sent(),[3,6];case 5:return s.sent(),[2,{code:exports.RCRTCCode.LOAD_3A_MODULE_FAILED}];case 6:return i=r.createMediaStreamSource(new MediaStream([t])),o=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:n}}),a=r.createMediaStreamDestination(),i.connect(o).connect(a),c=a.stream.getAudioTracks()[0],e._maps.set(t.id,r),[2,{code:exports.RCRTCCode.SUCCESS,track:c}]}}))}))}}),Object.defineProperty(e,"release3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e._maps.get(t.id);r&&(r.close(),e._maps.delete(t.id))}}),Object.defineProperty(e,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/liangzi-alpha.1/AudioProcessing.wasm"}),Object.defineProperty(e,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/liangzi-alpha.1/process-worklet.js"}),Object.defineProperty(e,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),e}(),Ei=function(t){function o(e,r,n,i,o,a,s){var c=t.call(this,e,r,n,i,o,!0,void 0,s)||this;return Object.defineProperty(c,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_isPause",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_isPublished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_bitrateInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),c.__innerSetMediaStreamTrack(a),a.onended=function(){a.onended=null,c._onTrackEnded()},c}return r(o,t),Object.defineProperty(o.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(o.EVENT_LOCAL_TRACK_END,this),this.removeAll(o.EVENT_LOCAL_TRACK_END)}}),Object.defineProperty(o.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;return new Promise((function(i,a){var s,c=r._localMuted!==e;null===(s=r._logger)||void 0===s||s.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({localMuted:e,trackId:r._id})),t.prototype._setLocalMuted.call(r,e),r._remoteMuted=r._localMuted,i(exports.RCRTCCode.SUCCESS),c&&r.emit(o.__INNER_EVENT_MUTED_CHANGE__,r,i)}))}}),Object.defineProperty(o.prototype,"updateDeviceAvailable",{enumerable:!1,configurable:!0,writable:!0,value:function(e){t.prototype.updateDeviceAvailable.call(this,e),this.emit(o.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this,e)}}),Object.defineProperty(o.prototype,"onlyMute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this.__setLocalMuted(!0)]}))}))}}),Object.defineProperty(o.prototype,"onlyUnmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this.__setLocalMuted(!1)]}))}))}}),Object.defineProperty(o.prototype,"pause",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=Ne.getMemo(),i=r.naviInfo;return-1===((null==i?void 0:i.pauseVideoDelayMs)||-1)||(!r.crtRoom||(null===(t=this._logger)||void 0===t||t.info(n.L_PAUSE_VIDEO_T,JSON.stringify({userId:this.getUserId(),trackId:this.getTrackId()})),this._isPause=e,this.emit(o.__INNER_EVENT_SEND_CHANGE__,this,e),!0))}}),Object.defineProperty(o.prototype,"isPause",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPause}}),Object.defineProperty(o.prototype,"__setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r;return t.prototype._setLocalMuted.call(this,e),this._remoteMuted=this._localMuted,null===(r=this._logger)||void 0===r||r.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({localMuted:e,trackId:this._id})),Promise.resolve(exports.RCRTCCode.SUCCESS)}}),Object.defineProperty(o.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPublished=e}}),Object.defineProperty(o.prototype,"isPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPublished}}),Object.defineProperty(o.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r;this._isDestroyed||(null===(e=this._logger)||void 0===e||e.info(n.L_LOCAL_TRACK_DESTROY_O,JSON.stringify({trackId:this._id,uuid:this.uuid})),this._isDestroyed=!0,this._isPause=!1,null===(r=this._msTrack)||void 0===r||r.stop(),t.prototype.__innerDestroy.call(this),this.isAudioTrack()&&t.prototype.__releaseMediaElement.call(this),this._isPublished&&this.emit(o.__INNER_EVENT_DESTROY__,this))}}),Object.defineProperty(o.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(o.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){var a,s,c;if(void 0===t&&(t=0),void 0===r&&(r=0),void 0===o&&(o=0),!e.isNumber(t)||!e.isNumber(r)||!e.isNumber(o)||t<=0||r<=0||t<r)null===(s=this._logger)||void 0===s||s.error(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:i.FAILED,msg:"params error -> max: ".concat(t,",min: ").concat(r,", start: ").concat(o),trackId:this._id}));else{null===(c=this._logger)||void 0===c||c.info(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:i.SUCCEEDED,max:t,min:r,start:o,trackId:this._id}));var u=Ne.getMemo();u.startBitrate?u.startBitrate[this.getTrackId()]=o:u.startBitrate=((a={})[this.getTrackId()]=o,a),this._bitrateInfo={max:t,min:r,start:o}}}}),Object.defineProperty(o.prototype,"getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,n,i,o,a,s,c,u=0,l=0,d=0;return(null===(r=this._msTrack)||void 0===r?void 0:r.kind)===pi.VIDEO?(u=(e=Bi(this._msTrack)).min,l=e.max):(null===(n=this._msTrack)||void 0===n?void 0:n.kind)===pi.AUDIO&&(u=(t={min:32,max:32}).min,l=t.max),(null===(i=this._bitrateInfo)||void 0===i?void 0:i.max)&&(d=.7*(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)),{min:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.min)||u,max:(null===(s=this._bitrateInfo)||void 0===s?void 0:s.max)||l,start:(null===(c=this._bitrateInfo)||void 0===c?void 0:c.start)||d}}}),Object.defineProperty(o.prototype,"__updateInnerDataByMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){t.prototype.__updateStreamId.call(this,e),t.prototype.__updateId.call(this,e),t.prototype.__updateMeid.call(this,e)}}),Object.defineProperty(o,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(o,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(o,"__INNER_EVENT_SEND_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-send-change"}),Object.defineProperty(o,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"}),Object.defineProperty(o,"__INNER_EVENT_DEVICE_STATUS_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-device-status-change"}),o}(vi),Oi=function(t){function o(e,r,n,i,o,a){var s=t.call(this,e,r,n,i,"audio",o,a)||this;return Object.defineProperty(s,"_audioLevelMonitorTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_audioLevelMonitorTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_audioLevelAnalyser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_audioLevelMonitorGap",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),s._audioLevelMonitorTrack=o.clone(),s._createMonitor(),s}return r(o,t),Object.defineProperty(o.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e){t.prototype.__innerSetPublished.call(this,e)}}),Object.defineProperty(o.prototype,"_createMonitor",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(AudioContext){var e=new AudioContext,t=new MediaStream;t.addTrack(this._audioLevelMonitorTrack);var r=e.createMediaStreamSource(t),i=e.createAnalyser();i.fftSize=256,r.connect(i),this._audioLevelAnalyser=i,this._check()}else this._logger.warn(n.L_NOT_SUPPORT_AUDIO_LEVEL_MONITOR_O)}}),Object.defineProperty(o.prototype,"_getVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e.frequencyBinCount);e.getByteFrequencyData(t);for(var r=0,n=0;n<t.length;n++)r+=t[n];return r/t.length/255*100}}),Object.defineProperty(o.prototype,"_check",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;if(this._audioLevelAnalyser){var t=Ne.getMemo();clearInterval(this._audioLevelMonitorTimer);var r=0,i=[];this._audioLevelMonitorTimer=setInterval((function(){r++;var o=e._getVolume(e._audioLevelAnalyser);o<.1&&void 0!==t.audioRecordInputZeroCount?t.audioRecordInputZeroCount+=1:t.audioRecordInputZeroCount=o<.1?1:0,$n.debug("audioLevelMonitor: ","current: ",o),t.micAudioLevel=o,i.push(o),r/10==0&&(e._logger.debug(n.L_COLLECT_VOLUME_O,JSON.stringify({volumeList:i})),r=0,i=[])}),this._audioLevelMonitorGap),$n.debug("start audioLevelMonitor interval: ",this._audioLevelMonitorTimer)}}}),Object.defineProperty(o.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){$n.debug("destroy audioLevelMonitor interval: ",this._audioLevelMonitorTimer),clearInterval(this._audioLevelMonitorTimer),this._audioLevelMonitorTrack.stop(),t.prototype.destroy.call(this)}}),Object.defineProperty(o.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.validate("audioBitrate",t,(function(e){return e in exports.RCAudioBitrate}))){var r=Ci[t];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else this._logger.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:i.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}}),Object.defineProperty(o.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=u(r,2),o=i[0],a=void 0===o?1:o,s=i[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),Object.defineProperty(o.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){t.prototype.__innerSetMediaStreamTrack.call(this,e)}}),o}(Ei),Ii=function(t){function o(e,r,n,i,o,a,s){void 0===a&&(a=!1);var c=t.call(this,e,r,n,i,"video",o,s)||this;return Object.defineProperty(c,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:a}),c}return r(o,t),Object.defineProperty(o.prototype,"__isTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isTiny}}),Object.defineProperty(o.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getStreamId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(o.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getTrackId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(o.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r;if(e.validate("videoBitrate",t,(function(e){return e in exports.RCVideoBitrate}))){var o=Si[t];this.setBitrate(o.max,o.min,o.start||.7*o.max)}else null===(r=this._logger)||void 0===r||r.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:i.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}}),Object.defineProperty(o.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=u(r,2),o=i[0],a=void 0===o?1:o,s=i[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),o}(Ei),Li=function(e){function t(r,n,i,o,a,s,c){var u=e.call(this,r,n,i,o,a,s)||this;return Object.defineProperty(u,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:c}),t._innerSetMapping(u.getTrackId(),c),u}return r(t,e),Object.defineProperty(t,"_innerSetMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}}),Object.defineProperty(t,"_innerRemoveMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i=null===(r=this._mapping.get(t))||void 0===r?void 0:r.filter((function(t){return t!==e}));i&&i.length>0?this._mapping.set(t,i):(this._mapping.delete(t),t.pause(),t.src="",null===(n=t.parentNode)||void 0===n||n.removeChild(t))}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAudioTrack()&&this.mute(),t._innerRemoveMapping(this.getTrackId(),this._resource),e.prototype.destroy.call(this)}}),Object.defineProperty(t,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t}(Ei),Pi=function(e){function t(t,r,n,i,o,a){return e.call(this,t,r,n,i,"video",o,a)||this}return r(t,e),t}(Li),Ai=function(e){function t(t,r,n,i,o,a){return e.call(this,t,r,n,i,"audio",o,a)||this}return r(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){return s(this,(function(r){return this._resource&&(this._resource.muted=t),[2,e.prototype._setLocalMuted.call(this,t)]}))}))}}),Object.defineProperty(t.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._setLocalMuted(!1)];case 1:return e.sent(),[2,Promise.resolve({code:exports.RCRTCCode.SUCCESS})]}}))}))}}),t}(Li),wi=function(e){function t(t,r,n,i,o,a){var s=e.call(this,t,r,n,i,o,a)||this;return Object.defineProperty(s,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),s}return r(t,e),Object.defineProperty(t.prototype,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,t,r;return s(this,(function(o){switch(o.label){case 0:return this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_T),this._originTrack?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:i.FAILED,msg:"3A noise module already applied"})),[2,{code:exports.RCRTCCode.SUCCESS}]):!this._msTrack||this.isDestroyed()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:i.FAILED,msg:"track not ready"})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]):this.isPublished()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:i.FAILED,msg:"track already published"})),[2,{code:exports.RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH}]):[4,yi.apply3ANoiseWorklet(this._msTrack)];case 1:return e=o.sent(),t=e.code,r=e.track,t===exports.RCRTCCode.SUCCESS&&r?(this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:i.SUCCEEDED})),[2,{code:exports.RCRTCCode.SUCCESS}]):(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:i.FAILED,msg:"apply 3A noise module failed: ".concat(t)})),[2,{code:t}])}}))}))}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(t){!t&&this._originTrack&&(yi.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),e.prototype.__innerSetMediaStreamTrack.call(this,t)}}),t}(Oi),ki=function(e){function t(t,r,n,i,o,a){return e.call(this,t,r,n,i,o,!1,a)||this}return r(t,e),t}(Ii),Ni=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(Ei.__INNER_EVENT_DESTROY__,this)}}),t}(Ii),Di=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(Ei.__INNER_EVENT_DESTROY__,this)}}),t}(Oi);exports.RTCMode=void 0,(Ti=exports.RTCMode||(exports.RTCMode={}))[Ti.RTC=0]="RTC",Ti[Ti.LIVE=2]="LIVE",Ti[Ti.CROSS_MUTI=7]="CROSS_MUTI",Ti[Ti.CROSS_LIVE=8]="CROSS_LIVE",Ti[Ti.SIP=4]="SIP",Ti[Ti.CALL=5]="CALL",Ti[Ti.MEETING=6]="MEETING",Ti[Ti.NEW_MEETING=9]="NEW_MEETING",Ti[Ti.GROUP_CALL=10]="GROUP_CALL";var Mi=function(e){var t,r=null===(t=Ne.getMemo().crtRoom)||void 0===t?void 0:t.getCrtUserId();return JSON.stringify(e.map((function(e){return o(o({},e),{msid:Hi(r,Ji(e.nmsid||e.msid).tag),nmsid:e.nmsid||e.msid,meid:Ji(e.nmsid||e.msid).identifier})})))},xi=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},Ui=function(t){if(void 0===t)return 0;if(e.isNumber(t))return t;var r=t;return r.exact||r.ideal||r.max||0},ji=function(e){var t=e.getSettings(),r=e.getConstraints();return{width:Ui(r.width)||t.width||0,height:Ui(r.height)||t.height||0,frameRate:t.frameRate||Ui(r.frameRate)}},Bi=function(e){var t=ji(e),r=t.width,n=t.height,i=t.frameRate,o=function(e,t){e=Ae(e),t=Ae(t);var r=Pe["W".concat(e,"_H").concat(t)];if(r)return r;var n=e*t;return Object.keys(Pe).map((function(e){return Pe[e]})).sort((function(e,t){return e.height*e.width-t.width*t.height})).filter((function(e){return e.height*e.width>=n}))[0]||Pe.W1920_H1080}(r||1920,n||1080),a=function(e){var t=Number.MAX_VALUE,r=1;for(var n in we){var i=Math.abs(e-parseInt(n));i<t&&(t=i,r=we[n])}return r}(i);return{min:o.minBitrate*a,max:o.maxBitrate*a}},Vi=function(e){return[e.nmsid||e.msid,e.mediaType].join("_")},Fi=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),identifier:t.join("_")}},Ji=function(e){var t=e.split("_");return{tag:t.pop(),identifier:t.join("_")}},Hi=function(e,t){return void 0===t&&(t=Uc.DEFAULT),[e,t].join("_")},Gi=function(e,t,r){return void 0===t&&(t=Uc.DEFAULT),"".concat(e,"_").concat(t,"_").concat(r)},Ki=function(e){return e.map((function(e){return o({},e)}))},qi=function(e,t,r,n){void 0===r&&(r=!1),void 0===n&&(n=!1),e=e.slice();var i=[],a=[],s=[],c=[],d=Ne.getMemo();return t.forEach((function(t){var a,u,l=Vi(t),p=e.findIndex((function(e){return Vi(e)===l}));if(r&&(p=e.findIndex((function(e){return e.uri===t.uri}))),-1===p){var _=JSON.parse(t.uri),f=_.ssrc,b=_.resourceId,m=_.meid,h=_.mediaType,g=_.tag,v=_.userId;b||(b=Gi(m||v,g,h));var R=null===(u=d.prePubUserBySSRC)||void 0===u?void 0:u[f];return R&&(d.replacePreTrackIdMap=o(o({},d.replacePreTrackIdMap),((a={})[b]=Gi(R.meid,void 0,t.mediaType),a))),void i.push(t)}var C=e[p];void 0!==(null==C?void 0:C.state)&&C.state!==t.state?s.push(t):void 0!==(null==C?void 0:C.code)&&C.code!==t.code?c.push(t):(C.uri!==t.uri||n)&&i.push(t),e.splice(p,1)})),a.push.apply(a,l([],u(e),!1)),{publishedList:i,unpublishedList:a,modifiedList:s,deviceChangedList:c}},Wi=function(){return"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)}))},zi=function(e){var t,r=window.localStorage.getItem("__meid_".concat(e,"__"));return r||(t=Wi(),(t="".concat(t.replace(/-/g,""))).length>32&&(t=t.slice(0,32)),Qi(r=t,e)),r},Qi=function(e,t){return window.localStorage.setItem("__meid_".concat(t,"__"),e),!0},Yi=function(e){if(Pe[e]){var t=Pe[e];return{width:t.width,height:t.height}}var r=u(e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),2);return{width:r[0],height:r[1]}},Zi=function(e){return!!exports.RCResolution[e]},Xi=function(e){return parseInt(e.replace("FPS_",""))},$i=function(){var e=ye.browserDetails;return{browser:e.browser,version:e.version,supportsUnifiedPlan:!1!==e.supportsUnifiedPlan}}();function eo(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function to(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var ro,no=function(e){return"[object Null]"===Object.prototype.toString.call(e)},io=function(e,t,r,i){var o={},a=Object.keys(e.users);return a.length&&a.forEach((function(a){var s=[],c=e.users[a];if(c.extra){var d=JSON.parse(c.extra).roomId;if(t!==d)return}if(c.uris)try{s.push.apply(s,l([],u(JSON.parse(c.uris)),!1))}catch(e){r.warn(n.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(a,", userData: ").concat(c),i)}o[a]=s})),o},oo=function(e,t){for(var r=!1,n=0,i=0;i<t.length;i++){var o=t[i];if("".concat(e.nmsid||e.msid,"_").concat(e.mediaType)==="".concat(o.nmsid||o.msid,"_").concat(o.mediaType)){r=!0,n=i;break}}return{isInclude:r,index:n}},ao=function(e){return e instanceof vi?e.getTrackId():e.track.getTrackId()},so=function(t){if(!e.isObject(t)||void 0===t.low||void 0===t.high)return t;var r=t.low;return r<0&&(r+=4294967296),r=r.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(r.length,"}$")),r),16)},co=function(){var e=navigator.userAgent.toLowerCase(),t=/macintosh|mac os x/i.test(navigator.userAgent);return e.indexOf("win32")>=0||e.indexOf("wow32")>=0||e.indexOf("win64")>=0||e.indexOf("wow64")>=0?"windows":t?"MacOS":"unknown"},uo=function(e){var t={};if(null==e)return t;if("string"!=typeof e)return e;try{t=JSON.parse(e)}catch(e){return t}return t};!function(e){e.PNG="png",e.JPG="jpg",e.GIF="gif",e.ICO="ico",e.BMP="bmp",e.WEBP="webp",e.SVG="svg"}(ro||(ro={})),ro.PNG,ro.JPG,ro.GIF,ro.ICO,ro.BMP,ro.WEBP,ro.SVG;var lo,po,_o=function(e){var t=exports.RTCMode.GROUP_CALL;switch(e){case exports.RTCMode.CALL:t=exports.RTCMode.CALL;break;case exports.RTCMode.MEETING:t=exports.RTCMode.NEW_MEETING;break;case exports.RTCMode.GROUP_CALL:t=exports.RTCMode.GROUP_CALL}return t},fo=function(e){return window.sessionStorage.setItem("__rtc_config__",e)},bo=function(){return"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams};!function(e){e.PUBLISH="RCRTC:PublishResource",e.UNPUBLISH="RCRTC:UnpublishResource",e.MODIFY="RCRTC:ModifyResource",e.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",e.STATE="RCRTC:state",e.ROOM_NOTIFY="RCRTC:RoomNtf",e.USER_NOTIFY="RCRTC:UserNtf",e.KICK="RCRTC:kick",e.PK_INVITE="RCRTC:invite",e.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",e.PK_CANCEL_INVITE="RCRTC:cancelInvite",e.PK_INVITE_ANSWER="RCRTC:answerInvite",e.PK_END="RCRTC:endInvite",e.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline",e.ROOM_TASK_FINISH="RCRTC:roomTaskFinish"}(lo||(lo={})),exports.RCRTCPingResult=void 0,(po=exports.RCRTCPingResult||(exports.RCRTCPingResult={})).SUCCESS="Success",po.FAIL="Fail";var mo,ho=function(){function t(e,t,r,n){void 0===n&&(n=5e3),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pingResultCount",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_version",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_kickOffByServer",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(t.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;this._started||(e<15e3&&(e=15e3),null===(r=null===(t=this._context)||void 0===t?void 0:t.logger)||void 0===r||r.info(n.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}}),Object.defineProperty(t.prototype,"_sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this;return new Promise((function(o){r._context.rtcPing(r._roomId,r._roomMode).then((function(t){var n=t.code;n===e.ErrorCode.SUCCESS&&(r._pingResultCount=0),40003===n&&(r._pingResultCount=Number.MAX_SAFE_INTEGER,r._kickOffByServer=!0),o(t)})).catch((function(a){var s,c;null===(c=null===(s=r._context)||void 0===s?void 0:s.logger)||void 0===c||c.error(n.L_PINGER_SEND_RTCPING_R,JSON.stringify({status:i.FAILED,msg:a}),t),o({code:e.ErrorCode.RC_PING_EXCEED_LIMIT})})),setTimeout(o,3e4,{code:e.ErrorCode.TIMEOUT})}))}}),Object.defineProperty(t.prototype,"_checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,o;return a(this,void 0,void 0,(function(){var a,c,u,l=this;return s(this,(function(s){return a=this._context.logger,c=a.createTraceId(),this._pingResultCount++,this._sendPing(c).then((function(e){var t=e.data;t&&(l._version=t.version)})),this._pingResultCount<e/this._gap&&!this._kickOffByServer?(null===(t=this.onPingResult)||void 0===t||t.call(this,exports.RCRTCPingResult.SUCCESS,this._version),this._timer=setTimeout((function(){return l._checkAlive(e)}),this._gap),[2]):(a.warn(n.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,status:i.FAILED}),c),this._started&&(null===(r=this.onPingResult)||void 0===r||r.call(this,exports.RCRTCPingResult.FAIL)),this.stop(),u=this._kickOffByServer?"":"ping timeout",null===(o=this.onFailed)||void 0===o||o.call(this,this._kickOffByServer,void 0,u),[2])}))}))}}),Object.defineProperty(t.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;this._started&&(null===(t=null===(e=this._context)||void 0===e?void 0:e.logger)||void 0===t||t.info(n.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}),t}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(mo||(mo={}));var go,vo=function(e,t){return Math.round(8*t/e)},Ro=function(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.min(Math.round(e*r)/r,1)},Co=function(e,t){void 0===t&&(t=2),e>1&&(e=1);var r=Math.pow(10,t);return Math.round(e*r)},To=function(e,t,r,n){if(0===t||e<0||t<0)return 0;if(!r||!n)return Ro(e/t,3);var i=t-n;if(0===i)return 1;var o=e-r;return o<0||i<0?0:Ro(o/i,3)},So=function(e){var t=e.jitter,r=e.rtt,n=e.packetsLostRate;return!no(t)||!no(r)||0!==n},yo=function(e){var t=0;if("number"==typeof e){var r=e>1?1:e;t=32767*r<32?0:20*Math.log10(32767*r)}return Math.floor(t)};exports.RCMediaType=void 0,(go=exports.RCMediaType||(exports.RCMediaType={}))[go.AUDIO_ONLY=0]="AUDIO_ONLY",go[go.VIDEO_ONLY=1]="VIDEO_ONLY",go[go.AUDIO_VIDEO=2]="AUDIO_VIDEO";var Eo,Oo=function(){function e(){}return Object.defineProperty(e,"getInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._instance||(this._instance=new Map([["sourceIdForPublishMap",new Map],["sourceIdForSubscribeMap",new Map]])),this._instance}}),Object.defineProperty(e,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._instance=new Map([["sourceIdForPublishMap",new Map],["sourceIdForSubscribeMap",new Map]])}}),Object.defineProperty(e,"_instance",{enumerable:!0,configurable:!0,writable:!0,value:new Map([["sourceIdForPublishMap",new Map],["sourceIdForSubscribeMap",new Map]])}),e}();!function(e){e.TRACK="track",e.STREAM="stream",e.MEDIASOURCE="media-source",e.INBOUNDRTP="inbound-rtp",e.OUTBOUNDRTP="outbound-rtp",e.REMOTEINBOUNDRTP="remote-inbound-rtp",e.PEERCONNECTION="peer-connection",e.TRANSPORT="transport",e.CERTIFICATE="certificate",e.CANDIDATEPAIR="candidate-pair",e.REMOTECANDIDATE="remote-candidate",e.LOCALCANDIDATE="local-candidate"}(Eo||(Eo={}));var Io,Lo=function(){function e(e,t,r,n,i,o){Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_latestPacketsSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestPacketsRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}}),Object.defineProperty(e.prototype,"updateBytesSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];n=t-o.bytesSent,i=r-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else n=t,i=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return vo(i,n)}}),Object.defineProperty(e.prototype,"updateBytesRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];n=t-o.bytesRecv,i=r-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else n=t,i=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return vo(i,n)}}),Object.defineProperty(e.prototype,"updateSenderPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i=Ne.getMemo();if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var o=this._latestPacketsSent[e],a=o.packetsLost,s=o.packetsSent;i.sumPacketsSent+=r,i.sumPrePacketsSent+=s||0,i.sumPacketsSentLost+=t,i.sumPrePacketsSentLost+=a||0,n=To(t,r,a,s),this._latestPacketsSent[e]={packetsLost:t,packetsSent:(a||0)<t?r:s}}else n=To(t,r),this._latestPacketsSent[e]={packetsLost:t,packetsSent:r};return n}}),Object.defineProperty(e.prototype,"updateReceiverPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n,i=Ne.getMemo();if(this._latestPacketsRecv[e]){var o=this._latestPacketsRecv[e],a=o.packetsLost,s=o.packetsRecv;i.sumPacketsRecv+=r,i.sumPrePacketsRecv+=s||0,i.sumPacketsRecvLost+=t,i.sumPrePacketsRecvLost+=a||0,n=To(t,r+t,a,s+a)}else n=To(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},n}}),Object.defineProperty(e.prototype,"clearLatestpacketsSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){if(parseInt(e.split("_").pop())===exports.RCMediaType.VIDEO_ONLY){var r="".concat(e,"_tiny");delete t._latestPacketsSent[r],delete t._latestBytesSent[r]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]}))}}),Object.defineProperty(e.prototype,"clearLatestPacketsRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]}))}}),Object.defineProperty(e.prototype,"parseRTCStatsReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n={};try{for(var i=c(e.entries()),o=i.next();!o.done;o=i.next()){var a=u(o.value,2),s=a[0],l=a[1];n[s]=l}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}}),Object.defineProperty(e.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={senders:[],receivers:[]};return this._logger.info(n.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:i.SUCCEEDED,stats:e,reports:t})),t}}),Object.defineProperty(e.prototype,"getAudioLevelList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[]}}),Object.defineProperty(e.prototype,"isValidTranceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n,i="outbound-rtp"===t?null===(r=this._rtcPeerConn.currentLocalDescription)||void 0===r?void 0:r.sdp:null===(n=this._rtcPeerConn.currentRemoteDescription)||void 0===n?void 0:n.sdp,o=e.ssrc;return!(null==i?void 0:i.split("\r\nm=").some((function(e){return e.includes(o)&&e.includes("a=inactive")})))}}),Object.defineProperty(e.prototype,"formatStateData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Object.values(e).reduce((function(e,t){return t.type===Eo.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===Eo.INBOUNDRTP?(e.inbound.push(t),e):t.type===Eo.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===Eo.TRANSPORT?(e.transport.push(t),e):t.type===Eo.PEERCONNECTION?(e.connection.push(t),e):e}),{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}),Object.defineProperty(e,"formatSourceIdMapFromSdp",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t){var r=Oo.getInstance(),n=null==e?void 0:e.match(/a=ssrc:(.*) msid:(.*?) /gi);if(n){if("publish"===t){var i=r.get("sourceIdForPublishMap");null==i||i.clear(),n.forEach((function(e){var t=u(e.split(" ").map((function(e){return e.split(":")[1]})),2),r=t[0],n=t[1];null==i||i.set(r,n)}))}if("subscribe"===t){var o=r.get("sourceIdForSubscribeMap");null==o||o.clear(),n.forEach((function(e){var t=u(e.split(" ").map((function(e){return e.split(":")[1]})),2),r=t[0],n=t[1];null==o||o.set(r,n)}))}}}}),e}(),Po=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=this.formatStateData(e),i=n.outbound,o=n.remoteInbound,a=n.inbound,s=n.transport,c=n.connection,u=Ne.getMemo();u.sumPacketsSent=0,u.sumPrePacketsSent=0,u.sumPacketsSentLost=0,u.sumPrePacketsSentLost=0,u.sumPacketsRecv=0,u.sumPrePacketsRecv=0,u.sumPacketsRecvLost=0,u.sumPrePacketsRecvLost=0;var l={senders:[],receivers:[]},d=Math.floor(c[0].timestamp);l.timestamp=d;var p=0,_=0;p=(t=this.pickOutbound(i,e,p,d,_)).totalPacketsLost,_=t.bitrateSend,l.senders=t.senders,o.length>0&&l.senders.length>0&&this.pickRemoteInbound(o,l.senders,e);var f=0;if(p=(r=this.pickInbound(a,e,p,d,f)).totalPacketsLost,f=r.bitrateRecv,l.receivers=r.receivers,s.length>0){var b=s[0];this.pickRtcTransport(b,e,l,f,_,p)}return l}}),Object.defineProperty(t.prototype,"pickRtcTransport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){var a=e.selectedCandidatePairId;if(a){var s=t[a],c=s.availableOutgoingBitrate,u=s.availableIncomingBitrate,l=s.currentRoundTripTime,d=s.localCandidateId,p=s.remoteCandidateId,_=t[d],f=_.ip,b=_.port,m=_.networkType,h=t[p],g=h.ip,v=h.port,R=h.protocol;r.iceCandidatePair={IP:f,port:b,networkType:m,remoteIP:g,remotePort:v,protocol:R,bitrateRecv:n,bitrateSend:i,rtt:1e3*l,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},r.receivers.forEach((function(e){e.rtt=1e3*l}))}}}),Object.defineProperty(t.prototype,"pickRemoteInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this;e.forEach((function(e){var i,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter((function(e){return e.id===o}))[0];if(u&&!So(u)){var l=null===(i=n._store)||void 0===i?void 0:i.getTrackIdBySSRC(r[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var d=n._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=n.updateSenderPacketsLost(l,c,d)}}))}}),Object.defineProperty(t.prototype,"_getOutboundVideoAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,l=e.frameHeight;return"video"!==r||u||l||c||(u=(null===(o=t[n])||void 0===o?void 0:o.frameWidth)||t[i].width,l=(null===(a=t[n])||void 0===a?void 0:a.frameHeight)||t[i].height,c=(null===(s=t[i])||void 0===s?void 0:s.framesPerSecond)||null),{frameRate:c,frameWidth:u,frameHeight:l}}}),Object.defineProperty(t.prototype,"pickOutbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"outbound-rtp")){var c=e.id,u=e.kind,l=e.mediaSourceId,d=e.remoteId,p=e.packetsSent,_=e.bytesSent,f=e.encoderImplementation,b=e.pliCount,m=e.nackCount,h=e.mid,g=e.ssrc,v=e.framesEncoded,R=e.qpSum,C=e.googActualEncBitrate,T=e.rongFecBitrate,S=e.googTargetEncBitrate,y=e.googRetransmitBitrate,E=e.trackId;if(void 0!==h&&(E=o.getTrackIdByMid(h)),E){var O=o._getOutboundVideoAttrs(e,t,u,E,l),I=O.frameRate,L=O.frameWidth,P=O.frameHeight,A=t[d],w=null,k=null,N=0;A&&(w=A.jitter,k=A.roundTripTime,N=A.packetsLost),r+=N;var D=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(D){var M=l?t[l].audioLevel:t[E].audioLevel,x=0;!o._latestPacketsSent[D]&&(o._latestPacketsSent[D]={}),A?x=o.updateSenderPacketsLost(D,N,p):o._latestPacketsSent[D].crtPacketsSent=p;var U=o.updateBytesSent(D,_,n);U<0&&(U=0),i+=U,a.push({id:c,trackId:D,kind:u,packetsLostRate:x,remoteResource:!1,audioLevel:M||0===M?Co(M):null,audioDB:yo(M),frameWidth:L,frameHeight:P,frameRate:I,bitrate:U,jitter:w?Math.round(1e3*w):w,rtt:k?Math.round(1e3*k):k,encoderImplementation:f,pliCount:b,nackCount:m,googFirsSent:Wn,samplingRate:Wn,googRenderDelayMs:Wn,trackState:Wn,ssrc:String(g),framesEncoded:v,bytesSent:_,packetsLost:N,qpSum:R,googActualEncBitrate:C,rongFecBitrate:T,googTargetEncBitrate:S,googRetransmitBitrate:y})}}}})),{totalPacketsLost:r,bitrateSend:i,senders:a}}}),Object.defineProperty(t.prototype,"_getInboundMediaAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o,a,s,c=e.frameWidth,u=e.frameHeight,l=e.audioLevel;return"video"===i?c||u||(c=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[n].width,u=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[n].height):l||(l=(null===(s=t[r])||void 0===s?void 0:s.audioLevel)||t[n].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:l}}}),Object.defineProperty(t.prototype,"pickInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"inbound-rtp")){var c=e.packetsLost,u=e.packetsReceived,l=e.jitter,d=e.bytesReceived,p=e.framesPerSecond,_=e.kind,f=e.codecImplementationName,b=e.nackCount,m=e.pliCount,h=e.mid,g=e.id,v=e.ssrc,R=e.freezeCount,C=e.totalFreezesDuration,T=e.totalPausesDuration,S=e.pauseCount,y=e.qosFrozenCnt,E=e.qosFrozenDur,O=e.qosCDur,I=e.qosWithPLCFrozenCnt,L=e.qosWithPLCFrozenDur,P=e.trackId;if(void 0!==h&&(P=o.getTrackIdByMid(h)),P){var A=o._getInboundMediaAttrs(e,t,P,g,_),w=A.frameWidth,k=A.frameHeight,N=A.audioLevel;r+=c;var D=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),M=o.updateReceiverPacketsLost(D,c,u),x=o.updateBytesRecv(D,d,n);x<0&&(x=0),i+=x,a.push({trackId:D,kind:_,packetsLostRate:M,remoteResource:!0,audioLevel:N||0===N?Co(N):null,audioDB:yo(N),frameWidth:w,frameHeight:k,frameRate:p,bitrate:x,jitter:l?Math.round(1e3*l):0,codecImplementationName:f,nackCount:b,pliCount:m,rtt:null,samplingRate:Wn,googFirsReceived:Wn,googRenderDelayMs:Wn,trackState:Wn,ssrc:String(v),freezeCount:R,totalFreezesDuration:C,totalPausesDuration:T,pauseCount:S,bytesReceived:d,packetsLost:c,packetsReceived:u,qosFrozenCnt:y,qosFrozenDur:E,qosCDur:O,qosWithPLCFrozenCnt:I,qosWithPLCFrozenDur:L})}}})),{totalPacketsLost:r,bitrateRecv:i,receivers:a}}}),Object.defineProperty(t.prototype,"getAudioLevelList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=[],n=this.formatStateData(e),i=n.outbound,o=n.inbound;return i.filter((function(e){return"audio"===(null==e?void 0:e.kind)})).forEach((function(n){var i,o;if("unified-plan"!==t._sdpSemantics||t.isValidTranceiver(n,"outbound-rtp")){var a=n.mediaSourceId,s=n.trackId;n.kind;var c=null===(i=t._store)||void 0===i?void 0:i.getTrackIdBySSRC(n.ssrc),u=a&&e[a]?e[a].audioLevel:(null===(o=e[s])||void 0===o?void 0:o.audioLevel)||null;c&&r.push({trackId:c,audioLevel:u||0===u?Co(u):null})}})),o.filter((function(e){return"audio"===(null==e?void 0:e.kind)})).forEach((function(n){var i;if("unified-plan"!==t._sdpSemantics||t.isValidTranceiver(n,"inbound-rtp")){var o=n.trackId,a=n.audioLevel||e[o].audioLevel,s=null===(i=t._store)||void 0===i?void 0:i.getTrackIdBySSRC(n.ssrc);s&&r.push({trackId:s,audioLevel:a||0===a?Co(a):null})}})),r}}),t}(Lo),Ao=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return r(t,e),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,r)){var i=e.kind,o=e.bytesSent,a=e.packetsSent,s=e.bitrateMean,c=e.framerateMean,u=e.nackCount,l=e.pliCount,d=e.remoteId,p=d?t[d]:{jitter:null,roundTripTime:null,packetsLost:0},_=p.jitter,f=p.roundTripTime,b=p.packetsLost,m=null===(n=this._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=b;var h=0;!this._latestPacketsSent[m]&&(this._latestPacketsSent[m]={}),d?h=this.updateSenderPacketsLost(m,b,a):this._latestPacketsSent[m].crtPacketsSent=a;var g=0;"video"===i?s&&(g=Math.floor(s/1e3)):g=this.updateBytesSent(m,o,this._reportsData.timestamp),g<0&&(g=0),this._bitrateSend+=g,this._reportsData.senders.push({trackId:m,kind:i,packetsLostRate:h,remoteResource:!1,audioLevel:null,audioDB:0,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:g,jitter:_?Math.round(1e3*_):null,rtt:f,encoderImplementation:null,pliCount:l,nackCount:u,googFirsSent:Wn,samplingRate:Wn,googRenderDelayMs:Wn,trackState:Wn,qpSum:Wn})}}}),Object.defineProperty(t.prototype,"_addSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=t.localId,i=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e[n].ssrc),o=this._reportsData.senders.filter((function(e){return e.trackId===i}))[0];o&&So(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(i,t.packetsLost,this._latestPacketsSent[i].crtPacketsSent))}}),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var n=e.packetsLost,i=e.bytesReceived,o=e.packetsReceived,a=e.jitter,s=e.framerateMean,c=e.kind,u=e.bitrateMean,l=e.nackCount,d=e.pliCount,p=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=n;var _=this.updateReceiverPacketsLost(p,n,o),f=0;"video"===c?u&&(f=Math.floor(u/1e3)):f=this.updateBytesRecv(p,i,this._reportsData.timestamp),f<0&&(f=0),this._bitrateRecv+=f,this._reportsData.receivers.push({trackId:p,kind:c,packetsLostRate:_,remoteResource:!0,audioLevel:null,audioDB:0,frameWidth:null,frameHeight:null,frameRate:Math.floor(s),bitrate:f,jitter:a?Math.round(1e3*a):null,codecImplementationName:null,nackCount:l,pliCount:d,rtt:null,samplingRate:Wn,googFirsReceived:Wn,googRenderDelayMs:Wn,trackState:Wn,packetsLost:n,packetsReceived:o})}}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e[t.localCandidateId],n=r.address,i=r.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:n,port:i,networkType:null,remoteIP:a,remotePort:s,protocol:c,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:this._totalPacketsLost}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=+new Date;for(var r in this._reportsData={senders:[],receivers:[],timestamp:t},this._totalPacketsLost=0,this._bitrateRecv=0,this._bitrateSend=0,e){var n=e[r],i=n.type;"outbound-rtp"===i&&this._pickSenderData(n,e,i),"remote-inbound-rtp"===i&&this._addSenderData(e,n),"inbound-rtp"===i&&this._pickReceiverData(n,i),"candidate-pair"===i&&"succeeded"===n.state&&this._pickIceCandidatePair(e,n)}return this._reportsData}}),t}(Lo),wo=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return Object.defineProperty(e,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(e,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(e,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(e,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),e}return r(i,t),Object.defineProperty(i.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var t;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"inbound-rtp")){var n=e.packetsLost,i=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.mediaType,c=e.nackCount,u=e.pliCount,l=e.audioLevel,d=e.frameHeight,p=e.frameWidth,_=null===(t=r._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(_){r._totalPacketsLost+=n;var f=r.updateReceiverPacketsLost(_,n,i),b=r.updateBytesRecv(_,a,r._reportsData.timestamp);b<0&&(b=0),r._bitrateRecv+=b,r._reportsData.receivers.push({trackId:_,kind:s,packetsLostRate:f,remoteResource:!0,audioLevel:l||0===l?Co(l):null,audioDB:yo(l),frameWidth:p,frameHeight:d,frameRate:null,bitrate:b,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:Wn,googFirsReceived:Wn,googRenderDelayMs:Wn,trackState:Wn,packetsLost:n,packetsReceived:i})}}}))}}),Object.defineProperty(i.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var n;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"outbound-rtp")){var i=null===(n=r._store)||void 0===n?void 0:n.getTrackIdBySSRC(e.ssrc),o=e.kind,a=e.bytesSent,s=e.pliCount,c=e.nackCount,u=e.audioLevel,l=e.frameHeight,d=e.frameWidth,p=e.codecId,_=e.remoteId,f=e.packetsSent;if(i){var b=t[_],m=null,h=null,g=0;b&&(m=b.jitter,h=b.roundTripTime,g=b.packetsLost),r._totalPacketsLost+=g;var v=0;!r._latestPacketsSent[i]&&(r._latestPacketsSent[i]={}),b?v=r.updateSenderPacketsLost(i,g,f):r._latestPacketsSent[i].crtPacketsSent=f;var R=r.updateBytesSent(i,a,r._reportsData.timestamp);R<0&&(R=0),r._bitrateSend+=R,r._reportsData.senders.push({trackId:i,kind:o,packetsLostRate:v,remoteResource:!1,audioLevel:u||0===u?Co(u):null,audioDB:yo(u),frameWidth:d,frameHeight:l,frameRate:null,bitrate:R,jitter:m?Math.round(1e3*m):m,rtt:h?Math.round(1e3*h):h,encoderImplementation:t[p].mimeType,pliCount:s,nackCount:c,googFirsSent:Wn,samplingRate:Wn,googRenderDelayMs:Wn,trackState:Wn,qpSum:Wn})}}}))}}),Object.defineProperty(i.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.selectedCandidatePairId;if(r){var n=t[r],i=n.availableOutgoingBitrate,o=n.availableIncomingBitrate,a=n.currentRoundTripTime,s=n.localCandidateId,c=n.remoteCandidateId,u=t[s],l=u.address,d=u.port,p=t[c],_=p.address,f=p.port,b=p.protocol;this._reportsData.iceCandidatePair={IP:l||null,port:d,networkType:null,remoteIP:_,remotePort:f,protocol:b,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:i,availableIncomingBitrate:o,totalPacketsLost:this._totalPacketsLost},this._reportsData.receivers.forEach((function(e){e.rtt=a}))}}}),Object.defineProperty(i.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.formatStateData(e),r=t.outbound,n=t.inbound,i=t.transport;t.connection,this._reportsData={senders:[],receivers:[]};var o=Math.floor(e.RTCPeerConnection.timestamp);if(this._reportsData.timestamp=o,this._totalPacketsLost=0,this._bitrateSend=0,this._bitrateRecv=0,this._pickSenderData(r,e),this._pickReceiverData(n,e),i.length>0){var a=i[0];this._pickIceCandidatePair(a,e)}return this._reportsData}}),Object.defineProperty(i.prototype,"getAudioLevelList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this,i=[],o=Object.keys(t);return o.filter((function(e){return/^RTCOutboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(e){var n,o=t[e];if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(o,"outbound-rtp")){var a=o.trackId;if("video"!==o.mediaType){var s=null===(n=r._store)||void 0===n?void 0:n.getTrackIdBySSRC(o.ssrc),c=t[a];i.push({trackId:s,audioLevel:c||0===c?Co(c):null})}}})),o.filter((function(e){return/^RTCInboundRTP(Video|Audio)Stream_/.test(e)})).forEach((function(o){var a,s,c,u,l=t[o];if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(l,"inbound-rtp")){var d=l.trackId,p=l.mediaType;if(d&&"video"!==p){var _=t[d].audioLevel;if(e.isNumber(_)){var f=Ne.getMemo();f.senderAudioLevel={min:Math.min(_,(null===(a=null==f?void 0:f.senderAudioLevel)||void 0===a?void 0:a.min)||0),max:Math.max(_,(null===(s=null==f?void 0:f.senderAudioLevel)||void 0===s?void 0:s.max)||0),count:(((null===(c=null==f?void 0:f.senderAudioLevel)||void 0===c?void 0:c.count)||0)+1)%10},0===f.senderAudioLevel.count&&(Qn.info(n.L_AUDIO_LEVEL_O,JSON.stringify({audioLevel:{min:f.senderAudioLevel.min,max:f.senderAudioLevel.max}})),f.senderAudioLevel={min:0,max:0,count:0})}var b=null===(u=r._store)||void 0===u?void 0:u.getTrackIdBySSRC(l.ssrc);i.push({trackId:b,audioLevel:_||0===_?Co(_):null})}}})),i}}),i}(Lo),ko=function(){function e(e,t,r){Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"SDPHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"videoStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"audioStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]});var n=this.getStreamIndex();this.spliteStreams(n)}return Object.defineProperty(e.prototype,"videoSdps",{get:function(){return this.videoStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioSdps",{get:function(){return this.audioStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"trimBlankLine",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}}),Object.defineProperty(e.prototype,"getStreamIndex",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=new RegExp("m=(?:video|audio)","img"),t=new Set([0]),r=e.exec(this.SDP);null!==r;)t.add(null==r?void 0:r.index),r=e.exec(this.SDP);return t.add(this.SDP.length),l([],u(t),!1)}}),Object.defineProperty(e.prototype,"spliteStreams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.SDPHeader=this.SDP.substring(e[0],e[1]).replace(/\r\ns=-/g,"\r\ns=".concat((new Date).valueOf()));for(var t=1;t<e.length;t++){var r=this.SDP.substring(e[t],e[t+1]);/^\bm=video\b/.test(r)?this.videoStreams.push(r):this.audioStreams.push(r)}}}),Object.defineProperty(e,"clearInactiveOrRecvonly",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}),Object.defineProperty(e.prototype,"setHeaderBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.SDPHeader=this.SDPHeader.replace(/(\r\ns=[^\r\n]+)/gi,"$1\r\nc=IN IP4 0.0.0.0\r\nb=AS:".concat(t*e.KBitrate,"\r\nb=TIAS:").concat(t*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setAudiosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.audioStreams=this.audioStreams.map((function(r){return t.setAudioItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setAudioItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setAudioItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var n=["$1","maxaveragebitrate=".concat(r.max*e.Bitrate)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,n.join(";"))}return t}}),Object.defineProperty(e.prototype,"addAudioBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setVideosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.videoStreams=this.videoStreams.map((function(r){return t.setVideoItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(n)?r.setVideoItemBitrate(n,e):n})),this}}),Object.defineProperty(e.prototype,"setVideoItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bx-google-max-bitrate\b/.test(t)){var n=["$1","x-google-max-bitrate=".concat(r.max*e.KBitrate),"x-google-min-bitrate=".concat(r.min*e.KBitrate),"x-google-start-bitrate=".concat(r.start||r.max*e.KBitrate*.7)];t=t.replace(/(\bprofile-level-id=42[e0]01f\b)/gi,n.join(";"))}return t}}),Object.defineProperty(e.prototype,"addVideoBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"clearnSsrcWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n})),this.videoStreams=this.videoStreams.map((function(n){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(n)?r.clearSSRC(n,t):n})),this}}),Object.defineProperty(e.prototype,"clearSSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t===Mo.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Mo.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===Mo.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}),Object.defineProperty(e,"Bitrate",{enumerable:!0,configurable:!0,writable:!0,value:1e3}),Object.defineProperty(e,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1}),e}(),No=function(){function e(){}return Object.defineProperty(e,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}}),Object.defineProperty(e,"isInit",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}}),Object.defineProperty(e,"decodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"decodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),e}();!function(e){e[e.NB=0]="NB",e[e.MB=1]="MB",e[e.WB=2]="WB",e[e.SWB=3]="SWB",e[e.FB=4]="FB"}(Io||(Io={})),Io.NB,Io.NB,Io.NB,Io.NB,Io.MB,Io.MB,Io.MB,Io.MB,Io.WB,Io.WB,Io.WB,Io.WB,Io.SWB,Io.SWB,Io.FB,Io.FB,Io.NB,Io.NB,Io.NB,Io.NB,Io.WB,Io.WB,Io.WB,Io.WB,Io.SWB,Io.SWB,Io.SWB,Io.SWB,Io.FB,Io.FB,Io.FB,Io.FB;var Do,Mo,xo=function(){function e(){}return Object.defineProperty(e,"splitSections",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.split("\nm=").map((function(e,t){return"".concat((t>0?"m=".concat(e):e).trim(),"\r\n")}))}}),Object.defineProperty(e,"getMediaSections",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitSections(t);return r.shift(),r}}),Object.defineProperty(e,"parseExtmap",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}}}),Object.defineProperty(e,"splitLines",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.trim().split("\n").map((function(e){return e.trim()}))}}),Object.defineProperty(e,"parseMLine",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitLines(t)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}}}),Object.defineProperty(e,"matchPrefix",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.splitLines(t).filter((function(e){return 0===e.indexOf(r)}))}}),Object.defineProperty(e,"parseMsid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,n=e.matchPrefix(t,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=e.matchPrefix(t,"a=ssrc:").map((function(t){return e.parseSsrcMedia(t)})).filter((function(e){return"msid"===e.attribute}));return i.length>0&&i[0].value?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:{stream:"",track:""}}}),Object.defineProperty(e,"parseSsrcMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r}}),Object.defineProperty(e,"getMid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)}}),Object.defineProperty(e,"splitNaluData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e),r=0;if(this.isIFrame(t)){var n=t.join(","),i=n.indexOf("0,0,0,1,101");-1===i&&(i=n.indexOf("0,0,0,1,37")),r=n.substring(0,i).split(",").length-1+4+8}else r=12;return{header:t.slice(0,r),payloadData:t.slice(r)}}}),Object.defineProperty(e,"deal0x03",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r="encode"===t?e.join(",").replaceAll(",0,0,1,",",0,0,3,1,").split(",").map((function(e){return Number(e)})):e.join(",").replaceAll(",0,0,3,1,",",0,0,1,").split(",").map((function(e){return Number(e)})),new Uint8Array(r)}}),Object.defineProperty(e,"isIFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}}),Object.defineProperty(e,"parsePayloadTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.getMediaSections(t).find((function(t){return"audio"===e.parseMLine(t).kind}));if(r){var n=r.match(/a=rtpmap:(\d+)\s+(\S+)/g);n&&(e.payloadTypeCodecMap=n.map((function(e){var t=e.match(/a=rtpmap:(\d+)\s+(\w+)/);return t?{payloadType:Number(t[1]),codec:t[2]}:null})).filter((function(e){return!!e})))}}}),Object.defineProperty(e,"payloadTypeCodecMap",{enumerable:!0,configurable:!0,writable:!0,value:[]}),e}();!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(Do||(Do={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(Mo||(Mo={}));var Uo,jo=function(){function e(e,t,r){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e,"setSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=$i.browser,i=$i.version,o=$i.supportsUnifiedPlan;if(t.info(n.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:o,browser:r,version:i})),o)return/chrome/i.test(r)?i?void(this._sdpSemantics=i>92?"unified-plan":i<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(r)?this._sdpSemantics="unified-plan":/safari/i.test(r)?this._sdpSemantics=i<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}}),Object.defineProperty(e,"getSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e._sdpSemantics}}),Object.defineProperty(e.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._outboundStreams){var r=this._outboundStreams[t].getVideoTracks()[0];if(r){var n=/_tiny$/.test(t),i=ji(r),o=i.width,a=i.height;e.push({trackId:r.id,simulcast:n?mo.TINY:mo.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}}),Object.defineProperty(e.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return a(this,void 0,void 0,(function(){var r;return s(this,(function(o){switch(o.label){case 0:e=ko.trimBlankLine(e),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._peer.setRemoteDescription({type:"answer",sdp:e})];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),null===(t=this._logger)||void 0===t||t.info(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:i.FAILED,iceConnectionStatus:this._peer.iceConnectionState,sdp:e,msg:r})),[2,exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED];case 4:return this._logger.info(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:i.SUCCEEDED,sdp:e})),[2,exports.RCRTCCode.SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"getStatParsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return/chrome/i.test($i.browser)?new Po(this,e,this._logger,t,r,n):/Firefox/i.test($i.browser)?new Ao(this,e,this._logger,t,r,n):/Safari/i.test($i.browser)?new wo(this,e,this._logger,t,r,n):null}}),Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return null}}),Object.defineProperty(e.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return ko.trimBlankLine(e)}}),Object.defineProperty(e.prototype,"getRemoteSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return null===(e=this._peer.remoteDescription)||void 0===e?void 0:e.sdp}}),Object.defineProperty(e.prototype,"_setupSenderTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}}}),Object.defineProperty(e.prototype,"_setupReceiverTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,n=t.writable,i=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});r.pipeThrough(i).pipeTo(n)}}}),Object.defineProperty(e.prototype,"_encodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xo.splitNaluData(e),r=t.header,n=t.payloadData,i=No.encodeVideo(n),o=xo.deal0x03(i,"encode");return new Uint8Array(l(l([],u(r),!1),u(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_decodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=xo.splitNaluData(e),r=t.header,n=t.payloadData,i=xo.deal0x03(n,"decode"),o=No.decodeVideo(i);return new Uint8Array(l(l([],u(r),!1),u(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_handleAudioREDFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=function(e){for(var t=[],r=0;;){var n,i=!(e[r]>>7),o=127&e[r],a=void 0,s=void 0,c=void 0;if(i?(a=0,s=e.byteLength-(t.length>0?t.map((function(e){return 4+e.block.byteLength})).reduce((function(e,t){return e+t})):0)-1,c=e.slice(r,r+1),r+=1):(a=(e[r+1]<<6)+(e[r+2]>>2),s=((3&e[r+2])<<8)+e[r+3],c=e.slice(r,r+4),r+=4),n=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:n,isPrimary:i,blockPType:o}),i)break}return t.forEach((function(t){var n=t.block.byteLength,i=e.slice(r,r+n);t.block.set(i),r+=n})),t}(new Uint8Array(e)),n=[],i=[],o=0;r.forEach((function(e){var r="decode"===t?No.decodeAudio(e.block):No.encodeAudio(e.block);if(r.byteLength!==e.block.byteLength&&!e.isPrimary){var a=u(e.header,4),s=a[2],c=a[3];s=(s>>2<<2)+r.byteLength>>8,c=255&r.byteLength,e.header=new Uint8Array([e.header[0],e.header[1],s,c])}e.block=r,o+=e.block.byteLength+e.header.byteLength,n.push(e.header),i.push(e.block)}));var a=new Uint8Array(o),s=0;return l(l([],u(n),!1),u(i),!1).forEach((function(e){a.set(e,s),s+=e.byteLength})),a.buffer}}),Object.defineProperty(e.prototype,"_handleOpusFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=new Uint8Array(e);return("encode"===t?No.encodeAudio(r):No.decodeAudio(r)).buffer}}),Object.defineProperty(e.prototype,"_encodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(n);else{var i=t.getMetadata().payloadType,o=xo.payloadTypeCodecMap.filter((function(e){return e.payloadType===i}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(n,"encode"):"opus"===o?t.data=this._handleOpusFrame(n,"encode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}r.enqueue(t)}}),Object.defineProperty(e.prototype,"_decodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(n);else{var i=t.getMetadata().payloadType,o=xo.payloadTypeCodecMap.filter((function(e){return e.payloadType===i}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(n,"decode"):"opus"===o?t.data=this._handleOpusFrame(n,"decode"):console.error("Unsupport audio payloadType: ".concat(i,", codec: ").concat(o))}r.enqueue(t)}}),e}(),Bo=function(e){function t(t,r){var n=e.call(this,r,Do.PLANB,t)||this;return Object.defineProperty(n,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];l(l([],u(this.audioStreams),!1),u(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(video|audio)\b/),n=ko.clearInactiveOrRecvonly(t);r&&r[1]===pi.AUDIO&&(e[1]=n),r&&r[1]===pi.VIDEO&&(e[2]=n)}));var t=e.join("");return ko.trimBlankLine(t)}}),Object.defineProperty(t.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}}),Object.defineProperty(t.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}),t}(ko),Vo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_maxBitrate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(t,"_minBitrate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(t,"_startBitrate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t}return r(t,e),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._localTracks.includes(e)||this._localTracks.push(e);var t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),n=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);n.getTracks().forEach((function(e){e.kind===r.kind&&n.removeTrack(e)})),n.addTrack(r);var i=e.getTrackId(),o=this.senders[i];o?o.replaceTrack(r):(this.senders[i]=this._peer.addTrack(r,n),Object.defineProperty(r,"trackId",{value:i,writable:!1,enumerable:!1,configurable:!1}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._localTracks.findIndex((function(t){return t===e}));t>=0&&this._localTracks.splice(t,1);var r=e.getTrackId(),n=this.senders[r];n&&(n.replaceTrack(null),this._peer.removeTrack(n),delete this.senders[r])}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._maxBitrate=e,this._minBitrate=t,this._startBitrate=r||.7*e}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,n,i;return s(this,(function(o){switch(o.label){case 0:return[4,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0})];case 1:for(n in r=o.sent(),this._outboundStreams)i=this._outboundStreams[n].id,r.sdp=r.sdp.replace(new RegExp(i,"g"),n);return null==t||t.forEach((function(e){var t,n,i,o=e.mediaType,a=e.ssrc,s=e.msid;if(o===exports.RCMediaType.AUDIO_ONLY){var c="m=audio.*?a=ssrc:(\\d+)? msid:".concat(s," "),u=new RegExp(c,"ims");i=null===(t=r.sdp.match(u))||void 0===t?void 0:t[1]}else if(o===exports.RCMediaType.VIDEO_ONLY){c="m=video.*?a=ssrc:(\\d+)? msid:".concat(s," "),u=new RegExp(c,"ims");i=null===(n=r.sdp.match(u))||void 0===n?void 0:n[1]}if(i){var l=new RegExp(i,"ig");r.sdp=r.sdp.replace(l,a)}})),r.sdp&&(r.sdp=this.resetSdp(r.sdp)),[4,this._peer.setLocalDescription(r)];case 2:return o.sent(),[2,{type:"offer",semantics:"plan-b",sdp:r.sdp}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t=this.resetSdp(t),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Bo(this._logger,e),r={max:0,min:0},n={max:0,min:0};return this._localTracks.forEach((function(e){var t=e.getBitrate(),i=t.min,o=t.max,a=t.start;e.isAudioTrack()&&(n.max=n.max<o?o:n.max,n.min=n.min>i?i:n.min,n.max===o?n.start=a:n.start=.7*n.max),e.isVideoTrack()&&(r.max=r.max<o?o:r.max,r.min=r.min>i?i:r.min,r.max===o?r.start=a:r.start=.7*r.max)})),t.setAudiosBitrate(n),t.setVideosBitrate(r),t.stringify()}}),t}(jo),Fo=function(e){function t(t,r){return e.call(this,r,Do.UNIFIEDPLAN,t)||this}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];l(l([],u(this.audioStreams),!1),u(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(\d+)\b/);r&&r[1]&&(e[+r[1]+1]=t)})),this.SDPHeader="",this.videoStreams=[],this.audioStreams=[];var t=e.join("");return ko.trimBlankLine(t)}}),t}(ko),Jo=function(){function e(){Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return Object.defineProperty(e,"getInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e.instance||(e.instance=new e),e.instance}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.__streams.set(e,t),t}}),Object.defineProperty(e.prototype,"pickup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.get(e)}}),Object.defineProperty(e.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.delete(e)}}),Object.defineProperty(e.prototype,"streams",{get:function(){var e,t,r=new Map;try{for(var n=c(this.__streams.keys()),i=n.next();!i.done;i=n.next()){var o=i.value;r.set(o,this.pickup(o))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),e}();exports.RCKickReason=void 0,(Uo=exports.RCKickReason||(exports.RCKickReason={}))[Uo.SERVER_KICK=1]="SERVER_KICK",Uo[Uo.OTHER_KICK=2]="OTHER_KICK",Uo[Uo.IM_DISCONNECTED=3]="IM_DISCONNECTED",Uo[Uo.IM_LOGOUT=4]="IM_LOGOUT",Uo[Uo.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED",Uo[Uo.RTC_INNER_KICK=6]="RTC_INNER_KICK";var Ho,Go,Ko,qo,Wo,zo,Qo=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_sendTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_recvAudio",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvVideo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_subedTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"midMsid",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t}return r(t,e),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}}),Object.defineProperty(t.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var t in this._recvTransceiver){if(this._recvTransceiver[t].mid===e)return t}return null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=e.getTrackId(),n=e.getStreamId(),i=e.__innerGetMediaStreamTrack();this._localTracks[r]=e;var o=this._outboundStreams[n]||(this._outboundStreams[n]=new MediaStream);o.getTracks().forEach((function(e){e.kind===i.kind&&o.removeTrack(e)})),o.addTrack(i);var a=this._sendTransceiver[r];if(a)a.sender.replaceTrack(i),a.direction="sendonly";else{var s=this._sendTransceiver[r]=this._peer.addTransceiver(i,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}Jo.getInstance().push(r,{msid:n,id:this._outboundStreams[n].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId(),r=e.getStreamId();delete this._localTracks[t];var n=this._sendTransceiver[t];if(n){"closed"!==this._peer.connectionState&&(n.direction="inactive",this._peer.removeTrack(n.sender),n.sender.replaceTrack(null));var i=this._outboundStreams[r];(e.isAudioTrack()?i.getAudioTracks():i.getVideoTracks()).forEach((function(e){return i.removeTrack(e)}));var o=this._sendTransceiver["".concat(t,"_tiny")];if(o&&"inactive"!==o.direction&&"closed"!==this._peer.connectionState){o.direction="inactive";var a=o.sender,s=a.track;this._peer.removeTrack(a),a.replaceTrack(null),this._outboundStreams["".concat(r,"_tiny")].removeTrack(s),s.stop()}}}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Fi(e).mediaType;this._recvTransceiver[e]=t;var n=r===exports.RCMediaType.AUDIO_ONLY?this._recvAudio:this._recvVideo,i=n.findIndex((function(e){return e===t}));i>=0&&n.splice(i,1)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=Ne.getMemo(),n=e.slice(),i=this._subedTracks.slice();this._subedTracks=e.slice();for(var o=function(e){var t=n[e],r=i.findIndex((function(e){return e===t}));r>=0&&(n.splice(e,1),i.splice(r,1))},a=n.length-1;a>=0;a-=1)o(a);i.length&&i.forEach((function(e){var r=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var n=t._recvTransceiver[r];n&&(n.direction="inactive")}));var s={audio:0,video:0};n.length&&n.forEach((function(e){var n,i=e.isAudioTrack()?"audio":"video",o=e.getTrackId(),a=null===(n=r.replacePreTrackIdMap)||void 0===n?void 0:n[o];a&&(o=a);var c=t._recvTransceiver[o];c?c.direction="recvonly":s[i]+=1}));for(a=this._recvAudio.length;a<s.audio;a+=1){var c=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(c),this._setupReceiverTransform(c.receiver)}for(a=this._recvVideo.length;a<s.video;a+=1){c=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(c),this._setupReceiverTransform(c.receiver)}}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){var i,o,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:o="",s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peer.createOffer({iceRestart:e})];case 2:return i=s.sent(),o=i.sdp,[3,4];case 3:return a=s.sent(),this._logger.error(n.L_PEER_CREATE_OFFER_E,JSON.stringify({sdp:i,errorStack:a.stack})),c=Ne.getMemo(),null===(r=c.crtRoom)||void 0===r||r.mockKickOff(!1,exports.RCKickReason.RTC_INNER_KICK),[3,4];case 4:for(u in this._outboundStreams)l=this._outboundStreams[u].id,o=o.replace(new RegExp(l,"g"),u);o=(o=this.resetOfferSdp(o)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination"),null==t||t.forEach((function(e){var t,r,n,i=e.mediaType,a=e.msid,s=e.ssrc;if(i===exports.RCMediaType.AUDIO_ONLY){var c="m=audio.*?a=ssrc:(\\d+)? msid:".concat(a," "),u=new RegExp(c,"ims");n=null===(t=o.match(u))||void 0===t?void 0:t[1]}else if(i===exports.RCMediaType.VIDEO_ONLY){c="m=video.*?a=ssrc:(\\d+)? msid:".concat(a," "),u=new RegExp(c,"ims");n=null===(r=o.match(u))||void 0===r?void 0:r[1]}if(n){var l=new RegExp(n,"ig");o=o.replace(l,s)}})),i.sdp=o,s.label=5;case 5:return s.trys.push([5,7,,8]),[4,this._peer.setLocalDescription(i)];case 6:return s.sent(),[3,8];case 7:return d=s.sent(),this._logger.error(n.L_PEER_SET_LOCAL_DESC_E,JSON.stringify({sdp:i,errorStack:d.stack})),[3,8];case 8:return[2,{type:"offer",semantics:"unified-plan",sdp:o}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){t=this.resetAnswerSdp(t);var r=/[\r\n]+\r\n[\r\n]+/g;return r.test(t)&&(t=t.replace(r,"\r\n")),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_genarateMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=null;return xo.getMediaSections(e).forEach((function(e){xo.parseExtmap(e);var i=xo.parseMLine(e).kind,o=xo.parseMsid(e).stream,a=xo.getMid(e);"video"===r?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&r===i&&a&&(n=a)})),n}}),Object.defineProperty(t.prototype,"_setSenderTransceiverBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){var i=this._localTracks[t],o=null==i?void 0:i.getBitrate();n===pi.AUDIO&&o&&e.setAudioBitrateWithMid(o,r),n===pi.VIDEO&&o&&e.setVideoBitrateWithMid(o,r)}}),Object.defineProperty(t.prototype,"_resetSenderTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=null===(r=i.sender.track)||void 0===r?void 0:r.kind,a=i.direction,s=i.mid;s||(s=this._genarateMid(e,n,o)),s&&(a===Mo.SENDONLY&&this._setSenderTransceiverBitrate(t,n,s,o),a===Mo.INACTIVE&&t.clearnSsrcWithMid(s,Mo.INACTIVE))}}}),Object.defineProperty(t.prototype,"_resetRecvTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._recvTransceiver){var r=this._recvTransceiver[t],n=r.direction,i=r.mid;i&&n===Mo.INACTIVE&&e.clearnSsrcWithMid(i,Mo.RECVONLY)}}}),Object.defineProperty(t.prototype,"resetOfferSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Fo(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}}),Object.defineProperty(t.prototype,"resetAnswerSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=new Fo(this._logger,e);for(var n in this._sendTransceiver){var i=this._sendTransceiver[n],o=i.mid;if(o){var a=this._localTracks[n],s=null==a?void 0:a.getBitrate(),c=null===(t=i.sender.track)||void 0===t?void 0:t.kind;c===pi.AUDIO&&s&&r.setAudioBitrateWithMid(s,o),c===pi.VIDEO&&s&&r.setVideoBitrateWithMid(s,o)}}return r.stringify()}}),t}(jo);!function(e){e.VP8="VP8",e.VP9="VP9",e.H264="H264"}(Ho||(Ho={})),exports.RCRTCNetworkQualityType=void 0,
2
- /*!
3
- Excellent, 80% ~ 100%
4
- */
5
- (Go=exports.RCRTCNetworkQualityType||(exports.RCRTCNetworkQualityType={}))[Go.RCRTCNetworkQualityTypeExcellent=1]="RCRTCNetworkQualityTypeExcellent",
6
- /*!
7
- Good, 60% ~ 80%
8
- */
9
- Go[Go.RCRTCNetworkQualityTypeGood=2]="RCRTCNetworkQualityTypeGood",
10
- /*!
11
- Poor, 40% ~ 60%
12
- */
13
- Go[Go.RCRTCNetworkQualityTypePoor=3]="RCRTCNetworkQualityTypePoor",
14
- /*!
15
- Bad, 20% ~ 40%
16
- */
17
- Go[Go.RCRTCNetworkQualityTypeBad=4]="RCRTCNetworkQualityTypeBad",
18
- /*!
19
- VBad, 1% ~ 20%
20
- */
21
- Go[Go.RCRTCNetworkQualityTypeVBad=5]="RCRTCNetworkQualityTypeVBad",
22
- /*!
23
- Down, 0%
24
- */
25
- Go[Go.RCRTCNetworkQualityTypeDown=6]="RCRTCNetworkQualityTypeDown",exports.RCRTCNetworkStatus=void 0,(Ko=exports.RCRTCNetworkStatus||(exports.RCRTCNetworkStatus={}))[Ko.NetworkNone=0]="NetworkNone",Ko[Ko.NetworkResume=1]="NetworkResume",Ko[Ko.NetworkUnavailable=2]="NetworkUnavailable",exports.RCRTCVideoStuckStatus=void 0,(qo=exports.RCRTCVideoStuckStatus||(exports.RCRTCVideoStuckStatus={}))[qo.VideoNone=0]="VideoNone",qo[qo.VideoResume=1]="VideoResume",qo[qo.VideoStandstill=2]="VideoStandstill",exports.RCRTCAudioStuckStatus=void 0,(Wo=exports.RCRTCAudioStuckStatus||(exports.RCRTCAudioStuckStatus={}))[Wo.AudioNone=0]="AudioNone",Wo[Wo.AudioResume=1]="AudioResume",Wo[Wo.AudioStandstill=2]="AudioStandstill",exports.RCRTCNetworkType=void 0,(zo=exports.RCRTCNetworkType||(exports.RCRTCNetworkType={})).None="None",zo.Wifi="Wifi",zo.Ethernet="Ethernet";var Yo,Zo,Xo,$o,ea=function(t){function c(e,r,n,i,o,a){void 0===a&&(a=!1);var s=t.call(this)||this;Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_store",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"senderAndReciveSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(s,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(s,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_historyAudioLevelMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(s,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(s,"_isSave",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Ne.getMemo();var c=jo.getSdpSemantics(),u="unified-plan"===c&&a&&bo()&&No.isInit(),l=s._rtcPeerConn=new RTCPeerConnection({sdpSemantics:c,encodedInsertableStreams:u});return s._sdpStrategy="plan-b"===c?new Vo(s._logger,l,!1):new Qo(s._logger,l,u),s._rtcPeerConn.oniceconnectionstatechange=s._onICEConnectionStateChange.bind(s),s._rtcPeerConn.onconnectionstatechange=s._onConnectionStateChange.bind(s),s._rtcPeerConn.ontrack=s._onTrackReady.bind(s),s.reportParser=s._sdpStrategy.getStatParsr(s._rtcPeerConn,c,s._currentUserId,s._store),s}return r(c,t),Object.defineProperty(c.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.values(this.pubLocalTracks)}}),Object.defineProperty(c.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(n.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}}),Object.defineProperty(c.prototype,"startAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout((function(){t._reportHandle(),t.startAutoExecute(e)}),e)}}),Object.defineProperty(c.prototype,"stopAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reportStatsTimer)}}),Object.defineProperty(c.prototype,"_onICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r;return a(this,void 0,void 0,(function(){var o,a,u;return s(this,(function(s){switch(s.label){case 0:return o=this._rtcPeerConn.iceConnectionState,this._logger.info(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:o})),[4,this._getStatsData()];case 1:a=s.sent(),u=a?this._createRCRTCStateReport(a).iceCandidatePair:null,this.emit(c.__INNER_ICE_STATE_CHANGE__,{status:o,time:Date.now(),iceCandidatePair:u}),"connected"===o?(this.emit(c.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==o&&"disconnected"!==o||this._handleRetry();try{null===(t=null===(e=this._reportListener)||void 0===e?void 0:e.onICEConnectionStateChange)||void 0===t||t.call(e,o)}catch(e){null===(r=this._logger)||void 0===r||r.error(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:i.FAILED,msg:e}))}return[2]}}))}))}}),Object.defineProperty(c.prototype,"_handleRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,t=this;return s(this,(function(r){switch(r.label){case 0:return this._inRetry?[2]:(this.clearReTryExchangeTimer(),this._inRetry=!0,[4,this._reTryExchange()]);case 1:return e=r.sent().code,this._inRetry=!1,e===exports.RCRTCCode.SUCCESS?[2]:(this._reTryExchangeTimer=setTimeout((function(){return t._handleRetry()}),15e3),[2])}}))}))}}),Object.defineProperty(c.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.streams.length){var t=e.streams[0].id,r=e.receiver.track,n=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");r.trackId||Object.defineProperty(r,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(n,e.transceiver),this.emit(c.__INNER_EVENT_TRACK_READY__,e)}}}),Object.defineProperty(c.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){return s(this,(function(o){return this._sdpStrategy.setBitrate(e,t,r),this._logger.info(n.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:i.SUCCEEDED,max:e,min:t,start:r})),[2]}))}))}}),Object.defineProperty(c.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return s(this,(function(i){switch(i.label){case 0:return[4,this._sdpStrategy.createOffer(e,t)];case 1:return r=i.sent(),this._logger.info(n.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({iceRestart:e,offerSDP:r.sdp,sdpDemantics:r.semantics})),[2,r]}}))}))}}),Object.defineProperty(c.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return void 0===t&&(t=!1),a(this,void 0,void 0,(function(){return s(this,(function(n){return xo.parsePayloadTypes(null===(r=this._rtcPeerConn.localDescription)||void 0===r?void 0:r.sdp),this._firstConnectFromPub=t,[2,this._sdpStrategy.setRemoteAnswer(e)]}))}))}}),Object.defineProperty(c.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.pubLocalTracks[e]||null}}),Object.defineProperty(c.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(Ei.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Ei.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(Ei.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(Ei.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),e.on(Ei.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(Ei.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(Ei.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.on(Ei.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),this._logger.info(n.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,JSON.stringify({trackId:e.getTrackId()}))}}),Object.defineProperty(c.prototype,"removeLocalTrackById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:i.SUCCEEDED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:i.FAILED,msg:"track not found",trackId:e}))}}),Object.defineProperty(c.prototype,"removeAllLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach((function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)}))}}),Object.defineProperty(c.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(Ei.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Ei.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(Ei.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(Ei.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this);var r="".concat(t,"_tiny"),i=this.getLocalTrack(r);i&&(this._sdpStrategy.removeLocalTrack(i),delete this.pubLocalTracks[r],i.destroy()),this._logger.info(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:t}))}}),Object.defineProperty(c.prototype,"_updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}}),Object.defineProperty(c.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_UPDATE_SUB_REMOTE_TRACKS_O,JSON.stringify({tracks:e.map(ao)})),this._sdpStrategy.updateSubRemoteTracks(e)}}),Object.defineProperty(c.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sdpStrategy.getOutboundVideoInfo()}}),Object.defineProperty(c.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&(r.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(Ei.__INNER_EVENT_MUTED_CHANGE__,e,t)}}),Object.defineProperty(c.prototype,"_onLocalTrackDeviceStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&r.updateDeviceAvailable(t),this.emit(Ei.__INNER_EVENT_DEVICE_STATUS_CHANGE__,e,t)}}),Object.defineProperty(c.prototype,"_onLocalTrackSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.emit(Ei.__INNER_EVENT_SEND_CHANGE__,e,t)}}),Object.defineProperty(c.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.emit(Ei.__INNER_EVENT_DESTROY__,e)}}),Object.defineProperty(c.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(c.prototype,"_createSenderReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ne.getMemo(),r=[];return e.forEach((function(e){var n,i,a=e.trackId,s=e.kind,c=e.packetsLostRate,u=e.remoteResource,l=e.bitrate,d=e.jitter,p=e.networkQuality,_=e.audioDB,f={trackId:a,kind:s,packetsLostRate:c,remoteResource:u,bitrate:l,jitter:d,rtt:e.rtt,networkQuality:p,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[Fi(a).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(f.audioLevel=e.audioLevel),e.frameWidth&&(f.frameWidth=e.frameWidth),e.frameHeight&&(f.frameHeight=e.frameHeight),e.frameRate&&(f.frameRate=e.frameRate),e.trackId){var b=e.trackId;e.trackId.includes("tiny")&&(b=e.trackId.replace("_tiny",""));var m=Fi(b).identifier,h=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[m];e.userId=h,r.push(o(o({},f),{userId:h}))}})),r}}),Object.defineProperty(c.prototype,"_createReceiverReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ne.getMemo(),r=[];return e.forEach((function(e){var n,i,a=e.trackId,s=e.kind,c=e.packetsLostRate,u=e.remoteResource,l=e.bitrate,d=e.jitter,p=e.networkQuality,_=e.audioDB,f={trackId:a,kind:s,packetsLostRate:c,remoteResource:u,bitrate:l,jitter:d,networkQuality:p,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[Fi(a).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(f.audioLevel=e.audioLevel),e.frameWidth&&(f.frameWidth=e.frameWidth),e.frameHeight&&(f.frameHeight=e.frameHeight),e.frameRate&&(f.frameRate=e.frameRate),e.trackId){var b=Fi(e.trackId).identifier,m=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[b];e.userId=m,r.push(o({},f))}})),r}}),Object.defineProperty(c.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.timestamp,r=e.iceCandidatePair,n=e.senders,i=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)no(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(n),receivers:this._createReceiverReport(i)}}}),Object.defineProperty(c.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return a(this,void 0,void 0,(function(){var r,n,i;return s(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._rtcPeerConn.getStats()];case 1:return n=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(n),i=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=i,[2,i]}}))}))}}),Object.defineProperty(c.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t,r,i;return a(this,void 0,void 0,(function(){var o,a,d,p,_=this;return s(this,(function(s){switch(s.label){case 0:return o=Ne.getMemo(),[4,this._getStatsData()];case 1:if(!(a=s.sent()))return[2];if((d=this._createRCRTCStateReport(a)).senders.forEach((function(e){var t=Fi(e.trackId),r=t.tag,n=t.mediaType;r===Uc.DEFAULT&&n===exports.RCMediaType.AUDIO_ONLY&&(e.detectAudioLevel=o.micAudioLevel)})),null===(t=this._store)||void 0===t?void 0:t.isMeetingMode)return Ne.getMemo().pubReportData=d,[2];try{null===(i=null===(r=this._reportListener)||void 0===r?void 0:r.onStateReport)||void 0===i||i.call(r,JSON.parse(JSON.stringify(d)))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}return p=l(l([],u(a.receivers),!1),u(a.senders),!1).filter((function(e){return!("audio"!==e.kind)})).map((function(t){var r;if(e.isNumber(t.audioLevel)){var n=_._historyAudioLevelMap[t.trackId];n?(n.length>3&&n.splice(0,1),n.push(t.audioLevel||0)):n=_._historyAudioLevelMap[t.trackId]=[t.audioLevel||0];var i=n.reduce((function(e,t){return e+t}),0)/n.length;return{trackId:t.trackId,audioLevel:i}}_._historyAudioLevelMap[t.trackId]=[];var o=t.trackId;t.trackId.includes("tiny")&&(o=t.trackId.replace("_tiny",""));var a=Fi(o).identifier,s=null===(r=_._store)||void 0===r?void 0:r.getUserIdByMeid(a);return{trackId:t.trackId,audioLevel:t.audioLevel,userId:s}})),this.emit(c.__INNER_AUDIOLEVEL_CHANGE__,p),[2]}}))}))}}),Object.defineProperty(c.prototype,"_calculateNetworkStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i,o,a,s,c,d,p,_,f,b,m=Ne.getMemo(),h=0,g=0,v=0;!1===m.pubPeerUseabled&&(g+=1),!1===m.subPeerUseabled&&(v+=1);var R=e.senders.filter((function(e){return!e.networkQuality||e.networkQuality<exports.RCRTCNetworkQualityType.RCRTCNetworkQualityTypeVBad})),C=e.receivers.filter((function(e){return!e.networkQuality||e.networkQuality<exports.RCRTCNetworkQualityType.RCRTCNetworkQualityTypeVBad}));0===R.length&&0!==e.senders.length&&(g+=1),0===C.length&&0!==e.receivers.length&&(v+=1),g>0&&v>0&&(h+=1);var T=[],S=[],y=[];S=m.sendNetworkStatusList?l(l([],u(m.sendNetworkStatusList.slice(-4)),!1),[g],!1):[g],y=m.recvNetworkStatusList?l(l([],u(m.recvNetworkStatusList.slice(-4)),!1),[v],!1):[v],T=m.networkStatusList?l(l([],u(m.networkStatusList.slice(-4)),!1),[h],!1):[h],m.networkStatusList=T,m.sendNetworkStatusList=S,m.recvNetworkStatusList=y;var E=5===T.length&&T.filter((function(e){return e>0})).length>=3,O=5===S.length&&S.filter((function(e){return e>0})).length>=3,I=5===y.length&&y.filter((function(e){return e>0})).length>=3;O&&m.sendNetworkUnAvailabled!==O?(null===(r=null===(t=this._reportListener)||void 0===t?void 0:t.onSendConnnectionLost)||void 0===r||r.call(t,exports.RCRTCNetworkStatus.NetworkUnavailable),m.sendQos=!1,this._logger.info(n.L_SEND_CONNECTION_LOST_O,JSON.stringify({status:exports.RCRTCNetworkStatus.NetworkUnavailable,sendNetworkStatusList:S}))):m.sendNetworkUnAvailabled&&m.sendNetworkUnAvailabled!==O&&(null===(o=null===(i=this._reportListener)||void 0===i?void 0:i.onSendConnnectionLost)||void 0===o||o.call(i,exports.RCRTCNetworkStatus.NetworkResume),m.sendQos=!0,this._logger.info(n.L_SEND_CONNECTION_LOST_O,JSON.stringify({status:exports.RCRTCNetworkStatus.NetworkUnavailable,sendNetworkStatusList:S}))),I&&m.recvNetworkUnAvailabled!==I?(null===(s=null===(a=this._reportListener)||void 0===a?void 0:a.onRecvConnnectionLost)||void 0===s||s.call(a,exports.RCRTCNetworkStatus.NetworkUnavailable),this._logger.info(n.L_RECV_CONNECTION_LOST_O,JSON.stringify({status:exports.RCRTCNetworkStatus.NetworkUnavailable,recvNetworkStatusList:y}))):m.recvNetworkUnAvailabled&&m.recvNetworkUnAvailabled!==I&&(null===(d=null===(c=this._reportListener)||void 0===c?void 0:c.onRecvConnnectionLost)||void 0===d||d.call(c,exports.RCRTCNetworkStatus.NetworkResume),this._logger.info(n.L_RECV_CONNECTION_LOST_O,JSON.stringify({status:exports.RCRTCNetworkStatus.NetworkUnavailable,recvNetworkStatusList:y}))),E&&m.networkUnAvailabled!==E?(null===(_=null===(p=this._reportListener)||void 0===p?void 0:p.onConnectionLost)||void 0===_||_.call(p,exports.RCRTCNetworkStatus.NetworkUnavailable),this._logger.info(n.L_CONNECTION_LOST_O,JSON.stringify({status:exports.RCRTCNetworkStatus.NetworkUnavailable,networkStatusList:T}))):m.networkUnAvailabled&&m.networkUnAvailabled!==E&&(null===(b=null===(f=this._reportListener)||void 0===f?void 0:f.onConnectionLost)||void 0===b||b.call(f,exports.RCRTCNetworkStatus.NetworkResume),this._logger.info(n.L_CONNECTION_LOST_O,JSON.stringify({status:exports.RCRTCNetworkStatus.NetworkResume,networkStatusList:T}))),m.networkUnAvailabled=E,m.sendNetworkUnAvailabled=O,m.recvNetworkUnAvailabled=I}}),Object.defineProperty(c.prototype,"_sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return a(this,void 0,void 0,(function(){var r,n,i,o;return s(this,(function(a){switch(a.label){case 0:return r=this._formatStatsData,n=Ne.getMemo(),i=null==n?void 0:n.subPolarisReportData,r?((o={timestamp:r.timestamp,iceCandidatePair:r.iceCandidatePair,senders:l(l([],u(r.senders),!1),u((null==i?void 0:i.senders)||[]),!1),receivers:l(l([],u(r.receivers),!1),u((null==i?void 0:i.receivers)||[]),!1)}).receivers.length+o.senders.length>this.senderAndReciveSize&&(o.receivers=o.receivers.slice(0,this.senderAndReciveSize)),o.senders.length||o.receivers.length?[4,null===(t=this._polarisReport)||void 0===t?void 0:t.sendR3R4Data(o,e)]:[3,2]):[2,!0];case 1:a.sent(),a.label=2;case 2:return[2]}}))}))}}),Object.defineProperty(c.prototype,"__reportR3R4ToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e=this;return s(this,(function(t){return clearTimeout(this._reportR3R4ToPolarisTimer),this._isDestroyed||(this._reportR3R4ToPolarisTimer=setTimeout((function(){return a(e,void 0,void 0,(function(){return s(this,(function(e){return this._sendR3R4Data(this._isSave),this._isSave=!this._isSave,this.__reportR3R4ToPolaris(),[2]}))}))}),2e3)),[2]}))}))}}),Object.defineProperty(c.prototype,"getRTCPeerConn",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcPeerConn}}),Object.defineProperty(c.prototype,"getCapabilitiesCodes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;void 0===e&&(e=Ho.H264);var r=(null===(t=RTCRtpSender.getCapabilities("video"))||void 0===t?void 0:t.codecs)||[];if(r){var n=null;switch(e){case Ho.VP8:case Ho.VP9:n=r.find((function(t){return t.mimeType.match(e)}));break;case Ho.H264:n=r.find((function(t){var r;return t.mimeType.match(e)&&(null===(r=t.sdpFmtpLine)||void 0===r?void 0:r.match("42e01f"))}))}r=r.filter((function(e){return e!==n})),r=l([n],u(r),!1)}return r}}),Object.defineProperty(c.prototype,"setEncoderPreferences",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r;return s(this,(function(o){return t=this.getRTCPeerConn(),r=this.getCapabilitiesCodes(e),this._logger.info(n.L_SET_ENCODER_PREFERENCES_S,JSON.stringify({status:i.SUCCEEDED,codecCap:r})),t.getTransceivers().forEach((function(e){var t;"video"===(null===(t=e.sender.track)||void 0===t?void 0:t.kind)&&e.setCodecPreferences(r)})),[2]}))}))}}),Object.defineProperty(c.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.clear(),this.clearReTryExchangeTimer(),clearTimeout(this._reportR3R4ToPolarisTimer),this.stopAutoExecute(),this.registerReportListener(null),this._rtcPeerConn.close(),this._isDestroyed=!0,this.reportParser=null,this._logger.info(n.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:i.SUCCEEDED}))}}),Object.defineProperty(c.prototype,"clearReTryExchangeTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearInterval(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}),Object.defineProperty(c.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(c.prototype,"getRemoteSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sdpStrategy.getRemoteSdp()}}),Object.defineProperty(c.prototype,"getSenders",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcPeerConn.getSenders()}}),Object.defineProperty(c.prototype,"getSenderByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getSenders().filter((function(t){var r;return(null===(r=t.track)||void 0===r?void 0:r.id)===e}))[0];return t}}),Object.defineProperty(c.prototype,"disableSenderEncodingsByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e){var t=this.getSenderByTrackId(e);if(t){var r=t.getParameters(),n=o(o({},r),{encodings:r.encodings.map((function(e){return o(o({},e),{active:!1})}))});t.setParameters(n)}}}}),Object.defineProperty(c.prototype,"enableSenderEncodingsByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e){var t=this.getSenderByTrackId(e);if(t){var r=t.getParameters(),n=o(o({},r),{encodings:r.encodings.map((function(e){return o(o({},e),{active:!0})}))});t.setParameters(n)}}}}),Object.defineProperty(c,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(c,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(c,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(c,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),c}(e.EventEmitter);!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE",e[e.STAT_NONE=-1]="STAT_NONE"}(Yo||(Yo={})),function(e){e[e.Meeting=1]="Meeting"}(Zo||(Zo={})),function(e){e[e.NOT_REPORT=-1]="NOT_REPORT",e[e.REPORT_SUCCESS=1e4]="REPORT_SUCCESS",e[e.REPORT_FAIL=0]="REPORT_FAIL",e[e.PB_ERROR=40001]="PB_ERROR"}(Xo||(Xo={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4",e.R3R4="R3R4"}($o||($o={}));var ta,ra,na=function(){function t(e,t,r,n,i){void 0===i&&(i=Zo.Meeting),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:i})}return Object.defineProperty(t.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){return s(this,(function(r){switch(r.label){case 0:return this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?[2,Xo.NOT_REPORT]:[4,this._context.setRTCState(this._roomId,t)];case 1:return r.sent()===e.ErrorCode.SUCCESS?[2,Xo.REPORT_SUCCESS]:[2,Xo.REPORT_FAIL]}}))}))}}),Object.defineProperty(t.prototype,"_getClientID",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=function(){var e=Wi();return e="".concat(e.replace(/-/g,""),"0"),(e=function(e){var t="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ+/".split(""),r=t.length+1,n=+e,i=[];do{var o=n%r;n=(n-o)/r,i.unshift(t[o])}while(n);return i.join("")}(e=parseInt(e,16))).length>22&&(e=e.slice(0,22)),e}(),this._runtime.localStorage.setItem(e,t)),t}}),Object.defineProperty(t.prototype,"_getRealResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}}),Object.defineProperty(t.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var n=r.pop(),i=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n,i].join("_")}else{i=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i].join("_")}return t}}),Object.defineProperty(t.prototype,"sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,n,i,o,a,c,u,l,d,p=this;return s(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.senders,n=e.receivers,i={bitrateSend:(null==t?void 0:t.bitrateSend)||Wn,bitrateRecv:(null==t?void 0:t.bitrateRecv)||Wn,networkType:(null==t?void 0:t.networkType)||"unknown",rtt:(null==t?void 0:t.rtt)||Wn,localAddress:"".concat((null==t?void 0:t.IP)||Wn,":").concat(null==t?void 0:t.port),remoteAddress:"".concat(null==t?void 0:t.remoteIP,":").concat(null==t?void 0:t.remotePort),receiveBand:(null==t?void 0:t.availableIncomingBitrate)||Wn,sendBand:(null==t?void 0:t.availableOutgoingBitrate)||Wn,packetsLost:(null==t?void 0:t.totalPacketsLost)||Wn,deviceId:this._context.getCurrentId()},o="R3\t".concat(i.bitrateSend,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),a="R4\t".concat(i.bitrateRecv,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),c=r.map((function(e){var t,r=e.trackId,n=e.audioLevel,i=e.samplingRate,o=e.bitrate,a=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,f=e.pliCount,b=e.rtt,m=e.googFirsSent,h=e.encoderImplementation,g=p._getPolarisTrackId(r),v=p._getRealResourceId(r);return{trackId:g,googCodecName:h||String(Wn),audioLevel:n||0===n?n:Wn,bitrate:o||0===o?o:Wn,packetsLostRate:a||0===a?a:Wn,frameRate:s||Wn,resolution:c&&u?"".concat(c," * ").concat(u):"".concat(Wn),jitter:d||Wn,nackCount:_||0===_?_:Wn,pliCount:f||0===f?f:Wn,rtt:b||Wn,googFirsSent:m,samplingRate:i,googRenderDelayMs:l,encoderImplementation:h||String(Wn),trackState:(null===(t=p._crtRTCRoom.getLocalTrack(v))||void 0===t?void 0:t.isLocalMuted())?Yo.DISABLE:Yo.ENABLE}})),u=n.filter((function(e){return!!e.trackId})).map((function(e){var t,r=e.trackId,n=e.audioLevel,i=e.samplingRate,o=e.bitrate,a=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,f=e.pliCount,b=e.rtt,m=e.googFirsReceived,h=e.codecImplementationName,g=p._getPolarisTrackId(r),v=p._getRealResourceId(r);return{trackId:g,googCodecName:h||String(Wn),audioLevel:n||0===n?n:Wn,bitrate:o||0===o?o:Wn,packetsLostRate:a||0===a?a:Wn,frameRate:s||Wn,resolution:c&&u?"".concat(c," * ").concat(u):"".concat(Wn),jitter:d||Wn,nackCount:_||0===_?_:Wn,pliCount:f||0===f?f:Wn,rtt:b||Wn,googFirsReceived:m,samplingRate:i,googRenderDelayMs:l,codecImplementationName:h||String(Wn),trackState:(null===(t=p._crtRTCRoom.getRemoteTrack(v))||void 0===t?void 0:t.isLocalMuted())?Yo.DISABLE:Yo.ENABLE}})),l=Xo.REPORT_FAIL,o+=c.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsSent,"\t").concat(e.encoderImplementation,"\t").concat(e.trackState)})).join("\n"),e.senders.length?[4,this._send("".concat(o,"\r").concat(this._userRole))]:[3,2];case 1:l=s.sent(),s.label=2;case 2:return d=Xo.REPORT_FAIL,a+=u.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsReceived,"\t").concat(e.codecImplementationName,"\t").concat(e.trackState)})).join("\n"),e.receivers.length?[4,this._send("".concat(a,"\r").concat(this._userRole))]:[3,4];case 3:d=s.sent(),s.label=4;case 4:return l!==Xo.REPORT_SUCCESS&&d!==Xo.REPORT_SUCCESS?[2,Xo.REPORT_FAIL]:[2,Xo.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(t.prototype,"sendR1",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._context.getCoreVersion(),t=navigator.platform,r=$i.browser,n=$i.version,i=this._getClientID(),o="R1\t".concat("5.7.10-enterprise-lz.50","\t").concat(e,"\t").concat("web","\t").concat(t,"\t").concat(-1,"\t").concat(r,"\t").concat(n,"\t").concat(i,"\t").concat(this._userRole);this._send(o)}}),Object.defineProperty(t.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this._getClientID(),i="R2\t".concat(e,"\t").concat(t,"\t").concat(n,"\r").concat(r.join("\t"),"\r").concat(this._userRole);this._send(i)}}),t}();!function(e){e[e.new=0]="new",e[e.checking=1]="checking",e[e.connected=2]="connected",e[e.completed=3]="completed",e[e.failed=4]="failed",e[e.disconnected=5]="disconnected",e[e.closed=6]="closed"}(ta||(ta={})),function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(ra||(ra={}));var ia,oa,aa,sa=function(){function e(){Object.defineProperty(this,"_locked",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_database",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"open",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=indexedDB.open("QosDataBase");t.onerror=function(e){Qn.error(n.L_DATA_BASE_E,"indexedDB open error: QosDataBase -> errorCode: ".concat(e.target.errorCode))},t.onsuccess=function(t){Qn.info(n.L_DATA_BASE_O,"indexedDB open success: QosDataBase"),e._database=t.target.result,e._locked=!1},t.onupgradeneeded=function(t){Qn.info(n.L_DATA_BASE_O,"indexedDB upgrade: QosDataBase"),e._database=t.target.result,e._database.createObjectStore("reportData",{keyPath:"time",autoIncrement:!0})}}}),Object.defineProperty(e.prototype,"add",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(Qn.warn(n.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").add(e);n.onsuccess=function(){r({status:!0})},n.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"get",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(Qn.warn(n.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=IDBKeyRange.upperBound(e),i=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").get(n);i.onsuccess=function(e){var t;r({status:!0,data:null===(t=e.target)||void 0===t?void 0:t.result})},i.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"put",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(Qn.warn(n.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").put(e);n.onsuccess=function(){r({status:!0})},n.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"del",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this._locked?(Qn.warn(n.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(r){var n=t._database.transaction(["reportData"],"readwrite").objectStore("reportData").delete(e);n.onsuccess=function(){r({status:!0})},n.onerror=function(){r({status:!1})}}))}}),Object.defineProperty(e.prototype,"delAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this._locked?(Qn.warn(n.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(t){var r=IDBKeyRange.upperBound(Date.now()),n=e._database.transaction(["reportData"],"readwrite").objectStore("reportData").delete(r);n.onsuccess=function(e){t({status:!0})},n.onerror=function(){t({status:!1})}}))}}),Object.defineProperty(e.prototype,"getAll",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this._locked?(Qn.warn(n.L_DATA_BASE_E,"QosDataBase not use"),Promise.resolve({status:!1})):new Promise((function(t){var r=e._database.transaction(["reportData"],"readwrite").objectStore("reportData").getAll();r.onsuccess=function(e){t({status:!0,data:e.target.result})},r.onerror=function(){t({status:!1})}}))}}),e}(),ca=function(){function e(){Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_locked",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._queue.push(e),this._execute()}}),Object.defineProperty(e.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return this._queue.length>0&&!this._locked?(this._locked=!0,[4,this._queue.shift()()]):[3,2];case 1:e.sent(),this._locked=!1,this._execute(),e.label=2;case 2:return[2]}}))}))}}),e}(),ua=function(){function t(e,r,n,i,o){void 0===o&&(o=Zo.Meeting),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_polarisSignalReporter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_useHttp",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"timesOfR3Report",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"timesOfR4Report",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_sequenceId",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"_database",{enumerable:!0,configurable:!0,writable:!0,value:new sa}),Object.defineProperty(this,"_localQosDataQueue",{enumerable:!0,configurable:!0,writable:!0,value:new ca});var a=Ne.getMemo(),s=this._context.getNaviInfo();t.logServer=null==s?void 0:s.logServer,t.dc=null==s?void 0:s.dc,this._polarisSignalReporter=new na(e,r,n,i,o),this._database.open(),a.database=this._database}return Object.defineProperty(t.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){var o,c;return a(this,void 0,void 0,(function(){var a,u;return s(this,(function(s){switch(s.label){case 0:return(a=t.logServer)&&this._useHttp?[4,this._context.setRTCStateByHttp(a,this._runtime,e,r,i)]:[2,Xo.REPORT_FAIL];case 1:return(u=s.sent())===Xo.REPORT_SUCCESS?[2,Xo.REPORT_SUCCESS]:u===exports.RCRTCCode.JWT_TIME_OUT?[2,Xo.REPORT_FAIL]:u===Xo.REPORT_FAIL||u===Xo.PB_ERROR?(null===(c=null===(o=this._context)||void 0===o?void 0:o.logger)||void 0===c||c.info(n.L_HTTP_POLARIS_REPORT_FAIL_O,"send data fail -> code: ".concat(u)),[2,Xo.REPORT_FAIL]):[2,Xo.REPORT_FAIL]}}))}))}}),Object.defineProperty(t.prototype,"reportLocalQosDataToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,t,r,n,i,o,a,d,p,_;return s(this,(function(s){switch(s.label){case 0:return[4,this._database.getAll()];case 1:if(e=s.sent(),t=e.status,r=e.data,t&&0===(null==r?void 0:r.length))return[2];this._database.delAll(),n={},t&&(null==r||r.forEach((function(e){n[e.roomId]=l(l([],u(n[e.roomId]||[]),!1),[e],!1)}))),i=Object.keys(n);try{for(o=c(i),a=o.next();!a.done;a=o.next())d=a.value,this._sendLocalQosData(n[d])}catch(e){p={error:e}}finally{try{a&&!a.done&&(_=o.return)&&_.call(o)}finally{if(p)throw p.error}}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_sendLocalQosData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,n=0,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;i.push(s),(n+=s.byteLength)>=503316.48&&(this._sendLocalQosSliceData(i),i=[],n=0)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}n>0&&this._sendLocalQosSliceData(i)}}),Object.defineProperty(t.prototype,"_sendLocalQosSliceData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r=this;return s(this,(function(n){return t=function(){return a(r,void 0,void 0,(function(){var t=this;return s(this,(function(r){switch(r.label){case 0:return[4,this.sendLocalQosData(e)];case 1:return r.sent()!==Xo.REPORT_SUCCESS&&e.forEach((function(e){t._database.put(e)})),[2]}}))}))},this._localQosDataQueue.push(t),[2]}))}))}}),Object.defineProperty(t.prototype,"_refetchNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e,r,n;return s(this,(function(i){switch(i.label){case 0:return[4,(o=this._context,a(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,o.getPluginContext().refetchNaviInfo()];case 1:return t.sent(),[2,{naviInfo:e=o.getNaviInfo(),jwt:ri(e)}]}}))})))];case 1:return e=i.sent(),r=e.jwt,n=e.naviInfo,bi.jwtToken=r,t.logServer=null==n?void 0:n.logServer,t.dc=null==n?void 0:n.dc,[2]}var o}))}))}}),Object.defineProperty(t.prototype,"_getRealResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}}),Object.defineProperty(t.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var n=r.pop(),i=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n,i].join("_")}else{i=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i].join("_")}return t}}),Object.defineProperty(t.prototype,"_formatReportBaseData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r,n,i=Ne.getMemo();return{type:e,appKey:this._context.getAppkey(),sessionId:this._crtRTCRoom.getSessionId(),roomId:this._roomId,roomCreateTime:this._context.roomCreateTime||0,userId:this._context.getCurrentId(),userRole:this._userRole,joinTime:this._context.userJoinTime||0,signalDataCenter:t.dc||"",iceStatus:ta[null===(r=i.iceNewStatusData)||void 0===r?void 0:r.status],subIceStatus:ta[null===(n=i.subIceNewStatusData)||void 0===n?void 0:n.status]}}}),Object.defineProperty(t.prototype,"_formatReportData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,n=this._formatReportBaseData(e),i={};switch(e){case $o.R1:i=this._formatR1Data();break;case $o.R2:i=this._formatR2Data(t);break;case $o.R3:case $o.R4:case $o.R3R4:i=this._formatR3R4Data(e,t)}return o(o({},n),((r={})[{R1:"r1Info",R2:"r2Info",R3:"r3Info",R4:"r4Info",R3R4:"r3r4Info"}[e]]=i,r))}}),Object.defineProperty(t.prototype,"_formatR1Data",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{joinTime:this._context.userJoinTime||0,rtcVersion:"5.7.10-enterprise-lz.50",imVersion:this._context.getCoreVersion(),platform:"web",device:navigator.platform,os:String(Wn),browserName:$i.browser,browserVersion:String($i.version),receiveTime:Date.now()}}}),Object.defineProperty(t.prototype,"_formatR2Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=Ne.getMemo(),n=e.action,i=e.status,o=e.trackIds,a=Fi(o[0]).identifier;return{joinTime:this._context.userJoinTime||0,sendTime:Date.now(),rtcActionType:n,rtcActionStatus:i,trackId:o,receiveTime:Date.now(),userId:n===ra.SUBSCRIBE?null===(t=r.meidToUserIdMap)||void 0===t?void 0:t[a]:""}}}),Object.defineProperty(t.prototype,"_formatR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){var n,i,o=this,a=Ne.getMemo(),s=r.iceCandidatePair,c=r.senders,u=r.receivers,l=0,d=[],p=[],_=[],f=[],b=[];return t===$o.R3?(this.timesOfR3Report+=1,l=(null==s?void 0:s.bitrateSend)||Wn,d=c.map((function(e){var t,r=e.trackId,n=e.audioLevel,i=e.samplingRate,a=e.bitrate,s=e.packetsLostRate,c=e.frameRate,u=e.frameWidth,l=e.frameHeight,d=e.googRenderDelayMs,p=e.jitter,_=e.nackCount,f=e.pliCount,b=e.rtt,m=e.googFirsSent,h=e.encoderImplementation;e.ssrc;var g=e.framesEncoded;e.qpSum;var v=o._getPolarisTrackId(r),R=o._getRealResourceId(r);return{trackId:v,userId:o._crtRTCRoom.getCrtUserId(),codeName:h||String(Wn),volume:String(n||0===n?n:Wn),samplingRate:i||Wn,bitRate:a||0===a?a:Wn,packetLossRate:s||0===s?s:Wn,frameRate:c||Wn,resolution:u&&l?"".concat(u," * ").concat(l):"".concat(Wn),blockTime:d,jitterData:p||Wn,nAckCount:String(_||0===_?_:Wn),pliCount:String(f||0===f?f:Wn),googleRTTTotalTime:b||Wn,isReceiveFirstFrameRate:m,codeType:h||String(Wn),isEnabled:(null===(t=o._crtRTCRoom.getLocalTrack(R))||void 0===t?void 0:t.isLocalMuted())?Yo.DISABLE:Yo.ENABLE,googTargetEncBitrate:-1,googActualEncBitrate:-1,googRetransmitBitrate:-1,rongFecBitrate:-1,framesEncoded:g,googFrameRateInput:-1,framesDroppedByCapturer:-1,framesDroppedByBwLimit:-1,framesDroppedByEncoderQueue:-1,framesDroppedByEncoder:-1,packetsFractionLost:-1}}))):t===$o.R4?(this.timesOfR3Report+=1,l=(null==s?void 0:s.bitrateRecv)||Wn,d=u.filter((function(e){return!!e.trackId})).map((function(e){var t,r,n=e.trackId,i=e.audioLevel,s=e.samplingRate,c=e.bitrate,u=e.packetsLostRate,l=e.frameRate,d=e.frameWidth,p=e.frameHeight,_=e.googRenderDelayMs,f=e.jitter,b=e.nackCount,m=e.pliCount,h=e.rtt,g=e.googFirsReceived,v=e.codecImplementationName;e.ssrc;var R=e.totalFreezesDuration,C=e.freezeCount,T=e.totalPausesDuration,S=e.pauseCount,y=e.packetsLost,E=e.packetsReceived,O=o._getPolarisTrackId(n),I=o._getRealResourceId(n);return{trackId:O,userId:null===(t=a.meidToUserIdMap)||void 0===t?void 0:t[Fi(O).identifier],codeName:v||String(Wn),volume:String(i||0===i?i:Wn),samplingRate:s||Wn,bitRate:c||0===c?c:Wn,packetLossRate:u||0===u?u:Wn,frameRate:l||Wn,resolution:d&&p?"".concat(d," * ").concat(p):"".concat(Wn),blockTime:_,jitterData:f||Wn,nAckCount:String(b||0===b?b:Wn),pliCount:String(m||0===m?m:Wn),googleRTTTotalTime:h||Wn,isReceiveFirstFrameRate:g,codeType:v||String(Wn),isEnabled:(null===(r=o._crtRTCRoom.getRemoteTrack(I))||void 0===r?void 0:r.isLocalMuted())?Yo.DISABLE:Yo.ENABLE,googFrameRateDecoded:-1,retransmitBytes:-1,FECBytes:-1,googFrameRateOutput:-1,googFirstFrameReceivedToDecodedMs:-1,googFirsSent:-1,freezeCount:C,freezesDurationMs:R,pausesDurationMs:T,totalSamplesDuration:-1,rongE2eDelayMs:-1,CurrentDelayMs:-1,googTargetDelayMs:-1,googJitterBufferMs:-1,rongAvSyncMs:-1,googDecodingPLC:-1,googDecodingPLCCNG:-1,googExpandRate:-1,googSpeechExpandRate:-1,googAccelerateRate:-1,rongFirstFrameStartedToDecodeMs:-1,googNackMaxContSeqsSent:-1,googNackSeqsSent:-1,googNackUniqueSeqsSent:-1,discardedPackets:-1,recvFrameCleanCount:-1,packetLossFraction:-1,pausesCount:S,framesDurationsMs:-1,googMaxDecodeMs:-1,packetsFractionLost:y,muteRate:-1,googPreemptiveExpandRate:-1,googPreferredJitterBufferMs:-1,rongPlcMs:-1,googDecodingNormal:-1,packetsReceived:E}}))):t===$o.R3R4&&(u.forEach((function(t){var r,n,i;if(t.trackId){var c=t.trackId,u=t.audioLevel,l=t.samplingRate,d=t.bitrate,p=t.packetsLostRate,_=t.frameRate,m=t.frameWidth,h=t.frameHeight,g=t.googRenderDelayMs,v=t.jitter,R=t.nackCount,C=t.pliCount,T=t.rtt,S=t.googFirsReceived,y=t.codecImplementationName,E=t.ssrc,O=t.totalFreezesDuration,I=t.freezeCount,L=t.totalPausesDuration,P=t.pauseCount;t.packetsLost;var A=t.packetsReceived,w=t.bytesReceived,k=t.qosFrozenCnt,N=t.qosFrozenDur,D=t.qosCDur,M=t.qosWithPLCFrozenCnt,x=t.qosWithPLCFrozenDur,U=o._getPolarisTrackId(c),j=o._getRealResourceId(c),B={trackId:U,userId:null===(r=a.meidToUserIdMap)||void 0===r?void 0:r[Fi(U).identifier],codeName:y||String(Wn),volume:String(u||0===u?u:Wn),samplingRate:l||Wn,bitRate:d||0===d?d:Wn,packetLossRate:p||0===p?p:Wn,frameRate:_||Wn,resolution:m&&h?"".concat(m," * ").concat(h):"".concat(Wn),blockTime:g,jitterData:v||Wn,nAckCount:String(R||0===R?R:Wn),pliCount:String(C||0===C?C:Wn),googleRTTTotalTime:T||Wn,isReceiveFirstFrameRate:S,codeType:y||String(Wn),isEnabled:(null===(n=o._crtRTCRoom.getRemoteTrack(j))||void 0===n?void 0:n.isLocalMuted())?Yo.DISABLE:Yo.ENABLE,streamCode:null===(i=o._crtRTCRoom.getRemoteTrack(j))||void 0===i?void 0:i.getDeviceAvailable(!0)};t.kind===pi.AUDIO&&f.push({streamInfo:B,ssrc:Number(E)||Wn,bytesReceived:w||Wn,retransmitBytes:Wn,packetsReceived:A||Wn,rongE2eDelayMs:Wn,googDecodingPLC:Wn,decodingNormal:Wn,muteRate:Wn,googDecodingPLCCNG:Wn,googExpandRate:Wn,googSpeechExpandRate:Wn,googAccelerateRate:Wn,googPreemptiveExpandRate:Wn,googNackMaxContSeqsSent:Wn,googPacketLostRate:Wn,googNackSeqsSent:Wn,googJitterBufferMs:Wn,googCurrentDelayMs:Wn,freezesDurationMs:O||Wn,rongPlcMs:Wn,totalSamplesDuration:Wn,maxSeqNum:Wn,cdur:e.isNumber(D)?D:Wn,frdur:Wn,audioFrozenDur:e.isNumber(N)?N:Wn,audioFrozenCnt:e.isNumber(k)?k:Wn,audioFrozenDurWithPlc:e.isNumber(x)?x:Wn,audioFrozenCntWithPlc:e.isNumber(M)?M:Wn}),t.kind===pi.VIDEO&&b.push({streamInfo:B,ssrc:Number(E)||Wn,bytesReceived:w||Wn,retransmitBytes:Wn,FECBytes:Wn,googFrameRateInput:Wn,googFrameRateDecoded:Wn,googFrameRateOutput:Wn,googFirstFrameReceivedToDecodedMs:Wn,googNackMaxContSeqsSent:Wn,googPacketLostRate:Wn,googNackSeqsSent:Wn,packetsReceived:A||Wn,rongFirstFrameStartedToDecodeMs:Wn,packetLoss:(null==s?void 0:s.totalPacketsLost)||Wn,freezeCount:I||Wn,freezesDurationMs:O||Wn,pausesCount:P||Wn,pausesDurationMs:L||Wn,googMaxDecodeMs:Wn,rongE2eDelayMs:Wn,googCurrentDelayMs:Wn,googTargetDelayMs:Wn,googJitterBufferMs:Wn,rongAvSyncMs:Wn,discardedPackets:Wn,recvFrameCleanCount:Wn,cdur:e.isNumber(D)?D:Wn,frdur:Wn,videoFrozenDur:e.isNumber(N)?N:Wn,videoFrozenCnt:e.isNumber(k)?k:Wn})}})),c.forEach((function(e){var t,r,n;if(e.trackId){var i=e.trackId,s=e.audioLevel,c=e.samplingRate,u=e.bitrate,l=e.packetsLostRate,d=e.frameRate,f=e.frameWidth,b=e.frameHeight,m=e.googRenderDelayMs,h=e.jitter,g=e.nackCount,v=e.pliCount,R=e.rtt,C=e.googFirsSent,T=e.encoderImplementation,S=e.ssrc,y=e.framesEncoded,E=e.bytesSent,O=e.packetsLost,I=e.qpSum,L=e.googActualEncBitrate,P=e.rongFecBitrate,A=e.googTargetEncBitrate,w=e.googRetransmitBitrate,k=o._getPolarisTrackId(i),N=o._crtRTCRoom.getLocalTrack(e.trackId),D={trackId:k,userId:o._crtRTCRoom.getCrtUserId(),codeName:T||String(Wn),volume:String(s||0===s?s:Wn),samplingRate:c||Wn,bitRate:u||0===u?u:Wn,packetLossRate:l||0===l?l:Wn,frameRate:d||Wn,resolution:f&&b?"".concat(f," * ").concat(b):"".concat(Wn),blockTime:m,jitterData:h||Wn,nAckCount:String(g||0===g?g:Wn),pliCount:String(v||0===v?v:Wn),googleRTTTotalTime:R||Wn,isReceiveFirstFrameRate:C,codeType:T||String(Wn),isEnabled:(null===(t=o._crtRTCRoom.getLocalTrack(e.trackId))||void 0===t?void 0:t.isLocalMuted())?Yo.DISABLE:Yo.ENABLE,isActive:(null==N?void 0:N.isPause())?0:1,streamCode:null==N?void 0:N.getDeviceAvailable(!0)};e.kind===pi.AUDIO&&p.push({streamInfo:D,ssrc:Number(S)||Wn,bytesSent:E||Wn,googTargetEncBitrate:A||Wn,googActualEncBitrate:L||Wn,googRetransmitBitrate:w||Wn,maxSeqNum:Wn}),e.kind===pi.VIDEO&&_.push({streamInfo:D,ssrc:Number(S)||Wn,bytesSent:E||Wn,packetsFractionLost:O||Wn,googTargetEncBitrate:A||Wn,googActualEncBitrate:L||Wn,googRetransmitBitrate:w||Wn,rongFecBitrate:P||Wn,framesEncoded:y||Wn,framesDroppedByCapturer:Wn,framesDroppedByBwLimit:Wn,framesDroppedByEncoderQueue:Wn,framesDroppedByEncoder:Wn,googFrameRateInput:Wn,videoQp:I||Wn,enableVirtualBG:a.openVirtualBG&&((null===(r=a.openBG)||void 0===r?void 0:r[N.uuid])||(null===(n=a.openBlur)||void 0===n?void 0:n[N.uuid]))?1:0})}}))),{info:{joinTime:this._context.userJoinTime||0,receiveTime:Date.now(),totalBitRate:l,appCPUUsage:-1,systemCPUUsage:-1,systemCPUFrequency:-1,networkStatus:(null==s?void 0:s.networkType)||"unknown",googleRTTNetwork:(null==s?void 0:s.rtt)?parseFloat("".concat(null==s?void 0:s.rtt)):Wn,ipAddress:"".concat((null==s?void 0:s.IP)||Wn,":").concat(null==s?void 0:s.port),useReceiveBroadBand:String((null==s?void 0:s.availableIncomingBitrate)||Wn),useSendBroadBand:String((null==s?void 0:s.availableOutgoingBitrate)||Wn),packetLossCount:String((null==s?void 0:s.totalPacketsLost)||Wn),streams:d,googTargetEncBitrate:-1,googRetransmitBitrate:-1,googTransmitBitrate:-1,googBucketDelay:-1,upLinkLossrate:-1,rongNetOffsetMs:-1,rongPreBweBps:-1,rongAvgRttMs:-1,sendAudioStreams:p,sendVideoStreams:_,recvAudioStreams:f,recvVideoStreams:b,rtcVersion:"5.7.10-enterprise-lz.50",imVersion:this._context.getCoreVersion(),platform:"web",iceStatus:ta[null===(n=a.iceNewStatusData)||void 0===n?void 0:n.status],subIceStatus:ta[null===(i=a.subIceNewStatusData)||void 0===i?void 0:i.status],xorMode:0,startAudioDeviceCount:-1,sequenceId:-1,rongMaxRttMs:-1,iceDecoupleMode:0,remoteAddress:localStorage.getItem("".concat(this._context.getAppkey(),"__fast_media_url__"))||"",deviceInfo:"",group:a.group||""}}}}),Object.defineProperty(t.prototype,"sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t=!1),a(this,void 0,void 0,(function(){var r,n;return s(this,(function(i){return r="".concat(this._sequenceId++),n=this._formatReportData($o.R3R4,e),this._context.saveRTCState(n,$o.R3R4,r),t||this.reportLocalQosDataToPolaris(),[2,Xo.REPORT_SUCCESS]}))}))}}),Object.defineProperty(t.prototype,"sendLocalQosData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r,i;return a(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return(o=t.logServer)&&this._useHttp?!1===Ne.getMemo().sendQos?[2,Xo.REPORT_FAIL]:[4,this._context.setRTCQosDataByHttp(o,this._runtime,e)]:[2,Xo.REPORT_FAIL];case 1:return(a=s.sent())===Xo.REPORT_SUCCESS?[2,Xo.REPORT_SUCCESS]:(null===(i=null===(r=this._context)||void 0===r?void 0:r.logger)||void 0===i||i.info(n.L_HTTP_POLARIS_REPORT_FAIL_O,"send data fail -> code: ".concat(a)),[2,Xo.REPORT_FAIL])}}))}))}}),Object.defineProperty(t.prototype,"sendR1",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=this._formatReportData($o.R1),[4,this._send(e,$o.R1,"".concat(this._sequenceId++))];case 1:return t.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n;return s(this,(function(i){switch(i.label){case 0:return n=this._formatReportData($o.R2,{action:e,status:t,trackIds:r}),[4,this._send(n,$o.R2,"".concat(this._sequenceId++))];case 1:return i.sent(),[2]}}))}))}}),t}(),la=function(){function e(e,t){Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"audioLevelReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(this._audioLevelChangeHandler){var r=[],n=Ne.getMemo();e.forEach((function(e){var i,o=Fi(e.trackId).identifier,a=null===(i=n.meidToUserIdMap)||void 0===i?void 0:i[o],s=t._store.crtUserId===a?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);s&&r.push({track:s,audioLevel:e.audioLevel||0,userId:a,detectAudioLevel:n.micAudioLevel})})),this._audioLevelChangeHandler(r)}}}),Object.defineProperty(e.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioLevelChangeHandler=e}}),e}();!function(e){e.UNPUBLISH_PREV="UnpublishPrevCommand",e.PULL_RTCROOM_STATUS="PullRTCRoomStatusCommand",e.JOINROOM="JoinRoomCommand",e.MeetingJoinRoomCommand="MeetingJoinRoomCommand",e.MeetingAudioSubCommand="MeetingAudioSubCommand",e.MeetingVideoSubCommand="MeetingVideoSubCommand",e.MeetingVideoUnsubCommand="MeetingVideoUnsubCommand",e.MeetingUpdateVideoSubListCommand="MeetingUpdateVideoSubListCommand",e.MeetingUnsubCommand="MeetingUnsubCommand",e.PARSE_REMOTERES="ParseRemoteResCommand",e.PARSE_USERSTATE="ParseUserStateCommand",e.LOCAL_TRACK_MUTE="LocalTrackMuteCommand",e.LOCAL_TRACK_DEVICE_STATUS_CHANGE_MUTE="LocalTrackDeviceStatusChangeCommand",e.PUBLISH="PublishCommand",e.RETRY_EXCHANGE="RetryExchangeCommand",e.UNPUBLISH="UnpublishCommand",e.SUBSCRIBE="SubscribeCommand",e.ASYNC_COMMAND="AsyncCommand",e.UNSUBSCRIBE="UnsubscribeCommand",e.UPDATE_SUBSCRIBE_LIST="UpdateSubscribeListCommand",e.ON_SIGNAL_RECONNECTED="OnSignalReconnectedCommand",e.UNKNOWN="Unknown",e.MOCKJOINROOM="MockJoinRoomCommand",e.PUBLISH_AND_SUBSCRIBE="PublishAndSubscribeCommand",e.JOIN_MEETING_AND_ROOM="JoinMeetingAndRoomCommand",e.SubPeerReconnectCommand="SubPeerReconnectCommand",e.PULL_MEETING_AND_RTCROOM_STATUS="PullMeetingAndRTCRoomCommand",e.CONNECT_MEDIA_SERVER="connectMediaServerCommand",e.DISCONNECT_MEDIA_SERVER="disconnectMediaServerCommand",e.PULL_JOIN_MEETING_STATUS="pullJoinMeetingStatusCommand"}(ia||(ia={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}(oa||(oa={})),function(e){e[e.Destroy=40400]="Destroy"}(aa||(aa={}));var da,pa=function(){function e(){}return Object.defineProperty(e.prototype,"priority",{get:function(){return oa.LOW},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return ia.UNKNOWN},enumerable:!1,configurable:!0}),e}(),_a=function(){function t(e,t,r,n){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_busy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(t.prototype,"_next",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._busy=!1,this._execute()}}),Object.defineProperty(t.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var t,r,i,o,a,c;return s(this,(function(s){switch(s.label){case 0:if(this._isDestroyed||this._busy||0===this._queue.length)return[2];this._busy=!0,t=this._queue.shift(),r=t.command,i=t.resolve,a=this._logger.createTraceId(),s.label=1;case 1:return s.trys.push([1,3,,4]),this._logger.info(n.L_INVOKER_EXECUTE_T,"kind: ".concat(r.kind,", length: ").concat(this._queue.length),a),[4,r.execute(this._context,this._store,this)];case 2:return o=s.sent(),[3,4];case 3:return s.sent(),this._logger.error(n.L_INVOKER_EXECUTE_R,r.kind,a),this._next(),[2];case 4:return(c=o.code)!==exports.RCRTCCode.SUCCESS&&c!==e.ErrorCode.SUCCESS?this._logger.warn(n.L_INVOKER_EXECUTE_R,"code: ".concat(c,", kind: ").concat(r.kind),a):this._logger.info(n.L_INVOKER_EXECUTE_R,"kind: ".concat(r.kind,", Done"),a),i(o),this._next(),[2]}}))}))}}),Object.defineProperty(t.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t=this;return s(this,(function(r){return[2,new Promise((function(r){if(t._logger.info(n.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:t._isDestroyed,kind:e.kind,length:t._queue.length})),t._isDestroyed)r({code:exports.RCRTCCode.NOT_IN_ROOM});else{var i=e.priority;if(i===oa.LOW)t._queue.push({command:e,resolve:r});else{var o=t._queue.findIndex((function(e){return e.command.priority<i})),a=-1===o?t._queue.length-1:o;t._queue.splice(a,0,{command:e,resolve:r})}setTimeout((function(){t._execute()}),0)}}))]}))}))}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._isDestroyed||(this._logger.info(n.L_INVOKER_DESTROY_O,JSON.stringify({isDestroyed:this._isDestroyed})),this._isDestroyed=!0,this._queue.forEach((function(t){t.resolve({code:e.abortCode})})),this._queue.length=0)}}),t}(),fa=function(e){function t(t,r){return e.call(this,t.logger,t,r,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED)||this}return r(t,e),Object.defineProperty(t.prototype,"store",{get:function(){return this._context.store},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.destroy.call(this),this._store.removeRemoteTracks()}}),t}(_a),ba=function(e){function t(t,r,n,i,o,a){var s=e.call(this,t,r,n,i,o,!1,a)||this;return Object.defineProperty(s,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_isPreSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),s}return r(t,e),Object.defineProperty(t.prototype,"__innerSetRemoteMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteMuted=e}}),Object.defineProperty(t.prototype,"__innerSetSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubscribed=e}}),Object.defineProperty(t.prototype,"isSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubscribed}}),Object.defineProperty(t.prototype,"__innerSetPreSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPreSubscribed=e}}),Object.defineProperty(t.prototype,"isPreSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPreSubscribed}}),t}(vi),ma=function(e){function t(t,r,n,i,o){return e.call(this,t,r,n,i,"audio",o)||this}return r(t,e),Object.defineProperty(t.prototype,"getVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}),t}(ba),ha=function(e){function t(t,r,n,i,o){var a=e.call(this,t,r,n,i,"video",o)||this;return Object.defineProperty(a,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a}return r(t,e),Object.defineProperty(t.prototype,"__innerSetIsTinyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubTiny=e}}),Object.defineProperty(t.prototype,"isSubTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubTiny}}),t}(ba);!function(e){e.Muted="muted"}(da||(da={}));var ga,va=function(){function t(){Object.defineProperty(this,"_retryTimerMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_retryLockMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_retryGap",{enumerable:!0,configurable:!0,writable:!0,value:2e3}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:5e3}),Object.defineProperty(this,"_retrySignalMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return Object.defineProperty(t.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._getQueue(e.name);t.push(e.execute),this._setQueue(e.name,t),this.retry(e.name)}}),Object.defineProperty(t.prototype,"retry",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=this;if(!this._getLocked(t)){this._lock(t);var n=this._retryTimerMap.get(t);n&&(clearTimeout(n),this._clearTimer(t));var i,o=this._getQueue(t),a=o.shift();if(a)Promise.any([(i=this._timeout,new Promise((function(t){setTimeout((function(){t(e.ErrorCode.TIMEOUT)}),i)}))),a()]).then((function(i){if(r._unlock(t),o.length>0){var s=o.pop();o.length=0,o.push(s),r.retry(t)}else i!==e.ErrorCode.SUCCESS&&(o.push(a),n=setTimeout((function(){r.retry(t)}),r._retryGap),r._setTimer(t,n))}));else this._unlock(t)}}}),Object.defineProperty(t.prototype,"_lock",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._retryLockMap.set(e,!0)}}),Object.defineProperty(t.prototype,"_unlock",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._retryLockMap.set(e,!1)}}),Object.defineProperty(t.prototype,"_getLocked",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._retryLockMap.get(e)}}),Object.defineProperty(t.prototype,"_getQueue",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._retrySignalMap.get(e)||[]}}),Object.defineProperty(t.prototype,"_setQueue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._retrySignalMap.set(e,t)}}),Object.defineProperty(t.prototype,"_clearTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._retryTimerMap.delete(e)}}),Object.defineProperty(t.prototype,"_setTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._retryTimerMap.set(e,t)}}),t}(),Ra=function(){function e(e,t,r,n,i,o,a,s,c,u){void 0===c&&(c=!1),void 0===u&&(u=!1),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"isMainRoom",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"isMeetingMode",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"is1v1CallMode",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_roomResources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_collectSubscribeList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_trackIdSSRCMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_roomStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"retrySignalingMannger",{enumerable:!0,configurable:!0,writable:!0,value:new va}),Object.defineProperty(this,"_meidToUserIdMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_userIdToMeidMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_supportNtf",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"meetingAudioSubCommandStamp",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(e.prototype,"getResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._roomResources[e]}}),Object.defineProperty(e.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(e.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var n=this._remoteTracks[r];n.getUserId()===e&&t.push(n)}return t}}),Object.defineProperty(e.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteTracks}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(e.prototype,"getAllUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.keys(this._roomResources)}}),Object.defineProperty(e.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this.getAllUserIds().filter((function(t){return t!==e.crtUserId}))}}),Object.defineProperty(e.prototype,"getSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subscribedList}}),Object.defineProperty(e.prototype,"getCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._collectSubscribeList}}),Object.defineProperty(e.prototype,"getPublishedResourceByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=Fi(e).identifier,n=this.getUserIdByMeid(r);return null===(t=this._roomResources[n])||void 0===t?void 0:t.find((function(t){return Vi(t)===e}))}}),Object.defineProperty(e.prototype,"getToken",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._token}}),Object.defineProperty(e.prototype,"getRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomStatusVersion}}),Object.defineProperty(e.prototype,"getTrackIdBySSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._trackIdSSRCMap.get(e)}}),Object.defineProperty(e.prototype,"getRTCRequestHeader",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}}),Object.defineProperty(e.prototype,"getSupportNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._supportNtf}}),Object.defineProperty(e.prototype,"getUserIdByMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._meidToUserIdMap[e]}}),Object.defineProperty(e.prototype,"getMeidByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._userIdToMeidMap[e]}}),Object.defineProperty(e.prototype,"setRelationshipMapBetweenUserIdAndMeid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Ne.getMemo();this._meidToUserIdMap[e]=t,this._userIdToMeidMap[t]=e,r.meidToUserIdMap=this._meidToUserIdMap,r._userIdToMeidMap=this._userIdToMeidMap}}),Object.defineProperty(e.prototype,"setTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Ne.getMemo(),n=t.includes("_tiny"),i=t;n&&(i=t.slice(0,-5));var o=Fi(i),a=o.identifier,s=o.mediaType,c=o.tag,u=n?"".concat(Hi(a,c),"_tiny"):Hi(a,c);a===zi(this.crtUserId)&&(r.myFirstPublishResources?r.myFirstPublishResources.filter((function(e){return e.mediaType===s&&e.msid===u}))[0]||r.myFirstPublishResources.push({mediaType:s,msid:u,ssrc:String(e)}):r.myFirstPublishResources=[{mediaType:s,msid:u,ssrc:String(e)}]);this._trackIdSSRCMap.set(e,t)}}),Object.defineProperty(e.prototype,"setMeetingAudioSubCommandStamp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.meetingAudioSubCommandStamp=e}}),e}(),Ca=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.values(this._roomResources).forEach((function(t){t.forEach((function(t){var r,n=JSON.parse(t.uri),i=n.ssrc,o=n.tag,a=n.meid,s=n.mediaType,c=n.resourceId,u=n.userId;r=c||Gi(a||u,o,s),e.setTrackIdSSRCMap(i,r)}))}))}}),Object.defineProperty(t.prototype,"_initRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=Ne.getMemo();this.setRelationshipMapBetweenUserIdAndMeid(zi(this.crtUserId),this.crtUserId);var r=function(r){var i=n._roomResources[r];if(r===n.crtUserId||0===i.length)return"continue";i.forEach((function(n){var i,a,s=Vi(n);if(!e._remoteTracks[s]){var c=n.ssrc;if(c){var u=null===(a=t.prePubUserBySSRC)||void 0===a?void 0:a[c];u&&(t.replacePreTrackIdMap=o(o({},t.replacePreTrackIdMap),((i={})[s]=Gi(u.meid,void 0,n.mediaType),i)))}var l=Fi(s),d=l.tag,p=l.identifier,_=l.mediaType;e.setRelationshipMapBetweenUserIdAndMeid(p,r);var f=_===exports.RCMediaType.AUDIO_ONLY?new ma(e._logger,d,r,p):new ha(e._logger,d,r,p);f.__innerSetRemoteMuted(0===n.state),f.updateDeviceAvailable(n.code||exports.RCRTCStreamCode.RCRTCStreamCodeDefault),e._remoteTracks[s]=f}}))},n=this;for(var i in this._roomResources)r(i)}}),Object.defineProperty(t.prototype,"initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=so(e.version),this._roomResources=io(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(n.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}}),Object.defineProperty(t.prototype,"assignRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"setResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"removeRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"removeResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"addRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteTracks[e.getTrackId()]=e}}),Object.defineProperty(t.prototype,"removeRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach((function(e){e.isAudioTrack()&&e.__releaseMediaElement()})),this._remoteTracks={})}}),Object.defineProperty(t.prototype,"resetSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._subscribedList).splice.apply(t,l([0,this._subscribedList.length],u(e),!1)),this.resetCollectSubscribeList(e)}}),Object.defineProperty(t.prototype,"resetCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,l([0,this._collectSubscribeList.length],u(e),!1))}}),Object.defineProperty(t.prototype,"setRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._roomStatusVersion=so(e)}}),t}(Ra),Ta=function(t){function o(){return null!==t&&t.apply(this,arguments)||this}return r(o,t),Object.defineProperty(o.prototype,"kind",{get:function(){return ia.UNPUBLISH_PREV},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var o,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:return o=t.logger,a=t.context,c=r.getResourcesByUserId(r.crtUserId),u=c.slice(),c.length=0,l=o.createTraceId(),o.info(n.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:u}),l),[4,a.setRTCTotalRes(r.roomId,Mi([]),lo.TOTAL_CONTENT_RESOURCE)];case 1:return(d=s.sent())!==e.ErrorCode.SUCCESS?o.error(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:i.FAILED,code:d}),l):o.info(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:i.SUCCEEDED}),l),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),o}(pa),Sa=function(t){function o(e,r,n,i,o,a){var s=t.call(this)||this;return Object.defineProperty(s,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return r(o,t),Object.defineProperty(o.prototype,"kind",{get:function(){return ia.JOINROOM},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){var o=this;if(t.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(t.getNaviInfo(),!e.validate("roomId",this.roomId,e.notEmptyString,!0))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("roomType",this.roomType,(function(e){return void 0!==exports.RTCMode[e]})))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("outerUserDatas",this.outerUserDatas,e.isObject,!1))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every((function(t){return e.validate("outerUserDatas.".concat(t),o.outerUserDatas[t],e.isString,!0)})))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}}),Object.defineProperty(o.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,c,u,l,d,p,_,f,b,m,h,g;return s(this,(function(s){switch(s.label){case 0:return a=Date.now(),c=t.context,u=t.service,l=t.logger,d=t.reportMediaActionLogger,p=n.L_RTC_CLIENT_JOIN_RTC_ROOM_R,(_=this._validateParams(c,l,p).code)!==exports.RCRTCCode.SUCCESS?[2,{code:_}]:(u.detectorMediaSever(),u.getNaviMS().length?(f=r.getSupportNtf(),[4,c.joinRTCRoom(this.roomId,this.roomType,this.joinType,this.innerUserDatas,this.outerUserDatas,f)]):(l.error(p,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]));case 1:return b=s.sent(),m=b.code,h=b.data,d.reportQualityJoinRoomData(a,m,this.roomType,null==h?void 0:h.sessionId),m===e.ErrorCode.SUCCESS&&h?(r.initWithRoomData(h,this.traceId),r.getResourcesByUserId(r.crtUserId).length>0&&o.push(new Ta),l.info(p,JSON.stringify({status:i.SUCCEEDED,userId:r.crtUserId,roomId:this.roomId}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS,data:h}]):(g=40032===m?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:m,l.error(p,JSON.stringify({status:i.FAILED,code:g,msg:"joinRoom failed"}),this.traceId),[2,{code:g}])}}))}))}}),o}(pa),ya="PEER_CONNECTION_CLOSED_BY_EXCEPTION",Ea="USER_JOIN",Oa="USER_LEAVE",Ia="TRACKS_PUBLISH",La="TRACKS_UNPUBLISH",Pa="AUDIO_MUTE_CHANGE",Aa="VIDEO_MUTE_CHANGE",wa="USER_STATE_CHANGE",ka="TRACKS_DEVICE_CHANGE",Na=function(e){function t(t,r,n,i,o,a,s,c,u){var l=e.call(this)||this;return Object.defineProperty(l,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(l,"service",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(l,"context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(l,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(l,"peer",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(l,"store",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(l,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(l,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(l,"subPeer",{enumerable:!0,configurable:!0,writable:!0,value:u}),l}return r(t,e),t}(e.EventEmitter),Da=function(e){function t(t,r){void 0===r&&(r=!1);var n=e.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"ignoreCheck",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.MeetingUpdateVideoSubListCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var r,n,i,o,a,c,d,p,_,f,b,m,h;return s(this,(function(s){switch(s.label){case 0:if(e.logger,r=e.subPeer,!this.ignoreCheck&&(n=[],i=this.tracks.map((function(e){return e instanceof ba?(n.push({subTiny:!1,track:e}),e):(n.push(e),e.track)})),o=t.getSubscribedList().filter((function(e){return e.track.isVideoTrack()})),i.length===o.length&&i.every((function(e){return e.isSubscribed()}))&&n.every((function(e){return e.subTiny===e.track.isSubTiny()}))))return[2,{code:exports.RCRTCCode.SUCCESS}];for(b in a=[],this.tracks.forEach((function(e){var r=e instanceof ba?{subTiny:!1,track:e}:e,n=r.subTiny,i=r.track;t.getPublishedResourceByTrackId(i.getTrackId())&&i.isVideoTrack()&&a.push({mslabel:i.getStreamId(),simulcast:!!n,uri:t.getPublishedResourceByTrackId(i.getTrackId()).uri,userId:i.getUserId()})})),c=t.getRemoteTracks(),d=function(e){var t=c[e];if(t.isAudioTrack())return"continue";a.every((function(e){return e.mslabel!==t.getStreamId()}))&&t.__innerSetMediaStreamTrack(void 0)},c)d(b);for(b in p=[],_=[],this.tracks.forEach((function(e){var t=e instanceof ba?{track:e}:e;p.push(t)})),f=function(e){var t=c[e];if(t.isAudioTrack())return"continue";var r=p.some((function(e){return e.track===t}));t.__innerSetSubscribed(r);var n=a.some((function(t){return"".concat(t.mslabel,"_1")===e&&t.simulcast}));t.__innerSetIsTinyTrack(n)},c)f(b);return(m=t.getSubscribedList().filter((function(e){return e.track.isAudioTrack()}))).push.apply(m,l([],u(p),!1)),t.resetSubscribedList(m),[4,r.updateVideoSubList(a)];case 1:return(h=s.sent().code)!==exports.RCRTCCode.SUCCESS?[2,{code:h}]:[2,{code:h,failedList:_}]}}))}))}}),t}(pa),Ma=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.MeetingVideoUnsubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o=this;return s(this,(function(a){return n=t.getSubscribedList().filter((function(e){return e.track.isVideoTrack()})),i=n.filter((function(e){return!o.tracks.includes(e.track)})),n.length===i.length?[2,{code:exports.RCRTCCode.SUCCESS}]:[2,new Da(i).execute(e,t,r)]}))}))}}),t}(pa),xa=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.MeetingUnsubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o;return s(this,(function(a){switch(a.label){case 0:return n=e.subPeer,i=[],o=[],this.tracks.forEach((function(e){e.isAudioTrack()?o.push(e):i.push(e)})),[4,n.removeAudioSubList(o.map((function(e){return e.getStreamId()})))];case 1:return a.sent(),[2,new Ma(i).execute(e,t,r)]}}))}))}}),t}(pa);!function(e){e.BEGIN="begin",e.END="end"}(ga||(ga={}));var Ua,ja,Ba,Va=function(e){function t(t,r,n,i){var o=e.call(this)||this;return Object.defineProperty(o,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(o,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"pbMode",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var r,n,i,o,a;return s(this,(function(s){switch(s.label){case 0:return r=e.service,e.context,this.pbMode?[3,2]:[4,r.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas)];case 1:return n=s.sent(),[3,4];case 2:return[4,r.miniSDPExchange(t.getRTCRequestHeader(),this.reqBody,this.traceId)];case 3:n=s.sent(),s.label=4;case 4:return i=n.code,o=n.data,a=n.qualityMsList,[2,{code:i,data:{data:o,qualityMsList:a}}]}}))}))}}),t}(pa);!function(e){e[e["UDP/TLS/RTP/SAVPF"]=0]="UDP/TLS/RTP/SAVPF",e[e["RTP/AVPF"]=1]="RTP/AVPF",e[e["RTP/SAVPF"]=2]="RTP/SAVPF"}(Ua||(Ua={})),function(e){e[e.opus=0]="opus",e[e.PCMU=1]="PCMU",e[e.red=10]="red"}(ja||(ja={})),function(e){e[e.H264=0]="H264",e[e.VP8=1]="VP8",e[e.rtx=2]="rtx",e[e["flexfec-03"]=11]="flexfec-03"}(Ba||(Ba={}));var Fa,Ja=function(e){var t,r,n=JSON.stringify(e),i=Ne.getMemo(),o=[];o.push(Ha());try{for(var a=c(i.answerInfo.midMap),s=a.next();!s.done;s=a.next()){var l=u(s.value,2),d=l[0],p=l[1],_=p.direction,f=p.msid,b=p.mediaType;"audio"===b?o.push(Ka(e,{mid:d,msid:f,direction:_,mediaType:b})):"video"===b&&o.push(Za(e,{mid:d,msid:f,direction:_,mediaType:b}))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}var m=o.join("").replace(/\n+/g,"\n");return $n.info("miniSDPToAnswer: ",uo(n),m),m},Ha=function(){var e,t,r=Ne.getMemo();return"v=0\no=- 0 0 IN IP4 ".concat(null===(e=r.answerInfo)||void 0===e?void 0:e.ipAddr,"\ns=MediaServer4.0\nt=0 0\na=group:BUNDLE ").concat(null===(t=r.answerInfo)||void 0===t?void 0:t.groupBundle,"\na=msid-semantic: WMS *\n")},Ga=function(e){var t="sendrecv";switch(e){case"sendonly":t="recvonly";break;case"recvonly":t="sendonly";break;default:t=e}return t},Ka=function(e,t){var r,n,i,a,s,c,l,d=Ne.getMemo(),p=Ga(t.direction),_="m=audio 40001 ".concat(Ua[e.dataFormat]," ").concat(null===(r=e.audioMedia)||void 0===r?void 0:r.codecs.map((function(e){return e.payload})).join(" "),"\nc=IN IP4 ").concat(null===(n=d.answerInfo)||void 0===n?void 0:n.ipAddr,"\na=rtcp:40001 IN IP4 ").concat(null===(i=d.answerInfo)||void 0===i?void 0:i.ipAddr,"\na=ice-ufrag:").concat(e.ifrag,"\na=ice-pwd:").concat(e.ipwd,"\na=ice-lite\na=fingerprint:").concat(e.fingerprint,"\na=candidate:").concat(e.candidates[0],"\na=candidate:").concat(e.candidates[1],"\na=setup:").concat(e.setup,"\na=mid:").concat(t.mid,"\n").concat(qa(e.audioMedia.ext),"\na=").concat(p,"\na=rtcp-mux\n").concat(Wa(e),"\n").concat(za(e),"\n").concat(Qa(e),"\n");if("recvonly"!==p&&"inactive"!==p){var f=void 0;if(t.msid){var b=e.audioMedia.streams.findIndex((function(r){return"".concat(r.meid,"_").concat(r.tag||e.tag)===t.msid}));-1!==b&&(f=u(e.audioMedia.streams.splice(b,1),1)[0])}else f=e.audioMedia.streams.shift();if(f){var m=null===(s=null===(a=d.answerInfo)||void 0===a?void 0:a.midMap)||void 0===s?void 0:s.get(t.mid),h="".concat(f.meid,"_").concat(f.tag||e.tag);null===(l=null===(c=d.answerInfo)||void 0===c?void 0:c.midMap)||void 0===l||l.set(t.mid,o(o({},m),{msid:h})),_+=Ya(f,h)}}return _},qa=function(e){var t="";return e.sal&&(t+="a=extmap:".concat(e.sal," urn:ietf:params:rtp-hdrext:ssrc-audio-level\n")),e.absts&&(t+="a=extmap:".concat(e.absts," http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\n")),e.tccno&&(t+="a=extmap:".concat(e.tccno," http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\n")),t},Wa=function(e){var t=e.audioMedia.codecs.filter((function(e){return e.tp===ja.red}))[0];if(t){var r=t.formatParameters.reduce((function(e,t){return"none"===t.key?""===e?"".concat(t.value):"".concat(t.value,";").concat(e):e=""===e?"".concat(t.key,"=").concat(t.value):"".concat(e,";").concat(t.key,"=").concat(t.value)}),"");return"a=rtpmap:".concat(t.payload," red/48000/2\na=fmtp:").concat(t.payload," ").concat(r,"\n")}return""},za=function(e){var t=e.audioMedia.codecs.filter((function(e){return e.tp===ja.opus}))[0];return t?"a=rtpmap:".concat(t.payload," opus/48000/2\na=rtcp-fb:").concat(t.payload," nack\na=fmtp:").concat(t.payload," minptime=10;useinbandfec=1;maxaveragebitrate=32000\n"):""},Qa=function(e){var t=e.audioMedia.codecs.filter((function(e){return e.tp===ja.PCMU}))[0];return t?"a=rtpmap:".concat(t.payload," PCMU/8000\n"):""},Ya=function(e,t){var r,n=Ne.getMemo();return"a=msid:".concat(t," ").concat(t,"_audio\na=ssrc:").concat(e.ssrc.main," cname:").concat(null===(r=n.answerInfo)||void 0===r?void 0:r.uid,"\na=ssrc:").concat(e.ssrc.main," msid:").concat(t," ").concat(t,"_audio\na=ssrc:").concat(e.ssrc.main," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.main," label:").concat(t,"_audio\n")},Za=function(e,t){var r,n,i,a,s,c,l,d=Ne.getMemo(),p=Ga(t.direction),_="m=video 40001 ".concat(Ua[e.dataFormat]," ").concat(e.videoMedia.codecs.map((function(e){return e.payload})).join(" "),"\nc=IN IP4 ").concat(null===(r=d.answerInfo)||void 0===r?void 0:r.ipAddr,"\na=rtcp:40001 IN IP4 ").concat(null===(n=d.answerInfo)||void 0===n?void 0:n.ipAddr,"\na=ice-ufrag:").concat(e.ifrag,"\na=ice-pwd:").concat(e.ipwd,"\na=ice-lite\na=fingerprint:").concat(e.fingerprint,"\na=setup:").concat(e.setup,"\na=mid:").concat(t.mid,"\n").concat(function(e){var t;return null===(t=e.candidates)||void 0===t||t.forEach((function(e){})),""}(e),"\n").concat(qa(e.videoMedia.ext),"\na=").concat(p,"\na=rtcp-mux\n").concat(Xa(e),"\n").concat($a(e),"\n").concat(es(e,null===(i=e.videoMedia.codecs.filter((function(e){return e.tp===Ba.H264}))[0])||void 0===i?void 0:i.payload),"\n");if("recvonly"!==p&&"inactive"!==p){var f=void 0;if(t.msid){var b=e.videoMedia.streams.findIndex((function(r){return"".concat(r.meid,"_").concat(r.tag||e.tag)===t.msid}));-1!==b&&(f=u(e.videoMedia.streams.splice(b,1),1)[0])}else f=e.videoMedia.streams.shift();if(f){var m=null===(s=null===(a=d.answerInfo)||void 0===a?void 0:a.midMap)||void 0===s?void 0:s.get(t.mid),h="".concat(f.meid,"_").concat(f.tag||e.tag);null===(l=null===(c=d.answerInfo)||void 0===c?void 0:c.midMap)||void 0===l||l.set(t.mid,o(o({},m),{msid:h})),_+=ts(f,h)}}return _},Xa=function(e){var t=e.videoMedia.codecs.filter((function(e){return e.tp===Ba.H264}))[0];if(t){var r=t.formatParameters.reduce((function(e,t){return""===e?"".concat(t.key,"=").concat(t.value):e="".concat(e,";").concat(t.key,"=").concat(t.value)}),"");return"a=rtpmap:".concat(t.payload," H264/90000\na=rtcp-fb:").concat(t.payload," ccm fir\na=rtcp-fb:").concat(t.payload," nack\na=rtcp-fb:").concat(t.payload," nack pli\na=rtcp-fb:").concat(t.payload," goog-remb\na=fmtp:").concat(t.payload," ").concat(r,"\n")}return""},$a=function(e){var t=e.videoMedia.codecs.filter((function(e){return e.tp===Ba["flexfec-03"]}))[0];return t?"a=rtpmap:".concat(t.payload," flexfec-03/90000\na=fmtp:").concat(t.payload," repair-window=10000000\n"):""},es=function(e,t){var r=e.videoMedia.codecs.filter((function(e){return e.tp===Ba.rtx}))[0];return console.log("getRtxTemplate",r,t),r&&t?"a=rtpmap:".concat(r.payload," rtx/90000\na=fmtp:").concat(r.payload," apt=").concat(t,"\n"):""},ts=function(e,t){var r,n,i,o=Ne.getMemo();return"a=msid:".concat(t," ").concat(t,"_video\na=ssrc-group:FID ").concat(e.ssrc.main," ").concat(e.ssrc.fid,"\na=ssrc-group:FEC-FR ").concat(e.ssrc.main," ").concat(e.ssrc.fec,"\na=ssrc:").concat(e.ssrc.main," cname:").concat(null===(r=o.answerInfo)||void 0===r?void 0:r.uid,"\na=ssrc:").concat(e.ssrc.main," msid:").concat(t," ").concat(t,"_video\na=ssrc:").concat(e.ssrc.main," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.main," label:").concat(t,"_video\na=ssrc:").concat(e.ssrc.fid," cname:").concat(null===(n=o.answerInfo)||void 0===n?void 0:n.uid,"\na=ssrc:").concat(e.ssrc.fid," msid:").concat(t," ").concat(t,"_video\na=ssrc:").concat(e.ssrc.fid," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.fid," label:").concat(t,"_video\na=ssrc:").concat(e.ssrc.fec," cname:").concat(null===(i=o.answerInfo)||void 0===i?void 0:i.uid,"\na=ssrc:").concat(e.ssrc.fec," msid:").concat(t," ").concat(t,"_video\na=ssrc:").concat(e.ssrc.fec," mslabel:").concat(t,"\na=ssrc:").concat(e.ssrc.fec," label:").concat(t,"_video\n")},rs=function(){return a(void 0,void 0,void 0,(function(){var e,t,r,n;return s(this,(function(i){switch(i.label){case 0:return(e=Ne.getMemo()).miniSDPTemplate?[3,2]:((t=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),[4,t.createOffer()]);case 1:r=i.sent(),n=r.sdp,t.close(),t=null,e.miniSDPTemplate={audioMedia:os(n),videoMedia:as(n)},i.label=2;case 2:return[2,e.miniSDPTemplate]}}))}))},ns=function(e){var t,r,n,i,a,s,c,l,d,p,_,f,b,m,h,g,v,R;if(e){var C,T,S=Ne.getMemo();e.includes("m=audio ")?C=os(e):(rs(),C=null===(t=S.miniSDPTemplate)||void 0===t?void 0:t.audioMedia),(null==e?void 0:e.includes("m=video "))?T=as(e):(rs(),T=null===(r=S.miniSDPTemplate)||void 0===r?void 0:r.videoMedia);var y=u(e.split("m=")),E=y[0],O=y.slice(1),I=null===(n=E.match(/o=.* IN IP4 (.*)/im))||void 0===n?void 0:n[1],L=null===(i=E.match(/a=group:BUNDLE (.+)/im))||void 0===i?void 0:i[1],P=null===(a=E.match(/a=msid-semantic: WMS (.+)/im))||void 0===a?void 0:a[1],A=null===(s=null==E?void 0:E.match(/o=.*? (\d+) /im))||void 0===s?void 0:s[1],w=null===(l=null===(c=O[0])||void 0===c?void 0:c.match(/a=ice-ufrag:(.+)/im))||void 0===l?void 0:l[1],k=null===(p=null===(d=O[0])||void 0===d?void 0:d.match(/a=ice-pwd:(.+)/im))||void 0===p?void 0:p[1],N=null===(f=null===(_=O[0])||void 0===_?void 0:_.match(/a=setup:(.+)/im))||void 0===f?void 0:f[1],D=null===(m=null===(b=O[0])||void 0===b?void 0:b.match(/a=fingerprint:(.+)/im))||void 0===m?void 0:m[1],M=null===(g=null===(h=O[0])||void 0===h?void 0:h.match(/(audio|video) \d+ ([A-Z/]+) /im))||void 0===g?void 0:g[2],x=/a=ssrc:(\d+) cname:/im,U=/a=ssrc-group:FID (\d+) (\d+)/im,j=/a=ssrc-group:FEC-FR (\d+) (\d+)/im,B=null===(v=null==S?void 0:S.answerInfo)||void 0===v?void 0:v.midMap;B||(B=new Map),O.forEach((function(e){var t,r,n,i,a,s,c,l,d=null===(n=e.match(/a=mid:(\d+)/im))||void 0===n?void 0:n[1],p=null===(i=e.match(/a=(inactive|sendonly|recvonly|sendrecv)/im))||void 0===i?void 0:i[1];if(e.includes("audio")){var _=null===(a=e.match(x))||void 0===a?void 0:a[1],f=new RegExp("a=ssrc:".concat(_," msid:(.*) "),"im"),b=null===(s=e.match(f))||void 0===s?void 0:s[1];if(B.get(d)||B.set(d,{mid:d,direction:p,msid:b,mediaType:"audio"}),_){var m=Ji(b||"").tag;S.trackIdToSsrc=o(o({},S.trackIdToSsrc),((t={})["".concat(b,"_0")]=_,t)),m!==Uc.DEFAULT?C.streams.push({tag:m,ssrc:{main:_}}):C.streams.push({ssrc:{main:_}})}}if(e.includes("video")){var h=u(e.match(U)||[],3),g=(_=h[1],h[2]),v=null===(c=e.match(j))||void 0===c?void 0:c[2];f=new RegExp("a=ssrc:".concat(_," msid:(.*) "),"im"),b=null===(l=e.match(f))||void 0===l?void 0:l[1];if(B.get(d)||B.set(d,{mid:d,direction:p,msid:b,mediaType:"video"}),_){m=void 0;if(null==b?void 0:b.includes("_tiny")){var R=b.split("_");m="".concat(R[R.length-2],"_tiny")}else m=Ji(b||"").tag;S.trackIdToSsrc=o(o({},S.trackIdToSsrc),((r={})["".concat(b,"_1")]=_,r)),m!==Uc.DEFAULT?T.streams.push({tag:m,ssrc:{main:_,fec:v,fid:g}}):T.streams.push({ssrc:{main:_,fec:v,fid:g}})}}}));var V={uid:null===(R=S.crtRoom)||void 0===R?void 0:R.getCrtUserId(),ipAddr:I,groupBundle:L,semantic:P,midMap:B},F={sid:A,ifrag:w,ipwd:k,setup:N,crypto:undefined,fingerprint:D,candidates:[],dataFormat:Ua[M],tag:Uc.DEFAULT,audioMedia:C,videoMedia:T};return S.answerInfo=V,$n.info("offerToMiniSDP: ",e,F,V),F}},is=function(e,t,r){var n,i,o,a;if(t.test(e)){var s=null===(n=null==e?void 0:e.match(t))||void 0===n?void 0:n[1],c=null===(i=null==e?void 0:e.match(t))||void 0===i?void 0:i[2],l=void 0;l=r===exports.RCMediaType.AUDIO_ONLY?function(e){var t;switch(e){case"red":t=ja.red;break;case"opus":default:t=ja.opus;break;case"PCMU":t=ja.PCMU}return t}(c):function(e){var t;switch(e){case"H264":default:t=Ba.H264;break;case"VP8":t=Ba.VP8;break;case"flexfec-03":t=Ba["flexfec-03"];break;case"rtx":t=Ba.rtx}return t}(c);var d={tp:l,payload:s,feedbackTypes:[],formatParameters:[]},p=new RegExp("a=fmtp:".concat(s," (.*$)"),"im"),_=null===(o=null==e?void 0:e.match(p))||void 0===o?void 0:o[1];return null===(a=null==_?void 0:_.split(";"))||void 0===a||a.forEach((function(e){var t=u(e.split("="),2),r=t[0],n=t[1];""!==r&&(void 0===n?d.formatParameters.push({key:"none",value:r}):d.formatParameters.push({key:r,value:n}))})),d}},os=function(e){var t,r,n,i;if(!e)return{ext:{},codecs:[],streams:[]};var o=null===(t=null==(e+="m=a")?void 0:e.match(/m=audio.*?m=(a|v)/ims))||void 0===t?void 0:t[0],a={sal:Number(null===(r=null==o?void 0:o.match(/a=extmap:(\d+) urn:ietf:params:rtp-hdrext:ssrc-audio-level/im))||void 0===r?void 0:r[1]),absts:Number(null===(n=null==o?void 0:o.match(/a=extmap:(\d+) http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time/im))||void 0===n?void 0:n[1]),tccno:Number(null===(i=null==o?void 0:o.match(/a=extmap:(\d+) http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01/im))||void 0===i?void 0:i[1])},s=[],c=is(o,/a=rtpmap:(\d+) .*(red)\/48000\/2/im,0);c&&s.push(c);var u=is(o,/a=rtpmap:(\d+) .*(opus)\/48000\/2/im,0);u&&s.push(u);var l=is(o,/a=rtpmap:(\d+) .*(PCMU)\/8000/im,0);return l&&s.push(l),{ext:a,codecs:s,streams:[]}},as=function(e){var t,r,n,i,o;if(!e)return{ext:{},codecs:[],streams:[]};var a=null===(t=null==(e+="m=a")?void 0:e.match(/m=video.*?m=(a|v)/ims))||void 0===t?void 0:t[0],s={absts:Number(null===(r=null==a?void 0:a.match(/a=extmap:(\d+) http:\/\/www.webrtc.org\/experiments\/rtp-hdrext\/abs-send-time/im))||void 0===r?void 0:r[1]),tccno:Number(null===(n=null==a?void 0:a.match(/a=extmap:(\d+) http:\/\/www.ietf.org\/id\/draft-holmer-rmcat-transport-wide-cc-extensions-01/im))||void 0===n?void 0:n[1])},c=[],u=null===(i=null==a?void 0:a.match(/a=fmtp:(\d+) .*(profile-level-id=42e01f|packetization-mode=1).*(profile-level-id=42e01f|packetization-mode=1).*(\n|\r\n|\r|\n\r)/im))||void 0===i?void 0:i[1],l=new RegExp("a=rtpmap:(".concat(u,") (H264)/90000"),"im"),d=is(a,l,1);d&&c.push(d);var p=new RegExp("a=fmtp:(\\d+) apt=".concat(u),"im"),_=null===(o=null==a?void 0:a.match(p))||void 0===o?void 0:o[1],f=new RegExp("a=rtpmap:(".concat(_,") (rtx)/90000"),"im"),b=is(a,f,1);b&&c.push(b);var m=is(a,/a=rtpmap:(\d+) (flexfec-03)\/90000/im,1);return m&&c.push(m),{ext:s,codecs:c,streams:[]}},ss=function(e,t){var r,n=Ne.getMemo(),i=new Map;null===(r=e.preSubList)||void 0===r||r.forEach((function(e){var t=e.msid;if(t){var r=Ji(e.msid),n=r.identifier,a=r.tag,s=i.get(t),c=void 0;c=e.mediaType===exports.RCMediaType.AUDIO_ONLY?o(o({},s),{meid:n,userId:e.userId,tag:a,audioSSRC:Number(e.ssrc)}):o(o({},s),{meid:n,userId:e.userId,tag:a,videoSSRC:Number(e.ssrc),videoSimulcast:e.simulcast}),i.set(t,c)}}));var a={sdp:ns(e.sdp.sdp),subStreamList:l([],u(i.values()),!1),roomType:_o(n.roomType),meid:zi(t),snui:e.snui};return $n.debug("miniSDPExchangeParams: ",a),a};!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(Fa||(Fa={}));var cs=function(t){function c(e,r,n,i,o,a){void 0===i&&(i=Fa.SUB),void 0===a&&(a=0);var s=t.call(this)||this;return Object.defineProperty(s,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"reTry",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(s,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),s}return r(c,t),Object.defineProperty(c.prototype,"kind",{get:function(){return ia.UPDATE_SUBSCRIBE_LIST},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o){var a=null==o?void 0:o.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),s=r.filter((function(e){return!(null==a?void 0:a.includes(e.track.getTrackId()))})),c=r.filter((function(e){return null==a?void 0:a.includes(e.track.getTrackId())})),u=null==s?void 0:s.map((function(e){return e.track.getTrackId()}));t.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:i.SUCCEEDED,subSuccessTrackIds:u,failedList:c}),this.traceId);var l=e.getRemoteTracks(),d=function(e){var t=s.some((function(t){return t.track.getTrackId()===e}));l[e].__innerSetSubscribed(t);var r=s.some((function(t){return t.track.getTrackId()===e&&t.subTiny}));l[e].isVideoTrack()&&l[e].__innerSetIsTinyTrack(r)};for(var p in l)d(p);return e.resetSubscribedList(s),c}}),Object.defineProperty(c.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,a=r.map((function(e){return e instanceof ba?{track:e}:o({},e)})),s={};return a=a.filter((function(r){var o=r.track.getTrackId();return e.getRemoteTrack(o)?!s[o]&&(s[o]=!0,!0):(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(o),i.traceId),!1)})).map((function(e){return o({},e)}))}}),Object.defineProperty(c.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.validate("tracks",r,(function(){return e.isArray(r)&&r.every((function(e){return e instanceof ba||e.track instanceof ba}))}),!0)?{code:exports.RCRTCCode.SUCCESS}:(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR})}}),Object.defineProperty(c.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){(null==r?void 0:r.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,r,t,this._trackMediaMap)}}),Object.defineProperty(c.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var u,l,d,p,_;return a(this,void 0,void 0,(function(){var a,f,b,m,h,g,v,R,C,T,S,y,E,O,I,L,P,A,w,k,N,D,M,x,U,j,B,V,F,J,H,G,K,q,W=this;return s(this,(function(s){switch(s.label){case 0:if(a=e.logger,f=e.peer,b=e.reportMediaActionLogger,this._actionStartTime=Date.now(),h=(m=this).tracks,g=m.forceReq,v=m.reTry,R=m.traceId,C=m.fromCommand,T=m.unsubTracks,S=t.roomId,y=Ne.getMemo(),a.info(n.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(S,", forceReq: ").concat(g,", trackIds: ").concat(h.map(ao)),this.traceId),(E=this._validateParams(a,h).code)!==exports.RCRTCCode.SUCCESS)return[2,{code:E}];if(O=this._getParams(t,a,h),I=t.getSubscribedList().map((function(e){return o({},e)})),!g){if(!gs(O,I))return a.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:i.SUCCEEDED,msg:"subscribe list unchanged"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}];I.length&&(L=I.map((function(e){return e.track})),a.warn(n.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:L.map((function(e){return e.getTrackId()}))}),this.traceId),P=t.getSubscribedList().filter((function(e){return!L.includes(e.track)})),t.resetSubscribedList(P))}return f.__reportR3R4ToPolaris(),f.clearReTryExchangeTimer(),f.updateSubRemoteTracks(O.map((function(e){return e.track}))),[4,ds(O,!1,e)];case 1:return A=s.sent(),w=null===(l=null===(u=uo(y.rtcConfig))||void 0===u?void 0:u.rtc)||void 0===l?void 0:l.config,k=null===(d=uo(null==w?void 0:w.exchangeSetting))||void 0===d?void 0:d.mode,N=k?ss(o(o({},A),{snui:0}),t.crtUserId):o(o({},A),{snui:0}),[4,new Va(N,this.traceId,!0,k).execute(e,t,r)];case 2:return D=s.sent(),h.forEach((function(e){var t=e instanceof ba?e.getTrackId():e.track.getTrackId();W._trackMediaMap[t]=D.data.qualityMsList||[]})),M=this.fromCommand===Fa.SUB?h:this.unsubTracks,D.code!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(b,D.code,M),a.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:i.FAILED,code:D.code}),this.traceId),[2,{code:D.code}]):(V=0,k?(H=null===(p=D.data)||void 0===p?void 0:p.data,x=H.sdp,U=H.code,H.msg,G=H.snui,V=void 0===G?0:G,j=Ja(x)):(K=null===(_=D.data)||void 0===_?void 0:_.data,x=K.sdp,U=K.resultCode,K.message,K.subscribedList,B=K.subscribeErrorList,q=K.snui,V=void 0===q?0:q,j=x.sdp),y.snui=V,U!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(b,U,M),a.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:i.FAILED,code:U}),this.traceId),[2,{code:U}]):B&&B.length>0&&v>0&&B.some((function(e){return e.IsRetry}))?[2,new c(h,!0,R,C,T,v-1).execute(e,t,r)]:[4,f.setRemoteAnswer(j)]);case 3:return F=s.sent(),this._reportPubOrSubQualityData(b,F,M),F!==exports.RCRTCCode.SUCCESS?[2,{code:F}]:(Lo.formatSourceIdMapFromSdp(j,"subscribe"),[2,(J=this._dealSubscribeResult(t,a,O,B)).length?{code:exports.RCRTCCode.SUCCESS,failedList:J}:{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),c}(pa),us=function(t){function c(e,r){var n=t.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return r(c,t),Object.defineProperty(c.prototype,"kind",{get:function(){return ia.UNSUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,c){return a(this,void 0,void 0,(function(){var a,u,l,d;return s(this,(function(s){return a=t.logger,u=t.polarisReport,l=this.tracks,e.validate("tracks",l,(function(){return e.isArray(l)&&l.length>0&&l.every((function(e){return e instanceof ba}))}),!0)?(a.info(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:l.map(ao)}),this.traceId),d=r.getSubscribedList().map((function(e){return o({},e)})).filter((function(e){return!l.includes(e.track)})),l.forEach((function(e){u.sendR2(ra.SUBSCRIBE,ga.END,[e.getTrackId()])})),[2,new cs(d,!1,this.traceId,Fa.UNSUB,this.tracks).execute(t,r,c)]):(a.warn(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),c}(pa),ls=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var i,o,a;return s(this,(function(s){switch(s.label){case 0:return i=e.logger,o=this.tracks,a=i.createTraceId(),i.info(n.L_USER_LEFT_UNSUBSCRIBE_O,void 0,a),t.isMeetingMode?[4,new xa(o).execute(e,t,r)]:[3,2];case 1:return s.sent(),[3,4];case 2:return[4,new us(o,a).execute(e,t,r)];case 3:s.sent(),s.label=4;case 4:return o.forEach((function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())})),e.emit(La,o),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(pa);function ds(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:return n=r.peer,i=r.store,o=r.service,a=Ne.getMemo(),c=i.isMeetingMode,u=a.myFirstPublishResources||[],[4,n.createOffer(t,u)];case 1:return l=s.sent(),d={sdp:l,extend:JSON.stringify({customParams:o.getCustomExtendInfo(),resolutionInfo:n.getOutboundVideoInfo()}),subscribeList:c?e.filter((function(e){var t=e.track.getTrackId(),r=Fi(t).identifier,n=i.getUserIdByMeid(r),o=i.getResourcesByUserId(n);if(!o)return!1;var a=o.filter((function(e){return t==="".concat(e.nmsid||e.msid,"_").concat(e.mediaType)})).length;return a})).map((function(e){return{simulcast:e.subTiny?mo.TINY:mo.NORMAL,resolution:"",uri:i.getPublishedResourceByTrackId(e.track.getTrackId()).uri}})):void 0,preSubList:c?void 0:e.filter((function(e){var t=e.track.getTrackId(),r=Fi(t).identifier,n=i.getUserIdByMeid(r),o=i.getResourcesByUserId(n);if(!o)return!1;var a=o.filter((function(e){return t==="".concat(e.nmsid||e.msid,"_").concat(e.mediaType)})).length;return a})).map((function(e){var t,r=i.getPublishedResourceByTrackId(e.track.getTrackId()),n=e.subTiny?mo.TINY:mo.NORMAL,o=(null==r?void 0:r.uri)||"{}",s=JSON.parse(o),c=s.serverId,u=s.userTimestamp,l=s.ssrc,d=Fi(e.track.getTrackId()).identifier,p=i.getUserIdByMeid(d),_=null===(t=a.replacePreTrackIdMap)||void 0===t?void 0:t[e.track.getTrackId()],f=_&&Hi(Fi(_).identifier);return{simulcast:n,serverId:c,userTimestamp:u,msid:(null==r?void 0:r.nmsid)||(null==r?void 0:r.msid),mediaType:null==r?void 0:r.mediaType,userId:p,ssrc:l,replaceMsid:f,meid:(null==r?void 0:r.nmsid)&&(null==r?void 0:r.meid)}})),switchstream:!1,capabilityVersion:1},[2,d]}}))}))}function ps(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o,a,c,u;return s(this,(function(s){switch(s.label){case 0:return n=r.peer,i=r.store,r.service,o=Ne.getMemo(),a=o.myFirstPublishResources||[],[4,n.createOffer(t,a)];case 1:return c=s.sent(),u={sdp:c,extend:JSON.stringify({resolutionInfo:n.getOutboundVideoInfo()}),preSubList:e.filter((function(e){var t=e.track.getTrackId(),r=Fi(t).identifier,n=i.getUserIdByMeid(r),o=i.getResourcesByUserId(n);if(!o)return!1;var a=o.filter((function(e){return t==="".concat(e.nmsid||e.msid,"_").concat(e.mediaType)})).length;return a})).map((function(e){var t,r=i.getPublishedResourceByTrackId(e.track.getTrackId()),n=e.subTiny?mo.TINY:mo.NORMAL,a=(null==r?void 0:r.uri)||"{}",s=JSON.parse(a),c=s.serverId,u=s.userTimestamp,l=s.ssrc,d=Fi(e.track.getTrackId()).identifier,p=i.getUserIdByMeid(d),_=null===(t=o.replacePreTrackIdMap)||void 0===t?void 0:t[e.track.getTrackId()],f=_&&Hi(Fi(_).identifier);return{simulcast:n,serverId:c,userTimestamp:u,msid:(null==r?void 0:r.nmsid)||(null==r?void 0:r.msid),mediaType:null==r?void 0:r.mediaType,userId:p,ssrc:l,replaceMsid:f,meid:(null==r?void 0:r.nmsid)&&(null==r?void 0:r.meid)}}))},[2,u]}}))}))}var _s=function(e,t,r,n){return a(void 0,void 0,void 0,(function(){var i,o,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:for(a in i=e.crtUserId,o=[],n)o.push(a);c=0,s.label=1;case 1:return c<o.length?(u=o[c])===i?[3,3]:(l=n[u]).length?(d=l.map((function(t){return e.getRemoteTrack(Vi(t))})),[4,new ls(d).execute(t,e,r)]):[3,3]:[3,4];case 2:s.sent(),s.label=3;case 3:return c++,[3,1];case 4:return[2]}}))}))};function fs(e,t,r,n,i){return a(this,void 0,void 0,(function(){var o,a,c,u,l,d,p,_,f,b,m,h,g,v,R,C,T,S,y,E;return s(this,(function(s){switch(s.label){case 0:for(o=r.logger,a=t.roomId,t.crtUserId,t.roomMode,c=[],u={},l={},d={},p={},_=io(e,a,o,i),f=Object.keys(_),b=t.getAllUserIds(),m=f.length-1;m>=0;m-=1)h=f[m],-1!==(g=b.indexOf(h))?(v=t.getResourcesByUserId(h),R=_[h],C=qi(v,R,!0),T=C.publishedList,S=C.modifiedList,y=C.unpublishedList,E=C.deviceChangedList,u[h]=Ki(T),l[h]=Ki(y),d[h]=Ki(S),p[h]=Ki(E),b.splice(g,1)):(c.push(h),u[h]=Ki(_[h]));return b.length&&b.forEach((function(e){t.removeResourcesByUserId(e)})),t.assignRoomData(_),b.length?[4,bs(b,r,t,n,i)]:[3,2];case 1:s.sent(),r.emit(Oa,b),s.label=2;case 2:return c.length&&r.emit(Ea,c),[4,_s(t,r,n,l)];case 3:return s.sent(),function(e,t,r){var n=t.logger;Object.keys(r).forEach((function(i){var o=r[i];if(0!==o.length){var a=o.map((function(t){var r=Vi(t),i=Fi(r),o=i.identifier,a=i.tag,s=i.mediaType,c=e.getUserIdByMeid(o),u=s===exports.RCMediaType.AUDIO_ONLY?new ma(n,a,c,o):new ha(n,a,c,o);return e.addRemoteTrack(u),u.__innerSetRemoteMuted(0===t.state),u.updateDeviceAvailable(t.code||exports.RCRTCStreamCode.RCRTCStreamCodeDefault),u}));t.emit(Ia,a)}}))}(t,r,u),function(e,t,r){Object.keys(r).forEach((function(n){r[n].forEach((function(r){var n=Vi(r),i=e.getRemoteTrack(n);i.__innerSetRemoteMuted(0===r.state),i.isAudioTrack()?t.emit(Pa,i):t.emit(Aa,i)}))}))}(t,r,d),function(e,t,r){Object.keys(r).forEach((function(n){var i=r[n];if(0!==i.length){var o=i.map((function(t){var r=Vi(t),n=e.getRemoteTrack(r);return n.updateDeviceAvailable(t.code||exports.RCRTCStreamCode.RCRTCStreamCodeDefault),{track:n,status:t.code}}));t.emit(ka,o)}}))}(t,r,p),[2]}}))}))}function bs(e,t,r,i,o){return a(this,void 0,void 0,(function(){var a,c,d,p;return s(this,(function(s){switch(s.label){case 0:return a=[],c=[],d=r.isMeetingMode,p=t.logger,e.forEach((function(e){a.push.apply(a,l([],u(r.getRemoteTracksByUserId(e)),!1)),c.push(e)})),a.length?(p.info(n.L_RES_UNPUB_UNSUBSCRIBE_O,void 0,o),d?[4,new xa(a).execute(t,r,i)]:[3,2]):[3,5];case 1:return s.sent(),[3,4];case 2:return[4,new us(a,o).execute(t,r,i)];case 3:s.sent(),s.label=4;case 4:a.forEach((function(e){return r.removeRemoteTrack(e.getTrackId())})),s.label=5;case 5:return c.length&&c.forEach((function(e){return r.removeResourcesByUserId(e)})),[2]}}))}))}var ms,hs=function(e,t,r){var n=e.split("\r\nm"),i=r===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=n.filter((function(e){return e.includes("=".concat(i))&&e.includes(t)}))[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},gs=function(e,t){var r=!1;return e.forEach((function(e){var n=t.findIndex((function(t){return t.track.getTrackId()===e.track.getTrackId()}));-1!==n?t.splice(n,1)[0].subTiny!==e.subTiny&&(r=!0):r=!0})),t.length&&(r=!0),r},vs=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.PARSE_USERSTATE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return oa.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealAddUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var o=e.getResourcesByUserId(i),a=null==o?void 0:o.every((function(e){return void 0===uo(e.uri).state}));o&&!a||(r.joined.push(i),t.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user joined"}),this.traceId)),e.setResourcesByUserId(i,o||[])}}),Object.defineProperty(t.prototype,"_dealReduceUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){t.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:i,msg:"user left"}),this.traceId),r.left.push(i)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o,a,c=this;return s(this,(function(s){switch(s.label){case 0:return n=e.logger,i={joined:[],left:[],upgrade:[],downgrade:[]},0===(o=this.msgContent.users).length?[2,{code:exports.RCRTCCode.SUCCESS,data:i}]:(o.forEach((function(e){var r=e.userId;0===Number(e.state)?c._dealAddUser(t,n,i,r):c._dealReduceUser(t,n,i,r)})),(a=l(l([],u(i.left),!1),u(i.downgrade),!1)).length?[4,bs(a,e,t,r,this.traceId)]:[3,2]);case 1:s.sent(),s.label=2;case 2:return[2,{code:exports.RCRTCCode.SUCCESS,data:i}]}}))}))}}),t}(pa),Rs=function(e){function t(t,r,n,i,o){var a=e.call(this)||this;return Object.defineProperty(a,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_deviceChangedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.PARSE_REMOTERES},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return oa.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealPublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var a,c,d,p,_,f,b,m,h,g,v,R=this;return s(this,(function(s){switch(s.label){case 0:return a=e.logger,c=e.reportMediaActionLogger,d=this.senderId,p=t.getResourcesByUserId(d)||[],_=this._nowResources.map(Vi),f=[],b=[],this._publishedList.forEach((function(e){var r=Vi(e),n=_.indexOf(r),i=Fi(r),o=i.identifier,s=i.tag,c=i.mediaType,u=t.getUserIdByMeid(o);n>-1?R._nowResources[n]=e:R._nowResources.push(e);var l=t.getRemoteTrack(r);l?f.push(l):(l=c===exports.RCMediaType.AUDIO_ONLY?new ma(a,s,u,o):new ha(a,s,u,o),t.addRemoteTrack(l),b.push(l)),l.__innerSetRemoteMuted(0===e.state),l.updateDeviceAvailable(e.code||exports.RCRTCStreamCode.RCRTCStreamCodeDefault)})),f.length?(t.setResourcesByUserId(d,p),m=f.map((function(e){return e.getTrackId()})),h=void 0,t.isMeetingMode?(g=t.getSubscribedList().map((function(e){return o({},e)})).filter((function(e){return!f.includes(e.track)&&e.track.isVideoTrack()})),[4,new Da(l(l([],u(f),!1),u(g),!1),!0).execute(e,t,r)]):[3,2]):[3,5];case 1:return h=s.sent(),[3,4];case 2:return a.info(n.L_PARSE_REMOTE_RES_COMMAND_P,JSON.stringify({exce:"UpdateSubscribeListCommand",list:f.map(ao)}),this.traceId),g=t.getSubscribedList().map((function(e){return o({},e)})).filter((function(e){return!f.includes(e.track)})),[4,new cs(l(l([],u(f),!1),u(g),!1),!0,this.traceId).execute(e,t,r)];case 3:h=s.sent(),s.label=4;case 4:(v=h.code)!==exports.RCRTCCode.SUCCESS&&a.error(n.L_RESUB_REPUB_RES_R,JSON.stringify({status:i.FAILED,trackIds:m,code:v}),this.traceId),s.label=5;case 5:return b.length>0&&e.emit(Ia,b),c.reportQualityRecvPubMsgData(this.sentTime,this.senderId),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o,a;return s(this,(function(s){switch(s.label){case 0:for(n=this._unpublishedList.map(Vi),i=this._nowResources.length-1;i>=0;i-=1)o=this._nowResources[i],n.includes(Vi(o))&&this._nowResources.splice(i,1);return a=this._unpublishedList.map((function(e){var r=Vi(e);return t.getRemoteTrack(r)})).filter((function(e){return e})),[4,new ls(a).execute(e,t,r)];case 1:return s.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModifiedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,n,i,o,a,u,l,d,p;return s(this,(function(s){r=this._nowResources.map(Vi);try{for(n=c(this._modifiedList),i=n.next();!i.done;i=n.next())o=i.value,a=Vi(o),u=r.indexOf(a),this._nowResources[u].state=o.state,(l=t.getRemoteTrack(a)).__innerSetRemoteMuted(0===o.state),l.isAudioTrack()?e.emit(Pa,l):e.emit(Aa,l)}catch(e){d={error:e}}finally{try{i&&!i.done&&(p=n.return)&&p.call(n)}finally{if(d)throw d.error}}return[2]}))}))}}),Object.defineProperty(t.prototype,"_dealDeviceChangedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,n,i,o,a,u,l,d,p,_;return s(this,(function(s){r=this._nowResources.map(Vi),n=[];try{for(i=c(this._deviceChangedList),o=i.next();!o.done;o=i.next())a=o.value,u=Vi(a),l=r.indexOf(u),this._nowResources[l].code=a.code,d=t.getRemoteTrack(u),n.push({track:d,status:a.code}),d.updateDeviceAvailable(a.code||exports.RCRTCStreamCode.RCRTCStreamCodeDefault)}catch(e){p={error:e}}finally{try{o&&!o.done&&(_=i.return)&&_.call(i)}finally{if(p)throw p.error}}return e.emit(ka,n),[2]}))}))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o,a,c,d,p,_,f=this;return s(this,(function(s){switch(s.label){case 0:if((n=this.msgContent.uris).forEach((function(e){t.setRelationshipMapBetweenUserIdAndMeid(Ji(e.nmsid||e.msid).identifier,f.senderId)})),this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],this._deviceChangedList=[],o=this.senderId,a=this.messageType,!t.getRemoteUserIds().includes(o))return[2,{code:exports.RCRTCCode.SUCCESS}];if(this._nowResources=t.getResourcesByUserId(o)||[],a===lo.TOTAL_CONTENT_RESOURCE)i=qi(this._nowResources,n),(c=this._publishedList).push.apply(c,l([],u(i.publishedList),!1)),(d=this._unpublishedList).push.apply(d,l([],u(i.unpublishedList),!1)),(p=this._modifiedList).push.apply(p,l([],u(i.modifiedList),!1)),(_=this._deviceChangedList).push.apply(_,l([],u(i.deviceChangedList),!1));return this._unpublishedList.length>0?[4,this._dealUnpublishList(e,t,r)]:[3,2];case 1:s.sent(),s.label=2;case 2:return this._publishedList.length>0?[4,this._dealPublishList(e,t,r)]:[3,4];case 3:s.sent(),s.label=4;case 4:return this._modifiedList.length>0?[4,this._dealModifiedList(e,t)]:[3,6];case 5:s.sent(),s.label=6;case 6:return this._deviceChangedList.length>0?[4,this._dealDeviceChangedList(e,t)]:[3,8];case 7:s.sent(),s.label=8;case 8:return t.setResourcesByUserId(o,this._nowResources),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(pa),Cs=function(t){function c(e,r,n){var i=t.call(this)||this;return Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),i}return r(c,t),Object.defineProperty(c.prototype,"kind",{get:function(){return ia.SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,c){return a(this,void 0,void 0,(function(){var a,u,l,d,p,_,f,b,m;return s(this,(function(s){return a=t.logger,u=t.polarisReport,d=(l=this).tracks,p=l.forceReq,e.validate("tracks",d,(function(){return e.isArray(d)&&d.length>0&&d.every((function(e){return e instanceof ba||e.track instanceof ba}))}),!0)?(a.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:d.map(ao),forceReq:p}),this.traceId),_=r.getSubscribedList().map((function(e){return o({},e)})),f=d.map((function(e){return e instanceof ba?{track:e}:e})),b=!1,m=[],f.forEach((function(e){var t=e.track.getTrackId();m.push(t);var r=_.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:_.push(e),b=!0)})),b||p?(u.sendR2(ra.SUBSCRIBE,ga.BEGIN,m),[2,new cs(_,!0,this.traceId,void 0,void 0,2).execute(t,r,c)]):(a.warn(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:i.SUCCEEDED,msg:"repeat subscribe"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}])):(a.error(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),c}(pa),Ts=function(t){function d(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return r(d,t),Object.defineProperty(d.prototype,"kind",{get:function(){return ia.PUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var i=e instanceof Ei?e:e.track;r._logger.debug(n.L_ABSTRACT_ROOM_PUBLISH_P,"remove pub failed track from peerconnection -> trackId: ".concat(i.getTrackId()),r._traceId),t.removeLocalTrackById(i.getTrackId())}))}}),Object.defineProperty(d.prototype,"_addLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){var i,o,a,u,l,d,p,_,f,b,m,h,g,v,R,C,T,S,y;return s(this,(function(s){switch(s.label){case 0:i=[],s.label=1;case 1:s.trys.push([1,11,12,13]),o=c(e),a=o.next(),s.label=2;case 2:if(a.done)return[3,10];if(u=a.value,d=(l=u instanceof Ei?{pubTiny:!1,track:u}:u).track,p=l.pubTiny,!d.isVideoTrack())return[3,8];if(!p||!/chrome/i.test($i.browser))return[3,7];_=void 0,s.label=3;case 3:return s.trys.push([3,5,,6]),_=d.__innerGetMediaStreamTrack().clone(),f=p.frameRate||exports.RCFrameRate.FPS_15,b=p.resolution||exports.RCResolution.W176_H144,m=Yi(b),h=m.width,g=m.height,v=Xi(f),[4,_.applyConstraints({width:h,height:g,frameRate:v})];case 4:return s.sent(),[3,6];case 5:return R=s.sent(),null==_||_.stop(),this._logger.warn(n.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(d.getTrackId(),", msg: ").concat(R.message),this._traceId),[3,10];case 6:return C=new Ii(this._logger,d.getTag(),d.getUserId(),d.getMeid(),_,!0),i.push(C),t.addLocalTrack(C),[3,8];case 7:null===(r=this._logger)||void 0===r||r.info(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({msg:"Non chrome does not support tiny track"}),this._traceId),s.label=8;case 8:t.addLocalTrack(d),s.label=9;case 9:return a=o.next(),[3,2];case 10:return[3,13];case 11:return T=s.sent(),S={error:T},[3,13];case 12:try{a&&!a.done&&(y=o.return)&&y.call(o)}finally{if(S)throw S.error}return[7];case 13:return[2,i]}}))}))}}),Object.defineProperty(d.prototype,"__publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,c){var d,p,_,f,b,m,h,g,v,R;return a(this,void 0,void 0,(function(){var a,C,T,S,y,E,O,I,L,P,A,w,k,N,D,M,x,U,j,B,V,F,J,H,G,K,q=this;return s(this,(function(s){switch(s.label){case 0:return a=Ne.getMemo(),C=e.peer,T=e.reportMediaActionLogger,S=t.roomId,y=[],r.forEach((function(e){var t=(e instanceof Ei?{track:e}:e).track;y.push(t)})),r.sort((function(e,t){return(e instanceof Ei?{track:e}:e).track.getBitrate().max-(t instanceof Ei?{track:t}:t).track.getBitrate().max})),C.getLocalTracks().length+function(e,t){var r=0;return e.forEach((function(e){var n=e instanceof Ei?e.getTrackId():e.track.getTrackId();t.getLocalTrack(n)||(e instanceof Ei?r++:e.pubTiny&&e.track.isVideoTrack()&&(r+=2))})),r}(r,C)>10?(null===(d=this._logger)||void 0===d||d.error(n.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(ao),msg:"publish track limit exceeded"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:y}]):(null===(p=this._logger)||void 0===p||p.info(n.L_ABSTRACT_ROOM_PUBLISH_P,"publish tracks -> roomId: ".concat(S,", tracks: ").concat(r.map(ao)),this._traceId),[4,this._addLocalTracks(r,C)]);case 1:return E=s.sent(),C.clearReTryExchangeTimer(),O=t.isMeetingMode?[]:t.getSubscribedList(),C.getLocalTracks().forEach((function(e){e.emit(Ei.__INNER_EVENT_SEND_CHANGE__,e,e.isPause())})),[4,ds(O,!1,e)];case 2:return I=s.sent(),Lo.formatSourceIdMapFromSdp(I.sdp.sdp,"publish"),L=null===(f=null===(_=uo(a.rtcConfig))||void 0===_?void 0:_.rtc)||void 0===f?void 0:f.config,P=null===(b=uo(null==L?void 0:L.exchangeSetting))||void 0===b?void 0:b.mode,A=P?ss(o(o({},I),{snui:0}),t.crtUserId):o(o({},I),{snui:0}),[4,new Va(A,this._traceId,!0,P).execute(e,t,c)];case 3:return w=s.sent(),y.forEach((function(e){var t=e.getTrackId();q._trackMediaMap[t]=w.data.qualityMsList||[]})),w.code!==exports.RCRTCCode.SUCCESS?(T.reportPubOrSubQualityData(Fa.PUB,this._actionStartTime,y,w.code,this._trackMediaMap),null===(m=this._logger)||void 0===m||m.error(n.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({status:i.FAILED,tracks:r.map(ao),code:w.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(r,C),[2,{code:w.code,tracks:y}]):(x=0,P?(J=null===(h=w.data)||void 0===h?void 0:h.data,k=J.sdp,N=J.code,D=J.msg,H=J.snui,x=void 0===H?0:H,M=Ja(k)):(G=null===(g=w.data)||void 0===g?void 0:g.data,k=G.sdp,N=G.resultCode,D=G.message,K=G.snui,x=void 0===K?0:K,M=k.sdp),a.snui=x,N!==exports.RCRTCCode.SUCCESS?(T.reportPubOrSubQualityData(Fa.PUB,this._actionStartTime,y,N,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:i.FAILED,trackIds:r.map(ao),code:N,msg:"exchange inner failed: ".concat(D)}),this._traceId),this._removePubFailedTracks(r,C),[2,{code:N,tracks:y}]):(T.setPubOrSubSuccessTime(Date.now()),[4,C.setRemoteAnswer(M,!0)]));case 4:return(U=s.sent())!==exports.RCRTCCode.SUCCESS?(T.reportPubOrSubQualityData(Fa.PUB,this._actionStartTime,y,U,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({status:i.FAILED,trackIds:r.map(ao),code:U,msg:"set remote answer error"}),this._traceId),[2,{code:U,tracks:y}]):(E.length&&this._updateTinyTrackIdSSRCMap(t,I.sdp.sdp,E),P?(B=null===(R=w.data)||void 0===R?void 0:R.data,V=[],F=C.getLocalTracks().filter((function(e){return e.isPublished()})),l(l([],u(y),!1),u(F),!1).forEach((function(e){var t,r=null===(t=a.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();V.push({mediaType:n,msid:e.getStreamId(),ssrc:Number(r||0),uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:Gi(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),j={code:w.code,data:{resultCode:N,message:D,"Request-Id":null==B?void 0:B["Request-Id"],clusterId:null==B?void 0:B.clusterId,publishList:V,roomId:"",sdp:{type:"answer",sdp:M},snui:B.snui},tracks:y}):j={code:w.code,data:null===(v=w.data)||void 0===v?void 0:v.data,tracks:y},[2,j])}}))}))}}),Object.defineProperty(d.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var n=hs(t,r.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(n),r.getTrackId())}))}}),Object.defineProperty(d.prototype,"_dealPublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,c){return a(this,void 0,void 0,(function(){var a,d,p,_,f,b,m,h,g,v,R,C,T,S,y;return s(this,(function(s){switch(s.label){case 0:return a=c.polarisReport,d=c.context,p=c.peer,_=c.reportMediaActionLogger,f=c.logger,b=r.crtUserId,m=r.roomId,h=r.getResourcesByUserId(b),g=l([],u(h),!1),v=t.tracks,t.code!==exports.RCRTCCode.SUCCESS?[2,{code:t.code}]:(R=t.data.publishList,R.map((function(e){return o(o({tag:Ji(e.nmsid||e.msid).tag,state:p.getLocalTrack(Vi(e)).isLocalMuted()?0:1},e),{ssrc:Number(e.ssrc||0),code:p.getLocalTrack(Vi(e)).getDeviceAvailable(!0)||exports.RCRTCStreamCode.RCRTCStreamCodeDefault})})).forEach((function(e){var t=oo(e,g),r=t.isInclude,n=t.index;r?g.splice(n,1,e):g.push(e)})),C=qi(h,g).publishedList,T=Date.now(),[4,d.setRTCTotalRes(m,Mi(g),lo.TOTAL_CONTENT_RESOURCE)]);case 1:return S=s.sent(),_.reportPubOrSubQualityData(Fa.PUB,this._actionStartTime,v,S,this._trackMediaMap,[{dur:Date.now()-T,cod:S}]),S!==e.ErrorCode.SUCCESS?(f.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:i.FAILED,code:S,msg:"send publish streams notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(r.setResourcesByUserId(b,g),y=C.map((function(e){return Vi(e)})),a.sendR2(ra.PUBLISH,ga.BEGIN,y),C.forEach((function(e){p.getLocalTrack("".concat(e.nmsid||e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(d.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,c,u,l,d=this;return s(this,(function(s){switch(s.label){case 0:return a=t.logger,c=t.peer,this._traceId=a.createTraceId(),this._logger=a,this._actionStartTime=Date.now(),u=this.tracks,e.validate("tracks",u,(function(){return e.isArray(u)&&u.length>0&&u.every((function(e){return e instanceof Ei||e.track instanceof Ei}))}),!0)?(a.info(n.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:u.map(ao)})),(u=u.filter((function(e){var t=(e instanceof Ei?{track:e}:e).track,r=t.isDestroyed();return r&&a.warn(n.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({msg:"track -> ".concat(t.getTrackId()," has beem destroyed")}),d._traceId),!r}))).length?(c.__reportR3R4ToPolaris(),c.clearReTryExchangeTimer(),[4,this.__publish(t,r,u,o)]):(a.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID}])):(a.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=s.sent(),[4,this._dealPublishRes(l,r,t)];case 2:return[2,s.sent()]}}))}))}}),d}(pa),Ss=function(t){function c(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return r(c,t),Object.defineProperty(c.prototype,"kind",{get:function(){return ia.UNPUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"__unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,c){var u,l,d;return a(this,void 0,void 0,(function(){var a,p,_,f,b,m,h,g,v,R,C,T,S,y,E,O,I,L,P,A,w,k,N,D,M=this;return s(this,(function(s){switch(s.label){case 0:return a=e.peer,p=e.polarisReport,_=e.logger,f=e.reportMediaActionLogger,b=Ne.getMemo(),m=c.map((function(e){return e.getTrackId()})),0===m.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})).length?[2,{code:exports.RCRTCCode.SUCCESS,tracks:c}]:(m.forEach((function(e){return a.removeLocalTrackById(e)})),p.sendR2(ra.PUBLISH,ga.END,m),a.clearReTryExchangeTimer(),[4,ds(t.getSubscribedList(),!1,e)]);case 1:return h=s.sent(),g=null===(l=null===(u=uo(b.rtcConfig))||void 0===u?void 0:u.rtc)||void 0===l?void 0:l.config,v=null===(d=uo(null==g?void 0:g.exchangeSetting))||void 0===d?void 0:d.mode,R=v?ss(o(o({},h),{snui:0}),t.crtUserId):o(o({},h),{snui:0}),[4,new Va(R,this._traceId,!0,v).execute(e,t,r)];case 2:return C=s.sent(),c.forEach((function(e){var t=e.getTrackId();M._trackMediaMap[t]=C.data.qualityMsList||[]})),C.code!==exports.RCRTCCode.SUCCESS?(f.reportPubOrSubQualityData(Fa.UNPUB,this._actionStartTime,c,C.code,this._trackMediaMap),_.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:i.FAILED,code:C.code,trackIds:c.map(ao),msg:"exchange failed"}),this._traceId),[2,{code:C.code,tracks:c}]):(O=0,v?(w=C.data.data,T=w.sdp,S=w.code,y=w.msg,k=w.snui,O=void 0===k?0:k,E=Ja(T)):(N=C.data.data,T=N.sdp,S=N.resultCode,y=N.message,D=N.snui,O=void 0===D?0:D,E=T.sdp),b.snui=O,S!==exports.RCRTCCode.SUCCESS?(f.reportPubOrSubQualityData(Fa.UNPUB,this._actionStartTime,c,S,this._trackMediaMap),_.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:i.FAILED,code:S,trackIds:c.map(ao),msg:"exchange inner failed: ".concat(y)}),this._traceId),[2,{code:S,tracks:c}]):(L=a.getLocalTracks().filter((function(e){return!e.isVideoTrack()||!e.__isTiny()})),v?(P=C.data.data,A=[],L.forEach((function(e){var t,r=null===(t=b.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();A.push({mediaType:n,msid:e.getStreamId(),ssrc:Number(r||0),uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:Gi(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),I={code:C.code,data:{resultCode:S,message:y,"Request-Id":null==P?void 0:P["Request-Id"],clusterId:null==P?void 0:P.clusterId,publishList:A,roomId:"",sdp:{type:"answer",sdp:E},snui:P.snui},tracks:c}):I={code:C.code,data:C.data.data,tracks:c},[2,I]))}}))}))}}),Object.defineProperty(c.prototype,"_dealUnpublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,c,d,p,_,f,b,m,h,g,v,R,C,T,S,y,E;return s(this,(function(s){switch(s.label){case 0:return a=t.context,c=t.logger,d=t.peer,p=t.reportMediaActionLogger,_=a.getCurrentId(),f=r.roomId,b=[],m=o.tracks,h=o.code,g=o.data,h!==exports.RCRTCCode.SUCCESS?(c.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:h,msg:"unpublish failed"}),this._traceId),[2,{code:h}]):g?(v=m.map((function(e){return e.getTrackId()})),R=v.map(r.getPublishedResourceByTrackId.bind(r)).filter((function(e){return!!e})),b.push.apply(b,l([],u(R),!1)),C=r.getResourcesByUserId(_),T=C.filter((function(e){return!b.includes(e)})),S=Date.now(),[4,a.setRTCTotalRes(f,Mi(T),lo.TOTAL_CONTENT_RESOURCE)]):(c.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:i.SUCCEEDED,msg:"unpublish list is empty "})),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return y=s.sent(),p.reportPubOrSubQualityData(Fa.UNPUB,this._actionStartTime,m,y,this._trackMediaMap,[{dur:Date.now()-S,cod:y}]),y!==e.ErrorCode.SUCCESS?(c.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:i.FAILED,code:y,msg:"send unpublish notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(c.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:i.SUCCEEDED,code:exports.RCRTCCode.SUCCESS,msg:"unpublish success",unPubResourceIds:v}),this._traceId),E=o.data.sdp,[4,d.setRemoteAnswer(E.sdp)]);case 2:return s.sent(),r.setResourcesByUserId(_,T),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(c.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,c,u,l;return s(this,(function(s){switch(s.label){case 0:return a=t.logger,this._actionStartTime=Date.now(),c=r.crtUserId,u=this.tracks,this._traceId=a.createTraceId(),e.validate("tracks",u,(function(){return u.every((function(e){return e.getUserId()===c&&e instanceof Ei}))}),!0)?(a.info(n.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:u.map(ao)})),[4,this.__unpublish(t,r,o,u)]):(a.error(n.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=s.sent(),[4,this._dealUnpublishRes(t,r,l)];case 2:return[2,s.sent()]}}))}))}}),c}(pa),ys=function(t){function d(e,r,n,i,o){var a=t.call(this)||this;return Object.defineProperty(a,"localTracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(a,"remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"isPre",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"isSpread",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(a,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),a}return r(d,t),Object.defineProperty(d.prototype,"kind",{get:function(){return ia.PUBLISH_AND_SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"__publishAndSubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,d,p){var _,f,b,m,h,g,v,R;return a(this,void 0,void 0,(function(){var a,C,T,S,y,E,O,I,L,P,A,w,k,N,D,M,x,U,j,B,V,F,J,H,G,K,q,W,z,Q,Y,Z,X,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,le,de,pe,_e,fe,be,me=this;return s(this,(function(s){switch(s.label){case 0:if(a=Ne.getMemo(),C=e.peer,T=e.logger,e.context,S=t.roomId,y=[],r.forEach((function(e){var r=(e instanceof Ei?{track:e}:e).track,n=zi(t.crtUserId);r.__updateInnerDataByMeid(n),y.push(r)})),r.sort((function(e,t){return(e instanceof Ei?{track:e}:e).track.getBitrate().max-(t instanceof Ei?{track:t}:t).track.getBitrate().max})),C.getLocalTracks().length>10)return T.error(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(ao),msg:"publish track limit exceeded"}),this.traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:y}];T.info(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,"publish tracks -> roomId: ".concat(S,", tracks: ").concat(r.map(ao)),this.traceId),E=[],s.label=1;case 1:s.trys.push([1,11,12,13]),O=c(r),I=O.next(),s.label=2;case 2:if(I.done)return[3,10];if(L=I.value,A=(P=L instanceof Ei?{pubTiny:!1,track:L}:L).track,w=P.pubTiny,A.isPublished())return[3,9];if(!A.isVideoTrack())return[3,8];if(!w||!/chrome/i.test($i.browser))return[3,7];k=void 0,s.label=3;case 3:return s.trys.push([3,5,,6]),k=A.__innerGetMediaStreamTrack().clone(),N=w.frameRate||exports.RCFrameRate.FPS_15,D=w.resolution||exports.RCResolution.W176_H144,M=Yi(D),x=M.width,U=M.height,j=Xi(N),[4,k.applyConstraints({width:x,height:U,frameRate:j})];case 4:return s.sent(),[3,6];case 5:return B=s.sent(),null==k||k.stop(),T.warn(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,"pubTiny failed -> id: ".concat(A.getTrackId(),", msg: ").concat(B.message),this.traceId),[3,10];case 6:return V=new Ii(T,A.getTag(),A.getUserId(),A.getMeid(),k,!0),E.push(V),C.addLocalTrack(V),[3,8];case 7:T.info(n.L_ABSTRACT_ROOM_PUBLISH_P,JSON.stringify({msg:"Non chrome does not support tiny track"}),this.traceId),s.label=8;case 8:C.addLocalTrack(A),s.label=9;case 9:return I=O.next(),[3,2];case 10:return[3,13];case 11:return F=s.sent(),le={error:F},[3,13];case 12:try{I&&!I.done&&(de=O.return)&&de.call(O)}finally{if(le)throw le.error}return[7];case 13:return C.clearReTryExchangeTimer(),t.getSubscribedList(),J=d.map((function(e){return e instanceof ba?{track:e}:o({},e)})),H={},J=J.filter((function(e){var r=e.track.getTrackId();return t.getRemoteTrack(r)?!H[r]&&(H[r]=!0,!0):(T.warn(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,"track cannot found in room -> trackId: ".concat(r),me.traceId),!1)})).map((function(e){return o({},e)})),C.updateSubRemoteTracks(J.map((function(e){return e.track}))),[4,ps(J,!1,e)];case 14:return G=s.sent(),K=t.getRemoteUserIds(),q=null===(_=t.getResourcesByUserId(K[0]))||void 0===_?void 0:_.every((function(e){return void 0===e.state})),this.isPre&&q?C.getLocalTracks().forEach((function(e){var t;C.disableSenderEncodingsByTrackId(null===(t=e.__innerGetMediaStreamTrack())||void 0===t?void 0:t.id)})):C.getLocalTracks().forEach((function(e){e.emit(Ei.__INNER_EVENT_SEND_CHANGE__,e,e.isPause())})),Lo.formatSourceIdMapFromSdp(G.sdp.sdp,"publish"),W=null===(b=null===(f=uo(a.rtcConfig))||void 0===f?void 0:f.rtc)||void 0===b?void 0:b.config,z=null===(m=uo(null==W?void 0:W.exchangeSetting))||void 0===m?void 0:m.mode,Q=z?ss(o(o({},G),{snui:0}),t.crtUserId):o(o({},G),{snui:0}),[4,new Va(Q,this.traceId,!0,z).execute(e,t,p)];case 15:if((Y=s.sent()).code!==exports.RCRTCCode.SUCCESS)return T.error(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:i.FAILED,publishTracks:r.map(ao),code:Y.code,msg:"exchange failed"}),this.traceId),this._removePubFailedTracks(r,C,t),[2,{code:Y.code,tracks:y}];if(te=0,z?(pe=null===(h=Y.data)||void 0===h?void 0:h.data,Z=pe.sdp,X=pe.code,$=pe.msg,_e=pe.snui,te=void 0===_e?0:_e,ee=Ja(Z)):(fe=null===(g=Y.data)||void 0===g?void 0:g.data,Z=fe.sdp,X=fe.resultCode,$=fe.message,be=fe.snui,te=void 0===be?0:be,ee=Z.sdp),a.snui=te,J.map((function(e){return e.track.getTrackId()})),X!==exports.RCRTCCode.SUCCESS)return T.error(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:i.FAILED,trackIds:r.map(ao),code:X,msg:"exchange inner failed: ".concat($)}),this.traceId),this._removePubFailedTracks(r,C,t),[2,{code:X,tracks:y}];for(ie in Lo.formatSourceIdMapFromSdp(ee,"subscribe"),re=t.getRemoteTracks(),ne=function(e){var t=d.some((function(t){return ao(t)===e}));re[e].__innerSetSubscribed(t),re[e].__innerSetPreSubscribed(!0);var r=d.some((function(t){return ao(t)===e&&t instanceof ba||t.subTiny}));re[e].isVideoTrack()&&re[e].__innerSetIsTinyTrack(r)},re)ne(ie);return t.resetSubscribedList(d.map((function(e){return e instanceof ba?{track:e}:e}))),[4,C.setRemoteAnswer(ee)];case 16:return(oe=s.sent())!==exports.RCRTCCode.SUCCESS?(T.error(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_P,JSON.stringify({status:i.FAILED,publishTrackIds:r.map(ao),subscribeTrackIds:d.map(ao),code:oe,msg:"set remote answer error"}),this.traceId),[2,{code:oe,tracks:y}]):(E.length&&this._updateTinyTrackIdSSRCMap(t,G.sdp.sdp,E),z?(se=null===(R=Y.data)||void 0===R?void 0:R.data,ce=[],ue=C.getLocalTracks().filter((function(e){return e.isPublished()})),l(l([],u(y),!1),u(ue),!1).forEach((function(e){var t,r=null===(t=a.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();ce.push({mediaType:n,msid:e.getStreamId(),ssrc:Number(r||0),uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:Gi(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),ae={code:Y.code,data:{resultCode:X,message:$,"Request-Id":null==se?void 0:se["Request-Id"],clusterId:null==se?void 0:se.clusterId,publishList:ce,roomId:"",sdp:{type:"answer",sdp:ee},snui:se.snui},tracks:y}):ae={code:Y.code,data:null===(v=Y.data)||void 0===v?void 0:v.data,tracks:y},[2,ae])}}))}))}}),Object.defineProperty(d.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var n=hs(t,r.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(n),r.getTrackId())}))}}),Object.defineProperty(d.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this;e.forEach((function(e){var r=e instanceof Ei?e:e.track;i._logger.debug(n.L_ABSTRACT_ROOM_PUBLISH_P,"remove pub failed track from peerconnection -> trackId: ".concat(r.getTrackId()),i.traceId),t.removeLocalTrackById(r.getTrackId())}))}}),Object.defineProperty(d.prototype,"_dealPubAndSubRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,c,d){return a(this,void 0,void 0,(function(){var a,p,_,f,b,m,h,g,v,R,C,T,S,y,E;return s(this,(function(s){switch(s.label){case 0:return a=c.peer,p=c.context,_=c.logger,f=c.polarisReport,b=r.crtUserId,m=r.roomId,h=[],g=r.getResourcesByUserId(b),v=l([],u(g),!1),t.code!==exports.RCRTCCode.SUCCESS?(R=t.tracks,h.push({code:t.code,tracks:R}),[2,{code:t.code}]):(C=t.data.publishList,C.map((function(e){return o(o({tag:Ji(e.nmsid||e.msid).tag,state:a.getLocalTrack(Vi(e)).isLocalMuted()?0:1},e),{code:a.getLocalTrack(Vi(e)).getDeviceAvailable(!0)||exports.RCRTCStreamCode.RCRTCStreamCodeDefault})})).forEach((function(e){var t=oo(e,v),r=t.isInclude,n=t.index;r?v.splice(n,1,e):v.push(e)})),T=qi(g,v).publishedList,d?[4,p.setRTCTotalRes(m,Mi(v),lo.TOTAL_CONTENT_RESOURCE)]:[3,2]);case 1:if((S=s.sent())!==e.ErrorCode.SUCCESS)return _.error(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:i.FAILED,code:S,msg:"send publish streams notification failed"}),this.traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}];s.label=2;case 2:return r.setResourcesByUserId(b,v),y=T.map((function(e){return Vi(e)})),f.sendR2(ra.PUBLISH,ga.BEGIN,y),T.forEach((function(e){a.getLocalTrack("".concat(e.nmsid||e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),_.info(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:i.SUCCEEDED,code:h.length?exports.RCRTCCode.SOME_TRACKS_PUBLISH_FAILED:exports.RCRTCCode.SUCCESS,pubSuccessTrackIds:y}),this.traceId),E={code:exports.RCRTCCode.SUCCESS},h.length&&(E.failedTracks=h,E.code=exports.RCRTCCode.REQUEST_FAILED),[2,E]}}))}))}}),Object.defineProperty(d.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,c,u,l,d,p,_=this;return s(this,(function(s){switch(s.label){case 0:return a=t.logger,u=(c=this).localTracks,l=c.remoteTracks,d=r.roomId,this._logger=a,a.info(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_T,JSON.stringify({localTrackIds:u.map(ao),remoteTrackIds:l.map(ao),roomId:d}),this.traceId),e.validate("tracks",u,(function(){return e.isArray(u)&&u.every((function(e){return e instanceof Ei||e.track instanceof Ei}))}),!0)?e.validate("tracks",l,(function(){return e.isArray(l)&&l.every((function(e){return e instanceof ba||e.track instanceof ba}))}),!0)?(u=u.filter((function(e){var t=(e instanceof Ei?{track:e}:e).track,r=t.isDestroyed();return r&&a.warn(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({msg:"localTracks -> ".concat(t.getTrackId()," has beem destroyed")}),_.traceId),!r})),[4,this.__publishAndSubscribe(t,r,u,l,o)]):(a.warn(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> remoteTracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(a.error(n.L_PUBLISH_AND_SUBSCRIBE_STREAMS_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> localTracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return p=s.sent(),[4,this._dealPubAndSubRes(p,r,t,this.isSpread)];case 2:return[2,s.sent()]}}))}))}}),d}(pa),Es=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.LOCAL_TRACK_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var r,o,a,u,l,d,p,_,f,b,m,h,g,v,R,C,T;return s(this,(function(s){r=e.logger,o=e.context,a=this.localTrack,u=a.getTrackId(),l=t.crtUserId,d=t.roomId,p=!a.isLocalMuted(),_=r.createTraceId(),r.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:p,trackId:this.localTrack.getTrackId()}),_),f=[{resourceId:u,enabled:p}],b=t.getResourcesByUserId(l),m=[],h=function(e){var t=Vi(e),r=f.findIndex((function(e){return e.resourceId===t}));if(r>=0){var n=f[r].enabled;return e.state=n?1:0,m.push(e),"break"}};try{for(g=c(b),v=g.next();!v.done&&(R=v.value,"break"!==h(R));v=g.next());}catch(e){C={error:e}}finally{try{v&&!v.done&&(T=g.return)&&T.call(g)}finally{if(C)throw C.error}}return t.retrySignalingMannger.push({name:da.Muted,execute:function(){return o.setRTCTotalRes(d,Mi(b),lo.TOTAL_CONTENT_RESOURCE)}}),r.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:i.SUCCEEDED}),_),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(pa),Os=function(t){function c(){return null!==t&&t.apply(this,arguments)||this}return r(c,t),Object.defineProperty(c.prototype,"kind",{get:function(){return ia.RETRY_EXCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"priority",{get:function(){return oa.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,c,u,l;return a(this,void 0,void 0,(function(){var a,d,p,_,f,b,m,h,g,v,R,C,T,S,y,E,O,I,L,P,A,w,k,N;return s(this,(function(s){switch(s.label){case 0:return a=e.logger,d=e.peer,p=e.context,_=Ne.getMemo(),f=a.createTraceId(),a.info(n.L_RETRY_EXCHANGE_COMMAND_T),b=p.getCurrentId(),[4,ds(t.isMeetingMode?[]:t.getSubscribedList(),!0,e)];case 1:return m=s.sent(),h=null===(c=null===(i=uo(_.rtcConfig))||void 0===i?void 0:i.rtc)||void 0===c?void 0:c.config,g=null===(u=uo(null==h?void 0:h.exchangeSetting))||void 0===u?void 0:u.mode,v=g?ss(o(o({},m),{snui:0}),t.crtUserId):o(o({},m),{snui:0}),[4,new Va(v,f,!1,g).execute(e,t,r)];case 2:return(R=s.sent()).code!==exports.RCRTCCode.SUCCESS?[2,{code:R.code}]:(y=0,g?(A=R.data.data,C=A.sdp,T=A.code,w=A.snui,y=void 0===w?0:w,S=Ja(C)):(k=R.data.data,C=k.sdp,T=k.resultCode,N=k.snui,y=void 0===N?0:N,S=C.sdp),_.snui=y,T!==exports.RCRTCCode.SUCCESS?[2,{code:T}]:(d.clearReTryExchangeTimer(),[4,d.setRemoteAnswer(S)]));case 3:return(E=s.sent())!==exports.RCRTCCode.SUCCESS?[2,{code:E}]:(O=(null===(l=R.data.data)||void 0===l?void 0:l.publishList)||[],g&&d.getLocalTracks().filter((function(e){return e.isPublished()})).forEach((function(e){var t,r=null===(t=_.trackIdToSsrc)||void 0===t?void 0:t[e.getTrackId()],n=e.isAudioTrack()?0:1,i=e.getMeid(),o=e.getTag();O.push({mediaType:n,msid:e.getStreamId(),ssrc:Number(r||0),uri:JSON.stringify({meid:i,ssrc:Number(r),mediaType:n,tag:o,userId:e.getUserId(),resourceId:Gi(i,o,n)}),nmsid:"".concat(i,"_").concat(o),meid:i})})),I=this._diffPublishListChange(O,t,d,b,g),L=I.plus,P=I.minus,L.length||P.length?[4,this._spreadPublishListUri(e,b,f)]:[3,5]);case 4:s.sent(),s.label=5;case 5:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(c.prototype,"_diffPublishListChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){void 0===i&&(i=!1);var a=t.getResourcesByUserId(n),s=JSON.parse(JSON.stringify(a));e.forEach((function(e){var t,n=e.mediaType,i=e.msid,a=s.findIndex((function(e){var t=e.mediaType,r=e.msid;return n===t&&i===r}));if(-1===a){var c=o(o({tag:i.split("_").pop(),state:(null===(t=r.getLocalTrack(Vi(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e),{code:r.getLocalTrack(Vi(e)).getDeviceAvailable(!0)||exports.RCRTCStreamCode.RCRTCStreamCodeDefault});s.push(c)}else s[a].uri=e.uri}));var c=qi(a,s,!0,i),u=c.publishedList,l=c.unpublishedList;return t.setResourcesByUserId(n,s),{plus:u,minus:l}}}),Object.defineProperty(c.prototype,"_spreadPublishListUri",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,c,u,l;return s(this,(function(s){switch(s.label){case 0:return a=t.store,c=t.logger,u=t.context,l=a.getResourcesByUserId(r),c.info(n.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({allPublishList:l}),o),[4,u.setRTCTotalRes(a.roomId,Mi(l),lo.TOTAL_CONTENT_RESOURCE)];case 1:return s.sent()===e.ErrorCode.SUCCESS?c.info(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(i.SUCCEEDED),o):c.error(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(i.FAILED),o),[2]}}))}))}}),c}(pa);!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(ms||(ms={}));var Is,Ls=function(t){function o(e,r,n,i){var o=t.call(this)||this;return Object.defineProperty(o,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_context",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(o,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:i}),o}return r(o,t),Object.defineProperty(o.prototype,"kind",{get:function(){return ia.PULL_RTCROOM_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,u,l,d,p,_,f,b,m,h,g,v,R,C,T,S,y,E,O,I,L;return s(this,(function(s){switch(s.label){case 0:return a=t.logger,u=r.getRoomStatusVersion(),a.info(n.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:u}),this._traceId),this._targetPullVersion&&this._targetPullVersion<=u?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:i.SUCCEEDED,msg:"the roomData has been pulled",localVersion:u,targetPullVersion:this._targetPullVersion}),this._traceId),[2,{code:e.ErrorCode.SUCCESS}]):[4,this._context.pullRTCRoomStatus(this._roomId,u)];case 1:return l=s.sent(),d=l.code,p=l.data,d!==e.ErrorCode.SUCCESS?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:i.FAILED,code:d}),this._traceId),[2,{code:d}]):(f=(_=p).bFullStatus,b=_.version,m=_.usersData,h=_.roomStatus,a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:f,version:so(b),usersData:m,roomStatus:h}),this._traceId),r.setRoomStatusVersion(b),f?(g=function(e){var t={users:{}};return e.forEach((function(e){var r,n=e.userId,i=e.userData;t.users[n]={};var o=null===(r=i.filter((function(e){return"uris"===e.key}))[0])||void 0===r?void 0:r.value;t.users[n]={uris:o}})),{urisData:t}}(m).urisData,[4,fs(g,r,t,o,this._traceId)]):[3,3]);case 2:return s.sent(),[2,{code:d}];case 3:s.trys.push([3,10,11,12]),v=c(h),R=v.next(),s.label=4;case 4:return R.done?[3,9]:(C=R.value).event!==ms.RESOURCECHANGE?[3,6]:(T=function(e){var t,r=e.userId,n=e.userData,i=function(e){return e.some((function(e){return"uris"===e.key}))}(n);if(i){var o=null===(t=n.filter((function(e){return"uris"===e.key}))[0])||void 0===t?void 0:t.value;return{userId:r,content:{uris:o?JSON.parse(o):[]}}}}(C),T?(y=T.content,(S=T.userId)===r.crtUserId?[3,8]:(a.info(n.L_PULL_ROOM_STATUS_P,JSON.stringify(y),this._traceId),[4,new Rs(y,lo.TOTAL_CONTENT_RESOURCE,S,this._traceId).execute(t,r,o)])):[3,8]);case 5:return s.sent(),[3,8];case 6:return y=function(e){var t,r=e.userId,n=e.userData,i=e.event,o=e.switchRoleType;return{users:[{userId:r,extra:null===(t=n.filter((function(e){return"extra"===e.key}))[0])||void 0===t?void 0:t.value,state:i,switchRoleType:o}]}}(C),[4,new vs(y,this._traceId).execute(t,r,o)];case 7:E=s.sent().data,t.emit(wa,E),s.label=8;case 8:return R=v.next(),[3,4];case 9:return[3,12];case 10:return O=s.sent(),I={error:O},[3,12];case 11:try{R&&!R.done&&(L=v.return)&&L.call(v)}finally{if(I)throw I.error}return[7];case 12:return[2,{code:d}]}}))}))}}),o}(pa),Ps=function(t){function o(){return t.call(this)||this}return r(o,t),Object.defineProperty(o.prototype,"kind",{get:function(){return ia.ON_SIGNAL_RECONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"priority",{get:function(){return oa.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return a(this,void 0,void 0,(function(){var o,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:return o=t.logger,a=t.peer,c=t.context,u=r.roomId,l=r.roomMode,d=o.createTraceId(),o.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,d),"closed"===a.getRTCPeerConn().connectionState?(o.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",d),t.emit(ya),[2,{code:exports.RCRTCCode.SUCCESS}]):[4,c.rtcPing(u,l)];case 1:return s.sent().code,[4,this._joinRoom(t,r,i,d)];case 2:return s.sent()!==e.ErrorCode.SUCCESS?[3,4]:[4,this._restoreMediaServer(t,r,i)];case 3:s.sent(),s.label=4;case 4:return[3,7];case 5:return[4,new Ls(u,d,c).execute(t,r,i)];case 6:s.sent(),s.label=7;case 7:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(o.prototype,"_joinRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o,c){return a(this,void 0,void 0,(function(){var a,u,l,d,p;return s(this,(function(s){switch(s.label){case 0:return a=t.context,u=t.logger,[4,a.joinRTCRoom(r.roomId,r.roomMode)];case 1:return l=s.sent(),d=l.code,p=l.data,d!==e.ErrorCode.SUCCESS?(u.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:i.FAILED,code:d,msg:"im reconnect joinRTCRoom failed"}),c),[2]):p?[4,fs(p,r,t,o,c)]:(u.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:i.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),c),[2]);case 2:return s.sent(),u.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:i.SUCCEEDED,roomData:p}),c),[2,d]}}))}))}}),Object.defineProperty(o.prototype,"_restoreMediaServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i;return s(this,(function(o){switch(o.label){case 0:return n=e.peer.getLocalTracks(),i=Object.values(t.getRemoteTracks()).filter((function(e){return!!e.isSubscribed()})),n.length?[4,new Ts(n).execute(e,t,r)]:[3,2];case 1:o.sent(),o.label=2;case 2:return n.length||!i.length?[3,4]:[4,new Cs(i,!0).execute(e,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),o}(pa);!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(Is||(Is={}));var As,ws,ks,Ns=function(e){function t(t,r){var n=e.call(this)||this;return Object.defineProperty(n,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"status",{enumerable:!0,configurable:!0,writable:!0,value:r}),n}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.LOCAL_TRACK_DEVICE_STATUS_CHANGE_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var r,i,o,a,u,l,d,p,_,f,b,m,h,g,v,R;return s(this,(function(s){r=e.logger,i=e.context,o=this.localTrack,a=o.getTrackId(),u=t.crtUserId,l=t.roomId,d=o.getDeviceAvailable(!0),p=r.createTraceId(),r.info(n.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_T,JSON.stringify({status:d,trackId:this.localTrack.getTrackId()}),p),_=t.getResourcesByUserId(u),f=[];try{for(b=c(_),m=b.next();!m.done;m=b.next())if(h=m.value,g=Vi(h),a===g){h.code=d,f.push(h);break}}catch(e){v={error:e}}finally{try{m&&!m.done&&(R=b.return)&&R.call(b)}finally{if(v)throw v.error}}return t.retrySignalingMannger.push({name:da.Muted,execute:function(){return i.setRTCTotalRes(l,Mi(_),lo.TOTAL_CONTENT_RESOURCE)}}),r.info(n.L_LOCAL_TRACK_DEVICE_CHANGE_SPREAD_R,void 0,p),[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(pa),Ds=1,Ms=5,xs=function(){function e(e,t,r,i){var a=this;Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_baseReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_networkReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pubOrSubSuccessTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_peerCStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reportQualityJoinRoomData",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t,r,i){a._baseReportData=Object.assign(a._baseReportData,{snid:i});var s=o(o(o({},a._baseReportData),a._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:r});a._logger.__statistics(n.L_QS_JOIN_ROOM_S,JSON.stringify(s))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}}return Object.defineProperty(e.prototype,"reportQualityKickedData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=o(o(o({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===exports.RCKickReason.OTHER_KICK?Ms:Ds});this._logger.__statistics(n.L_QS_KICKED_S,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,a,s){var c=this;r.forEach((function(r){var u,l,d=r instanceof Ei||r instanceof ba?r:r.track,p=d.getTrackId(),_=Fi(p).mediaType,f=!1;f=d instanceof Ei?!!d.isVideoTrack()&&(null===(l=(u=d).__isTiny)||void 0===l?void 0:l.call(u)):r.subTiny||!1;var b=o(o(o({},c._baseReportData),c._networkReportData),{resid:p,mtp:_,smct:f?mo.TINY:mo.NORMAL,stp:"Rongcloud"!==d.getTag()?1:0,cod:i,msas:a?a[p]:[],sigs:s,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":c._logger.__statistics(n.L_QS_PUBLISH_S,JSON.stringify(b));break;case"unpub":c._logger.__statistics(n.L_QS_UNPUBLISH_S,JSON.stringify(b));break;case"sub":c._logger.__statistics(n.L_QS_SUBSCRIBE_S,JSON.stringify(b));break;case"unsub":c._logger.__statistics(n.L_QS_UNSUBSCRIBE_S,JSON.stringify(b))}}))}}),Object.defineProperty(e.prototype,"reportQualityRecvPubMsgData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=o(o(o({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(n.L_QS_RECV_PUB_MSG_S,JSON.stringify(r))}}),Object.defineProperty(e.prototype,"setPubOrSubSuccessTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pubOrSubSuccessTime=e}}),Object.defineProperty(e.prototype,"reportIceFirstConnectData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=o(o(o({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),r="pub"===e?n.L_QS_PUB_ICE_STATUS_S:n.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(r,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"recordQualityIceStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this._peerCStatus||{},a=i.status,s=i.time;if(s){var c=e.IP,u=e.port,l=e.networkType,d=e.remoteIP,p=e.remotePort,_=o(o(o({},this._baseReportData),this._networkReportData),{dur:r-s,time:r,pices:ta[a],ices:ta[t],rcdts:[{ip:"".concat(d,":").concat(p)}],lcdts:[{ip:"".concat(c,":").concat(u),nttp:l}],cncdts:[]});this._logger.__statistics(n.L_QS_ICE_STATUS_S,JSON.stringify(_)),this._peerCStatus={status:t,time:r}}else this._peerCStatus={status:t,time:r}}}),e}(),Us="evt-leave",js=function(t){function o(e,r,i,o,c,u,l,d,p,_,f){void 0===p&&(p=ei()),void 0===_&&(_=!1);var b=t.call(this)||this;Object.defineProperty(b,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(b,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(b,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(b,"_service",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(b,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(b,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:p}),Object.defineProperty(b,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_trackSentTimer",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(b,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(b,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var m=b._logger=b._context.logger;b._reportMediaActionLogger=new xs(m,b._roomId,b._clientSessionId,b._context.getCurrentId()),b._polarisReport=new ua(b._context,b._runtime,b._roomId,b);var h=b._context.getCurrentId(),g=new Ca(m,p,b._context.getAppkey(),i,h,o,l,d,!1,f),v=b._peerConnection=new ea(m,b._reTryExchange.bind(b),h,g,b._polarisReport,_);b._setPeerConnectionListener();var R=b._executeCtx=new Na(m,b._service,e,r,v,g,b._polarisReport,b._reportMediaActionLogger);return b.setCommandEventListener(),b._invoker=new fa(R,g),b._store=b._invoker.store,b._audioLevelReport=new la(b._store,v),v.on(ea.__INNER_AUDIOLEVEL_CHANGE__,b._audioLevelReport.audioLevelReport,b._audioLevelReport),b._pinger=new ho(b._context,b._roomId,o,b._initOptions.pingGap),b._pinger.onFailed=b.__kickoff.bind(b),b._pinger.onPingResult=b._handlePingResult.bind(b),b._context.registerRTCSignalListener((function(e){return a(b,void 0,void 0,(function(){var t,r,i,o,a;return s(this,(function(s){if(t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,o=t.roomId,a=m.createTraceId(),this._invoker.isDestroyed())return m.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:r,roomId:o})),[2];if(2===i){if(o!==this._roomId)return[2];m.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,r)}return[2]}))}))})),b}return r(o,t),Object.defineProperty(o.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(ea.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(Ei.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(Ei.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(ea.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(ea.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)}))}}),Object.defineProperty(o.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(ya,this._rtcpeerClosed,this),e.on(Ea,this._callAppListener.bind(this,"onUserJoin"),this),e.on(Oa,this._callAppListener.bind(this,"onUserLeave"),this),e.on(Ia,this._onTrackPublish,this),e.on(La,this._onTrackUnpublish,this),e.on(Pa,this._onAudioMuteChange,this),e.on(Aa,this._onVideoMuteChange,this),e.on(wa,this._dealUserAppListener,this),e.on(ka,this._onTrackDeviceStatusChange,this)}}),Object.defineProperty(o.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new Ls(e,t,this._context,r))];case 1:return n.sent(),[2]}}))}))}}),Object.defineProperty(o.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===e&&(e=exports.RTCMode.RTC),a(this,void 0,void 0,(function(){var o,a,c;return s(this,(function(s){switch(s.label){case 0:return[4,this._invoker.push(new Sa(this._roomId,e,t,r,n,i))];case 1:return o=s.sent(),a=o.code,c=o.data,a!==exports.RCRTCCode.SUCCESS?[2,{code:a}]:(this._initWithRoomData(c.offlineKickTime),[2,{code:a,data:c}])}}))}))}}),Object.defineProperty(o.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}}),Object.defineProperty(o.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e===exports.RCRTCPingResult.SUCCESS){var r=this._store.getRoomStatusVersion(),i=String(t).length-String(r).length;if(i<0?t&&(t*=Math.pow(10,i)):r&&(r*=Math.pow(10,i)),t>r){var o=this._logger.createTraceId();this._logger.info(n.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),o),this._startPullRTCRoomStatus(this._roomId,o,t)}}this._callAppListener("onPing",e)}}),Object.defineProperty(o.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._logger.warn(n.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),e.assert("max",t,(function(t){return e.isNumber(t)&&t>Math.max(r||1,200)}),!0),e.assert("min",r,(function(r){return e.isNumber(r)&&r>=1&&(!e.isNumber(t)||r<t)}),!0),e.assert("start",i,(function(n){return e.isNumber(n)&&n>r&&n<=t})),this._peerConnection.setBitrate(t,r,i)}}),Object.defineProperty(o.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,o=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=this._store.getRemoteTrack(o);a?a.isReady()?a.__innerSetMediaStreamTrack(r):(a.__innerSetMediaStreamTrack(r),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackReady",trackId:a.getTrackId()})),this._callAppListener("onTrackReady",a)):this._logger.warn(n.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(o.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];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,l([],u(r),!1))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(o.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(o.prototype,"_onTrackDeviceStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackDeviceStatusChange",tracks:null==e?void 0:e.map((function(e){var t;return{trackId:null===(t=null==e?void 0:e.track)||void 0===t?void 0:t.getTrackId(),status:null==e?void 0:e.status}}))}))}}),Object.defineProperty(o.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(e.conversationType,r===this._roomId){this._logger.info(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var o=e.content;switch(e.messageType){case lo.KICK:this.__kickoff(!0,o);break;case lo.STATE:this._stateHandle(o,t);break;case lo.MODIFY:case lo.PUBLISH:case lo.UNPUBLISH:case lo.TOTAL_CONTENT_RESOURCE:this._resourceHandle(o,e.messageType,e.senderUserId,e.sentTime,t);break;case lo.ROOM_NOTIFY:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case lo.USER_NOTIFY:this._logger.warn(n.L_OLD_DAILY_RECORD_O,"TODO: ".concat(lo.USER_NOTIFY));break;case lo.PK_INVITE:case lo.PK_CANCEL_INVITE:case lo.PK_INVITE_TIMEOUT:case lo.PK_INVITE_ANSWER:case lo.PK_END:case lo.OTHER_ROOM_OFFLINE:default:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,o,e.senderUserId,e.messageUId)}}else this._logger.warn(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:i.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(o.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,o,a=this;return s(this,(function(s){return this._invoker.isDestroyed()||(this._logger.warn(n.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(Us),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===a._context.getCurrentId()&&(o=e.type,r=e.kickExtra,a._reportMediaActionLogger.reportQualityKickedData(o))})),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onKickOff",byServer:e,kickType:o,kickExtra:r})),this._callAppListener("onKickOff",e,o,r)),[2]}))}))}}),Object.defineProperty(o.prototype,"mockKickOff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.__kickoff(e,{users:[{userId:this.getCrtUserId(),type:t}]})}}),Object.defineProperty(o.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(Us),this._leaveHandle(!0),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(o.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return a(this,void 0,void 0,(function(){var o;return s(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new Rs(e,t,r,i,n)),[2]}))}))}}),Object.defineProperty(o.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(o.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,n,i;return s(this,(function(o){switch(o.label){case 0:return[4,this._invoker.push(new vs(e,t))];case 1:return r=o.sent(),n=r.code,i=r.data,n===exports.RCRTCCode.SUCCESS&&this._dealUserAppListener(i),[2]}}))}))}}),Object.defineProperty(o.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.left,o=e.joined,a=Ne.getMemo(),s=l([],u(o),!1),c=l([],u(r),!1);if(s.length>0){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onUserJoin",allJoined:s}));var d=a.crtRoom,p=null==d?void 0:d.getRemoteUserIds();if(0!==(null==p?void 0:p.length)){var _=null==d?void 0:d.getLocalTracks();null==_||_.forEach((function(e){var r;t._peerConnection.enableSenderEncodingsByTrackId(null===(r=e.__innerGetMediaStreamTrack())||void 0===r?void 0:r.id)}))}this._callAppListener("onUserJoin",s)}c.length>0&&(c.length&&this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onUserLeave",allLeft:c})),this._callAppListener("onUserLeave",c))}}),Object.defineProperty(o.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(o.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(o.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(o.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,l([],u(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(o.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(o.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(o.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return o=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:t,content:r}),o),[4,this._context.sendMessage(e.ConversationType.RTC_ROOM,this._roomId,{messageType:t,content:r,isStatusMessage:!0})];case 1:return(a=s.sent().code)!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:i.FAILED,code:a}),o),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:i.SUCCEEDED,name:t,content:r}),o),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(o.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o,c){return void 0===c&&(c=!1),a(this,void 0,void 0,(function(){var a,u;return s(this,(function(s){switch(s.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:t,value:r,message:o,isInner:c}),a),[4,this._context.setRTCData(this._roomId,t,r,c,Is.ROOM,o)];case 1:return(u=s.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.FAILED,code:u}),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.SUCCEEDED,roomId:this._roomId,key:t,value:r,message:o,isInner:c}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(o.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return void 0===o&&(o=!1),a(this,void 0,void 0,(function(){var a,c;return s(this,(function(s){switch(s.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,message:r,isInner:o}),a),[4,this._context.removeRTCData(this._roomId,t,o,Is.ROOM,r)];case 1:return(c=s.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.FAILED,code:c}),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.SUCCEEDED,roomId:this._roomId,keys:t,message:r,isInner:o}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(o.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return void 0===t&&(t=[]),void 0===r&&(r=!1),a(this,void 0,void 0,(function(){var o,a,c,u;return s(this,(function(s){switch(s.label){case 0:return o=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,isInner:r}),o),[4,this._context.getRTCData(this._roomId,t,r,Is.ROOM)];case 1:return a=s.sent(),c=a.code,u=a.data,c!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(c),o),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.SUCCEEDED,data:u}),o),[2,{code:exports.RCRTCCode.SUCCESS,data:u}])}}))}))}}),Object.defineProperty(o.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Is.PERSON,r)}}),Object.defineProperty(o.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Is.PERSON,t)}}),Object.defineProperty(o.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,Is.PERSON)}}),Object.defineProperty(o.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(o.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(o.prototype,"__destroyMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._leaveHandleMock()}}),Object.defineProperty(o.prototype,"_muteRemoteTracksBeforeQuit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach((function(e){return e.mute()}))}}),Object.defineProperty(o.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this._invoker.isDestroyed()?[2]:(Ne.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),e?[4,this._context.quitRTCRoom(this._roomId)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())];case 3:return t.sent(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(o.prototype,"_leaveHandleMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return this._invoker.isDestroyed()?[2]:(Ne.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())]);case 1:return e.sent(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(o.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.off(Ei.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Ei.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(Ei.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(Ei.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),e.removeAllLocalTrack(),e.clear(),e.destroy()}}),Object.defineProperty(o.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof Ii&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(o.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return s(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new Es(e))];case 1:return r=n.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(o.prototype,"_onLocalTrackDeviceStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._invoker.push(new Ns(e,t))}}),Object.defineProperty(o.prototype,"_onLocalTrackSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i=this,o=null===(r=e.__innerGetMediaStreamTrack())||void 0===r?void 0:r.id;o&&clearTimeout(this._trackSentTimer[o]);var a=this._context.getNaviInfo(),s=(null==a?void 0:a.pauseVideoDelayMs)||-1;-1!==s&&o&&(t?this._trackSentTimer[o]=setTimeout((function(){i._logger.info(n.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!0})),i._peerConnection.disableSenderEncodingsByTrackId(o)}),s):(this._logger.info(n.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!1})),this._peerConnection.enableSenderEncodingsByTrackId(o)))}}),Object.defineProperty(o.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._invoker.push(new Ts(e))]}))}))}}),Object.defineProperty(o.prototype,"publishAndSubscribeStreams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!0),a(this,void 0,void 0,(function(){return s(this,(function(i){return[2,this._invoker.push(new ys(e,t,void 0,r,n))]}))}))}}),Object.defineProperty(o.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new Os)}}),Object.defineProperty(o.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._invoker.push(new Ss(e))]}))}))}}),Object.defineProperty(o.prototype,"_getResourceById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getPublishedResourceByTrackId(e)}}),Object.defineProperty(o.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=Fi(e).identifier,n=this._store.getUserIdByMeid(r);return!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find((function(t){return Vi(t)===e})))}}),Object.defineProperty(o.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._invoker.push(new Cs(e,void 0,void 0))]}))}))}}),Object.defineProperty(o.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){return t=this._logger.createTraceId(),this._logger.info(n.L_APP_CALL_UNSUBSCRIBE_O,void 0,t),[2,this._invoker.push(new us(e,t))]}))}))}}),Object.defineProperty(o.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t=!0),a(this,void 0,void 0,(function(){return s(this,(function(r){return[2,this._invoker.push(new cs(e,t,this._logger.createTraceId(),void 0,void 0,2))]}))}))}}),Object.defineProperty(o.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(o.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(o.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(o.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(o.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;null===(r=null===(t=this._context)||void 0===t?void 0:t.logger)||void 0===r||r.info(n.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,listener:e&&Object.keys(e)})),this._peerConnection.registerReportListener(e)}}),Object.defineProperty(o.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,o;null===(o=null===(r=this._context)||void 0===r?void 0:r.logger)||void 0===o||o.info(n.L_ABSTRACT_ROOM_AUDIO_LEVEL_O,JSON.stringify({status:i.SUCCEEDED,handler:null==e?void 0:e.name,gap:t})),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(o.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._invoker.push(new Ps)}}),Object.defineProperty(o.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(o.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(o.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),o}(e.EventEmitter),Bs=function(e){function t(t,r,n,i,o,a,s,c){return void 0===a&&(a=exports.RTCMode.RTC),void 0===s&&(s=!1),void 0===c&&(c=!1),e.call(this,t,r,n,a,i,o,!1,!1,ei(),s,c)||this}return r(t,e),t}(js),Vs=function(e){function t(t,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var a=e.call(this)||this;return Object.defineProperty(a,"list",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"tryCount",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"timestamp",{enumerable:!0,configurable:!0,writable:!0,value:o}),a.tryCount>0&&a.logger.warn(n.L_RETRY_SUB_AUDIO_O,JSON.stringify({list:a.list,tryCount:a.tryCount,version:a.timestamp})),a}return r(t,e),Object.defineProperty(t.prototype,"priority",{get:function(){return oa.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.MeetingAudioSubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return a(this,void 0,void 0,(function(){var i,o,a,c,u,l,d,p,_,f=this;return s(this,(function(s){switch(s.label){case 0:for(e.logger,i=e.subPeer,o=r.crtUserId,a=this.list.length-1;a>=0;a-=1)c=Ji(this.list[a].mslabel).identifier,r.getUserIdByMeid(c)===o&&this.list.splice(a,1);return u=[],l=[],d=[],this.list.forEach((function(e){var t="".concat(e.mslabel,"_0"),n=r.getRemoteTrack(t);n?(l.push(e),d.push(n)):u.push(e)})),r.meetingAudioSubCommandStamp>this.timestamp?[2,{code:exports.RCRTCCode.SUCCESS}]:(u.length&&this.tryCount<10&&setTimeout((function(){n.push(new t(u,f.logger,f.tryCount+1,f.timestamp))}),100+150*this.tryCount),0===l.length?[2,{code:exports.RCRTCCode.SUCCESS}]:[4,i.addAudioSubList(l)]);case 1:return p=s.sent(),_=r.getSubscribedList().slice(),d.forEach((function(e){e.__innerSetSubscribed(!0),_.every((function(t){return t.track.getTrackId()!==e.getTrackId()}))&&_.push({track:e})})),r.resetSubscribedList(_),[2,{code:p}]}}))}))}}),t}(pa),Fs=function(t){function o(e,r,n,i,o){var a=t.call(this)||this;return Object.defineProperty(a,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(a,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:exports.RTCMode.RTC}),a}return r(o,t),Object.defineProperty(o.prototype,"kind",{get:function(){return ia.MeetingJoinRoomCommand},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){var o=this;if(t.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(t.getNaviInfo(),!e.validate("roomId",this.roomId,e.notEmptyString,!0))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("roomType",this.roomType,(function(e){return void 0!==exports.RTCMode[e]})))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("outerUserDatas",this.outerUserDatas,e.isObject,!1))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every((function(t){return e.validate("outerUserDatas.".concat(t),o.outerUserDatas[t],e.isString,!0)})))return r.error(n,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}}),Object.defineProperty(o.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return a(this,void 0,void 0,(function(){var a,c,d,p,_,f,b,m,h,g,v,R,C,T,S,y,E,O;return s(this,(function(s){switch(s.label){case 0:return a=Date.now(),c=t.context,d=t.service,p=t.subPeer,_=t.logger,f=t.reportMediaActionLogger,b=n.L_RTC_CLIENT_JOIN_RTC_ROOM_R,(m=this._validateParams(c,_,b).code)!==exports.RCRTCCode.SUCCESS?[2,{code:m}]:(d.detectorMediaSever(),d.getNaviMS().length?(h=r.getSupportNtf(),[4,c.joinRTCRoom(this.roomId,this.roomType,this.joinType,this.innerUserDatas,this.outerUserDatas,h)]):(_.error(b,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]));case 1:return g=s.sent(),v=g.code,R=g.data,f.reportQualityJoinRoomData(a,v,this.roomType,null==R?void 0:R.sessionId),v===e.ErrorCode.SUCCESS&&R?(r.initWithRoomData(R,this.traceId),T=[],r.getRemoteUserIds().forEach((function(e){var t=r.getRemoteTracksByUserId(e).filter((function(e){return e.isAudioTrack()})).map((function(e){return r.getPublishedResourceByTrackId(e.getTrackId())})).map((function(e){return{uri:e.uri}}));T.push.apply(T,l([],u(t),!1))})),[4,p.exchangeDatachannel(T,!1)]):(C=40032===v?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:v,_.error(b,JSON.stringify({status:i.FAILED,code:C,msg:"joinRoom failed"}),this.traceId),[2,{code:C}]);case 2:return S=s.sent(),y=S.code,E=S.activeAudioList,y!==exports.RCRTCCode.SUCCESS?[2,{code:y}]:(r.getResourcesByUserId(r.crtUserId).length>0&&o.push(new Ta),O=Date.now(),r.setMeetingAudioSubCommandStamp(O),E.length>0&&o.push(new Vs(E,_,0,O)),_.info(b,JSON.stringify({status:i.SUCCEEDED,userId:r.crtUserId,roomId:this.roomId}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS,data:R}])}}))}))}}),o}(pa);!function(e){e[e.SSRC=1]="SSRC",e[e.MediaResource=2]="MediaResource",e[e.VideoResourceInfo=3]="VideoResourceInfo",e[e.VideoOperReq=4]="VideoOperReq",e[e.MediaOperErrInfo=5]="MediaOperErrInfo",e[e.VideoOperRes=6]="VideoOperRes",e[e.AudioNtf=7]="AudioNtf",e[e.AudioNtfAck=8]="AudioNtfAck",e[e.DataChannelOpen=13]="DataChannelOpen"}(ws||(ws={})),function(e){e.SSRC="SSRC",e.MediaResource="MediaResource",e.VideoResourceInfo="VideoResourceInfo",e.VideoOperReq="VideoOperReq",e.MediaOperErrInfo="MediaOperErrInfo",e.VideoOperRes="VideoOperRes",e.AudioNtf="AudioNtf",e.AudioNtfAck="AudioNtfAck",e.DataChannelOpen="DataChannelOpen"}(ks||(ks={}));var Js,Hs,Gs,Ks,qs,Ws=((As={})[ks.SSRC]=["ssrc","cname","mslabel","label","rtcSSRC","fecSSRC"],As[ks.MediaResource]=["ssrc","userId"],As[ks.VideoResourceInfo]=["userId","mslabel","uri","simulcast","rtxSSRC","fecSSRC"],As[ks.VideoOperReq]=["requestId","videoList"],As[ks.MediaOperErrInfo]=["userId","mslabel","code","message"],As[ks.VideoOperRes]=["requestId","code","message","videoList","errList"],As[ks.AudioNtf]=["requestId","audioList"],As[ks.AudioNtfAck]=["requestId"],As[ks.DataChannelOpen]=["timeStamp"],As),zs="\npackage Modules;\nmessage probuf {\n message ".concat(ks.SSRC," {\n optional uint64 ssrc = 1;\n optional string cname = 2;\n optional string mslabel = 3;\n optional string label = 4;\n optional uint64 rtxSSRC = 5; \n optional uint64 fecSSRC = 6;\n }\n message ").concat(ks.MediaResource," {\n optional string userId = 1;\n optional ").concat(ks.SSRC," ssrc = 2;\n }\n message ").concat(ks.VideoResourceInfo," {\n optional string userId = 1;\n optional string mslabel = 2;\n optional string uri = 3;\n optional bool simulcast = 4;\n optional uint64 rtxSSRC = 5;\n optional uint64 fecSSRC = 6;\n }\n message ").concat(ks.VideoOperReq," {\n optional string requestId = 1;\n repeated ").concat(ks.VideoResourceInfo," videoList = 2;\n optional uint64 timeStamp = 3;\n }\n message ").concat(ks.MediaOperErrInfo," {\n optional string userId = 1;\n optional string mslabel = 2;\n optional uint32 code = 3;\n optional string message = 4;\n }\n message ").concat(ks.VideoOperRes," {\n optional string requestId = 1;\n optional uint32 code = 2;\n optional string message = 3;\n repeated ").concat(ks.MediaResource," videoList = 4;\n repeated ").concat(ks.MediaOperErrInfo," errList = 5;\n optional uint64 timeStamp = 6;\n }\n message ").concat(ks.AudioNtf," {\n optional string requestId = 1;\n repeated ").concat(ks.MediaResource," audioList = 2;\n optional uint64 timeStamp = 3;\n }\n message ").concat(ks.AudioNtfAck," {\n optional string requestId = 1;\n optional uint64 timeStamp = 2;\n }\n message ").concat(ks.DataChannelOpen," {\n optional uint64 timeStamp = 1;\n }\n}\n"),Qs=function(){function e(e){Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:e})}return Object.defineProperty(e.prototype,"addAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"removeAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"createOfferTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"parseAnswerTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"updateVideoSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(e.prototype,"setDescriptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){throw new Error("Method not implemented.")}}),e}(),Ys=function(){function e(){Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_locked",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._queue.push(e),this._execute()}}),Object.defineProperty(e.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return this._queue.length>0&&!this._locked?(this._locked=!0,[4,this._queue.shift()()]):[3,2];case 1:e.sent(),this._locked=!1,this._execute(),e.label=2;case 2:return[2]}}))}))}}),e}(),Zs=function(){function e(e,t){Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_answerHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_answerSectionApp",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_answerSectionAudio",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_answerSectionVideo",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_crtSubAudioList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_crtSubVideoList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_setDescriptionsQueue",{enumerable:!0,configurable:!0,writable:!0,value:new Ys})}return Object.defineProperty(e.prototype,"createOfferTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i;return a(this,void 0,void 0,(function(){var o,a,c,u,l,d,p,_;return s(this,(function(s){switch(s.label){case 0:if(a="",c="",e)return[3,12];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peer.createOffer()];case 2:return o=s.sent(),[3,4];case 3:return u=s.sent(),this._logger.error(n.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({sdp:o,errorStack:u.stack})),_=Ne.getMemo(),null===(t=_.crtRoom)||void 0===t||t.mockKickOff(!1,exports.RCKickReason.RTC_INNER_KICK),[3,4];case 4:return s.trys.push([4,6,,7]),[4,this._peer.setLocalDescription(o)];case 5:return s.sent(),[3,7];case 6:return l=s.sent(),this._logger.error(n.L_SUB_PEER_SET_LOCAL_DESC_E,JSON.stringify({sdp:o,errorStack:l.stack})),[3,7];case 7:this._peer.addTransceiver("audio",{direction:"inactive"}),this._peer.addTransceiver("video",{direction:"inactive"}),s.label=8;case 8:return s.trys.push([8,10,,11]),[4,this._peer.createOffer()];case 9:return o=s.sent(),(null==(c=o.sdp)?void 0:c.includes("a=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli"))||(c=null==c?void 0:c.replace(/(a=rtpmap:111 opus\/48000\/2\r\na=rtcp-fb:111 transport-cc)/g,"$1\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli")),a=c,[3,11];case 10:return d=s.sent(),this._logger.error(n.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({sdp:o,errorStack:d.stack})),_=Ne.getMemo(),null===(r=_.crtRoom)||void 0===r||r.mockKickOff(!1,exports.RCKickReason.RTC_INNER_KICK),[3,11];case 11:return[3,15];case 12:return s.trys.push([12,14,,15]),[4,this._peer.createOffer({iceRestart:!0})];case 13:return o=s.sent(),(null==(c=o.sdp)?void 0:c.includes("a=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli"))||(c=null==c?void 0:c.replace(/(a=rtpmap:111 opus\/48000\/2\r\na=rtcp-fb:111 transport-cc)/g,"$1\r\na=rtcp-fb:111 nack\r\na=rtcp-fb:111 nack pli")),a=this._transOffer2Template(c),[3,15];case 14:return p=s.sent(),this._logger.error(n.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({sdp:o,errorStack:p.stack})),_=Ne.getMemo(),null===(i=_.crtRoom)||void 0===i||i.mockKickOff(!1,exports.RCKickReason.RTC_INNER_KICK),[3,15];case 15:return this._logger.info(n.L_SUB_PEER_SET_OFFER_O,c),[2,{type:"offer",sdp:c,semantics:"unified-plan",template:a}]}}))}))}}),Object.defineProperty(e.prototype,"_transOffer2Template",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return"".concat(e.replace(/a=group:BUNDLE(\s\d+)+/,"a=group:BUNDLE 0 1 2").split(/\r\n(?=m=)/).slice(0,4).join("\r\n"),"\r\n")}}),Object.defineProperty(e.prototype,"setDescriptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var i,a;return s(this,(function(s){switch(s.label){case 0:return[4,this._peer.setLocalDescription({type:"offer",sdp:t.sdp})];case 1:return s.sent(),e?[3,3]:[4,this._peer.setRemoteDescription({type:"answer",sdp:r})];case 2:case 4:return s.sent(),this._logger.info(n.L_SUB_PEER_SET_REMOTE_DESC_O,r),[2];case 3:return i=this._crtSubAudioList.map((function(e){return o({},e)})),a=this._crtSubVideoList.map((function(e){return o({},e)})),r=this._generateSDPAnswer(t.sdp.match(/a=group:BUNDLE(\s\d+)+/)[0],i,a),[4,this._peer.setRemoteDescription({type:"answer",sdp:r})]}}))}))}}),Object.defineProperty(e.prototype,"parseAnswerTemplate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;t=u(e.split(/\r\n(?=$|m=)/),4),this._answerHeader=t[0],this._answerSectionApp=t[1],this._answerSectionAudio=t[2],this._answerSectionVideo=t[3]}}),Object.defineProperty(e.prototype,"addAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r=this;return s(this,(function(n){return t=!1,e.forEach((function(e){var n=e.ssrc,i=e.mslabel,a=r._crtSubAudioList.findIndex((function(e){return e.mslabel===i}));-1===a?(r._crtSubAudioList.push(o(o({},e),{cancel:!1})),t=!0):n!==r._crtSubAudioList[a].ssrc&&(r._crtSubAudioList[a]=o(o({},e),{cancel:!1}),t=!0)})),t?[2,this._setDescriptions()]:[2,exports.RCRTCCode.SUCCESS]}))}))}}),Object.defineProperty(e.prototype,"removeAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this._crtSubAudioList.forEach((function(t){t.cancel||(t.cancel=e.some((function(e){return t.mslabel===e})))})),[4,this._setDescriptions()];case 1:return t.sent(),[2]}}))}))}}),Object.defineProperty(e.prototype,"updateVideoSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t,r=function(t){var r=n._crtSubVideoList[t],i=e.findIndex((function(e){return e.mslabel===r.mslabel}));-1===i?r.cancel=!0:n._crtSubVideoList[t]=o(o({},e.splice(i,1)[0]),{cancel:!1})},n=this,i=this._crtSubVideoList.length-1;i>=0;i-=1)r(i);return e.length&&(t=this._crtSubVideoList).push.apply(t,l([],u(e.map((function(e){return o(o({},e),{cancel:!1})}))),!1)),this._setDescriptions()}}),Object.defineProperty(e.prototype,"_setDescriptions",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var e=this;return s(this,(function(t){return[2,new Promise((function(t){var r=e._crtSubAudioList.map((function(e){return o({},e)})),i=e._crtSubVideoList.map((function(e){return o({},e)})),c=e._crtSubAudioList.map((function(e){return o({},e)})),u=e._crtSubVideoList.map((function(e){return o({},e)}));e._setDescriptionsQueue.push((function(){return a(e,void 0,void 0,(function(){var e,o,a,l,d,p,_,f=this;return s(this,(function(s){switch(s.label){case 0:this._peer.getTransceivers().forEach((function(e){var t="audio"===e.receiver.track.kind?r.shift():i.shift();t&&(e.direction=t.cancel?"inactive":"recvonly")})),r.forEach((function(e){f._peer.addTransceiver("audio",{direction:e.cancel?"inactive":"recvonly"})})),i.forEach((function(e){f._peer.addTransceiver("video",{direction:e.cancel?"inactive":"recvonly"})})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peer.createOffer()];case 2:return e=s.sent(),[3,4];case 3:return o=s.sent(),this._logger.error(n.L_SUB_PEER_CREATE_OFFER_E,JSON.stringify({offer:e,errorStack:o.stack})),a=Ne.getMemo(),null===(_=a.crtRoom)||void 0===_||_.mockKickOff(!1,exports.RCKickReason.RTC_INNER_KICK),[2,t(exports.RCRTCCode.CREATE_OFFER_FAILED)];case 4:return s.trys.push([4,6,,7]),[4,this._peer.setLocalDescription(e)];case 5:return s.sent(),[3,7];case 6:return l=s.sent(),this._logger.error(n.L_SUB_PEER_SET_LOCAL_DESC_E,JSON.stringify({offer:e,errorStack:l.stack})),[2,t(exports.RCRTCCode.SET_LOCAL_DESCRIPTION_FAILED)];case 7:this._logger.info(n.L_SUB_PEER_SET_OFFER_O,null==e?void 0:e.sdp),d=this._generateSDPAnswer(e.sdp.match(/a=group:BUNDLE(\s\d+)+/)[0],c,u),s.label=8;case 8:return s.trys.push([8,10,,11]),[4,this._peer.setRemoteDescription({type:"answer",sdp:d})];case 9:return s.sent(),[3,11];case 10:return p=s.sent(),this._logger.error(n.L_SUB_PEER_SET_REMOTE_DESC_E,JSON.stringify({sdp:d,errorStack:p.stack})),[2,t(exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED)];case 11:return this._logger.info(n.L_SUB_PEER_SET_REMOTE_DESC_O,d),[2,t(exports.RCRTCCode.SUCCESS)]}}))}))}))}))]}))}))}}),Object.defineProperty(e.prototype,"_generateSDPAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n=this,i=this._peer.getTransceivers().map((function(e){var i="video"===e.receiver.track.kind,o=e.mid;return i?n._formatVideoSec(o,r.shift()):n._formatAudioSec(o,t.shift())}));return l(l([this._answerHeader.replace(/a=group:BUNDLE(\s\d+)+/,e),this._answerSectionApp],u(i),!1),[""],!1).join("\r\n")}}),Object.defineProperty(e.prototype,"_formatVideoSec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._answerSectionVideo.replace(/a=mid:\d+/,"a=mid:".concat(e));if(!t)return r;var n=t.fecSSRC,i=void 0===n?0:n,o=t.cname,a=t.mslabel,s=t.label,c=t.ssrc,u=t.cancel,l=t.rtxSSRC,d=void 0===l?0:l;return r=r.replace("a=inactive","a=".concat(u?"inactive":"sendonly","\r\na=msid:").concat(a," ").concat(s)),d&&i?[r,"a=ssrc-group:FID ".concat(c," ").concat(d),"a=ssrc-group:FEC-FR ".concat(c," ").concat(i),"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s),"a=ssrc:".concat(d," cname:").concat(o),"a=ssrc:".concat(d," msid:").concat(a," ").concat(s),"a=ssrc:".concat(d," mslabel:").concat(a),"a=ssrc:".concat(d," label:").concat(s),"a=ssrc:".concat(i," cname:").concat(o),"a=ssrc:".concat(i," msid:").concat(a," ").concat(s),"a=ssrc:".concat(i," mslabel:").concat(a),"a=ssrc:".concat(i," label:").concat(s)].join("\r\n"):d?[r,"a=ssrc-group:FID ".concat(c," ").concat(d),"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s),"a=ssrc:".concat(d," cname:").concat(o),"a=ssrc:".concat(d," msid:").concat(a," ").concat(s),"a=ssrc:".concat(d," mslabel:").concat(a),"a=ssrc:".concat(d," label:").concat(s)].join("\r\n"):i?[r,"a=ssrc-group:FEC-FR ".concat(c," ").concat(i),"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s),"a=ssrc:".concat(i," cname:").concat(o),"a=ssrc:".concat(i," msid:").concat(a," ").concat(s),"a=ssrc:".concat(i," mslabel:").concat(a),"a=ssrc:".concat(i," label:").concat(s)].join("\r\n"):[r,"a=ssrc:".concat(c," cname:").concat(o),"a=ssrc:".concat(c," msid:").concat(a," ").concat(s),"a=ssrc:".concat(c," mslabel:").concat(a),"a=ssrc:".concat(c," label:").concat(s)].join("\r\n")}}),Object.defineProperty(e.prototype,"_formatAudioSec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._answerSectionAudio.replace(/a=mid:\d+/,"a=mid:".concat(e));if(!t)return r;var n=t.ssrc,i=t.mslabel,o=t.label,a=t.cname,s=t.cancel;return[r=r.replace("a=inactive","a=".concat(s?"inactive":"sendonly","\r\na=msid:").concat(i," ").concat(o)),"a=ssrc:".concat(n," cname:").concat(a),"a=ssrc:".concat(n," msid:").concat(i," ").concat(o),"a=ssrc:".concat(n," mslabel:").concat(i),"a=ssrc:".concat(n," label:").concat(o)].join("\r\n")}}),e}(),Xs="audio_ntf",$s="inner_track_ready",ec="sub_ice_connection_change",tc="inner_audio_level_change",rc="inner_report_data",nc="sub_ice_datachannel_open",ic=function(t){function i(e,r,n,i,o,a,s){void 0===s&&(s=!1);var c=t.call(this)||this;Object.defineProperty(c,"_service",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(c,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(c,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"_store",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(c,"_codec",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_datachannel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_sdpProxy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_historyAudioLevelMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_trackIdToSSRC",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_maxRequestId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(c,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(c,"_videoSubMaps",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_DCError",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_stateTimer",{enumerable:!0,configurable:!0,writable:!0,value:null});var u=jo.getSdpSemantics(),l="unified-plan"===u&&s&&bo()&&No.isInit(),d=c._peer=new RTCPeerConnection({sdpSemantics:u,encodedInsertableStreams:l});return c._sdpStrategy="plan-b"===u?new Vo(c._logger,d,!1):new Qo(c._logger,d,l),c._peer.oniceconnectionstatechange=c._onICEConnectionStateChange.bind(c),c._peer.onconnectionstatechange=c._onConnectionStateChange.bind(c),c._peer.ontrack=c._onTrackReady.bind(c),c.reportParser=c._sdpStrategy.getStatParsr(c._peer,u,c._currentUserId,c._store),c._sdpProxy="plan-b"===u?new Qs(c._peer):new Zs(c._peer,c._logger),c._createDataChannel(),c}return r(i,t),Object.defineProperty(i.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.streams.length){var t=e.streams[0].id,r=e.receiver.track,n=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");r.trackId||Object.defineProperty(r,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}),this.emit($s,e)}}}),Object.defineProperty(i.prototype,"_onICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peer.iceConnectionState;if(this._logger.info(n.L_SUB_ICE_CONNECTION_S,e),"connected"===e)this._startStateTimer();this.emit(ec,this._peer.iceConnectionState)}}),Object.defineProperty(i.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(n.L_SUB_CONNECTION_S,this._peer.connectionState)}}),Object.defineProperty(i.prototype,"_onDataChannelClose",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(n.L_DATACHANNEL_CLOSE_O)}}),Object.defineProperty(i.prototype,"_onDataChannelError",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.debug(n.L_DATACHANNEL_E,e.toString())}}),Object.defineProperty(i.prototype,"_recvHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e),r=u(t.slice(0,4),4);r[0],r[1];var i=(r[2]<<8)+r[3],o=t.slice(4),a=null;switch([ws.VideoOperRes,ws.AudioNtf].includes(i)&&(a=this._codec.decode(ws[i],o)),this._logger.info(n.L_DATACHANNEL_RECV_MSG_O,JSON.stringify({type:i,data:a})),i){case ws.VideoOperRes:this._onSubVideoRes(a);break;case ws.AudioNtf:this._onAudioNtf(a);break;case ws.DataChannelOpen:this._onDCReopen()}}}),Object.defineProperty(i.prototype,"_onAudioNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.requestId,n=e.audioList;this.sendonly(ws.AudioNtfAck,this._codec.encode(ks.AudioNtfAck,{requestId:r}));var i=[];n.forEach((function(e){var r,n;e.userId!==(null===(r=t._store)||void 0===r?void 0:r.crtUserId)&&(i.push(e),null===(n=t._store)||void 0===n||n.setTrackIdSSRCMap(Number(e.ssrc.ssrc),Gi(t._store.getMeidByUserId(e.userId),Uc.DEFAULT,exports.RCMediaType.AUDIO_ONLY)))})),this.emit(Xs,i)}}),Object.defineProperty(i.prototype,"_sendVideoReq",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this._maxRequestId=parseInt(e)>parseInt(this._maxRequestId)?e:this._maxRequestId,new Promise((function(n){r._videoSubMaps[e]=n,r.sendonly(ws.VideoOperReq,t)}))}}),Object.defineProperty(i.prototype,"_onSubVideoRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.requestId,r=this._videoSubMaps[t];if(r){if(delete this._videoSubMaps[t],parseInt(t)<parseInt(this._maxRequestId))return r({code:exports.RCRTCCode.SUB_VIDEO_EXPIRED});r(e)}}}),Object.defineProperty(i.prototype,"_onDCReopen",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._DCError&&this.emit(nc),this._DCError=!1}}),Object.defineProperty(i.prototype,"sendonly",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){var i=l([0,0,0,t],u(new Uint8Array(r)),!1);try{this._datachannel.send(new Uint8Array(i).buffer)}catch(t){e.logger.info(n.L_DATACHANNEL_E,JSON.stringify({stack:t.stack,msg:"send data error in datachannel"}))}}}),Object.defineProperty(i.prototype,"_createDataChannel",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._datachannel=this._peer.createDataChannel("rc-datachannel",{ordered:!1,negotiated:!0,id:0}),this._datachannel.binaryType="arraybuffer",this._datachannel.onmessage=function(t){return e._recvHandler(t.data)},this._datachannel.onclose=this._onDataChannelClose.bind(this),this._datachannel.onerror=this._onDataChannelError.bind(this)}}),Object.defineProperty(i.prototype,"_dataChannelReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return void 0===n&&(n=!1),a(this,void 0,void 0,(function(){var i,o=this;return s(this,(function(a){switch(a.label){case 0:return"open"!==this._datachannel.readyState?[3,2]:[4,this._sdpProxy.setDescriptions(e,t,r.sdp)];case 1:return a.sent(),n&&(this._DCError=!0),[2,exports.RCRTCCode.SUCCESS];case 2:return i=new Promise((function(e){setTimeout((function(){o._datachannel.onopen=null,e(exports.RCRTCCode.DATACHANNEL_OPEN_TIMEOUT)}),1e4),o._datachannel.onopen=function(){e(exports.RCRTCCode.SUCCESS)}})),[4,this._sdpProxy.setDescriptions(e,t,r.sdp)];case 3:return a.sent(),[2,i]}}))}))}}),Object.defineProperty(i.prototype,"exchangeDatachannel",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return a(this,void 0,void 0,(function(){var i,a,c,u,l,d,p,_,f,b,m,h,g,v,R,C;return s(this,(function(s){switch(s.label){case 0:return i=Ne.getMemo(),[4,this._sdpProxy.createOfferTemplate(t)];case 1:return a=s.sent(),c=a.template,u=a.semantics,[4,this._service.meetingSubExchange(this._store.getRTCRequestHeader(),{sdp:{type:"offer",sdp:c,semantics:u},subscribeList:e,snui:0},this._logger.createTraceId())];case 2:return l=s.sent(),d=l.code,p=l.data,d!==exports.RCRTCCode.SUCCESS?[2,{code:d}]:(f=(_=p).sdp,b=_.resultCode,m=_.rtcFinger,h=_.snui,g=void 0===h?0:h,i.snui=g,b!==exports.RCRTCCode.SUCCESS?[2,{code:b}]:(this._sdpProxy.parseAnswerTemplate(f.sdp),v=""!==this._rtcFinger&&this._rtcFinger!==m,this._rtcFinger=m,[4,this._dataChannelReady(t,a,f,v)]));case 3:return(R=s.sent())!==exports.RCRTCCode.SUCCESS?(this._logger.warn(n.L_DATACHANNEL_OPEN_FAILED_O,R),[2,{code:R}]):(this._logger.info(n.L_DATACHANNEL_OPEN_O),C=(null===(r=p.activeAudioList)||void 0===r?void 0:r.map((function(e){return o(o({},e),{cname:e.cname||e.userId||"-",label:e.label||"".concat(e.mslabel,"_audio")})})))||[],[2,{code:exports.RCRTCCode.SUCCESS,activeAudioList:C}])}}))}))}}),Object.defineProperty(i.prototype,"addAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpProxy.addAudioSubList(e)}}),Object.defineProperty(i.prototype,"removeAudioSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpProxy.removeAudioSubList(e)}}),Object.defineProperty(i.prototype,"updateVideoSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t,r,i,a,c,u=this;return s(this,(function(s){switch(s.label){case 0:return t=Date.now().toString(),this._logger.info(n.L_SEND_VIDEO_SUB_REQ_T,"reqId: ".concat(t,", list: ").concat(e.map((function(e){return e.mslabel})))),r=this._codec.encode(ks.VideoOperReq,{requestId:t,videoList:e.map((function(e){var t=e.uri&&JSON.parse(e.uri);return u._codec.encode(ks.VideoResourceInfo,o(o({},e),{rtxSSRC:Number(t.ssrc)+1,fecSSRC:Number(t.ssrc)+2}),!0)}))}),i=e.map((function(e){var t,r,n=e.uri&&JSON.parse(e.uri);return u._trackIdToSSRC[e.mslabel]={ssrc:n.ssrc,rtxSSRC:Number(n.ssrc)+1,fecSSRC:Number(n.ssrc)+2},{userId:e.userId,ssrc:{ssrc:n.ssrc,cname:e.userId,mslabel:e.mslabel,label:"".concat(e.mslabel,"_video"),rtxSSRC:null===(t=u._trackIdToSSRC[e.mslabel])||void 0===t?void 0:t.rtxSSRC,fecSSRC:null===(r=u._trackIdToSSRC[e.mslabel])||void 0===r?void 0:r.fecSSRC}}})),a=[],[4,this._sdpProxy.updateVideoSubList(i.map((function(e){return e.ssrc})))];case 1:return(c=s.sent())!==exports.RCRTCCode.SUCCESS?[2,{code:c}]:(this._differSubList(t,r),this._logger.info(n.L_SEND_VIDEO_SUB_REQ_R,"reqId: ".concat(t,", code: ").concat(exports.RCRTCCode.SUCCESS)),[2,{code:exports.RCRTCCode.SUCCESS,videoList:i,errList:a}])}}))}))}}),Object.defineProperty(i.prototype,"_differSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,i,o,a,c,u=this;return s(this,(function(s){switch(s.label){case 0:return[4,this._sendVideoReq(e,t)];case 1:return r=s.sent(),i=r.code,o=r.videoList,a=r.errList,i===exports.RCRTCCode.SUB_VIDEO_EXPIRED?(this._logger.info(n.L_SEND_VIDEO_SUB_REQ_E,"reqId: ".concat(e,", code: ").concat(exports.RCRTCCode.SUB_VIDEO_EXPIRED)),[2]):a&&a.length>0?(setTimeout((function(){u._differSubList(e,t)}),1e3),[2]):(c=(null==o?void 0:o.filter((function(e){var t,r,n;return!(e.ssrc.rtxSSRC!==(null===(t=u._trackIdToSSRC[e.ssrc.mslabel])||void 0===t?void 0:t.rtxSSRC)||e.ssrc.ssrc!==(null===(r=u._trackIdToSSRC[e.ssrc.mslabel])||void 0===r?void 0:r.ssrc)||e.ssrc.fecSSRC!==(null===(n=u._trackIdToSSRC[e.ssrc.mslabel])||void 0===n?void 0:n.fecSSRC))})))||[],c.length===(null==o?void 0:o.length)?[3,4]:[4,this._sdpProxy.updateVideoSubList(c.map((function(e){return e.ssrc})))]);case 2:return s.sent(),[4,this._sdpProxy.updateVideoSubList(o.map((function(e){var t,r;return u._trackIdToSSRC[e.ssrc.mslabel]={ssrc:e.ssrc.ssrc,rtxSSRC:null===(t=u._trackIdToSSRC[e.ssrc.mslabel])||void 0===t?void 0:t.rtxSSRC,fecSSRC:null===(r=u._trackIdToSSRC[e.ssrc.mslabel])||void 0===r?void 0:r.fecSSRC},e.ssrc})))];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))}}),Object.defineProperty(i.prototype,"close",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._stopStateTimer(),this._datachannel.close(),this._peer.close()}}),Object.defineProperty(i.prototype,"_startStateTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this.reportParser&&(this._stopStateTimer(),this._stateTimer=setTimeout((function(){e._reportHandle(),e._startStateTimer()}),1e3))}}),Object.defineProperty(i.prototype,"_stopStateTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._stateTimer&&(clearTimeout(this._stateTimer),this._stateTimer=null)}}),Object.defineProperty(i.prototype,"_createSenderReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ne.getMemo(),r=[];return e.forEach((function(e){var n,i,a=e.trackId,s=e.kind,c=e.packetsLostRate,u=e.remoteResource,l=e.bitrate,d=e.jitter,p=e.networkQuality,_=e.audioDB,f={trackId:a,kind:s,packetsLostRate:c,remoteResource:u,bitrate:l,jitter:d,rtt:e.rtt,networkQuality:p,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[Fi(a).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(f.audioLevel=e.audioLevel),e.frameWidth&&(f.frameWidth=e.frameWidth),e.frameHeight&&(f.frameHeight=e.frameHeight),e.frameRate&&(f.frameRate=e.frameRate),e.trackId){var b=e.trackId;e.trackId.includes("tiny")&&(b=e.trackId.replace("_tiny",""));var m=Fi(b).identifier,h=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[m];e.userId=h,r.push(o(o({},f),{userId:h}))}})),r}}),Object.defineProperty(i.prototype,"_createReceiverReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Ne.getMemo(),r=[];return e.forEach((function(e){var n,i,a=e.trackId,s=e.kind,c=e.packetsLostRate,u=e.remoteResource,l=e.bitrate,d=e.jitter,p=e.networkQuality,_=e.audioDB,f={trackId:a,kind:s,packetsLostRate:c,remoteResource:u,bitrate:l,jitter:d,networkQuality:p,userId:null===(n=t.meidToUserIdMap)||void 0===n?void 0:n[Fi(a).identifier],audioDB:_};if((e.audioLevel||0===e.audioLevel)&&(f.audioLevel=e.audioLevel),e.frameWidth&&(f.frameWidth=e.frameWidth),e.frameHeight&&(f.frameHeight=e.frameHeight),e.frameRate&&(f.frameRate=e.frameRate),e.trackId){var b=Fi(e.trackId).identifier,m=null===(i=t.meidToUserIdMap)||void 0===i?void 0:i[b];e.userId=m,r.push(o({},f))}})),r}}),Object.defineProperty(i.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=t.timestamp,n=t.iceCandidatePair,i=t.senders,o=t.receivers;for(var a in(null==n?void 0:n.totalPacketsLost)&&(null==n||delete n.totalPacketsLost),n)e.isNull(n[a])&&delete n[a];return{timestamp:r,iceCandidatePair:n,senders:this._createSenderReport(i),receivers:this._createReceiverReport(o)}}}),Object.defineProperty(i.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return a(this,void 0,void 0,(function(){var r,n,i;return s(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._peer.getStats()];case 1:return n=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(n),i=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=i,[2,i]}}))}))}}),Object.defineProperty(i.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t,r,n;return a(this,void 0,void 0,(function(){var i,a,c,d,p,_,f,b=this;return s(this,(function(s){switch(s.label){case 0:return i=Ne.getMemo(),[4,this._getStatsData()];case 1:return(a=s.sent())?(i.subPolarisReportData=a,c=i.pubReportData,d=this._createRCRTCStateReport(a),p={timestamp:d.timestamp,iceCandidatePair:o(o({},d.iceCandidatePair),{bitrateSend:null===(t=null==c?void 0:c.iceCandidatePair)||void 0===t?void 0:t.bitrateSend}),senders:l(l([],u(d.senders),!1),u((null==c?void 0:c.senders)||[]),!1),receivers:l(l([],u(d.receivers),!1),u((null==c?void 0:c.receivers)||[]),!1)},_=l(l([],u(p.receivers),!1),u(p.senders),!1).filter((function(e){return!("audio"!==e.kind)})).map((function(t){var r;if(e.isNumber(t.audioLevel)){var n=b._historyAudioLevelMap[t.trackId];n?(n.length>3&&n.splice(0,1),n.push(t.audioLevel||0)):n=b._historyAudioLevelMap[t.trackId]=[t.audioLevel||0];var i=n.reduce((function(e,t){return e+t}),0)/n.length;return{trackId:t.trackId,audioLevel:i}}b._historyAudioLevelMap[t.trackId]=[];var o=t.trackId;t.trackId.includes("tiny")&&(o=t.trackId.replace("_tiny",""));var a=Fi(o).identifier,s=null===(r=b._store)||void 0===r?void 0:r.getUserIdByMeid(a);return{trackId:t.trackId,audioLevel:t.audioLevel,userId:s}})),this.emit(tc,_),f=o(o({},p),{senders:null===(r=p.senders)||void 0===r?void 0:r.map((function(e){var t,r=e.trackId;e.trackId.includes("tiny")&&(r=e.trackId.replace("_tiny",""));var n=Fi(r).identifier,i=null===(t=b._store)||void 0===t?void 0:t.getUserIdByMeid(n);if("video"===e.kind)return o(o({},e),{userId:i});var a=_.filter((function(t){return e.trackId===t.trackId}))[0];return o(o({},e),{audioLevel:null==a?void 0:a.audioLevel,userId:i})})),receivers:null===(n=p.receivers)||void 0===n?void 0:n.map((function(e){var t,r=Fi(e.trackId).identifier,n=null===(t=i.meidToUserIdMap)||void 0===t?void 0:t[r];if("video"===e.kind)return o(o({},e),{userId:n});var a=_.filter((function(t){return e.trackId===t.trackId}))[0];return o(o({},e),{audioLevel:null==a?void 0:a.audioLevel,userId:n})}))}),this.emit(rc,JSON.parse(JSON.stringify(f))),[2]):[2]}}))}))}}),Object.defineProperty(i.prototype,"getPeerConnectionState",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peer.connectionState}}),i}(e.EventEmitter),oc=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.MeetingVideoSubCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o;return s(this,(function(a){return n=t.getSubscribedList().filter((function(e){return e.track.isVideoTrack()})),i=this.tracks.map((function(e){return e instanceof ba?{track:e}:e})),o=!1,i.forEach((function(e){var t=e.track.getTrackId(),r=n.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:e.track.isVideoTrack()&&n.push(e),o=!0)})),o?[2,new Da(n).execute(e,t,r)]:[2,{code:exports.RCRTCCode.SUCCESS}]}))}))}}),t}(pa),ac=function(e){function t(){return e.call(this)||this}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ia.SubPeerReconnectCommand},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return oa.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,n){return a(this,void 0,void 0,(function(){var i,o,a,c,u,l,d,p;return s(this,(function(s){switch(s.label){case 0:return i=e.subPeer,o=e.logger,a=r.getSubscribedList().map((function(e){return r.getPublishedResourceByTrackId(e.track.getTrackId())})).filter((function(e){return e&&e.mediaType===exports.RCMediaType.AUDIO_ONLY})).map((function(e){return{uri:e.uri,simulcast:e.simulcast}})),[4,i.exchangeDatachannel(a,!0)];case 1:return c=s.sent(),u=c.code,l=c.activeAudioList,u!==exports.RCRTCCode.SUCCESS?($n.error("ice retry 15s: ",i.getPeerConnectionState()),setTimeout((function(){return n.push(new t)}),15e3),[2,{code:u}]):(setTimeout((function(){$n.error("ice retry 5s: ",i.getPeerConnectionState()),"connected"!==i.getPeerConnectionState()&&n.push(new t)}),5e3),l.length?(d=Date.now(),r.setMeetingAudioSubCommandStamp(d),[4,new Vs(l,o,0,d).execute(e,r,n)]):[3,3]);case 2:s.sent(),s.label=3;case 3:return(p=r.getSubscribedList().filter((function(e){return e.track.isVideoTrack()}))).length?[4,new Da(p,!0).execute(e,r,n)]:[3,5];case 4:s.sent(),s.label=5;case 5:return[2,{code:u}]}}))}))}}),t}(pa),sc="evt-leave",cc=function(t){function o(e,r,i,o,c,u,l,d){void 0===u&&(u=ei()),void 0===l&&(l=!1);var p=t.call(this)||this;Object.defineProperty(p,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(p,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(p,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(p,"_service",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(p,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(p,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(p,"version",{enumerable:!0,configurable:!0,writable:!0,value:d}),Object.defineProperty(p,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_subPeer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_trackSentTimer",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(p,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(p,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(p,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var _=exports.RTCMode.MEETING,f=p._logger=p._context.logger;p._reportMediaActionLogger=new xs(f,p._roomId,p._clientSessionId,p._context.getCurrentId()),p._polarisReport=new ua(p._context,p._runtime,p._roomId,p);var b=p._context.getCurrentId(),m=new Ca(f,u,p._context.getAppkey(),i,b,_,!1,!1,!0,!1),h=p._peerConnection=new ea(f,p._reTryExchange.bind(p),b,m,p._polarisReport,l);p._setPeerConnectionListener();var g=p._subPeer=new ic(p._service,p._logger,b,m,p._context.createCodec(Ws,zs),p._polarisReport,l);p._setSubPeerConnectionListener();var v=p._executeCtx=new Na(f,p._service,e,r,h,m,p._polarisReport,p._reportMediaActionLogger,g);return p.setCommandEventListener(),p._invoker=new fa(v,m),p._store=p._invoker.store,p._pinger=new ho(p._context,p._roomId,_,p._initOptions.pingGap),p._pinger.onFailed=p.__kickoff.bind(p),p._pinger.onPingResult=p._handlePingResult.bind(p),p._context.registerRTCSignalListener((function(e){return a(p,void 0,void 0,(function(){var t,r,i,o,a;return s(this,(function(s){if(t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,o=t.roomId,a=f.createTraceId(),this._invoker.isDestroyed())return f.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:r,roomId:o})),[2];switch(i){case 0:break;case 2:if(o!==this._roomId)return[2];f.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,r)}return[2]}))}))})),p}return r(o,t),Object.defineProperty(o.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(ea.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(Ei.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(Ei.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(ea.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(ea.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,n=t.time,i=t.iceCandidatePair;i&&e._reportMediaActionLogger.recordQualityIceStatusData(i,r,n)}))}}),Object.defineProperty(o.prototype,"_setSubPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._subPeer;e.on(Xs,this._onAudioNtf.bind(this)),e.on($s,this._onTrackReady.bind(this)),e.on(ec,this._onSubICEConnectionStateChange.bind(this)),e.on(tc,this._onSubAudioLevelReport,this),e.on(rc,this._onSubStatsReport,this),e.on(nc,this._reupdateSubList.bind(this))}}),Object.defineProperty(o.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(ya,this._rtcpeerClosed,this),e.on(Ea,this._callAppListener.bind(this,"onUserJoin"),this),e.on(Oa,this._callAppListener.bind(this,"onUserLeave"),this),e.on(Ia,this._onTrackPublish,this),e.on(La,this._onTrackUnpublish,this),e.on(Pa,this._onAudioMuteChange,this),e.on(Aa,this._onVideoMuteChange,this),e.on(wa,this._dealUserAppListener,this),e.on(ka,this._onTrackDeviceStatusChange,this)}}),Object.defineProperty(o.prototype,"_pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return new Ls(e,t,this._context,r)}}),Object.defineProperty(o.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){return s(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(this._pullRTCRoomStatus(e,t,r))];case 1:return n.sent(),[2]}}))}))}}),Object.defineProperty(o.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return a(this,void 0,void 0,(function(){var i,o,a;return s(this,(function(s){switch(s.label){case 0:return[4,this._invoker.push(new Fs(this._roomId,e,t,r,n))];case 1:return i=s.sent(),o=i.code,a=i.data,o!==exports.RCRTCCode.SUCCESS?[2,{code:o}]:(this._initWithRoomData(a.offlineKickTime),[2,{code:o,data:a}])}}))}))}}),Object.defineProperty(o.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;this._pinger.start(1e3*e),null===(t=this._polarisReport)||void 0===t||t.sendR1()}}),Object.defineProperty(o.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,o,a;if(e===exports.RCRTCPingResult.SUCCESS){var s=this._store.getRoomStatusVersion(),c=String(t).length-String(s).length;if(c<0?t&&(t*=Math.pow(10,c)):s&&(s*=Math.pow(10,c)),t>s){var u=null===(i=null===(r=this._context)||void 0===r?void 0:r.logger)||void 0===i?void 0:i.createTraceId();null===(a=null===(o=this._context)||void 0===o?void 0:o.logger)||void 0===a||a.info(n.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),u),this._startPullRTCRoomStatus(this._roomId,u,t)}}this._callAppListener("onPing",e)}}),Object.defineProperty(o.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._logger.warn(n.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),e.assert("max",t,(function(t){return e.isNumber(t)&&t>Math.max(r||1,200)}),!0),e.assert("min",r,(function(r){return e.isNumber(r)&&r>=1&&(!e.isNumber(t)||r<t)}),!0),e.assert("start",i,(function(n){return e.isNumber(n)&&n>r&&n<=t})),this._peerConnection.setBitrate(t,r,i)}}),Object.defineProperty(o.prototype,"_onSubICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;Ne.getMemo();try{null===(r=null===(t=this._reportListener)||void 0===t?void 0:t.onICEConnectionStateChange)||void 0===r||r.call(t,e,"sub")}catch(e){this._context.logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,e.stack)}"failed"!==e&&"disconnected"!==e||this._invoker.push(new ac)}}),Object.defineProperty(o.prototype,"_onSubAudioLevelReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;null===(t=this._audioLevelReport)||void 0===t||t.audioLevelReport(e)}}),Object.defineProperty(o.prototype,"_onSubStatsReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;try{null===(r=null===(t=this._reportListener)||void 0===t?void 0:t.onStateReport)||void 0===r||r.call(t,e)}catch(e){this._context.logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,e.stack)}}}),Object.defineProperty(o.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,o=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=this._store.getRemoteTrack(o);a?a.isReady()?a.__innerSetMediaStreamTrack(r):(a.__innerSetMediaStreamTrack(r),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackReady",trackId:a.getTrackId()})),this._callAppListener("onTrackReady",a)):this._logger.warn(n.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(o.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];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,l([],u(r),!1))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(o.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(o.prototype,"_onTrackDeviceStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackDeviceStatusChange",tracks:null==e?void 0:e.map((function(e){var t;return{trackId:null===(t=null==e?void 0:e.track)||void 0===t?void 0:t.getTrackId(),status:null==e?void 0:e.status}}))}))}}),Object.defineProperty(o.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(e.conversationType,r===this._roomId){this._logger.info(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var o=e.content;switch(e.messageType){case lo.KICK:this.__kickoff(!0,o);break;case lo.STATE:this._stateHandle(o,t);break;case lo.MODIFY:case lo.PUBLISH:case lo.UNPUBLISH:case lo.TOTAL_CONTENT_RESOURCE:this._resourceHandle(o,e.messageType,e.senderUserId,e.sentTime,t);break;case lo.ROOM_NOTIFY:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case lo.USER_NOTIFY:this._logger.warn(n.L_OLD_DAILY_RECORD_O,"TODO: ".concat(lo.USER_NOTIFY));break;case lo.PK_INVITE:case lo.PK_CANCEL_INVITE:case lo.PK_INVITE_TIMEOUT:case lo.PK_INVITE_ANSWER:case lo.PK_END:case lo.OTHER_ROOM_OFFLINE:default:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,o,e.senderUserId,e.messageUId)}}else this._logger.warn(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:i.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(o.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,o,a=this;return s(this,(function(s){return this._invoker.isDestroyed()||(this._logger.warn(n.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(sc),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===a._context.getCurrentId()&&(o=e.type,r=e.kickExtra,a._reportMediaActionLogger.reportQualityKickedData(o))})),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onKickOff",byServer:e,kickType:o,kickExtra:r})),this._callAppListener("onKickOff",e,o,r)),[2]}))}))}}),Object.defineProperty(o.prototype,"mockKickOff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this.__kickoff(e,{users:[{userId:this.getCrtUserId(),type:t}]})}}),Object.defineProperty(o.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(sc),this._leaveHandle(!0),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(o.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return a(this,void 0,void 0,(function(){var o;return s(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new Rs(e,t,r,i,n)),[2]}))}))}}),Object.defineProperty(o.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;null===(r=null===(t=this._context)||void 0===t?void 0:t.logger)||void 0===r||r.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(o.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,n,i;return s(this,(function(o){switch(o.label){case 0:return[4,this._invoker.push(new vs(e,t))];case 1:return r=o.sent(),n=r.code,i=r.data,n===exports.RCRTCCode.SUCCESS&&this._dealUserAppListener(i),[2]}}))}))}}),Object.defineProperty(o.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.left,r=l([],u(e.joined),!1),o=l([],u(t),!1);r.length>0&&(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onUserJoin",allJoined:r})),this._callAppListener("onUserJoin",r)),o.length>0&&(o.length&&this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onUserLeave",allLeft:o})),this._callAppListener("onUserLeave",o))}}),Object.defineProperty(o.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(o.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(o.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(o.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,l([],u(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(o.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(o.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(o.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:return o=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:t,content:r}),o),[4,this._context.sendMessage(e.ConversationType.RTC_ROOM,this._roomId,{messageType:t,content:r,isStatusMessage:!0})];case 1:return(a=s.sent().code)!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:i.FAILED,code:a}),o),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:i.SUCCEEDED,name:t,content:r}),o),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(o.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o,c){return void 0===c&&(c=!1),a(this,void 0,void 0,(function(){var a,u;return s(this,(function(s){switch(s.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:t,value:r,message:o,isInner:c}),a),[4,this._context.setRTCData(this._roomId,t,r,c,Is.ROOM,o)];case 1:return(u=s.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.FAILED,code:u}),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.SUCCEEDED,roomId:this._roomId,key:t,value:r,message:o,isInner:c}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(o.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,o){return void 0===o&&(o=!1),a(this,void 0,void 0,(function(){var a,c;return s(this,(function(s){switch(s.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,message:r,isInner:o}),a),[4,this._context.removeRTCData(this._roomId,t,o,Is.ROOM,r)];case 1:return(c=s.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.FAILED,code:c}),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.SUCCEEDED,roomId:this._roomId,keys:t,message:r,isInner:o}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(o.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return void 0===t&&(t=[]),void 0===r&&(r=!1),a(this,void 0,void 0,(function(){var o,a,c,u;return s(this,(function(s){switch(s.label){case 0:return o=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,isInner:r}),o),[4,this._context.getRTCData(this._roomId,t,r,Is.ROOM)];case 1:return a=s.sent(),c=a.code,u=a.data,c!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(c),o),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:i.SUCCEEDED,data:u}),o),[2,{code:exports.RCRTCCode.SUCCESS,data:u}])}}))}))}}),Object.defineProperty(o.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,Is.PERSON,r)}}),Object.defineProperty(o.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,Is.PERSON,t)}}),Object.defineProperty(o.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,Is.PERSON)}}),Object.defineProperty(o.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(o.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(o.prototype,"__destroyMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._leaveHandleMock()}}),Object.defineProperty(o.prototype,"_muteRemoteTracksBeforeQuit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach((function(e){return e.mute()}))}}),Object.defineProperty(o.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this._invoker.isDestroyed()?[2]:(Ne.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),e?[4,this._context.quitRTCRoom(this._roomId)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())];case 3:return t.sent(),this._subPeer.close(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(o.prototype,"_leaveHandleMock",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return this._invoker.isDestroyed()?[2]:(Ne.destroy(),this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())]);case 1:return e.sent(),this._subPeer.close(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(o.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.off(Ei.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Ei.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.off(Ei.__INNER_EVENT_SEND_CHANGE__,this._onLocalTrackSent,this),e.off(Ei.__INNER_EVENT_DEVICE_STATUS_CHANGE__,this._onLocalTrackDeviceStatusChanged,this),e.removeAllLocalTrack(),e.clear(),e.destroy()}}),Object.defineProperty(o.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof Ii&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(o.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return s(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new Es(e))];case 1:return r=n.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(o.prototype,"_onLocalTrackDeviceStatusChanged",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._invoker.push(new Ns(e,t))}}),Object.defineProperty(o.prototype,"_onLocalTrackSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i=this,o=null===(r=e.__innerGetMediaStreamTrack())||void 0===r?void 0:r.id;o&&clearTimeout(this._trackSentTimer[o]);var a=this._context.getNaviInfo(),s=(null==a?void 0:a.pauseVideoDelayMs)||-1;-1!==s&&o&&(t?this._trackSentTimer[o]=setTimeout((function(){i._logger.info(n.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!0})),i._peerConnection.disableSenderEncodingsByTrackId(o)}),s):(this._logger.info(n.L_PAUSE_VIDEO_R,JSON.stringify({userId:e.getUserId(),trackId:e.getTrackId(),state:!1})),this._peerConnection.enableSenderEncodingsByTrackId(o)))}}),Object.defineProperty(o.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._invoker.push(new Ts(e))]}))}))}}),Object.defineProperty(o.prototype,"_onAudioNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=Date.now();this._invoker.store.setMeetingAudioSubCommandStamp(t),this._invoker.push(new Vs(e.map((function(e){return e.ssrc})),this._context.logger,0,t))}}),Object.defineProperty(o.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){return[2,this._invoker.push(new Os)]}))}))}}),Object.defineProperty(o.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._invoker.push(new Ss(e))]}))}))}}),Object.defineProperty(o.prototype,"_getResourceById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getPublishedResourceByTrackId(e)}}),Object.defineProperty(o.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=Fi(e).identifier,n=this._store.getUserIdByMeid(r);return!!(null===(t=this._store.getResourcesByUserId(n))||void 0===t?void 0:t.find((function(t){return Vi(t)===e})))}}),Object.defineProperty(o.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return 0===(e=e.filter((function(e){return e instanceof ba?e instanceof ha:e.track instanceof ha}))).length?[2,{code:exports.RCRTCCode.SUCCESS}]:[2,this._invoker.push(new oc(e))]}))}))}}),Object.defineProperty(o.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){return 0===(t=e.filter((function(e){return e instanceof ha}))).length?[2,{code:exports.RCRTCCode.SUCCESS}]:[2,this._invoker.push(new Ma(t))]}))}))}}),Object.defineProperty(o.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){return 0===(e=e.filter((function(e){return e instanceof ba?e instanceof ha:e.track instanceof ha}))).length?[2,{code:exports.RCRTCCode.SUCCESS}]:[2,this._invoker.push(new Da(e))]}))}))}}),Object.defineProperty(o.prototype,"_reupdateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.getRemoteTracks().filter((function(e){return e.isVideoTrack()}));return this._invoker.push(new Da(e,!0))}}),Object.defineProperty(o.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(o.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(o.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(o.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(o.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(o.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,listener:e&&Object.keys(e)})),this._reportListener=e,this._peerConnection.registerReportListener(e)}}),Object.defineProperty(o.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(n.L_ABSTRACT_ROOM_AUDIO_LEVEL_O,JSON.stringify({status:i.SUCCEEDED,handler:null==e?void 0:e.name,gap:t})),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(o.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._invoker.push(new Ps)}}),Object.defineProperty(o.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(o.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:i.SUCCEEDED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(o.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),o}(e.EventEmitter),uc=function(){function t(e){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_audioDeviceStatusCheckTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_currentAudioRecordStatus",{enumerable:!0,configurable:!0,writable:!0,value:exports.RCRTCAudioRecordStatus.Resume}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isElectron",{enumerable:!0,configurable:!0,writable:!0,value:/Electron/.test(navigator.userAgent)}),this._logger=e.logger}return Object.defineProperty(t.prototype,"_getMediaStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t="getUserMedia"),a(this,void 0,void 0,(function(){var r,i,o,a,c,u,l;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),r=this.setConstraintsConfig(e),[4,navigator.mediaDevices[t](r)];case 1:return i=s.sent(),"getDisplayMedia"===t?[2,{code:exports.RCRTCCode.SUCCESS,stream:i}]:(o=i.getAudioTracks()[0],a=i.getVideoTracks()[0],c=void 0,u=new MediaStream,o&&u.addTrack(o),a&&(c=ei(),u.addTrack(a)),[2,{code:exports.RCRTCCode.SUCCESS,stream:u,uuid:{audioTrackUUID:undefined,videoTrackUUID:c}}]);case 2:return"Permission denied"===(l=s.sent()).message?[2,{code:exports.RCRTCCode.BROWSER_PERMISSION_DENIED}]:"Permission denied by system"===l.message?[2,{code:exports.RCRTCCode.SYSTEM_PERMISSION_DENIED}]:(this._logger.error(n.L_GET_USER_MEDIA_E,JSON.stringify({error:l})),[3,3]);case 3:return[2,{code:"getUserMedia"===t?exports.RCRTCCode.GET_USER_MEDIA_FAILED:exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED}]}}))}))}}),Object.defineProperty(t.prototype,"_getMediaStreamErrorReason",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="";switch(e){case exports.RCRTCCode.BROWSER_PERMISSION_DENIED:t="Permission denied";break;case exports.RCRTCCode.SYSTEM_PERMISSION_DENIED:t="Permission denied by system";break;case exports.RCRTCCode.GET_USER_MEDIA_FAILED:t="getUserMedia failed";break;case exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED:t="getDisplayMedia failed"}return t}}),Object.defineProperty(t.prototype,"setConstraintsConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(null==e?void 0:e.audio){"boolean"==typeof e.audio&&(e.audio={});var t=navigator.mediaDevices.getSupportedConstraints();t.noiseSuppression&&(e.audio.noiseSuppression=!!t.noiseSuppression),t.autoGainControl&&(e.audio.autoGainControl=!!t.autoGainControl),t.echoCancellation&&(e.audio.echoCancellation=!!t.echoCancellation),this._logger.info(n.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(t)))}return e}}),Object.defineProperty(t.prototype,"_check",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=Ne.getMemo();t.audioRecordInputZeroCount=0,this._currentAudioRecordStatus=exports.RCRTCAudioRecordStatus.Resume,clearInterval(this._audioDeviceStatusCheckTimer),this._audioDeviceStatusCheckTimer=setInterval((function(){var r,n,i,o,a=null===(r=t.crtRoom)||void 0===r?void 0:r.getLocalTracks().filter((function(e){return e.isAudioTrack()&&e.getTag()===Uc.DEFAULT}))[0];if(a){var s=(null===(n=null==a?void 0:a.__innerGetMediaStreamTrack())||void 0===n?void 0:n.label)||"",c=(null===(o=null===(i=null==a?void 0:a.__innerGetMediaStreamTrack())||void 0===i?void 0:i.getSettings())||void 0===o?void 0:o.deviceId)||"";if(t.audioRecordInputZeroCount>=2&&e._currentAudioRecordStatus===exports.RCRTCAudioRecordStatus.Resume){e._currentAudioRecordStatus=exports.RCRTCAudioRecordStatus.Error,$n.debug("audio device error: ",{deviceName:s,deviceId:c});var u=(null==a?void 0:a.getDeviceAvailable(!0))|exports.RCRTCStreamCode.RCRTCStreamCodeCantRecordAudioData;null==a||a.updateDeviceAvailable(u)}else if(0===t.audioRecordInputZeroCount&&e._currentAudioRecordStatus===exports.RCRTCAudioRecordStatus.Error){e._currentAudioRecordStatus=exports.RCRTCAudioRecordStatus.Resume,$n.debug("audio device resume: ",{deviceName:s,deviceId:c});u=(null==a?void 0:a.getDeviceAvailable(!0))&~exports.RCRTCStreamCode.RCRTCStreamCodeCantRecordAudioData;null==a||a.updateDeviceAvailable(u)}}}),1e3)}}),Object.defineProperty(t.prototype,"createMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e=Uc.DEFAULT),a(this,void 0,void 0,(function(){var r,o,a,c,u,l,d,p,_;return s(this,(function(s){switch(s.label){case 0:return xi(e)?(r=this._context.getCurrentId())?[4,this._getMediaStream({audio:{deviceId:null==t?void 0:t.micphoneId,sampleRate:null==t?void 0:t.sampleRate,noiseSuppression:null==t?void 0:t.noiseSuppression,echoCancellation:null==t?void 0:t.echoCancellation,autoGainControl:null==t?void 0:t.autoGainControl}})]:(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId",options:t})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag",options:t})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return o=s.sent(),a=o.stream,c=o.code,u=o.uuid,l=(u||{}).audioTrackUUID,c!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:i.FAILED,code:c,msg:this._getMediaStreamErrorReason(c),options:t})),[2,{code:c}]):(d=a.getAudioTracks()[0],p=null,_=zi(this._context.getCurrentId()),p=new wi(this._logger,e,r,_,d,l),this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:i.SUCCEEDED,trackId:p.getTrackId(),options:t})),[2,{code:c,track:p}])}}))}))}}),Object.defineProperty(t.prototype,"createCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e=Uc.DEFAULT),a(this,void 0,void 0,(function(){var r,o,a,c,u,l,d,p,_,f,b,m,h,g,v,R,C;return s(this,(function(s){switch(s.label){case 0:return xi(e)?(r=this._context.getCurrentId())?(o=Zi(null==t?void 0:t.resolution)?t.resolution:exports.RCResolution.W640_H480,a=Yi(o),c=a.width,u=a.height,[4,this._getMediaStream({video:{deviceId:null==t?void 0:t.cameraId,frameRate:Xi((null==t?void 0:t.frameRate)||exports.RCFrameRate.FPS_15),width:c,height:u,facingMode:null==t?void 0:t.faceMode}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId",options:t})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag",options:t})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return l=s.sent(),d=l.stream,p=l.code,_=l.uuid,f=(_||{}).videoTrackUUID,p!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:i.FAILED,code:p,msg:this._getMediaStreamErrorReason(p),options:t})),[2,{code:p}]):(b=d.getVideoTracks()[0],m=zi(this._context.getCurrentId()),h=new ki(this._logger,e,r,m,b,f),(null==t?void 0:t.bitrate)&&(g=t.bitrate,v=g.max,R=g.min,C=g.start,h.setBitrate(v,R,C)),this._logger.info(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:i.SUCCEEDED,trackId:h.getTrackId(),options:t})),[2,{code:p,track:h}])}}))}))}}),Object.defineProperty(t.prototype,"createMicrophoneAndCameraTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,o,c,u;return void 0===e&&(e=Uc.DEFAULT),a(this,void 0,void 0,(function(){var a,l,d,p,_,f,b,m,h,g,v,R,C,T,S,y=this;return s(this,(function(s){switch(s.label){case 0:return a=[],xi(e)?(l=this._context.getCurrentId())?(d=Zi(null===(r=null==t?void 0:t.video)||void 0===r?void 0:r.resolution)?t.video.resolution:exports.RCResolution.W640_H480,p=Yi(d),_=p.width,f=p.height,b=null==t?void 0:t.audio,[4,this._getMediaStream({video:{deviceId:null===(o=null==t?void 0:t.video)||void 0===o?void 0:o.cameraId,frameRate:Xi((null===(c=null==t?void 0:t.video)||void 0===c?void 0:c.frameRate)||exports.RCFrameRate.FPS_15),width:_,height:f,facingMode:null===(u=null==t?void 0:t.video)||void 0===u?void 0:u.faceMode},audio:{deviceId:null==b?void 0:b.micphoneId,sampleRate:null==b?void 0:b.sampleRate,noiseSuppression:null==b?void 0:b.noiseSuppression,echoCancellation:null==b?void 0:b.echoCancellation,autoGainControl:null==b?void 0:b.autoGainControl}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId",options:t})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag",options:t})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:a}]);case 1:return m=s.sent(),h=m.stream,g=m.code,v=m.uuid,C=(R=v||{}).audioTrackUUID,T=R.videoTrackUUID,g!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:i.FAILED,code:g,msg:this._getMediaStreamErrorReason(g),options:t})),[2,{code:g,tracks:a}]):(S=zi(this._context.getCurrentId()),h.getTracks().forEach((function(r){var n,i;if("video"===r.kind){var o=new ki(y._logger,e,l,S,r,T);if(null===(n=null==t?void 0:t.video)||void 0===n?void 0:n.bitrate){var s=null===(i=t.video)||void 0===i?void 0:i.bitrate,c=s.max,u=s.min,d=s.start;o.setBitrate(c,u,d)}a.push(o)}else a.unshift(new wi(y._logger,e,l,S,r,C))})),this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:i.SUCCEEDED,trackIds:a.map((function(e){return e.getTrackId()})),options:t})),[2,{code:g,tracks:a}])}}))}))}}),Object.defineProperty(t.prototype,"createScreenVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),a(this,void 0,void 0,(function(){var r;return s(this,(function(i){switch(i.label){case 0:return[4,this._createScreenTracks(e,!1,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,t)];case 1:return(r=i.sent()).code===exports.RCRTCCode.SUCCESS?[2,{code:r.code,track:r.tracks[0]}]:[2,r]}}))}))}}),Object.defineProperty(t.prototype,"createScreenWithAudioTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),a(this,void 0,void 0,(function(){return s(this,(function(r){return[2,this._createScreenTracks(e,!0,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,t)]}))}))}}),Object.defineProperty(t.prototype,"_createScreenTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o){return a(this,void 0,void 0,(function(){var a,c,u,l,d,p,_,f,b,m,h,g,v;return s(this,(function(s){switch(s.label){case 0:return a=zi(this._context.getCurrentId()),xi(e)?(c=this._context.getCurrentId())?to()?(u=/macintosh|mac os x/i.test(navigator.userAgent),l=(!this._isElectron||!u)&&t,d=Zi(null==o?void 0:o.resolution)?o.resolution:exports.RCResolution.W1280_H720,this._isElectron?[4,this._createElectronScreenStream(t,r,d,null==o?void 0:o.chromeMediaSourceId)]:[3,2]):(this._logger.error(n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),[2,{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT}]):(this._logger.error(r,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(r,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return b=s.sent(),[3,4];case 2:return[4,this._createWebScreenStream(t,d,null==o?void 0:o.frameRate)];case 3:b=s.sent(),s.label=4;case 4:return _=(p=b).stream,(f=p.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(r,JSON.stringify({status:i.FAILED,code:f,msg:this._getMediaStreamErrorReason(f)})),[2,{code:f}]):(m=_.getVideoTracks()[0],h=new Ni(this._logger,e,c,a,m),g=[h],l&&(v=_.getAudioTracks()[0])&&g.push(new Di(this._logger,e,c,a,v)),this._logger.info(r,JSON.stringify({status:i.SUCCEEDED,trackIds:g.map((function(e){return e.getTrackId()}))})),[2,{code:f,tracks:g}])}}))}))}}),Object.defineProperty(t.prototype,"_createElectronScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,o){var c,u;return a(this,void 0,void 0,(function(){var a,l,d,p,_,f,b;return s(this,(function(s){return a=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&a&&t&&this._logger.warn(r,JSON.stringify({status:i.INFO,code:exports.RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),l=(!this._isElectron||!a)&&t,!this._isElectron||e.isUndefined(o)||e.isString(o)?(d=Yi(n),p=d.width,_=d.height,f={mandatory:{chromeMediaSourceId:o,chromeMediaSource:"desktop",minWidth:p,maxWidth:p,minHeight:_,maxHeight:_}},o&&(null===(c=f.mandatory)||void 0===c||delete c.chromeMediaSourceId),b=null,l&&this._isElectron&&(null===(u=f.mandatory)||void 0===u||delete u.chromeMediaSourceId,b={mandatory:{chromeMediaSource:"desktop"}}),[2,this._getMediaStream({video:f,audio:b||l},"getUserMedia")]):(this._logger.error(r,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"_createWebScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i,o,a;return s(this,(function(s){return n=Yi(t),i=n.width,o=n.height,a={frameRate:Xi(r||exports.RCFrameRate.FPS_15),width:i,height:o},[2,this._getMediaStream({video:a,audio:e},"getDisplayMedia")]}))}))}}),Object.defineProperty(t.prototype,"createLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,o,a;return s(this,(function(s){return r=zi(this._context.getCurrentId()),xi(e)?t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind?(o=this._context.getCurrentId())?(a=new Oi(this._logger,e,o,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:i.SUCCEEDED,trackId:a.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"createLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,o,a;return s(this,(function(s){return r=zi(this._context.getCurrentId()),xi(e)?t&&t instanceof MediaStreamTrack&&"video"===t.kind?(o=this._context.getCurrentId())?(a=new Ii(this._logger,e,o,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:i.SUCCEEDED,trackId:a.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"_validateCreateLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(!xi(t))return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),{code:exports.RCRTCCode.INVALID_TAGS,tracks:[]};if(!eo())return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,tracks:[]};var o=r instanceof File?URL.createObjectURL(r):r;return e.isHttpUrl(o)||/^blob:/.test(o)?this._context.getCurrentId()?{code:exports.RCRTCCode.SUCCESS,tracks:[],url:o}:(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:exports.RCRTCCode.INVALID_USER_ID,tracks:[]}):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> file"})),{code:exports.RCRTCCode.PARAMS_ERROR,tracks:[]})}}),Object.defineProperty(t.prototype,"createLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,o){return a(this,void 0,void 0,(function(){var c,l,d,p=this;return s(this,(function(_){return c=zi(this._context.getCurrentId()),(l=this._validateCreateLocalFileTracks(e,r)).code!==exports.RCRTCCode.SUCCESS?[2,l]:(d=this._context.getCurrentId(),[2,new Promise((function(r){var _=document.createElement("video");(null==o?void 0:o.withoutAudio)&&(_.muted=!0),_.onloadedmetadata=function(){return a(p,void 0,void 0,(function(){var a,l,p,f,b,m;return s(this,(function(s){a=[];try{p=_.mozCaptureStream?"mozCaptureStream":"captureStream",l=_[p]()}catch(e){this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:a})}return f=u(t.getTracksWithOptions(l,o),2),b=f[0],m=f[1],b&&a.push(new Ai(this._logger,e,d,c,b,_)),m&&a.push(new Pi(this._logger,e,d,c,m,_)),0===a.length&&(_.pause(),_.src=""),_.onerror=null,this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:i.SUCCEEDED,trackIds:a.map((function(e){return e.getTrackId()}))})),r({code:exports.RCRTCCode.SUCCESS,tracks:a}),[2]}))}))},_.onerror=function(){p._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:[]})},_.src=l.url,_.loop=!0,_.play()}))])}))}))}}),Object.defineProperty(t.prototype,"createLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,o){return a(this,void 0,void 0,(function(){var a,c,l,d,p,_;return s(this,(function(s){return a=[],c=zi(this._context.getCurrentId()),xi(e)?r instanceof MediaStream?(l=this._context.getCurrentId())?(d=u(t.getTracksWithOptions(r,o),2),p=d[0],_=d[1],p&&a.push(new Oi(this._logger,e,l,c,p)),_&&a.push(new Ii(this._logger,e,l,c,_)),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:i.SUCCEEDED,trackIds:a.map((function(e){return e.getTrackId()}))})),[2,{code:exports.RCRTCCode.SUCCESS,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> stream"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:a}])}))}))}}),Object.defineProperty(t,"getTracksWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],r[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],r}}),t}(),lc=function(t){function o(e,r,n){var i=t.call(this,e)||this;return Object.defineProperty(i,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(i,"_options",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(i,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(i,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),jo.setSdpSemantics(n.sdpSemantics||"unified-plan",i._logger),i._service=new bi(i._runtime,i._context,i._options.mediaServer,i._options.timeout),i._context.registerConnectionStateChangeListener(i._onIMStatusChange.bind(i)),i._context.registerDestroyListener(i._onIMUninit.bind(i)),i._context.registerMessageListener(i._handleMessage.bind(i)),i._context.getPluginContext().onnavidatachange=i.naviDataChange.bind(i),i}return r(o,t),Object.defineProperty(o.prototype,"_handleMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.conversationType!==e.ConversationType.RTC_ROOM)return!1;var r=this._logger.createTraceId();return this._logger.info(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:i.SUCCEEDED,message:t}),r),this._crtRoom?(this._crtRoom.__parseInnerMessage(t,r),!0):(this._logger.warn(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:i.FAILED,message:"the crtRoom is empty"}),r),!0)}}),Object.defineProperty(o.prototype,"naviDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.detectorMediaSever(),ua.logServer=null==e?void 0:e.logServer,ua.dc=null==e?void 0:e.dc}}),Object.defineProperty(o.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(o.prototype,"setCustomExtendInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return this._logger.info(n.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_T,"info: ".concat(t)),e.isString(t)?(this._service.setCustomExtendInfo(t),this._logger.info(n.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R,"code: ".concat(exports.RCRTCCode.SUCCESS)),{code:exports.RCRTCCode.SUCCESS}):(this._logger.info(n.L_RTC_CLIENT_SET_CUSTOM_EXTEND_INFO_R,"code: ".concat(exports.RCRTCCode.PARAMS_ERROR)),{code:exports.RCRTCCode.PARAMS_ERROR})}}),Object.defineProperty(o.prototype,"joinCrossRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=exports.RTCMode.CROSS_MUTI),a(this,void 0,void 0,(function(){return s(this,(function(n){return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{joinType:t,userData:r,mode:exports.RTCMode.CROSS_MUTI})]}))}))}}),Object.defineProperty(o.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return void 0===i&&(i=exports.RTCMode.RTC),a(this,void 0,void 0,(function(){return s(this,(function(n){return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{mode:i,joinType:t,userData:r})]}))}))}}),Object.defineProperty(o.prototype,"joinRTCRoomWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r,o,a,c,u=this;return s(this,(function(s){switch(s.label){case 0:return r=this._logger.createTraceId(),(o=Ne.getMemo()).roomType=null==t?void 0:t.mode,this._logger.info(n.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(a=this._crtRoom=new Bs(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt)).__innerInit(null==t?void 0:t.mode,null==t?void 0:t.joinType,void 0,null==t?void 0:t.userData,r)];case 1:return(c=s.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:c}]):(a.once(Us,(function(){u._service.clearClusterId(),ii(u._runtime,u._context),u._crtRoom=null})),o.crtRoom=a,this._joinRoomSucceed(),[2,{code:c,room:a,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()}])}}))}))}}),Object.defineProperty(o.prototype,"joinMeetingRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,o){return void 0===o&&(o=!1),a(this,void 0,void 0,(function(){var a,c,u,l,d=this;return s(this,(function(s){switch(s.label){case 0:return a=this._logger.createTraceId(),(c=Ne.getMemo()).roomType=exports.RTCMode.MEETING,this._logger.info(n.L_RTC_JOIN_MEETING_ROOM_T,JSON.stringify({roomId:e,joinType:t,outerUserDatas:r}),a),this._crtRoom?(this._logger.error(n.L_RTC_JOIN_MEETING_ROOM_R,JSON.stringify({status:i.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),a),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(u=this._crtRoom=new cc(this._context,this._runtime,e,this._service,this._options,ei(),o)).__innerInit(t,void 0,r,a)];case 1:return(l=s.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:l}]):(u.once(Us,(function(){d._service.clearClusterId(),ii(d._runtime,d._context),d._crtRoom=null})),c.crtRoom=u,this._joinRoomSucceed(),[2,{code:l,room:u,userIds:u.getRemoteUserIds(),tracks:u.getRemoteTracks()}])}}))}))}}),Object.defineProperty(o.prototype,"_onIMStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(this._logger.info(n.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:t,code:r,desc:e.RCConnectionStatus[t]})),t===e.RCConnectionStatus.DISCONNECTED){if(this._crtRoom){var i=exports.RCKickReason.IM_DISCONNECTED;r===e.ErrorCode.RC_DISCONN_KICK?i=exports.RCKickReason.OTHER_CLIENT_IM_CONNECTED:2===r&&(i=exports.RCKickReason.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:i}]})}}else t===e.RCConnectionStatus.CONNECTED&&this._service.detectorMediaSever();this._crtRoom&&(ii(this._runtime,this._context),this._service.detectorMediaSever(!0),this._crtRoom.__onReconnected())}}),Object.defineProperty(o.prototype,"_onIMUninit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;this._logger.info(n.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"User destroys IM client"})),t=this._context.getCurrentId(),window.localStorage.removeItem("__meid_".concat(t,"__")),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}}),Object.defineProperty(o.prototype,"leaveRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),t),this._crtRoom?[4,this._crtRoom.__destroy(!0)]:(this._logger.warn(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:i.FAILED,msg:"Room does not exist, without leave"}),t),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return r.sent(),this._service.detectorMediaSever(!0),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:i.SUCCEEDED,roomId:this._crtRoom.getRoomId()}),t),this._crtRoom=null,[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(o.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return a(this,void 0,void 0,(function(){var t,r,o,a,c;return s(this,(function(s){switch(s.label){case 0:return t=this._logger.createTraceId(),r=this._context.getCurrentId(),this._logger.info(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:r}),t),[4,this._context.getRTCJoinedUserInfo(r)];case 1:return o=s.sent(),a=o.code,c=o.data,a!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:i.FAILED,code:a}),t),[2,{code:a}]):(this._logger.info(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:i.SUCCEEDED,roomInfo:c}),t),[2,{code:exports.RCRTCCode.SUCCESS,data:c}])}}))}))}}),Object.defineProperty(o.prototype,"setMediaServerUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e){""===e&&this._service.clearCacheMsList(),this._context.setMediaServerUrl(e)}}),Object.defineProperty(o.prototype,"createCodec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.createCodec(e,t)}}),Object.defineProperty(o.prototype,"rtcSignaling",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return a(this,void 0,void 0,(function(){return s(this,(function(i){return[2,this._context.rtcSignaling(e,t,r,n)]}))}))}}),Object.defineProperty(o.prototype,"getDeviceId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getPluginContext().getDeviceId()}}),Object.defineProperty(o.prototype,"getIMStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getConnectionStatus()}}),Object.defineProperty(o.prototype,"getVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=exports.RCResolution["W_".concat(e,"H_").concat(t)];return r||exports.RCResolution.W640_H360}}),Object.defineProperty(o.prototype,"getVideoFps",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=exports.RCFrameRate["FPS_".concat(e)];return t||exports.RCFrameRate.FPS_15}}),Object.defineProperty(o.prototype,"setAudioRecordStatusListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._context.registerAudioRecordStatusChangedListener(e)}}),Object.defineProperty(o.prototype,"_joinRoomSucceed",{enumerable:!1,configurable:!0,writable:!0,value:function(){Ne.getMemo().rtcConfig=window.sessionStorage.getItem("__rtc_config__")}}),o}(uc);exports.BackgroundPictureFillMode=void 0,(Js=exports.BackgroundPictureFillMode||(exports.BackgroundPictureFillMode={}))[Js.CROP=1]="CROP",Js[Js.WHOLE=2]="WHOLE",exports.MixLayoutMode=void 0,(Hs=exports.MixLayoutMode||(exports.MixLayoutMode={}))[Hs.CUSTOMIZE=1]="CUSTOMIZE",Hs[Hs.SUSPENSION=2]="SUSPENSION",Hs[Hs.ADAPTATION=3]="ADAPTATION",exports.MixVideoRenderMode=void 0,(Gs=exports.MixVideoRenderMode||(exports.MixVideoRenderMode={}))[Gs.CROP=1]="CROP",Gs[Gs.WHOLE=2]="WHOLE",exports.RTCJoinType=void 0,(Ks=exports.RTCJoinType||(exports.RTCJoinType={}))[Ks.KICK=0]="KICK",Ks[Ks.REFUSE=1]="REFUSE",Ks[Ks.COEXIST=2]="COEXIST";var dc,pc="rtcRJoin_data",_c="rtcRExit",fc="rtcRInfo",bc="rtcUData",mc="rtcUDel",hc="rtcSetData",gc="userSetData",vc="rtcQryData",Rc="rtcDelData",Cc="rtcToken",Tc="rtcUserState",Sc="rtcUList",yc="rtcPullKv",Ec="rtcQueryJoined",Oc="rtcPullRoomStatus",Ic="reportsdk",Lc="rtcPing";!function(e){e.RtcInput="RtcInput",e.RtcOutput="RtcOutput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcRoomStatusInput="RtcRoomStatusInput",e.RtcRoomStatusOutput="RtcRoomStatusOutput",e.RtcReportSDKInput="RtcReportSDKInput",e.RtcPBPolaris="RCRTCPBPolaris",e.RtcPBR1Info="RCRTCPBR1Info",e.RtcPBR2Info="RCRTCPBR2Info",e.RtcPBR3Info="RCRTCPBR3Info",e.RtcPBR4Info="RCRTCPBR4Info",e.RtcPBStatusInfo="RCRTCPBStatusInfo",e.RtcPBStreamInfo="RCRTCPBStreamInfo",e.RCRTCPBPolarisCombine="RCRTCPBPolarisCombine",e.RCRTCPBReceiveAudioInfo="RCRTCPBReceiveAudioInfo",e.RCRTCPBSendAudioInfo="RCRTCPBSendAudioInfo",e.RCRTCPBSendVideoInfo="RCRTCPBSendVideoInfo",e.RCRTCPBReceiveVideoInfo="RCRTCPBReceiveVideoInfo",e.RCRTCPBR3R4Info="RCRTCPBR3R4Info",e.RtcPBCallAndJoinRoomReq="Call_CallAndJoinRoomReq",e.RtcPBJoinRoomReq="Call_JoinRoomReq",e.RtcPBStream="Call_StreamRes",e.RtcPBCallAndJoinRoomRes="Call_CallAndJoinRoomResp",e.RtcPBAcceptAndJoinRoomReq="Call_CallAndJoinRoomReq",e.RtcPBAcceptAndJoinRoomRes="Call_CallAndJoinRoomResp",e.RtcPBJoinRoomRes="Call_JoinRoomResp",e.RtcPBHangupAndExitRoomReq="Call_CallAndExitRoomReq",e.RtcPBHangupAndExitRoomRes="Call_CallAndExitRoomResp",e.JoinMeetingAndRoomReq="Meeting_JoinMeetingAndRoomReq",e.JoinRoomReq="Meeting_JoinRoomReq",e.JoinMeetingAndRoomResp="Meeting_JoinMeetingAndRoomResp",e.QuickMeetingAndRoomResp="Meeting_QuickMeetingAndRoomResp",e.JoinRoomResp="Meeting_JoinRoomResp",e.RtcRoomUserState="Meeting_RtcRoomUserState",e.LeaveMeetingAndRoomReq="Meeting_LeaveMeetingAndRoomReq",e.GetMeetingAndRoomStateReq="Meeting_GetMeetingAndRoomStateReq",e.GetMeetingAndRoomStateResp="Meeting_GetMeetingAndRoomStateResp",e.GetJoinMeetingStateReq="Meeting_PullJoinMeetingDataReq",e.GetJoinMeetingStateResp="Meeting_PullJoinMeetingDataResp",e.GetRtcRoomStateResp="Meeting_GetRtcRoomStateResp"}(dc||(dc={}));var Pc,Ac=((qs={})[dc.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"],qs[dc.RtcOutput]=["version"],qs[dc.RtcUserListOutput]=["users","token","sessionId","roomInfo","version","meid"],qs[dc.SetUserStatusInput]=["status"],qs[dc.RtcSetDataInput]=["interior","target","key","value","objectName","content"],qs[dc.RtcUserSetDataInput]=["valueInfo","objectName","content"],qs[dc.RtcDataInput]=["interior","target","key","objectName","content"],qs[dc.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],qs[dc.MCFollowInput]=["state"],qs[dc.RtcTokenOutput]=["rtcToken"],qs[dc.RtcQryOutput]=["outInfo"],qs[dc.RtcQryUserOutDataInput]=["userId"],qs[dc.RtcUserOutDataOutput]=["user"],qs[dc.RtcQueryListInput]=["order"],qs[dc.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],qs[dc.RtcValueInfo]=["key","value"],qs[dc.RtcKeyDeleteInput]=["key"],qs[dc.RtcNotifyMsg]=["type","time","roomId","openConnection"],qs[dc.RtcPullKV]=["timestamp","roomId"],qs[dc.RtcKVOutput]=["entries","bFullUpdate","syncTime"],qs[dc.RtcQueryUserJoinedInput]=["userId"],qs[dc.RtcQueryUserJoinedOutput]=["info"],qs[dc.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],qs[dc.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],qs[dc.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],qs[dc.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],qs[dc.RtcRoomStatusInput]=["version"],qs[dc.RtcRoomStatusOutput]=["bFullStatus","version","usersData","roomStatus"],qs[dc.RtcReportSDKInput]=["sdkInfo"],qs[dc.RtcPBPolaris]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"],qs[dc.RtcPBR1Info]=["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion","receiveTime","sequenceId"],qs[dc.RtcPBR2Info]=["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId","receiveTime","userId","sequenceId"],qs[dc.RtcPBR3Info]=["info"],qs[dc.RtcPBR4Info]=["info"],qs[dc.RtcPBStatusInfo]=["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams","googTargetEncBitrate","googRetransmitBitrate","googTransmitBitrate","googBucketDelay","upLinkLossrate","rongNetOffsetMs","rongPreBweBps","rongAvgRttMs","sendAudioStreams","sendVideoStreams","recvAudioStreams","recvVideoStreams","rtcVersion","imVersion","platform","iceStatus","xorMode","subIceStatus","startAudioDeviceCount","sequenceId","rongMaxRttMs","iceDecoupleMode","remoteAddress","deviceInfo","group","micphoneVolume","speakerVolume"],qs[dc.RtcPBStreamInfo]=["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled","userId","state","isActive","streamCode"],qs[dc.RCRTCPBPolarisCombine]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info","r3r4Info","requestId","roomType"],qs[dc.RCRTCPBReceiveAudioInfo]=["streamInfo","ssrc","bytesReceived","retransmitBytes","packetsReceived","rongE2eDelayMs","googDecodingPLC","decodingNormal","muteRate","googDecodingPLCCNG","googExpandRate","googSpeechExpandRate","googAccelerateRate","googPreemptiveExpandRate","googNackMaxContSeqsSent","googPacketLostRate","googNackSeqsSent","googJitterBufferMs","googCurrentDelayMs","freezesDurationMs","rongPlcMs","totalSamplesDuration","maxSeqNum","cdur","audioFrozenDur","audioFrozenCnt","rxQuality","googPreferredJitterBufferMs","googDecodeLostDurationMs","googReportDurationMs","audioPlayFrameRate","audioFecReceived","audioFecDecoded","googMaxJitterBufferSizeMs","googMaxIatMs","googMeanIatMs","googStddevIatMs","audioFrozenDurWithPlc","audioFrozenCntWithPlc","audioFrozenDurWithout3K","audioFrozenCntWithout3K","cdurWithout3K"],qs[dc.RCRTCPBSendAudioInfo]=["streamInfo","ssrc","bytesSent","googTargetEncBitrate","googActualEncBitrate","googRetransmitBitrate","maxSeqNum","txQuality","encodeDurationMs","audioCaptureFrameRate","audioEncodeFrameRate"],qs[dc.RCRTCPBSendVideoInfo]=["streamInfo","ssrc","bytesSent","packetsFractionLost","googTargetEncBitrate","googActualEncBitrate","googRetransmitBitrate","rongFecBitrate","framesEncoded","framesDroppedByCapturer","framesDroppedByBwLimit","framesDroppedByEncoderQueue","framesDroppedByEncoder","googFrameRateInput","videoQp","inputResolution","txQuality","videoMaxEncodeCostTime","videoEncodeFrameRate","googActualTargetEncBitrate","videoDeviceInterrupted","enableVirtualBG"],qs[dc.RCRTCPBReceiveVideoInfo]=["streamInfo","ssrc","bytesReceived","retransmitBytes","FECBytes","googFrameRateInput","googFrameRateDecoded","googFrameRateOutput","googFirstFrameReceivedToDecodedMs","googNackMaxContSeqsSent","googPacketLostRate","googNackSeqsSent","packetsReceived","rongFirstFrameStartedToDecodeMs","packetLoss","freezeCount","freezesDurationMs","pausesCount","pausesDurationMs","googMaxDecodeMs","rongE2eDelayMs","googCurrentDelayMs","googTargetDelayMs","googJitterBufferMs","rongAvSyncMs","discardedPackets","recvFrameCleanCount","cdur","videoFrozenDur","videoFrozenCnt","rxQuality","videoDecodeDropCount","videoMaxDecodeCostTime","videoFrozenDurWithout3K","videoFrozenCntWithout3K","videoFrozenCdurWithout3K"],qs[dc.RCRTCPBR3R4Info]=["info"],qs[dc.RtcPBCallAndJoinRoomReq]=["callReq","joinRoomReq"],qs[dc.RtcPBJoinRoomReq]=["streamResList"],qs[dc.RtcPBStream]=["userId","mediaType","ssrc","deviceStreamRes"],qs[dc.RtcPBCallAndJoinRoomRes]=["callResp","joinRoomResp"],qs[dc.RtcPBJoinRoomRes]=["roomId","roomUserList","streamResList","token","sessionId","offlineKickTime","roomCreateTime","userJoinTime","dataVersion"],qs[dc.RtcPBHangupAndExitRoomReq]=["callReq"],qs[dc.RtcPBHangupAndExitRoomRes]=["callResp","exitRoomResp"],qs[dc.JoinMeetingAndRoomReq]=["joinMeetingReq","joinRoomReq"],qs[dc.JoinRoomReq]=["pullModel"],qs[dc.JoinMeetingAndRoomResp]=["joinMeetingResp","joinRoomResp","maxTime","hasMore","maxJoinIndex"],qs[dc.QuickMeetingAndRoomResp]=["joinMeetingResp","joinRoomResp","maxTime","hasMore"],qs[dc.JoinRoomResp]=["roomId","token","sessionId","offlineKickTime","roomCreateTime","userJoinTime","rtcRoomUserState","openConnection"],qs[dc.RtcRoomUserState]=["userId","rtcValueInfo","syncTime"],qs[dc.LeaveMeetingAndRoomReq]=["leaveMeetingReq","leaveRoomReq"],qs[dc.GetMeetingAndRoomStateReq]=["meetingId","syncTime"],qs[dc.GetMeetingAndRoomStateResp]=["getMeetingStateResp","getRtcRoomStateResp","maxTime","hasMore"],qs[dc.GetJoinMeetingStateReq]=["meetingId","syncTime","joinIndex"],qs[dc.GetJoinMeetingStateResp]=["getMeetingStateResp","getRtcRoomStateResp","maxTime","maxJoinIndex","hasMore"],qs[dc.GetRtcRoomStateResp]=["rtcRoomUserState","leaveUserIds"],qs),wc="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(dc.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(dc.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(dc.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(dc.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(dc.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(dc.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(dc.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(dc.RtcRoomStatusOutput,"{ // rtc 和 living room 拉房间资源状态返回的数据\n required bool bFullStatus =1; //标识此次给的数据是否是全量数据\n required int64 version =2; //当前获取后房间的最大版本号\n repeated RtcUserInfo usersData=3;//如果是全量数据,这个不为空,给的是房间全部的人以及发布的资源\n repeated RtcRoomStatus roomStatus=4;//房间增量数据\n }\n message RtcRoomStatus{ //房间状态变动\n required string userId = 1;//用户ID\n required int32 event = 2;//房间状态变更的event(人员加入/退出/离线/发布资源) (0:加入;1:离开;2:离线;3:资源变动) \n required int64 time = 3;//本次变更的版本号\n repeated RtcValueInfo userData = 4;//用户变更的资源(event为0或者3时可能有值)\n optional int32 switchRoleType = 5;//如果是切换角色导致的加入房间或退出房间的类型\n optional string extra = 6;\n }\n message ").concat(dc.RtcUserListOutput,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n repeated string codeFormat = 8; //当前房间用户支持的编码交集\n optional int64 roomCreateTime = 9;//房间创建时间\n optional int64 userJoinTime = 10;//用户加入房间\n optional int64 version = 11;//当前房间的版本号\n optional string meid=12;\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(dc.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(dc.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(dc.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(dc.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(dc.RtcQryOutput,"{\n repeated ").concat(dc.RtcValueInfo," outInfo=1;\n }\n message ").concat(dc.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(dc.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(dc.RtcUserSetDataInput," {\n repeated ").concat(dc.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(dc.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(dc.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(dc.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(dc.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(dc.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(dc.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(dc.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n optional int32 openConnection = 4;\n }\n message ").concat(dc.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(dc.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(dc.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(dc.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(dc.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n optional string sessionId=4;\n optional int64 roomCreateTime = 5;//房间创建时间\n optional int64 userJoinTime = 6;//用户加入房间\n }\n message ").concat(dc.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(dc.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(dc.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(dc.RtcEndInviteInput,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(dc.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(dc.RtcPBPolaris," {\n required string type = 1;//上报数据类型 R1-R4\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int32 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional ").concat(dc.RtcPBR1Info," r1Info = 10;\n optional ").concat(dc.RtcPBR2Info," r2Info = 11;\n optional ").concat(dc.RtcPBR3Info," r3Info = 12;\n optional ").concat(dc.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(dc.RtcPBR1Info," {\n required int64 joinTime = 1;//用户加入房间的时间\n required string rtcVersion = 2;//Rtc版本号\n required string imVersion = 3;//IM SDK 版本\n required string platform = 4;//平台(如:Android、iOS、Web)\n required string device = 5; //设备信息(手机名称+型号)\n required string os = 6;//系统版本(手机系统版本)\n optional string browserName = 7; //浏览器名称, 没有用 -1 表示\n optional string browserVersion = 8;//浏览器版本, 没有用 -1 表示\n optional int64 receiveTime = 9; // 发送数据的时间\n optional int64 sequenceId = 10;//第一次上报时候生成的连续Id\n }\n message ").concat(dc.RtcPBR2Info," {\n required int64 joinTime = 1;\n required int64 sendTime = 2;\n required string rtcActionType = 3;//发布类型 subscribe : 订阅 publish : 发布\n required string rtcActionStatus = 4;//发布状态 begin : 开始 tend : 结束\n repeated string trackId = 5;\n optional int64 receiveTime = 6; // 发送数据的时间\n optional string userId = 7;//远端用户 Id\n optional int64 sequenceId = 8;//第一次上报时候生成的连续Id\n }\n message ").concat(dc.RtcPBR3Info," {\n required ").concat(dc.RtcPBStatusInfo," info = 1;\n }\n message ").concat(dc.RtcPBR4Info," {\n required ").concat(dc.RtcPBStatusInfo," info = 1;\n }\n message ").concat(dc.RtcPBStatusInfo," {\n optional int64 joinTime = 1;//用户加入房间的时间\n optional int64 receiveTime = 2;//用户发布数据流的时间(毫秒),暂时由客户端生成,后期如果有问题服务端做兜底处理\n optional int64 totalBitRate = 3;//总码率\n optional float appCPUUsage = 4;//APP CPU占用率\n optional float systemCPUUsage = 5;////系统 CPU占用率\n optional float systemCPUFrequency = 6;//系统CPU频率 (安卓8.0以上)\n optional string networkStatus = 7;//实时网络状态(2g、3g、4g、wifi)\n optional int32 googleRTTNetwork = 8;//Goog rtt 网络延迟\n optional string ipAddress = 9; //本地ip地址\n optional string useReceiveBroadBand = 10; //可接收带宽(单位: bit)\n optional string useSendBroadBand = 11;//可用发送带宽(单位: bit)\n optional string packetLossCount = 12;//丢包数\n repeated ").concat(dc.RtcPBStreamInfo," streams = 13;\n optional int64 googTargetEncBitrate = 14;//总的视频编码码率\n optional int64 googRetransmitBitrate = 15;//总视频重传码率\n optional int64 googTransmitBitrate = 16;//实际视频发送总码率\n optional int64 googBucketDelay = 17;//发送缓冲延时\n optional float upLinkLossrate = 18;//上行丢包率\n optional int64 rongNetOffsetMs = 19;//Ntp offset\n optional int64 rongPreBweBps = 20;//Pre bwe\n optional int64 rongAvgRttMs = 21;//平均往返延时\n repeated RCRTCPBSendAudioInfo sendAudioStreams = 22;//音频发送\n repeated RCRTCPBSendVideoInfo sendVideoStreams = 23;//视频发送\n repeated RCRTCPBReceiveAudioInfo recvAudioStreams = 24;//音频接收\n repeated RCRTCPBReceiveVideoInfo recvVideoStreams = 25;//视频接收\n optional string rtcVersion = 26;//RTC版本号\n optional string imVersion = 27;//IM版本号\n optional string platform = 28;//客户端平台\n optional int64 iceStatus = 29;//ICE状态\n optional int64 xorMode = 30;//混淆模式\n optional int64 subIceStatus = 31;//PC meeting模式的下行ice状态\n optional int64 startAudioDeviceCount = 32;//音频设备启动的次数 \n optional int64 sequenceId = 33;//第一次上报时候生成的连续Id\n optional int64 rongMaxRttMs = 34;//最大往返延时\n optional int64 iceDecoupleMode = 35;//ICE解耦模式\n optional string remoteAddress = 36;//服务器ip地址 \n optional string deviceInfo = 37;//设备信息\n optional string group = 38;//配置服务所属group\n optional int64 micphoneVolume = 39; //micphone音量\n optional int64 speakerVolume = 40; //speaker音量\n }\n message ").concat(dc.RtcPBStreamInfo," {\n required string trackId = 1;\n optional string codeName = 2;//编解码名称\n optional string volume = 3;//音频播放音量\n optional int64 samplingRate = 4; //音频采样率\n optional float bitRate = 5;//下行码率\n optional float packetLossRate = 6;\n optional int64 frameRate = 7;//视频接收帧率(单位:fps)\n optional string resolution = 8;//视频分辨率(格式:640*480)\n optional int64 blockTime = 9;//接收卡顿(间隔时间, 单位: ms)\n optional int64 jitterData = 10;//jitter数据抖动\n optional string nAckCount = 11;//nack数量\n optional string pliCount = 12; //PLI请求数\n optional int64 googleRTTTotalTime = 13; //googRtt往返时长\n optional int64 isReceiveFirstFrameRate = 14;//第一个关键帧是否正常收到\n optional string codeType = 15;//编码方式\n optional int64 isEnabled = 16; //track状态是否可用/track是否mute\n optional string userId = 17;\n optional int64 state = 18;//设备开关状态(0:关闭、1:开启) \n optional int64 isActive = 19; // sender发送数据状态,0-false、1-true\n optional int64 streamCode = 20; //远端流采集状态 0-正常,1-异常\n }\n message ").concat(dc.RCRTCPBReceiveAudioInfo," {\n optional ").concat(dc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesReceived = 3;\n optional int64 retransmitBytes = 4;\n optional int64 packetsReceived = 5;\n optional int64 rongE2eDelayMs = 6;//端到端延时\n optional int64 googDecodingPLC = 7; // PLC样点数 音频plc样点(反应卡顿情况)\n optional int64 decodingNormal = 8;\n optional float muteRate = 9;\n optional int64 googDecodingPLCCNG = 10; // PLC次数\n optional float googExpandRate = 11; // 拉伸比率\n optional float googSpeechExpandRate = 12; // 语音拉伸比率\n optional float googAccelerateRate = 13; // 加速比率\n optional float googPreemptiveExpandRate = 14;\n optional int64 googNackMaxContSeqsSent = 15;//近500个包,连续最长请求重传的数目\n optional float googPacketLostRate = 16; //统计周期内的丢包比率\n optional int64 googNackSeqsSent = 17; //累计重传请求包的次数,一个包可能被多次重传\n optional int64 googJitterBufferMs = 18; // 抖动延时\n optional int64 googCurrentDelayMs = 19; // 当前延时\n optional int64 freezesDurationMs = 20; // 总卡顿时长\n optional int64 rongPlcMs = 21; //通话以来,累计PLC时长\n optional float totalSamplesDuration = 22; // 总时长\n optional int64 maxSeqNum = 23;\n optional int64 cdur = 24;//通话时长,单位毫秒\n optional int64 audioFrozenDur = 25; //卡顿时长,单位毫秒,音频卡顿时长增量 \n optional int64 audioFrozenCnt = 26; //音频卡顿次数增量\n optional float rxQuality = 27; //接收网络质量\n optional int64 googPreferredJitterBufferMs = 28; // 目标延时\n optional int64 googDecodeLostDurationMs = 29; // 丢字时长\n optional int64 googReportDurationMs = 30; // 上报周期\n optional int64 audioPlayFrameRate = 31; // 音频播放帧率\n optional int64 audioFecReceived = 32; //周期内收到的音频fec包数\n optional int64 audioFecDecoded = 33; //周期内实际用于音频解码fec包数\n optional int64 googMaxJitterBufferSizeMs = 34;//音频抖动缓冲区最大时长\n optional int64 googMaxIatMs = 35;//音频IAT最大时长\n optional int64 googMeanIatMs = 36;//音频IAT均值时长\n optional int64 googStddevIatMs = 37;//音频IAT标准差时长\n optional int64 audioFrozenDurWithPlc = 38; //包含PLC帧的卡顿时长,单位毫秒,音频卡顿时长增量 \n optional int64 audioFrozenCntWithPlc = 39; //包含PLC帧音频卡顿次数增量 \n optional int64 audioFrozenDurWithout3K = 40; //不包含cdur>3000的音频卡顿时长,单位毫秒,音频卡顿时长增量 \n optional int64 audioFrozenCntWithout3K = 41; //不包含cdur>3000音频卡顿次数增量\n optional int64 cdurWithout3K = 42; //不包含cdur>3000的通话时长,单位毫秒\n }\n message ").concat(dc.RCRTCPBReceiveVideoInfo," {\n optional ").concat(dc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesReceived = 3;\n optional int64 retransmitBytes = 4;\n optional int64 FECBytes = 5;\n optional int64 googFrameRateInput = 6;\n optional int64 googFrameRateDecoded = 7; //视频解码帧率\n optional int64 googFrameRateOutput = 8; //视频渲染帧率\n optional int64 googFirstFrameReceivedToDecodedMs = 9;// 第一帧从接收到解码延时\n optional int64 googNackMaxContSeqsSent = 10;//近500个包,连续最长请求重传的数目\n optional float googPacketLostRate = 11; //统计周期内的丢包比率\n optional int64 googNackSeqsSent = 12; //累计重传请求包的次数,一个包可能被多次重传\n optional int64 packetsReceived = 13;//累计收包数目\n optional int64 rongFirstFrameStartedToDecodeMs = 14; //第一帧从流建立到解码延时\n optional int64 packetLoss = 15; //累计收包数目\n optional int64 freezeCount = 16; // 卡顿次数\n optional int64 freezesDurationMs = 17; // 总卡顿时长\n optional int64 pausesCount = 18; //总暂停次数\n optional int64 pausesDurationMs = 19; // 总暂停时长\n optional int64 googMaxDecodeMs = 20;//近10s最大解码时长(95分位)\n optional int64 rongE2eDelayMs = 21;//端到端延时\n optional int64 googCurrentDelayMs = 22; // 当前延时\n optional int64 googTargetDelayMs = 23; // 目标延时\n optional int64 googJitterBufferMs = 24; // 抖动延时\n optional int64 rongAvSyncMs = 25; // 音视频同步偏差\n optional int64 discardedPackets = 26;//解码前累计主动丢弃帧数目\n optional int64 recvFrameCleanCount = 27; //累计清空frames(解码前的缓冲区)次数\n optional int64 cdur = 28;//通话时长,单位毫秒\n optional int64 videoFrozenDur = 29;//卡顿时长,单位毫秒,视频卡顿时长增量\n optional int64 videoFrozenCnt = 30; //视频卡顿次数增量\n optional float rxQuality = 31; //接收网络质量\n optional int64 videoDecodeDropCount = 32; //视频解码掉帧数\n optional int64 videoMaxDecodeCostTime = 33; //视频解码最大耗时\n optional int64 videoFrozenDurWithout3K = 34; //不包含cdur>3000的视频卡顿时长,单位毫秒,视频卡顿时长增量 \n optional int64 videoFrozenCntWithout3K = 35; //不包含cdur>3000视频卡顿次数增量\n optional int64 videoFrozenCdurWithout3K = 36; //不包含cdur>3000的通话时长,单位毫秒\n }\n message ").concat(dc.RCRTCPBSendAudioInfo," {\n optional ").concat(dc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesSent = 3;\n optional int64 googTargetEncBitrate = 4;\n optional int64 googActualEncBitrate = 5;\n optional int64 googRetransmitBitrate = 6;\n optional int64 maxSeqNum = 7;\n optional float txQuality = 8;\n optional int64 encodeDurationMs = 9; //音频编码耗时\n optional int64 audioCaptureFrameRate = 10; //音频采集帧率 \n optional int64 audioEncodeFrameRate = 11; //音频编码帧率\n }\n message ").concat(dc.RCRTCPBSendVideoInfo," {\n optional ").concat(dc.RtcPBStreamInfo," streamInfo = 1;\n optional int64 ssrc = 2;\n optional int64 bytesSent = 3;\n optional float packetsFractionLost = 4; \n optional int64 googTargetEncBitrate = 5;\n optional int64 googActualEncBitrate = 6;\n optional int64 googRetransmitBitrate = 7;\n optional int64 rongFecBitrate = 8;\n optional int64 framesEncoded = 9;\n optional int64 framesDroppedByCapturer = 10;\n optional int64 framesDroppedByBwLimit = 11;\n optional int64 framesDroppedByEncoderQueue = 12;\n optional int64 framesDroppedByEncoder = 13;\n optional int64 googFrameRateInput = 14;\n optional int64 videoQp = 15;\n optional string inputResolution = 16;\n optional float txQuality = 17;\n optional int64 videoMaxEncodeCostTime = 18;\n optional int64 videoEncodeFrameRate = 19;\n optional int64 googActualTargetEncBitrate = 20;\n optional int64 videoDeviceInterrupted = 21;\n optional int64 enableVirtualBG = 22;\n }\n message ").concat(dc.RCRTCPBR3R4Info," {\n required ").concat(dc.RtcPBStatusInfo," info = 1;\n }\n message ").concat(dc.RCRTCPBPolarisCombine," {\n required string type = 1;//上报数据类型 R1-R4, R1:加入房间动作, R2:发布/订阅动作, R3:发送, R4:接收, R3R4:发布+订阅\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int64 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional RCRTCPBR1Info r1Info = 10;\n optional RCRTCPBR2Info r2Info = 11;\n repeated RCRTCPBR3R4Info r3r4Info = 12;\n optional int64 requestId = 13;\n optional int64 roomType = 14;\n }\n // ---- 北极星数据上报 -------\n // ---- 1v1呼叫并加入房间 ----\n message Call_CallAndJoinRoomReq{ \n required bytes callReq=1; // 加入call参数\n optional bytes joinRoomReq=2; // 加入RTC房间参数\n }\n message Call_JoinRoomReq{ \n repeated Call_StreamRes streamResList=1; \n }\n message Call_StreamRes{ \n required string userId=1;\n required int32 mediaType=2; \n required int32 ssrc=3; //上行不填写,下行如果符合分配规则填写,否则不填写\n repeated Call_DeviceStreamRes deviceStreamRes=4;\n }\n message Call_CallAndJoinRoomResp{ \n required bytes callResp=1; //GroupCallLib 使用\n required bytes joinRoomResp=2; //RongRTCLib 使用\n }\n message Call_JoinRoomResp{ //RongRTCLib 使用\n required string roomId=1;\n repeated RtcUserInfo roomUserList=2;\n repeated Call_StreamRes streamResList=3;\n optional string token=4;\n optional string sessionId=5;\n optional int32 offlineKickTime=6;\n optional int64 roomCreateTime=7;\n optional int64 userJoinTime=8;\n optional int64 dataVersion=9;//当前房间的版本号,用于标识增量更新数据的版本\n }\n message Call_CallAndExitRoomReq{ \n required bytes callReq=1; \n }\n message Call_CallAndExitRoomResp{ \n required bytes callResp=1; \n optional bytes exitRoomResp=2; \n }\n message Call_DeviceStreamRes{\n required int32 ssrc=1;\n required string meid=2; //新增字段,使用 UUID\n }\n // ---- 1v1呼叫并加入房间 ----\n // ---- 加入Meeting和Room开始 ----\n message Meeting_JoinMeetingAndRoomReq{ \n required bytes joinMeetingReq=1; \n optional bytes joinRoomReq=2; \n }\n message Meeting_JoinRoomReq{\n required int32 pullModel=1;\n }\n message Meeting_JoinMeetingAndRoomResp{ \n required bytes joinMeetingResp=1 ;\n required bytes joinRoomResp=2 ;\n required int64 maxTime=3;\n optional int32 hasMore= 4;\n required int32 maxJoinIndex = 5;\n }\n message Meeting_QuickMeetingAndRoomResp{ \n required bytes joinMeetingResp=1;\n required bytes joinRoomResp=2;\n required int64 maxTime=3;\n optional int32 hasMore= 4;\n }\n message ").concat(dc.JoinRoomResp," { \n required string roomId=1;\n optional string token=2;\n optional string sessionId=3; \n optional int32 offlineKickTime=4;\n optional int64 roomCreateTime=5; \n optional int64 userJoinTime=6;\n repeated ").concat(dc.RtcRoomUserState," rtcRoomUserState = 7;\n optional int32 openConnection=8;\n }\n message ").concat(dc.RtcRoomUserState," { \n required string userId = 1;\n repeated ").concat(dc.RtcValueInfo," userRtcKv= 2; \n required int64 syncTime= 3;\n }\n message ").concat(dc.LeaveMeetingAndRoomReq," { \n required bytes leaveMeetingReq=1; \n optional bytes leaveRoomReq=2; \n }\n message LeaveMeetingReq { \n required string mSeqId= 1; \n required string meetingCode= 2; \n }\n message Meeting_PullJoinMeetingDataReq{\n required string meetingId = 1;\n required int64 syncTime = 2;\n required int32 joinIndex = 3;\n }\n message Meeting_PullJoinMeetingDataResp{\n required bytes getMeetingStateResp = 1 ;\n required bytes getRtcRoomStateResp = 2 ;\n required int64 maxTime = 3;\n required int32 maxJoinIndex = 4;\n required int32 hasMore = 5;\n }\n message ").concat(dc.GetMeetingAndRoomStateReq," { \n required string meetingId= 1; \n required int64 syncTime= 2; \n }\n message ").concat(dc.GetRtcRoomStateResp,"{ \n repeated ").concat(dc.RtcRoomUserState," rtcRoomUserState=1;\n repeated string leaveUserIds=2;\n }\n message ").concat(dc.GetMeetingAndRoomStateResp,"{ \n required bytes getMeetingStateResp=1;\n required bytes getRtcRoomStateResp=2;\n required int64 maxTime=3;\n required int32 hasMore=4;\n }\n // ---- 加入Meeting和Room结束 ----\n}\n"),kc=function(e,t,r,n,i,o){var a=n?Object.keys(n).map((function(t){return e.encode(dc.RtcValueInfo,{key:t,value:n[t]},!0)})):void 0,s=i?Object.keys(i).map((function(t){return e.encode(dc.RtcValueInfo,{key:t,value:i[t]},!0)})):void 0;return e.encode(dc.RtcInput,{roomType:t,joinType:r,innerDatas:a,outerDatas:s,supportNtf:o})},Nc=function(t,r){var n=t.decode(dc.RtcUserListOutput,r),i=n.users,o=n.token,a=n.sessionId,s=n.roomInfo,c=n.entries,u=n.offlineKickTime,l=void 0===u?60:u,d=n.codeFormat,p=n.roomCreateTime,_=n.userJoinTime,f=n.version,b=n.meid,m={};return e.forEach(i,(function(t){var r=t.userId,n=t.userData,i={};e.forEach(n,(function(e){var t=e.key,r=e.value;i[t]=r})),m[r]=i})),{users:m,token:o,sessionId:a,roomInfo:s,kvEntries:c,offlineKickTime:l,codeFormat:d,roomCreateTime:so(p),userJoinTime:so(_),version:f,meid:b}},Dc=function(e,t,r,n,i,a){var s,c,u,l,d,p=Ne.getMemo(),_=t.type,f=t.appKey,b=t.sessionId,m=t.roomId,h=t.roomCreateTime,g=t.userId,v=t.userRole,R=t.joinTime,C=t.signalDataCenter,T=t.r1Info,S=t.r2Info,y=t.r3Info,E=t.r4Info,O=t.r3r4Info,I={type:_,appKey:f,sessionId:b,roomId:m,roomCreateTime:h,userId:g,userRole:v,joinTime:R,signalDataCenter:C,iceStatus:t.iceStatus,xorMode:t.xorMode,subIceStatus:t.subIceStatus},L=_o(p.roomType);if(r===$o.R1&&T){var P=e.encode(dc.RtcPBR1Info,T,!0),A=e.encode(dc.RCRTCPBPolarisCombine,o(o({},I),{r1Info:P,requestId:i,roomType:L}));if(!a)return A;null===(s=p.database)||void 0===s||s.put(o(o({time:Number(i),roomType:L},I),{data:P,byteLength:A.byteLength}))}if(r===$o.R2&&S){var w=e.encode(dc.RtcPBR2Info,S,!0);A=e.encode(dc.RCRTCPBPolarisCombine,o(o({},I),{r2Info:w,requestId:i,roomType:L}));if(!a)return A;null===(c=p.database)||void 0===c||c.put(o(o({time:Number(i),roomType:L},I),{data:w,byteLength:A.byteLength}))}if(r===$o.R3&&y){var k=(U=y.info).streams,N=Array.isArray(k)&&k.map((function(t){return t&&e.encode(dc.RtcPBStreamInfo,t,!0)})),D=e.encode(dc.RtcPBStatusInfo,o(o({},U),{streams:N,sequenceId:n}),!0),M=e.encode(dc.RtcPBR3Info,{info:D},!0);A=e.encode(dc.RCRTCPBPolarisCombine,o(o({},I),{r3Info:[M],requestId:i,roomType:L}));if(!a)return A;null===(u=p.database)||void 0===u||u.put(o(o({time:Number(i),roomType:L},I),{data:M,byteLength:A.byteLength}))}if(r===$o.R4&&E){k=(U=E.info).streams,N=Array.isArray(k)&&k.map((function(t){return t&&e.encode(dc.RtcPBStreamInfo,t,!0)})),D=e.encode(dc.RtcPBStatusInfo,o(o({},U),{streams:N,sequenceId:n}),!0);var x=e.encode(dc.RtcPBR4Info,{info:D},!0);A=e.encode(dc.RCRTCPBPolarisCombine,o(o({},I),{r4Info:[x],requestId:i,roomType:L}));if(!a)return A;null===(l=p.database)||void 0===l||l.put(o(o({time:Number(i),roomType:L},I),{data:x,byteLength:A.byteLength}))}if(r===$o.R3R4&&O){k=(U=O.info).streams;var U,j=U.recvVideoStreams,B=U.recvAudioStreams,V=U.sendAudioStreams,F=U.sendVideoStreams,J=(N=Array.isArray(k)&&k.map((function(t){return t&&e.encode(dc.RtcPBStreamInfo,t,!0)})),Array.isArray(j)&&j.map((function(t){return t&&e.encode(dc.RCRTCPBReceiveVideoInfo,t,!0)}))),H=Array.isArray(B)&&B.map((function(t){return t&&e.encode(dc.RCRTCPBReceiveAudioInfo,t,!0)})),G=Array.isArray(V)&&V.map((function(t){return t&&e.encode(dc.RCRTCPBSendAudioInfo,t,!0)})),K=Array.isArray(F)&&F.map((function(t){return t&&e.encode(dc.RCRTCPBSendVideoInfo,t,!0)})),q=(D=e.encode(dc.RtcPBStatusInfo,o(o({},U),{streams:N,recvVideoStreams:J,recvAudioStreams:H,sendAudioStreams:G,sendVideoStreams:K,sequenceId:n,micphoneVolume:p.micphoneVolume,speakerVolume:p.speakerVolume}),!0),e.encode(dc.RCRTCPBR3R4Info,{info:D},!0));A=e.encode(dc.RCRTCPBPolarisCombine,o(o({},I),{r3r4Info:[q],requestId:i,roomType:L}));if(!a)return A;null===(d=p.database)||void 0===d||d.put(o(o({time:Number(i),roomType:L},I),{data:q,byteLength:A.byteLength}))}},Mc=function(){function t(e,t,r){Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"codec",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomCreateTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userJoinTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"staticMediaServerUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"miniSDPCodec",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAudioRecordStatusChanged",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.miniSDPCodec=this.createCodec(si,ci)}return Object.defineProperty(t.prototype,"createCodec",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.context.createCodec(e,t)}}),Object.defineProperty(t.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o,c){return a(this,void 0,void 0,(function(){var a,u,l,d,p,_,f,b,m,h,g,v,R,C,T;return s(this,(function(s){switch(s.label){case 0:return a=kc(this.codec,r,n,i,o,c),[4,this.context.rtcSignaling(t,pc,!0,a)];case 1:return u=s.sent(),l=u.code,d=u.buffer,l===e.ErrorCode.SUCCESS&&d?(p=Nc(this.codec,d),_=p.users,f=p.token,b=p.sessionId,m=p.roomInfo,h=p.kvEntries,g=p.offlineKickTime,v=p.roomCreateTime,R=p.userJoinTime,C=p.version,T=p.meid,this.roomCreateTime=v,this.userJoinTime=R,[2,{code:l,data:{users:_,token:f,sessionId:b,roomInfo:m,kvEntries:h,offlineKickTime:g,version:C,meid:T}}]):[2,{code:l,data:p}]}}))}))}}),Object.defineProperty(t.prototype,"quitRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(dc.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,_c,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,n,i,o,a;return s(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(dc.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,fc,!0,r)];case 1:return n=s.sent(),i=n.code,o=n.buffer,i===e.ErrorCode.SUCCESS&&o&&(a=this.codec.decode(dc.RtcRoomInfoOutput,o)),[2,{code:i,data:a}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,n,i,o,a,c;return s(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(dc.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,bc,!0,r)];case 1:return n=s.sent(),i=n.code,o=n.buffer,i===e.ErrorCode.SUCCESS&&o&&(c=Nc(this.codec,o),a={users:c.users}),[2,{code:i,data:a}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(t.prototype,"removeRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return s(this,(function(n){switch(n.label){case 0:return r=this.codec.encode(dc.RtcKeyDeleteInput,{key:t}),[4,this.context.rtcSignaling(e,mc,!1,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i,o){return a(this,void 0,void 0,(function(){var a;return s(this,(function(s){switch(s.label){case 0:return a=this.codec.encode(dc.RtcSetDataInput,{interior:n,target:i,key:t,value:r,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.context.rtcSignaling(e,hc,!1,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCTotalRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return a(this,void 0,void 0,(function(){var n,i;return s(this,(function(o){switch(o.label){case 0:return n={objectName:r,content:[],valueInfo:[this.codec.encode(dc.RtcValueInfo,{key:"uris",value:t},!0)]},$n.info("setRTCTotalRes: ",n),i=this.codec.encode(dc.RtcUserSetDataInput,n),[4,this.context.rtcSignaling(e,gc,!0,i)];case 1:return[2,o.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i){return a(this,void 0,void 0,(function(){var o,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:return o=this.codec.encode(dc.RtcDataInput,{interior:n,target:i,key:r}),[4,this.context.rtcSignaling(t,vc,!0,o)];case 1:return a=s.sent(),c=a.code,u=a.buffer,c===e.ErrorCode.SUCCESS&&u?(l=this.codec.decode(dc.RtcQryOutput,u).outInfo,d={},l.forEach((function(e){d[e.key]=e.value})),[2,{code:c,data:d}]):[2,{code:c}]}}))}))}}),Object.defineProperty(t.prototype,"removeRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n,i){return a(this,void 0,void 0,(function(){var o;return s(this,(function(a){switch(a.label){case 0:return o=this.codec.encode(dc.RtcDataInput,{interior:r,target:n,key:t,objectName:(null==i?void 0:i.name)||"",content:(null==i?void 0:i.content)||""}),[4,this.context.rtcSignaling(e,Rc,!1,o)];case 1:return[2,a.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return a(this,void 0,void 0,(function(){return s(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){return s(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCToken",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return a(this,void 0,void 0,(function(){var i,o,a,c,u;return s(this,(function(s){switch(s.label){case 0:return i=kc(this.codec,r,n),[4,this.context.rtcSignaling(t,Cc,!0,i)];case 1:return o=s.sent(),a=o.code,c=o.buffer,a===e.ErrorCode.SUCCESS&&c?(u=this.codec.decode(dc.RtcTokenOutput,c).rtcToken,[2,{code:a,data:{rtcToken:u}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"setRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return a(this,void 0,void 0,(function(){var r;return s(this,(function(n){switch(n.label){case 0:return r=this.codec.encode(dc.MCFollowInput,{state:t}),[4,this.context.rtcSignaling(e,Tc,!0,r)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCStateByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n,i,o){return a(this,void 0,void 0,(function(){var a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:if(a="".concat(Date.now()),c=Ne.getMemo(),!(u=Dc(this.codec,n,i,o,a,!1===c.sendQos)))return[2,Xo.REPORT_SUCCESS];l=t,/^https:\/\//.test(t)||(l="https://".concat(t)),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.httpReq({url:"".concat(l,"/rtc/logserver/v2/polaris"),body:u,method:e.HttpMethod.POST,headers:{jwt:bi.jwtToken,"Request-Id":a,"Sequence-Id":o,UserId:this.getCurrentId()},timeout:2e3})];case 2:if(!(d=s.sent()).data)throw new Error("http request fail");return[2,JSON.parse(d.data).resultCode];case 3:return s.sent(),[2,Xo.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"setRTCQosDataByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return a(this,void 0,void 0,(function(){var i,o,a,c,u,l,d,p,_,f,b,m,h,g,v,R,C,T,S,y,E,O;return s(this,(function(s){switch(s.label){case 0:switch(i="".concat(Date.now()),o=n[0],a=o.time,c=o.type,u=o.appKey,l=o.sessionId,d=o.roomId,p=o.roomCreateTime,_=o.userId,f=o.userRole,b=o.joinTime,m=o.signalDataCenter,h=o.iceStatus,g=o.xorMode,v=o.subIceStatus,R=o.roomType,C="",c){case $o.R1:C="r1Info";break;case $o.R2:C="r2Info";break;case $o.R3:C="r3Info";break;case $o.R4:C="r4Info";break;case $o.R3R4:C="r3r4Info"}(O={time:a,type:c,appKey:u,sessionId:l,roomId:d,roomCreateTime:p,userId:_,userRole:f,joinTime:b,signalDataCenter:m,iceStatus:h,xorMode:g,subIceStatus:v,roomType:R})[C]=[],T=O,n.forEach((function(e){var t;null===(t=T[C])||void 0===t||t.push(e.data)})),S=this.codec.encode(dc.RCRTCPBPolarisCombine,T),y=t,/^https:\/\//.test(t)||(y="https://".concat(t)),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.httpReq({url:"".concat(y,"/rtc/logserver/polaris/v2"),body:S,method:e.HttpMethod.POST,headers:{jwt:bi.jwtToken,"Request-Id":i,UserId:this.getCurrentId()},timeout:2e3})];case 2:if(!(E=s.sent()).data)throw new Error("http request fail");return[2,JSON.parse(E.data).resultCode];case 3:return s.sent(),[2,Xo.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"saveRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var n="".concat(Date.now());Dc(this.codec,e,t,r,n,!0)}}),Object.defineProperty(t.prototype,"getRTCUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,n,i,o,a;return s(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(dc.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,Sc,!0,r)];case 1:return n=s.sent(),i=n.code,o=n.buffer,i===e.ErrorCode.SUCCESS&&o?(a=Nc(this.codec,o),[2,{code:i,data:a}]):[2,{code:i}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCJoinedUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,n,i,o,a;return s(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(dc.RtcQueryUserJoinedInput,{userId:t}),[4,this.context.rtcSignaling("",Ec,!0,r)];case 1:return n=s.sent(),i=n.code,o=n.buffer,i===e.ErrorCode.SUCCESS&&o?(a=this.codec.decode(dc.RtcQueryUserJoinedOutput,o).info||[],[2,{code:i,data:a.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:so(e.joinTime)}}))}]):[2,{code:i}]}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return a(this,void 0,void 0,(function(){var r,n,i,a,c,u,l;return s(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(dc.RtcPullKV,{timestamp:0,roomId:t}),[4,this.context.rtcSignaling(t,yc,!0,r)];case 1:return n=s.sent(),i=n.code,a=n.buffer,i!==e.ErrorCode.SUCCESS?[2,{code:i}]:(c=this.codec.decode(dc.RtcKVOutput,a),u=c.entries,l=c.syncTime,u=(u||[]).map((function(e){return o(o({},e),{timestamp:so(e.timestamp)})})),[2,{code:i,data:{kvEntries:u,syncTime:so(l)}}])}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return a(this,void 0,void 0,(function(){var n,i,o,a,c;return s(this,(function(s){switch(s.label){case 0:return n=this.codec.encode(dc.RtcRoomStatusInput,{version:r}),[4,this.context.rtcSignaling(t,Oc,!0,n)];case 1:return i=s.sent(),o=i.code,a=i.buffer,o!==e.ErrorCode.SUCCESS?[2,{code:o}]:(c=this.codec.decode(dc.RtcRoomStatusOutput,a),[2,{code:o,data:c}])}}))}))}}),Object.defineProperty(t.prototype,"decodeRtcNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.decode(dc.RtcNotifyMsg,e),r=t.time,n=t.type,i=t.roomId,o=t.openConnection;return{time:so(r),type:n,roomId:i,openConnection:o}}}),Object.defineProperty(t.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCurrentId()}}),Object.defineProperty(t.prototype,"getNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getNaviInfo()}}),Object.defineProperty(t.prototype,"getConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getConnectionStatus()}}),Object.defineProperty(t.prototype,"getAppkey",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getAppkey()}}),Object.defineProperty(t.prototype,"webRtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,n){return a(this,void 0,void 0,(function(){var i,o,a,c,u;return s(this,(function(s){switch(s.label){case 0:return i=this.codec.encode(dc.RtcInput,{roomType:r,broadcastType:n}),[4,this.context.rtcSignaling(t,Lc,!0,i)];case 1:return o=s.sent(),a=o.code,c=o.buffer,a!==e.ErrorCode.SUCCESS?[2,{code:a}]:((u=this.codec.decode(dc.RtcOutput,c)).version=so(u.version),[2,{code:a,data:u}])}}))}))}}),Object.defineProperty(t.prototype,"rtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return/Electron/.test(navigator.userAgent)?this.context.rtcPingResVersion(e,t,r):this.webRtcPing(e,t,r)}}),Object.defineProperty(t.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this.context.sendMessage(e,t,r)}}),Object.defineProperty(t.prototype,"registerRTCSignalListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.registerRTCSignalListener(e)}}),Object.defineProperty(t.prototype,"registerConnectionStateChangeListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onconnectionstatechange=e}}),Object.defineProperty(t.prototype,"registerDisconnectListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondisconnect=e}}),Object.defineProperty(t.prototype,"registerDestroyListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondestroy=e}}),Object.defineProperty(t.prototype,"registerMessageListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onmessage=e}}),Object.defineProperty(t.prototype,"getCoreVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCoreVersion()}}),Object.defineProperty(t.prototype,"getPluginContext",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context}}),Object.defineProperty(t.prototype,"reportSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.encode(dc.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Ic,!0,t)}}),Object.defineProperty(t.prototype,"setMediaServerUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(t){e.isHttpUrl(t)?this.staticMediaServerUrl=t:this.staticMediaServerUrl=""}}),Object.defineProperty(t.prototype,"rtcSignaling",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,n){return this.context.rtcSignaling(e,t,r,n)}}),Object.defineProperty(t.prototype,"registerAudioRecordStatusChangedListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.onAudioRecordStatusChanged=e}}),t}();!function(e){e.RTC="RTC"}(Pc||(Pc={})),e.VersionManage.add("rtclib","5.7.10-enterprise-lz.50");var xc={tag:"RCRTC",verify:function(t){return"undefined"==typeof isSecureContext||isSecureContext?!!e.VersionManage.validEngine("5.8.2")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-rtc required engine version at least '").concat("5.8.2","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(t,r,i){void 0===i&&(i={});var o=t.createLogger("RCRTC",Pc.RTC);if(i.logLevel&&o.setOutputLevel(i.logLevel),o.warn(n.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.7.10-enterprise-lz.50",Commit:"9fea24ea88b0c3ddc51777b4de5cedc41b8450f4","browserInfo.browser":$i.browser,"browserInfo.supportsUnifiedPlan":$i.supportsUnifiedPlan,"browserInfo.version":$i.version})),e.assert("options",i,e.AssertRules.OBJECT,!0),e.assert("options.mediaServer",i.mediaServer,(function(t){return!(!e.isHttpUrl(t)||"https:"===location.protocol&&!/^https/.test(t))})),e.assert("options.timeout",i.timeout,(function(t){return e.isNumber(t)&&t>=5e3&&t<=3e4})),e.assert("options.pingGap",i.pingGap,(function(t){return e.isNumber(t)&&t>=3e3&&t<=1e4})),null==i?void 0:i.AAAWorklet){e.assert("options.AAAWorklet",i.AAAWorklet,e.AssertRules.OBJECT,!0);var a=i.AAAWorklet,s=a.scriptUrl,c=a.wasmUrl;e.assert("AAAWorklet.scriptUrl",s,e.AssertRules.STRING,!0),e.assert("AAAWorklet.wasmUrl",c,e.AssertRules.STRING,!0),yi.SCRIPT_URL=s,yi.WASM_URL=c}i.encryptor&&(e.assert("options.encrypt",i.encryptor,e.AssertRules.OBJECT,!0),e.assert("options.encrypt.decodeAudio",i.encryptor.decodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.decodeVideo",i.encryptor.decodeVideo,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeAudio",i.encryptor.encodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeVideo",i.encryptor.encodeVideo,(function(e){return"function"==typeof e}),!0),No.init(i.encryptor,o));var u=new Mc(t,o,t.createCodec(Ac,wc));return t.getConnectionStatus()===e.RCConnectionStatus.CONNECTED&&ii(r,u),new lc(u,r,i)}},Uc={DEFAULT:"RongCloudRTC"},jc={transResolution:Yi,transFrameRate:Xi,parseTrackId:Fi,ifSupportLocalFileTrack:eo,ifSupportScreenShare:to};exports.RCAbstractRoom=js,exports.RCCameraVideoTrack=ki,exports.RCLocalAudioTrack=Oi,exports.RCLocalFileAudioTrack=Ai,exports.RCLocalFileTrack=Li,exports.RCLocalFileVideoTrack=Pi,exports.RCLocalTrack=Ei,exports.RCLocalVideoTrack=Ii,exports.RCMediaStreamCapture=uc,exports.RCMeetingRoom=cc,exports.RCMicphoneAudioTrack=wi,exports.RCRTCClient=lc,exports.RCRTCRoom=Bs,exports.RCRemoteAudioTrack=ma,exports.RCRemoteTrack=ba,exports.RCRemoteVideoTrack=ha,exports.RCScreenAudioTrack=Di,exports.RCScreenVideoTrack=Ni,exports.RCTag=Uc,exports.RCTrack=vi,exports.device=ke,exports.helper=jc,exports.installer=xc;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@rongcloud/engine"),t=function(e,r){return t=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])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i,n,o,a=function(){return a=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},a.apply(this,arguments)};function s(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function c(e,t){var r,i,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=o.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function u(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.")}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 d(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,exports.RCRTCCode=void 0,(i=exports.RCRTCCode||(exports.RCRTCCode={}))[i.SUCCESS=1e4]="SUCCESS",i[i.PB_ERROR=40001]="PB_ERROR",i[i.SIGNAL_DISCONNECTED=5e4]="SIGNAL_DISCONNECTED",i[i.PARAMS_ERROR=50001]="PARAMS_ERROR",i[i.REPERT_JOIN_ROOM=50002]="REPERT_JOIN_ROOM",i[i.NOT_IN_ROOM=50003]="NOT_IN_ROOM",i[i.SERVICE_INVALID=50004]="SERVICE_INVALID",i[i.RTC_TOKEN_INVALID=50006]="RTC_TOKEN_INVALID",i[i.SIGNAL_ERROR=53001]="SIGNAL_ERROR",i[i.CREATE_OFFER_FAILED=53003]="CREATE_OFFER_FAILED",i[i.REQUEST_FAILED=53004]="REQUEST_FAILED",i[i.MCU_SERVER_NOT_FOUND=53005]="MCU_SERVER_NOT_FOUND",i[i.BROADCAST_SUB_LIST_NOT_EMPTY=53007]="BROADCAST_SUB_LIST_NOT_EMPTY",i[i.ROOM_HAS_BEEN_DESTROYED=53008]="ROOM_HAS_BEEN_DESTROYED",i[i.NOT_OPEN_VIDEO_AUDIO_SERVER=53009]="NOT_OPEN_VIDEO_AUDIO_SERVER",i[i.GET_USER_MEDIA_FAILED=53010]="GET_USER_MEDIA_FAILED",i[i.GET_DISPLAY_MEDIA_FAILED=53011]="GET_DISPLAY_MEDIA_FAILED",i[i.BROWSER_PERMISSION_DENIED=53012]="BROWSER_PERMISSION_DENIED",i[i.CREATE_CUSTOM_TRACK_FAILED=53013]="CREATE_CUSTOM_TRACK_FAILED",i[i.INVALID_TAGS=53014]="INVALID_TAGS",i[i.INVALID_USER_ID=53015]="INVALID_USER_ID",i[i.CREATE_FILE_TRACK_FAILED=53016]="CREATE_FILE_TRACK_FAILED",i[i.INVALID_FILE_INSTANCE=53017]="INVALID_FILE_INSTANCE",i[i.SET_REMOTE_DESCRIPTION_FAILED=53018]="SET_REMOTE_DESCRIPTION_FAILED",i[i.BROWSER_NOT_SUPPORT=53019]="BROWSER_NOT_SUPPORT",i[i.TRACK_NOT_READY=53020]="TRACK_NOT_READY",i[i.VIDEO_TRACK_MISS_MEDIA_ELEMENT=53021]="VIDEO_TRACK_MISS_MEDIA_ELEMENT",i[i.TRACK_PLAY_ERROR=53022]="TRACK_PLAY_ERROR",i[i.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED=53023]="SIGNAL_AUDIENCE_JOIN_ROOM_FAILED",i[i.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED=53024]="SIGNAL_ROOM_CHANGE_IDENTITY_FAILED",i[i.PACKAGE_ENVIRONMENT_ERROR=53025]="PACKAGE_ENVIRONMENT_ERROR",i[i.PUBLISH_TRACK_LIMIT_EXCEEDED=53026]="PUBLISH_TRACK_LIMIT_EXCEEDED",i[i.CDN_RESOURCE_IS_EMPTY=53027]="CDN_RESOURCE_IS_EMPTY",i[i.SIGNAL_JOIN_RTC_ROOM_REFUSED=53028]="SIGNAL_JOIN_RTC_ROOM_REFUSED",i[i.NO_PERMISSION_TO_USE_REQUESTED_DEVICE=53029]="NO_PERMISSION_TO_USE_REQUESTED_DEVICE",i[i.THE_FUNCTION_IS_DISABLED_IN_PKROOM=53030]="THE_FUNCTION_IS_DISABLED_IN_PKROOM",i[i.SOME_TRACKS_PUBLISH_FAILED=53031]="SOME_TRACKS_PUBLISH_FAILED",i[i.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO=53032]="MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO",i[i.JWT_TIME_OUT=1004]="JWT_TIME_OUT",i[i.SYSTEM_PERMISSION_DENIED=53033]="SYSTEM_PERMISSION_DENIED",i[i.PUBLISH_TRACKS_IS_INVALID=53034]="PUBLISH_TRACKS_IS_INVALID",i[i.TRACK_READYSTATE_IS_ENDED=53035]="TRACK_READYSTATE_IS_ENDED",i[i.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH=53036]="APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH",i[i.LOAD_3A_MODULE_FAILED=53037]="LOAD_3A_MODULE_FAILED",function(e){e.L_INDEX_INSTALL_RTC_PLUGIN_O="L-index_install_rtc_plugin-O",e.L_RTC_CLIENT_IM_CONNECTION_STATE_S="L-rtc_client_im_connection_state-S",e.L_RTC_CLIENT_MESSAGE_O="L-rtc_client_message-O",e.L_RTC_CLIENT_DESTROY_S="L-rtc_client_destroy-S",e.L_RTC_CLIENT_JOIN_RTC_ROOM_T="L-rtc_client_join_rtc_room-T",e.L_RTC_CLIENT_JOIN_RTC_ROOM_O="L-rtc_client_join_rtc_room-O",e.L_RTC_CLIENT_JOIN_RTC_ROOM_R="L-rtc_client_join_rtc_room-R",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_T="L-rtc_client_join_living_room-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_R="L-rtc_client_join_living_room-R",e.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O="L-rtc_client_get_audience_client-O",e.L_RTC_CLIENT_LEAVE_ROOM_T="L-rtc_client_leave_room-T",e.L_RTC_CLIENT_LEAVE_ROOM_R="L-rtc_client_leave_room-R",e.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O="L-rtc_client_create_microphone_audio_track-O",e.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O="L-rtc_client_create_camera_video_track-O",e.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O="L-rtc_client_create_microphone_and_camera_tracks-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O="L-rtc_client_create_screen_video_track-O",e.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O="L-rtc_client_create_screen_video_and_audio_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O="L-rtc_client_create_local_audio_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O="L-rtc_client_create_local_video_track-O",e.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O="L-rtc_client_create_local_file_tracks-O",e.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O="L-rtc_client_create_local_tracks-O",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_join_living_room_as_audience-T",e.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_join_living_room_as_audience_R",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T="L-rtc_client_leave_living_room_as_audience-T",e.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R="L-rtc_client_leave_living_room_as_audience-R",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T="L-rtc_client_upgrade_to_anchor_room-T",e.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R="L-rtc_client_upgrade_to_anchor_room-R",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T="L-rtc_client_downgrade_to_audience_room-T",e.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R="L-rtc_client_downgrade_to_audience_room-R",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T="L-rtc_client_get_joined_room_info-T",e.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R="L-rtc_client_get_joined_room_info-R",e.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O="L-audinence_client_call_onTrackReady-O",e.L_AUDIENCE_CLIENT_SUBSCRIBE_T="L-audinence_client_subscribe-T",e.L_AUDIENCE_CLIENT_SUBSCRIBE_R="L-audinence_client_subscribe-R",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T="L-audinence_client_unsubscribe-T",e.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R="L-audinence_client_unsubscribe-R",e.L_PINGER_START_O="L-pinger_start-O",e.L_PINGER_STOP_O="L-pinger_stop-O",e.L_PINGER_SEND_RTCPING_E="L-pinger_send_rtcping-E",e.L_ABSTRACT_ROOM_SEND_MESSAGE_T="L-abstract_room_send_message-T",e.L_ABSTRACT_ROOM_SEND_MESSAGE_R="L-abstract_room_send_message-R",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T="L-abstract_room_set_room_attribute-T",e.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R="L-abstract_room_set_room_attribute_R",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T="L-abstract_room_delete_room_attribute_T",e.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R="L-abstract_room_delete_room_attribute_R",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T="L-abstract_room_get_room_attribute_T",e.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R="L-abstract_room_get_room_attribute_R",e.L_ABSTRACT_ROOM_PUBLISH_T="L-abstract_room_publish-T",e.L_ABSTRACT_ROOM_PUBLISH_R="L-abstract_room_publish-R",e.L_ABSTRACT_ROOM_PUBLISH_E="L-abstract_room_publish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_T="L-abstract_room_unpublish-T",e.L_ABSTRACT_ROOM_UNPUBLISH_R="L-abstract_room_unpublish-R",e.L_ABSTRACT_ROOM_UNPUBLISH_E="L-abstract_room_unpublish-E",e.L_ABSTRACT_ROOM_UNPUBLISH_P="L-abstract_room_unpublish-P",e.L_ABSTRACT_ROOM_SUBSCRIBE_T="L-abstract_room_subscribe-T",e.L_ABSTRACT_ROOM_SUBSCRIBE_R="L-abstract_room_subscribe-R",e.L_ABSTRACT_ROOM_SUBSCRIBE_E="L-abstract_room_subscribe-E",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_T="L-abstract_room_unsubscribe-T",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_R="L-abstract_room_unsubscribe-R",e.L_ABSTRACT_ROOM_UNSUBSCRIBE_E="L-abstract_room_unsubscribe-E",e.L_APP_CALL_UNSUBSCRIBE_O="L-app_call_unsubscribe-O",e.L_USER_LEFT_UNSUBSCRIBE_O="L-user_left_unsubscribe-O",e.L_RES_UNPUB_UNSUBSCRIBE_O="L-res_unpub_unsubscribe-O",e.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O="L-abstract_room_register_room_event_listener-O",e.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O="L-abstract_room_register_report_listener-O",e.L_ABSTRACT_ROOM_AUDIO_LEVEL_O="L-abstract_room_audio_level-O",e.L_ABSTRACT_ROOM_IM_RECONNECTED_T="L-abstract_room_im_reconnected-T",e.L_ABSTRACT_ROOM_IM_RECONNECTED_R="L-abstract_room_im_reconnected-R",e.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O="L-abstract_room_call_app_listener-O",e.L_ABSTRACT_ROOM_SETBITRATE_O="L-abstract_room_setBitrate-O",e.L_ABSTRACT_ROOM_ONTRACKREADY_O="L-abstract_room_onTrackReady-O",e.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O="L-abstract_room_receive_message-O",e.L_ABSTRACT_ROOM_ONKICKOFF_O="L-abstract_room_onKickoff-O",e.L_LIVING_ROOM_RECONNECTED_T="L-living_room_reconnected-T",e.L_LIVING_ROOM_RECONNECTED_R="L-living_room_reconnected-R",e.L_LIVING_ROOM_ENABLE_INNER_CDN_T="L-living_room_enable_inner_cdn-T",e.L_LIVING_ROOM_ENABLE_INNER_CDN_R="L-living_room_enable_inner_cdn-R",e.L_LIVING_ROOM_SPREAD_CDN_INFO_T="L-living_room_spread_cdn_info-T",e.L_LIVING_ROOM_SPREAD_CDN_INFO_R="L-living_room_spread_cdn_info-R",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T="L-living_room_set_room_cdn_info-T",e.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R="L-living_room_set_room_cdn_info-R",e.L_LIVING_ROOM_JOINED_PK_ROOM_T="L-living_room_joined_pk_room-T",e.L_LIVING_ROOM_JOINED_PK_ROOM_R="L-living_room_joined_pk_room-R",e.L_LIVING_ROOM_LEAVE_PK_ROOM_T="L-living_room_leave_pk_room-T",e.L_LIVING_ROOM_LEAVE_PK_ROOM_R="L-living_room_leave_pk_room-R",e.L_APP_CALL_LEAVE_PK_ROOM_O="L-app_call_leave_pk_room-O",e.L_QUIT_PK_LEAVE_PK_ROOM_O="L-quit_pk_leave_pk_room-O",e.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O="L-living_room_get_room_pk_handler-O",e.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O="L-living_room_get_mcu_config_builder-O",e.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O="L-living_room_quit_all_pk_room-O",e.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O="L-living_pk_handler_register_room_pk_event_listener-O",e.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O="L-living_pk_handler_call_app_listener-O",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_request_join_other_room-T",e.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_request_join_other_room-R",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T="L-living_pk_handler_cancel_request_join_other_room-T",e.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R="L-living_pk_handler_cancel_request_join_other_room-R",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T="L-living_pk_handler_response_join_other_room-T",e.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R="L-living_pk_handler_response_join_other_room-R",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T="L-living_pk_handler_join_other_room-T",e.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R="L-living_pk_handler_join_other_room-R",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_T="L-living_pk_handler_leave_other_room-T",e.L_LIVING_PK_HANDLER_LEAVE_OTHER_ROOM_R="L-living_pk_handler_leave_other_room-R",e.L_QUIT_PK_T="L-quit_pk-T",e.L_QUIT_PK_R="L-quit_pk-R",e.L_EXCHANGE_WITH_PUSHOTHERROOM_T="L-exchange_with_pushotherroom-T",e.L_EXCHANGE_WITH_PUSHOTHERROOM_R="L-exchange_with_pushotherroom-R",e.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O="L-audience_living_room_call_app_listener-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_O="L-audience_living_room_pull_kvEntries-O",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T",e.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R="L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R",e.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P="L-audience_living_room_singal_data_change-P",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T="L-audience_living_room_get_cdn_play_url-T",e.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R="L-audience_living_room_get_cdn_play_url-R",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T="L-audience_living_room_subscribe-T",e.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R="L-audience_living_room_subscribe-R",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T="L-audience_living_room_unsubscribe-T",e.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R="L-audience_living_room_unsubscribe-R",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T="L-audience_living_room_update_subscribeList-T",e.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R="L-audience_living_room_update_subscribeList-R",e.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O="L-audience_living_room_onTrackReady-O",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R="L-audience_living_room_im_reconnected-R",e.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T="L-audience_living_room_im_reconnected-T",e.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O="L-mcu_config_builder_set_host_video_track-O",e.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O="L-mcu_config_builder_set_mix_layout_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O="L-mcu_config_builder_set_output_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O="L-mcu_config_builder_set_output_tiny_video_resolution-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O="L-mcu_config_builder_set_output_tiny_video_fps-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O="L-mcu_config_builder_set_output_tiny_video_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O="L-mcu_config_builder_set_output_video_render_mode-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O="L-mcu_config_builder_set_output_audio_bitrate-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O="L-mcu_config_builder_set_output_background_color-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_add_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_remove_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O="L-mcu_config_builder_clear_output_background_picture-O",e.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O="L-mcu_config_builder_set_output_background_picture-fill-mode-O",e.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_add_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_remove_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O="L-mcu_config_builder_clear_publish_stream_urls-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_add_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_remove_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O="L-mcu_config_builder_clear_customize_layout_video-O",e.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_set_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_add_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_remove_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O="L-mcu_config_builder_clear_customize_input_audio-O",e.L_MCU_CONFIG_BUILDER_RESET_O="L-mcu_config_builder_reset-O",e.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O="L-mcu_config_builder_add_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O="L-mcu_config_builder_remove_single_water_mark-O",e.L_MCU_CONFIG_BUILDER_CLEAR_SINGLE_WATER_MARK_O="L-mcu_config_builder_clear_single_water_mark-O",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_T="L-media_service_set_mcu_config-T",e.L_MEDIA_SERVICE_SET_MCU_CONFIG_R="L-media_service_set_mcu_config-R",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T="L-media_service_get_cnd_resource_info-T",e.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R="L-media_service_get_cnd_resource_info-R",e.L_MEDIA_SERVICE_MSLIST_CHANGE_O="L-media_service_msList_change-O",e.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O="L-media_service_parse_navi_callvoip_info-O",e.L_MEDIA_SERVICE_REQUEST_T="L-media_service_request-T",e.L_MEDIA_SERVICE_REQUEST_R="L-media_service_request-R",e.L_LOCAL_TRACK_DESTROY_O="L-loacl_track_destroy-O",e.L_LOCAL_TRACK_SET_BITRATE_O="L-loacl_track_set_bitrate-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_O="L-loacl_track_set_local_muted-O",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T="L-loacl_track_set_local_muted_spread-T",e.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R="L-loacl_track_set_local_muted_spread-R",e.L_TRACK_PLAY_O="L-track_play-O",e.L_TRACK_PLAY_E="L-track_play-E",e.L_TRACK_LOAD_START_O="L-track_load_start-O",e.L_TRACK_DURATION_CHANGE_O="L-track_duration_change-O",e.L_TRACK_LOADED_META_DATA_O="L-track_loaded_meta_data-O",e.L_TRACK_LOADED_DATA_O="L-track_loaded_data-O",e.L_TRACK_ABORT_O="L-track_abort-O",e.L_TRACK_VOLUME_CHANGE_O="L-track_volume_change-O",e.L_TRACK_CANPLAY_O="L-track_canplay-O",e.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O="L-abstract_stat_parser_format_rtc_state_report-O",e.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O="L-a_sdp_strategy_set_sdp_semantics-O",e.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O="L-a_sdp_strategy_set_remote_answer-O",e.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O="L-rtc_peer_connection_add_local_track-O",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S="L-rtc_peer_connection_ice_connection_state-S",e.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R="L-rtc_peer_connection_ice_connection_state_report-R",e.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S="L-rtc_peer_connection_connection_state-S",e.L_RTC_PEER_CONNECTION_SET_BITRATE_O="L-rtc_peer_connection_set_bitrate-O",e.L_RTC_PEER_CONNECTION_CREATE_OFFER_O="L-rtc_peer_connection_create_offer-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O="L-rtc_peer_connection_remove_local_track_by_id-O",e.L_RTC_PEER_CONNECTION_REMOVE_ALL_LOCAL_TRACK_O="L-rtc_peer_connection_remove_all_local_track-O",e.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O="L-rtc_peer_connection_remove_local_track-O",e.L_RTC_PEER_CONNECTION_DESTROY_O="L-rtc_peer_connection_destroy-O",e.L_RTC_SET_RECOMMEND_BITRATE_O="L_rtc_set_recommend_bitrate_O",e.L_RTC_3ANOISE_NODE_O="L_RTC_AAAnoiseNode_O",e.L_RTC_3ANOISE_NODE_E="L_RTC_AAAnoiseNode_E",e.L_RTC_3ANOISE_NODE_STOP_O="L_RTC_AAAnoiseNode_Stop_O",e.L_QS_JOIN_ROOM_S="RTC-joinRoomRtc-S",e.L_QS_SUBSCRIBE_S="RTC-subscribe-S",e.L_QS_UNSUBSCRIBE_S="RTC-unsubscribe-S",e.L_QS_PUBLISH_S="RTC-publishRtc-S",e.L_QS_UNPUBLISH_S="RTC-unpublishRtc-S",e.L_QS_ICE_STATUS_S="RTC-iceStatus-S",e.L_QS_KICKED_S="RTC-forcedOffline-S",e.L_QS_PUB_ICE_STATUS_S="RTC-pubIceConnected-S",e.L_QS_SUB_ICE_STATUS_S="RTC-subIceConnected-S",e.L_QS_RECV_PUB_MSG_S="RTC-recvPubMsg-S",e.L_SET_ENCODER_PREFERENCES_S="RTC-set_Encoder_Preferences-S",e.L_RTCNTF_PULL_ROOM_STATUS_O="L-rtcntf_pull_room_status-O",e.L_RTCPING_PULL_ROOM_STATUS_O="L-rtcping_pull_room_status-O",e.L_PULL_ROOM_STATUS_T="L-pull_room_status-T",e.L_PULL_ROOM_STATUS_R="L-pull_room_status-R",e.L_OLD_DAILY_RECORD_O="L-old_daily_record-O",e.L_REMOTE_USER_JOINED_RESOURCES_O="L-remote_user_joined_resources-O",e.L_REMOTE_USER_STATE_HANDLE_O="L-remote_user_state_handle-O",e.L_UPDATE_SUBSCRIBELIST_COMMAND_T="L-update_subscribeList_command-T",e.L_UPDATE_SUBSCRIBELIST_COMMAND_P="L-update_subscribeList_command-P",e.L_UPDATE_SUBSCRIBELIST_COMMAND_R="L-update_subscribeList_command-R",e.L_RTC_CLIENT_NAVI_CHANGE_O="L-rtc_client_navi_change-O",e.L_UNPUBLISH_PREV_COMMAND_T="L-unpublish_prev_command-T",e.L_UNPUBLISH_PREV_COMMAND_R="L-unpublish_prev_command-R",e.L_RETRY_EXCHANGE_COMMAND_T="L-retry_exchange_command-T",e.L_RETRY_EXCHANGE_SPREAD_T="L-retry_exchange_spread-T",e.L_RETRY_EXCHANGE_SPREAD_R="L-retry_exchange_spread-R",e.L_PARSE_USERSTATE_COMMAND_R="L-parse_userstate_command-R",e.L_RESUB_REPUB_RES_R="L-resub_repub_res-R",e.L_PARSE_ROOMDATA_URIS_R="L-parse_roomdata_uris-R",e.L_SET_AUDIO_CONSTRAINTS_O="L-set_audio_constraints-O",e.L_FUNCTION_IS_UNAVAILABLE="L-function_is_unavailable",e.L_CLEAR_UNSUBSCRIBE_LIST_O="L-clear_unsubscribe_list-O",e.L_INVOKER_PUSH_O="L-invoker_push-O",e.L_INVOKER_EXECUTE_T="L-invoker_execute-T",e.L_INVOKER_EXECUTE_R="L-invoker_execute-R",e.L_INVOKER_DESTROY_O="L-invoker_destroy-R",e.L_PARSE_VOIP_SERVER_CONF_E="L_PARSE_VOIP_SERVER_CONF_E",e.L_GET_MEDIA_STREAM_E="L_GET_MEDIA_STREAM_E",e.L_INNER_SET_TRACK_O="L_INNER_SET_TRACK_O",e.A_APPLY_3A_NOISE_WORKLET_T="A-apply_3a_noise_worklet-T",e.A_APPLY_3A_NOISE_WORKLET_R="A-apply_3a_noise_worklet-R",e.L_ENCRYPTOR_ENCODE_E="L-encryptor_encode-E",e.L_ENCRYPTOR_DECODE_E="L-encryptor_decode-E"}(n||(n={})),function(e){e.FAILED="fail",e.SUCCESSED="success",e.TIMEOUT="timeout",e.INFO="info"}(o||(o={}));let _=!0,p=!0;function f(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function h(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function b(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(_=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function R(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(p=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function g(){if("object"==typeof window){if(_)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function m(e,t){p&&console.warn(e+" is deprecated, please use "+t+" instead.")}function C(e){return"[object Object]"===Object.prototype.toString.call(e)}function v(e){return C(e)?Object.keys(e).reduce((function(t,r){const i=C(e[r]),n=i?v(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function O(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?O(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((t=>{O(e,e.get(t),r)}))})))}function T(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===i&&r.trackId===t.id&&O(e,r,n)}))})),n}const E=g;function I(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach((e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let a=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=i(e.video),E("chrome: "+JSON.stringify(e)),n(e)}))}e.video=i(e.video)}return E("chrome: "+JSON.stringify(e)),n(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{i&&i(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function S(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function y(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else h(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function L(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function P(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const n=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const i=function(e){r(o(n(e)))};return t.apply(this,[i,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(n(t)))},r])})).then(r,i)}}function N(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>T(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),h(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>T(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach((r=>{r.track===e&&(t?i=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?i=!0:r=t),t.track===e))),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function A(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),n.apply(this,arguments)}}function w(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return A(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const n=this._streams[r.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=i[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function D(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function k(e,t){h(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var U=Object.freeze({__proto__:null,shimMediaStream:S,shimOnTrack:y,shimGetSendersWithDtmf:L,shimGetStats:P,shimSenderReceiverGetStats:N,shimAddTrackRemoveTrackWithNative:A,shimAddTrackRemoveTrack:w,shimPeerConnection:D,fixNegotiationNeeded:k,shimGetUserMedia:I,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var M,x,j=(M=function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:r[t[i]]=t[i+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));var n=0;return r.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),i+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){var r,i=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),i.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},i.push(t))}})),0===i.length&&c&&i.push({ssrc:c});var l=t.matchPrefix(e,"b=");return l.length&&(l=0===l[0].indexOf("b=TIAS:")?parseInt(l[0].substr(7),10):0===l[0].indexOf("b=AS:")?1e3*parseInt(l[0].substr(5),10)*.95-16e3:void 0,i.forEach((function(e){e.maxBitrate=l}))),i},t.parseRtcpParameters=function(e){var r={},i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,i=t.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,i=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(r=parseInt(n[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:i.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,i){var n=void 0!==r?r:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,i,n){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+n.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var i=t.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),i=0;i<r.length;i++)if(r[i].length<2||"="!==r[i].charAt(1))return!1;return!0},e.exports=t},M(x={exports:{}},x.exports),x.exports);function B(e,t,r,i,n){var o=j.writeRtpDescription(e.kind,t);if(o+=j.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=j.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":n||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(i?i.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+j.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+j.localCName+"\r\n"),o}function V(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},i=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},n=function(e,t,r,n){var o=i(e.parameters.apt,r),a=i(t.parameters.apt,n);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(i){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(i.name.toLowerCase()===a.name.toLowerCase()&&i.clockRate===a.clockRate){if("rtx"===i.name.toLowerCase()&&i.parameters&&a.parameters.apt&&!n(i,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(i.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter((function(e){for(var t=0;t<i.rtcpFeedback.length;t++)if(i.rtcpFeedback[t].type===e.type&&i.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var i=0;i<t.headerExtensions.length;i++){var n=t.headerExtensions[i];if(e.uri===n.uri){r.headerExtensions.push(n);break}}})),r}function F(e,t,r){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)}function J(e,t){var r=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return r||e.addRemoteCandidate(t),!r}function G(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}var H=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function i(t,r,i,n){var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=n,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var n=function(r){var i=this,n=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){i[e]=n[e].bind(n)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw G("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var i=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof i;return n&&(i=[i]),i=i.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||r?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)})),delete e.url,e.urls=n?i[0]:i,!!i.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=j.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(n.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(n.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),n.prototype.onicecandidate=null,n.prototype.onaddstream=null,n.prototype.ontrack=null,n.prototype.onremovestream=null,n.prototype.onsignalingstatechange=null,n.prototype.oniceconnectionstatechange=null,n.prototype.onconnectionstatechange=null,n.prototype.onicegatheringstatechange=null,n.prototype.onnegotiationneeded=null,n.prototype.ondatachannel=null,n.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},n.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},n.prototype.getConfiguration=function(){return this._config},n.prototype.getLocalStreams=function(){return this.localStreams},n.prototype.getRemoteStreams=function(){return this.remoteStreams},n.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,i={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();i.iceTransport=n.iceTransport,i.dtlsTransport=n.dtlsTransport}return t||this.transceivers.push(i),i},n.prototype.addTrack=function(t,r){if(this._isClosed)throw G("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var i;if(this.transceivers.find((function(e){return e.track===t})))throw G("InvalidAccessError","Track already exists.");for(var n=0;n<this.transceivers.length;n++)this.transceivers[n].track||this.transceivers[n].kind!==t.kind||(i=this.transceivers[n]);return i||(i=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),i.track=t,i.stream=r,i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport),i.rtpSender},n.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var i=e.clone();e.getTracks().forEach((function(e,t){var r=i.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),i.getTracks().forEach((function(e){r.addTrack(e,i)}))}},n.prototype.removeTrack=function(t){if(this._isClosed)throw G("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw G("InvalidAccessError","Sender was not created by this connection.");var i=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(i)&&this.localStreams.indexOf(i)>-1&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},n.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},n.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},n.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},n.prototype._createIceGatherer=function(t,r){var i=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var n=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(n,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;n.state=r?"completed":"gathering",null!==i.transceivers[t].bufferedCandidateEvents&&i.transceivers[t].bufferedCandidateEvents.push(e)},n.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),n},n.prototype._gather=function(t,r){var i=this,n=this.transceivers[r].iceGatherer;if(!n.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,n.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),n.onlocalcandidate=function(e){if(!(i.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==n.state&&"gathering"!==n.state||(n.state="completed");else{"new"===n.state&&(n.state="gathering"),a.component=1,a.ufrag=n.getLocalParameters().usernameFragment;var c=j.writeCandidate(a);o.candidate=Object.assign(o.candidate,j.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=j.getMediaSections(i._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",i._localDescription.sdp=j.getDescription(i._localDescription.sdp)+u.join("");var l=i.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==i.iceGatheringState&&(i.iceGatheringState="gathering",i._emitGatheringStateChange()),s||i._dispatchEvent("icecandidate",o),l&&(i._dispatchEvent("icecandidate",new Event("icecandidate")),i.iceGatheringState="complete",i._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){n.onlocalcandidate(e)}))}),0)}},n.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var i=new e.RTCDtlsTransport(r);return i.ondtlsstatechange=function(){t._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:i}},n.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var i=this.transceivers[e].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[e].dtlsTransport)},n.prototype._transceive=function(e,r,i){var n=V(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(n.encodings=e.sendEncodingParameters,n.rtcp={cname:j.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(n.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(n)),i&&e.rtpReceiver&&n.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?n.encodings=e.recvEncodingParameters:n.encodings=[{}],n.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(n.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(n.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(n))},n.prototype.setLocalDescription=function(e){var t,r,i=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(G("TypeError",'Unsupported type "'+e.type+'"'));if(!F("setLocalDescription",e.type,i.signalingState)||i._isClosed)return Promise.reject(G("InvalidStateError","Can not set local "+e.type+" in state "+i.signalingState));if("offer"===e.type)t=j.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=j.parseRtpParameters(e);i.transceivers[t].localCapabilities=r})),i.transceivers.forEach((function(e,t){i._gather(e.mid,t)}));else if("answer"===e.type){t=j.splitSections(i._remoteDescription.sdp),r=t.shift();var n=j.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=i.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,l=o.remoteCapabilities;if(!(j.isRejected(e)&&0===j.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var d=j.getIceParameters(e,r),_=j.getDtlsParameters(e,r);n&&(_.role="server"),i.usingBundle&&0!==t||(i._gather(o.mid,t),"new"===s.state&&s.start(a,d,n?"controlling":"controlled"),"new"===c.state&&c.start(_));var p=V(u,l);i._transceive(o,p.codecs.length>0,!1)}}))}return i._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?i._updateSignalingState("have-local-offer"):i._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(n){var o=this;if(-1===["offer","answer"].indexOf(n.type))return Promise.reject(G("TypeError",'Unsupported type "'+n.type+'"'));if(!F("setRemoteDescription",n.type,o.signalingState)||o._isClosed)return Promise.reject(G("InvalidStateError","Can not set remote "+n.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=j.splitSections(n.sdp),u=c.shift(),l=j.matchPrefix(u,"a=ice-lite").length>0,d=j.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=d;var _=j.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!_&&_.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(i,c){var _=j.splitLines(i),p=j.getKind(i),f=j.isRejected(i)&&0===j.matchPrefix(i,"a=bundle-only").length,h=_[0].substr(2).split(" ")[2],b=j.getDirection(i,u),R=j.parseMsid(i),g=j.getMid(i)||j.generateIdentifier();if(f||"application"===p&&("DTLS/SCTP"===h||"UDP/DTLS/SCTP"===h))o.transceivers[c]={mid:g,kind:p,protocol:h,rejected:!0};else{var m,C,v,O,T,E,I,S,y;!f&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(p,!0));var L,P,N=j.parseRtpParameters(i);f||(L=j.getIceParameters(i,u),(P=j.getDtlsParameters(i,u)).role="client"),I=j.parseRtpEncodingParameters(i);var A=j.parseRtcpParameters(i),w=j.matchPrefix(i,"a=end-of-candidates",u).length>0,D=j.matchPrefix(i,"a=candidate:").map((function(e){return j.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===n.type||"answer"===n.type)&&!f&&d&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==n.type||f){if("answer"===n.type&&!f){C=(m=o.transceivers[c]).iceGatherer,v=m.iceTransport,O=m.dtlsTransport,T=m.rtpReceiver,E=m.sendEncodingParameters,S=m.localCapabilities,o.transceivers[c].recvEncodingParameters=I,o.transceivers[c].remoteCapabilities=N,o.transceivers[c].rtcpParameters=A,D.length&&"new"===v.state&&(!l&&!w||d&&0!==c?D.forEach((function(e){J(m.iceTransport,e)})):v.setRemoteCandidates(D)),d&&0!==c||("new"===v.state&&v.start(C,L,"controlling"),"new"===O.state&&O.start(P)),!V(m.localCapabilities,m.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&m.sendEncodingParameters[0].rtx&&delete m.sendEncodingParameters[0].rtx,o._transceive(m,"sendrecv"===b||"recvonly"===b,"sendrecv"===b||"sendonly"===b),!T||"sendrecv"!==b&&"sendonly"!==b?delete m.rtpReceiver:(y=T.track,R?(a[R.stream]||(a[R.stream]=new e.MediaStream),r(y,a[R.stream]),s.push([y,T,a[R.stream]])):(a.default||(a.default=new e.MediaStream),r(y,a.default),s.push([y,T,a.default])))}}else{(m=o.transceivers[c]||o._createTransceiver(p)).mid=g,m.iceGatherer||(m.iceGatherer=o._createIceGatherer(c,d)),D.length&&"new"===m.iceTransport.state&&(!w||d&&0!==c?D.forEach((function(e){J(m.iceTransport,e)})):m.iceTransport.setRemoteCandidates(D)),S=e.RTCRtpReceiver.getCapabilities(p),t<15019&&(S.codecs=S.codecs.filter((function(e){return"rtx"!==e.name}))),E=m.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var k,U=!1;if("sendrecv"===b||"sendonly"===b){if(U=!m.rtpReceiver,T=m.rtpReceiver||new e.RTCRtpReceiver(m.dtlsTransport,p),U)y=T.track,R&&"-"===R.stream||(R?(a[R.stream]||(a[R.stream]=new e.MediaStream,Object.defineProperty(a[R.stream],"id",{get:function(){return R.stream}})),Object.defineProperty(y,"id",{get:function(){return R.track}}),k=a[R.stream]):(a.default||(a.default=new e.MediaStream),k=a.default)),k&&(r(y,k),m.associatedRemoteMediaStreams.push(k)),s.push([y,T,k])}else m.rtpReceiver&&m.rtpReceiver.track&&(m.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===m.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),m.associatedRemoteMediaStreams=[]);m.localCapabilities=S,m.remoteCapabilities=N,m.rtpReceiver=T,m.rtcpParameters=A,m.sendEncodingParameters=E,m.recvEncodingParameters=I,o._transceive(o.transceivers[c],!1,U)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===n.type?"active":"passive"),o._remoteDescription={type:n.type,sdp:n.sdp},"offer"===n.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(a).forEach((function(t){var r=a[t];if(r.getTracks().length){if(-1===o.remoteStreams.indexOf(r)){o.remoteStreams.push(r);var n=new Event("addstream");n.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",n)}))}s.forEach((function(e){var t=e[0],n=e[1];r.id===e[2].id&&i(o,t,n,[r])}))}})),s.forEach((function(e){e[2]||i(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},n.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},n.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},n.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},n.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},n.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},n.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(G("InvalidStateError","Can not call createOffer after close"));var i=r.transceivers.filter((function(e){return"audio"===e.kind})).length,n=r.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(i=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(n=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--n<0&&(e.wantReceive=!1)}));i>0||n>0;)i>0&&(r._createTransceiver("audio"),i--),n>0&&(r._createTransceiver("video"),n--);var a=j.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(i,n){var o=i.track,a=i.kind,s=i.mid||j.generateIdentifier();i.mid=s,i.iceGatherer||(i.iceGatherer=r._createIceGatherer(n,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),i.remoteCapabilities&&i.remoteCapabilities.codecs&&i.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(i.remoteCapabilities&&i.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=i.sendEncodingParameters||[{ssrc:1001*(2*n+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),i.wantReceive&&(i.rtpReceiver=new e.RTCRtpReceiver(i.dtlsTransport,a)),i.localCapabilities=c,i.sendEncodingParameters=u})),"max-compat"!==r._config.bundlePolicy&&(a+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){a+=B(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,a+="a="+j.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},n.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(G("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(G("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var i=j.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(i+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),i+="a=ice-options:trickle\r\n";var n=j.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>n)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?i+="m=application 0 DTLS/SCTP 5000\r\n":i+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?i+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(i+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(i+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var a;if(e.stream)"audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var s=V(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,i+=B(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(i+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:i});return Promise.resolve(o)},n.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(i,n){if(!r._remoteDescription)return n(G("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<r.transceivers.length;a++)if(r.transceivers[a].mid===e.sdpMid){o=a;break}var s=r.transceivers[o];if(!s)return n(G("OperationError","Can not add ICE candidate"));if(s.rejected)return i();var c=Object.keys(e.candidate).length>0?j.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return i();if(c.component&&1!==c.component)return i();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!J(s.iceTransport,c))return n(G("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=j.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=j.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var l=0;l<r.transceivers.length&&(r.transceivers[l].rejected||(r.transceivers[l].iceTransport.addRemoteCandidate({}),(t=j.getMediaSections(r._remoteDescription.sdp))[l]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=j.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));l++);i()}))},n.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw G("InvalidAccessError","Invalid selector.");return r.getStats()}var i=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&i.push(e[t].getStats())}))})),Promise.all(i).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var i=r.prototype.getStats;r.prototype.getStats=function(){return i.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var i;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(i=e[r]).type]||i.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=n.prototype[e];n.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=n.prototype[e];n.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=n.prototype[e];n.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),n};function K(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch((e=>Promise.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e))))}}function W(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function Y(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=H(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e){let t=!1;return(e=JSON.parse(JSON.stringify(e))).filter((e=>{if(e&&(e.urls||e.url)){let r=e.urls||e.url;e.url&&!e.urls&&m("RTCIceServer.url","RTCIceServer.urls");const i="string"==typeof r;return i&&(r=[r]),r=r.filter((e=>{if(0===e.indexOf("stun:"))return!1;const r=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return r&&!t?(t=!0,!0):r&&!t})),delete e.url,e.urls=i?r[0]:r,!!r.length}}))}(e.iceServers,t.version),g("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function z(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var q=Object.freeze({__proto__:null,shimPeerConnection:Y,shimReplaceTrack:z,shimGetUserMedia:K,shimGetDisplayMedia:W});function Q(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){m("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function Z(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function X(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then((e=>{if(t.version<53&&!n)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(n,o)}}function $(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function ee(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),h(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function te(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){m("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function re(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function ie(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return i})}function ne(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function oe(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function ae(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var se=Object.freeze({__proto__:null,shimOnTrack:Z,shimPeerConnection:X,shimSenderGetStats:$,shimReceiverGetStats:ee,shimRemoveStream:te,shimRTCDataChannel:re,shimAddTransceiver:ie,shimGetParameters:ne,shimCreateOffer:oe,shimCreateAnswer:ae,shimGetUserMedia:Q,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function ce(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function ue(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function le(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let s=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=s,s=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=s,s=function(e,t,r){const i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=s}function de(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(_e(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function _e(e){return e&&void 0!==e.video?Object.assign({},e,{video:v(e.video)}):e}function pe(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];!i.hasOwnProperty("urls")&&i.hasOwnProperty("url")?(m("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function fe(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function he(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function be(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Re=Object.freeze({__proto__:null,shimLocalStreamsAPI:ce,shimRemoteStreamsAPI:ue,shimCallbacksAPI:le,shimGetUserMedia:de,shimConstraints:_e,shimRTCIceServerUrls:pe,shimTrackEventTransceiver:fe,shimCreateOfferLegacy:he,shimAudioContext:be});function ge(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),i=j.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,h(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function me(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(function(e){if(!e||!e.sdp)return!1;const t=j.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=j.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))}(arguments[0])){const e=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r}(arguments[0]),r=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r}(e),i=function(e,r){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=j.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i}(arguments[0],e);let n;n=0===r&&0===i?Number.POSITIVE_INFINITY:0===r||0===i?Math.max(r,i):Math.min(r,i);const o={};Object.defineProperty(o,"maxMessageSize",{get:()=>n}),this._sctp=o}return r.apply(this,arguments)}}function Ce(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},h(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ve(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function Oe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Te(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}var Ee=Object.freeze({__proto__:null,shimRTCIceCandidate:ge,shimMaxMessageSize:me,shimSendThrowTypeError:Ce,shimConnectionState:ve,removeExtmapAllowMixed:Oe,shimAddIceCandidateNullOrEmpty:Te});const Ie=function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const r=g,i=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=f(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=f(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=f(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=f(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),n={browserDetails:i,commonShim:Ee,extractVersion:f,disableLog:b,disableWarnings:R};switch(i.browser){case"chrome":if(!U||!D||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),n;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),n;r("adapter.js shimming chrome."),n.browserShim=U,Te(e,i),I(e,i),S(e),D(e,i),y(e),w(e,i),L(e),P(e),N(e),k(e,i),ge(e),ve(e),me(e,i),Ce(e),Oe(e,i);break;case"firefox":if(!se||!X||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),n;r("adapter.js shimming firefox."),n.browserShim=se,Te(e,i),Q(e,i),X(e,i),Z(e),te(e),$(e),ee(e),re(e),ie(e),ne(e),oe(e),ae(e),ge(e),ve(e),me(e,i),Ce(e);break;case"edge":if(!q||!Y||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),n;r("adapter.js shimming edge."),n.browserShim=q,K(e),W(e),Y(e,i),z(e),me(e,i),Ce(e);break;case"safari":if(!Re||!t.shimSafari)return r("Safari shim is not included in this adapter release."),n;r("adapter.js shimming safari."),n.browserShim=Re,Te(e,i),pe(e),he(e),le(e),ce(e),ue(e),fe(e),de(e),be(e),ge(e),me(e,i),Ce(e),Oe(e,i);break;default:r("Unsupported browser!")}return n}({window:"undefined"==typeof window?void 0:window});var Se,ye,Le,Pe;exports.RCFrameRate=void 0,(Se=exports.RCFrameRate||(exports.RCFrameRate={})).FPS_10="FPS_10",Se.FPS_15="FPS_15",Se.FPS_24="FPS_24",Se.FPS_30="FPS_30",exports.RCResolution=void 0,(ye=exports.RCResolution||(exports.RCResolution={})).W176_H132="W176_H132",ye.W176_H144="W176_H144",ye.W180_H180="W180_H180",ye.W240_H180="W240_H180",ye.W240_H240="W240_H240",ye.W256_H144="W256_H144",ye.W320_H180="W320_H180",ye.W320_H240="W320_H240",ye.W360_H360="W360_H360",ye.W480_H360="W480_H360",ye.W480_H480="W480_H480",ye.W640_H360="W640_H360",ye.W640_H480="W640_H480",ye.W720_H480="W720_H480",ye.W848_H480="W848_H480",ye.W960_H720="W960_H720",ye.W1280_H720="W1280_H720",ye.W1920_H1080="W1920_H1080",ye.W144_H176="W144_H176",ye.W144_H256="W144_H256",ye.W180_H240="W180_H240",ye.W180_H320="W180_H320",ye.W240_H320="W240_H320",ye.W360_H480="W360_H480",ye.W360_H640="W360_H640",ye.W480_H640="W480_H640",ye.W480_H720="W480_H720",ye.W480_H848="W480_H848",ye.W720_H1280="W720_H1280",ye.W720_H960="W720_H960",ye.W1080_H1920="W1080_H1920",exports.RCMediaType=void 0,(Le=exports.RCMediaType||(exports.RCMediaType={}))[Le.AUDIO_ONLY=0]="AUDIO_ONLY",Le[Le.VIDEO_ONLY=1]="VIDEO_ONLY",Le[Le.AUDIO_VIDEO=2]="AUDIO_VIDEO";var Ne,Ae=((Pe={})[exports.RCResolution.W176_H132]={width:176,height:132,maxBitrate:150,minBitrate:80},Pe[exports.RCResolution.W176_H144]={width:176,height:144,maxBitrate:150,minBitrate:80},Pe[exports.RCResolution.W180_H180]={width:180,height:180,maxBitrate:200,minBitrate:100},Pe[exports.RCResolution.W240_H180]={width:240,height:180,maxBitrate:240,minBitrate:120},Pe[exports.RCResolution.W240_H240]={width:240,height:240,maxBitrate:280,minBitrate:120},Pe[exports.RCResolution.W256_H144]={width:256,height:144,maxBitrate:240,minBitrate:120},Pe[exports.RCResolution.W320_H180]={width:320,height:180,maxBitrate:280,minBitrate:120},Pe[exports.RCResolution.W320_H240]={width:320,height:240,maxBitrate:400,minBitrate:120},Pe[exports.RCResolution.W360_H360]={width:360,height:360,maxBitrate:520,minBitrate:140},Pe[exports.RCResolution.W480_H360]={width:480,height:360,maxBitrate:650,minBitrate:150},Pe[exports.RCResolution.W480_H480]={width:480,height:480,maxBitrate:800,minBitrate:180},Pe[exports.RCResolution.W640_H360]={width:640,height:360,maxBitrate:800,minBitrate:180},Pe[exports.RCResolution.W640_H480]={width:640,height:480,maxBitrate:900,minBitrate:200},Pe[exports.RCResolution.W720_H480]={width:720,height:480,maxBitrate:1e3,minBitrate:200},Pe[exports.RCResolution.W848_H480]={width:848,height:480,maxBitrate:1860,minBitrate:200},Pe[exports.RCResolution.W960_H720]={width:960,height:720,maxBitrate:2e3,minBitrate:250},Pe[exports.RCResolution.W1280_H720]={width:1280,height:720,maxBitrate:2200,minBitrate:250},Pe[exports.RCResolution.W1920_H1080]={width:1920,height:1080,maxBitrate:4e3,minBitrate:400},Pe[exports.RCResolution.W144_H176]={width:144,height:176,maxBitrate:150,minBitrate:80},Pe[exports.RCResolution.W144_H256]={width:144,height:256,maxBitrate:240,minBitrate:120},Pe[exports.RCResolution.W180_H240]={width:180,height:240,maxBitrate:240,minBitrate:120},Pe[exports.RCResolution.W180_H320]={width:180,height:320,maxBitrate:280,minBitrate:120},Pe[exports.RCResolution.W240_H320]={width:240,height:320,maxBitrate:400,minBitrate:120},Pe[exports.RCResolution.W360_H480]={width:360,height:480,maxBitrate:650,minBitrate:150},Pe[exports.RCResolution.W360_H640]={width:360,height:640,maxBitrate:800,minBitrate:180},Pe[exports.RCResolution.W480_H640]={width:480,height:640,maxBitrate:900,minBitrate:200},Pe[exports.RCResolution.W480_H720]={width:480,height:720,maxBitrate:1e3,minBitrate:200},Pe[exports.RCResolution.W480_H848]={width:480,height:848,maxBitrate:1860,minBitrate:930},Pe[exports.RCResolution.W720_H1280]={width:720,height:1280,maxBitrate:2200,minBitrate:250},Pe[exports.RCResolution.W720_H960]={width:720,height:960,maxBitrate:2760,minBitrate:910},Pe[exports.RCResolution.W1080_H1920]={width:1080,height:1920,maxBitrate:4e3,minBitrate:400},Pe),we=function(e){var t={192:180,368:360,1088:1080};return t[e]?t[e]:e},De=function(e,t){e=we(e),t=we(t);var r=Ae["W".concat(e,"_H").concat(t)];if(r)return r;var i=e*t;return Object.keys(Ae).map((function(e){return Ae[e]})).sort((function(e,t){return e.height*e.width-t.width*t.height})).filter((function(e){return e.height*e.width>=i}))[0]||Ae.W1920_H1080},ke={10:1,15:1,24:1.5,30:1.5},Ue=function(e){var t=Number.MAX_VALUE,r=1;for(var i in ke){var n=Math.abs(e-parseInt(i));n<t&&(t=n,r=ke[i])}return r},Me={getCameras:function(){return s(void 0,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"videoinput"===e.kind}))]}}))}))},getMicrophones:function(){return s(void 0,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audioinput"===e.kind}))]}}))}))},getSpeakers:function(){return s(void 0,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return[2,e.sent().filter((function(e){return"audiooutput"===e.kind}))]}}))}))}};!function(e){e.AUDIO="audio",e.VIDEO="video"}(Ne||(Ne={}));var xe,je,Be,Ve=function(t){function i(e,r,i,n,o,a){var s=t.call(this)||this;return Object.defineProperty(s,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"_tag",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_kind",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"_isLocalTrack",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(s,"_localMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_remoteMuted",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(s,"_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_streamId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_msTrack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"_msStream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(s,"DataTrackId",{enumerable:!0,configurable:!0,writable:!0,value:"data-track-id"}),Object.defineProperty(s,"_element",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),s._streamId=[s._userId||s._roomId,s._tag].join("_"),s._id=[s._streamId,s.isAudioTrack()?0:1].join("_"),s}return r(i,t),Object.defineProperty(i.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._streamId}}),Object.defineProperty(i.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._id}}),Object.defineProperty(i.prototype,"getUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._userId}}),Object.defineProperty(i.prototype,"__innerGetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msTrack}}),Object.defineProperty(i.prototype,"streamTrack",{get:function(){return this._msTrack},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"getTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._tag}}),Object.defineProperty(i.prototype,"isLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isLocalTrack}}),Object.defineProperty(i.prototype,"isVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"video"===this._kind}}),Object.defineProperty(i.prototype,"isAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return"audio"===this._kind}}),Object.defineProperty(i.prototype,"isReady",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return"live"===(null===(e=this._msTrack)||void 0===e?void 0:e.readyState)}}),Object.defineProperty(i.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._msTrack=e,this._setLocalMuted(this._localMuted);var t=this._msStream=this._msStream||new MediaStream,r=t.getTracks()[0];r&&t.removeTrack(r),this._isLocalTrack||this._logger.warn(n.L_INNER_SET_TRACK_O,"trackId: ".concat(this._id,", track: ").concat(e?e.id:"undefined")),e?t.addTrack(e):this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.pause(),this._element.srcObject=null)}}),Object.defineProperty(i.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return this._msTrack&&(this._msTrack.enabled=!e),this._localMuted=e,[2,exports.RCRTCCode.SUCCESS]}))}))}}),Object.defineProperty(i.prototype,"mute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._setLocalMuted(!0)]}))}))}}),Object.defineProperty(i.prototype,"unmute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2,this._setLocalMuted(!1)]}))}))}}),Object.defineProperty(i.prototype,"isLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._localMuted}}),Object.defineProperty(i.prototype,"isMCUTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Boolean(this._roomId)}}),Object.defineProperty(i.prototype,"isOwnerMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteMuted}}),Object.defineProperty(i.prototype,"_validateVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(null==t?void 0:t.volume){if(!e.isNumber(null==t?void 0:t.volume))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.volume not a number"})),{code:exports.RCRTCCode.PARAMS_ERROR};(null==t?void 0:t.volume)<0&&(t.volume=0,this._logger.warn(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,msg:"params error -> options.volume < 0",tips:"the valid range of options.volume is 0-100, the value of volume has been set 0"}))),(null==t?void 0:t.volume)>100&&(t.volume=100,this._logger.warn(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,msg:"params error -> options.volume > 100",tips:"the valid range of options.volume is 0-100, the value of volume has been set 100"})))}}}),Object.defineProperty(i.prototype,"_validatePlayOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){switch(a.label){case 0:return this._msTrack?("ended"===this._msTrack.readyState&&this._logger.warn(n.L_TRACK_PLAY_E,"track readyState is ended -> id: ".concat(this._id)),(r=this._validateVolume(t))?[2,r]:(null==t?void 0:t.audioDeviceId)?[4,Me.getSpeakers()]:[3,2]):(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.TRACK_NOT_READY,kind:this._kind,msg:"the track is not ready to play -> id: ".concat(this._id)})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]);case 1:if(i=a.sent().map((function(e){return e.deviceId})),!i.includes(t.audioDeviceId))return this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.audioDeviceId"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}];a.label=2;case 2:return!this.isVideoTrack()||e&&(e instanceof HTMLVideoElement||this._validateVideoNodeName(e))?[2]:(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT,kind:this._kind,msg:"params element is not a HTMLVideoElement"})),[2,{code:exports.RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT}])}}))}))}}),Object.defineProperty(i.prototype,"_setPlayAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return e&&(this._element.playsInline=!0,this._element.x5PlaysInline=!0,this._element.webkitPlaysInline=!0),!(null==t?void 0:t.audioDeviceId)||e?[3,2]:[4,this._element.setSinkId(t.audioDeviceId)];case 1:i.sent(),i.label=2;case 2:return e||!(null==t?void 0:t.volume)&&0!==(null==t?void 0:t.volume)||(this._element.volume=t.volume/100),null===(r=this._element)||void 0===r||r.setAttribute(this.DataTrackId,this.getTrackId()),[2]}}))}))}}),Object.defineProperty(i.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a=this;return c(this,(function(u){switch(u.label){case 0:return this._logger.info(n.L_TRACK_PLAY_O,JSON.stringify({elementId:null==e?void 0:e.id,trackId:this._id,kind:this._kind,options:t?{volume:null==t?void 0:t.volume,audioDeviceId:t.audioDeviceId}:void 0})),[4,this._validatePlayOptions(e,t)];case 1:return(r=u.sent())?[2,r]:(i=this.isVideoTrack(),this._element=i?e:this._element||new Audio,this._localMuted&&this._setLocalMuted(!1),this._element.srcObject&&this._element.srcObject===this._msStream||this._element.pause(),this._element.onloadstart=function(e){var t;a._logger.info(n.L_TRACK_LOAD_START_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadstart -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.ondurationchange=function(e){var t;a._logger.info(n.L_TRACK_DURATION_CHANGE_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement ondurationchange -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onloadedmetadata=function(e){var t;a._logger.info(n.L_TRACK_LOADED_META_DATA_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadedmetadata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onloadeddata=function(e){var t;a._logger.info(n.L_TRACK_LOADED_DATA_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onloadeddata -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.onabort=function(e){var t;a._logger.info(n.L_TRACK_ABORT_O,JSON.stringify({status:o.INFO,kind:a._kind,msg:"HTMLMediaElement onabort -> id: ".concat(null===(t=e.target)||void 0===t?void 0:t.id,", trackId: ").concat(a._id)}))},this._element.oncanplay=function(e){return s(a,void 0,void 0,(function(){var r,a,s;return c(this,(function(c){switch(c.label){case 0:this._logger.info(n.L_TRACK_CANPLAY_O,JSON.stringify({status:o.INFO,kind:this._kind,msg:"HTMLMediaElement oncanplay -> id: ".concat(null===(a=e.target)||void 0===a?void 0:a.id,", trackId: ").concat(this._id)})),c.label=1;case 1:return c.trys.push([1,5,,6]),!(null==t?void 0:t.audioDeviceId)||i?[3,3]:[4,this._element.setSinkId(t.audioDeviceId)];case 2:c.sent(),c.label=3;case 3:return[4,null===(s=this._element)||void 0===s?void 0:s.play()];case 4:return c.sent(),[3,6];case 5:return"No permission to use requested device"===(r=c.sent()).message?(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,kind:this._kind,code:exports.RCRTCCode.NO_PERMISSION_TO_USE_REQUESTED_DEVICE,msg:"setSinkId failed, error msg: ".concat(r.message)})),[2]):(this._logger.error(n.L_TRACK_PLAY_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.TRACK_PLAY_ERROR,kind:this._kind,msg:"play error, error msg: ".concat(r.message)})),[3,6]);case 6:return[2]}}))}))},this._element.onvolumechange=function(e){var t,r,i=Math.floor(100*(null===(t=e.target)||void 0===t?void 0:t.volume));a._logger.info(n.L_TRACK_VOLUME_CHANGE_O,JSON.stringify({status:o.INFO,msg:"HTMLMediaElement onvolumechange -> id: ".concat(null===(r=e.target)||void 0===r?void 0:r.id,", volume: ").concat(i,", trackId: ").concat(a._id)}))},this._element.srcObject=this._msStream,this._element.autoplay=!0,[4,this._setPlayAttrs(i,t)]);case 2:return u.sent(),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"__innerDestroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.__innerSetMediaStreamTrack(void 0)}}),Object.defineProperty(i.prototype,"__releaseMediaElement",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._element&&this._element.getAttribute(this.DataTrackId)===this.getTrackId()&&(this._element.remove(),this._element.srcObject=null)}}),Object.defineProperty(i.prototype,"_validateVideoNodeName",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e&&e.nodeName&&"VIDEO"===e.nodeName.toUpperCase()}}),i}(e.EventEmitter);exports.RCAudioBitrate=void 0,(Be=exports.RCAudioBitrate||(exports.RCAudioBitrate={})).Speech="Speech",Be.Music="Music",Be.MusicHigh="MusicHigh";var Fe,Je=((xe={})[exports.RCAudioBitrate.Music]={max:64,min:64},xe[exports.RCAudioBitrate.MusicHigh]={max:128,min:128},xe[exports.RCAudioBitrate.Speech]={max:32,min:32},xe);exports.RCVideoBitrate=void 0,(Fe=exports.RCVideoBitrate||(exports.RCVideoBitrate={})).LEVEL0="LEVEL0",Fe.LEVEL1="LEVEL1",Fe.LEVEL2="LEVEL2",Fe.LEVEL3="LEVEL3",Fe.LEVEL4="LEVEL4",Fe.LEVEL5="LEVEL5";var Ge=((je={})[exports.RCVideoBitrate.LEVEL0]={max:150,min:80},je[exports.RCVideoBitrate.LEVEL1]={max:280,min:120},je[exports.RCVideoBitrate.LEVEL2]={max:650,min:150},je[exports.RCVideoBitrate.LEVEL3]={max:1e3,min:200},je[exports.RCVideoBitrate.LEVEL4]={max:2200,min:250},je[exports.RCVideoBitrate.LEVEL5]={max:4e3,min:400},je),He=function(){function e(){}return Object.defineProperty(e,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:r=new AudioContext({sampleRate:44100}),c.label=1;case 1:return c.trys.push([1,5,,6]),[4,r.audioWorklet.addModule(e.SCRIPT_URL)];case 2:return c.sent(),[4,fetch(e.WASM_URL,{cache:"force-cache",credentials:"same-origin"})];case 3:return[4,c.sent().arrayBuffer()];case 4:return i=c.sent(),[3,6];case 5:return c.sent(),[2,{code:exports.RCRTCCode.LOAD_3A_MODULE_FAILED}];case 6:return n=r.createMediaStreamSource(new MediaStream([t])),o=new AudioWorkletNode(r,"process-worklet",{numberOfInputs:1,numberOfOutputs:1,outputChannelCount:[1],processorOptions:{binary:i}}),a=r.createMediaStreamDestination(),n.connect(o).connect(a),s=a.stream.getAudioTracks()[0],e._maps.set(t.id,r),[2,{code:exports.RCRTCCode.SUCCESS,track:s}]}}))}))}}),Object.defineProperty(e,"release3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e._maps.get(t.id);r&&(r.close(),e._maps.delete(t.id))}}),Object.defineProperty(e,"WASM_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/AudioProcessing.wasm"}),Object.defineProperty(e,"SCRIPT_URL",{enumerable:!0,configurable:!0,writable:!0,value:"https://cdn.ronghub.com/plugin-rtc/wasm/5.0.0-alpha.2/process-worklet.js"}),Object.defineProperty(e,"_maps",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),e}(),Ke=function(t){function i(e,r,i,n,o){var a=t.call(this,e,r,i,n,!0)||this;return Object.defineProperty(a,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_isPublished",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(a,"_bitrateInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),a.__innerSetMediaStreamTrack(o),o.onended=function(){o.onended=null,a._onTrackEnded()},a}return r(i,t),Object.defineProperty(i.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(i.EVENT_LOCAL_TRACK_END,this),this.removeAll(i.EVENT_LOCAL_TRACK_END)}}),Object.defineProperty(i.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r=this;return new Promise((function(o){var a=r._localMuted!==e;t.prototype._setLocalMuted.call(r,e),r._remoteMuted=r._localMuted,a&&r._isPublished?r.emit(i.__INNER_EVENT_MUTED_CHANGE__,r,o):o(exports.RCRTCCode.SUCCESS),r._logger.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_O,JSON.stringify({enable:e,trackId:r._id}))}))}}),Object.defineProperty(i.prototype,"__innerSetPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isPublished=e}}),Object.defineProperty(i.prototype,"isPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isPublished}}),Object.defineProperty(i.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._isDestroyed||(this._logger.info(n.L_LOCAL_TRACK_DESTROY_O,this._id),this._isDestroyed=!0,null===(e=this._msTrack)||void 0===e||e.stop(),t.prototype.__innerDestroy.call(this),this.isAudioTrack()&&t.prototype.__releaseMediaElement.call(this),this._isPublished&&this.emit(i.__INNER_EVENT_DESTROY__,this))}}),Object.defineProperty(i.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){void 0===t&&(t=0),void 0===r&&(r=0),void 0===i&&(i=0),!e.isNumber(t)||!e.isNumber(r)||!e.isNumber(i)||t<=0||r<=0||t<r?this._logger.error(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> max: ".concat(t,",min: ").concat(r,", start: ").concat(i),trackId:this._id})):(this._logger.info(n.L_LOCAL_TRACK_SET_BITRATE_O,JSON.stringify({status:o.SUCCESSED,max:t,min:r,start:i,trackId:this._id})),this._bitrateInfo={max:t,min:r,start:i})}}),Object.defineProperty(i.prototype,"getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t,r,i,n,o,a,s,c,u=0,l=0,d=0;return(null===(r=this._msTrack)||void 0===r?void 0:r.kind)===Ne.VIDEO?(u=(e=ut(this._msTrack)).min,l=e.max):(null===(i=this._msTrack)||void 0===i?void 0:i.kind)===Ne.AUDIO&&(u=(t={min:32,max:32}).min,l=t.max),(null===(n=this._bitrateInfo)||void 0===n?void 0:n.max)&&(d=.7*(null===(o=this._bitrateInfo)||void 0===o?void 0:o.max)),{min:(null===(a=this._bitrateInfo)||void 0===a?void 0:a.min)||u,max:(null===(s=this._bitrateInfo)||void 0===s?void 0:s.max)||l,start:(null===(c=this._bitrateInfo)||void 0===c?void 0:c.start)||d}}}),Object.defineProperty(i,"EVENT_LOCAL_TRACK_END",{enumerable:!0,configurable:!0,writable:!0,value:"local-track-end"}),Object.defineProperty(i,"__INNER_EVENT_MUTED_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-muted-change"}),Object.defineProperty(i,"__INNER_EVENT_DESTROY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-destroy"}),i}(Ve),We=function(t){function i(e,r,i,n){return t.call(this,e,r,i,"audio",n)||this}return r(i,t),Object.defineProperty(i.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.validate("audioBitrate",t,(function(e){return e in exports.RCAudioBitrate}))){var r=Je[t];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else this._logger.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> params type is RCAudioBitrate"}))}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=l(r,2),o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),i}(Ke),Ye=function(t){function i(e,r,i,n,o){void 0===o&&(o=!1);var a=t.call(this,e,r,i,"video",n)||this;return Object.defineProperty(a,"_isTiny",{enumerable:!0,configurable:!0,writable:!0,value:o}),a}return r(i,t),Object.defineProperty(i.prototype,"__isTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isTiny}}),Object.defineProperty(i.prototype,"getStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getStreamId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(i.prototype,"getTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.prototype.getTrackId.call(this);return this._isTiny?"".concat(e,"_tiny"):e}}),Object.defineProperty(i.prototype,"setRecommendBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(e.validate("videoBitrate",t,(function(e){return e in exports.RCVideoBitrate}))){var r=Ge[t];this.setBitrate(r.max,r.min,r.start||.7*r.max)}else this._logger.warn(n.L_RTC_SET_RECOMMEND_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> params type is RCVideoBitrate"}))}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=l(r,2),o=n[0],a=void 0===o?1:o,s=n[1],c=void 0===s?.7*e||1:s;t.prototype.setBitrate.call(this,e,a,c)}}),i}(Ke),ze=function(e){function t(r,i,n,o,a,s){var c=e.call(this,r,i,n,o,a)||this;return Object.defineProperty(c,"_resource",{enumerable:!0,configurable:!0,writable:!0,value:s}),t._innerSetMapping(c.getTrackId(),s),c}return r(t,e),Object.defineProperty(t,"_innerSetMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._mapping.get(t)||[];r.push(e),this._mapping.set(t,r)}}),Object.defineProperty(t,"_innerRemoveMapping",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n=null===(r=this._mapping.get(t))||void 0===r?void 0:r.filter((function(t){return t!==e}));n&&n.length>0?this._mapping.set(t,n):(this._mapping.delete(t),t.pause(),t.src="",null===(i=t.parentNode)||void 0===i||i.removeChild(t))}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.isAudioTrack()&&this.mute(),t._innerRemoveMapping(this.getTrackId(),this._resource),e.prototype.destroy.call(this)}}),Object.defineProperty(t,"_mapping",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),t}(Ke),qe=function(e){function t(t,r,i,n,o){return e.call(this,t,r,i,"video",n,o)||this}return r(t,e),t}(ze),Qe=function(e){function t(t,r,i,n,o){return e.call(this,t,r,i,"audio",n,o)||this}return r(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._resource&&(this._resource.muted=t),[2,e.prototype._setLocalMuted.call(this,t)]}))}))}}),Object.defineProperty(t.prototype,"play",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this._setLocalMuted(!1)];case 1:return[2,{code:e.sent()}]}}))}))}}),t}(ze),Ze=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_originTrack",{enumerable:!0,configurable:!0,writable:!0,value:null}),t}return r(t,e),Object.defineProperty(t.prototype,"apply3ANoiseWorklet",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t,r;return c(this,(function(i){switch(i.label){case 0:return this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_T),this._originTrack?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"3A noise module already applied"})),[2,{code:exports.RCRTCCode.SUCCESS}]):!this._msTrack||this.isDestroyed()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"track not ready"})),[2,{code:exports.RCRTCCode.TRACK_NOT_READY}]):this.isPublished()?(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"track already published"})),[2,{code:exports.RCRTCCode.APPLY_3A_NOISE_WORKLET_BEFORE_PUBLISH}]):[4,He.apply3ANoiseWorklet(this._msTrack)];case 1:return e=i.sent(),t=e.code,r=e.track,t===exports.RCRTCCode.SUCCESS&&r?(this._originTrack=this._msTrack,this._msTrack=r,this._logger.info(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.SUCCESSED})),[2,{code:exports.RCRTCCode.SUCCESS}]):(this._logger.warn(n.A_APPLY_3A_NOISE_WORKLET_R,JSON.stringify({status:o.FAILED,msg:"apply 3A noise module failed: ".concat(t)})),[2,{code:t}])}}))}))}}),Object.defineProperty(t.prototype,"__innerSetMediaStreamTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(t){!t&&this._originTrack&&(He.release3ANoiseWorklet(this._originTrack),this._originTrack.stop(),this._originTrack=null),e.prototype.__innerSetMediaStreamTrack.call(this,t)}}),t}(We),Xe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(Ye),$e=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(Ke.__INNER_EVENT_DESTROY__,this)}}),t}(Ye),et=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_onTrackEnded",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype._onTrackEnded.call(this),this.isPublished()&&this.emit(Ke.__INNER_EVENT_DESTROY__,this)}}),t}(We),tt=function(e){function t(t,r,i,n,o){var a=e.call(this,t,r,i,n,!1,o)||this;return Object.defineProperty(a,"_isSubscribed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),a}return r(t,e),Object.defineProperty(t.prototype,"__innerSetRemoteMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteMuted=e}}),Object.defineProperty(t.prototype,"__innerSetSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubscribed=e}}),Object.defineProperty(t.prototype,"isSubscribed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubscribed}}),t}(Ve),rt=function(e){function t(t,r,i,n){return e.call(this,t,r,i,"audio",n)||this}return r(t,e),Object.defineProperty(t.prototype,"_setLocalMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=Ct.browser,i=Ct.version;return this._element&&i&&/chrome/i.test(r)&&i>=130&&(this._element.muted=t),e.prototype._setLocalMuted.call(this,t)}}),Object.defineProperty(t.prototype,"getVolume",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return 100*((null===(e=this._element)||void 0===e?void 0:e.volume)||0)}}),t}(tt),it=function(e){function t(t,r,i,n){var o=e.call(this,t,r,i,"video",n)||this;return Object.defineProperty(o,"_isSubTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),o}return r(t,e),Object.defineProperty(t.prototype,"__innerSetIsTinyTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._isSubTiny=e}}),Object.defineProperty(t.prototype,"isSubTiny",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isSubTiny}}),t}(tt),nt=function(e,t){return{name:e,content:JSON.stringify({uris:t,ignore:!0})}},ot=function(e){return JSON.stringify(e)},at=function(e){return/^[a-zA-Z\d-=]+$/g.test(e)},st=function(t){if(void 0===t)return 0;if(e.isNumber(t))return t;var r=t;return r.exact||r.ideal||r.max||0},ct=function(e){var t=e.getSettings(),r=e.getConstraints();return{width:st(r.width)||t.width||0,height:st(r.height)||t.height||0,frameRate:t.frameRate||st(r.frameRate)}},ut=function(e){var t=ct(e),r=t.width,i=t.height,n=t.frameRate,o=De(r||1920,i||1080),a=Ue(n);return{min:o.minBitrate*a,max:o.maxBitrate*a}},lt=function(e){return[e.msid,e.mediaType].join("_")},dt=function(e){var t=e.split("_");return{mediaType:parseInt(t.pop()),tag:t.pop(),userId:t.join("_")}},_t=function(e,t){return[e,t].join("_")},pt=function(e){return e.map((function(e){return a({},e)}))},ft=function(e,t,r){void 0===r&&(r=!1),e=e.slice();var i=[],n=[],o=[];return t.forEach((function(t){var n=lt(t),a=e.findIndex((function(e){return lt(e)===n}));if(r&&(a=e.findIndex((function(e){return e.uri===t.uri}))),-1!==a){var s=e[a];s.uri!==t.uri?i.push(t):s.state!==t.state&&o.push(t),e.splice(a,1)}else i.push(t)})),n.push.apply(n,d([],l(e),!1)),{publishedList:i,unpublishedList:n,modifiedList:o}},ht=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},bt=function(e){if(Ae[e]){var t=Ae[e];return{width:t.width,height:t.height}}var r=l(e.split("_").map((function(e){return parseInt(e.replace(/[^\d]/g,""))})),2);return{width:r[0],height:r[1]}},Rt=function(e){return!!exports.RCResolution[e]},gt=function(e){return!!exports.RCFrameRate[e]},mt=function(e){return parseInt(e.replace("FPS_",""))},Ct=function(){var e=Ie.browserDetails;return{browser:e.browser,version:e.version,supportsUnifiedPlan:!1!==e.supportsUnifiedPlan}}();function vt(){return"captureStream"in HTMLMediaElement.prototype||"mozCaptureStream"in HTMLMediaElement.prototype}function Ot(){return"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices}var Tt,Et,It=function(e){return"[object Null]"===Object.prototype.toString.call(e)},St=function(e){return 1===e.type},yt=function(e,t,r,i){var o={},a=Object.keys(e.users);return a.length&&a.forEach((function(a){var s=[],c=e.users[a];if(c.extra){var u=JSON.parse(c.extra).roomId;if(t!==u)return}if(c.uris)try{s.push.apply(s,d([],l(JSON.parse(c.uris)),!1))}catch(e){r.warn(n.L_PARSE_ROOMDATA_URIS_R,"invalid user data -> userId: ".concat(a,", userData: ").concat(c),i)}o[a]=s})),o},Lt=function(e){return e instanceof Ve?e.getTrackId():e.track.getTrackId()},Pt=function(t){if(!e.isObject(t)||void 0===t.low||void 0===t.high)return t;var r=t.low;return r<0&&(r+=4294967296),r=r.toString(16),parseInt(t.high.toString(16)+"00000000".replace(new RegExp("0{".concat(r.length,"}$")),r),16)};!function(e){e.PUBLISH="RCRTC:PublishResource",e.UNPUBLISH="RCRTC:UnpublishResource",e.MODIFY="RCRTC:ModifyResource",e.TOTAL_CONTENT_RESOURCE="RCRTC:TotalContentResources",e.STATE="RCRTC:state",e.ROOM_NOTIFY="RCRTC:RoomNtf",e.USER_NOTIFY="RCRTC:UserNtf",e.KICK="RCRTC:kick",e.PK_INVITE="RCRTC:invite",e.PK_INVITE_TIMEOUT="RCRTC:inviteTimeout",e.PK_CANCEL_INVITE="RCRTC:cancelInvite",e.PK_INVITE_ANSWER="RCRTC:answerInvite",e.PK_END="RCRTC:endInvite",e.OTHER_ROOM_OFFLINE="RCRTC:otherRoomOffline",e.ROOM_TASK_FINISH="RCRTC:roomTaskFinish"}(Tt||(Tt={})),exports.RCRTCPingResult=void 0,(Et=exports.RCRTCPingResult||(exports.RCRTCPingResult={})).SUCCESS="Success",Et.FAIL="Fail";var Nt=function(){function t(e,t,r,i){void 0===i&&(i=5e3),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomMode",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_gap",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_latestTimestamp",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onPingResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_started",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_timer",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger}return Object.defineProperty(t.prototype,"start",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._started||(e<15e3&&(e=15e3),this._logger.info(n.L_PINGER_START_O,JSON.stringify({interval:this._gap,offlineKickTime:e})),this._started=!0,this._checkAlive(e))}}),Object.defineProperty(t.prototype,"_sendPing",{enumerable:!1,configurable:!0,writable:!0,value:function(){var t=this;return new Promise((function(r){t._context.rtcPing(t._roomId,t._roomMode).then(r),setTimeout(r,5e3,{code:e.ErrorCode.TIMEOUT})}))}}),Object.defineProperty(t.prototype,"_checkAlive",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,o,a,s,u,l=this;return c(this,(function(c){switch(c.label){case 0:return r=this._context.logger,i=r.createTraceId(),[4,this._sendPing()];case 1:return o=c.sent(),a=o.code,s=o.data,this._started?(u=Date.now(),a===e.ErrorCode.SUCCESS?(this._latestTimestamp=u,this.onPingResult(exports.RCRTCPingResult.SUCCESS,s.version),this._timer=setTimeout((function(){return l._checkAlive(t)}),this._gap),[2]):(r.error(n.L_PINGER_SEND_RTCPING_E,JSON.stringify({roomId:this._roomId,code:a}),i),this.onPingResult(exports.RCRTCPingResult.FAIL),40003===a||u-this._latestTimestamp>t?(this.stop(),this.onFailed(40003===a),[2]):(this._timer=setTimeout((function(){return l._checkAlive(t)}),this._gap),[2]))):[2]}}))}))}}),Object.defineProperty(t.prototype,"stop",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._started&&(this._logger.info(n.L_PINGER_STOP_O),this._started=!1,this._timer&&(clearTimeout(this._timer),this._timer=null))}}),t}();function At(e){let t=e.length;for(;--t>=0;)e[t]=0}const wt=256,Dt=286,kt=30,Ut=15,Mt=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),xt=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),jt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Bt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Vt=new Array(576);At(Vt);const Ft=new Array(60);At(Ft);const Jt=new Array(512);At(Jt);const Gt=new Array(256);At(Gt);const Ht=new Array(29);At(Ht);const Kt=new Array(kt);function Wt(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let Yt,zt,qt;function Qt(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}At(Kt);const Zt=e=>e<256?Jt[e]:Jt[256+(e>>>7)],Xt=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},$t=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Xt(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},er=(e,t,r)=>{$t(e,r[2*t],r[2*t+1])},tr=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},rr=(e,t,r)=>{const i=new Array(16);let n,o,a=0;for(n=1;n<=Ut;n++)a=a+r[n-1]<<1,i[n]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=tr(i[t]++,t))}},ir=e=>{let t;for(t=0;t<Dt;t++)e.dyn_ltree[2*t]=0;for(t=0;t<kt;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},nr=e=>{e.bi_valid>8?Xt(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},or=(e,t,r,i)=>{const n=2*t,o=2*r;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[r]},ar=(e,t,r)=>{const i=e.heap[r];let n=r<<1;for(;n<=e.heap_len&&(n<e.heap_len&&or(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!or(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i},sr=(e,t,r)=>{let i,n,o,a,s=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+s++],i+=(255&e.pending_buf[e.sym_buf+s++])<<8,n=e.pending_buf[e.sym_buf+s++],0===i?er(e,n,t):(o=Gt[n],er(e,o+wt+1,t),a=Mt[o],0!==a&&(n-=Ht[o],$t(e,n,a)),i--,o=Zt(i),er(e,o,r),a=xt[o],0!==a&&(i-=Kt[o],$t(e,i,a)))}while(s<e.sym_next);er(e,256,t)},cr=(e,t)=>{const r=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,u=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(e.heap[++e.heap_len]=u=a,e.depth[a]=0):r[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,n&&(e.static_len-=i[2*c+1]);for(t.max_code=u,a=e.heap_len>>1;a>=1;a--)ar(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ar(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[2*c]=r[2*a]+r[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[2*a+1]=r[2*s+1]=c,e.heap[1]=c++,ar(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,d,_,p,f,h=0;for(_=0;_<=Ut;_++)e.bl_count[_]=0;for(r[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],_=r[2*r[2*l+1]+1]+1,_>c&&(_=c,h++),r[2*l+1]=_,l>i||(e.bl_count[_]++,p=0,l>=s&&(p=a[l-s]),f=r[2*l],e.opt_len+=f*(_+p),o&&(e.static_len+=f*(n[2*l+1]+p)));if(0!==h){do{for(_=c-1;0===e.bl_count[_];)_--;e.bl_count[_]--,e.bl_count[_+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(_=c;0!==_;_--)for(l=e.bl_count[_];0!==l;)d=e.heap[--u],d>i||(r[2*d+1]!==_&&(e.opt_len+=(_-r[2*d+1])*r[2*d],r[2*d+1]=_),l--)}})(e,t),rr(r,u,e.bl_count)},ur=(e,t,r)=>{let i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))},lr=(e,t,r)=>{let i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++s<c&&n===a)){if(s<u)do{er(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(er(e,n,e.bl_tree),s--),er(e,16,e.bl_tree),$t(e,s-3,2)):s<=10?(er(e,17,e.bl_tree),$t(e,s-3,3)):(er(e,18,e.bl_tree),$t(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}};let dr=!1;const _r=(e,t,r,i)=>{$t(e,0+(i?1:0),3),nr(e),Xt(e,r),Xt(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var pr=(e,t,r,i)=>{let n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<wt;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),cr(e,e.l_desc),cr(e,e.d_desc),a=(e=>{let t;for(ur(e,e.dyn_ltree,e.l_desc.max_code),ur(e,e.dyn_dtree,e.d_desc.max_code),cr(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Bt[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?_r(e,t,r,i):4===e.strategy||o===n?($t(e,2+(i?1:0),3),sr(e,Vt,Ft)):($t(e,4+(i?1:0),3),((e,t,r,i)=>{let n;for($t(e,t-257,5),$t(e,r-1,5),$t(e,i-4,4),n=0;n<i;n++)$t(e,e.bl_tree[2*Bt[n]+1],3);lr(e,e.dyn_ltree,t-1),lr(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),sr(e,e.dyn_ltree,e.dyn_dtree)),ir(e),i&&nr(e)},fr={_tr_init:e=>{dr||((()=>{let e,t,r,i,n;const o=new Array(16);for(r=0,i=0;i<28;i++)for(Ht[i]=r,e=0;e<1<<Mt[i];e++)Gt[r++]=i;for(Gt[r-1]=i,n=0,i=0;i<16;i++)for(Kt[i]=n,e=0;e<1<<xt[i];e++)Jt[n++]=i;for(n>>=7;i<kt;i++)for(Kt[i]=n<<7,e=0;e<1<<xt[i]-7;e++)Jt[256+n++]=i;for(t=0;t<=Ut;t++)o[t]=0;for(e=0;e<=143;)Vt[2*e+1]=8,e++,o[8]++;for(;e<=255;)Vt[2*e+1]=9,e++,o[9]++;for(;e<=279;)Vt[2*e+1]=7,e++,o[7]++;for(;e<=287;)Vt[2*e+1]=8,e++,o[8]++;for(rr(Vt,287,o),e=0;e<kt;e++)Ft[2*e+1]=5,Ft[2*e]=tr(e,5);Yt=new Wt(Vt,Mt,257,Dt,Ut),zt=new Wt(Ft,xt,0,kt,Ut),qt=new Wt(new Array(0),jt,0,19,7)})(),dr=!0),e.l_desc=new Qt(e.dyn_ltree,Yt),e.d_desc=new Qt(e.dyn_dtree,zt),e.bl_desc=new Qt(e.bl_tree,qt),e.bi_buf=0,e.bi_valid=0,ir(e)},_tr_stored_block:_r,_tr_flush_block:pr,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(Gt[r]+wt+1)]++,e.dyn_dtree[2*Zt(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{$t(e,2,3),er(e,256,Vt),(e=>{16===e.bi_valid?(Xt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var hr=(e,t,r,i)=>{let n=65535&e,o=e>>>16&65535,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{n=n+t[i++]|0,o=o+n|0}while(--a);n%=65521,o%=65521}return n|o<<16};const br=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var Rr=(e,t,r,i)=>{const n=br,o=i+r;e^=-1;for(let r=i;r<o;r++)e=e>>>8^n[255&(e^t[r])];return~e},gr={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},mr={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Cr,_tr_stored_block:vr,_tr_flush_block:Or,_tr_tally:Tr,_tr_align:Er}=fr,{Z_NO_FLUSH:Ir,Z_PARTIAL_FLUSH:Sr,Z_FULL_FLUSH:yr,Z_FINISH:Lr,Z_BLOCK:Pr,Z_OK:Nr,Z_STREAM_END:Ar,Z_STREAM_ERROR:wr,Z_DATA_ERROR:Dr,Z_BUF_ERROR:kr,Z_DEFAULT_COMPRESSION:Ur,Z_FILTERED:Mr,Z_HUFFMAN_ONLY:xr,Z_RLE:jr,Z_FIXED:Br,Z_DEFAULT_STRATEGY:Vr,Z_UNKNOWN:Fr,Z_DEFLATED:Jr}=mr,Gr=258,Hr=262,Kr=42,Wr=113,Yr=666,zr=(e,t)=>(e.msg=gr[t],t),qr=e=>2*e-(e>4?9:0),Qr=e=>{let t=e.length;for(;--t>=0;)e[t]=0},Zr=e=>{let t,r,i,n=e.w_size;t=e.hash_size,i=t;do{r=e.head[--i],e.head[i]=r>=n?r-n:0}while(--t);t=n,i=t;do{r=e.prev[--i],e.prev[i]=r>=n?r-n:0}while(--t)};let Xr=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const $r=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},ei=(e,t)=>{Or(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,$r(e.strm)},ti=(e,t)=>{e.pending_buf[e.pending++]=t},ri=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},ii=(e,t,r,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),r),1===e.state.wrap?e.adler=hr(e.adler,t,n,r):2===e.state.wrap&&(e.adler=Rr(e.adler,t,n,r)),e.next_in+=n,e.total_in+=n,n)},ni=(e,t)=>{let r,i,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-Hr?e.strstart-(e.w_size-Hr):0,u=e.window,l=e.w_mask,d=e.prev,_=e.strstart+Gr;let p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,u[r+a]===f&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<_);if(i=Gr-(_-o),o=_-Gr,i>a){if(e.match_start=t,a=i,i>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=d[t&l])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead},oi=e=>{const t=e.w_size;let r,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Hr)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),Zr(e),i+=t),0===e.strm.avail_in)break;if(r=ii(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=Xr(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=Xr(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Hr&&0!==e.strm.avail_in)},ai=(e,t)=>{let r,i,n,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(r=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,i=e.strstart-e.block_start,r>i+e.strm.avail_in&&(r=i+e.strm.avail_in),r>n&&(r=n),r<o&&(0===r&&t!==Lr||t===Ir||r!==i+e.strm.avail_in))break;a=t===Lr&&r===i+e.strm.avail_in?1:0,vr(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,$r(e.strm),i&&(i>r&&(i=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,r-=i),r&&(ii(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==Ir&&t!==Lr&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(n=e.window_size-e.strstart,e.strm.avail_in>n&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(ii(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,o=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=o||(i||t===Lr)&&t!==Ir&&0===e.strm.avail_in&&i<=n)&&(r=i>n?n:i,a=t===Lr&&0===e.strm.avail_in&&r===i?1:0,vr(e,e.block_start,r,a),e.block_start+=r,$r(e.strm)),a?3:1)},si=(e,t)=>{let r,i;for(;;){if(e.lookahead<Hr){if(oi(e),e.lookahead<Hr&&t===Ir)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Xr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-Hr&&(e.match_length=ni(e,r)),e.match_length>=3)if(i=Tr(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Xr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Xr(e,e.ins_h,e.window[e.strstart+1]);else i=Tr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(ei(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Lr?(ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ei(e,!1),0===e.strm.avail_out)?1:2},ci=(e,t)=>{let r,i,n;for(;;){if(e.lookahead<Hr){if(oi(e),e.lookahead<Hr&&t===Ir)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Xr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-Hr&&(e.match_length=ni(e,r),e.match_length<=5&&(e.strategy===Mr||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=Tr(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=Xr(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(ei(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=Tr(e,0,e.window[e.strstart-1]),i&&ei(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=Tr(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Lr?(ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ei(e,!1),0===e.strm.avail_out)?1:2};function ui(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}const li=[new ui(0,0,0,0,ai),new ui(4,4,8,4,si),new ui(4,5,16,8,si),new ui(4,6,32,32,si),new ui(4,4,16,16,ci),new ui(8,16,32,32,ci),new ui(8,16,128,128,ci),new ui(8,32,128,256,ci),new ui(32,128,258,1024,ci),new ui(32,258,258,4096,ci)];function di(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Jr,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),Qr(this.dyn_ltree),Qr(this.dyn_dtree),Qr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),Qr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),Qr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const _i=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Kr&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Wr&&t.status!==Yr?1:0},pi=e=>{if(_i(e))return zr(e,wr);e.total_in=e.total_out=0,e.data_type=Fr;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Kr:Wr,e.adler=2===t.wrap?0:1,t.last_flush=-2,Cr(t),Nr},fi=e=>{const t=pi(e);var r;return t===Nr&&((r=e.state).window_size=2*r.w_size,Qr(r.head),r.max_lazy_match=li[r.level].max_lazy,r.good_match=li[r.level].good_length,r.nice_match=li[r.level].nice_length,r.max_chain_length=li[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},hi=(e,t,r,i,n,o)=>{if(!e)return wr;let a=1;if(t===Ur&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||r!==Jr||i<8||i>15||t<0||t>9||o<0||o>Br||8===i&&1!==a)return zr(e,wr);8===i&&(i=9);const s=new di;return e.state=s,s.strm=e,s.status=Kr,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=r,fi(e)};var bi={deflateInit:(e,t)=>hi(e,t,Jr,15,8,Vr),deflateInit2:hi,deflateReset:fi,deflateResetKeep:pi,deflateSetHeader:(e,t)=>_i(e)||2!==e.state.wrap?wr:(e.state.gzhead=t,Nr),deflate:(e,t)=>{if(_i(e)||t>Pr||t<0)return e?zr(e,wr):wr;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===Yr&&t!==Lr)return zr(e,0===e.avail_out?kr:wr);const i=r.last_flush;if(r.last_flush=t,0!==r.pending){if($r(e),0===e.avail_out)return r.last_flush=-1,Nr}else if(0===e.avail_in&&qr(t)<=qr(i)&&t!==Lr)return zr(e,kr);if(r.status===Yr&&0!==e.avail_in)return zr(e,kr);if(r.status===Kr&&0===r.wrap&&(r.status=Wr),r.status===Kr){let t=Jr+(r.w_bits-8<<4)<<8,i=-1;if(i=r.strategy>=xr||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=i<<6,0!==r.strstart&&(t|=32),t+=31-t%31,ri(r,t),0!==r.strstart&&(ri(r,e.adler>>>16),ri(r,65535&e.adler)),e.adler=1,r.status=Wr,$r(e),0!==r.pending)return r.last_flush=-1,Nr}if(57===r.status)if(e.adler=0,ti(r,31),ti(r,139),ti(r,8),r.gzhead)ti(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ti(r,255&r.gzhead.time),ti(r,r.gzhead.time>>8&255),ti(r,r.gzhead.time>>16&255),ti(r,r.gzhead.time>>24&255),ti(r,9===r.level?2:r.strategy>=xr||r.level<2?4:0),ti(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(ti(r,255&r.gzhead.extra.length),ti(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=Rr(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(ti(r,0),ti(r,0),ti(r,0),ti(r,0),ti(r,0),ti(r,9===r.level?2:r.strategy>=xr||r.level<2?4:0),ti(r,3),r.status=Wr,$r(e),0!==r.pending)return r.last_flush=-1,Nr;if(69===r.status){if(r.gzhead.extra){let t=r.pending,i=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+i>r.pending_buf_size;){let n=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=Rr(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=n,$r(e),0!==r.pending)return r.last_flush=-1,Nr;t=0,i-=n}let n=new Uint8Array(r.gzhead.extra);r.pending_buf.set(n.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending+=i,r.gzhead.hcrc&&r.pending>t&&(e.adler=Rr(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=Rr(e.adler,r.pending_buf,r.pending-i,i)),$r(e),0!==r.pending)return r.last_flush=-1,Nr;i=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,ti(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>i&&(e.adler=Rr(e.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,i=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(e.adler=Rr(e.adler,r.pending_buf,r.pending-i,i)),$r(e),0!==r.pending)return r.last_flush=-1,Nr;i=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,ti(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>i&&(e.adler=Rr(e.adler,r.pending_buf,r.pending-i,i))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&($r(e),0!==r.pending))return r.last_flush=-1,Nr;ti(r,255&e.adler),ti(r,e.adler>>8&255),e.adler=0}if(r.status=Wr,$r(e),0!==r.pending)return r.last_flush=-1,Nr}if(0!==e.avail_in||0!==r.lookahead||t!==Ir&&r.status!==Yr){let i=0===r.level?ai(r,t):r.strategy===xr?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(oi(e),0===e.lookahead)){if(t===Ir)return 1;break}if(e.match_length=0,r=Tr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(ei(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Lr?(ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ei(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===jr?((e,t)=>{let r,i,n,o;const a=e.window;for(;;){if(e.lookahead<=Gr){if(oi(e),e.lookahead<=Gr&&t===Ir)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=e.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){o=e.strstart+Gr;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=Gr-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Tr(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Tr(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(ei(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Lr?(ei(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(ei(e,!1),0===e.strm.avail_out)?1:2})(r,t):li[r.level].func(r,t);if(3!==i&&4!==i||(r.status=Yr),1===i||3===i)return 0===e.avail_out&&(r.last_flush=-1),Nr;if(2===i&&(t===Sr?Er(r):t!==Pr&&(vr(r,0,0,!1),t===yr&&(Qr(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),$r(e),0===e.avail_out))return r.last_flush=-1,Nr}return t!==Lr?Nr:r.wrap<=0?Ar:(2===r.wrap?(ti(r,255&e.adler),ti(r,e.adler>>8&255),ti(r,e.adler>>16&255),ti(r,e.adler>>24&255),ti(r,255&e.total_in),ti(r,e.total_in>>8&255),ti(r,e.total_in>>16&255),ti(r,e.total_in>>24&255)):(ri(r,e.adler>>>16),ri(r,65535&e.adler)),$r(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Nr:Ar)},deflateEnd:e=>{if(_i(e))return wr;const t=e.state.status;return e.state=null,t===Wr?zr(e,Dr):Nr},deflateSetDictionary:(e,t)=>{let r=t.length;if(_i(e))return wr;const i=e.state,n=i.wrap;if(2===n||1===n&&i.status!==Kr||i.lookahead)return wr;if(1===n&&(e.adler=hr(e.adler,t,r,0)),i.wrap=0,r>=i.w_size){0===n&&(Qr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(r-i.w_size,r),0),t=e,r=i.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,oi(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do{i.ins_h=Xr(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++}while(--t);i.strstart=e,i.lookahead=2,oi(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,i.wrap=n,Nr},deflateInfo:"pako deflate (from Nodeca project)"};const Ri=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var gi=function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)Ri(r,t)&&(e[t]=r[t])}}return e},mi=e=>{let t=0;for(let r=0,i=e.length;r<i;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,i=0,n=e.length;t<n;t++){let n=e[t];r.set(n,i),i+=n.length}return r};let Ci=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Ci=!1}const vi=new Uint8Array(256);for(let e=0;e<256;e++)vi[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;vi[254]=vi[254]=1;var Oi=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,i,n,o,a=e.length,s=0;for(n=0;n<a;n++)r=e.charCodeAt(n),55296==(64512&r)&&n+1<a&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,n=0;o<s;n++)r=e.charCodeAt(n),55296==(64512&r)&&n+1<a&&(i=e.charCodeAt(n+1),56320==(64512&i)&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},Ti=(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let i,n;const o=new Array(2*r);for(n=0,i=0;i<r;){let t=e[i++];if(t<128){o[n++]=t;continue}let a=vi[t];if(a>4)o[n++]=65533,i+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&i<r;)t=t<<6|63&e[i++],a--;a>1?o[n++]=65533:t<65536?o[n++]=t:(t-=65536,o[n++]=55296|t>>10&1023,o[n++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&Ci)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r})(o,n)},Ei=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+vi[e[r]]>t?r:t};var Ii=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const Si=Object.prototype.toString,{Z_NO_FLUSH:yi,Z_SYNC_FLUSH:Li,Z_FULL_FLUSH:Pi,Z_FINISH:Ni,Z_OK:Ai,Z_STREAM_END:wi,Z_DEFAULT_COMPRESSION:Di,Z_DEFAULT_STRATEGY:ki,Z_DEFLATED:Ui}=mr;function Mi(e){this.options=gi({level:Di,method:Ui,chunkSize:16384,windowBits:15,memLevel:8,strategy:ki},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ii,this.strm.avail_out=0;let r=bi.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Ai)throw new Error(gr[r]);if(t.header&&bi.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?Oi(t.dictionary):"[object ArrayBuffer]"===Si.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=bi.deflateSetDictionary(this.strm,e),r!==Ai)throw new Error(gr[r]);this._dict_set=!0}}function xi(e,t){const r=new Mi(t);if(r.push(e,!0),r.err)throw r.msg||gr[r.err];return r.result}Mi.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize;let n,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?Ni:yi,"string"==typeof e?r.input=Oi(e):"[object ArrayBuffer]"===Si.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(o===Li||o===Pi)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(n=bi.deflate(r,o),n===wi)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=bi.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Ai;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},Mi.prototype.onData=function(e){this.chunks.push(e)},Mi.prototype.onEnd=function(e){e===Ai&&(this.result=mi(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ji={Deflate:Mi,deflate:xi,deflateRaw:function(e,t){return(t=t||{}).raw=!0,xi(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,xi(e,t)},constants:mr};const Bi=16209;var Vi=function(e,t){let r,i,n,o,a,s,c,u,l,d,_,p,f,h,b,R,g,m,C,v,O,T,E,I;const S=e.state;r=e.next_in,E=e.input,i=r+(e.avail_in-5),n=e.next_out,I=e.output,o=n-(t-e.avail_out),a=n+(e.avail_out-257),s=S.dmax,c=S.wsize,u=S.whave,l=S.wnext,d=S.window,_=S.hold,p=S.bits,f=S.lencode,h=S.distcode,b=(1<<S.lenbits)-1,R=(1<<S.distbits)-1;e:do{p<15&&(_+=E[r++]<<p,p+=8,_+=E[r++]<<p,p+=8),g=f[_&b];t:for(;;){if(m=g>>>24,_>>>=m,p-=m,m=g>>>16&255,0===m)I[n++]=65535&g;else{if(!(16&m)){if(64&m){if(32&m){S.mode=16191;break e}e.msg="invalid literal/length code",S.mode=Bi;break e}g=f[(65535&g)+(_&(1<<m)-1)];continue t}for(C=65535&g,m&=15,m&&(p<m&&(_+=E[r++]<<p,p+=8),C+=_&(1<<m)-1,_>>>=m,p-=m),p<15&&(_+=E[r++]<<p,p+=8,_+=E[r++]<<p,p+=8),g=h[_&R];;){if(m=g>>>24,_>>>=m,p-=m,m=g>>>16&255,16&m){if(v=65535&g,m&=15,p<m&&(_+=E[r++]<<p,p+=8,p<m&&(_+=E[r++]<<p,p+=8)),v+=_&(1<<m)-1,v>s){e.msg="invalid distance too far back",S.mode=Bi;break e}if(_>>>=m,p-=m,m=n-o,v>m){if(m=v-m,m>u&&S.sane){e.msg="invalid distance too far back",S.mode=Bi;break e}if(O=0,T=d,0===l){if(O+=c-m,m<C){C-=m;do{I[n++]=d[O++]}while(--m);O=n-v,T=I}}else if(l<m){if(O+=c+l-m,m-=l,m<C){C-=m;do{I[n++]=d[O++]}while(--m);if(O=0,l<C){m=l,C-=m;do{I[n++]=d[O++]}while(--m);O=n-v,T=I}}}else if(O+=l-m,m<C){C-=m;do{I[n++]=d[O++]}while(--m);O=n-v,T=I}for(;C>2;)I[n++]=T[O++],I[n++]=T[O++],I[n++]=T[O++],C-=3;C&&(I[n++]=T[O++],C>1&&(I[n++]=T[O++]))}else{O=n-v;do{I[n++]=I[O++],I[n++]=I[O++],I[n++]=I[O++],C-=3}while(C>2);C&&(I[n++]=I[O++],C>1&&(I[n++]=I[O++]))}break}if(64&m){e.msg="invalid distance code",S.mode=Bi;break e}g=h[(65535&g)+(_&(1<<m)-1)]}}break}}while(r<i&&n<a);C=p>>3,r-=C,p-=C<<3,_&=(1<<p)-1,e.next_in=r,e.next_out=n,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=n<a?a-n+257:257-(n-a),S.hold=_,S.bits=p};const Fi=15,Ji=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Gi=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Hi=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Ki=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var Wi=(e,t,r,i,n,o,a,s)=>{const c=s.bits;let u,l,d,_,p,f,h=0,b=0,R=0,g=0,m=0,C=0,v=0,O=0,T=0,E=0,I=null;const S=new Uint16Array(16),y=new Uint16Array(16);let L,P,N,A=null;for(h=0;h<=Fi;h++)S[h]=0;for(b=0;b<i;b++)S[t[r+b]]++;for(m=c,g=Fi;g>=1&&0===S[g];g--);if(m>g&&(m=g),0===g)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(R=1;R<g&&0===S[R];R++);for(m<R&&(m=R),O=1,h=1;h<=Fi;h++)if(O<<=1,O-=S[h],O<0)return-1;if(O>0&&(0===e||1!==g))return-1;for(y[1]=0,h=1;h<Fi;h++)y[h+1]=y[h]+S[h];for(b=0;b<i;b++)0!==t[r+b]&&(a[y[t[r+b]]++]=b);if(0===e?(I=A=a,f=20):1===e?(I=Ji,A=Gi,f=257):(I=Hi,A=Ki,f=0),E=0,b=0,h=R,p=o,C=m,v=0,d=-1,T=1<<m,_=T-1,1===e&&T>852||2===e&&T>592)return 1;for(;;){L=h-v,a[b]+1<f?(P=0,N=a[b]):a[b]>=f?(P=A[a[b]-f],N=I[a[b]-f]):(P=96,N=0),u=1<<h-v,l=1<<C,R=l;do{l-=u,n[p+(E>>v)+l]=L<<24|P<<16|N}while(0!==l);for(u=1<<h-1;E&u;)u>>=1;if(0!==u?(E&=u-1,E+=u):E=0,b++,0==--S[h]){if(h===g)break;h=t[r+a[b]]}if(h>m&&(E&_)!==d){for(0===v&&(v=m),p+=R,C=h-v,O=1<<C;C+v<g&&(O-=S[C+v],!(O<=0));)C++,O<<=1;if(T+=1<<C,1===e&&T>852||2===e&&T>592)return 1;d=E&_,n[d]=m<<24|C<<16|p-o}}return 0!==E&&(n[p+E]=h-v<<24|64<<16),s.bits=m,0};const{Z_FINISH:Yi,Z_BLOCK:zi,Z_TREES:qi,Z_OK:Qi,Z_STREAM_END:Zi,Z_NEED_DICT:Xi,Z_STREAM_ERROR:$i,Z_DATA_ERROR:en,Z_MEM_ERROR:tn,Z_BUF_ERROR:rn,Z_DEFLATED:nn}=mr,on=16180,an=16190,sn=16191,cn=16192,un=16194,ln=16199,dn=16200,_n=16206,pn=16209,fn=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function hn(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const bn=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<on||t.mode>16211?1:0},Rn=e=>{if(bn(e))return $i;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=on,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,Qi},gn=e=>{if(bn(e))return $i;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,Rn(e)},mn=(e,t)=>{let r;if(bn(e))return $i;const i=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?$i:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,gn(e))},Cn=(e,t)=>{if(!e)return $i;const r=new hn;e.state=r,r.strm=e,r.window=null,r.mode=on;const i=mn(e,t);return i!==Qi&&(e.state=null),i};let vn,On,Tn=!0;const En=e=>{if(Tn){vn=new Int32Array(512),On=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Wi(1,e.lens,0,288,vn,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Wi(2,e.lens,0,32,On,0,e.work,{bits:5}),Tn=!1}e.lencode=vn,e.lenbits=9,e.distcode=On,e.distbits=5},In=(e,t,r,i)=>{let n;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),i>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(n=o.wsize-o.wnext,n>i&&(n=i),o.window.set(t.subarray(r-i,r-i+n),o.wnext),(i-=n)?(o.window.set(t.subarray(r-i,r),0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0};var Sn={inflateReset:gn,inflateReset2:mn,inflateResetKeep:Rn,inflateInit:e=>Cn(e,15),inflateInit2:Cn,inflate:(e,t)=>{let r,i,n,o,a,s,c,u,l,d,_,p,f,h,b,R,g,m,C,v,O,T,E=0;const I=new Uint8Array(4);let S,y;const L=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(bn(e)||!e.output||!e.input&&0!==e.avail_in)return $i;r=e.state,r.mode===sn&&(r.mode=cn),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,l=r.bits,d=s,_=c,T=Qi;e:for(;;)switch(r.mode){case on:if(0===r.wrap){r.mode=cn;break}for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(2&r.wrap&&35615===u){0===r.wbits&&(r.wbits=15),r.check=0,I[0]=255&u,I[1]=u>>>8&255,r.check=Rr(r.check,I,2,0),u=0,l=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=pn;break}if((15&u)!==nn){e.msg="unknown compression method",r.mode=pn;break}if(u>>>=4,l-=4,O=8+(15&u),0===r.wbits&&(r.wbits=O),O>15||O>r.wbits){e.msg="invalid window size",r.mode=pn;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&u?16189:sn,u=0,l=0;break;case 16181:for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(r.flags=u,(255&r.flags)!==nn){e.msg="unknown compression method",r.mode=pn;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=pn;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&4&r.wrap&&(I[0]=255&u,I[1]=u>>>8&255,r.check=Rr(r.check,I,2,0)),u=0,l=0,r.mode=16182;case 16182:for(;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.head&&(r.head.time=u),512&r.flags&&4&r.wrap&&(I[0]=255&u,I[1]=u>>>8&255,I[2]=u>>>16&255,I[3]=u>>>24&255,r.check=Rr(r.check,I,4,0)),u=0,l=0,r.mode=16183;case 16183:for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&4&r.wrap&&(I[0]=255&u,I[1]=u>>>8&255,r.check=Rr(r.check,I,2,0)),u=0,l=0,r.mode=16184;case 16184:if(1024&r.flags){for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&4&r.wrap&&(I[0]=255&u,I[1]=u>>>8&255,r.check=Rr(r.check,I,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(p=r.length,p>s&&(p=s),p&&(r.head&&(O=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(o,o+p),O)),512&r.flags&&4&r.wrap&&(r.check=Rr(r.check,i,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;p=0;do{O=i[o+p++],r.head&&O&&r.length<65536&&(r.head.name+=String.fromCharCode(O))}while(O&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=Rr(r.check,i,p,o)),s-=p,o+=p,O)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break e;p=0;do{O=i[o+p++],r.head&&O&&r.length<65536&&(r.head.comment+=String.fromCharCode(O))}while(O&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=Rr(r.check,i,p,o)),s-=p,o+=p,O)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;l<16;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(4&r.wrap&&u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=pn;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=sn;break;case 16189:for(;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}e.adler=r.check=fn(u),u=0,l=0,r.mode=an;case an:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,Xi;e.adler=r.check=1,r.mode=sn;case sn:if(t===zi||t===qi)break e;case cn:if(r.last){u>>>=7&l,l-=7&l,r.mode=_n;break}for(;l<3;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}switch(r.last=1&u,u>>>=1,l-=1,3&u){case 0:r.mode=16193;break;case 1:if(En(r),r.mode=ln,t===qi){u>>>=2,l-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=pn}u>>>=2,l-=2;break;case 16193:for(u>>>=7&l,l-=7&l;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=pn;break}if(r.length=65535&u,u=0,l=0,r.mode=un,t===qi)break e;case un:r.mode=16195;case 16195:if(p=r.length,p){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;n.set(i.subarray(o,o+p),a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=sn;break;case 16196:for(;l<14;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(r.nlen=257+(31&u),u>>>=5,l-=5,r.ndist=1+(31&u),u>>>=5,l-=5,r.ncode=4+(15&u),u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=pn;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;l<3;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.lens[L[r.have++]]=7&u,u>>>=3,l-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,S={bits:r.lenbits},T=Wi(0,r.lens,0,19,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid code lengths set",r.mode=pn;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;E=r.lencode[u&(1<<r.lenbits)-1],b=E>>>24,R=E>>>16&255,g=65535&E,!(b<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(g<16)u>>>=b,l-=b,r.lens[r.have++]=g;else{if(16===g){for(y=b+2;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(u>>>=b,l-=b,0===r.have){e.msg="invalid bit length repeat",r.mode=pn;break}O=r.lens[r.have-1],p=3+(3&u),u>>>=2,l-=2}else if(17===g){for(y=b+3;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=b,l-=b,O=0,p=3+(7&u),u>>>=3,l-=3}else{for(y=b+7;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=b,l-=b,O=0,p=11+(127&u),u>>>=7,l-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=pn;break}for(;p--;)r.lens[r.have++]=O}}if(r.mode===pn)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=pn;break}if(r.lenbits=9,S={bits:r.lenbits},T=Wi(1,r.lens,0,r.nlen,r.lencode,0,r.work,S),r.lenbits=S.bits,T){e.msg="invalid literal/lengths set",r.mode=pn;break}if(r.distbits=6,r.distcode=r.distdyn,S={bits:r.distbits},T=Wi(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,S),r.distbits=S.bits,T){e.msg="invalid distances set",r.mode=pn;break}if(r.mode=ln,t===qi)break e;case ln:r.mode=dn;case dn:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,Vi(e,_),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,l=r.bits,r.mode===sn&&(r.back=-1);break}for(r.back=0;E=r.lencode[u&(1<<r.lenbits)-1],b=E>>>24,R=E>>>16&255,g=65535&E,!(b<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(R&&!(240&R)){for(m=b,C=R,v=g;E=r.lencode[v+((u&(1<<m+C)-1)>>m)],b=E>>>24,R=E>>>16&255,g=65535&E,!(m+b<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=m,l-=m,r.back+=m}if(u>>>=b,l-=b,r.back+=b,r.length=g,0===R){r.mode=16205;break}if(32&R){r.back=-1,r.mode=sn;break}if(64&R){e.msg="invalid literal/length code",r.mode=pn;break}r.extra=15&R,r.mode=16201;case 16201:if(r.extra){for(y=r.extra;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;E=r.distcode[u&(1<<r.distbits)-1],b=E>>>24,R=E>>>16&255,g=65535&E,!(b<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(!(240&R)){for(m=b,C=R,v=g;E=r.distcode[v+((u&(1<<m+C)-1)>>m)],b=E>>>24,R=E>>>16&255,g=65535&E,!(m+b<=l);){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}u>>>=m,l-=m,r.back+=m}if(u>>>=b,l-=b,r.back+=b,64&R){e.msg="invalid distance code",r.mode=pn;break}r.offset=g,r.extra=15&R,r.mode=16203;case 16203:if(r.extra){for(y=r.extra;l<y;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=pn;break}r.mode=16204;case 16204:if(0===c)break e;if(p=_-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=pn;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),h=r.window}else h=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{n[a++]=h[f++]}while(--p);0===r.length&&(r.mode=dn);break;case 16205:if(0===c)break e;n[a++]=r.length,c--,r.mode=dn;break;case _n:if(r.wrap){for(;l<32;){if(0===s)break e;s--,u|=i[o++]<<l,l+=8}if(_-=c,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?Rr(r.check,n,_,a-_):hr(r.check,n,_,a-_)),_=c,4&r.wrap&&(r.flags?u:fn(u))!==r.check){e.msg="incorrect data check",r.mode=pn;break}u=0,l=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;l<32;){if(0===s)break e;s--,u+=i[o++]<<l,l+=8}if(4&r.wrap&&u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=pn;break}u=0,l=0}r.mode=16208;case 16208:T=Zi;break e;case pn:T=en;break e;case 16210:return tn;default:return $i}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=l,(r.wsize||_!==e.avail_out&&r.mode<pn&&(r.mode<_n||t!==Yi))&&In(e,e.output,e.next_out,_-e.avail_out),d-=e.avail_in,_-=e.avail_out,e.total_in+=d,e.total_out+=_,r.total+=_,4&r.wrap&&_&&(e.adler=r.check=r.flags?Rr(r.check,n,_,e.next_out-_):hr(r.check,n,_,e.next_out-_)),e.data_type=r.bits+(r.last?64:0)+(r.mode===sn?128:0)+(r.mode===ln||r.mode===un?256:0),(0===d&&0===_||t===Yi)&&T===Qi&&(T=rn),T},inflateEnd:e=>{if(bn(e))return $i;let t=e.state;return t.window&&(t.window=null),e.state=null,Qi},inflateGetHeader:(e,t)=>{if(bn(e))return $i;const r=e.state;return 2&r.wrap?(r.head=t,t.done=!1,Qi):$i},inflateSetDictionary:(e,t)=>{const r=t.length;let i,n,o;return bn(e)?$i:(i=e.state,0!==i.wrap&&i.mode!==an?$i:i.mode===an&&(n=1,n=hr(n,t,r,0),n!==i.check)?en:(o=In(e,t,r,r),o?(i.mode=16210,tn):(i.havedict=1,Qi)))},inflateInfo:"pako inflate (from Nodeca project)"};var yn=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const Ln=Object.prototype.toString,{Z_NO_FLUSH:Pn,Z_FINISH:Nn,Z_OK:An,Z_STREAM_END:wn,Z_NEED_DICT:Dn,Z_STREAM_ERROR:kn,Z_DATA_ERROR:Un,Z_MEM_ERROR:Mn}=mr;function xn(e){this.options=gi({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Ii,this.strm.avail_out=0;let r=Sn.inflateInit2(this.strm,t.windowBits);if(r!==An)throw new Error(gr[r]);if(this.header=new yn,Sn.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=Oi(t.dictionary):"[object ArrayBuffer]"===Ln.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Sn.inflateSetDictionary(this.strm,t.dictionary),r!==An)))throw new Error(gr[r])}xn.prototype.push=function(e,t){const r=this.strm,i=this.options.chunkSize,n=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?Nn:Pn,"[object ArrayBuffer]"===Ln.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),o=Sn.inflate(r,a),o===Dn&&n&&(o=Sn.inflateSetDictionary(r,n),o===An?o=Sn.inflate(r,a):o===Un&&(o=Dn));r.avail_in>0&&o===wn&&r.state.wrap>0&&0!==e[r.next_in];)Sn.inflateReset(r),o=Sn.inflate(r,a);switch(o){case kn:case Un:case Dn:case Mn:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===wn))if("string"===this.options.to){let e=Ei(r.output,r.next_out),t=r.next_out-e,n=Ti(r.output,e);r.next_out=t,r.avail_out=i-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(n)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==An||0!==s){if(o===wn)return o=Sn.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},xn.prototype.onData=function(e){this.chunks.push(e)},xn.prototype.onEnd=function(e){e===An&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=mi(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};const{Deflate:jn,deflate:Bn,deflateRaw:Vn,gzip:Fn}=ji;var Jn=Fn;var Gn,Hn=-1,Kn=function(){return"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)}))},Wn=function(t,r,i){return s(void 0,void 0,void 0,(function(){var n,o;return c(this,(function(a){return n=[],o=i.jwt||"",[2,new Promise((function(i,a){t.forEach((function(t){return s(void 0,void 0,void 0,(function(){var a,s,u;return c(this,(function(c){switch(c.label){case 0:return a=t.detectorAddr.replace(/^(https?:\/\/)?/,"https://"),s="".concat(a,"/rtc/detector/ping?t=").concat((d=9999,(l=1e3)+Math.floor(Math.random()*(d-l)))),u={jwt:o},[4,r.httpReq({url:s,body:JSON.stringify(u),timeout:5e3,method:e.HttpMethod.POST})];case 1:return 200===c.sent().status&&n.push(t.clusterId),i(n),[2]}var l,d}))}))}))}))]}))}))},Yn=function(e,t){var r,i;if(!t)return"";try{i=JSON.parse(t.voipCallInfo||'{ "strategy": 0 }')}catch(r){return e.warn(n.L_MEDIA_SERVICE_PARSE_NAVI_CALLVOIP_INFO_O,"parse `voipCallInfo` of navi failed: ".concat(t.voipCallInfo)),""}if(0===i.strategy)return"";var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return"";var a=o[0];return a.detectorManager?a.detectorManager:""},zn=function(t,r,i){return s(void 0,void 0,void 0,(function(){var n,o,a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:return n=Yn(r,i),o=i.jwt||"",a=120,s=0,u=i.ipType||0,l={jwt:o,ipType:u},[4,t.httpReq({url:"".concat(n,"/rtc/detector/servers"),body:JSON.stringify(l),headers:{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Ct.browser,"|").concat(Ct.version),ClientVersion:"5.16.0","Client-Session-Id":Kn(),"Request-Id":Date.now().toString()},method:e.HttpMethod.POST})];case 1:return d=c.sent(),_=d.data&&JSON.parse(d.data).detectorAddrs||[],a=d.data&&JSON.parse(d.data).clientDetectMinute,s=d.data&&JSON.parse(d.data).resultCode,[2,{detectoraddrs:_,clientDetectMinute:a,status:s}]}}))}))},qn=function(){return{"Content-Type":"application/json;charset=UTF-8","Cache-Control":"no-cache",ClientType:"web|".concat(Ct.browser,"|").concat(Ct.version),ClientVersion:"5.16.0","Client-Session-Id":Kn(),"Request-Id":Date.now().toString()}},Qn=function(){function t(t,r,i,n){void 0===n&&(n=5e3),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_msUrl",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_timeout",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_failedMs",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_rtcFinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clusterId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_configUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_msList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_qualityMsList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._context.logger,r.getConnectionStatus()===e.RCConnectionStatus.CONNECTED&&this.isNededDetector()&&this.detectorMediaSever()}return Object.defineProperty(t.prototype,"isNededDetector",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._context.getNaviInfo();if(!e)return!1;var r=Yn(this._logger,e),i=e.jwt||"",n=Date.now(),o=!1;return 0===t.detectorTime?o=!1:t.detectValidMinute+t.detectorTime<n&&(o=!0),!(!r||!i||this._msUrl||o)}}),Object.defineProperty(t.prototype,"detectorMediaSever",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.clearMSList();var e=this._context.getNaviInfo();this._startDetector(e)}}),Object.defineProperty(t.prototype,"_startDetector",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var r,i,n,o;return c(this,(function(a){switch(a.label){case 0:return[4,zn(this._runtime,this._logger,e)];case 1:return r=a.sent(),i=r.detectoraddrs,n=r.clientDetectMinute,r.status!==exports.RCRTCCode.JWT_TIME_OUT?[3,3]:[4,this._context.getPluginContext().refetchNaviInfo()];case 2:return a.sent(),this.detectorMediaSever(),[2];case 3:return i.length?(o=t,[4,Wn(i,this._runtime,e)]):[3,5];case 4:o.msInDetector=a.sent(),a.label=5;case 5:return t.detectorTime=Date.now(),t.detectValidMinute=60*n*1e3,[2]}}))}))}}),Object.defineProperty(t.prototype,"clearMSList",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._msList.length=0}}),Object.defineProperty(t.prototype,"getMsList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._msUrl?[this._msUrl]:(0===this._msList.length&&(this._failedMs.length=0,this._sortMediaServiceList()),this._msList)}}),Object.defineProperty(t.prototype,"_sortMediaServiceList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=t.msInDetector[0],r=t.msInDetector.slice(1),i=function(e,t){var r,i;if(!e)return[];try{i=JSON.parse(e.voipCallInfo||'{ "strategy": 0 }')}catch(r){return t.warn(n.L_PARSE_VOIP_SERVER_CONF_E,e.voipCallInfo),[]}if(0===i.strategy)return[];var o=null===(r=i.callEngine)||void 0===r?void 0:r.filter((function(e){return 4===e.engineType}));if(!o||0===o.length)return[];var a=o[0],s=[];return a.mediaServer&&s.push(a.mediaServer.replace(/^(https?:\/\/)?/,"https://")),a.backupMediaServer&&a.backupMediaServer.forEach((function(e){s.push(e.replace(/^(https?:\/\/)?/,"https://"))})),s}(this._context.getNaviInfo(),this._logger),o=i[0],a=i.slice(1),s=d(d([this._clusterId,e,o],l(r),!1),l(a),!1).filter((function(e){return!!e}));this._msList=s.map((function(e){return e.replace(/^(https?:\/\/)?/,"https://")})),this._logger.info(n.L_MEDIA_SERVICE_MSLIST_CHANGE_O,"MediaServiceList msList -> ".concat(JSON.stringify(this._msList)))}}),Object.defineProperty(t.prototype,"_openGzip",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){for(var r=JSON.stringify(t),i=r.length,n=new Uint8Array(i),o=0;o<i;o++)n[o]=r.charCodeAt(o);var s;return{headers:e=a(a({},e),{"Content-Encoding":"gzip","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}),body:t=Jn(n,s)}}}),Object.defineProperty(t.prototype,"_dealRequestSuccessResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=JSON.parse(e);return i.rtcFinger&&(this._rtcFinger=i.rtcFinger),i.clusterId&&(this._clusterId!==i.clusterId&&this.clearMSList(),this._clusterId=i.clusterId),this._logger.info(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.SUCCESSED,url:t}),r),{code:exports.RCRTCCode.SUCCESS,data:i,qualityMsList:this._qualityMsList}}}),Object.defineProperty(t.prototype,"_request",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,u,_){var p;return s(this,void 0,void 0,(function(){var s,f,h,b,R,g,m,C,v,O,T,E,I,S,y,L;return c(this,(function(c){switch(c.label){case 0:if(this._qualityMsList=[],s=(null===(p=this._context.getNaviInfo())||void 0===p?void 0:p.openGzip)||!1,f=s?this._openGzip(r,i):{headers:r,body:i},h=f.headers,b=f.body,0===(R=this.getMsList()).length)return this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"have no valid service address"}),u),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}];this._rtcFinger&&(b.rtcFinger=this._rtcFinger),g=0,c.label=1;case 1:return g<R.length?(m=Date.now(),C="".concat(R[g]).concat(t),v=qn(),O=a(a({},v),h),T=/x-www-form-urlencoded/.test(O["Content-Type"])?b:JSON.stringify(b),E=v["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_REQUEST_T,JSON.stringify({url:C,"Request-Id":E}),u),[4,this._runtime.httpReq({url:C,body:T,headers:O,method:e.HttpMethod.POST,timeout:this._timeout})]):[3,4];case 2:if(I=c.sent(),S=I.status,y=I.data,_&&this._qualityMsList.push({rsdur:Date.now()-m,rsid:E,rscod:200===S?exports.RCRTCCode.SUCCESS:exports.RCRTCCode.REQUEST_FAILED,msa:C}),200===S)return[2,this._dealRequestSuccessResult(y,C,u)];(L=this._failedMs).push.apply(L,d([],l(this._msList.splice(g,1)),!1)),this._logger.error(n.L_MEDIA_SERVICE_REQUEST_R,JSON.stringify({status:o.FAILED,msg:"request error -> Request-Id: ".concat(E,", status: ").concat(S,", url: ").concat(C),timeout:this._timeout}),u),c.label=3;case 3:return g+=1,[3,1];case 4:return[2,{code:exports.RCRTCCode.REQUEST_FAILED,qualityMsList:this._qualityMsList}]}}))}))}}),Object.defineProperty(t.prototype,"exchange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n;return s(this,void 0,void 0,(function(){var o,a;return c(this,(function(s){switch(s.label){case 0:return[4,this._request("/exchange",e,t,r,i)];case 1:return(o=s.sent()).code===exports.RCRTCCode.SUCCESS&&(null===(n=o.data)||void 0===n?void 0:n.resultCode)===exports.RCRTCCode.SUCCESS&&(a=o.data.urls)&&(this._configUrl=a.configUrl),[2,o]}}))}))}}),Object.defineProperty(t.prototype,"exit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/exit",e,{},t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"broadcastSubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this._logger.createTraceId();return this._request("/broadcast/subscribe",e,t,r,!0)}}),Object.defineProperty(t.prototype,"broadcastExit",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),[4,this._request("/broadcast/exit",e,{},t,!0)];case 1:return[2,{code:r.sent().code}]}}))}))}}),Object.defineProperty(t.prototype,"setMcuConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d,_,p,f,h,b,R;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_T,JSON.stringify({body:r}),i),this._configUrl?(s="".concat(this._configUrl.replace(/^(https?:\/\/)?/,"https://"),"/server/mcu/config"),u=qn(),l=a(a({},u),t),d=JSON.stringify(r),_=u["Request-Id"],[4,this._runtime.httpReq({url:s,headers:l,body:d,method:e.HttpMethod.POST})]):(this._logger.error(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND,msg:"MCU server not found"}),i),[2,{code:exports.RCRTCCode.MCU_SERVER_NOT_FOUND}]);case 1:return p=c.sent(),f=p.status,h=p.data,200===f?(b=JSON.parse(h),(R=b.resultCode)===exports.RCRTCCode.SUCCESS?this._logger.info(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.SUCCESSED,"Request-Id":_}),i):this._logger.warn(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({code:R,"Request-Id":_}),i),[2,{code:R,res:b}]):(this._logger.error(n.L_MEDIA_SERVICE_SET_MCU_CONFIG_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REQUEST_FAILED,msg:"request error -> Request-Id: ".concat(_,", status: ").concat(f,", url: ").concat(s)}),i),[2,{code:exports.RCRTCCode.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(t.prototype,"getCDNResourceInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s=qn(),u=a(a({},s),t),l=s["Request-Id"],this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_T,"Request-Id: ".concat(l,", url: ").concat(r),i),[4,this._runtime.httpReq({url:r,headers:u,method:e.HttpMethod.GET})];case 1:return d=c.sent(),_=d.status,p=d.data,200===_?(f=JSON.parse(p),this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:o.SUCCESSED,cdnPlayerUrl:null==f?void 0:f.data.pull_url}),i),[2,{code:f.resultCode,res:f}]):(this._logger.info(n.L_MEDIA_SERVICE_GET_CDN_RESOURCE_INFO_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REQUEST_FAILED}),i),[2,{code:exports.RCRTCCode.REQUEST_FAILED}])}}))}))}}),Object.defineProperty(t,"msInDetector",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"detectorTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"detectValidMinute",{enumerable:!0,configurable:!0,writable:!0,value:72e5}),t}();!function(e){e[e.NORMAL=1]="NORMAL",e[e.TINY=2]="TINY"}(Gn||(Gn={}));var Zn,Xn=function(e,t){return Math.round(8*t/e)},$n=function(e,t){void 0===t&&(t=2);var r=Math.pow(10,t);return Math.round(e*r)/r},eo=function(e,t){void 0===t&&(t=2),e>1&&(e=1);var r=Math.pow(10,t);return Math.round(e*r)},to=function(e,t,r,i){if(0===t)return 0;if(!r||!i)return $n(e/t,3);var n=t-i;if(0===n)return 0;var o=e-r;return o<0||n<0?0:$n(o/n,3)},ro=function(e){var t=e.jitter,r=e.rtt,i=e.packetsLostRate;return!It(t)||!It(r)||0!==i};!function(e){e.TRACK="track",e.STREAM="stream",e.MEDIASOURCE="media-source",e.INBOUNDRTP="inbound-rtp",e.OUTBOUNDRTP="outbound-rtp",e.REMOTEINBOUNDRTP="remote-inbound-rtp",e.PEERCONNECTION="peer-connection",e.TRANSPORT="transport",e.CERTIFICATE="certificate",e.CANDIDATEPAIR="candidate-pair",e.REMOTECANDIDATE="remote-candidate",e.LOCALCANDIDATE="local-candidate"}(Zn||(Zn={}));var io,no=function(){function e(e,t,r,i,n,o){Object.defineProperty(this,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sdpSemantics",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_latestPacketsSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesSent",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestBytesRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_latestPacketsRecv",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._sdpStrategy.getTrackIdByMid(e)}}),Object.defineProperty(e.prototype,"updateBytesSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,n;if(this._latestBytesSent[e]&&t<this._latestBytesSent[e].bytesSent&&this.clearLatestpacketsSent([e]),this._latestBytesSent[e]){var o=this._latestBytesSent[e];i=t-o.bytesSent,n=r-o.timestamp,this._latestBytesSent[e]={bytesSent:t,timestamp:r}}else i=t,n=1e3,this._latestBytesSent[e]={bytesSent:t,timestamp:r};return Xn(n,i)}}),Object.defineProperty(e.prototype,"updateBytesRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,n;if(this._latestBytesRecv[e]&&t<this._latestBytesRecv[e].bytesRecv&&this.clearLatestPacketsRecv([e]),this._latestBytesRecv[e]){var o=this._latestBytesRecv[e];i=t-o.bytesRecv,n=r-o.timestamp,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r}}else i=t,n=1e3,this._latestBytesRecv[e]={bytesRecv:t,timestamp:r};return Xn(n,i)}}),Object.defineProperty(e.prototype,"updateSenderPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if(Object.prototype.hasOwnProperty.call(this._latestPacketsSent[e],"packetsSent")){var n=this._latestPacketsSent[e],o=n.packetsLost,a=n.packetsSent;i=to(t,r,o,a),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=o===t?a:r}else i=to(t,r),this._latestPacketsSent[e].packetsLost=t,this._latestPacketsSent[e].packetsSent=r;return i}}),Object.defineProperty(e.prototype,"updateReceiverPacketsLost",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if(this._latestPacketsRecv[e]){var n=this._latestPacketsRecv[e],o=n.packetsLost,a=n.packetsRecv;i=to(t,r+t,o,a+o)}else i=to(t,r);return this._latestPacketsRecv[e]={packetsLost:t,packetsRecv:r},i}}),Object.defineProperty(e.prototype,"clearLatestpacketsSent",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){if(parseInt(e.split("_").pop())===exports.RCMediaType.VIDEO_ONLY){var r="".concat(e,"_tiny");delete t._latestPacketsSent[r],delete t._latestBytesSent[r]}delete t._latestPacketsSent[e],delete t._latestBytesSent[e]}))}}),Object.defineProperty(e.prototype,"clearLatestPacketsRecv",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;e.forEach((function(e){delete t._latestPacketsRecv[e],delete t._latestBytesRecv[e]}))}}),Object.defineProperty(e.prototype,"parseRTCStatsReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i={};try{for(var n=u(e.entries()),o=n.next();!o.done;o=n.next()){var a=l(o.value,2),s=a[0],c=a[1];/codec/gi.test(c)&&s.includes("RTCCodec_")||(i[s]=c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return i}}),Object.defineProperty(e.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t={senders:[],receivers:[]};return this._logger.info(n.L_ABSTRACT_STAT_PARSER_FORMAT_RTC_STATE_REPORT_O,JSON.stringify({status:o.SUCCESSED,stats:e,reports:t})),t}}),Object.defineProperty(e.prototype,"isValidTranceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n="outbound-rtp"===t?null===(r=this._rtcPeerConn.currentLocalDescription)||void 0===r?void 0:r.sdp:null===(i=this._rtcPeerConn.currentRemoteDescription)||void 0===i?void 0:i.sdp,o=e.ssrc;return!(null==n?void 0:n.split("\r\nm=").some((function(e){return e.includes(o)&&e.includes("a=inactive")})))}}),Object.defineProperty(e.prototype,"formatStateData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return Object.values(e).reduce((function(e,t){return t.type===Zn.REMOTEINBOUNDRTP?(e.remoteInbound.push(t),e):t.type===Zn.INBOUNDRTP?(e.inbound.push(t),e):t.type===Zn.OUTBOUNDRTP?(e.outbound.push(t),e):t.type===Zn.TRANSPORT?(e.transport.push(t),e):t.type===Zn.PEERCONNECTION?(e.connection.push(t),e):e}),{outbound:[],remoteInbound:[],inbound:[],transport:[],connection:[]})}}),e}(),oo=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=this.formatStateData(e),n=i.outbound,o=i.remoteInbound,a=i.inbound,s=i.transport,c=i.connection,u={senders:[],receivers:[]},l=Math.floor(c[0].timestamp);u.timestamp=l;var d=0,_=0;d=(t=this.pickOutbound(n,e,d,l,_)).totalPacketsLost,_=t.bitrateSend,u.senders=t.senders,o.length>0&&u.senders.length>0&&this.pickRemoteInbound(o,u.senders,e);var p=0;if(d=(r=this.pickInbound(a,e,d,l,p)).totalPacketsLost,p=r.bitrateRecv,u.receivers=r.receivers,s.length>0){var f=s[0];this.pickRtcTransport(f,e,u,p,_,d)}return u}}),Object.defineProperty(t.prototype,"pickRtcTransport",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o){var a=e.selectedCandidatePairId;if(a){var s=t[a],c=s.availableOutgoingBitrate,u=s.availableIncomingBitrate,l=s.currentRoundTripTime,d=s.localCandidateId,_=s.remoteCandidateId,p=t[d],f=p.ip,h=p.port,b=p.networkType,R=t[_],g=R.ip,m=R.port,C=R.protocol;r.iceCandidatePair={IP:f,port:h,networkType:b,remoteIP:g,remotePort:m,protocol:C,bitrateRecv:i,bitrateSend:n,rtt:1e3*l,availableOutgoingBitrate:c,availableIncomingBitrate:u,totalPacketsLost:o},r.receivers.forEach((function(e){e.rtt=1e3*l}))}}}),Object.defineProperty(t.prototype,"pickRemoteInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this;e.forEach((function(e){var n,o=e.localId,a=e.jitter,s=e.roundTripTime,c=e.packetsLost,u=t.filter((function(e){return e.id===o}))[0];if(u&&!ro(u)){var l=null===(n=i._store)||void 0===n?void 0:n.getTrackIdBySSRC(r[u.id].ssrc);u.jitter=Math.round(1e3*a),u.rtt=s;var d=i._latestPacketsSent[l].crtPacketsSent;u.packetsLostRate=i.updateSenderPacketsLost(l,c,d)}}))}}),Object.defineProperty(t.prototype,"_getOutboundVideoAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o,a,s,c=e.framesPerSecond,u=e.frameWidth,l=e.frameHeight;return"video"!==r||u||l||c||(u=(null===(o=t[i])||void 0===o?void 0:o.frameWidth)||t[n].width,l=(null===(a=t[i])||void 0===a?void 0:a.frameHeight)||t[n].height,c=(null===(s=t[n])||void 0===s?void 0:s.framesPerSecond)||null),{frameRate:c,frameWidth:u,frameHeight:l}}}),Object.defineProperty(t.prototype,"pickOutbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"outbound-rtp")){var c=e.id,u=e.kind,l=e.mediaSourceId,d=e.remoteId,_=e.packetsSent,p=e.bytesSent,f=e.encoderImplementation,h=e.pliCount,b=e.nackCount,R=e.mid,g=e.trackId;if(void 0!==R&&(g=o.getTrackIdByMid(R)),g){var m=o._getOutboundVideoAttrs(e,t,u,g,l),C=m.frameRate,v=m.frameWidth,O=m.frameHeight,T=t[d],E=null,I=null,S=0;T&&(E=T.jitter,I=T.roundTripTime,S=T.packetsLost),r+=S;var y=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc);if(y){var L=l?t[l].audioLevel:t[g].audioLevel,P=0;!o._latestPacketsSent[y]&&(o._latestPacketsSent[y]={}),T?P=o.updateSenderPacketsLost(y,S,_):o._latestPacketsSent[y].crtPacketsSent=_;var N=o.updateBytesSent(y,p,i);N<0&&(N=0),n+=N,a.push({id:c,trackId:y,kind:u,packetsLostRate:P,remoteResource:!1,audioLevel:L||0===L?eo(L):null,frameWidth:v,frameHeight:O,frameRate:C,bitrate:N,jitter:E?Math.round(1e3*E):E,rtt:I?Math.round(1e3*I):I,encoderImplementation:f,pliCount:h,nackCount:b,googFirsSent:Hn,samplingRate:Hn,googRenderDelayMs:Hn,trackState:Hn})}}}})),{totalPacketsLost:r,bitrateSend:n,senders:a}}}),Object.defineProperty(t.prototype,"_getInboundMediaAttrs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o,a,s,c=e.frameWidth,u=e.frameHeight,l=e.audioLevel;return"video"===n?c||u||(c=(null===(o=t[r])||void 0===o?void 0:o.frameWidth)||t[i].width,u=(null===(a=t[r])||void 0===a?void 0:a.frameHeight)||t[i].height):l||(l=(null===(s=t[r])||void 0===s?void 0:s.audioLevel)||t[i].audioLevel),{frameWidth:c,frameHeight:u,audioLevel:l}}}),Object.defineProperty(t.prototype,"pickInbound",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){var o=this,a=[];return e.forEach((function(e){var s;if("unified-plan"!==o._sdpSemantics||o.isValidTranceiver(e,"inbound-rtp")){var c=e.packetsLost,u=e.packetsReceived,l=e.jitter,d=e.bytesReceived,_=e.framesPerSecond,p=e.kind,f=e.codecImplementationName,h=e.nackCount,b=e.pliCount,R=e.mid,g=e.id,m=e.trackId;if(void 0!==R&&(m=o.getTrackIdByMid(R)),m){var C=o._getInboundMediaAttrs(e,t,m,g,p),v=C.frameWidth,O=C.frameHeight,T=C.audioLevel;r+=c;var E=null===(s=o._store)||void 0===s?void 0:s.getTrackIdBySSRC(e.ssrc),I=o.updateReceiverPacketsLost(E,c,u),S=o.updateBytesRecv(E,d,i);S<0&&(S=0),n+=S,a.push({trackId:E,kind:p,packetsLostRate:I,remoteResource:!0,audioLevel:T||0===T?eo(T):null,frameWidth:v,frameHeight:O,frameRate:_,bitrate:S,jitter:l?Math.round(1e3*l):0,codecImplementationName:f,nackCount:h,pliCount:b,rtt:null,samplingRate:Hn,googFirsReceived:Hn,googRenderDelayMs:Hn,trackState:Hn})}}})),{totalPacketsLost:r,bitrateRecv:n,receivers:a}}}),t}(no),ao=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return r(t,e),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,r)){var n=e.kind,o=e.bytesSent,a=e.packetsSent,s=e.bitrateMean,c=e.framerateMean,u=e.nackCount,l=e.pliCount,d=e.remoteId,_=d?t[d]:{jitter:null,roundTripTime:null,packetsLost:0},p=_.jitter,f=_.roundTripTime,h=_.packetsLost,b=null===(i=this._store)||void 0===i?void 0:i.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=h;var R=0;!this._latestPacketsSent[b]&&(this._latestPacketsSent[b]={}),d?R=this.updateSenderPacketsLost(b,h,a):this._latestPacketsSent[b].crtPacketsSent=a;var g=0;"video"===n?s&&(g=Math.floor(s/1e3)):g=this.updateBytesSent(b,o,this._reportsData.timestamp),g<0&&(g=0),this._bitrateSend+=g,this._reportsData.senders.push({trackId:b,kind:n,packetsLostRate:R,remoteResource:!1,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(c),bitrate:g,jitter:p?Math.round(1e3*p):null,rtt:f,encoderImplementation:null,pliCount:l,nackCount:u,googFirsSent:Hn,samplingRate:Hn,googRenderDelayMs:Hn,trackState:Hn})}}}),Object.defineProperty(t.prototype,"_addSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i=t.localId,n=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e[i].ssrc),o=this._reportsData.senders.filter((function(e){return e.trackId===n}))[0];o&&ro(o)&&(o.jitter=Math.round(1e3*t.jitter),o.rtt=t.rtt,o.packetsLostRate=this.updateSenderPacketsLost(n,t.packetsLost,this._latestPacketsSent[n].crtPacketsSent))}}),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;if("unified-plan"!==this._sdpSemantics||this.isValidTranceiver(e,t)){var i=e.packetsLost,n=e.bytesReceived,o=e.packetsReceived,a=e.jitter,s=e.framerateMean,c=e.kind,u=e.bitrateMean,l=e.nackCount,d=e.pliCount,_=null===(r=this._store)||void 0===r?void 0:r.getTrackIdBySSRC(e.ssrc);this._totalPacketsLost+=i;var p=this.updateReceiverPacketsLost(_,i,o),f=0;"video"===c?u&&(f=Math.floor(u/1e3)):f=this.updateBytesRecv(_,n,this._reportsData.timestamp),f<0&&(f=0),this._bitrateRecv+=f,this._reportsData.receivers.push({trackId:_,kind:c,packetsLostRate:p,remoteResource:!0,audioLevel:null,frameWidth:null,frameHeight:null,frameRate:Math.floor(s),bitrate:f,jitter:a?Math.round(1e3*a):null,codecImplementationName:null,nackCount:l,pliCount:d,rtt:null,samplingRate:Hn,googFirsReceived:Hn,googRenderDelayMs:Hn,trackState:Hn})}}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e[t.localCandidateId],i=r.address,n=r.port,o=e[t.remoteCandidateId],a=o.address,s=o.port,c=o.protocol;this._reportsData.iceCandidatePair={IP:i,port:n,networkType:null,remoteIP:a,remotePort:s,protocol:c,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:null,availableOutgoingBitrate:null,availableIncomingBitrate:null,totalPacketsLost:this._totalPacketsLost}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=+new Date;for(var r in this._reportsData={senders:[],receivers:[],timestamp:t},this._totalPacketsLost=0,this._bitrateRecv=0,this._bitrateSend=0,e){var i=e[r],n=i.type;"outbound-rtp"===n&&this._pickSenderData(i,e,n),"remote-inbound-rtp"===n&&this._addSenderData(e,i),"inbound-rtp"===n&&this._pickReceiverData(i,n),"candidate-pair"===n&&"succeeded"===i.state&&this._pickIceCandidatePair(e,i)}return this._reportsData}}),t}(no),so=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_reportsData",{enumerable:!0,configurable:!0,writable:!0,value:{senders:[],receivers:[],timestamp:+new Date}}),Object.defineProperty(t,"_totalPacketsLost",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateSend",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(t,"_bitrateRecv",{enumerable:!0,configurable:!0,writable:!0,value:0}),t}return r(t,e),Object.defineProperty(t.prototype,"_pickReceiverData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var t;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"inbound-rtp")){var i=e.packetsLost,n=e.packetsReceived,o=e.jitter,a=e.bytesReceived,s=e.kind,c=e.nackCount,u=e.pliCount,l=e.audioLevel,d=e.frameHeight,_=e.frameWidth,p=null===(t=r._store)||void 0===t?void 0:t.getTrackIdBySSRC(e.ssrc);if(p){r._totalPacketsLost+=i;var f=r.updateReceiverPacketsLost(p,i,n),h=r.updateBytesRecv(p,a,r._reportsData.timestamp);h<0&&(h=0),r._bitrateRecv+=h,r._reportsData.receivers.push({trackId:p,kind:s,packetsLostRate:f,remoteResource:!0,audioLevel:l||0===l?eo(l):null,frameWidth:_,frameHeight:d,frameRate:null,bitrate:h,jitter:o?Math.round(1e3*o):o,codecImplementationName:null,nackCount:c,pliCount:u,rtt:null,samplingRate:Hn,googFirsReceived:Hn,googRenderDelayMs:Hn,trackState:Hn})}}}))}}),Object.defineProperty(t.prototype,"_pickSenderData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;e.forEach((function(e){var i;if("unified-plan"!==r._sdpSemantics||r.isValidTranceiver(e,"outbound-rtp")){var n=null===(i=r._store)||void 0===i?void 0:i.getTrackIdBySSRC(e.ssrc),o=e.kind,a=e.bytesSent,s=e.pliCount,c=e.nackCount,u=e.audioLevel,l=e.frameHeight,d=e.frameWidth,_=e.codecId,p=e.remoteId,f=e.packetsSent;if(n){var h=t[p],b=null,R=null,g=0;h&&(b=h.jitter,R=h.roundTripTime,g=h.packetsLost),r._totalPacketsLost+=g;var m=0;!r._latestPacketsSent[n]&&(r._latestPacketsSent[n]={}),h?m=r.updateSenderPacketsLost(n,g,f):r._latestPacketsSent[n].crtPacketsSent=f;var C=r.updateBytesSent(n,a,r._reportsData.timestamp);C<0&&(C=0),r._bitrateSend+=C,r._reportsData.senders.push({trackId:n,kind:o,packetsLostRate:m,remoteResource:!1,audioLevel:u||0===u?eo(u):null,frameWidth:d,frameHeight:l,frameRate:null,bitrate:C,jitter:b?Math.round(1e3*b):b,rtt:R?Math.round(1e3*R):R,encoderImplementation:t[_].mimeType,pliCount:s,nackCount:c,googFirsSent:Hn,samplingRate:Hn,googRenderDelayMs:Hn,trackState:Hn})}}}))}}),Object.defineProperty(t.prototype,"_pickIceCandidatePair",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.selectedCandidatePairId;if(r){var i=t[r],n=i.availableOutgoingBitrate,o=i.availableIncomingBitrate,a=i.currentRoundTripTime,s=i.localCandidateId,c=i.remoteCandidateId,u=t[s],l=u.address,d=u.port,_=t[c],p=_.address,f=_.port,h=_.protocol;this._reportsData.iceCandidatePair={IP:l||null,port:d,networkType:null,remoteIP:p,remotePort:f,protocol:h,bitrateRecv:this._bitrateRecv,bitrateSend:this._bitrateSend,rtt:1e3*a,availableOutgoingBitrate:n,availableIncomingBitrate:o,totalPacketsLost:this._totalPacketsLost},this._reportsData.receivers.forEach((function(e){e.rtt=1e3*a}))}}}),Object.defineProperty(t.prototype,"formatRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.formatStateData(e),r=t.outbound,i=t.inbound,n=t.transport,o=t.connection;this._reportsData={senders:[],receivers:[]};var a=Math.floor(o[0].timestamp);if(this._reportsData.timestamp=a,this._totalPacketsLost=0,this._bitrateSend=0,this._bitrateRecv=0,this._pickSenderData(r,e),this._pickReceiverData(i,e),n.length>0){var s=n[0];this._pickIceCandidatePair(s,e)}return this._reportsData}}),t}(no),co=function(){function e(e,t,r){Object.defineProperty(this,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"SDPHeader",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"videoStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"audioStreams",{enumerable:!0,configurable:!0,writable:!0,value:[]});var i=this.getStreamIndex();this.spliteStreams(i)}return Object.defineProperty(e.prototype,"videoSdps",{get:function(){return this.videoStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioSdps",{get:function(){return this.audioStreams.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e,"trimBlankLine",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.replace(/\n\r\s*\r\n/g,"\r\n").replace(/\s+\r\n/g,"\r\n")}}),Object.defineProperty(e.prototype,"getStreamIndex",{enumerable:!1,configurable:!0,writable:!0,value:function(){for(var e=/m=(?:video|audio)/gim,t=new Set([0]),r=e.exec(this.SDP);null!==r;)t.add(null==r?void 0:r.index),r=e.exec(this.SDP);return t.add(this.SDP.length),d([],l(t),!1)}}),Object.defineProperty(e.prototype,"spliteStreams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.SDPHeader=this.SDP.substring(e[0],e[1]).replace(/\r\ns=-/g,"\r\ns=".concat((new Date).valueOf()));for(var t=1;t<e.length;t++){var r=this.SDP.substring(e[t],e[t+1]);/^\bm=video\b/.test(r)?this.videoStreams.push(r):this.audioStreams.push(r)}}}),Object.defineProperty(e,"clearInactiveOrRecvonly",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/\ba=(recvonly|inactive)\b/.test(e)?e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,""):e}}),Object.defineProperty(e.prototype,"setHeaderBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.SDPHeader=this.SDPHeader.replace(/(\r\ns=[^\r\n]+)/gi,"$1\r\nc=IN IP4 0.0.0.0\r\nb=AS:".concat(t*e.KBitrate,"\r\nb=TIAS:").concat(t*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setAudiosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.audioStreams=this.audioStreams.map((function(r){return t.setAudioItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(i){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(i)?r.setAudioItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setAudioBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(i){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(i)?r.setAudioItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setAudioItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bmaxaveragebitrate\b/gi.test(t)){var i=["$1","maxaveragebitrate=".concat(r.max*e.KBitrate*1e3)];t=t.replace(/(\buseinbandfec=[^\r\n]+)/gi,i.join(";"))}return this.addAudioBlineAS(t,r)}}),Object.defineProperty(e.prototype,"addAudioBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"setVideosBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return this.videoStreams=this.videoStreams.map((function(r){return t.setVideoItemBitrate(r,e)})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(i){return new RegExp("\\bmsid:".concat(t,"\\b"),"ig").test(i)?r.setVideoItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setVideoBitrateWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.videoStreams=this.videoStreams.map((function(i){return new RegExp("\\bmid:".concat(t,"\\b"),"ig").test(i)?r.setVideoItemBitrate(i,e):i})),this}}),Object.defineProperty(e.prototype,"setVideoItemBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(0===r.max&&/\ba=inactive\b/gi.test(t))return t;if(!/\bx-google-max-bitrate\b/.test(t)){var i=["$1","x-google-max-bitrate=".concat(r.max*e.KBitrate),"x-google-min-bitrate=".concat(r.min*e.KBitrate),"x-google-start-bitrate=".concat(r.start||r.max*e.KBitrate*.7)];t=t.replace(/(\bprofile-level-id=42[e0]01f\b)/gi,i.join(";"))}return this.addVideoBlineAS(t,r)}}),Object.defineProperty(e.prototype,"addVideoBlineAS",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return/\bb=AS:\d+\b/gi.test(t)?t:t.replace(/(\bc=IN[^\r\n]+)/gi,"$1\r\nb=AS:".concat(r.max*e.KBitrate,"\r\nb=TIAS:").concat(r.max*e.KBitrate*850))}}),Object.defineProperty(e.prototype,"clearnSsrcWithMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;return this.audioStreams=this.audioStreams.map((function(i){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(i)?r.clearSSRC(i,t):i})),this.videoStreams=this.videoStreams.map((function(i){return new RegExp("\\bmid:".concat(e,"\\b"),"ig").test(i)?r.clearSSRC(i,t):i})),this}}),Object.defineProperty(e.prototype,"clearSSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(t===_o.SENDONLY&&/\ba=sendonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===_o.RECVONLY&&/\ba=recvonly\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");if(t===_o.INACTIVE&&/\ba=inactive\b/.test(e))return e.replace(/\r\na=(ssrc|msid)[^\r\n]+/gi,"");return e}}),Object.defineProperty(e,"KBitrate",{enumerable:!0,configurable:!0,writable:!0,value:1}),e}(),uo=function(){function e(){}return Object.defineProperty(e,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._audioEncoder=e.encodeAudio,this._audioDecoder=e.decodeAudio,this._videoEncoder=e.encodeVideo,this._videoDecoder=e.decodeVideo,this._logger=t}}),Object.defineProperty(e,"isInit",{enumerable:!1,configurable:!0,writable:!0,value:function(){return!!(this._audioEncoder&&this._audioDecoder&&this._videoEncoder&&this._videoDecoder)}}),Object.defineProperty(e,"decodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioDecoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._audioEncoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"decodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoDecoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_DECODE_E,null==t?void 0:t.message),console.error(t),e}}}),Object.defineProperty(e,"encodeVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){try{return this._videoEncoder(e)}catch(t){return this._logger.error(n.L_ENCRYPTOR_ENCODE_E,null==t?void 0:t.message),console.error(t),e}}}),e}();!function(e){e[e.NB=0]="NB",e[e.MB=1]="MB",e[e.WB=2]="WB",e[e.SWB=3]="SWB",e[e.FB=4]="FB"}(io||(io={})),io.NB,io.NB,io.NB,io.NB,io.MB,io.MB,io.MB,io.MB,io.WB,io.WB,io.WB,io.WB,io.SWB,io.SWB,io.FB,io.FB,io.NB,io.NB,io.NB,io.NB,io.WB,io.WB,io.WB,io.WB,io.SWB,io.SWB,io.SWB,io.SWB,io.FB,io.FB,io.FB,io.FB;var lo,_o,po=function(){function e(){}return Object.defineProperty(e,"splitSections",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.split("\nm=").map((function(e,t){var r=t>0?"m=".concat(e):e;return"".concat(r.trim(),"\r\n")}))}}),Object.defineProperty(e,"getMediaSections",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitSections(t);return r.shift(),r}}),Object.defineProperty(e,"parseExtmap",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}}}),Object.defineProperty(e,"splitLines",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.trim().split("\n").map((function(e){return e.trim()}))}}),Object.defineProperty(e,"parseMLine",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.splitLines(t)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}}}),Object.defineProperty(e,"matchPrefix",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.splitLines(t).filter((function(e){return 0===e.indexOf(r)}))}}),Object.defineProperty(e,"parseMsid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i=e.matchPrefix(t,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=e.matchPrefix(t,"a=ssrc:").map((function(t){return e.parseSsrcMedia(t)})).filter((function(e){return"msid"===e.attribute}));return n.length>0&&n[0].value?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:{stream:"",track:""}}}),Object.defineProperty(e,"parseSsrcMedia",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r}}),Object.defineProperty(e,"getMid",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.matchPrefix(t,"a=mid:")[0];if(r)return r.substr(6)}}),Object.defineProperty(e,"splitNaluData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new Uint8Array(e),r=0;if(this.isIFrame(t)){var i=t.join(","),n=i.indexOf("0,0,0,1,101");-1===n&&(n=i.indexOf("0,0,0,1,37")),r=i.substring(0,n).split(",").length-1+4+8}else r=12;return{header:t.slice(0,r),payloadData:t.slice(r)}}}),Object.defineProperty(e,"deal0x03",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r="encode"===t?e.join(",").replaceAll(",0,0,1,",",0,0,3,1,").split(",").map((function(e){return Number(e)})):e.join(",").replaceAll(",0,0,3,1,",",0,0,1,").split(",").map((function(e){return Number(e)})),new Uint8Array(r)}}),Object.defineProperty(e,"isIFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.join("").startsWith("0001103");return t||(t=e.join("").startsWith("000139")),t}}),Object.defineProperty(e,"parsePayloadTypes",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r=e.getMediaSections(t).find((function(t){return"audio"===e.parseMLine(t).kind}));if(r){var i=r.match(/a=rtpmap:(\d+)\s+(\S+)/g);i&&(e.payloadTypeCodecMap=i.map((function(e){var t=e.match(/a=rtpmap:(\d+)\s+(\w+)/);return t?{payloadType:Number(t[1]),codec:t[2]}:null})).filter((function(e){return!!e})))}}}),Object.defineProperty(e,"payloadTypeCodecMap",{enumerable:!0,configurable:!0,writable:!0,value:[]}),e}();!function(e){e.PLANB="plan-b",e.UNIFIEDPLAN="unified-plan"}(lo||(lo={})),function(e){e.SENDONLY="sendonly",e.RECVONLY="recvonly",e.INACTIVE="inactive"}(_o||(_o={}));var fo,ho,bo,Ro,go=function(){function e(e,t,r){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_useEncrypt",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_outboundStreams",{enumerable:!0,configurable:!0,writable:!0,value:{}})}return Object.defineProperty(e,"setSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=Ct.browser,i=Ct.version,o=Ct.supportsUnifiedPlan;if(t.info(n.L_A_SDP_STRATEGY_SET_SDP_SEMANTICS_O,JSON.stringify({sdpSemantics:e,supportsUnifiedPlan:o,browser:r,version:i})),o)return/chrome/i.test(r)?i?void(this._sdpSemantics=i>92?"unified-plan":i<72?"plan-b":e):void(this._sdpSemantics="unified-plan"):void(/firefox/i.test(r)?this._sdpSemantics="unified-plan":/safari/i.test(r)?this._sdpSemantics=i<12?"plan-b":"unified-plan":this._sdpSemantics="unified-plan");this._sdpSemantics="plan-b"}}),Object.defineProperty(e,"getSdpSemantics",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e._sdpSemantics}}),Object.defineProperty(e.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._outboundStreams){var r=this._outboundStreams[t].getVideoTracks()[0];if(r){var i=/_tiny$/.test(t),n=ct(r),o=n.width,a=n.height;e.push({trackId:r.id,simulcast:i?Gn.TINY:Gn.NORMAL,resolution:"".concat(o,"x").concat(a)})}}return e}}),Object.defineProperty(e.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:e=co.trimBlankLine(e),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._peer.setRemoteDescription({type:"answer",sdp:e})];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),this._logger.info(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:o.FAILED,msg:t})),[2,exports.RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED];case 4:return this._logger.info(n.L_A_SDP_STRATEGY_SET_REMOTE_ANSWER_O,JSON.stringify({status:o.SUCCESSED,sdp:e})),[2,exports.RCRTCCode.SUCCESS]}}))}))}}),Object.defineProperty(e.prototype,"getStatParsr",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return/chrome/i.test(Ct.browser)?new oo(this,e,this._logger,t,r,i):/Firefox/i.test(Ct.browser)?new ao(this,e,this._logger,t,r,i):/Safari/i.test(Ct.browser)?new so(this,e,this._logger,t,r,i):null}}),Object.defineProperty(e.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return null}}),Object.defineProperty(e.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return co.trimBlankLine(e)}}),Object.defineProperty(e.prototype,"_setupSenderTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,i=t.writable,n=new TransformStream({transform:this._encodeRtpChunk.bind(this,e)});r.pipeThrough(n).pipeTo(i)}}}),Object.defineProperty(e.prototype,"_setupReceiverTransform",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._useEncrypt){var t=e.createEncodedStreams(),r=t.readable,i=t.writable,n=new TransformStream({transform:this._decodeRtpChunk.bind(this,e)});r.pipeThrough(n).pipeTo(i)}}}),Object.defineProperty(e.prototype,"_encodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=po.splitNaluData(e),r=t.header,i=t.payloadData,n=uo.encodeVideo(i),o=po.deal0x03(n,"encode");return new Uint8Array(d(d([],l(r),!1),l(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_decodeVideoFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=po.splitNaluData(e),r=t.header,i=t.payloadData,n=po.deal0x03(i,"decode"),o=uo.decodeVideo(n);return new Uint8Array(d(d([],l(r),!1),l(o),!1)).buffer}}),Object.defineProperty(e.prototype,"_handleAudioREDFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=function(e){for(var t=[],r=0;;){var i,n=!(e[r]>>7),o=127&e[r],a=void 0,s=void 0,c=void 0;if(n?(a=0,s=e.byteLength-(t.length>0?t.map((function(e){return 4+e.block.byteLength})).reduce((function(e,t){return e+t})):0)-1,c=e.slice(r,r+1),r+=1):(a=(e[r+1]<<6)+(e[r+2]>>2),s=((3&e[r+2])<<8)+e[r+3],c=e.slice(r,r+4),r+=4),i=new Uint8Array(s),t.push({timestampOffset:a,header:c,block:i,isPrimary:n,blockPType:o}),n)break}return t.forEach((function(t){var i=t.block.byteLength,n=e.slice(r,r+i);t.block.set(n),r+=i})),t}(new Uint8Array(e)),i=[],n=[],o=0;r.forEach((function(e){var r="decode"===t?uo.decodeAudio(e.block):uo.encodeAudio(e.block);if(r.byteLength!==e.block.byteLength&&!e.isPrimary){var a=l(e.header,4),s=a[2],c=a[3];s=(s>>2<<2)+r.byteLength>>8,c=255&r.byteLength,e.header=new Uint8Array([e.header[0],e.header[1],s,c])}e.block=r,o+=e.block.byteLength+e.header.byteLength,i.push(e.header),n.push(e.block)}));var a=new Uint8Array(o),s=0;return d(d([],l(i),!1),l(n),!1).forEach((function(e){a.set(e,s),s+=e.byteLength})),a.buffer}}),Object.defineProperty(e.prototype,"_handleOpusFrame",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=new Uint8Array(e);return("encode"===t?uo.encodeAudio(r):uo.decodeAudio(r)).buffer}}),Object.defineProperty(e.prototype,"_encodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._encodeVideoFrame(i);else{var n=t.getMetadata().payloadType,o=po.payloadTypeCodecMap.filter((function(e){return e.payloadType===n}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(i,"encode"):"opus"===o?t.data=this._handleOpusFrame(i,"encode"):console.error("Unsupport audio payloadType: ".concat(n,", codec: ").concat(o))}r.enqueue(t)}}),Object.defineProperty(e.prototype,"_decodeRtpChunk",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=t.data;if(t instanceof RTCEncodedVideoFrame)t.data=this._decodeVideoFrame(i);else{var n=t.getMetadata().payloadType,o=po.payloadTypeCodecMap.filter((function(e){return e.payloadType===n}))[0].codec;"red"===o?t.data=this._handleAudioREDFrame(i,"decode"):"opus"===o?t.data=this._handleOpusFrame(i,"decode"):console.error("Unsupport audio payloadType: ".concat(n,", codec: ").concat(o))}r.enqueue(t)}}),e}(),mo=function(e){function t(t,r){var i=e.call(this,r,lo.PLANB,t)||this;return Object.defineProperty(i,"SDP",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];d(d([],l(this.audioStreams),!1),l(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(video|audio)\b/),i=co.clearInactiveOrRecvonly(t);r&&r[1]===Ne.AUDIO&&(e[1]=i),r&&r[1]===Ne.VIDEO&&(e[2]=i)}));var t=e.join("");return co.trimBlankLine(t)}}),Object.defineProperty(t.prototype,"setAudioBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Audio Bitrate With Stream Id"),this}}),Object.defineProperty(t.prototype,"setVideoBitrateWithStreamId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"plan-b not support set Video Bitrate With Stream Id"),this}}),t}(co),Co=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"senders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),t}return r(t,e),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._localTracks.every((function(t){return t.getTrackId()!==e.getTrackId()}))&&this._localTracks.push(e);var t=e.getStreamId(),r=e.__innerGetMediaStreamTrack(),i=this._outboundStreams[t]||(this._outboundStreams[t]=new MediaStream);i.getTracks().forEach((function(e){e.kind===r.kind&&i.removeTrack(e)})),i.addTrack(r);var n=e.getTrackId(),o=this.senders[n];o?o.replaceTrack(r):(this.senders[n]=this._peer.addTrack(r,i),Object.defineProperty(r,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._localTracks.findIndex((function(t){return t===e}));t>=0&&this._localTracks.splice(t,1);var r=e.getTrackId(),i=this.senders[r];i&&(i.replaceTrack(null),this._peer.removeTrack(i),delete this.senders[r])}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i;return c(this,(function(n){switch(n.label){case 0:return[4,this._peer.createOffer({iceRestart:e,offerToReceiveAudio:!0,offerToReceiveVideo:!0})];case 1:for(r in t=n.sent(),this._outboundStreams)i=this._outboundStreams[r].id,t.sdp=t.sdp.replace(new RegExp(i,"g"),r);return t.sdp&&(t.sdp=this.resetSdp(t.sdp)),[4,this._peer.setLocalDescription(t)];case 2:return n.sent(),[2,{type:"offer",semantics:"plan-b",sdp:t.sdp}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return t=this.resetSdp(t),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_getMaxRangeBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this._localTracks.filter((function(t){return e===exports.RCMediaType.AUDIO_ONLY?t.isAudioTrack():t.isVideoTrack()})),r={max:0,min:0};return t.forEach((function(e){var t=e.getBitrate(),i=t.min,n=t.max,o=t.start;r.max=r.max<n?n:r.max,r.min=r.min>i?i:r.min,r.max===n?r.start=o:r.start=.7*r.max})),r}}),Object.defineProperty(t.prototype,"resetSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new mo(this._logger,e),r=this._getMaxRangeBitrate(exports.RCMediaType.VIDEO_ONLY),i=this._getMaxRangeBitrate(exports.RCMediaType.AUDIO_ONLY);return t.setAudiosBitrate(i),t.setVideosBitrate(r),t.stringify()}}),t}(go),vo=function(e){function t(t,r){return e.call(this,r,lo.UNIFIEDPLAN,t)||this}return r(t,e),Object.defineProperty(t.prototype,"stringify",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[this.SDPHeader];d(d([],l(this.audioStreams),!1),l(this.videoStreams),!1).forEach((function(t){var r=t.match(/\ba=mid:(\d+)\b/);r&&r[1]&&(e[+r[1]+1]=t)})),this.SDPHeader="",this.videoStreams=[],this.audioStreams=[];var t=e.join("");return co.trimBlankLine(t)}}),t}(co),Oo=function(){function e(){Object.defineProperty(this,"__streams",{enumerable:!0,configurable:!0,writable:!0,value:new Map})}return Object.defineProperty(e,"getInstance",{enumerable:!1,configurable:!0,writable:!0,value:function(){return e.instance||(e.instance=new e),e.instance}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this.__streams.set(e,t),t}}),Object.defineProperty(e.prototype,"pickup",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.get(e)}}),Object.defineProperty(e.prototype,"delete",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.__streams.delete(e)}}),Object.defineProperty(e.prototype,"streams",{get:function(){var e,t,r=new Map;try{for(var i=u(this.__streams.keys()),n=i.next();!n.done;n=i.next()){var o=n.value;r.set(o,this.pickup(o))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},enumerable:!1,configurable:!0}),e}(),To=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return Object.defineProperty(t,"_sendTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_localTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_recvAudio",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvVideo",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"_recvTransceiver",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(t,"_subedTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(t,"midMsid",{enumerable:!0,configurable:!0,writable:!0,value:{}}),t}return r(t,e),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.warn(n.L_FUNCTION_IS_UNAVAILABLE,"the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`")}}),Object.defineProperty(t.prototype,"getTrackIdByMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._sendTransceiver){if(this._sendTransceiver[t].mid===e)return t}for(var t in this._recvTransceiver){if(this._recvTransceiver[t].mid===e)return t}return null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=e.getTrackId(),i=e.getStreamId(),n=e.__innerGetMediaStreamTrack();this._localTracks[r]=e;var o=this._outboundStreams[i]||(this._outboundStreams[i]=new MediaStream);o.getTracks().forEach((function(e){e.kind===n.kind&&o.removeTrack(e)})),o.addTrack(n);var a=this._sendTransceiver[r];if(a)a.sender.replaceTrack(n),a.direction="sendonly";else{var s=this._sendTransceiver[r]=this._peer.addTransceiver(n,{direction:"sendonly",streams:[o]});this._setupSenderTransform(s.sender)}Oo.getInstance().push(r,{msid:i,id:this._outboundStreams[i].id,kind:null===(t=e.streamTrack)||void 0===t?void 0:t.kind})}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId(),r=e.getStreamId();delete this._localTracks[t];var i=this._sendTransceiver[t];if(i){"closed"!==this._peer.connectionState&&(i.direction="inactive",this._peer.removeTrack(i.sender),i.sender.replaceTrack(null));var n=this._outboundStreams[r];(e.isAudioTrack()?n.getAudioTracks():n.getVideoTracks()).forEach((function(e){return n.removeTrack(e)}));var o=this._sendTransceiver["".concat(t,"_tiny")];if(o&&"inactive"!==o.direction&&"closed"!==this._peer.connectionState){o.direction="inactive";var a=o.sender,s=a.track;this._peer.removeTrack(a),a.replaceTrack(null),this._outboundStreams["".concat(r,"_tiny")].removeTrack(s),s.stop()}}}}),Object.defineProperty(t.prototype,"updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=dt(e).mediaType;this._recvTransceiver[e]=t;var i=r===exports.RCMediaType.AUDIO_ONLY?this._recvAudio:this._recvVideo,n=i.findIndex((function(e){return e===t}));n>=0&&i.splice(n,1)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this,r=e.slice(),i=this._subedTracks.slice();this._subedTracks=e.slice();for(var n=function(e){var t=r[e],n=i.findIndex((function(e){return e===t}));n>=0&&(r.splice(e,1),i.splice(n,1))},o=r.length-1;o>=0;o-=1)n(o);i.length&&i.forEach((function(e){var r=e.getTrackId();e.__innerSetMediaStreamTrack(void 0);var i=t._recvTransceiver[r];i&&(i.direction="inactive")}));var a={audio:0,video:0};r.length&&r.forEach((function(e){var r=e.isAudioTrack()?"audio":"video",i=t._recvTransceiver[e.getTrackId()];i?i.direction="recvonly":a[r]+=1}));for(o=this._recvAudio.length;o<a.audio;o+=1){var s=this._peer.addTransceiver("audio",{direction:"recvonly"});this._recvAudio.push(s),this._setupReceiverTransform(s.receiver)}for(o=this._recvVideo.length;o<a.video;o+=1){s=this._peer.addTransceiver("video",{direction:"recvonly"});this._recvVideo.push(s),this._setupReceiverTransform(s.receiver)}}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n;return c(this,(function(o){switch(o.label){case 0:return[4,this._peer.createOffer({iceRestart:e})];case 1:for(i in t=o.sent(),r=t.sdp,this._outboundStreams)n=this._outboundStreams[i].id,r=r.replace(new RegExp(n,"g"),i);return r=(r=this.resetOfferSdp(r)).replace(/(a=ice-options:trickle)/g,"$1\r\na=ice-options:renomination"),t.sdp=r,[4,this._peer.setLocalDescription(t)];case 2:return o.sent(),[2,{type:"offer",semantics:"unified-plan",sdp:r}]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(t){t=this.resetAnswerSdp(t);var r=/[\r\n]+\r\n[\r\n]+/g;return r.test(t)&&(t=t.replace(r,"\r\n")),e.prototype.setRemoteAnswer.call(this,t)}}),Object.defineProperty(t.prototype,"_genarateMid",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=null;return po.getMediaSections(e).forEach((function(e){po.parseExtmap(e);var n=po.parseMLine(e).kind,o=po.parseMsid(e).stream,a=po.getMid(e);"video"===r?/tiny$/.test(o)?o=o.replace(/tiny$/gi,"1_tiny"):o+="_1":o+="_0",o===t&&r===n&&a&&(i=a)})),i}}),Object.defineProperty(t.prototype,"_setSenderTransceiverBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n=this._localTracks[t],o=null==n?void 0:n.getBitrate();i===Ne.AUDIO&&o&&e.setAudioBitrateWithMid(o,r),i===Ne.VIDEO&&o&&e.setVideoBitrateWithMid(o,r)}}),Object.defineProperty(t.prototype,"_resetSenderTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;for(var i in this._sendTransceiver){var n=this._sendTransceiver[i],o=null===(r=n.sender.track)||void 0===r?void 0:r.kind,a=n.direction,s=n.mid;s||(s=this._genarateMid(e,i,o)),s&&(a===_o.SENDONLY&&this._setSenderTransceiverBitrate(t,i,s,o),a===_o.INACTIVE&&t.clearnSsrcWithMid(s,_o.INACTIVE))}}}),Object.defineProperty(t.prototype,"_resetRecvTransceiver",{enumerable:!1,configurable:!0,writable:!0,value:function(e){for(var t in this._recvTransceiver){var r=this._recvTransceiver[t],i=r.direction,n=r.mid;n&&i===_o.INACTIVE&&e.clearnSsrcWithMid(n,_o.RECVONLY)}}}),Object.defineProperty(t.prototype,"resetOfferSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=new vo(this._logger,e);return this._resetSenderTransceiver(e,t),this._resetRecvTransceiver(t),t.stringify()}}),Object.defineProperty(t.prototype,"resetAnswerSdp",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=new vo(this._logger,e);for(var i in this._sendTransceiver){var n=this._sendTransceiver[i],o=n.mid;if(o){var a=this._localTracks[i],s=null==a?void 0:a.getBitrate(),c=null===(t=n.sender.track)||void 0===t?void 0:t.kind;c===Ne.AUDIO&&s&&r.setAudioBitrateWithMid(s,o),c===Ne.VIDEO&&s&&r.setVideoBitrateWithMid(s,o)}}return r.stringify()}}),t}(go),Eo=function(e){function t(t,r,i,n,o,a,s){void 0===a&&(a=!1),void 0===s&&(s=!1);var c=e.call(this)||this;Object.defineProperty(c,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(c,"_reTryExchange",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(c,"_currentUserId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(c,"_store",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"_isRoomAudience",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"_rtcPeerConn",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"_sdpStrategy",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"reportParser",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(c,"pubLocalTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(c,"_reTryExchangeTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_reportStatsTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_reportR3R4ToPolarisTimer",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_formatStatsData",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(c,"_inRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_firstConnectFromPub",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(c,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null});var u=go.getSdpSemantics(),l="unified-plan"===u&&s&&"function"==typeof RTCRtpSender.prototype.createEncodedStreams&&"function"==typeof RTCRtpReceiver.prototype.createEncodedStreams&&uo.isInit(),d=c._rtcPeerConn=new RTCPeerConnection({sdpSemantics:u,encodedInsertableStreams:l});return c._sdpStrategy="plan-b"===u?new Co(c._logger,d,!1):new To(c._logger,d,l),c._rtcPeerConn.oniceconnectionstatechange=c._onICEConnectionStateChange.bind(c),c._rtcPeerConn.onconnectionstatechange=c._onConnectionStateChange.bind(c),c._rtcPeerConn.ontrack=c._onTrackReady.bind(c),c.reportParser=c._sdpStrategy.getStatParsr(c._rtcPeerConn,u,c._currentUserId,c._store),c}return r(t,e),Object.defineProperty(t.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.values(this.pubLocalTracks)}}),Object.defineProperty(t.prototype,"_onConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._logger.info(n.L_RTC_PEER_CONNECTION_CONNECTION_STATE_S,"state: ".concat(this._rtcPeerConn.connectionState))}}),Object.defineProperty(t.prototype,"startAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;this.stopAutoExecute(),this._reportStatsTimer=setTimeout((function(){t._reportHandle(),t.startAutoExecute(e)}),e)}}),Object.defineProperty(t.prototype,"stopAutoExecute",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reportStatsTimer)}}),Object.defineProperty(t.prototype,"_onICEConnectionStateChange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r;return s(this,void 0,void 0,(function(){var i,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this._rtcPeerConn.iceConnectionState,this._logger.info(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_S,JSON.stringify({iceConnectionState:i})),[4,this._getStatsData()];case 1:a=c.sent(),s=a?this._createRCRTCStateReport(a).iceCandidatePair:null,this.emit(t.__INNER_ICE_STATE_CHANGE__,{status:i,time:Date.now(),iceCandidatePair:s}),"connected"===i?(this.emit(t.__INNER_ICE_CONNECTED__,this._firstConnectFromPub),this.startAutoExecute(1e3)):"failed"!==i&&"disconnected"!==i||this._handleRetry();try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onICEConnectionStateChange)||void 0===r||r.call(e,i)}catch(e){this._logger.error(n.L_RTC_PEER_CONNECTION_ICE_CONNECTION_STATE_REPORT_R,JSON.stringify({status:o.FAILED,mag:e}))}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_handleRetry",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t=this;return c(this,(function(r){switch(r.label){case 0:return this._inRetry?[2]:(this.clearReTryExchangeTimer(),this._inRetry=!0,[4,this._reTryExchange()]);case 1:return e=r.sent().code,this._inRetry=!1,e===exports.RCRTCCode.SUCCESS?[2]:(this._reTryExchangeTimer=setTimeout((function(){return t._handleRetry()}),15e3),[2])}}))}))}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(e.streams.length){var r=e.streams[0].id,i=e.receiver.track,n=[r,"audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_");Object.defineProperty(i,"trackId",{value:n,writable:!1,enumerable:!1,configurable:!1}),this._updateRecvTransceiverMap(n,e.transceiver),this.emit(t.__INNER_EVENT_TRACK_READY__,e)}}}),Object.defineProperty(t.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){return this._sdpStrategy.setBitrate(e,t,r),this._logger.info(n.L_RTC_PEER_CONNECTION_SET_BITRATE_O,JSON.stringify({status:o.SUCCESSED,max:e,min:t,start:r})),[2]}))}))}}),Object.defineProperty(t.prototype,"createOffer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return[4,this._sdpStrategy.createOffer(e)];case 1:return t=r.sent(),this._logger.info(n.L_RTC_PEER_CONNECTION_CREATE_OFFER_O,JSON.stringify({offerSDP:t.sdp,sdpDemantics:t.semantics})),[2,t]}}))}))}}),Object.defineProperty(t.prototype,"setRemoteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;return void 0===t&&(t=!1),s(this,void 0,void 0,(function(){return c(this,(function(i){return po.parsePayloadTypes(null===(r=this._rtcPeerConn.localDescription)||void 0===r?void 0:r.sdp),this._firstConnectFromPub=t,[2,this._sdpStrategy.setRemoteAnswer(e)]}))}))}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.pubLocalTracks[e]||null}}),Object.defineProperty(t.prototype,"addLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.pubLocalTracks[e.getTrackId()]=e,this._sdpStrategy.addLocalTrack(e),e.off(Ke.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Ke.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),e.on(Ke.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.on(Ke.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),this._logger.info(n.L_RTC_PEER_CONNECTION_ADD_LOCAL_TRACK_O,"trackId: ".concat(e.getTrackId()))}}),Object.defineProperty(t.prototype,"removeLocalTrackById",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.getLocalTrack(e);t?(this._logger.info(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this.removeLocalTrack(t)):this._logger.warn(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_BY_ID_O,JSON.stringify({status:o.FAILED,msg:"track not found",trackId:e}))}}),Object.defineProperty(t.prototype,"removeAllLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.keys(this.pubLocalTracks).forEach((function(t){/_tiny$/.test(t)||e.removeLocalTrackById(t)}))}}),Object.defineProperty(t.prototype,"removeLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.getTrackId();delete this.pubLocalTracks[t],this._sdpStrategy.removeLocalTrack(e),e.__innerSetPublished(!1),e.off(Ke.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),e.off(Ke.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this);var r="".concat(t,"_tiny"),i=this.getLocalTrack(r);i&&(this._sdpStrategy.removeLocalTrack(i),delete this.pubLocalTracks[r],i.destroy()),this._logger.info(n.L_RTC_PEER_CONNECTION_REMOVE_LOCAL_TRACK_O,JSON.stringify({trackId:t}))}}),Object.defineProperty(t.prototype,"_updateRecvTransceiverMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sdpStrategy.updateRecvTransceiverMap(e,t)}}),Object.defineProperty(t.prototype,"updateSubRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._sdpStrategy.updateSubRemoteTracks(e)}}),Object.defineProperty(t.prototype,"getOutboundVideoInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sdpStrategy.getOutboundVideoInfo()}}),Object.defineProperty(t.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this.getLocalTrack("".concat(e.getTrackId(),"_tiny"));r&&(r.__innerGetMediaStreamTrack().enabled=!e.isLocalMuted()),this.emit(Ke.__INNER_EVENT_MUTED_CHANGE__,e,t)}}),Object.defineProperty(t.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.emit(Ke.__INNER_EVENT_DESTROY__,e)}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"_createSenderReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.filter((function(e){return e.trackId})).map((function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),a({},t)}))}}),Object.defineProperty(t.prototype,"_createReceiverReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e.filter((function(e){return e.trackId})).map((function(e){var t={trackId:e.trackId,kind:e.kind,packetsLostRate:e.packetsLostRate,remoteResource:e.remoteResource,bitrate:e.bitrate,jitter:e.jitter,rtt:e.rtt};return(e.audioLevel||0===e.audioLevel)&&(t.audioLevel=e.audioLevel),e.frameWidth&&(t.frameWidth=e.frameWidth),e.frameHeight&&(t.frameHeight=e.frameHeight),e.frameRate&&(t.frameRate=e.frameRate),a({},t)}))}}),Object.defineProperty(t.prototype,"_createRCRTCStateReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.timestamp,r=e.iceCandidatePair,i=e.senders,n=e.receivers;for(var o in(null==r?void 0:r.totalPacketsLost)&&(null==r||delete r.totalPacketsLost),r)It(r[o])&&delete r[o];return{timestamp:t,iceCandidatePair:r,senders:this._createSenderReport(i),receivers:this._createReceiverReport(n)}}}),Object.defineProperty(t.prototype,"_getStatsData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return s(this,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:return this._formatStatsData=null,r=null,[4,this._rtcPeerConn.getStats()];case 1:return i=o.sent(),r=null===(e=this.reportParser)||void 0===e?void 0:e.parseRTCStatsReport(i),n=null===(t=this.reportParser)||void 0===t?void 0:t.formatRCRTCStateReport(r),this._formatStatsData=n,[2,n]}}))}))}}),Object.defineProperty(t.prototype,"_reportHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,r,i,o,a;return s(this,void 0,void 0,(function(){var s,u,_,p;return c(this,(function(c){switch(c.label){case 0:return[4,this._getStatsData()];case 1:if(!(s=c.sent()))return[2];u=this._createRCRTCStateReport(s);try{null===(r=null===(e=this._reportListener)||void 0===e?void 0:e.onStateReport)||void 0===r||r.call(e,JSON.parse(JSON.stringify(u)))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}if(_=d(d([],l(s.receivers),!1),l(s.senders),!1).filter((function(e){return"audio"===e.kind})).map((function(e){return{trackId:e.trackId,audioLevel:e.audioLevel}})),this.emit(t.__INNER_AUDIOLEVEL_CHANGE__,_),this._isRoomAudience&&(null===(i=this._reportListener)||void 0===i?void 0:i.onReportLiveAudioStates)){p=this._getLiveAudioState();try{p.length&&(null===(a=null===(o=this._reportListener)||void 0===o?void 0:o.onReportLiveAudioStates)||void 0===a||a.call(o,p))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}return[2]}}))}))}}),Object.defineProperty(t.prototype,"_getLiveAudioState",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this._rtcPeerConn.getReceivers().forEach((function(e){var r=e.getContributingSources();r.length&&t.push.apply(t,d([],l(r),!1))})),t.map((function(t){var r=t.source,i=t.audioLevel,n=e._store.getTrackIdBySSRC(r);if(!n)return{};var o=dt(n).userId;return{audioLevel:eo(i),userId:o,trackId:n}})).filter((function(e){return!!e.userId}))}}),Object.defineProperty(t.prototype,"_sendR3R4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t;return s(this,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:return(r=this._formatStatsData)?(i=r.senders,n=r.receivers,i.length?[4,null===(e=this._polarisReport)||void 0===e?void 0:e.sendR3Data(r)]:[3,2]):[2];case 1:o.sent(),o.label=2;case 2:return n.length?[4,null===(t=this._polarisReport)||void 0===t?void 0:t.sendR4Data(r)]:[3,4];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"__reportR3R4ToPolaris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return clearTimeout(this._reportR3R4ToPolarisTimer),this._reportR3R4ToPolarisTimer=setTimeout((function(){return s(e,void 0,void 0,(function(){var e=this;return c(this,(function(t){return this._sendR3R4Data().then((function(){e.__reportR3R4ToPolaris()})),[2]}))}))}),2e3),[2]}))}))}}),Object.defineProperty(t.prototype,"getRTCPeerConn",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._rtcPeerConn}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.clear(),this.clearReTryExchangeTimer(),clearTimeout(this._reportR3R4ToPolarisTimer),this.stopAutoExecute(),this.registerReportListener(null),this._rtcPeerConn.close(),this._isDestroyed=!0,this.reportParser=null,this._logger.info(n.L_RTC_PEER_CONNECTION_DESTROY_O,JSON.stringify({status:o.SUCCESSED}))}}),Object.defineProperty(t.prototype,"clearReTryExchangeTimer",{enumerable:!1,configurable:!0,writable:!0,value:function(){clearTimeout(this._reTryExchangeTimer),this._reTryExchangeTimer=null}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t,"__INNER_EVENT_TRACK_READY__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-track-ready"}),Object.defineProperty(t,"__INNER_AUDIOLEVEL_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-audio-level-change"}),Object.defineProperty(t,"__INNER_ICE_STATE_CHANGE__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-state-change"}),Object.defineProperty(t,"__INNER_ICE_CONNECTED__",{enumerable:!0,configurable:!0,writable:!0,value:"inner-ice-connected"}),t}(e.EventEmitter),Io=function(){function e(e,t){Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_peer",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_audioLevelChangeHandler",{enumerable:!0,configurable:!0,writable:!0,value:null})}return Object.defineProperty(e.prototype,"audioLevelReport",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;if(this._audioLevelChangeHandler){var r=[];e.forEach((function(e){var i=dt(e.trackId).userId,n=t._store.crtUserId===i?t._peer.getLocalTrack(e.trackId):t._store.getRemoteTrack(e.trackId);n&&r.push({track:n,audioLevel:e.audioLevel||0})})),this._audioLevelChangeHandler(r)}}}),Object.defineProperty(e.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._audioLevelChangeHandler=e}}),e}();exports.RCRTCLiveRole=void 0,(fo=exports.RCRTCLiveRole||(exports.RCRTCLiveRole={}))[fo.ANCHOR=1]="ANCHOR",fo[fo.AUDIENCE=2]="AUDIENCE",function(e){e.UNPUBLISH_PREV="UnpublishPrevCommand",e.PULL_RTCROOM_STATUS="PullRTCRoomStatusCommand",e.JOINROOM="JoinRoomCommand",e.PARSE_REMOTERES="ParseRemoteResCommand",e.PARSE_USERSTATE="ParseUserStateCommand",e.LOCAL_TRACK_MUTE="LocalTrackMuteCommand",e.PUBLISH="PublishCommand",e.RETRY_EXCHANGE="RetryExchangeCommand",e.UNPUBLISH="UnpublishCommand",e.SUBSCRIBE="SubscribeCommand",e.UNSUBSCRIBE="UnsubscribeCommand",e.UPDATE_SUBSCRIBE_LIST="UpdateSubscribeListCommand",e.ON_SIGNAL_RECONNECTED="OnSignalReconnectedCommand",e.LEAVE_OTHER_ROOM="LeaveOtherRoomCommand",e.RTC_IDENTITY_CHANGE="RTCIdentityChangeCommand",e.ENABLE_INNER_CDN="EnableInnerCDNCommand",e.EXCHANGE_WITH_PUSH_OTHER_ROOM="ExchangeWithPushOtherRoomCommand",e.MCUCONFIG_FLUSH="MCUConfigFlushCommand",e.UNKNOWN="Unknown"}(ho||(ho={})),function(e){e[e.LOW=0]="LOW",e[e.NORMAL=1]="NORMAL",e[e.HIGH=2]="HIGH"}(bo||(bo={})),function(e){e[e.Destroy=40400]="Destroy"}(Ro||(Ro={}));var So,yo=function(){function e(){}return Object.defineProperty(e.prototype,"priority",{get:function(){return bo.LOW},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){return ho.UNKNOWN},enumerable:!1,configurable:!0}),e}(),Lo=function(){function t(e,t,r,i){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"abortCode",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_busy",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isDestroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1})}return Object.defineProperty(t.prototype,"_next",{enumerable:!1,configurable:!0,writable:!0,value:function(){this._busy=!1,this._execute()}}),Object.defineProperty(t.prototype,"_execute",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t,r,i,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:if(this._isDestroyed||this._busy||0===this._queue.length)return[2];this._busy=!0,t=this._queue.shift(),r=t.command,i=t.resolve,a=this._logger.createTraceId(),c.label=1;case 1:return c.trys.push([1,3,,4]),this._logger.info(n.L_INVOKER_EXECUTE_T,"kind: ".concat(r.kind,", length: ").concat(this._queue.length),a),[4,r.execute(this._context,this._store,this)];case 2:return o=c.sent(),[3,4];case 3:return s=c.sent(),console.error(s),this._logger.error(n.L_INVOKER_EXECUTE_R,r.kind,a),this._next(),[2];case 4:return(u=o.code)!==exports.RCRTCCode.SUCCESS&&u!==e.ErrorCode.SUCCESS?this._logger.warn(n.L_INVOKER_EXECUTE_R,"code: ".concat(u,", kind: ").concat(r.kind),a):this._logger.info(n.L_INVOKER_EXECUTE_R,"kind: ".concat(r.kind,", Done"),a),i(o),this._next(),[2]}}))}))}}),Object.defineProperty(t.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,new Promise((function(r){if(t._logger.info(n.L_INVOKER_PUSH_O,JSON.stringify({isDestroyed:t._isDestroyed,kind:e.kind,length:t._queue.length})),t._isDestroyed)r({code:exports.RCRTCCode.NOT_IN_ROOM});else{var i=e.priority;if(i===bo.LOW)t._queue.push({command:e,resolve:r});else{var o=t._queue.findIndex((function(e){return e.command.priority<i})),a=-1===o?t._queue.length-1:o;t._queue.splice(a,0,{command:e,resolve:r})}setTimeout((function(){t._execute()}),0)}}))]}))}))}}),Object.defineProperty(t.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._isDestroyed}}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._isDestroyed||(this._logger.info(n.L_INVOKER_DESTROY_O),this._isDestroyed=!0,this._queue.forEach((function(t){t.resolve({code:e.abortCode})})),this._queue.length=0)}}),t}(),Po=function(e){function t(t,r){return e.call(this,t.logger,t,r,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED)||this}return r(t,e),Object.defineProperty(t.prototype,"store",{get:function(){return this._context.store},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(){e.prototype.destroy.call(this),this._store.removeRemoteTracks()}}),t}(Lo),No=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;Object.values(this._roomResources).forEach((function(t){t.forEach((function(t){var r=JSON.parse(t.uri),i=r.ssrc,n=r.resourceId;e._trackIdSSRCMap.set(i,n)}))}))}}),Object.defineProperty(t.prototype,"setTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._trackIdSSRCMap.set(e,t)}}),Object.defineProperty(t.prototype,"_initRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;for(var t in this._roomResources){var r=this._roomResources[t];t!==this.crtUserId&&0!==r.length&&r.forEach((function(t){var r=lt(t),i=dt(r),n=i.tag,o=i.userId,a=i.mediaType===exports.RCMediaType.AUDIO_ONLY?new rt(e._logger,n,o):new it(e._logger,n,o);a.__innerSetRemoteMuted(0===t.state),e._remoteTracks[r]=a}))}}}),Object.defineProperty(t.prototype,"initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._sessionId=e.sessionId,this._token=e.token,this._roomStatusVersion=Pt(e.version),this._roomResources=yt(e,this.roomId,this._logger,t),this._updateTrackIdSSRCMap(),this._initRemoteTracks(),this.setResourcesByUserId(this.crtUserId,this.getResourcesByUserId(this.crtUserId)||[]),this._logger.info(n.L_PARSE_ROOMDATA_URIS_R,"room data -> ".concat(JSON.stringify(this._roomResources)),t)}}),Object.defineProperty(t.prototype,"assignRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){Object.assign(this._roomResources,e),this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"setResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._roomResources[e]=t,this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"removeRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"removeResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){delete this._roomResources[e],this._updateTrackIdSSRCMap()}}),Object.defineProperty(t.prototype,"addRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._remoteTracks[e.getTrackId()]=e}}),Object.defineProperty(t.prototype,"removeRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._remoteTracks);e.length&&(e.forEach((function(e){e.isAudioTrack()&&e.__releaseMediaElement()})),this._remoteTracks={})}}),Object.defineProperty(t.prototype,"setCDNEnabel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._CDNEnable=e}}),Object.defineProperty(t.prototype,"setCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._CDNUris=e}}),Object.defineProperty(t.prototype,"resetSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._subscribedList).splice.apply(t,d([0,this._subscribedList.length],l(e),!1)),this.resetCollectSubscribeList(e)}}),Object.defineProperty(t.prototype,"resetCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;(t=this._collectSubscribeList).splice.apply(t,d([0,this._collectSubscribeList.length],l(e),!1))}}),Object.defineProperty(t.prototype,"setRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._roomStatusVersion=Pt(e)}}),t}(function(){function e(e,t,r,i,n,o,a,s){Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"appkey",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"roomMode",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"isUpgrade",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"isMainRoom",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_roomResources",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_collectSubscribeList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_token",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_CDNEnable",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_trackIdSSRCMap",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"_roomStatusVersion",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_supportNtf",{enumerable:!0,configurable:!0,writable:!0,value:!0})}return Object.defineProperty(e.prototype,"getResourcesByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._roomResources[e]}}),Object.defineProperty(e.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(e.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}}),Object.defineProperty(e.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._remoteTracks}}),Object.defineProperty(e.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(e.prototype,"getAllUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return Object.keys(this._roomResources)}}),Object.defineProperty(e.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;return this.getAllUserIds().filter((function(t){return t!==e.crtUserId}))}}),Object.defineProperty(e.prototype,"getSubscribedList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._subscribedList}}),Object.defineProperty(e.prototype,"getCollectSubscribeList",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._collectSubscribeList}}),Object.defineProperty(e.prototype,"getPublishedResourceByTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=dt(e).userId;return this._roomResources[t].find((function(t){return lt(t)===e}))}}),Object.defineProperty(e.prototype,"getToken",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._token}}),Object.defineProperty(e.prototype,"getCDNEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNEnable}}),Object.defineProperty(e.prototype,"getCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNUris}}),Object.defineProperty(e.prototype,"getRoomStatusVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomStatusVersion}}),Object.defineProperty(e.prototype,"getTrackIdBySSRC",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._trackIdSSRCMap.get(e)}}),Object.defineProperty(e.prototype,"getRTCRequestHeader",{enumerable:!1,configurable:!0,writable:!0,value:function(){return{"App-Key":this.appkey,RoomId:this.roomId,Token:this._token,RoomType:this.roomMode,UserId:this.crtUserId,"Client-Session-Id":this.clientSessionId}}}),Object.defineProperty(e.prototype,"getSupportNtf",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._supportNtf}}),e}()),Ao=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.UNPUBLISH_PREV},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return i=t.logger,a=t.context,s=r.getResourcesByUserId(r.crtUserId),u=s.slice(),s.length=0,l=i.createTraceId(),i.info(n.L_UNPUBLISH_PREV_COMMAND_T,JSON.stringify({resource:u}),l),[4,a.setRTCTotalRes(r.roomId,[nt(Tt.UNPUBLISH,u)],ot([]),Tt.TOTAL_CONTENT_RESOURCE,ot([]))];case 1:return(d=c.sent())!==e.ErrorCode.SUCCESS?i.error(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:o.FAILED,code:d}),l):i.info(n.L_UNPUBLISH_PREV_COMMAND_R,JSON.stringify({status:o.SUCCESSED}),l),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(yo);exports.RTCMode=void 0,(So=exports.RTCMode||(exports.RTCMode={}))[So.RTC=0]="RTC",So[So.LIVE=2]="LIVE",So[So.CROSS_MUTI=7]="CROSS_MUTI",So[So.SIP=4]="SIP",So[So.CALL=5]="CALL";var wo,Do=function(t){function i(e,r,i,n,o,a,s){var c=t.call(this)||this;return Object.defineProperty(c,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(c,"roomType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(c,"joinType",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(c,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(c,"innerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(c,"outerUserDatas",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(c,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:s}),c}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.JOINROOM},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_getResultTag",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=n.L_RTC_CLIENT_JOIN_RTC_ROOM_R;return this.roomType===exports.RTCMode.LIVE&&(e=n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R),e}}),Object.defineProperty(i.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n=this;if(t.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED)return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"im not connected"}),this.traceId),{code:exports.RCRTCCode.SIGNAL_DISCONNECTED};if(St(t.getNaviInfo()))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),this.traceId),{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR};if(!e.validate("roomId",this.roomId,e.notEmptyString,!0))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("roomType",this.roomType,(function(e){return void 0!==exports.RTCMode[e]})))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomType"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(!e.validate("outerUserDatas",this.outerUserDatas,e.isObject,!1))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};if(this.outerUserDatas&&!Object.keys(this.outerUserDatas).every((function(t){return e.validate("outerUserDatas.".concat(t),n.outerUserDatas[t],e.isString,!0)})))return r.error(i,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> outerUserDatas"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR};return{code:exports.RCRTCCode.SUCCESS}}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n;return s(this,void 0,void 0,(function(){var a,s,u,l,d,_,p,f,h,b,R,g,m;return c(this,(function(c){switch(c.label){case 0:return a=Date.now(),s=t.context,u=t.service,l=t.logger,d=t.reportMediaActionLogger,_=this._getResultTag(),(p=this._validateParams(s,l,_).code)!==exports.RCRTCCode.SUCCESS?[2,{code:p}]:u.getMsList().length?(f=r.getSupportNtf(),[4,s.joinRTCRoom(this.roomId,this.roomType,this.livingType,this.joinType,this.innerUserDatas,this.outerUserDatas,f)]):(l.error(_,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),this.traceId),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]);case 1:return h=c.sent(),b=h.code,R=h.data,d.reportQualityJoinRoomData(a,b,this.roomType,null==R?void 0:R.sessionId),b===e.ErrorCode.SUCCESS&&R?(r.initWithRoomData(R,this.traceId),r.getResourcesByUserId(r.crtUserId).length>0&&i.push(new Ao),(m=null===(n=R.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&r.setCDNUris(JSON.parse(m)[0]),l.info(_,JSON.stringify({status:o.SUCCESSED,userId:r.crtUserId,roomId:this.roomId}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS,data:R}]):(g=40032===b?exports.RCRTCCode.SIGNAL_JOIN_RTC_ROOM_REFUSED:b,l.error(_,JSON.stringify({status:o.FAILED,code:g,msg:"joinRoom failed"}),this.traceId),[2,{code:g}])}}))}))}}),i}(yo);!function(e){e[e.ROOM=1]="ROOM",e[e.PERSON=2]="PERSON"}(wo||(wo={}));var ko,Uo,Mo,xo="PEER_CONNECTION_CLOSED_BY_EXCEPTION",jo="USER_JOIN",Bo="USER_LEAVE",Vo="TRACKS_PUBLISH",Fo="TRACKS_UNPUBLISH",Jo="AUDIO_MUTE_CHANGE",Go="VIDEO_MUTE_CHANGE",Ho="CDN_ENABLE_CHANGE",Ko="USER_STATE_CHANGE",Wo=function(e){function t(t,r,i,n,o,a,s,c){var u=e.call(this)||this;return Object.defineProperty(u,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(u,"service",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(u,"context",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(u,"runtime",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(u,"peer",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(u,"store",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(u,"polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(u,"reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(u,"getPushOtherRooms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),u}return r(t,e),t}(e.EventEmitter);!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe"}(ko||(ko={})),function(e){e.BEGIN="begin",e.END="end"}(Uo||(Uo={})),function(e){e[e.SPREAD=0]="SPREAD",e[e.NO_SPREAD=-1]="NO_SPREAD"}(Mo||(Mo={}));var Yo,zo=function(e){function t(t,r,i){var n=e.call(this)||this;return Object.defineProperty(n,"reqBody",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"isNeedUpdateMsas",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i;return s(this,void 0,void 0,(function(){var r,n,o,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return r=e.service,n=e.context,[4,r.exchange(t.getRTCRequestHeader(),this.reqBody,this.traceId,this.isNeedUpdateMsas)];case 1:return o=c.sent(),s=o.code,u=o.data,l=o.qualityMsList,d={code:s,data:{data:u,qualityMsList:l}},_=null===(i=null==u?void 0:u.urls)||void 0===i?void 0:i.pull_url,t.roomMode===exports.RTCMode.LIVE&&_&&(p=JSON.parse(_),t.setCDNUris(p),(null==p?void 0:p.broadcast)===Mo.SPREAD&&(t.setCDNEnabel(!0),f=a(a({},p),{enableInnerCDN:!0}),ea(n,t.roomId,f))),[2,d]}}))}))}}),t}(yo);!function(e){e.PUB="pub",e.UNPUB="unpub",e.SUB="sub",e.UNSUB="unsub"}(Yo||(Yo={}));var qo=function(t){function i(e,r,i,n,o){void 0===n&&(n=Yo.SUB);var a=t.call(this)||this;return Object.defineProperty(a,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(a,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"fromCommand",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"unsubTracks",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(a,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),a}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.UPDATE_SUBSCRIBE_LIST},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var a=null==i?void 0:i.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),s=r.filter((function(e){return null==a?void 0:a.includes(e.track.getTrackId())})),c=r.filter((function(e){return!(null==a?void 0:a.includes(e.track.getTrackId()))}));t.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,subSuccessTrackIds:a,failedList:c}),this.traceId);var u=e.getRemoteTracks(),l=function(e){var t=s.some((function(t){return t.track.getTrackId()===e}));u[e].__innerSetSubscribed(t);var r=s.some((function(t){return t.track.getTrackId()===e&&t.subTiny}));u[e].isVideoTrack()&&u[e].__innerSetIsTinyTrack(r)};for(var d in u)l(d);return e.resetSubscribedList(s),c}}),Object.defineProperty(i.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this,o=r.map((function(e){return e instanceof tt?{track:e}:a({},e)})),s={};return o=o.filter((function(r){var o=r.track.getTrackId();return e.getRemoteTrack(o)?!s[o]&&(s[o]=!0,!0):(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_P,"track cannot found in room -> trackId: ".concat(o),i.traceId),!1)})).map((function(e){return a({},e)}))}}),Object.defineProperty(i.prototype,"_validateParams",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return e.validate("tracks",r,(function(){return e.isArray(r)&&r.every((function(e){return e instanceof tt||e.track instanceof tt}))}),!0)?{code:exports.RCRTCCode.SUCCESS}:(t.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"tracks is invalid"}),this.traceId),{code:exports.RCRTCCode.PARAMS_ERROR})}}),Object.defineProperty(i.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){(null==r?void 0:r.length)&&e.reportPubOrSubQualityData(this.fromCommand,this._actionStartTime,r,t,this._trackMediaMap)}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,s,u,l,d,_,p,f,h,b,R,g,m,C,v,O,T,E,I,S,y,L,P=this;return c(this,(function(c){switch(c.label){case 0:if(i=e.logger,s=e.peer,u=e.reportMediaActionLogger,l=e.context,this._actionStartTime=Date.now(),_=(d=this).tracks,p=d.forceReq,f=t.roomId,i.info(n.L_UPDATE_SUBSCRIBELIST_COMMAND_T,"roomId: ".concat(f,", forceReq: ").concat(p,", trackIds: ").concat(_.map(Lt)),this.traceId),(h=this._validateParams(i,_).code)!==exports.RCRTCCode.SUCCESS)return[2,{code:h}];if(b=this._getParams(t,i,_),R=t.getSubscribedList().map((function(e){return a({},e)})),!p){if(!sa(b,R))return i.warn(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.SUCCESSED,msg:"subscribe list unchanged"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}];R.length&&(g=R.map((function(e){return e.track})),i.warn(n.L_CLEAR_UNSUBSCRIBE_LIST_O,JSON.stringify({list:g.map((function(e){return e.getTrackId()}))}),this.traceId),m=t.getSubscribedList().filter((function(e){return g.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),t.resetSubscribedList(m))}return s.__reportR3R4ToPolaris(),s.clearReTryExchangeTimer(),s.updateSubRemoteTracks(b.map((function(e){return e.track}))),[4,Xo(b,!1,s,t,l)];case 1:return(C=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new zo(C,this.traceId,!0).execute(e,t,r)];case 2:return v=c.sent(),_.forEach((function(e){var t=e instanceof tt?e.getTrackId():e.track.getTrackId();P._trackMediaMap[t]=v.data.qualityMsList||[]})),O=this.fromCommand===Yo.SUB?_:this.unsubTracks,v.code!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(u,v.code,O),i.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:v.code}),this.traceId),[2,{code:v.code}]):(T=v.data.data,E=T.sdp,I=T.resultCode,S=T.subscribedList,I!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(u,I,O),i.error(n.L_UPDATE_SUBSCRIBELIST_COMMAND_R,JSON.stringify({status:o.FAILED,code:I}),this.traceId),[2,{code:I}]):(u.setPubOrSubSuccessTime(Date.now()),[4,s.setRemoteAnswer(E.sdp)]));case 3:return y=c.sent(),this._reportPubOrSubQualityData(u,y,O),y!==exports.RCRTCCode.SUCCESS?[2,{code:y}]:[2,(L=this._dealSubscribeResult(t,i,b,S)).length?{code:exports.RCRTCCode.SUCCESS,data:L}:{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(yo),Qo=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.UNSUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d;return c(this,(function(c){return s=t.logger,u=t.polarisReport,l=this.tracks,e.validate("tracks",l,(function(){return e.isArray(l)&&l.length>0&&l.every((function(e){return e instanceof tt}))}),!0)?(s.info(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_T,JSON.stringify({unSubscribeTrackIds:l.map(Lt)}),this.traceId),d=r.getSubscribedList().map((function(e){return a({},e)})).filter((function(e){return l.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),u.sendR2(ko.SUBSCRIBE,Uo.END,l.map((function(e){return e.getTrackId()}))),[2,new qo(d,!1,this.traceId,Yo.UNSUB,this.tracks).execute(t,r,i)]):(s.warn(n.L_ABSTRACT_ROOM_UNSUBSCRIBE_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),i}(yo),Zo=function(e){function t(t){var r=e.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:t}),r}return r(t,e),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a;return c(this,(function(s){switch(s.label){case 0:return i=e.logger,o=this.tracks,a=i.createTraceId(),i.info(n.L_USER_LEFT_UNSUBSCRIBE_O,void 0,a),[4,new Qo(o,a).execute(e,t,r)];case 1:return s.sent(),o.forEach((function(e){e.__innerDestroy(),t.removeRemoteTrack(e.getTrackId())})),e.emit(Fo,o),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(yo);function Xo(e,t,r,i,n){var o;return s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=(null===(o=n.getNaviInfo())||void 0===o?void 0:o.ipType)||0,[4,r.createOffer(t)];case 1:return s=c.sent(),[2,{ipType:a,sdp:s,extend:JSON.stringify({resolutionInfo:r.getOutboundVideoInfo()}),subscribeList:e.filter((function(e){var t=e.track.getTrackId(),r=dt(t).userId,n=i.getResourcesByUserId(r);if(!n)return!1;var o=n.filter((function(e){return t==="".concat(e.msid,"_").concat(e.mediaType)})).length;return o})).map((function(e){return{simulcast:e.subTiny?Gn.TINY:Gn.NORMAL,resolution:"",uri:i.getPublishedResourceByTrackId(e.track.getTrackId()).uri}})),switchstream:!1}]}}))}))}function $o(t,r,i){return s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=t.logger.createTraceId(),t.logger.info(n.L_LIVING_ROOM_SPREAD_CDN_INFO_T,JSON.stringify({CDNUris:i}),a),[4,t.setRTCCDNUris(r,Tt.TOTAL_CONTENT_RESOURCE,JSON.stringify([i]))];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(t.logger.error(n.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(o.FAILED,", code: ").concat(s),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(t.logger.info(n.L_LIVING_ROOM_SPREAD_CDN_INFO_R,"status: ".concat(o.SUCCESSED),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}function ea(t,r,i){return s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=t.logger.createTraceId(),t.logger.info(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_T,"CDNUris: ".concat(i),a),[4,t.setRTCData(r,"cdn_uris",JSON.stringify([i]),!0,wo.ROOM)];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(t.logger.error(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(o.FAILED,", code: ").concat(s),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(t.logger.info(n.L_LIVING_ROOM_SET_ROOM_CDN_INFO_R,"status: ".concat(o.SUCCESSED),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}function ta(e,t){return s(this,void 0,void 0,(function(){var r,i,n;return c(this,(function(o){switch(o.label){case 0:return r=t.roomId,i=Object.assign({},t.getCDNUris(),{enableInnerCDN:t.getCDNEnable()}),[4,Promise.all([$o(e,r,i),ea(e,r,i)])];case 1:return n=o.sent(),[2,n.every((function(e){return e.code===exports.RCRTCCode.SUCCESS}))?{code:exports.RCRTCCode.SUCCESS}:{code:exports.RCRTCCode.SIGNAL_ERROR}]}}))}))}var ra=function(e,t,r,i){return s(void 0,void 0,void 0,(function(){var n,o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:for(a in n=e.crtUserId,o=[],i)o.push(a);s=0,c.label=1;case 1:return s<o.length?(u=o[s])===n?[3,3]:(l=i[u]).length?(d=l.map((function(t){return e.getRemoteTrack(lt(t))})),[4,new Zo(d).execute(t,e,r)]):[3,3]:[3,4];case 2:c.sent(),c.label=3;case 3:return s++,[3,1];case 4:return[2]}}))}))};function ia(t,r,i,a,u,l){return s(this,void 0,void 0,(function(){var s,d,_,p,f,h,b,R,g,m,C,v,O,T,E,I,S,y,L;return c(this,(function(c){switch(c.label){case 0:for(s=i.logger,d=r.roomId,_=r.roomMode,p=[],f={},h={},b={},R=yt(t,d,s,l),g=Object.keys(R),m=r.getAllUserIds(),C=g.length-1;C>=0;C-=1)v=g[C],-1!==(O=m.indexOf(v))?(T=r.getResourcesByUserId(v),E=R[v],I=ft(T,E,!0),S=I.publishedList,y=I.modifiedList,L=I.unpublishedList,f[v]=pt(S),h[v]=pt(L),b[v]=pt(y),m.splice(O,1)):(p.push(v),f[v]=pt(R[v]));return m.length&&m.forEach((function(e){r.removeResourcesByUserId(e)})),r.assignRoomData(R),m.length?[4,na(m,i,r,a,l)]:[3,2];case 1:c.sent(),i.emit(Bo,m),c.label=2;case 2:return p.length&&i.emit(jo,p),[4,ra(r,i,a,h)];case 3:return c.sent(),function(e,t,r){var i=t.logger;Object.keys(r).forEach((function(n){var o=r[n];if(0!==o.length){var a=o.map((function(t){var r=lt(t),n=dt(r),o=n.userId,a=n.tag,s=n.mediaType===exports.RCMediaType.AUDIO_ONLY?new rt(i,a,o):new it(i,a,o);return e.addRemoteTrack(s),s.__innerSetRemoteMuted(0===t.state),s}));a.length&&t.emit(Vo,a)}}))}(r,i,f),function(e,t,r){Object.keys(r).forEach((function(i){r[i].forEach((function(r){var i=lt(r),n=e.getRemoteTrack(i);n.__innerSetRemoteMuted(0===r.state),n.isAudioTrack()?t.emit(Jo,n):t.emit(Go,n)}))}))}(r,i,b),_===e.RTCMode.LIVE&&function(e,t,r,i){var a;if(!i)return void r.warn(n.L_LIVING_ROOM_RECONNECTED_R,JSON.stringify({status:o.FAILED,code:"",msg:"cdn_uris not found"}));var s=JSON.parse(i),c=(null===(a=t.getCDNUris())||void 0===a?void 0:a.enableInnerCDN)!==s.enableInnerCDN;t.setCDNUris(s),c&&e.emit(Ho,s.enableInnerCDN)}(i,r,s,u),[2]}}))}))}function na(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o,a;return c(this,(function(s){switch(s.label){case 0:return o=[],a=[],e.forEach((function(e){o.push.apply(o,d([],l(r.getRemoteTracksByUserId(e)),!1)),a.push(e)})),o.length?[4,new Qo(o,n).execute(t,r,i)]:[3,2];case 1:s.sent(),o.forEach((function(e){return r.removeRemoteTrack(e.getTrackId())})),s.label=2;case 2:return a.length&&a.forEach((function(e){return r.removeResourcesByUserId(e)})),[2]}}))}))}var oa,aa=function(e,t,r){var i=e.split("\r\nm"),n=r===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=i.filter((function(e){return e.includes("=".concat(n))&&e.includes(t)}))[0],a=new RegExp("a=ssrc:(.*?) msid:".concat(t)),s=o.match(a);return s?s[1]:""},sa=function(e,t){var r=!1;return e.forEach((function(e){var i=t.findIndex((function(t){return t.track.getTrackId()===e.track.getTrackId()}));-1!==i?t.splice(i,1)[0].subTiny!==e.subTiny&&(r=!0):r=!0})),t.length&&(r=!0),r},ca=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ho.PARSE_USERSTATE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return bo.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isPKRoomUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i;try{for(var n=u(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(a.extra&&a.extra.roomId!==e.roomId)return!0;if(1===Number(a.state)&&!e.getRemoteUserIds().includes(a.userId))return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return!1}}),Object.defineProperty(t.prototype,"_dealAddUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o){var a=e.getResourcesByUserId(o);a||(i?r.upgrade.push(o):r.joined.push(o),t.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:o,msg:"user ".concat(i?"upgrade":"joined")}),this.traceId)),e.setResourcesByUserId(o,a||[])}}),Object.defineProperty(t.prototype,"_dealReduceUser",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o){e.info(n.L_PARSE_USERSTATE_COMMAND_R,JSON.stringify({userId:o,msg:"user ".concat(i?"downgrade":"left")}),this.traceId),i?t.downgrade.push(o):1!==Number(r)?t.offline.push(o):t.left.push(o)}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s=this;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,n={joined:[],left:[],offline:[],upgrade:[],downgrade:[]},0===(o=this.msgContent.users).length?[2,{code:exports.RCRTCCode.SUCCESS,data:n}]:this._isPKRoomUser(t,o)?[2,{code:exports.RCRTCCode.SUCCESS,data:n}]:(o.forEach((function(e){var r=e.userId;0===Number(e.state)?s._dealAddUser(t,i,n,e.switchRoleType,r):s._dealReduceUser(i,n,e.state,e.switchRoleType,r)})),(a=d(d(d([],l(n.left),!1),l(n.downgrade),!1),l(n.offline),!1)).length?[4,na(a,e,t,r,this.traceId)]:[3,2]);case 1:c.sent(),c.label=2;case 2:return[2,{code:exports.RCRTCCode.SUCCESS,data:n}]}}))}))}}),t}(yo),ua=function(e){function t(t,r,i,n,o){var a=e.call(this)||this;return Object.defineProperty(a,"msgContent",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(a,"messageType",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(a,"senderId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(a,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(a,"sentTime",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(a,"_publishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_unpublishedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_modifiedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(a,"_nowResources",{enumerable:!0,configurable:!0,writable:!0,value:[]}),a}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ho.PARSE_REMOTERES},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"priority",{get:function(){return bo.NORMAL},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_dealPublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p=this;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,a=e.reportMediaActionLogger,s=this._nowResources.map(lt),u=[],l=[],this._publishedList.forEach((function(e){var r=lt(e),n=s.indexOf(r),o=dt(r),a=o.userId,c=o.tag,d=o.mediaType;n>-1?p._nowResources[n]=e:p._nowResources.push(e);var _=t.getRemoteTrack(r);_?_.isSubscribed()&&u.push(_):(_=d===exports.RCMediaType.AUDIO_ONLY?new rt(i,c,a):new it(i,c,a),t.addRemoteTrack(_),l.push(_)),_.__innerSetRemoteMuted(0===e.state)})),u.length?(d=u.map((function(e){return e.getTrackId()})),[4,new qo(u,!0,this.traceId).execute(e,t,r)]):[3,2];case 1:(_=c.sent().code)!==exports.RCRTCCode.SUCCESS&&i.error(n.L_RESUB_REPUB_RES_R,JSON.stringify({status:o.FAILED,trackIds:d,code:_}),this.traceId),c.label=2;case 2:return l.length&&e.emit(Vo,l),a.reportQualityRecvPubMsgData(this.sentTime,this.senderId),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublishList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a;return c(this,(function(s){switch(s.label){case 0:for(i=this._unpublishedList.map(lt),n=this._nowResources.length-1;n>=0;n-=1)o=this._nowResources[n],i.includes(lt(o))&&this._nowResources.splice(n,1);return a=this._unpublishedList.map((function(e){var r=lt(e);return t.getRemoteTrack(r)})),[4,new Zo(a).execute(e,t,r)];case 1:return s.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModifiedList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s,l,d,_;return c(this,(function(c){r=this._nowResources.map(lt);try{for(i=u(this._modifiedList),n=i.next();!n.done;n=i.next())o=n.value,a=lt(o),s=r.indexOf(a),this._nowResources[s].state=o.state,(l=t.getRemoteTrack(a)).__innerSetRemoteMuted(0===o.state),l.isAudioTrack()?e.emit(Jo,l):e.emit(Go,l)}catch(e){d={error:e}}finally{try{n&&!n.done&&(_=i.return)&&_.call(i)}finally{if(d)throw d.error}}return[2]}))}))}}),Object.defineProperty(t.prototype,"_updateCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,n=this.msgContent.cdn_uris[0],o=(null===(r=t.getCDNUris())||void 0===r?void 0:r.enableInnerCDN)!==n.enableInnerCDN;t.setCDNUris(n),o&&e.emit(Ho,!!(null===(i=t.getCDNUris())||void 0===i?void 0:i.enableInnerCDN))}}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s,u,_,p,f,h;return c(this,(function(c){switch(c.label){case 0:if(i=this.msgContent.uris,this._publishedList=[],this._unpublishedList=[],this._modifiedList=[],o=this.senderId,a=this.messageType,!t.getRemoteUserIds().includes(o))return[2,{code:exports.RCRTCCode.SUCCESS}];switch(this._nowResources=t.getResourcesByUserId(o)||[],a){case Tt.MODIFY:(s=this._modifiedList).push.apply(s,d([],l(i),!1));break;case Tt.PUBLISH:(u=this._publishedList).push.apply(u,d([],l(i),!1));break;case Tt.UNPUBLISH:(_=this._unpublishedList).push.apply(_,d([],l(i),!1));break;case Tt.TOTAL_CONTENT_RESOURCE:n=ft(this._nowResources,i),(p=this._publishedList).push.apply(p,d([],l(n.publishedList),!1)),(f=this._unpublishedList).push.apply(f,d([],l(n.unpublishedList),!1)),(h=this._modifiedList).push.apply(h,d([],l(n.modifiedList),!1))}return this._publishedList.length?[4,this._dealPublishList(e,t,r)]:[3,2];case 1:c.sent(),c.label=2;case 2:return this._unpublishedList.length?[4,this._dealUnpublishList(e,t,r)]:[3,4];case 3:c.sent(),c.label=4;case 4:return this._modifiedList.length?[4,this._dealModifiedList(e,t)]:[3,6];case 5:c.sent(),c.label=6;case 6:return t.setResourcesByUserId(o,this._nowResources),t.roomMode!==exports.RTCMode.LIVE?[2,{code:exports.RCRTCCode.SUCCESS}]:this.msgContent.cdn_uris?(this._updateCDNUris(e,t),[2,{code:exports.RCRTCCode.SUCCESS}]):[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(yo),la=function(t){function i(e,r,i){var n=t.call(this)||this;return Object.defineProperty(n,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(n,"forceReq",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.SUBSCRIBE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,b;return c(this,(function(c){return s=t.logger,u=t.polarisReport,d=(l=this).tracks,_=l.forceReq,e.validate("tracks",d,(function(){return e.isArray(d)&&d.length>0&&d.every((function(e){return e instanceof tt||e.track instanceof tt}))}),!0)?(s.info(n.L_ABSTRACT_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:d.map(Lt),forceReq:_}),this.traceId),p=r.getSubscribedList().map((function(e){return a({},e)})),f=d.map((function(e){return e instanceof tt?{track:e}:e})),h=!1,b=[],f.forEach((function(e){var t=e.track.getTrackId();b.push(t);var r=p.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:p.push(e),h=!0)})),h||_?(u.sendR2(ko.SUBSCRIBE,Uo.BEGIN,b),[2,new qo(p,!0,this.traceId).execute(t,r,i)]):(s.warn(n.L_ABSTRACT_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,msg:"repeat subscribe"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}])):(s.error(n.L_ABSTRACT_ROOM_SUBSCRIBE_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this.traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),i}(yo),da=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.PUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"_removePubFailedTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){e.forEach((function(e){var r=e instanceof Ke?e:e.track;t.removeLocalTrackById(r.getTrackId())}))}}),Object.defineProperty(i.prototype,"_addLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o,a,s,l,d,_,p,f,h,b,R,g,m,C,v,O,T;return c(this,(function(c){switch(c.label){case 0:r=[],c.label=1;case 1:c.trys.push([1,10,11,12]),i=u(e),o=i.next(),c.label=2;case 2:if(o.done)return[3,9];if(a=o.value,l=(s=a instanceof Ke?{pubTiny:!1,track:a}:a).track,d=s.pubTiny,!l.isVideoTrack())return[3,7];if(!d)return[3,7];_=void 0,c.label=3;case 3:return c.trys.push([3,5,,6]),_=l.__innerGetMediaStreamTrack().clone(),p=d.frameRate||exports.RCFrameRate.FPS_15,f=d.resolution||exports.RCResolution.W176_H144,h=bt(f),b=h.width,R=h.height,g=mt(p),[4,_.applyConstraints({width:b,height:R,frameRate:g})];case 4:return c.sent(),[3,6];case 5:return m=c.sent(),null==_||_.stop(),this._logger.warn(n.L_ABSTRACT_ROOM_PUBLISH_E,"pubTiny failed -> id: ".concat(l.getTrackId(),", msg: ").concat(m.message),this._traceId),[3,9];case 6:return C=new Ye(this._logger,l.getTag(),l.getUserId(),_,!0),r.push(C),t.addLocalTrack(C),[3,7];case 7:t.addLocalTrack(l),c.label=8;case 8:return o=i.next(),[3,2];case 9:return[3,12];case 10:return v=c.sent(),O={error:v},[3,12];case 11:try{o&&!o.done&&(T=i.return)&&T.call(i)}finally{if(O)throw O.error}return[7];case 12:return[2,r]}}))}))}}),Object.defineProperty(i.prototype,"__publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,b,R,g,m,C=this;return c(this,(function(c){switch(c.label){case 0:return s=e.peer,u=e.reportMediaActionLogger,l=e.context,t.roomId,d=[],r.forEach((function(e){var t=(e instanceof Ke?{track:e}:e).track;d.push(t)})),r.sort((function(e,t){return(e instanceof Ke?{track:e}:e).track.getBitrate().max-(t instanceof Ke?{track:t}:t).track.getBitrate().max})),s.getLocalTracks().length+function(e,t){var r=0;return e.forEach((function(e){var i=e instanceof Ke?e.getTrackId():e.track.getTrackId();t.getLocalTrack(i)||(e instanceof Ke?r++:e.pubTiny&&e.track.isVideoTrack()&&(r+=2))})),r}(r,s)>10?(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,trackIds:r.map(Lt),msg:"publish track limit exceeded"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACK_LIMIT_EXCEEDED,tracks:d}]):[4,this._addLocalTracks(r,s)];case 1:return _=c.sent(),s.clearReTryExchangeTimer(),[4,Xo(t.getSubscribedList(),!1,s,t,l)];case 2:return(p=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new zo(p,this._traceId,!0).execute(e,t,i)];case 3:return f=c.sent(),d.forEach((function(e){var t=e.getTrackId();C._trackMediaMap[t]=f.data.qualityMsList||[]})),f.code!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(Yo.PUB,this._actionStartTime,d,f.code,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,tracks:r.map(Lt),code:f.code,msg:"exchange failed"}),this._traceId),this._removePubFailedTracks(r,s),[2,{code:f.code,tracks:d}]):(h=f.data.data,b=h.sdp,R=h.resultCode,g=h.message,R!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(Yo.PUB,this._actionStartTime,d,R,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,trackIds:r.map(Lt),code:R,msg:"exchange inner failed: ".concat(g)}),this._traceId),this._removePubFailedTracks(r,s),[2,{code:R,tracks:d}]):(u.setPubOrSubSuccessTime(Date.now()),[4,s.setRemoteAnswer(b.sdp,!0)]));case 4:return(m=c.sent())!==exports.RCRTCCode.SUCCESS?(u.reportPubOrSubQualityData(Yo.PUB,this._actionStartTime,d,m,this._trackMediaMap),this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,trackIds:r.map(Lt),code:m,msg:"set remote answer error"}),this._traceId),[2,{code:m,tracks:d}]):(_.length&&this._updateTinyTrackIdSSRCMap(t,p.sdp.sdp,_),[2,a(a({code:R},f.data),{tracks:d})])}}))}))}}),Object.defineProperty(i.prototype,"_updateTinyTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){r.forEach((function(r){var i=aa(t,r.getStreamId(),exports.RCMediaType.VIDEO_ONLY);e.setTrackIdSSRCMap(Number(i),r.getTrackId())}))}}),Object.defineProperty(i.prototype,"_dealPublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,_,p,f,h,b,R,g,m,C,v,O,T,E,I,S,y,L,P,N,A,w;return c(this,(function(c){switch(c.label){case 0:return s=i.polarisReport,u=i.context,_=i.peer,p=i.reportMediaActionLogger,f=r.crtUserId,h=r.roomId,b="",R=r.getResourcesByUserId(f),g=d([],l(R),!1),[],C=t.tracks,t.code!==exports.RCRTCCode.SUCCESS?[2,{code:t.code}]:(v=t.data,O=v.publishList,T=v.urls,E=v.mcuPublishList,b=null==T?void 0:T.liveUrl,O.map((function(e){return a({tag:e.msid.split("_").pop(),state:_.getLocalTrack(lt(e)).isLocalMuted()?0:1},e)})).forEach((function(e){var t=function(e,t){for(var r=!1,i=0,n=0;n<t.length;n++){var o=t[n];if("".concat(e.msid,"_").concat(e.mediaType)==="".concat(o.msid,"_").concat(o.mediaType)){r=!0,i=n;break}}return{isInclude:r,index:i}}(e,g),r=t.isInclude,i=t.index;r?g.splice(i,1,e):g.push(e)})),I=(null==E?void 0:E.map((function(e){return a({tag:e.msid.split("_").pop(),state:1},e)})))||[],m=I,S=ft(R,g).publishedList,y=a(a({},r.getCDNUris()),{enableInnerCDN:r.getCDNEnable()}),L=y&&y.broadcast===Mo.SPREAD?JSON.stringify([y]):"",P=Date.now(),[4,u.setRTCTotalRes(h,[nt(Tt.PUBLISH,S)],ot(g),Tt.TOTAL_CONTENT_RESOURCE,ot(m),L)]);case 1:return N=c.sent(),p.reportPubOrSubQualityData(Yo.PUB,this._actionStartTime,C,N,this._trackMediaMap,[{dur:Date.now()-P,cod:N}]),N!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:N,msg:"send publish streams notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(r.setResourcesByUserId(f,g),A=S.map((function(e){return lt(e)})),s.sendR2(ko.PUBLISH,Uo.BEGIN,A),S.forEach((function(e){_.getLocalTrack("".concat(e.msid,"_").concat(e.mediaType)).__innerSetPublished(!0)})),w={code:exports.RCRTCCode.SUCCESS},b&&(w.liveUrl=b),[2,w])}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=t.peer,this._traceId=a.createTraceId(),this._logger=a,this._actionStartTime=Date.now(),u=this.tracks,e.validate("tracks",u,(function(){return e.isArray(u)&&u.length>0&&u.every((function(e){return e instanceof Ke||e.track instanceof Ke}))}),!0)?(this._logger.info(n.L_ABSTRACT_ROOM_PUBLISH_T,JSON.stringify({trackIds:u.map(Lt)})),(u=u.filter((function(e){var t=(e instanceof Ke?{track:e}:e).track,r=t.isDestroyed();return r&&d._logger.warn(n.L_ABSTRACT_ROOM_PUBLISH_E,"track '".concat(t.getTrackId(),"' has beem destroyed"),d._traceId),!r}))).length?(s.__reportR3R4ToPolaris(),s.clearReTryExchangeTimer(),[4,this.__publish(t,r,u,i)]):(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID,msg:"params tracks is empty"}),this._traceId),[2,{code:exports.RCRTCCode.PUBLISH_TRACKS_IS_INVALID}])):(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),this._traceId),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=c.sent(),[4,this._dealPublishRes(l,r,t)];case 2:return[2,c.sent()]}}))}))}}),i}(yo),_a=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"tracks",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(r,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"_actionStartTime",{enumerable:!0,configurable:!0,writable:!0,value:Date.now()}),Object.defineProperty(r,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.UNPUBLISH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"__unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,b,R,g,m,C=this;return c(this,(function(c){switch(c.label){case 0:return s=e.peer,u=e.polarisReport,l=e.logger,d=e.reportMediaActionLogger,_=e.context,p=i.map((function(e){return e.getTrackId()})),0===p.map(t.getPublishedResourceByTrackId.bind(t)).filter((function(e){return!!e})).length?[2,{code:exports.RCRTCCode.SUCCESS,tracks:i}]:(p.forEach((function(e){return s.removeLocalTrackById(e)})),u.sendR2(ko.PUBLISH,Uo.END,p),s.clearReTryExchangeTimer(),[4,Xo(t.getSubscribedList(),!1,s,t,_)]);case 1:return f=c.sent(),(h=e.getPushOtherRooms()).length&&(f.pushOtherRooms=h),[4,new zo(f,this._traceId,!0).execute(e,t,r)];case 2:return b=c.sent(),i.forEach((function(e){var t=e.getTrackId();C._trackMediaMap[t]=b.data.qualityMsList||[]})),b.code!==exports.RCRTCCode.SUCCESS?(d.reportPubOrSubQualityData(Yo.UNPUB,this._actionStartTime,i,b.code,this._trackMediaMap),l.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:o.FAILED,code:b.code,trackIds:i.map(Lt),msg:"exchange failed"}),this._traceId),[2,{code:b.code,tracks:i}]):(R=b.data.data,g=R.resultCode,m=R.message,g!==exports.RCRTCCode.SUCCESS?(d.reportPubOrSubQualityData(Yo.UNPUB,this._actionStartTime,i,b.data.data.resultCode,this._trackMediaMap),l.error(n.L_ABSTRACT_ROOM_UNPUBLISH_P,JSON.stringify({status:o.FAILED,code:g,trackIds:i.map(Lt),msg:"exchange inner failed: ".concat(m)}),this._traceId),[2,{code:g,tracks:i}]):[2,a(a({code:b.code},b.data),{tracks:i})])}}))}))}}),Object.defineProperty(i.prototype,"_dealUnpublishRes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var s,u,_,p,f,h,b,R,g,m,C,v,O,T,E,I,S,y,L,P;return c(this,(function(c){switch(c.label){case 0:return s=t.context,u=t.logger,_=t.peer,p=t.reportMediaActionLogger,f=s.getCurrentId(),h=r.roomId,b=[],[],g=i.tracks,m=i.code,C=i.data,m!==exports.RCRTCCode.SUCCESS?(u.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({code:m,msg:"unpublish failed"}),this._traceId),[2,{code:m}]):C?(v=C.mcuPublishList,O=g.map((function(e){return e.getTrackId()})),T=O.map(r.getPublishedResourceByTrackId.bind(r)).filter((function(e){return!!e})),b.push.apply(b,d([],l(T),!1)),E=v?v.map((function(e){return a({tag:e.msid.split("_").pop(),state:1},e)})):[],R=E,I=r.getResourcesByUserId(f),S=I.filter((function(e){return!b.includes(e)})),y=Date.now(),[4,s.setRTCTotalRes(h,[nt(Tt.UNPUBLISH,b)],ot(S),Tt.TOTAL_CONTENT_RESOURCE,ot(R))]):(u.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.SUCCESSED,msg:"unpublish list is empty "})),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return L=c.sent(),p.reportPubOrSubQualityData(Yo.UNPUB,this._actionStartTime,g,L,this._trackMediaMap,[{dur:Date.now()-y,cod:L}]),L!==e.ErrorCode.SUCCESS?(u.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.FAILED,code:L,msg:"send unpublish notification failed"}),this._traceId),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(u.info(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.SUCCESSED,code:exports.RCRTCCode.SUCCESS,msg:"unpublish success",unPubResourceIds:O}),this._traceId),P=i.data.sdp,[4,_.setRemoteAnswer(P.sdp)]);case 2:return c.sent(),r.setResourcesByUserId(f,S),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,this._actionStartTime=Date.now(),s=r.crtUserId,u=this.tracks,this._traceId=a.createTraceId(),e.validate("tracks",u,(function(){return u.every((function(e){return e.getUserId()===s&&e instanceof Ke}))}),!0)?(a.info(n.L_ABSTRACT_ROOM_UNPUBLISH_T,JSON.stringify({trackIds:u.map(Lt)})),[4,this.__unpublish(t,r,i,u)]):(a.error(n.L_ABSTRACT_ROOM_UNPUBLISH_E,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return l=c.sent(),[4,this._dealUnpublishRes(t,r,l)];case 2:return[2,c.sent()]}}))}))}}),i}(yo),pa=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"localTrack",{enumerable:!0,configurable:!0,writable:!0,value:e}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.LOCAL_TRACK_MUTE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,a,s,l,d,_,p,f,h,b,R,g,m,C,v,O,T,E;return c(this,(function(c){switch(c.label){case 0:i=t.logger,a=t.context,s=this.localTrack,l=s.getTrackId(),d=r.crtUserId,_=r.roomId,p=!s.isLocalMuted(),f=i.createTraceId(),i.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_T,JSON.stringify({enabled:p,trackId:this.localTrack.getTrackId()}),f),h=[{resourceId:l,enabled:p}],b=r.getResourcesByUserId(d),R=[],g=function(e){var t=lt(e),r=h.findIndex((function(e){return e.resourceId===t}));if(r>=0){var i=h[r].enabled;return e.state=i?1:0,R.push(e),"break"}};try{for(m=u(b),C=m.next();!C.done&&(v=C.value,"break"!==g(v));C=m.next());}catch(e){T={error:e}}finally{try{C&&!C.done&&(E=m.return)&&E.call(m)}finally{if(T)throw T.error}}return[4,a.setRTCTotalRes(_,[nt(Tt.MODIFY,R)],ot(b),Tt.TOTAL_CONTENT_RESOURCE)];case 1:return(O=c.sent())!==e.ErrorCode.SUCCESS?(i.error(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:o.FAILED,code:O,msg:"signal error"}),f),[2,{code:O}]):(i.info(n.L_LOCAL_TRACK_SET_LOCAL_MUTED_SPREAD_R,JSON.stringify({status:o.SUCCESSED}),f),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),i}(yo),fa=function(t){function i(){return null!==t&&t.apply(this,arguments)||this}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.RETRY_EXCHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priority",{get:function(){return bo.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,o,a,s,u,l,d,_,p,f,h,b,R,g,m;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,o=e.peer,a=e.context,s=i.createTraceId(),i.info(n.L_RETRY_EXCHANGE_COMMAND_T),u=a.getCurrentId(),[4,Xo(t.getSubscribedList(),!0,o,t,a)];case 1:return(l=c.sent()).pushOtherRooms=e.getPushOtherRooms(),[4,new zo(l,s).execute(e,t,r)];case 2:return(d=c.sent()).code!==exports.RCRTCCode.SUCCESS?[2,{code:d.code}]:(_=d.data.data,p=_.sdp,(f=_.resultCode)!==exports.RCRTCCode.SUCCESS?[2,{code:f}]:(o.clearReTryExchangeTimer(),[4,o.setRemoteAnswer(p.sdp)]));case 3:return(h=c.sent())!==exports.RCRTCCode.SUCCESS?[2,{code:h}]:(b=d.data.data.publishList||[],R=this._diffPublishListChange(b,t,o,u),g=R.plus,m=R.minus,g.length||m.length?[4,this._spreadPublishListUri(e,u,g,m,s)]:[3,5]);case 4:c.sent(),c.label=5;case 5:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"_diffPublishListChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){var n=t.getResourcesByUserId(i),o=JSON.parse(JSON.stringify(n));e.forEach((function(e){var t,i=e.mediaType,n=e.msid,s=o.findIndex((function(e){var t=e.mediaType,r=e.msid;return i===t&&n===r}));if(-1===s){var c=a({tag:n.split("_").pop(),state:(null===(t=r.getLocalTrack(lt(e)))||void 0===t?void 0:t.isLocalMuted)?0:1},e);o.push(c)}else o[s].uri=e.uri}));var s=ft(n,o,!0),c=s.publishedList,u=s.unpublishedList;return t.setResourcesByUserId(i,o),{plus:c,minus:u}}}),Object.defineProperty(i.prototype,"_spreadPublishListUri",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,u){return s(this,void 0,void 0,(function(){var s,l,d,_;return c(this,(function(c){switch(c.label){case 0:return s=t.store,l=t.logger,d=s.getResourcesByUserId(r),l.info(n.L_RETRY_EXCHANGE_SPREAD_T,JSON.stringify({plus:i,minus:a,allPublishList:d}),u),_=[],a.length&&_.push(nt(Tt.UNPUBLISH,a)),i.length&&_.push(nt(Tt.PUBLISH,i)),[4,t.context.setRTCTotalRes(s.roomId,_,ot(d),Tt.TOTAL_CONTENT_RESOURCE)];case 1:return c.sent()===e.ErrorCode.SUCCESS?l.info(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(o.SUCCESSED),u):l.error(n.L_RETRY_EXCHANGE_SPREAD_R,"status: ".concat(o.FAILED),u),[2]}}))}))}}),i}(yo);!function(e){e[e.JOIN=0]="JOIN",e[e.LEAVE=1]="LEAVE",e[e.OFFLINE=2]="OFFLINE",e[e.RESOURCECHANGE=3]="RESOURCECHANGE"}(oa||(oa={}));var ha,ba,Ra=function(t){function i(e,r,i,n){var o=t.call(this)||this;return Object.defineProperty(o,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(o,"_traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(o,"_context",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(o,"_targetPullVersion",{enumerable:!0,configurable:!0,writable:!0,value:n}),o}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.PULL_RTCROOM_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,l,d,_,p,f,h,b,R,g,m,C,v,O,T,E,I,S,y,L,P,N;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=r.getRoomStatusVersion(),a.info(n.L_PULL_ROOM_STATUS_T,JSON.stringify({roomId:this._roomId,localVersion:s}),this._traceId),this._targetPullVersion&&this._targetPullVersion<=s?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:o.SUCCESSED,msg:"the roomData has been pulled",localVersion:s,targetPullVersion:this._targetPullVersion}),this._traceId),[2,{code:e.ErrorCode.SUCCESS}]):[4,this._context.pullRTCRoomStatus(this._roomId,s)];case 1:return l=c.sent(),d=l.code,_=l.data,d!==e.ErrorCode.SUCCESS?(a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({status:o.FAILED,code:d}),this._traceId),[2,{code:d}]):(f=(p=_).bFullStatus,h=p.version,b=p.usersData,R=p.roomStatus,a.info(n.L_PULL_ROOM_STATUS_R,JSON.stringify({bFullStatus:f,version:Pt(h),usersData:b,roomStatus:R}),this._traceId),r.setRoomStatusVersion(h),f?(g=function(e){var t={users:{}},r="";return e.forEach((function(e){var i,n,o=e.userId,a=e.userData;t.users[o]={};var s=null===(i=a.filter((function(e){return"uris"===e.key}))[0])||void 0===i?void 0:i.value,c=null===(n=a.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value;r=c||r,t.users[o]={uris:s}})),{urisData:t,CDNUris:r&&JSON.stringify(JSON.parse(r)[0])}}(b),m=g.urisData,C=g.CDNUris,[4,ia(m,r,t,i,C,this._traceId)]):[3,3]);case 2:return c.sent(),[2,{code:d}];case 3:c.trys.push([3,10,11,12]),v=u(R),O=v.next(),c.label=4;case 4:return O.done?[3,9]:(T=O.value).event!==oa.RESOURCECHANGE?[3,6]:(E=function(e){var t,r,i=e.userId,n=e.userData,o=function(e){return e.some((function(e){return"uris"===e.key||"cdn_uris"===e.key}))}(n);if(o){var a=null===(t=n.filter((function(e){return"uris"===e.key}))[0])||void 0===t?void 0:t.value,s=null===(r=n.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===r?void 0:r.value;return{userId:i,content:{uris:a?JSON.parse(a):[],cdn_uris:s&&JSON.parse(s)}}}}(T),E?(S=E.content,(I=E.userId)===r.crtUserId?[3,8]:[4,new ua(S,Tt.TOTAL_CONTENT_RESOURCE,I,this._traceId).execute(t,r,i)]):[3,8]);case 5:return c.sent(),[3,8];case 6:return S=function(e){var t,r=e.userId,i=e.userData,n=e.event,o=e.switchRoleType;return{users:[{userId:r,extra:null===(t=i.filter((function(e){return"extra"===e.key}))[0])||void 0===t?void 0:t.value,state:n,switchRoleType:o}]}}(T),[4,new ca(S,this._traceId).execute(t,r,i)];case 7:y=c.sent().data,t.emit(Ko,y),c.label=8;case 8:return O=v.next(),[3,4];case 9:return[3,12];case 10:return L=c.sent(),P={error:L},[3,12];case 11:try{O&&!O.done&&(N=v.return)&&N.call(v)}finally{if(P)throw P.error}return[7];case 12:return[2,{code:d}]}}))}))}}),i}(yo),ga=function(t){function i(e){var r=t.call(this)||this;return Object.defineProperty(r,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:e}),r}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.ON_SIGNAL_RECONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"priority",{get:function(){return bo.HIGH},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return o=t.logger,a=t.peer,s=t.context,u=r.roomId,l=r.roomMode,d=o.createTraceId(),o.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_T,void 0,d),"closed"===a.getRTCPeerConn().connectionState?(o.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,"RTCPeerConnection closed. Please rejoin room to restore services",d),t.emit(xo),[2,{code:exports.RCRTCCode.SUCCESS}]):[4,s.rtcPing(u,l)];case 1:return 40001!==c.sent().code?[3,5]:[4,this._joinRoom(t,r,i,d)];case 2:return c.sent()!==e.ErrorCode.SUCCESS?[3,4]:[4,this._restoreMediaServer(t,r,i)];case 3:c.sent(),c.label=4;case 4:return[3,7];case 5:return[4,new Ra(u,d,s).execute(t,r,i)];case 6:c.sent(),c.label=7;case 7:return[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"_joinRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){var u;return s(this,void 0,void 0,(function(){var s,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return s=t.context,l=t.logger,[4,s.joinRTCRoom(r.roomId,r.roomMode,this.livingType)];case 1:return d=c.sent(),_=d.code,p=d.data,_!==e.ErrorCode.SUCCESS?(l.error(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.FAILED,code:_,msg:"im reconnect joinRTCRoom failed"}),a),[2]):p?(f=null===(u=p.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===u?void 0:u.value,[4,ia(p,r,t,i,f,a)]):(l.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.FAILED,msg:"im reconnect joinRTCRoom, roomData is empty"}),a),[2]);case 2:return c.sent(),l.info(n.L_ABSTRACT_ROOM_IM_RECONNECTED_R,JSON.stringify({status:o.SUCCESSED,roomData:p}),a),[2,_]}}))}))}}),Object.defineProperty(i.prototype,"_restoreMediaServer",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n;return c(this,(function(o){switch(o.label){case 0:return i=e.peer.getLocalTracks(),n=Object.values(t.getRemoteTracks()).filter((function(e){return!!e.isSubscribed()})),i.length?[4,new da(i).execute(e,t,r)]:[3,2];case 1:o.sent(),o.label=2;case 2:return i.length||!n.length?[3,4]:[4,new la(n,!0).execute(e,t,r)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))}}),i}(yo),ma=1,Ca=5;!function(e){e[e.new=0]="new",e[e.checking=1]="checking",e[e.connected=2]="connected",e[e.completed=3]="completed",e[e.failed=4]="failed",e[e.disconnected=5]="disconnected",e[e.closed=6]="closed"}(ha||(ha={})),exports.RCKickReason=void 0,(ba=exports.RCKickReason||(exports.RCKickReason={}))[ba.SERVER_KICK=1]="SERVER_KICK",ba[ba.OTHER_KICK=2]="OTHER_KICK",ba[ba.IM_DISCONNECTED=3]="IM_DISCONNECTED",ba[ba.IM_LOGOUT=4]="IM_LOGOUT",ba[ba.OTHER_CLIENT_IM_CONNECTED=5]="OTHER_CLIENT_IM_CONNECTED";var va,Oa,Ta,Ea,Ia=function(){function e(e,t,r,i){var o=this;Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_userId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_baseReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_networkReportData",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pubOrSubSuccessTime",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_peerCStatus",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reportQualityJoinRoomData",{enumerable:!0,configurable:!0,writable:!0,value:function(e,t,r,i){o._baseReportData=Object.assign(o._baseReportData,{snid:i});var s=a(a(a({},o._baseReportData),o._networkReportData),{cod:t,time:e,dur:Date.now()-e,rtp:r});o._logger.__statistics(n.L_QS_JOIN_ROOM_S,JSON.stringify(s))}}),this._baseReportData={rid:this._roomId,csnid:this._clientSessionId,snid:"",time:Date.now(),uid:this._userId},this._networkReportData={cr:"unknown",net:"unknown"}}return Object.defineProperty(e.prototype,"reportQualityKickedData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=a(a(a({},this._baseReportData),this._networkReportData),{time:Date.now(),cod:e===exports.RCKickReason.OTHER_KICK?Ca:ma});this._logger.__statistics(n.L_QS_KICKED_S,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,o,s){var c=this;r.forEach((function(r){var u,l,d=r instanceof Ke||r instanceof tt?r:r.track,_=d.getTrackId(),p=dt(_).mediaType,f=!1;f=d instanceof Ke?!!d.isVideoTrack()&&(null===(l=(u=d).__isTiny)||void 0===l?void 0:l.call(u)):r.subTiny||!1;var h=a(a(a({},c._baseReportData),c._networkReportData),{resid:_,mtp:p,smct:f?Gn.TINY:Gn.NORMAL,stp:"Rongcloud"!==d.getTag()?1:0,cod:i,msas:o?o[_]:[],sigs:s,time:Date.now(),dur:Date.now()-t});switch(e){case"pub":c._logger.__statistics(n.L_QS_PUBLISH_S,JSON.stringify(h));break;case"unpub":c._logger.__statistics(n.L_QS_UNPUBLISH_S,JSON.stringify(h));break;case"sub":c._logger.__statistics(n.L_QS_SUBSCRIBE_S,JSON.stringify(h));break;case"unsub":c._logger.__statistics(n.L_QS_UNSUBSCRIBE_S,JSON.stringify(h))}}))}}),Object.defineProperty(e.prototype,"reportQualityRecvPubMsgData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=a(a(a({},this._baseReportData),this._networkReportData),{puid:t,time:Date.now(),dur:Date.now()-e});this._logger.__statistics(n.L_QS_RECV_PUB_MSG_S,JSON.stringify(r))}}),Object.defineProperty(e.prototype,"setPubOrSubSuccessTime",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pubOrSubSuccessTime=e}}),Object.defineProperty(e.prototype,"reportIceFirstConnectData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=a(a(a({},this._baseReportData),this._networkReportData),{time:this._pubOrSubSuccessTime,dur:Date.now()-this._pubOrSubSuccessTime}),r="pub"===e?n.L_QS_PUB_ICE_STATUS_S:n.L_QS_SUB_ICE_STATUS_S;this._logger.__statistics(r,JSON.stringify(t))}}),Object.defineProperty(e.prototype,"recordQualityIceStatusData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this._peerCStatus||{},o=i.status,s=i.time;if(s){var c=e.IP,u=e.port,l=e.networkType,d=e.remoteIP,_=e.remotePort,p=a(a(a({},this._baseReportData),this._networkReportData),{dur:r-s,time:r,pices:ha[o],ices:ha[t],rcdts:[{ip:"".concat(d,":").concat(_)}],lcdts:[{ip:"".concat(c,":").concat(u),nttp:l}],cncdts:[]});this._logger.__statistics(n.L_QS_ICE_STATUS_S,JSON.stringify(p)),this._peerCStatus={status:t,time:r}}else this._peerCStatus={status:t,time:r}}}),e}();!function(e){e[e.DISABLE=0]="DISABLE",e[e.ENABLE=1]="ENABLE"}(va||(va={})),function(e){e[e.MeetingOrAnchor=1]="MeetingOrAnchor",e[e.Audience=2]="Audience"}(Oa||(Oa={})),function(e){e[e.NOT_REPORT=-1]="NOT_REPORT",e[e.REPORT_SUCCESS=1e4]="REPORT_SUCCESS",e[e.REPORT_FAIL=0]="REPORT_FAIL",e[e.PB_ERROR=40001]="PB_ERROR"}(Ta||(Ta={})),function(e){e.R1="R1",e.R2="R2",e.R3="R3",e.R4="R4"}(Ea||(Ea={}));var Sa,ya,La,Pa,Na=function(){function t(e,t,r,i,n){void 0===n&&(n=Oa.MeetingOrAnchor),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_crtRTCRoom",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_userRole",{enumerable:!0,configurable:!0,writable:!0,value:n})}return Object.defineProperty(t.prototype,"_send",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?[2,Ta.NOT_REPORT]:[4,this._context.setRTCState(this._roomId,t)];case 1:return r.sent()===e.ErrorCode.SUCCESS?[2,Ta.REPORT_SUCCESS]:[2,Ta.REPORT_FAIL]}}))}))}}),Object.defineProperty(t.prototype,"_getClientID",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e="uuid",t=this._runtime.localStorage.getItem(e);return t||(t=ht(),this._runtime.localStorage.setItem(e,t)),t}}),Object.defineProperty(t.prototype,"_getRealResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e,r=e.indexOf("_tiny");return r>-1&&(t=e.slice(0,r)),t}}),Object.defineProperty(t.prototype,"_getPolarisTrackId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="",r=e.split("_");if(e.includes("_tiny")){var i=r.pop(),n=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,i,n].join("_")}else{n=parseInt(r.pop())===exports.RCMediaType.AUDIO_ONLY?"audio":"video",o=r.pop();t=[r.join("_"),o,n].join("_")}return t}}),Object.defineProperty(t.prototype,"_getBaseData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{bitrateSend:(null==e?void 0:e.bitrateSend)||Hn,bitrateRecv:(null==e?void 0:e.bitrateRecv)||Hn,networkType:(null==e?void 0:e.networkType)||"unknown",rtt:(null==e?void 0:e.rtt)||Hn,localAddress:"".concat((null==e?void 0:e.IP)||Hn,":").concat(null==e?void 0:e.port),remoteAddress:"".concat(null==e?void 0:e.remoteIP,":").concat(null==e?void 0:e.remotePort),receiveBand:(null==e?void 0:e.availableIncomingBitrate)||Hn,sendBand:(null==e?void 0:e.availableOutgoingBitrate)||Hn,packetsLost:(null==e?void 0:e.totalPacketsLost)||Hn,deviceId:this._context.getCurrentId()}}}),Object.defineProperty(t.prototype,"_getAudioLevel",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Hn}}),Object.defineProperty(t.prototype,"_getBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Hn}}),Object.defineProperty(t.prototype,"_getPacketsLostRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Hn}}),Object.defineProperty(t.prototype,"_getFrameRate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Hn}}),Object.defineProperty(t.prototype,"_getResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return e&&t?"".concat(e," * ").concat(t):"".concat(Hn)}}),Object.defineProperty(t.prototype,"_getJitter",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Hn}}),Object.defineProperty(t.prototype,"_getNackCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Hn}}),Object.defineProperty(t.prototype,"_getPliCount",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||0===e?e:Hn}}),Object.defineProperty(t.prototype,"_getRTT",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return e||Hn}}),Object.defineProperty(t.prototype,"_getTrackState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e?this._crtRTCRoom.getLocalTrack(t):this._crtRTCRoom.getRemoteTrack(t);return(null==r?void 0:r.isLocalMuted())?va.DISABLE:va.ENABLE}}),Object.defineProperty(t.prototype,"sendR3Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.senders,i=this._getBaseData(t),n="R3\t".concat(i.bitrateSend,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),o=r.map((function(e){var t=e.trackId,r=e.audioLevel,i=e.samplingRate,n=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsSent,b=e.encoderImplementation,R=a._getPolarisTrackId(t),g=a._getRealResourceId(t);return{trackId:R,googCodecName:b||String(Hn),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(n),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(d),nackCount:a._getNackCount(_),pliCount:a._getPliCount(p),rtt:a._getRTT(f),googFirsSent:h,samplingRate:i,googRenderDelayMs:l,encoderImplementation:b||String(Hn),trackState:a._getTrackState(!0,g)}})),n+=o.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsSent,"\t").concat(e.encoderImplementation,"\t").concat(e.trackState)})).join("\n"),[4,this._send("".concat(n,"\r").concat(this._userRole))];case 1:return s.sent()!==Ta.REPORT_SUCCESS?[2,Ta.REPORT_FAIL]:[2,Ta.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(t.prototype,"sendR4Data",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return t=e.iceCandidatePair,r=e.receivers,i=this._getBaseData(t),n="R4\t".concat(i.bitrateRecv,"\t-1\t-1\t-1\t").concat(i.networkType,"\t").concat(i.rtt,"\t").concat(i.localAddress,"\t").concat(i.receiveBand,"\t").concat(i.sendBand,"\t").concat(i.packetsLost,"\t").concat(i.deviceId,"\r"),o=r.filter((function(e){return!!e.trackId})).map((function(e){var t=e.trackId,r=e.audioLevel,i=e.samplingRate,n=e.bitrate,o=e.packetsLostRate,s=e.frameRate,c=e.frameWidth,u=e.frameHeight,l=e.googRenderDelayMs,d=e.jitter,_=e.nackCount,p=e.pliCount,f=e.rtt,h=e.googFirsReceived,b=e.codecImplementationName,R=a._getPolarisTrackId(t),g=a._getRealResourceId(t);return{trackId:R,googCodecName:b||String(Hn),audioLevel:a._getAudioLevel(r),bitrate:a._getBitrate(n),packetsLostRate:a._getPacketsLostRate(o),frameRate:a._getFrameRate(s),resolution:a._getResolution(c,u),jitter:a._getJitter(d),nackCount:a._getNackCount(_),pliCount:a._getPliCount(p),rtt:a._getRTT(f),googFirsReceived:h,samplingRate:i,googRenderDelayMs:l,codecImplementationName:b||String(Hn),trackState:a._getTrackState(!1,g)}})),n+=o.map((function(e){return"".concat(e.trackId,"\t").concat(e.googCodecName,"\t").concat(e.audioLevel,"\t").concat(e.samplingRate,"\t").concat(e.bitrate,"\t").concat(e.packetsLostRate,"\t").concat(e.frameRate,"\t").concat(e.resolution,"\t").concat(e.googRenderDelayMs,"\t").concat(e.jitter,"\t").concat(e.nackCount,"\t").concat(e.pliCount,"\t").concat(e.rtt,"\t").concat(e.googFirsReceived,"\t").concat(e.codecImplementationName,"\t").concat(e.trackState)})).join("\n"),[4,this._send("".concat(n,"\r").concat(this._userRole))];case 1:return s.sent()!==Ta.REPORT_SUCCESS?[2,Ta.REPORT_FAIL]:[2,Ta.REPORT_SUCCESS]}}))}))}}),Object.defineProperty(t.prototype,"sendR1",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=this._context.getCoreVersion(),r=(null===(e=navigator.userAgentData)||void 0===e?void 0:e.platformn)||navigator.platform,i=Ct.browser,n=Ct.version,o=this._getClientID(),a="R1\t".concat("5.16.0","\t").concat(t,"\t").concat("web","\t").concat(r,"\t").concat(-1,"\t").concat(i,"\t").concat(n,"\t").concat(o,"\t").concat(this._userRole);this._send(a)}}),Object.defineProperty(t.prototype,"sendR2",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i=this._getClientID(),n="R2\t".concat(e,"\t").concat(t,"\t").concat(i,"\r").concat(r.join("\t"),"\r").concat(this._userRole);this._send(n)}}),t}(),Aa="evt-leave",wa=function(t){function i(e,r,i,o,a,u,l,d,_,p){void 0===_&&(_=Kn()),void 0===p&&(p=!1);var f=t.call(this)||this;Object.defineProperty(f,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(f,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(f,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(f,"_service",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(f,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(f,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:_}),Object.defineProperty(f,"_pinger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_peerConnection",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(f,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(f,"_onRecvPKMsg",{enumerable:!0,configurable:!0,writable:!0,value:null});var h=f._logger=f._context.logger;f._reportMediaActionLogger=new Ia(h,f._roomId,f._clientSessionId,f._context.getCurrentId()),f._polarisReport=new Na(f._context,f._runtime,f._roomId,f);var b=f._context.getCurrentId(),R=new No(h,_,f._context.getAppkey(),i,b,o,l,d),g=f._peerConnection=new Eo(h,f._reTryExchange.bind(f),b,R,f._polarisReport,!1,p);f._setPeerConnectionListener();var m=f._executeCtx=new Wo(h,f._service,e,r,g,R,f._polarisReport,f._reportMediaActionLogger);return m.getPushOtherRooms=function(){return f._getPushOtherRoomsParams()},f.setCommandEventListener(),f._invoker=new Po(m,R),f._store=f._invoker.store,f._audioLevelReport=new Io(f._store,g),g.on(Eo.__INNER_AUDIOLEVEL_CHANGE__,f._audioLevelReport.audioLevelReport,f._audioLevelReport),f._pinger=new Nt(f._context,f._roomId,o,f._initOptions.pingGap),f._pinger.onFailed=f.__kickoff.bind(f),f._pinger.onPingResult=f._handlePingResult.bind(f),f._context.registerRTCSignalListener((function(e){return s(f,void 0,void 0,(function(){var t,r,i,o,a;return c(this,(function(s){return t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,o=t.roomId,this._invoker.isDestroyed()?(this._logger.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,JSON.stringify({isDestroyed:!0,type:i,time:r,roomId:o})),[2]):(2===i&&o===this._roomId&&(a=this._logger.createTraceId(),this._logger.info(n.L_RTCNTF_PULL_ROOM_STATUS_O,null,a),this._startPullRTCRoomStatus(o,a,r)),[2])}))}))})),f}return r(i,t),Object.defineProperty(i.prototype,"_setPeerConnectionListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=this._peerConnection;t.on(Eo.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),t.on(Ke.__INNER_EVENT_MUTED_CHANGE__,this._onLocalTrackMuted,this),t.on(Ke.__INNER_EVENT_DESTROY__,this._onLocalTrackDestroied,this),t.once(Eo.__INNER_ICE_CONNECTED__,(function(t){e._reportMediaActionLogger.reportIceFirstConnectData(t?"pub":"sub")}),this),t.on(Eo.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,i=t.time,n=t.iceCandidatePair;n&&e._reportMediaActionLogger.recordQualityIceStatusData(n,r,i)}))}}),Object.defineProperty(i.prototype,"setCommandEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._executeCtx;e.on(xo,this._rtcpeerClosed,this),e.on(jo,this._callAppListener.bind(this,"onUserJoin"),this),e.on(Bo,this._callAppListener.bind(this,"onUserLeave"),this),e.on(Vo,this._onTrackPublish,this),e.on(Fo,this._onTrackUnpublish,this),e.on(Jo,this._onAudioMuteChange,this),e.on(Go,this._onVideoMuteChange,this),e.on(Ho,this._callAppListener.bind(this,"onCDNEnableChange"),this),e.on(Ko,this._dealUserAppListener,this)}}),Object.defineProperty(i.prototype,"_startPullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){return c(this,(function(i){switch(i.label){case 0:return[4,this._invoker.push(new Ra(e,t,this._context,r))];case 1:return i.sent(),[2]}}))}))}}),Object.defineProperty(i.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o){return s(this,void 0,void 0,(function(){var a,s,u;return c(this,(function(c){switch(c.label){case 0:return[4,this._invoker.push(new Do(this._roomId,e,t,r,i,n,o))];case 1:return a=c.sent(),s=a.code,u=a.data,s!==exports.RCRTCCode.SUCCESS?[2,{code:s}]:(this._initWithRoomData(u.offlineKickTime),[2,{code:s,data:u}])}}))}))}}),Object.defineProperty(i.prototype,"_initWithRoomData",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._pinger.start(1e3*e),this._polarisReport.sendR1()}}),Object.defineProperty(i.prototype,"_handlePingResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){if(e===exports.RCRTCPingResult.SUCCESS&&(t>this._store.getRoomStatusVersion()&&this._store.getSupportNtf())){var r=this._logger.createTraceId();this._logger.info(n.L_RTCPING_PULL_ROOM_STATUS_O,JSON.stringify({dataVersion:t}),r),this._startPullRTCRoomStatus(this._roomId,r,t)}this._callAppListener("onPing",e)}}),Object.defineProperty(i.prototype,"setBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){this._logger.warn(n.L_ABSTRACT_ROOM_SETBITRATE_O,"`RCAbstractRoom.setBitrate` will be deprecated, use `RCLocalTrack.setBitrate` instead."),e.assert("max",t,(function(t){return e.isNumber(t)&&t>Math.max(r||1,200)}),!0),e.assert("min",r,(function(r){return e.isNumber(r)&&r>=1&&(!e.isNumber(t)||r<t)}),!0),e.assert("start",i,(function(i){return e.isNumber(i)&&i>r&&i<=t})),this._peerConnection.setBitrate(t,r,i)}}),Object.defineProperty(i.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.streams[0].id,r=e.receiver.track,i=[t,"audio"===r.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=this._store.getRemoteTrack(i);a?(a.__innerSetMediaStreamTrack(r),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackReady",trackId:a.getTrackId()})),this._callAppListener("onTrackReady",a)):this._logger.warn(n.L_ABSTRACT_ROOM_ONTRACKREADY_O,"cannot found remote track ".concat(r.id))}}),Object.defineProperty(i.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];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,null==e?void 0:e.stack)}}}),Object.defineProperty(i.prototype,"_onTrackUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackUnpublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackUnpublish",e)}}),Object.defineProperty(i.prototype,"__parseInnerMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=e.targetId;if(r===this._roomId){this._logger.info(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,"recv inner msg -> message: ".concat(JSON.stringify(e)," | roomid: ").concat(this._roomId),t);var i=e.content;switch(e.messageType){case Tt.KICK:this.__kickoff(!0,i);break;case Tt.STATE:this._stateHandle(i,t);break;case Tt.MODIFY:case Tt.PUBLISH:case Tt.UNPUBLISH:case Tt.TOTAL_CONTENT_RESOURCE:this._resourceHandle(i,e.messageType,e.senderUserId,e.sentTime,t);break;case Tt.ROOM_NOTIFY:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onRoomAttributeChange",messageType:e.messageType,messageContent:e.content})),this._callAppListener("onRoomAttributeChange",e.messageType,e.content);break;case Tt.USER_NOTIFY:this._logger.warn(n.L_OLD_DAILY_RECORD_O,"TODO: ".concat(Tt.USER_NOTIFY));break;case Tt.PK_INVITE:case Tt.PK_CANCEL_INVITE:case Tt.PK_INVITE_TIMEOUT:case Tt.PK_INVITE_ANSWER:case Tt.PK_END:this._onRecvPKMsg&&this._onRecvPKMsg(e);break;case Tt.OTHER_ROOM_OFFLINE:break;default:this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onMessageReceive",messageType:e.messageType,messageContent:e.content,senderUserId:e.senderUserId,messageUId:e.messageUId})),this._callAppListener("onMessageReceive",e.messageType,i,e.senderUserId,e.messageUId)}}else this._logger.warn(n.L_ABSTRACT_ROOM_RECEIVE_MESSAGE_O,JSON.stringify({status:o.FAILED,message:"roomId is different, msg roomId-> ".concat(r,", this._roomId-> ").concat(this._roomId," ")}),t)}}),Object.defineProperty(i.prototype,"__kickoff",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a=this;return c(this,(function(s){return this._invoker.isDestroyed()||(this._logger.warn(n.L_ABSTRACT_ROOM_ONKICKOFF_O,"onKickOff -> byServer: ".concat(e,", kickContent: ").concat(JSON.stringify(t))),this.emit(Aa),this._leaveHandle(!e),e&&((null==t?void 0:t.users)||[]).forEach((function(e){e.userId===a._context.getCurrentId()&&(i=e.type,r=e.kickExtra,a._reportMediaActionLogger.reportQualityKickedData(i))})),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onKickOff",byServer:e,kickType:i,kickExtra:r})),this._callAppListener("onKickOff",e,i,r)),[2]}))}))}}),Object.defineProperty(i.prototype,"_rtcpeerClosed",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.emit(Aa),this._leaveHandle(!0),this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,"onRTCPeerConnectionCloseByException"),this._callAppListener("onRTCPeerConnectionCloseByException")}}),Object.defineProperty(i.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o;return c(this,(function(a){return o=e.uris,e.ignore||!o||this._invoker.push(new ua(e,t,r,n,i)),[2]}))}))}}),Object.defineProperty(i.prototype,"_onTrackPublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onTrackPublish",trackIds:null==e?void 0:e.map((function(e){return e.getTrackId()}))})),this._callAppListener("onTrackPublish",e)}}),Object.defineProperty(i.prototype,"_stateHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(n){switch(n.label){case 0:return[4,this._invoker.push(new ca(e,t))];case 1:return r=n.sent(),i=r.data,this._dealUserAppListener(i),[2]}}))}))}}),Object.defineProperty(i.prototype,"_dealUserAppListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=this,a=e.left,s=e.joined,c=e.upgrade,u=e.downgrade,_=e.offline,p=d([],l(s),!1),f=d([],l(a),!1);(null===(t=this._appListener)||void 0===t?void 0:t.onSwitchRole)?(null==c||c.forEach((function(e){i._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.ANCHOR})),i._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.ANCHOR)})),null==u||u.forEach((function(e){i._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onSwitchRole",userId:e,role:exports.RCRTCLiveRole.AUDIENCE})),i._callAppListener("onSwitchRole",e,exports.RCRTCLiveRole.AUDIENCE)}))):(p.push.apply(p,d([],l(c),!1)),f.push.apply(f,d([],l(u),!1))),_.length&&((null===(r=this._appListener)||void 0===r?void 0:r.onUserOffline)?(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserOffline",offline:_})),this._callAppListener("onUserOffline",_)):f.push.apply(f,d([],l(_),!1))),p.length>0&&(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserJoin",allJoined:p})),this._callAppListener("onUserJoin",p)),f.length>0&&(this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onUserLeave",allLeft:f})),this._callAppListener("onUserLeave",f))}}),Object.defineProperty(i.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(i.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(i.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getRemoteUserIds()}}),Object.defineProperty(i.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[];return this.getRemoteUserIds().forEach((function(r){t.push.apply(t,d([],l(e.getRemoteTracksByUserId(r)),!1))})),t}}),Object.defineProperty(i.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTracksByUserId(e)}}),Object.defineProperty(i.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.getSessionId()}}),Object.defineProperty(i.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a;return c(this,(function(s){switch(s.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_T,JSON.stringify({name:t,content:r}),i),[4,this._context.sendMessage(e.ConversationType.RTC_ROOM,this._roomId,{messageType:t,content:r,isStatusMessage:!0})];case 1:return(a=s.sent().code)!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:o.FAILED,code:a}),i),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SEND_MESSAGE_R,JSON.stringify({status:o.SUCCESSED,name:t,content:r}),i),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"setRoomAttribute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return void 0===a&&(a=!1),s(this,void 0,void 0,(function(){var s,u;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,key:t,value:r,message:i,isInner:a}),s),[4,this._context.setRTCData(this._roomId,t,r,a,wo.ROOM,i)];case 1:return(u=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.FAILED,code:u}),s),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_SET_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,roomId:this._roomId,key:t,value:r,message:i,isInner:a}),s),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"deleteRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var a,s;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,message:r,isInner:i}),a),[4,this._context.removeRTCData(this._roomId,t,i,wo.ROOM,r)];case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.FAILED,code:s}),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,roomId:this._roomId,keys:t,message:r,isInner:i}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(i.prototype,"getRoomAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return void 0===t&&(t=[]),void 0===r&&(r=!1),s(this,void 0,void 0,(function(){var i,a,s,u;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_T,JSON.stringify({roomId:this._roomId,keys:t,isInner:r}),i),[4,this._context.getRTCData(this._roomId,t,r,wo.ROOM)];case 1:return a=c.sent(),s=a.code,u=a.data,s!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_ABSTRACT_ROOM_GET_ROOM_ATTRIBUTE_R,"GetRoomAttributes Failed: ".concat(s),i),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(this._logger.info(n.L_ABSTRACT_ROOM_DELETE_ROOM_ATTRIBUTE_R,JSON.stringify({status:o.SUCCESSED,data:u}),i),[2,{code:exports.RCRTCCode.SUCCESS,data:u}])}}))}))}}),Object.defineProperty(i.prototype,"_setUserAttributeValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this._context.setRTCData(this._roomId,e,t,!1,wo.PERSON,r)}}),Object.defineProperty(i.prototype,"_deleteUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return this._context.removeRTCData(this._roomId,e,!1,wo.PERSON,t)}}),Object.defineProperty(i.prototype,"_getUserAttributes",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._context.getRTCData(this._roomId,e,!1,wo.PERSON)}}),Object.defineProperty(i.prototype,"isDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.isDestroyed()}}),Object.defineProperty(i.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._leaveHandle(e)}}),Object.defineProperty(i.prototype,"_muteRemoteTracksBeforeQuit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=Object.values(this._store.getRemoteTracks());e.length&&e.forEach((function(e){return e.mute()}))}}),Object.defineProperty(i.prototype,"_leaveHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){switch(t.label){case 0:return this._invoker.isDestroyed()?[2]:(this._invoker.destroy(),this._muteRemoteTracksBeforeQuit(),e?[4,this._context.quitRTCRoom(this._roomId)]:[3,2]);case 1:t.sent(),t.label=2;case 2:return this._store.isMainRoom?[4,this._quitAllPKRoom()]:[3,4];case 3:t.sent(),t.label=4;case 4:return this._pinger.stop(),[4,this._service.exit(this._store.getRTCRequestHeader())];case 5:return t.sent(),this._releasePCManager(),[2]}}))}))}}),Object.defineProperty(i.prototype,"_releasePCManager",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._peerConnection;e.removeAllLocalTrack(),e.destroy()}}),Object.defineProperty(i.prototype,"_onLocalTrackDestroied",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e instanceof Ye&&e.__isTiny()||this.unpublish([e])}}),Object.defineProperty(i.prototype,"_onLocalTrackMuted",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return[4,this._invoker.push(new pa(e))];case 1:return r=i.sent().code,t(r),[2]}}))}))}}),Object.defineProperty(i.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new da(e))]}))}))}}),Object.defineProperty(i.prototype,"_getPushOtherRoomsParams",{enumerable:!1,configurable:!0,writable:!0,value:function(){return[]}}),Object.defineProperty(i.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._invoker.push(new fa)}}),Object.defineProperty(i.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new _a(e))]}))}))}}),Object.defineProperty(i.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r=dt(e).userId;return!!(null===(t=this._store.getResourcesByUserId(r))||void 0===t?void 0:t.find((function(t){return lt(t)===e})))}}),Object.defineProperty(i.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new la(e,void 0,void 0))]}))}))}}),Object.defineProperty(i.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){return t=this._logger.createTraceId(),this._logger.info(n.L_APP_CALL_UNSUBSCRIBE_O,void 0,t),[2,this._invoker.push(new Qo(e,t))]}))}))}}),Object.defineProperty(i.prototype,"updateSubList",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new qo(e,!0,this._logger.createTraceId()))]}))}))}}),Object.defineProperty(i.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._peerConnection.getLocalTrack(e)}}),Object.defineProperty(i.prototype,"getLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._peerConnection.getLocalTracks()}}),Object.defineProperty(i.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._store.getRemoteTrack(e)||null}}),Object.defineProperty(i.prototype,"subscribedTracks",{get:function(){return this._store.getSubscribedList().slice()},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_ROOM_EVENT_LISTENER_O,e?Object.keys(e).join(","):null),this._appListener=e}}),Object.defineProperty(i.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_REGISTER_REPORT_LISTENER_O,e?Object.keys(e).join(","):null),this._peerConnection.registerReportListener(e)}}),Object.defineProperty(i.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(n.L_ABSTRACT_ROOM_AUDIO_LEVEL_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(i.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._invoker.push(new ga(e))}}),Object.defineProperty(i.prototype,"_onAudioMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onAudioMuteChange",trackId:e.getTrackId()})),this._callAppListener("onAudioMuteChange",e)}}),Object.defineProperty(i.prototype,"_onVideoMuteChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_ABSTRACT_ROOM_CALL_APP_LISTENER_O,JSON.stringify({status:o.SUCCESSED,eventType:"onVideoMuteChange",trackId:e.getTrackId()})),this._callAppListener("onVideoMuteChange",e)}}),Object.defineProperty(i.prototype,"_registerPKMsgListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._onRecvPKMsg=e}}),Object.defineProperty(i.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){return c(this,(function(e){return[2]}))}))}}),Object.defineProperty(i.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.clientSessionId}}),i}(e.EventEmitter),Da=function(e){function t(t,r){var i=e.call(this)||this;return Object.defineProperty(i,"data",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(i,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(t,e),Object.defineProperty(t.prototype,"kind",{get:function(){return ho.MCUCONFIG_FLUSH},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,n,o,a;return s(this,void 0,void 0,(function(){var r,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return r=e.context,s=e.service,u={"App-Key":r.getAppkey(),Token:t.getToken(),RoomId:t.roomId,UserId:r.getCurrentId(),SessionId:t.getSessionId()},[4,s.setMcuConfig(u,this.data)];case 1:return l=c.sent(),d=l.code,_=l.res,d!==exports.RCRTCCode.SUCCESS?[2,{code:d}]:(_.pull_url&&t.setCDNUris(JSON.parse(_.pull_url)),p=this.cdnValues,d===exports.RCRTCCode.SUCCESS&&((null===(n=null===(i=p.output)||void 0===i?void 0:i.video.normal)||void 0===n?void 0:n.width)||(null===(a=null===(o=p.output)||void 0===o?void 0:o.video.normal)||void 0===a?void 0:a.fps))&&ta(r,t),[2,{code:d,data:_}])}}))}))}}),t}(yo);exports.BackgroundPictureFillMode=void 0,(Sa=exports.BackgroundPictureFillMode||(exports.BackgroundPictureFillMode={}))[Sa.CROP=1]="CROP",Sa[Sa.WHOLE=2]="WHOLE",exports.MixLayoutMode=void 0,(ya=exports.MixLayoutMode||(exports.MixLayoutMode={}))[ya.CUSTOMIZE=1]="CUSTOMIZE",ya[ya.SUSPENSION=2]="SUSPENSION",ya[ya.ADAPTATION=3]="ADAPTATION",exports.MixVideoRenderMode=void 0,(La=exports.MixVideoRenderMode||(exports.MixVideoRenderMode={}))[La.CROP=1]="CROP",La[La.WHOLE=2]="WHOLE",function(e){e[e.AUDIO_VIDEO_ALL=0]="AUDIO_VIDEO_ALL",e[e.AUDIO_VIDEO_NO=1]="AUDIO_VIDEO_NO",e[e.AUDIO_ALL_VIDEO_NO=2]="AUDIO_ALL_VIDEO_NO",e[e.AUDIO_NO_VIDEO_ALL=3]="AUDIO_NO_VIDEO_ALL",e[e.AUDIO_VIDEO_INPUT=4]="AUDIO_VIDEO_INPUT",e[e.AUDIO_ALL_VIDEO_INPUT=5]="AUDIO_ALL_VIDEO_INPUT",e[e.AUDIO_NO_VIDEO_INPUT=6]="AUDIO_NO_VIDEO_INPUT",e[e.AUDIO_INPUT_VIDEO_ALL=7]="AUDIO_INPUT_VIDEO_ALL",e[e.AUDIO_INPUT_VIDEO_NO=8]="AUDIO_INPUT_VIDEO_NO",e[e.ROOM_AUDIO_VIDEO_APPEND=9]="ROOM_AUDIO_VIDEO_APPEND",e[e.ROOM_AUDIO_VIDEO_NOT_APPEND=10]="ROOM_AUDIO_VIDEO_NOT_APPEND",e[e.ROOM_AUDIO_APPEND=11]="ROOM_AUDIO_APPEND",e[e.ROOM_AUDIO_NOT_APPEND=12]="ROOM_AUDIO_NOT_APPEND",e[e.ROOM_VIDEO_APPEND=13]="ROOM_VIDEO_APPEND",e[e.ROOM_VIDEO_NOT_APPEND=14]="ROOM_VIDEO_NOT_APPEND"}(Pa||(Pa={}));var ka,Ua=function(){return{version:2,mode:exports.MixLayoutMode.SUSPENSION}},Ma=function(){function t(e,t,r){Object.defineProperty(this,"_executeCtx",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_isValidTrackId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_values",{enumerable:!0,configurable:!0,writable:!0,value:Ua()}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._executeCtx.logger}return Object.defineProperty(t.prototype,"setHostVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,msg:"videoTrackId: ".concat(e," is invalid")})),this;var t=dt(e),r=t.mediaType,i=t.tag,a=t.userId;return r!==exports.RCMediaType.VIDEO_ONLY?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,msg:"kind of ".concat(e," is not video")})),this):(this._values.host_stream_id=_t(a,i),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_HOST_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,videoTrackId:e})),this)}}),Object.defineProperty(t.prototype,"setMixLayoutMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.MixLayoutMode.CUSTOMIZE,exports.MixLayoutMode.SUSPENSION,exports.MixLayoutMode.ADAPTATION].includes(e)?(this._values.mode=e,this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:o.SUCCESSED,mode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_MIX_LAYOUT_MODE_O,JSON.stringify({status:o.SUCCESSED,msg:"mode: ".concat(e," is invalid")})),this)}}),Object.defineProperty(t.prototype,"_addOutputValue",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){void 0===r&&(r="normal");var i=this._values.output||(this._values.output={video:{normal:{width:640,height:480}}});if("cdn"!==e)if("audio"!==e){var n=i.video;if("normal"!==r&&"tiny"!==r)if("backgroundColor"!==r)if("exparams"!==r){if("backgroundPicture"===r){var o=n.backgroundPicture||(n.backgroundPicture={fillMode:exports.BackgroundPictureFillMode.CROP,picture:[]});Object.assign(o,t)}}else n.exparams={renderMode:t};else n.backgroundColor=t;else{var a=n[r]||(n[r]={});Object.assign(a,t)}}else i.audio={bitrate:t};else i.cdn=t}}),Object.defineProperty(t.prototype,"setOutputVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!Rt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:o.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=bt(e),r=t.width,i=t.height;return this._addOutputValue("video",{width:r,height:i},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RESOLUTION_O,JSON.stringify({status:o.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!gt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:o.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=mt(e);return this._addOutputValue("video",{fps:t},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_FPS_O,JSON.stringify({status:o.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e.isNumber(t)||t<=0?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"normal"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputTinyVideoResolution",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!Rt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:o.FAILED,msg:"params error -> resolution: ".concat(e)})),this;var t=bt(e),r=t.width,i=t.height;return this._addOutputValue("video",{width:r,height:i},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_RESOLUTION_O,JSON.stringify({status:o.SUCCESSED,resolution:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoFPS",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!gt(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:o.FAILED,msg:"params error -> fps: ".concat(e)})),this;var t=mt(e);return this._addOutputValue("video",{fps:t},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_FPS_O,JSON.stringify({status:o.SUCCESSED,fps:e})),this}}),Object.defineProperty(t.prototype,"setOutputTinyVideoBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return!e.isNumber(t)||t<=0?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this):(this._addOutputValue("video",{bitrate:t},"tiny"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_TINY_VIDEO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this)}}),Object.defineProperty(t.prototype,"setOutputVideoRenderMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.MixVideoRenderMode.CROP,exports.MixVideoRenderMode.WHOLE].includes(e)?(this._addOutputValue("video",e,"exparams"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:o.SUCCESSED,renderMode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_VIDEO_RENDER_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> renderMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"setOutputAudioBitrate",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return e.isNumber(t)&&t>0?(this._addOutputValue("audio",t),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:o.SUCCESSED,bitrate:t})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_AUDIO_BITRATE_O,JSON.stringify({status:o.FAILED,msg:"params error -> bitrate: ".concat(t)})),this)}}),Object.defineProperty(t.prototype,"setOutputBackgroundColor",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return/^0x[a-fA-F0-9]{6}$/.test(e)?(this._addOutputValue("video",e,"backgroundColor"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:o.SUCCESSED,color:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_COLOR_O,JSON.stringify({status:o.FAILED,msg:"params error -> color: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,s){var c,u,l;if(!e.isHttpUrl(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(t)})),this;if([r,i,a,s].some((function(t){return!e.isNumber(t)||t<0||t>1})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params of (x, y, w, h) error -> x: ".concat(r,", y: ").concat(i,", w: ").concat(a,", h: ").concat(s)})),this;var d=(null===(l=null===(u=null===(c=this._values.output)||void 0===c?void 0:c.video)||void 0===u?void 0:u.backgroundPicture)||void 0===l?void 0:l.picture)||[];return d.push({uri:t,w:a,h:s,x:r,y:i}),this._addOutputValue("video",{picture:d},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.SUCCESSED,uri:t,x:r,y:i,w:a,h:s})),this}}),Object.defineProperty(t.prototype,"removeOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a;if(!e.isHttpUrl(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(t)})),this;var s=null===(a=null===(i=null===(r=this._values.output)||void 0===r?void 0:r.video)||void 0===i?void 0:i.backgroundPicture)||void 0===a?void 0:a.picture;return s&&(s=s.filter((function(e){return e.uri!==t})),this._addOutputValue("video",{pictures:s},"backgroundPicture")),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_OUTPUT_BACKGROUND_PICTURE_O,JSON.stringify({status:o.SUCCESSED,uri:t})),this}}),Object.defineProperty(t.prototype,"clearOutputBackgroundPicture",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("video",{pictures:[]},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}}),Object.defineProperty(t.prototype,"setOutputBackgroundPictureFillMode",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return[exports.BackgroundPictureFillMode.CROP,exports.BackgroundPictureFillMode.WHOLE].includes(e)?(this._addOutputValue("video",{fillMode:e},"backgroundPicture"),this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.SUCCESSED,fillMode:e})),this):(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> fillMode: ".concat(e)})),this)}}),Object.defineProperty(t.prototype,"addPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a=/^rtmp:\/\/.+/;if(!e.isArray(t)||0===t.length||t.some((function(e){return!a.test(e)})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> urls: ".concat(t.join(","))})),this;var s=(null===(i=null===(r=this._values.output)||void 0===r?void 0:r.cdn)||void 0===i?void 0:i.concat())||[],c=!1;return t.forEach((function(e){s.some((function(t){return t.pushurl===e}))||(c=!0,s.push({pushurl:e}))})),s.length>5?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_OUTPUT_BACKGROUND_PICTURE_FILL_MODE_O,JSON.stringify({status:o.FAILED,msg:"params error -> publish stream urls no more than 5, length: ".concat(t.length)})),this):(c&&this._addOutputValue("cdn",s),this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.SUCCESSED,urls:t})),this)}}),Object.defineProperty(t.prototype,"removePublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(t){var r,i,a=/^rtmp:\/\/.+/;if(!e.isArray(t)||0===t.length||t.some((function(e){return!a.test(e)})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.FAILED,msg:"params error -> urls: ".concat(t.join(","))})),this;for(var s=(null===(i=null===(r=this._values.output)||void 0===r?void 0:r.cdn)||void 0===i?void 0:i.concat())||[],c=s.length-1;c>=0;c-=1){var u=s[c].pushurl,l=t.indexOf(u);l>=0&&(t.splice(l,1),s.splice(c,1))}return this._addOutputValue("cdn",s),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_PUBLISH_STREAM_URLS_O,JSON.stringify({status:o.SUCCESSED,urls:t})),this}}),Object.defineProperty(t.prototype,"clearPublishStreamUrls",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._addOutputValue("cdn",[]),this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_PUBLISH_STREAM_URLS_O),this}}),Object.defineProperty(t.prototype,"addCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,s){if(!e.notEmptyString(t)||!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!e.isNumber(r)||!e.isNumber(i))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params x or y is error -> x: ".concat(r,", y: ").concat(i)})),this;if([a,s].some((function(t){return!e.isNumber(t)||t<0})))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params width or height error -> width: ".concat(a,", height: ").concat(s)})),this;var c=dt(t),u=c.userId,l=c.tag;if(c.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(t," is not video")})),this;var d=_t(u,l),_=this._values.input||(this._values.input={}),p=_.video||(_.video=[]);return p.some((function(e){return e.height===s&&e.width===a&&e.stream_id===d&&e.user_id===u&&e.x===r&&e.y===i}))?(this._logger.warn(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"Duplicate configuration item place ignored"})),this):(p.push({user_id:u,stream_id:d,x:r,y:i,width:a,height:s}),this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.SUCCESSED,trackId:t,x:r,y:i,width:a,height:s})),this)}}),Object.defineProperty(t.prototype,"removeCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=dt(e),r=t.userId,i=t.tag;if(t.mediaType!==exports.RCMediaType.VIDEO_ONLY)return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(e," is not video")})),this;var a=_t(r,i),s=this._values.input;return(null==s?void 0:s.video)&&s.video.length>0&&(s.video=s.video.filter((function(e){return e.stream_id===a}))),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_LAYOUT_VIDEO_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this}}),Object.defineProperty(t.prototype,"clearCustomizeLayoutVideo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._values.input;return null==e||delete e.video,this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_LAYOUT_VIDEO_O),this}}),Object.defineProperty(t.prototype,"setCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this;return e.some((function(e){return t._isValidTrackId(e)}))?(this._logger.error(n.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"trackIds contain invalid item -> trackIds: ".concat(e.join(","))})),this):((this._values.input||(this._values.input={})).audio=e.map((function(e){var t=dt(e),r=t.userId,i=t.tag;return{stream_id:_t(r,i),user_id:r}})),this._values.inputFilterMode=Pa.AUDIO_INPUT_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_SET_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.SUCCESSED,trackIds:e})),this)}}),Object.defineProperty(t.prototype,"addCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input||(this._values.input={}),r=t.audio||(t.audio=[]),i=dt(e),a=i.userId,s=i.tag,c=_t(a,s);return r.some((function(e){return e.stream_id===c&&e.user_id===a}))?(this._logger.warn(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"trackId: ".concat(e," is exist")})),this):(r.push({user_id:a,stream_id:c}),this._values.inputFilterMode=Pa.AUDIO_INPUT_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this)}}),Object.defineProperty(t.prototype,"removeCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(!this._isValidTrackId(e))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(e)})),this;var t=this._values.input;if(!(null==t?void 0:t.audio)||0===t.audio.length)return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.FAILED,msg:"type of trackId: ".concat(e," is not audio")})),this;var r=dt(e),i=r.userId,a=r.tag,s=_t(i,a);return t.audio=t.audio.filter((function(e){return i!==e.user_id||s!==e.stream_id})),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_CUSTOMIZE_INPUT_AUDIO_O,JSON.stringify({status:o.SUCCESSED,trackId:e})),this}}),Object.defineProperty(t.prototype,"clearCustomizeInputAudio",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._values.input;return(null==e?void 0:e.audio)&&delete e.audio,this._values.inputFilterMode=Pa.AUDIO_VIDEO_ALL,this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_CUSTOMIZE_INPUT_AUDIO_O),this}}),Object.defineProperty(t.prototype,"addPictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a,s,c){if(!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;if(!e.isHttpUrl(r))return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> uri: ".concat(r)})),this;if([i,a,s,c].some((function(t){return!e.isNumber(t)||t<0||t>1}))||i+s>1||a+c>1)return this._logger.error(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"some attrs of (x, y, w, h) is invalid -> x: ".concat(i,", y: ").concat(a,", w: ").concat(s,", h: ").concat(c)})),this;var u=dt(t),l=u.userId,d=u.tag,_=_t(l,d),p=(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen,f=p.filter((function(e){return e.streamId===_}))[0];return f?f.picture.push({uri:r,w:s,h:c,x:i,y:a}):p.push({streamId:_,picture:[{uri:r,w:s,h:c,x:i,y:a}]}),this._values.waterMark.singleScreen=p,this._logger.info(n.L_MCU_CONFIG_BUILDER_ADD_SINGLE_WATER_MARK_O,JSON.stringify({status:o.SUCCESSED,trackId:t,uri:r,x:i,y:a,w:s,h:c,singleScreen:p})),this}}),Object.defineProperty(t.prototype,"clearPictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(){return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen=[],this._logger.info(n.L_MCU_CONFIG_BUILDER_CLEAR_OUTPUT_BACKGROUND_PICTURE_O),this}}),Object.defineProperty(t.prototype,"removePictureWaterMark",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(!e.notEmptyString(t)||!this._isValidTrackId(t))return this._logger.error(n.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:o.FAILED,msg:"params error -> trackId: ".concat(t)})),this;var i=dt(t),a=i.userId,s=i.tag,c=_t(a,s);return(this._values.waterMark||(this._values.waterMark={enable:"on",singleScreen:[]})).singleScreen.forEach((function(e){e.streamId===c&&(e.picture=e.picture.filter((function(e){return e.uri!==r})))})),this._logger.info(n.L_MCU_CONFIG_BUILDER_REMOVE_SINGLE_WATER_MARK_O,JSON.stringify({status:o.SUCCESSED,trackId:t,uri:r})),this}}),Object.defineProperty(t.prototype,"reset",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._values=Ua(),this._logger.info(n.L_MCU_CONFIG_BUILDER_RESET_O),this}}),Object.defineProperty(t.prototype,"flush",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return void 0===e&&(e=!0),s(this,void 0,void 0,(function(){var t,r;return c(this,(function(i){switch(i.label){case 0:return t=JSON.parse(JSON.stringify(this._values)),[4,this._invoker.push(new Da(t,this._values))];case 1:return r=i.sent().code,e&&(this._values=Ua()),[2,{code:r}]}}))}))}}),Object.defineProperty(t.prototype,"__innerGetValues",{enumerable:!1,configurable:!0,writable:!0,value:function(){return JSON.parse(JSON.stringify(this._values))}}),t}();exports.RCLivingType=void 0,(ka=exports.RCLivingType||(exports.RCLivingType={}))[ka.VIDEO=0]="VIDEO",ka[ka.AUDIO=1]="AUDIO";var xa,ja=function(e){function t(t,r,i){var n=e.call(this)||this;return Object.defineProperty(n,"roomId",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(n,"roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:i}),n}return r(t,e),Object.defineProperty(t.prototype,"_exchangeWithPushOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d,_,p,f,h;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,a=e.peer,s=e.context,a.getLocalTracks().length?(u=a,[4,Xo(t.getSubscribedList(),!1,u,t,s)]):(i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.SUCCESSED,msg:"have not published resource"}),this.traceId),[2]);case 1:return l=c.sent(),d=e.getPushOtherRooms(),l.pushOtherRooms=d,[4,new zo(l,this.traceId,!0).execute(e,t,r)];case 2:return(_=c.sent()).code!==exports.RCRTCCode.SUCCESS?(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,code:_.code,pushOtherRooms:d}),this.traceId),[2]):(p=_.data.data,f=p.sdp,(h=p.resultCode)!==exports.RCRTCCode.SUCCESS?(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,code:h,pushOtherRooms:d}),this.traceId),[2]):(i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.SUCCESSED,pushOtherRooms:d}),this.traceId),u.setRemoteAnswer(f.sdp),[2]))}}))}))}}),Object.defineProperty(t.prototype,"kind",{get:function(){return ho.EXCHANGE_WITH_PUSH_OTHER_ROOM},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a;return c(this,(function(s){switch(s.label){case 0:return i=e.logger,a=this.roomId,i.info(n.L_EXCHANGE_WITH_PUSHOTHERROOM_T,a),this.roomPKHandler?this.roomPKHandler.getPKInfo(a)?[4,this._exchangeWithPushOtherRoom(e,t,r)]:(i.warn(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,msg:"PKInfo not exist"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]):(i.error(n.L_EXCHANGE_WITH_PUSHOTHERROOM_R,JSON.stringify({status:o.FAILED,msg:"_roomPKHandler not exist"}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return s.sent(),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),t}(yo),Ba=function(t){function i(e,r,i,n,o,a){var s=t.call(this)||this;return Object.defineProperty(s,"pkHandler",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(s,"room",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(s,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(s,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(s,"isQuitPK",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(s,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:a}),s}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.LEAVE_OTHER_ROOM},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"quitRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,b,R;return c(this,(function(c){switch(c.label){case 0:return s=t.logger,u=t.context,s.info(n.L_QUIT_PK_T,"roomId: ".concat(r),a),this._PKInfo[r]?(l=this._PKInfo[r],d=l.inviterRoomId,_=l.inviteeRoomId,p=l.inviterUserId,f=l.inviteSessionId,h={inviteeRoomId:_,inviterRoomId:d,userId:i.crtUserId},b={roomId:i.roomId,endRoomId:r,sessionId:f,content:JSON.stringify(h),keys:["".concat(d,"|").concat(p)]},[4,u.endRoomPK(b)]):(s.warn(n.L_QUIT_PK_R,"status: ".concat(o.FAILED,", msg: pkinfo is empty"),a),[2]);case 1:return(R=c.sent())!==e.ErrorCode.SUCCESS?(s.error(n.L_QUIT_PK_R,"status: ".concat(o.FAILED,", code: ").concat(R),a),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(s.info(n.L_QUIT_PK_R,"status: ".concat(o.SUCCESSED),a),delete this._PKInfo[r],[2])}}))}))}}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return i=e.logger,s=(a=this).room,u=a.isQuitPK,l=s.getRoomId(),i.info(n.L_LIVING_ROOM_LEAVE_PK_ROOM_T,JSON.stringify({roomId:l,isQuitPK:u}),this.traceId),[4,s.__destroy(!0)];case 1:return c.sent(),delete this._joinedPKRooms[l],[4,new ja(l,this.pkHandler,this.traceId).execute(e,t,r)];case 2:return c.sent(),u&&this.quitRoomPK(e,l,t,this.traceId),i.info(n.L_LIVING_ROOM_LEAVE_PK_ROOM_R,JSON.stringify({status:o.SUCCESSED}),this.traceId),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),i}(yo),Va=function(){function t(e,t,r,i,n,o,a,s,c,u){Object.defineProperty(this,"_invoker",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_PKInfo",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_mainLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_registerPKMsgListener",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_onJoinedPKRoom",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:u}),Object.defineProperty(this,"_inviteTimeout",{enumerable:!0,configurable:!0,writable:!0,value:30}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mainRoomId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_joinedPKRooms",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._logger=this._context.logger,this._registerPKMsgListener(this._onRecvPKMsg.bind(this)),this._mainRoomId=this._mainLivingRoom.getRoomId()}return Object.defineProperty(t.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];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(t.prototype,"_onInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,i={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};this._PKInfo[r]=t,this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onRequestJoinOtherRoom",info:i})),this._callAppListener("onRequestJoinOtherRoom",i)}}),Object.defineProperty(t.prototype,"_onCancelInvite",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.inviteInfo||{},r=t.inviterRoomId,i={inviterRoomId:r,inviterUserId:t.inviterUserId,extra:t.extra};delete this._PKInfo[r],this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCancelRequestOtherRoom",cancelInfo:i})),this._callAppListener("onCancelRequestOtherRoom",i)}}),Object.defineProperty(t.prototype,"_onInviteTimeout",{enumerable:!1,configurable:!0,writable:!0,value:function(e){}}),Object.defineProperty(t.prototype,"_onInviteAnswer",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.answerCode,r=e.inviteContent,i=r.inviteSessionId,o=r.inviterUserId,a=r.inviterRoomId,s=r.inviteeUserId,c=r.inviterUserAutoMix,u=r.inviteeUserAutoMix,l=r.inviteeRoomId,d={agree:1===t,inviterRoomId:a,inviterUserId:o,inviteeRoomId:l,inviteeUserId:s,extra:r.extra};this._PKInfo[l]=this._PKInfo[l]||{inviteSessionId:i,inviterRoomId:a,inviterUserId:o,inviterUserAutoMix:c,inviteeRoomId:l},this._PKInfo[l].inviteeUserAutoMix=u,this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onResponseJoinOtherRoom",answerInfo:d})),this._callAppListener("onResponseJoinOtherRoom",d)}}),Object.defineProperty(t.prototype,"createLeaveOtherRoomCommand",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return new Ba(this,e,this._PKInfo,this._joinedPKRooms,t,r)}}),Object.defineProperty(t.prototype,"_onPKEnd",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return t=e.inviteInfo,r=t.inviteeRoomId,i=t.inviterRoomId,o=t.userId,a=i===this._mainRoomId?r:i,s={endRoomId:a,endUserId:o},u=this._joinedPKRooms[a],l=this._logger.createTraceId(),this._logger.info(n.L_QUIT_PK_LEAVE_PK_ROOM_O,void 0,l),u?[4,this._invoker.push(this.createLeaveOtherRoomCommand(u,!0,l))]:[3,2];case 1:c.sent(),c.label=2;case 2:return delete this._PKInfo[a],this._logger.info(n.L_LIVING_PK_HANDLER_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onFinishOtherRoom",endInfo:s})),this._callAppListener("onFinishOtherRoom",s),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onRecvPKMsg",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.content;switch(e.messageType){case Tt.PK_INVITE:this._onInvite(t);break;case Tt.PK_CANCEL_INVITE:this._onCancelInvite(t);break;case Tt.PK_INVITE_TIMEOUT:this._onInviteTimeout(t);break;case Tt.PK_INVITE_ANSWER:this._onInviteAnswer(t);break;case Tt.PK_END:this._onPKEnd(t)}}}),Object.defineProperty(t.prototype,"registerRoomPKEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_LIVING_PK_HANDLER_REGISTER_ROOM_PK_EVENT_LISTENER_O,JSON.stringify({listener:e&&Object.keys(e)})),this._appListener=e}}),Object.defineProperty(t.prototype,"requestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:t,inviteeUserId:r,options:i}),a),e.validate("inviteeRoomId",t,e.notEmptyString,!0)&&e.validate("inviteeUserId",r,e.notEmptyString,!0)?(s=Kn(),u=!e.isBoolean(null==i?void 0:i.autoMix)||(null==i?void 0:i.autoMix),l={inviteSessionId:s,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:u,inviteeRoomId:t,inviteeUserId:r,inviteeTimeoutTime:this._inviteTimeout,extra:(null==i?void 0:i.extra)||""},d={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:r,inviteTimeout:this._inviteTimeout,inviteInfo:JSON.stringify(l),inviteSessionId:s},[4,this._context.requestRoomPK(d)]):(this._logger.error(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(_=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:_}),a),[2,{code:_}]):(this._PKInfo[t]={inviteSessionId:s,inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviterUserAutoMix:u,inviteeRoomId:t},this._logger.info(n.L_LIVING_PK_HANDLER_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),a),[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"cancelRequestJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_T,JSON.stringify({inviteeRoomId:t,inviteeUserId:r,extra:i}),a),e.validate("inviteeRoomId",t,e.notEmptyString,!0)&&e.validate("inviteeUserId",r,e.notEmptyString,!0)?this._PKInfo[t]?(s={inviterRoomId:this._mainRoomId,inviterUserId:this._context.getCurrentId(),inviteeRoomId:t,inviteeUserId:r,extra:i||""},u={roomId:this._mainRoomId,invitedRoomId:t,invitedUserId:r,inviteSessionId:this._PKInfo[t].inviteSessionId,inviteInfo:JSON.stringify(s)},[4,this._context.cancelRoomPK(u)]):(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"The request to connect with ".concat(r," user in room ").concat(t," is not initiated")}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviteeRoomId or inviteeUserId"}),a),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(l=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:l}),a),[2,{code:l}]):(this._logger.info(n.L_LIVING_PK_HANDLER_CANCEL_REQUEST_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),a),delete this._PKInfo[t],[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"responseJoinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){return s(this,void 0,void 0,(function(){var s,u,l,d,_,p,f,h,b,R;return c(this,(function(c){switch(c.label){case 0:return s=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_T,JSON.stringify({inviterRoomId:t,inviterUserId:r,agree:i,options:a}),s),e.validate("inviterRoomId",t,e.notEmptyString,!0)&&e.validate("inviterUserId",r,e.notEmptyString,!0)?this._PKInfo[t]?(u=this._PKInfo[t],l=u.inviteSessionId,d=u.inviterUserAutoMix,_=!e.isBoolean(null==a?void 0:a.autoMix)||(null==a?void 0:a.autoMix),p={inviteSessionId:l,inviterRoomId:t,inviterUserId:r,inviterUserAutoMix:d,inviteeRoomId:this._mainRoomId,inviteeUserId:this._context.getCurrentId(),inviteeUserAutoMix:_},f=Object.assign(p,{inviterUserAutoMix:d}),h=i?Object.assign(p,{MultiRoomKey:"".concat(t,"|").concat(this._mainRoomId),MultiRoomValue:JSON.stringify(f)}):p,!e.isUndefined(null==a?void 0:a.extra)&&Object.assign(h,{extra:a.extra}),b={agree:i,roomId:this._mainRoomId,inviteSessionId:l,inviteRoomId:t,inviteUserId:r,content:JSON.stringify(h),key:"".concat(t,"|").concat(this._mainRoomId),value:JSON.stringify(p)},[4,this._context.responseRoomPK(b)]):(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"User ".concat(r," in room ").concat(t," did not send a request for connection")}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> inviterRoomId or inviterUserId"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(R=c.sent())!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:R}),s),[2,{code:R}]):(this._logger.info(n.L_LIVING_PK_HANDLER_RESPONSE_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),s),this._PKInfo[t].inviteeUserAutoMix=_,[2,{code:exports.RCRTCCode.SUCCESS}])}}))}))}}),Object.defineProperty(t.prototype,"joinOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_T,JSON.stringify({roomId:t}),r),e.validate("roomId",t,e.notEmptyString,!0)?this._context.getConnectionStatus()!==e.RCConnectionStatus.CONNECTED?(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_DISCONNECTED,msg:"IM disconnected"}),r),[2,{code:exports.RCRTCCode.SIGNAL_DISCONNECTED}]):this._joinedPKRooms[t]?(this._logger.warn(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):(i=exports.RCLivingType.VIDEO,a={extra:'{"roomId": "'.concat(this._mainRoomId,'"}')},[4,(s=new Wa(this._context,this._runtime,t,this._service,this._initOptions,i,!1,!1,this._clientSessionId)).__innerInit(exports.RTCMode.LIVE,void 0,i,a)]):(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.FAILED,code:u}),r),[2,{code:u}]):(this._joinedPKRooms[t]=s,[4,this._onJoinedPKRoom(t,r)]);case 2:return c.sent(),this._logger.info(n.L_LIVING_PK_HANDLER_JOIN_OTHER_ROOM_R,JSON.stringify({status:o.SUCCESSED}),r),[2,{room:s,code:exports.RCRTCCode.SUCCESS,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()}]}}))}))}}),Object.defineProperty(t.prototype,"leaveOtherRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){return r=this._logger.createTraceId(),this._logger.info(n.L_APP_CALL_LEAVE_PK_ROOM_O,void 0,r),[2,this._invoker.push(this.createLeaveOtherRoomCommand(e,t,r))]}))}))}}),Object.defineProperty(t.prototype,"getPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._PKInfo[e]}}),Object.defineProperty(t.prototype,"getAllPKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._PKInfo}}),Object.defineProperty(t.prototype,"getJoinedPKRooms",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._joinedPKRooms}}),t}();!function(e){e[e.OPEN=1]="OPEN",e[e.STOP=2]="STOP"}(xa||(xa={}));var Fa,Ja=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"cdnValues",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"enable",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.ENABLE_INNER_CDN},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return a=t.logger,s=t.context,u=this.enable,a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_T,JSON.stringify({roomId:r.roomId,enable:u})),r.isMainRoom?e.isBoolean(u)?(r.setCDNEnabel(u),l={version:2,output:{inCDNModel:u?xa.OPEN:xa.STOP}},[4,new Da(l,this.cdnValues).execute(t,r,i)]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> enable"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return(d=c.sent().code)!==exports.RCRTCCode.SUCCESS?(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:d,msg:"signal error"})),[2,{code:exports.RCRTCCode.SIGNAL_ERROR}]):(_=r.getCDNUris())&&_.broadcast!==Mo.SPREAD?(a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.SUCCESSED,enable:u})),[2,{code:exports.RCRTCCode.SUCCESS}]):[4,ta(s,r)];case 2:return(p=c.sent().code)===exports.RCRTCCode.SUCCESS?(a.info(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.SUCCESSED,enable:u})),[2,{code:exports.RCRTCCode.SUCCESS}]):(a.error(n.L_LIVING_ROOM_ENABLE_INNER_CDN_R,JSON.stringify({status:o.FAILED,code:p})),[2,{code:p}])}}))}))}}),i}(yo);!function(e){e[e.AnchorToViewer=1]="AnchorToViewer",e[e.ViewerToAnchor=2]="ViewerToAnchor"}(Fa||(Fa={}));var Ga,Ha,Ka=function(t){function i(e,r){var i=t.call(this)||this;return Object.defineProperty(i,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(i,"traceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),i}return r(i,t),Object.defineProperty(i.prototype,"kind",{get:function(){return ho.RTC_IDENTITY_CHANGE},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"execute",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){var n;return s(this,void 0,void 0,(function(){var o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return[4,t.context.rtcIdentityChange(r.roomId,Fa.ViewerToAnchor,this.livingType)];case 1:return o=c.sent(),a=o.code,s=o.data,a===e.ErrorCode.SUCCESS&&s?(r.initWithRoomData(s,this.traceId),r.getResourcesByUserId(r.crtUserId).length>0&&i.push(new Ao),(u=null===(n=s.roomInfo.filter((function(e){return"cdn_uris"===e.key}))[0])||void 0===n?void 0:n.value)&&r.setCDNUris(JSON.parse(u)[0]),[2,{code:a,data:s}]):[2,{code:a}]}}))}))}}),i}(yo),Wa=function(t){function i(e,r,i,n,o,a,s,c,u){var l=t.call(this,e,r,i,exports.RTCMode.LIVE,n,o,s,c,u)||this;return Object.defineProperty(l,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(l,"_mcuConfigBuilder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(l,"_roomPKHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),l._mcuConfigBuilder=new Ma(l._executeCtx,l._invoker,l._isValidResourceId.bind(l)),l}return r(i,t),Object.defineProperty(i.prototype,"_initRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(this._store.isMainRoom){var r=(i=this._roomId,n=e.roomInfo,o={},n.forEach((function(e){var t=JSON.parse(e.value),r=t.inviterRoomId,n=t.inviteeRoomId;o[i===r?n:r]=JSON.parse(e.value)})),o);this._roomPKHandler=new Va(this._invoker,r,this._context,this._runtime,this._service,this._initOptions,this,t.prototype._registerPKMsgListener.bind(this),this._onJoinedPKRoom.bind(this),this._clientSessionId)}var i,n,o}}),Object.defineProperty(i.prototype,"__innerInit",{enumerable:!1,configurable:!0,writable:!0,value:function(r,i,a,u,l,d){return s(this,void 0,void 0,(function(){var s,_,p;return c(this,(function(c){switch(c.label){case 0:return e.validate("livingType",a,(function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO}))?[4,t.prototype.__innerInit.call(this,r,i,a,u,l,d)]:(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType"}),d),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return s=c.sent(),_=s.code,p=s.data,_===exports.RCRTCCode.SUCCESS&&p&&this._initRoomPKHandler(p),[2,{code:_,data:p}]}}))}))}}),Object.defineProperty(i.prototype,"__innerInitByIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a;return c(this,(function(s){switch(s.label){case 0:return[4,this._invoker.push(new Ka(this._livingType,t))];case 1:return r=s.sent(),i=r.code,a=r.data,i===e.ErrorCode.SUCCESS&&a?(this._initRoomPKHandler(a),this._initWithRoomData(a.offlineKickTime),this._logger.info(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomData:a}),t)):this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:i}),t),[2,i]}}))}))}}),Object.defineProperty(i.prototype,"publish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._store.isMainRoom?[2,t.prototype.publish.call(this,e)]:(this._logger.error(n.L_ABSTRACT_ROOM_PUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(i.prototype,"unpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._store.isMainRoom?[2,t.prototype.unpublish.call(this,e)]:(this._logger.error(n.L_ABSTRACT_ROOM_UNPUBLISH_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}])}))}))}}),Object.defineProperty(i.prototype,"_isValidResourceId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=dt(e).userId,n=!!(null===(t=this._store.getResourcesByUserId(i))||void 0===t?void 0:t.find((function(t){return lt(t)===e}))),o=this.getRoomPKHandler(),a=o.code,s=o.roomPKHandler;if(a!==exports.RCRTCCode.SUCCESS||!s)return n;var c=s.getJoinedPKRooms(),u=[];return Object.values(c).forEach((function(e){u.push.apply(u,d([],l(e.getRemoteTracks()),!1))})),r=u.some((function(t){return e===t.getTrackId()})),n||r}}),Object.defineProperty(i.prototype,"getLivingType",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._livingType}}),Object.defineProperty(i.prototype,"getMCUConfigBuilder",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?this._mcuConfigBuilder:(this._logger.error(n.L_LIVING_ROOM_GET_MCU_CONFIG_BUILDER_O,"the `getMCUConfigBuilder` is disabled in PK room"),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}}),Object.defineProperty(i.prototype,"enableInnerCDN",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){return c(this,(function(t){return[2,this._invoker.push(new Ja(this._mcuConfigBuilder.__innerGetValues(),e))]}))}))}}),Object.defineProperty(i.prototype,"_resourceHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i,n,o){return s(this,void 0,void 0,(function(){return c(this,(function(a){return t.prototype._resourceHandle.call(this,e,r,i,n,o),[2]}))}))}}),Object.defineProperty(i.prototype,"__getCDNEnable",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return!!(null===(e=this._store.getCDNUris())||void 0===e?void 0:e.enableInnerCDN)}}),Object.defineProperty(i.prototype,"__getCDNPushMode",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return null===(e=this._store.getCDNUris())||void 0===e?void 0:e.push_mode}}),Object.defineProperty(i.prototype,"_onJoinedPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(r){return this._invoker.push(new ja(e,this._roomPKHandler,t)),[2]}))}))}}),Object.defineProperty(i.prototype,"_getPushOtherRoomsParams",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];if(!this.isMainRoom()||!this._roomPKHandler)return e;var t=this._roomPKHandler.getJoinedPKRooms();for(var r in t){var i=t[r].getSessionId(),n=this._roomPKHandler.getPKInfo(r);if(n){var o=n.inviterUserAutoMix,a=n.inviteeUserAutoMix,s=n.inviterUserId,c=this._context.getCurrentId()===s;e.push({roomId:r,sessionId:i,autoMix:c?!!o:!!a})}}return e}}),Object.defineProperty(i.prototype,"getRoomPKHandler",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom?(this._logger.info(n.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:o.SUCCESSED})),{code:exports.RCRTCCode.SUCCESS,roomPKHandler:this._roomPKHandler}):(this._logger.error(n.L_LIVING_ROOM_GET_ROOM_PK_HANDLER_O,JSON.stringify({status:o.SUCCESSED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"method not available in PK room"})),{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM})}}),Object.defineProperty(i.prototype,"_quitAllPKRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t;return c(this,(function(r){for(t in e=this._roomPKHandler.getJoinedPKRooms())this._roomPKHandler.leaveOtherRoom(e[t]);return this._logger.info(n.L_LIVING_ROOM_QUIT_ALL_PK_ROOM_O,JSON.stringify({status:o.SUCCESSED,roomIds:Object.keys(e)})),[2]}))}))}}),Object.defineProperty(i.prototype,"isMainRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._store.isMainRoom}}),i}(wa),Ya=function(e){function t(t,r,i,n,o,a,s){return void 0===a&&(a=exports.RTCMode.RTC),void 0===s&&(s=!1),e.call(this,t,r,i,a,n,o,!1,!1,Kn(),s)||this}return r(t,e),t}(wa),za=function(){function e(){Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"locked",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"taskCount",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(e.prototype,"checkToStart",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e,t,r,i,n,o;return c(this,(function(a){switch(a.label){case 0:if(0===this.queue.length||this.locked)return[2];this.locked=!0,e=this.queue.shift(),t=e.resolve,r=e.task,i=e.reject,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r()];case 2:return n=a.sent(),t(n),[3,4];case 3:return o=a.sent(),i(o),[3,4];case 4:return this.locked=!1,this.checkToStart(),[2]}}))}))}}),Object.defineProperty(e.prototype,"push",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=new Promise((function(t,i){r.queue.push({resolve:t,task:e,reject:i})}));return this.checkToStart(),i}}),e}(),qa=new za,Qa=function(e,t){return void 0===t&&(t=""),qa.push(e,t)},Za=function(){function t(e,t,r){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_rtcToken",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_liveUrl",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_subTracks",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:Kn()}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_livingType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_mediaType",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_subTiny",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_fromRetry",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._crtUserId=this._context.getCurrentId(),this._service=new Qn(t,e,r.mediaServer),this._logger=this._context.logger,this._store=new No(this._logger,this._clientSessionId,this._context.getAppkey(),this._crtUserId,this._crtUserId,exports.RTCMode.LIVE)}return Object.defineProperty(t.prototype,"_getReqHeaders",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o;return c(this,(function(a){switch(a.label){case 0:return r=this._crtUserId,this._rtcToken?[3,2]:[4,this._context.getRTCToken(r,exports.RTCMode.LIVE,t)];case 1:if(i=a.sent(),n=i.code,o=i.data,n!==e.ErrorCode.SUCCESS)return[2,{code:exports.RCRTCCode.SIGNAL_ERROR}];this._rtcToken=o.rtcToken,a.label=2;case 2:return[2,{code:exports.RCRTCCode.SUCCESS,headers:{"App-Key":this._context.getAppkey(),UserId:this._crtUserId,RoomId:r,RoomType:exports.RTCMode.LIVE,Token:this._rtcToken,"Client-Session-Id":this._clientSessionId}}]}}))}))}}),Object.defineProperty(t.prototype,"_clearSubscribeInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._liveUrl="",this._livingType=null,this._mediaType=null,this._subTiny=!1,this._subTracks.length=0,null===(e=this._pc)||void 0===e||e.destroy(),this._pc=null}}),Object.defineProperty(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return this._fromRetry=!0,[4,this.subscribe(this._liveUrl,this._livingType,this._mediaType,this._subTiny)];case 1:return(t=r.sent().code)===exports.RCRTCCode.SUCCESS&&(null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer()),[2,{code:t}]}}))}))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var n=this;return c(this,(function(o){return[2,Qa((function(){return n.__subscribe(e,t,r,i)}),"audience-client-sub")]}))}))}}),Object.defineProperty(t.prototype,"__subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,a){var u;return void 0===a&&(a=!1),s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h,b,R,g,m,C,v,O=this;return c(this,(function(c){switch(c.label){case 0:return this._logger.info(n.L_AUDIENCE_CLIENT_SUBSCRIBE_T,JSON.stringify({liveUrl:t,livingType:r,mediaType:i,subTiny:a})),s=[],St(this._context.getNaviInfo())?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"})),[2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,tracks:s}]):(!this._fromRetry&&(null===(u=this._pc)||void 0===u||u.clearReTryExchangeTimer()),this._fromRetry=!1,e.isString(t)?[exports.RCLivingType.AUDIO,exports.RCLivingType.VIDEO].includes(r)?[exports.RCMediaType.AUDIO_ONLY,exports.RCMediaType.VIDEO_ONLY,exports.RCMediaType.AUDIO_VIDEO].includes(i)?this._liveUrl&&this._liveUrl!==t?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,msg:"repeat subscribe"})),[2,{code:exports.RCRTCCode.BROADCAST_SUB_LIST_NOT_EMPTY,tracks:s}]):(this._pc||(this._pc=new Eo(this._logger,this._reTryExchange.bind(this),this._crtUserId,this._store,void 0,!1),this._pc.on(Eo.__INNER_EVENT_TRACK_READY__,this._onTrackReady,this),this._pc.registerReportListener(this._reportListener),this._pc.__reportR3R4ToPolaris()),this._liveUrl=t,[4,this._getReqHeaders(r)]):(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> -> mediaType: ".concat(i)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]):(this._logger.error("livingType is invalid: ".concat(r)),this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> livingType: ".concat(r)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]):(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> liveUrl: ".concat(t)})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:s}]));case 1:return l=c.sent(),d=l.code,_=l.headers,d!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:d,msg:"getRTCToken failed"})),[2,{code:d,tracks:s}]):(p="rc_mcu_".concat(Date.now()),f="RongCloudRTC",0===this._subTracks.length&&(this._subTracks.push(new rt(this._logger,f,p),new it(this._logger,f,p)),this._pc.updateSubRemoteTracks(this._subTracks.slice())),[4,this._pc.createOffer(!0)]);case 2:return h=c.sent(),b={sdp:h,liveUrl:t,mediaType:i,simulcast:a?Gn.TINY:Gn.NORMAL,switchstream:!1},[4,this._service.broadcastSubscribe(_,b)];case 3:return(R=c.sent()).code!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:R.code})),[2,{code:R.code,tracks:s}]):(g=R.data).resultCode!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:g.resultCode,msg:g.message})),[2,{code:g.resultCode,tracks:s}]):(this._livingType=r,this._mediaType=i,this._subTiny=a,m=g.sdp,C=g.subscribedList,this._subscribedList=C,v=[],C.forEach((function(e){var t=e.mediaType,r=O._subTracks[t];v.push(r),r.__innerSetRemoteMuted(!0)})),this._pc.setRemoteAnswer(m.sdp),v&&this._updateTrackIdSSRCMap(m.sdp,v),this._logger.info(n.L_AUDIENCE_CLIENT_SUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,liveUrl:t})),[2,{code:exports.RCRTCCode.SUCCESS,tracks:v}])}}))}))}}),Object.defineProperty(t.prototype,"_updateTrackIdSSRCMap",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this;t.forEach((function(t){var i=t.getTrackId(),n=dt(i).mediaType,o=r._subscribedList.filter((function(e){return e.mediaType===n}))[0].msid,a=aa(e,o,n);r._store.setTrackIdSSRCMap(Number(a),i)}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return[2,Qa((function(){return e.__unsubscribe()}),"audience-client-unsub")]}))}))}}),Object.defineProperty(t.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return s(this,void 0,void 0,(function(){var t,r;return c(this,(function(i){switch(i.label){case 0:return this._logger.info(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_T,JSON.stringify({liveUrl:this._liveUrl})),null===(e=this._pc)||void 0===e||e.clearReTryExchangeTimer(),this._rtcToken&&this._liveUrl?[4,this._getReqHeaders()]:(this._logger.warn(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:"",msg:"Address does not exist, without unsubscribe"})),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return t=i.sent().headers,[4,this._service.broadcastExit(t)];case 2:return(r=i.sent().code)!==exports.RCRTCCode.SUCCESS?this._logger.error(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:r})):(this._logger.info(n.L_AUDIENCE_CLIENT_UNSUBSCRIBE_R,JSON.stringify({status:o.SUCCESSED,liveUrl:this._liveUrl})),this._subscribedList=[]),this._clearSubscribeInfo(),[2,{code:r}]}}))}))}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"registerTrackEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(t.prototype,"_onTrackReady",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r,i=e.receiver.track,o="audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY,a=this._subTracks[o];a.__innerSetMediaStreamTrack(i);try{this._logger.info(n.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,"trackId: ".concat(a.getTrackId())),null===(r=null===(t=this._appListener)||void 0===t?void 0:t.onTrackReady)||void 0===r||r.call(t,a)}catch(e){this._logger.error(n.L_AUDIENCE_CLIENT_CALL_ONTRACKREADY_O,JSON.stringify(e))}}}),t}();exports.RCInnerCDNPullKind=void 0,(Ga=exports.RCInnerCDNPullKind||(exports.RCInnerCDNPullKind={})).RTMP="rtmp",Ga.FLV="flv",Ga.HLS="hls",exports.RCInnerCDNPullIsHttps=void 0,(Ha=exports.RCInnerCDNPullIsHttps||(exports.RCInnerCDNPullIsHttps={}))[Ha.NOT_HTTPS=0]="NOT_HTTPS",Ha[Ha.HTTPS=1]="HTTPS";var Xa,$a=a(a({},bt(exports.RCResolution.W176_H144)),{frameRate:mt(exports.RCFrameRate.FPS_15)}),es=function(){function t(e,t,r,i,n,o,a){void 0===a&&(a=Kn());var u=this;Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_initOptions",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_roomId",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_joinResData",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"livingType",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_clientSessionId",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_roomAnchorList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_roomRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_roomAnchorRes",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_remoteTracks",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_appListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_pc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_subscribedList",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_sessionId",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"_destroyed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_polarisReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_audioLevelReport",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_CDNUris",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isPulling",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_pullTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_store",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_crtUserId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportMediaActionLogger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_trackMediaMap",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_reportListener",{enumerable:!0,configurable:!0,writable:!0,value:null}),this._logger=this._context.logger,this._crtUserId=this._context.getCurrentId(),this._polarisReport=new Na(this._context,this._runtime,this._roomId,this,Oa.Audience),this._reportMediaActionLogger=new Ia(this._logger,this._roomId,this._clientSessionId,this._crtUserId),this._service=new Qn(this._runtime,this._context,this._initOptions.mediaServer,this._initOptions.timeout);var l=this._store=new No(this._logger,a,e.getAppkey(),i,this._crtUserId,exports.RTCMode.LIVE),d=this._pc=new Eo(this._logger,this._reTryExchange.bind(this),this._crtUserId,l,this._polarisReport,!0);this._audioLevelReport=new Io(this._store,d),d.on(Eo.__INNER_AUDIOLEVEL_CHANGE__,this._audioLevelReport.audioLevelReport,this._audioLevelReport),this._polarisReport.sendR1(),this._context.registerRTCSignalListener((function(e){return s(u,void 0,void 0,(function(){var t,r,i,n;return c(this,(function(o){return t=this._context.decodeRtcNotify(e),r=t.time,i=t.type,n=t.roomId,1===i&&this._startPull(n,r),[2]}))}))})),this._setInitData()}return Object.defineProperty(t.prototype,"_startPull",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return this._isPulling?[2]:(this._isPulling=!0,this._pullTime>r?(this._isPulling=!1,[2]):(i=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_T,"pullTime: ".concat(this._pullTime),i),[4,this._context.pullRTCRoomEntry(t)]));case 1:return a=c.sent(),s=a.code,u=a.data,s===e.ErrorCode.SUCCESS&&(this._isPulling=!1,this._pullTime=(null==u?void 0:u.syncTime)||0,l=(null==u?void 0:u.kvEntries)||[],this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(o.SUCCESSED,", kvEntries: ").concat(JSON.stringify(l)),i),this.singalDataChange(l,t,i)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_PULL_KVENTRIES_R,"status: ".concat(o.FAILED,", code: ").concat(s),i),[2]}}))}))}}),Object.defineProperty(t.prototype,"_setInitData",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=function(e,t,r){var i=t.filter((function(e){return"RC_RTC_SESSIONID"===e.key}))[0],n=i?i.value:"",o=t.filter((function(e){return"RC_ANCHOR_LIST"===e.key})).map((function(e){return JSON.parse(e.value||"[]")}))[0],a=t.filter((function(e){return e.key.includes("RC_RES_")})).map((function(e){return JSON.parse(e.value||"{}")})),s=a.length?JSON.parse(a[0].mcu_uris||"[]"):[],c=[];s.forEach((function(t){var i=t.mediaType,n=t.tag,o=i===exports.RCMediaType.AUDIO_ONLY?new rt(r,n,"",e):new it(r,n,"",e);c.push(o)}));var u=[],_=[];a.forEach((function(e){var t=JSON.parse(e.uris||"[]");u.push.apply(u,d([],l(t),!1)),t.forEach((function(e){var t=e.mediaType,i=e.tag,n=e.msid.split("_");n.pop();var o=n.join("_"),a=t===exports.RCMediaType.AUDIO_ONLY?new rt(r,i,o):new it(r,i,o);_.push(a)}))}));var p=t.filter((function(e){return"RC_CDN"===e.key})).map((function(e){var t=JSON.parse(e.value||"[]");return JSON.parse(t.cdn_uris)[0]}))[0];return{sessionId:n,remoteUserIds:o||[],remoteRTCUris:u,remoteMUCUris:s,remoteRTCTracks:_,remoteMCUTracks:c,remoteTracks:d(d([],l(_),!1),l(c),!1),CDNUris:p||{}}}(this._roomId,this._joinResData.kvEntries,this._logger),r=t.sessionId,i=t.remoteUserIds,n=t.remoteRTCUris,o=t.remoteMUCUris,a=t.remoteTracks,s=t.CDNUris;this._sessionId=r,this._roomAnchorList=i,a.forEach((function(t){e._remoteTracks[t.getTrackId()]=t})),this._CDNUris=s,n.forEach((function(t){var r=t.msid.split("_")[0];e._roomAnchorRes[r]?e._roomAnchorRes[r].push(t):e._roomAnchorRes[r]=[t];var i=JSON.parse(t.uri),n=i.ssrc,o=i.resourceId;e._store.setTrackIdSSRCMap(n,o)})),o.forEach((function(t){var r=t.mediaType,i=t.tag,n=[e._roomId,i,r].join("_");e._roomRes[n]=t;var o=JSON.parse(t.uri).ssrc;e._store.setTrackIdSSRCMap(o,n)})),n.forEach((function(t){var r=lt(t);e._roomRes[r]=t}))}}),Object.defineProperty(t.prototype,"_assertRoomDestroyed",{enumerable:!1,configurable:!0,writable:!0,value:function(){if(this._destroyed)return exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}}),Object.defineProperty(t.prototype,"singalDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,a=this;if(t===this._roomId){var s=[],c=null===(i=e.filter((function(e){return"RC_CDN"===e.key}))[0])||void 0===i?void 0:i.value;c&&this._diffCDNUris(JSON.parse(JSON.parse(c).cdn_uris)[0],r),e.forEach((function(e){var t=e.key,i=e.value,n=e.uid;if(-1!==t.indexOf("RC_RES_")){var o=JSON.parse(i||"{}"),c=JSON.parse(o.mcu_uris||"[]"),u=JSON.parse(o.uris||"[]");return s.push.apply(s,d([],l(c),!1)),void a._diffAnchorResource(u,n,r)}if("RC_ANCHOR_LIST"===t){var _=JSON.parse(i||"[]");a._diffAnchorList(_,r)}})),this._diffRoomResource(s,r)}else this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SINGAL_DATA_CHANGE_P,JSON.stringify({status:o.FAILED,msg:"roomId inconsistency -> params roomId:".concat(t,", current roomId:").concat(this._roomId)}),r)}}),Object.defineProperty(t.prototype,"_diffAnchorList",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=this,i=e.filter((function(e){return r._roomAnchorList.indexOf(e)<0})),n=this._roomAnchorList.filter((function(t){return e.indexOf(t)<0}));i.length>0&&this._handleNewJoinedAnchor(i,t),n.length>0&&this._handleLeftedAnchor(n,t)}}),Object.defineProperty(t.prototype,"_handleNewJoinedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r;(r=this._roomAnchorList).push.apply(r,d([],l(e),!1)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorJoin",list:e}),t),this._callAppListener("onAnchorJoin",e)}}),Object.defineProperty(t.prototype,"_handleLeftedAnchor",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i=this;return c(this,(function(o){switch(o.label){case 0:return this._roomAnchorList=this._roomAnchorList.filter((function(t){return!e.includes(t)})),r=[],e.forEach((function(e){r.push.apply(r,d([],l(i.getRemoteTracksByUserId(e)),!1)),delete i._roomAnchorRes[e]})),r.length?[4,this.unsubscribe(r)]:[3,2];case 1:o.sent(),r.forEach((function(e){return delete i._remoteTracks[e.getTrackId()]})),o.label=2;case 2:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorLeave",list:e}),t),this._callAppListener("onAnchorLeave",e),[2]}}))}))}}),Object.defineProperty(t.prototype,"_diffRoomResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o,a=this;return c(this,(function(s){return r=[],i=[],o=[],e.forEach((function(e){var t=lt(e),i=dt(t),n=i.tag,s=i.mediaType,c=[a._roomId,n,s].join("_"),u=JSON.parse(e.uri).ssrc;if(a._store.setTrackIdSSRCMap(u,c),!a._remoteTracks[c]){var l=s===exports.RCMediaType.AUDIO_ONLY?new rt(a._logger,n,"",a._roomId):new it(a._logger,n,"",a._roomId);r.push(l),a._remoteTracks[c]=l,a._roomRes[l.getTrackId()]=e}o.push(c)})),Object.keys(this._remoteTracks).forEach((function(e){o.indexOf(e)<0&&a._remoteTracks[e].isMCUTrack()&&i.push(a._remoteTracks[e])})),r.length>0&&(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackPublish",trackIds:r.map((function(e){return e.getTrackId()}))}),t),this._callAppListener("onTrackPublish",r)),i.length>0&&this._onUserUnpublish(i,"onTrackUnpublish",t),[2]}))}))}}),Object.defineProperty(t.prototype,"_dealPublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return i=e.map(lt),a=[],s=[],t.forEach((function(t){var r=lt(t),n=i.indexOf(r),o=dt(r),c=o.userId,u=o.tag,l=o.mediaType,_=JSON.parse(t.uri).ssrc;d._store.setTrackIdSSRCMap(_,r),n>-1?e[n]=t:e.push(t);var p=d._remoteTracks[r];d._roomRes[r]=t,p?p.isSubscribed()&&a.push(p):(p=l===exports.RCMediaType.AUDIO_ONLY?new rt(d._logger,u,c):new it(d._logger,u,c),d._remoteTracks[r]=p,s.push(p)),p.__innerSetRemoteMuted(0===t.state)})),a.length?(u=a.map((function(e){return e.getTrackId()})),[4,Qa((function(){return d._subscribeHandle(a,!0)}))]):[3,2];case 1:(l=c.sent().code)!==exports.RCRTCCode.SUCCESS&&this._logger.error(n.L_RESUB_REPUB_RES_R,JSON.stringify({status:o.FAILED,trackIds:u,code:l})),c.label=2;case 2:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onAnchorTrackPublish",trackIds:s.map((function(e){return e.getTrackId()}))}),r),this._callAppListener("onAnchorTrackPublish",s),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealUnpublished",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s=this;return c(this,(function(c){switch(c.label){case 0:for(i=t.map(lt),n=e.length-1;n>=0;n-=1)o=e[n],i.includes(lt(o))&&e.splice(n,1);return a=t.map((function(e){var t=lt(e);return s._remoteTracks[t]})),[4,this._onUserUnpublish(a,"onAnchorTrackUnpublish",r)];case 1:return c.sent(),[2]}}))}))}}),Object.defineProperty(t.prototype,"_dealModified",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,o,a=e.map(lt);try{for(var s=u(t),c=s.next();!c.done;c=s.next()){var l=c.value,d=lt(l);e[a.indexOf(d)].state=l.state;var _=this._remoteTracks[d];_.__innerSetRemoteMuted(0===l.state);var p=_.isAudioTrack()?"onAudioMuteChange":"onVideoMuteChange";this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:p,trackId:_.getTrackId()}),r),this._callAppListener(p,_)}}catch(e){i={error:e}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}}),Object.defineProperty(t.prototype,"_diffAnchorResource",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this._roomAnchorRes[t]||(this._roomAnchorRes[t]=[]),n=ft(i,e),o=n.publishedList,a=n.unpublishedList,s=n.modifiedList,o.length?[4,this._dealPublished(i,o,r)]:[3,2];case 1:c.sent(),c.label=2;case 2:return a.length?[4,this._dealUnpublished(i,a,r)]:[3,4];case 3:c.sent(),c.label=4;case 4:return s.length&&this._dealModified(i,s,r),[2]}}))}))}}),Object.defineProperty(t.prototype,"_onUserUnpublish",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i=this;return c(this,(function(o){switch(o.label){case 0:return[4,this.unsubscribe(e)];case 1:return o.sent(),e.forEach((function(e){i._subscribedList=i._subscribedList.filter((function(t){return t.track.getTrackId()!==e.getTrackId()})),delete i._roomRes[e.getTrackId()],e.__innerDestroy(),delete i._remoteTracks[e.getTrackId()]})),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:t,trackIds:e.map((function(e){return e.getTrackId()}))}),r),this._callAppListener(t,e),[2]}}))}))}}),Object.defineProperty(t.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];var o=null===(t=this._appListener)||void 0===t?void 0:t[e];if(o)try{o.apply(void 0,d([],l(r),!1))}catch(e){this._logger.error(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify(e))}}}),Object.defineProperty(t.prototype,"_reTryExchange",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var e=this;return c(this,(function(t){return[2,Qa((function(){return s(e,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return[4,this._createSubscribeParams(this._subscribedList,{},!0)];case 1:return e=c.sent().reqBody,[4,this._exchangeHandle(e)];case 2:return(t=c.sent()).code!==exports.RCRTCCode.SUCCESS?[2,{code:t.code}]:(r=t.data,i=r.sdp,(n=r.resultCode)!==exports.RCRTCCode.SUCCESS?[2,{code:n}]:(this._pc.clearReTryExchangeTimer(),(o=this._subscribedList.filter((function(e){return e.track.isMCUTrack()}))).length>0&&(a=o[0].track.getTrackId(),s=null===(l=this._roomRes[a])||void 0===l?void 0:l.msid,u=[this._roomId,"RongCloudRTC"].join("_"),i.sdp=i.sdp.replace(new RegExp(s,"g"),u)),[4,this._pc.setRemoteAnswer(i.sdp)]));case 3:return[2,{code:c.sent()}]}}))}))}),"audience-retry-exchange")]}))}))}}),Object.defineProperty(t.prototype,"_createSubscribeParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a=this;return c(this,(function(s){switch(s.label){case 0:return[4,this._pc.createOffer(r)];case 1:return i=s.sent(),n={resolutionInfo:[]},o={min:0,max:0},Object.keys(t).forEach((function(e){var r=t[e];[r.mediaStream,r.tinyStream].forEach((function(t,r){var a,s=1===r?[e,"tiny"].join("_"):e;i.sdp=null===(a=i.sdp)||void 0===a?void 0:a.replace(new RegExp(t.id,"g"),s);var c=t.getVideoTracks()[0];if(c){var u=0===r,l=u?ct(c):$a,d=l.width,_=l.height,p=l.frameRate;n.resolutionInfo.push({trackId:c.id,simulcast:u?Gn.NORMAL:Gn.TINY,resolution:"".concat(d,"x").concat(_)});var f=De(d,_),h=Ue(p);o.min+=f.minBitrate*h,o.max+=f.maxBitrate*h}}))})),[2,{reqBody:{sdp:i,switchstream:!1,newVersionFlag:!0,subscribeList:e.map((function(e){return{simulcast:e.subTiny?Gn.TINY:Gn.NORMAL,resolution:"",uri:a._roomRes[e.track.getTrackId()].uri}}))},dynamicBitrate:o,offer:i}]}}))}))}}),Object.defineProperty(t.prototype,"_subscribeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return void 0===r&&(r=!1),void 0===i&&(i=!1),s(this,void 0,void 0,(function(){var s,u,l,d,_,p;return c(this,(function(c){return s=Date.now(),u=i?Yo.SUB:void 0,l=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_T,JSON.stringify({trackIds:t.map(Lt),forceReq:r}),l),this._assertRoomDestroyed()?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),l),this._reportPubOrSubQualityData(s,t,exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,u),[2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}]):e.validate("tracks",t,(function(){return e.isArray(t)&&t.length>0&&t.every((function(e){return e instanceof tt||e.track instanceof tt}))}),!0)?(this._pc.__reportR3R4ToPolaris(),this._pc.registerReportListener(this._reportListener),this._addPeerCEvent(),d=this._subscribedList.map((function(e){return a({},e)})),_=t.map((function(e){return e instanceof tt?{track:e}:e})),p=[],_.forEach((function(e){var t=e.track.getTrackId();p.push(t);var r=d.find((function(e){return e.track.getTrackId()===t}));r&&r.subTiny===e.subTiny||(r?r.subTiny=e.subTiny:d.push(e))})),this._polarisReport.sendR2(ko.SUBSCRIBE,Uo.BEGIN,p),[2,this._updateSubListHandle(d,l,s,u,!0)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_SUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),l),this._reportPubOrSubQualityData(s,t,exports.RCRTCCode.PARAMS_ERROR,u),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"_addPeerCEvent",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this;this._pc.on(Eo.__INNER_EVENT_TRACK_READY__,(function(t){var r=t.streams[0].id,i=t.receiver.track,o=[r,"audio"===i.kind?exports.RCMediaType.AUDIO_ONLY:exports.RCMediaType.VIDEO_ONLY].join("_"),a=e._remoteTracks[o];a?(a.__innerSetMediaStreamTrack(i),e._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onTrackReady",trackId:a.getTrackId()})),e._callAppListener("onTrackReady",a)):e._logger.warn(n.L_AUDIENCE_LIVING_ROOM_ONTRACKREADY_O,"cannot found RCRemoteTrack: ".concat(i.id))})),this._pc.once(Eo.__INNER_ICE_CONNECTED__,(function(){e._reportMediaActionLogger.reportIceFirstConnectData("sub")}),this),this._pc.on(Eo.__INNER_ICE_STATE_CHANGE__,(function(t){var r=t.status,i=t.time,n=t.iceCandidatePair;n&&e._reportMediaActionLogger.recordQualityIceStatusData(n,r,i)}))}}),Object.defineProperty(t.prototype,"_getReqHeaders",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._crtUserId;return{"App-Key":this._context.getAppkey(),RoomId:e,Token:this._joinResData.token,RoomType:exports.RTCMode.LIVE,UserId:e,"Session-Id":this._sessionId,"Client-Session-Id":this._clientSessionId}}}),Object.defineProperty(t.prototype,"_exchangeHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._service.broadcastSubscribe(this._getReqHeaders(),e)}}),Object.defineProperty(t.prototype,"_dealSubscribeResult",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){var i,a=this,s=null==t?void 0:t.map((function(e){return"".concat(e.msid,"_").concat(e.mediaType)})),c=e.filter((function(e){if(e.track.isMCUTrack()){var t=a._roomRes[e.track.getTrackId()],r="".concat(t.msid,"_").concat(t.mediaType);return s.includes(r)}return null==s?void 0:s.includes(e.track.getTrackId())})),u=null==c?void 0:c.map((function(e){return"".concat(e.track.getTrackId())})),_=e.filter((function(e){return!(null==u?void 0:u.includes(e.track.getTrackId()))})),p=function(e){var t=c.some((function(t){return t.track.getTrackId()===e}));f._remoteTracks[e].__innerSetSubscribed(t)},f=this;for(var h in this._remoteTracks)p(h);return(i=this._subscribedList).splice.apply(i,d([0,this._subscribedList.length],l(c),!1)),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.SUCCESSED,subSuccessTrackIds:s,failedList:_}),r),_}}),Object.defineProperty(t.prototype,"_getParams",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=e.map((function(e){return e instanceof tt?{track:e}:a({},e)})),r={};return t=t.filter((function(e){var t=e.track.getTrackId();return!r[t]&&(r[t]=!0,!0)})).map((function(e){return a({},e)}))}}),Object.defineProperty(t.prototype,"_reportPubOrSubQualityData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){i&&this._reportMediaActionLogger.reportPubOrSubQualityData(i,e,t,r,this._trackMediaMap)}}),Object.defineProperty(t.prototype,"_updateSubListHandle",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,u){var l;return void 0===u&&(u=!1),s(this,void 0,void 0,(function(){var s,d,_,p,f,h,b,R,g,m,C,v,O=this;return c(this,(function(c){switch(c.label){case 0:return this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_T,JSON.stringify({trackIds:e.map(Lt),forceReq:u}),t),s=this._getParams(e),d=this._subscribedList.map((function(e){return a({},e)})),u||sa(s,d)?(this._pc.clearReTryExchangeTimer(),this._pc.updateSubRemoteTracks(s.map((function(e){return e.track}))),[4,this._createSubscribeParams(s,{},!1)]):(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.SUCCESSED,msg:"repeat subscribe"}),t),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return _=c.sent().reqBody,[4,this._exchangeHandle(_)];case 2:return p=c.sent(),d.length&&(f=[],d.forEach((function(e){f.push(e.track.getTrackId())})),null===(l=this._pc.reportParser)||void 0===l||l.clearLatestPacketsRecv(f)),e.forEach((function(e){var t=e instanceof tt?e.getTrackId():e.track.getTrackId();O._trackMediaMap[t]=p.qualityMsList||[]})),p.code!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(r,e,p.code,i),this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:p.code}),t),[2,{code:p.code}]):(h=p.data,b=h.sdp,R=h.resultCode,g=h.message,m=h.subscribedList,R!==exports.RCRTCCode.SUCCESS?(this._reportPubOrSubQualityData(r,e,R,i),this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:R,msg:g}),t),[2,{code:R}]):(s.forEach((function(e){var t=e.track;if(t.isMCUTrack()){var r=O._roomRes[t.getTrackId()].msid,i=dt(t.getTrackId()),n=i.tag,o=[i.userId,n].join("_");b.sdp=b.sdp.replace(new RegExp(r,"g"),o)}})),[4,this._pc.setRemoteAnswer(b.sdp)]));case 3:return C=c.sent(),this._reportPubOrSubQualityData(r,e,C,i),C!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UPDATE_SUBSCRIBELIST_R,JSON.stringify({status:o.FAILED,code:C,msg:"set remote answer error"}),t),[2,{code:C}]):[2,(v=this._dealSubscribeResult(s,m,t)).length?{code:exports.RCRTCCode.SUCCESS,failedList:v}:{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(t.prototype,"_diffCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,o;return c(this,(function(a){return this._CDNUris.url&&!e.url?(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoDisable"}),t),this._callAppListener("onCDNInfoDisable"),this._CDNUris=e,[2]):((!this._CDNUris||!this._CDNUris.url&&e.url)&&(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoEnable",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoEnable",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),r=this._CDNUris.w&&e.w&&this._CDNUris.w!==e.w,i=this._CDNUris.h&&e.h&&this._CDNUris.h!==e.h,o=this._CDNUris.fps&&e.fps&&this._CDNUris.fps!==e.fps,(r||i||o)&&(this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O,JSON.stringify({eventType:"onCDNInfoChange",resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)}),t),this._callAppListener("onCDNInfoChange",{resolution:"W".concat(e.w,"_H").concat(e.h),fps:"FPS_".concat(e.fps)})),this._CDNUris=e,[2])}))}))}}),Object.defineProperty(t.prototype,"_getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l,d,_,p,f,h,b,R,g,m,C;return c(this,(function(c){switch(c.label){case 0:return r=e.w,i=e.h,a=e.fps,s=this._initOptions.pullInnerCDNProtocol||exports.RCInnerCDNPullKind.FLV,u=this._initOptions.pullInnerCDNUseHttps===exports.RCInnerCDNPullIsHttps.NOT_HTTPS?exports.RCInnerCDNPullIsHttps.NOT_HTTPS:exports.RCInnerCDNPullIsHttps.HTTPS,this._CDNUris.url?(l={"App-Key":this._context.getAppkey(),Token:this._joinResData.token,RoomId:this.getRoomId(),UserId:this._crtUserId,SessionId:this.getSessionId()},d=[],_=this._CDNUris,p=_.w,f=void 0===p?0:p,h=_.h,f/(void 0===h?1:h)>1?(r&&d.push("w=".concat(r)),i&&d.push("h=".concat(i))):(r&&d.push("h=".concat(r)),i&&d.push("w=".concat(i))),a&&d.push("fps=".concat(a)),d.push("kind=".concat(s)),d.push("is_https=".concat(u)),b=d.join("&"),R="".concat(this._CDNUris.url,"?"),b&&(R+=b),[4,this._service.getCDNResourceInfo(l,R,t)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY,msg:"cdn_uris url is empty, the anchor need to open or push CDN"}),t),[2,{code:exports.RCRTCCode.CDN_RESOURCE_IS_EMPTY}]);case 1:return g=c.sent(),m=g.code,C=g.res,m!==exports.RCRTCCode.SUCCESS?[2,{code:m}]:[2,{code:m,CDNPlayUrl:null==C?void 0:C.data.pull_url}]}}))}))}}),Object.defineProperty(t.prototype,"getCDNPlayUrl",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){return r=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_T,JSON.stringify({resolution:e,fps:t}),r),e&&!Rt(e)?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> resolution"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):t&&!gt(t)?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_GET_CDN_PLAY_URL_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> fps"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(i=e?bt(e):{width:null,height:null},a=i.width,s=i.height,u=t?mt(t):null,l={},a&&(l.w=a),s&&(l.h=s),u&&(l.fps=u),[2,this._getCDNPlayUrl(l,r)])}))}))}}),Object.defineProperty(t.prototype,"subscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,Qa((function(){return t._subscribeHandle(e,!1,!0)}),"audience-sub")]}))}))}}),Object.defineProperty(t.prototype,"__unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,s,u;return c(this,(function(c){return r=Date.now(),i=Yo.UNSUB,s=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_T,JSON.stringify({trackIds:t.map((function(e){return e.getTrackId()}))}),s),this._assertRoomDestroyed()?(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED,msg:"room destroyed"}),s),[2,{code:exports.RCRTCCode.ROOM_HAS_BEEN_DESTROYED}]):e.validate("tracks",t,(function(){return e.isArray(t)&&t.length>0&&t.every((function(e){return e instanceof tt}))}),!0)?(u=this._subscribedList.map((function(e){return a({},e)})).filter((function(e){return t.every((function(t){return t.getTrackId()!==e.track.getTrackId()}))})),this._polarisReport.sendR2(ko.SUBSCRIBE,Uo.END,t.map((function(e){return e.getTrackId()}))),[2,this._updateSubListHandle(u,s,r,i,!1)]):(this._logger.error(n.L_AUDIENCE_LIVING_ROOM_UNSUBSCRIBE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> tracks"}),s),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"unsubscribe",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t=this;return c(this,(function(r){return[2,Qa((function(){return t.__unsubscribe(e)}),"audience-unsub")]}))}))}}),Object.defineProperty(t.prototype,"__destroy",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return s(this,void 0,void 0,(function(){return c(this,(function(r){switch(r.label){case 0:return this._destroyed?[2]:(this._destroyed=!0,e?[4,this._context.quitLivingRoomAsAudience(this._roomId)]:[3,2]);case 1:r.sent(),r.label=2;case 2:return[4,this._service.broadcastExit(this._getReqHeaders())];case 3:return r.sent(),null===(t=this._pc)||void 0===t||t.destroy(),this._context.registerRTCSignalListener(),[2]}}))}))}}),Object.defineProperty(t.prototype,"getRemoteTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._remoteTracks[e]}}),Object.defineProperty(t.prototype,"getLocalTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return{}}}),Object.defineProperty(t.prototype,"__onReconnected",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_T,void 0,t),[4,this._context.joinLivingRoomAsAudience(this._roomId,exports.RTCMode.LIVE)];case 1:return r.sent().code!==e.ErrorCode.SUCCESS&&this._logger.error(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(o.FAILED),t),this._logger.info(n.L_AUDIENCE_LIVING_ROOM_IM_RECONNECTED_R,"status: ".concat(o.SUCCESSED),t),[2]}}))}))}}),Object.defineProperty(t.prototype,"registerRoomEventListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._appListener=e}}),Object.defineProperty(t.prototype,"onAudioLevelChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){this._logger.info(n.L_AUDIENCE_LIVING_ROOM_CALL_APP_LISTENER_O),this._audioLevelReport.onAudioLevelChange(e)}}),Object.defineProperty(t.prototype,"registerReportListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._reportListener=e}}),Object.defineProperty(t.prototype,"getRoomId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomId}}),Object.defineProperty(t.prototype,"getCrtUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._crtUserId}}),Object.defineProperty(t.prototype,"getSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._sessionId}}),Object.defineProperty(t.prototype,"getRemoteUserIds",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._roomAnchorList}}),Object.defineProperty(t.prototype,"getRemoteTracksByUserId",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=[];for(var r in this._remoteTracks){var i=this._remoteTracks[r];i.getUserId()===e&&t.push(i)}return t}}),Object.defineProperty(t.prototype,"getRemoteTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this,t=[],r=[];for(var i in this._remoteTracks){if(2===r.length)break;var n=this._remoteTracks[i];n.isMCUTrack()&&r.push(n)}return this._roomAnchorList.forEach((function(r){t.push.apply(t,d([],l(e.getRemoteTracksByUserId(r)),!1))})),d(d([],l(r),!1),l(t),!1)}}),Object.defineProperty(t.prototype,"getRemoteRTCTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()||e.push(r)}return e}}),Object.defineProperty(t.prototype,"getRemoteMCUTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=[];for(var t in this._remoteTracks){var r=this._remoteTracks[t];r.isMCUTrack()&&e.push(r)}return e}}),Object.defineProperty(t.prototype,"getCDNInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._CDNUris.w?{resolution:"W".concat(this._CDNUris.w,"_H").concat(this._CDNUris.h),fps:"FPS_".concat(this._CDNUris.fps),CDNEnable:this._CDNUris.enableInnerCDN}:{CDNEnable:!1}}}),Object.defineProperty(t.prototype,"getClientSessionId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._clientSessionId}}),t}();!function(e){e[e.AUTOMATIC=0]="AUTOMATIC",e[e.MANUAL=1]="MANUAL"}(Xa||(Xa={}));var ts,rs,is=function(){function t(e){Object.defineProperty(this,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_isElectron",{enumerable:!0,configurable:!0,writable:!0,value:/Electron/.test(navigator.userAgent)}),this._logger=e.logger}return Object.defineProperty(t.prototype,"_getMediaStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===t&&(t="getUserMedia"),s(this,void 0,void 0,(function(){var r,i,o;return c(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),r=this.setConstraintsConfig(e),[4,navigator.mediaDevices[t](r)];case 1:return i=a.sent(),[2,{code:exports.RCRTCCode.SUCCESS,stream:i}];case 2:return o=a.sent(),this._logger.error(n.L_GET_MEDIA_STREAM_E,JSON.stringify({name:o.name,message:o.message})),"Permission denied"===o.message?[2,{code:exports.RCRTCCode.BROWSER_PERMISSION_DENIED}]:"Permission denied by system"===o.message?[2,{code:exports.RCRTCCode.SYSTEM_PERMISSION_DENIED}]:[3,3];case 3:return[2,{code:"getUserMedia"===t?exports.RCRTCCode.GET_USER_MEDIA_FAILED:exports.RCRTCCode.GET_DISPLAY_MEDIA_FAILED}]}}))}))}}),Object.defineProperty(t.prototype,"_getMediaStreamErrorReason",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t="";return e===exports.RCRTCCode.BROWSER_PERMISSION_DENIED&&(t="Permission denied"),e===exports.RCRTCCode.SYSTEM_PERMISSION_DENIED&&(t="Permission denied by system"),t}}),Object.defineProperty(t.prototype,"setConstraintsConfig",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t,r;if((null==e?void 0:e.audio)&&!this._isElectron){"boolean"==typeof e.audio&&(e.audio={});var i=null===(r=(t=navigator.mediaDevices).getSupportedConstraints)||void 0===r?void 0:r.call(t);(null==i?void 0:i.noiseSuppression)&&(e.audio.noiseSuppression=!!i.noiseSuppression),(null==i?void 0:i.autoGainControl)&&(e.audio.autoGainControl=!!i.autoGainControl),(null==i?void 0:i.echoCancellation)&&(e.audio.echoCancellation=!!i.echoCancellation),this._logger.info(n.L_SET_AUDIO_CONSTRAINTS_O,"browser supported -> ".concat(JSON.stringify(i)))}return e}}),Object.defineProperty(t.prototype,"createMicrophoneAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return at(e)?(r=this._context.getCurrentId())?[4,this._getMediaStream({audio:{deviceId:null==t?void 0:t.micphoneId,sampleRate:null==t?void 0:t.sampleRate,noiseSuppression:null==t?void 0:t.noiseSuppression,echoCancellation:null==t?void 0:t.echoCancellation,autoGainControl:null==t?void 0:t.autoGainControl}})]:(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return i=c.sent(),a=i.stream,(s=i.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:s,msg:this._getMediaStreamErrorReason(s)})),[2,{code:s}]):(u=a.getAudioTracks()[0],l=new Ze(this._logger,e,r,u),this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AUDIO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:l.getTrackId()})),[2,{code:s,track:l}])}}))}))}}),Object.defineProperty(t.prototype,"createCameraVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var r,i,a,s,u,l,d,_,p,f;return c(this,(function(c){switch(c.label){case 0:return at(e)?(r=this._context.getCurrentId())?(i=Rt(null==t?void 0:t.resolution)?t.resolution:exports.RCResolution.W640_H480,a=bt(i),s=a.width,u=a.height,[4,this._getMediaStream({video:{deviceId:null==t?void 0:t.cameraId,frameRate:mt((null==t?void 0:t.frameRate)||exports.RCFrameRate.FPS_15),width:s,height:u,facingMode:null==t?void 0:t.faceMode}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return l=c.sent(),d=l.stream,(_=l.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:_,msg:this._getMediaStreamErrorReason(_)})),[2,{code:_}]):(p=d.getVideoTracks()[0],f=new Xe(this._logger,e,r,p),this._logger.info(n.L_RTC_CLIENT_CREATE_CAMERA_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:f.getTrackId()})),[2,{code:_,track:f}])}}))}))}}),Object.defineProperty(t.prototype,"createMicrophoneAndCameraTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r,i,a,u;return void 0===e&&(e="RongCloudRTC"),s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h,b,R,g,m=this;return c(this,(function(c){switch(c.label){case 0:return s=[],at(e)?(l=this._context.getCurrentId())?(d=Rt(null===(r=null==t?void 0:t.video)||void 0===r?void 0:r.resolution)?t.video.resolution:exports.RCResolution.W640_H480,_=bt(d),p=_.width,f=_.height,h=null==t?void 0:t.audio,[4,this._getMediaStream({video:{deviceId:null===(i=null==t?void 0:t.video)||void 0===i?void 0:i.cameraId,frameRate:mt((null===(a=null==t?void 0:t.video)||void 0===a?void 0:a.frameRate)||exports.RCFrameRate.FPS_15),width:p,height:f,facingMode:null===(u=null==t?void 0:t.video)||void 0===u?void 0:u.faceMode},audio:{deviceId:null==h?void 0:h.micphoneId,sampleRate:null==h?void 0:h.sampleRate,noiseSuppression:null==h?void 0:h.noiseSuppression,echoCancellation:null==h?void 0:h.echoCancellation,autoGainControl:null==h?void 0:h.autoGainControl}})]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:s}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:s}]);case 1:return b=c.sent(),R=b.stream,(g=b.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.FAILED,code:g,msg:this._getMediaStreamErrorReason(g)})),[2,{code:g,tracks:s}]):(R.getTracks().forEach((function(t){"video"===t.kind?s.push(new Xe(m._logger,e,l,t)):s.unshift(new Ze(m._logger,e,l,t))})),this._logger.info(n.L_RTC_CLIENT_CREATE_MICROPHONE_AND_CAMERA_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:s.map((function(e){return e.getTrackId()}))})),[2,{code:g,tracks:s}])}}))}))}}),Object.defineProperty(t.prototype,"createScreenVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return[4,this._createScreenTracks(e,!1,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,t)];case 1:return(r=i.sent()).code===exports.RCRTCCode.SUCCESS?[2,{code:r.code,track:r.tracks[0]}]:[2,r]}}))}))}}),Object.defineProperty(t.prototype,"createScreenWithAudioTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return void 0===e&&(e="screenshare"),s(this,void 0,void 0,(function(){return c(this,(function(r){return[2,this._createScreenTracks(e,!0,n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_AND_AUDIO_TRACKS_O,t)]}))}))}}),Object.defineProperty(t.prototype,"_createScreenTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){var a,s,u,l,d,_,p,f,h,b,R,g;return c(this,(function(c){switch(c.label){case 0:return at(e)?(a=this._context.getCurrentId())?Ot()?(s=/macintosh|mac os x/i.test(navigator.userAgent),u=(!this._isElectron||!s)&&t,l=Rt(null==i?void 0:i.resolution)?i.resolution:exports.RCResolution.W1280_H720,this._isElectron?[4,this._createElectronScreenStream(t,r,l,null==i?void 0:i.chromeMediaSourceId)]:[3,2]):(this._logger.error(n.L_RTC_CLIENT_CREATE_SCREEN_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),[2,{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT}]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}]);case 1:return f=c.sent(),[3,4];case 2:return[4,this._createWebScreenStream(t,l,null==i?void 0:i.frameRate)];case 3:f=c.sent(),c.label=4;case 4:return _=(d=f).stream,(p=d.code)!==exports.RCRTCCode.SUCCESS?(this._logger.error(r,JSON.stringify({status:o.FAILED,code:p,msg:this._getMediaStreamErrorReason(p)})),[2,{code:p}]):(h=_.getVideoTracks()[0],b=new $e(this._logger,e,a,h),R=[b],u&&(g=_.getAudioTracks()[0])&&R.push(new et(this._logger,e,a,g)),this._logger.info(r,JSON.stringify({status:o.SUCCESSED,trackIds:R.map((function(e){return e.getTrackId()}))})),[2,{code:p,tracks:R}])}}))}))}}),Object.defineProperty(t.prototype,"_createElectronScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){var a,u;return s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h;return c(this,(function(c){return s=/macintosh|mac os x/i.test(navigator.userAgent),this._isElectron&&s&&t&&this._logger.warn(r,JSON.stringify({status:o.INFO,code:exports.RCRTCCode.MAC_IN_ELECTRON_NOT_SUPPORT_SCREEN_SHARE_WITH_AUDIO,msg:"mac in electron not support screen share with audio"})),l=(!this._isElectron||!s)&&t,!this._isElectron||e.isUndefined(n)||e.isString(n)?(d=bt(i),_=d.width,p=d.height,f={mandatory:{chromeMediaSourceId:n,chromeMediaSource:"desktop",minWidth:_,maxWidth:_,minHeight:p,maxHeight:p}},!n&&this._isElectron&&(null===(a=f.mandatory)||void 0===a||delete a.chromeMediaSourceId),h=null,l&&this._isElectron&&(null===(u=f.mandatory)||void 0===u||delete u.chromeMediaSourceId,h={mandatory:{chromeMediaSource:"desktop"}}),[2,this._getMediaStream({video:f,audio:h||l},"getUserMedia")]):(this._logger.error(r,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> options.chromeMediaSourceId type is string"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR}])}))}))}}),Object.defineProperty(t.prototype,"_createWebScreenStream",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i,n,o,a;return c(this,(function(s){return i=bt(t),n=i.width,o=i.height,a={frameRate:mt(r||exports.RCFrameRate.FPS_15),width:n,height:o},[2,this._getMediaStream({video:a,audio:e},"getDisplayMedia")]}))}))}}),Object.defineProperty(t.prototype,"createLocalAudioTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){return at(e)?t&&"[object MediaStreamTrack]"===t.toString()&&"audio"===t.kind?(r=this._context.getCurrentId())?(i=new We(this._logger,e,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:i.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not audio"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_AUDIO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"createLocalVideoTrack",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i;return c(this,(function(a){return at(e)?t&&t instanceof MediaStreamTrack&&"video"===t.kind?(r=this._context.getCurrentId())?(i=new Ye(this._logger,e,r,t),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.SUCCESSED,trackId:i.getTrackId()})),[2,{code:exports.RCRTCCode.SUCCESS,track:i}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,msg:"params track is not MediaStreamTrack or kind is not video"})),[2,{code:exports.RCRTCCode.CREATE_CUSTOM_TRACK_FAILED}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS}])}))}))}}),Object.defineProperty(t.prototype,"_validateCreateLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(!at(t))return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),{code:exports.RCRTCCode.INVALID_TAGS,tracks:[]};if(!vt())return this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,msg:"browser not support"})),{code:exports.RCRTCCode.BROWSER_NOT_SUPPORT,tracks:[]};var i=r instanceof File?URL.createObjectURL(r):r;return e.isHttpUrl(i)||/^blob:/.test(i)?this._context.getCurrentId()?{code:exports.RCRTCCode.SUCCESS,tracks:[],url:i}:(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),{code:exports.RCRTCCode.INVALID_USER_ID,tracks:[]}):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> file"})),{code:exports.RCRTCCode.PARAMS_ERROR,tracks:[]})}}),Object.defineProperty(t.prototype,"createLocalFileTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){return s(this,void 0,void 0,(function(){var a,s,u=this;return c(this,(function(c){return(a=this._validateCreateLocalFileTracks(e,r)).code!==exports.RCRTCCode.SUCCESS?[2,a]:(s=this._context.getCurrentId(),[2,new Promise((function(r){var c=document.createElement("video");(null==i?void 0:i.withoutAudio)&&(c.muted=!0),c.onloadedmetadata=function(){var a,d=[];try{var _=c.mozCaptureStream?"mozCaptureStream":"captureStream";a=c[_]()}catch(e){u._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"captureSteam error -> ".concat(JSON.stringify(e))})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:d})}var p=l(t.getTracksWithOptions(a,i),2),f=p[0],h=p[1];f&&d.push(new Qe(u._logger,e,s,f,c)),h&&d.push(new qe(u._logger,e,s,h,c)),0===d.length&&(c.pause(),c.src=""),c.onerror=null,u._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:d.map((function(e){return e.getTrackId()}))})),r({code:exports.RCRTCCode.SUCCESS,tracks:d})},c.onerror=function(){u._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_FILE_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,msg:"Failed to create file stream, video onerror"})),r({code:exports.RCRTCCode.CREATE_FILE_TRACK_FAILED,tracks:[]})},c.src=a.url,c.loop=!0,c.play()}))])}))}))}}),Object.defineProperty(t.prototype,"createLocalTracks",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){return s(this,void 0,void 0,(function(){var a,s,u,d,_;return c(this,(function(c){return a=[],at(e)?r instanceof MediaStream?(s=this._context.getCurrentId())?(u=l(t.getTracksWithOptions(r,i),2),d=u[0],_=u[1],d&&a.push(new We(this._logger,e,s,d)),_&&a.push(new Ye(this._logger,e,s,_)),this._logger.info(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.SUCCESSED,trackIds:a.map((function(e){return e.getTrackId()}))})),[2,{code:exports.RCRTCCode.SUCCESS,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_USER_ID,msg:"invalid IM connection,invalid userId"})),[2,{code:exports.RCRTCCode.INVALID_USER_ID,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> stream"})),[2,{code:exports.RCRTCCode.PARAMS_ERROR,tracks:a}]):(this._logger.error(n.L_RTC_CLIENT_CREATE_LOCAL_TRACKS_O,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.INVALID_TAGS,msg:"invalid tag"})),[2,{code:exports.RCRTCCode.INVALID_TAGS,tracks:a}])}))}))}}),Object.defineProperty(t,"getTracksWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){var r=[];return r[0]=(null==t?void 0:t.withoutAudio)?void 0:e.getAudioTracks()[0],r[1]=(null==t?void 0:t.withoutVideo)?void 0:e.getVideoTracks()[0],r}}),t}(),ns=function(t){function i(e,r,i){var n=t.call(this,e)||this;return Object.defineProperty(n,"_context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(n,"_runtime",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(n,"_options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(n,"_service",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(n,"_crtRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"_audience",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(n,"_crtAudienceLivingRoom",{enumerable:!0,configurable:!0,writable:!0,value:null}),go.setSdpSemantics(i.sdpSemantics||"unified-plan",n._logger),n._service=new Qn(n._runtime,n._context,n._options.mediaServer,n._options.timeout),n._context.registerConnectionStateChangeListener(n._onIMStatusChange.bind(n)),n._context.registerDestroyListener(n._onIMUninit.bind(n)),n._context.registerMessageListener(n._handleMessage.bind(n)),n._context.getPluginContext().onnavidatachange=n.naviDataChange.bind(n),n}return r(i,t),Object.defineProperty(i.prototype,"_handleMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(t.conversationType!==e.ConversationType.RTC_ROOM)return!1;var r=this._logger.createTraceId();this._crtRoom instanceof Wa&&this._getJoinedPKRoomList().forEach((function(e){e.__parseInnerMessage(t,r)}));return this._logger.info(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:o.SUCCESSED,message:t}),r),this._crtRoom?(this._crtRoom.__parseInnerMessage(t,r),!0):(this._logger.warn(n.L_RTC_CLIENT_MESSAGE_O,JSON.stringify({status:o.FAILED,message:"the crtRoom is empty"}),r),!0)}}),Object.defineProperty(i.prototype,"naviDataChange",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this._logger.info(n.L_RTC_CLIENT_NAVI_CHANGE_O,"on navi change data => ".concat(JSON.stringify(e))),this._service.clearMSList(),this._service.isNededDetector()&&this._service.detectorMediaSever()}}),Object.defineProperty(i.prototype,"_getJoinedPKRoomList",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this._crtRoom.getRoomPKHandler(),t=e.code,r=e.roomPKHandler;if(t===exports.RCRTCCode.SUCCESS&&r){var i=r.getJoinedPKRooms()||{};return Object.values(i)}return[]}}),Object.defineProperty(i.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this._context.getCurrentId()}}),Object.defineProperty(i.prototype,"joinCrossRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return void 0===n&&(n=exports.RTCMode.CROSS_MUTI),s(this,void 0,void 0,(function(){return c(this,(function(i){return console.warn("joinCrossRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{joinType:t,userData:r,mode:exports.RTCMode.CROSS_MUTI})]}))}))}}),Object.defineProperty(i.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return void 0===n&&(n=exports.RTCMode.RTC),s(this,void 0,void 0,(function(){return c(this,(function(i){return console.warn("joinRTCRoom is deprecated, use joinRTCRoomWithOptions instead"),[2,this.joinRTCRoomWithOptions(e,{mode:n,joinType:t,userData:r})]}))}))}}),Object.defineProperty(i.prototype,"joinRTCRoomWithOptions",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r,i,a,s=this;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_RTC_ROOM_T,JSON.stringify({roomId:e,options:t}),r),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_RTC_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(i=this._crtRoom=new Ya(this._context,this._runtime,e,this._service,this._options,null==t?void 0:t.mode,null==t?void 0:t.encrypt)).__innerInit((null==t?void 0:t.mode)||exports.RTCMode.RTC,null==t?void 0:t.joinType,void 0,void 0,null==t?void 0:t.userData,r)];case 1:return(a=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:a}]):(i.once(Aa,(function(){s._crtRoom=null})),[2,{code:a,room:i,userIds:i.getRemoteUserIds(),tracks:i.getRemoteTracks()}])}}))}))}}),Object.defineProperty(i.prototype,"joinLivingRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,a){return s(this,void 0,void 0,(function(){var a,s,u,l,d=this;return c(this,(function(c){switch(c.label){case 0:return a=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_T,JSON.stringify({roomId:e,livingType:t,joinType:r,outerUserDatas:i}),a),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly -> roomId: ".concat(e)}),a),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(s=this._crtRoom=new Wa(this._context,this._runtime,e,this._service,this._options,t,!1,!0)).__innerInit(exports.RTCMode.LIVE,r,t,void 0,i,a)];case 1:return(u=c.sent().code)!==exports.RCRTCCode.SUCCESS?(this._crtRoom=null,[2,{code:u}]):(s.once(Aa,(function(){d._crtRoom=null})),l={code:u,room:s,userIds:s.getRemoteUserIds(),tracks:s.getRemoteTracks()},s.__getCDNPushMode()===Xa.MANUAL&&Object.assign(l,{CDNEnable:s.__getCDNEnable()}),[2,l])}}))}))}}),Object.defineProperty(i.prototype,"getAudienceClient",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this._audience||(this._audience=new Za(this._context,this._runtime,this._options)),this._logger.info(n.L_RTC_CLIENT_GET_AUDIENCE_CLIENT_O),this._audience}}),Object.defineProperty(i.prototype,"_onIMStatusChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){if(this._logger.info(n.L_RTC_CLIENT_IM_CONNECTION_STATE_S,JSON.stringify({status:t,code:r,desc:e.RCConnectionStatus[t]})),t===e.RCConnectionStatus.SUSPENDED&&r===e.ErrorCode.RC_CONN_REDIRECTED&&this._service.clearMSList(),t===e.RCConnectionStatus.DISCONNECTED){if(this._crtRoom){var i=exports.RCKickReason.IM_DISCONNECTED;r===e.ErrorCode.RC_DISCONN_KICK?i=exports.RCKickReason.OTHER_CLIENT_IM_CONNECTED:2===r&&(i=exports.RCKickReason.IM_LOGOUT),this._crtRoom.__kickoff(!0,{users:[{userId:this._context.getCurrentId(),type:i}]})}}else if(t===e.RCConnectionStatus.CONNECTED){if(this._service.isNededDetector()&&this._service.detectorMediaSever(),this._crtRoom instanceof Wa)this._getJoinedPKRoomList().forEach((function(e){e.__onReconnected()}));this._crtRoom&&this._crtRoom.__onReconnected()}}}),Object.defineProperty(i.prototype,"_onIMUninit",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;this._logger.info(n.L_RTC_CLIENT_DESTROY_S,JSON.stringify({msg:"TODO -> on IM client ondestroy"})),null===(e=this._crtRoom)||void 0===e||e.__destroy(!0)}}),Object.defineProperty(i.prototype,"leaveRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t;return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_T,JSON.stringify({roomId:e.getRoomId()}),r),this._crtRoom?[4,this._crtRoom.__destroy(!0)]:(this._logger.warn(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:o.FAILED,msg:"Room does not exist, without leave"}),r),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return i.sent(),this._service.isNededDetector()&&this._service.detectorMediaSever(),this._logger.info(n.L_RTC_CLIENT_LEAVE_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomId:null===(t=this._crtRoom)||void 0===t?void 0:t.getRoomId()}),r),this._crtRoom=null,[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var i,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return i=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:t,livingType:r}),i),this._service.isNededDetector()&&this._service.detectorMediaSever(),St(this._context.getNaviInfo())?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR,msg:"package environment error"}),i),[2,{code:exports.RCRTCCode.PACKAGE_ENVIRONMENT_ERROR}]):e.validate("roomId",t,e.notEmptyString,!0)&&e.validate("livingType",r,(function(e){return e===exports.RCLivingType.AUDIO||e===exports.RCLivingType.VIDEO}))?this._crtAudienceLivingRoom?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),i),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):this._service.getMsList().length?[4,this._context.joinLivingRoomAsAudience(t,exports.RTCMode.LIVE,r)]:(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER,msg:"No audio / video server address available"}),i),[2,{code:exports.RCRTCCode.NOT_OPEN_VIDEO_AUDIO_SERVER}]):(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> roomId or livingType"}),i),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return a=c.sent(),s=a.code,u=a.data,s!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:s,msg:"signal error -> audience join room"}),i),[2,{code:exports.RCRTCCode.SIGNAL_AUDIENCE_JOIN_ROOM_FAILED}]):(l=Kn(),d=new es(this._context,this._runtime,this._options,t,u,r,l),this._crtAudienceLivingRoom=d,this._logger.info(n.L_RTC_CLIENT_JOIN_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.SUCCESSED,roomData:u}),i),[2,{room:d,code:exports.RCRTCCode.SUCCESS,userIds:d.getRemoteUserIds(),RTCTracks:d.getRemoteRTCTracks(),MCUTracks:d.getRemoteMCUTracks(),CDNUris:d.getCDNInfo()}])}}))}))}}),Object.defineProperty(i.prototype,"leaveLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_T,JSON.stringify({roomId:e.getRoomId(),userId:this._context.getCurrentId()}),t),this._crtAudienceLivingRoom?this._crtAudienceLivingRoom!==e?(this._logger.error(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),t),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):[4,this._crtAudienceLivingRoom.__destroy(!0)]:(this._logger.warn(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.FAILED,msg:"Room does not exist, without leave"}),t),[2,{code:exports.RCRTCCode.SUCCESS}]);case 1:return r.sent(),this._crtAudienceLivingRoom=null,this._logger.info(n.L_RTC_CLIENT_LEAVE_LIVING_ROOM_AS_AUDIENCE_R,JSON.stringify({status:o.SUCCESSED}),t),[2,{code:exports.RCRTCCode.SUCCESS}]}}))}))}}),Object.defineProperty(i.prototype,"upgradeToAnchorRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l=this;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_T,void 0,r),e.validate("room",t,(function(){return t instanceof es}),!0)?(i=t.getRoomId(),this._crtRoom?(this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly",roomId:i}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,(a=this._crtRoom=new Wa(this._context,this._runtime,i,this._service,this._options,t.livingType,!0,!0,t.getClientSessionId())).__innerInitByIdentityChange(r)]):(this._logger.error(n.L_RTC_CLIENT_UPGRADE_TO_ANCHOR_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]);case 1:return(s=c.sent())!==e.ErrorCode.SUCCESS?(this._crtRoom=null,[2,{code:s}]):(a.once(Aa,(function(){l._crtRoom=null})),[4,this._crtAudienceLivingRoom.__destroy(!1)]);case 2:return c.sent(),this._crtAudienceLivingRoom=null,u={room:a,code:exports.RCRTCCode.SUCCESS,userIds:a.getRemoteUserIds(),tracks:a.getRemoteTracks()},a.__getCDNPushMode()===Xa.MANUAL&&Object.assign(u,{CDNEnable:a.__getCDNEnable()}),[2,u]}}))}))}}),Object.defineProperty(i.prototype,"downgradeToAudienceRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return r=this._logger.createTraceId(),this._logger.info(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_T,JSON.stringify({roomId:t._roomId,userId:this._context.getCurrentId()}),r),t.isMainRoom()?e.validate("room",t,(function(){return t instanceof Wa}),!0)?this._crtAudienceLivingRoom?(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.REPERT_JOIN_ROOM,msg:"Join the room repeatedly"}),r),[2,{code:exports.RCRTCCode.REPERT_JOIN_ROOM}]):[4,this._context.rtcIdentityChange(t._roomId,Fa.AnchorToViewer,t.getLivingType())]:(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.PARAMS_ERROR,msg:"params error -> room"}),r),[2,{code:exports.RCRTCCode.PARAMS_ERROR}]):(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM,msg:"the `downgradeToAudienceRoom` is disabled in PK room"}),r),[2,{code:exports.RCRTCCode.THE_FUNCTION_IS_DISABLED_IN_PKROOM}]);case 1:return i=c.sent(),a=i.code,s=i.data,a!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.FAILED,code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}),r),[2,{code:exports.RCRTCCode.SIGNAL_ROOM_CHANGE_IDENTITY_FAILED}]):(this._logger.info(n.L_RTC_CLIENT_DOWNGRADE_TO_AUDIENCE_ROOM_R,JSON.stringify({status:o.SUCCESSED,roomData:s}),r),u=t.getClientSessionId(),l=new es(this._context,this._runtime,this._options,t._roomId,s,t.getLivingType(),u),this._crtAudienceLivingRoom=l,this._crtRoom.__destroy(!1),this._crtRoom=null,[2,{room:l,code:exports.RCRTCCode.SUCCESS,userIds:l.getRemoteUserIds(),RTCTracks:l.getRemoteRTCTracks(),MCUTracks:l.getRemoteMCUTracks(),CDNUris:l.getCDNInfo()}])}}))}))}}),Object.defineProperty(i.prototype,"getJoinedRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return s(this,void 0,void 0,(function(){var t,r,i,a,s;return c(this,(function(c){switch(c.label){case 0:return t=this._logger.createTraceId(),r=this._context.getCurrentId(),this._logger.error(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_T,JSON.stringify({userId:r}),t),[4,this._context.getRTCJoinedUserInfo(r)];case 1:return i=c.sent(),a=i.code,s=i.data,a!==e.ErrorCode.SUCCESS?(this._logger.error(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:o.FAILED,code:a}),t),[2,{code:a}]):(this._logger.info(n.L_RTC_CLIENT_GET_JOINED_ROOM_INFO_R,JSON.stringify({status:o.SUCCESSED,roomInfo:s}),t),[2,{code:exports.RCRTCCode.SUCCESS,data:s}])}}))}))}}),i}(is);exports.RTCJoinType=void 0,(ts=exports.RTCJoinType||(exports.RTCJoinType={}))[ts.KICK=0]="KICK",ts[ts.REFUSE=1]="REFUSE",ts[ts.COEXIST=2]="COEXIST";var os,as="rtcRJoin_data",ss="rtcRExit",cs="rtcRInfo",us="rtcUData",ls="rtcUDel",ds="rtcSetData",_s="userSetData",ps="rtcQryData",fs="rtcDelData",hs="rtcToken",bs="rtcUserState",Rs="rtcUList",gs="viewerJoinR",ms="viewerExitR",Cs="rtcPullKv",vs="rtcIdentityChange",Os="rtcInvite",Ts="rtcCancelInvite",Es="rtcInviteAnswer",Is="rtcEndInvite",Ss="rtcQueryJoined",ys="rtcPullRoomStatus",Ls="reportsdk",Ps="rtcPing";!function(e){e.RtcInput="RtcInput",e.RtcOutput="RtcOutput",e.RtcUserListOutput="RtcUserListOutput",e.SetUserStatusInput="SetUserStatusInput",e.RtcSetDataInput="RtcSetDataInput",e.RtcUserSetDataInput="RtcUserSetDataInput",e.RtcDataInput="RtcDataInput",e.RtcSetOutDataInput="RtcSetOutDataInput",e.MCFollowInput="MCFollowInput",e.RtcTokenOutput="RtcTokenOutput",e.RtcQryOutput="RtcQryOutput",e.RtcQryUserOutDataInput="RtcQryUserOutDataInput",e.RtcUserOutDataOutput="RtcUserOutDataOutput",e.RtcQueryListInput="RtcQueryListInput",e.RtcRoomInfoOutput="RtcRoomInfoOutput",e.RtcValueInfo="RtcValueInfo",e.RtcKeyDeleteInput="RtcKeyDeleteInput",e.RtcNotifyMsg="RtcNotifyMsg",e.RtcPullKV="RtcPullKV",e.RtcKVOutput="RtcKVOutput",e.RtcQueryUserJoinedInput="RtcQueryUserJoinedInput",e.RtcQueryUserJoinedOutput="RtcQueryUserJoinedOutput",e.RtcViewerJoinedOutput="RtcViewerJoinedOutput",e.RtcInviteInput="RtcInviteInput",e.RtcCancelInviteInput="RtcCancelInviteInput",e.RtcInviteAnswerInput="RtcInviteAnswerInput",e.RtcEndInviteInput="RtcEndInviteInput",e.RtcRoomStatusInput="RtcRoomStatusInput",e.RtcRoomStatusOutput="RtcRoomStatusOutput",e.RtcReportSDKInput="RtcReportSDKInput",e.RtcPBPolaris="RCRTCPBPolaris",e.RtcPBR1Info="RCRTCPBR1Info",e.RtcPBR2Info="RCRTCPBR2Info",e.RtcPBR3Info="RCRTCPBR3Info",e.RtcPBR4Info="RCRTCPBR4Info",e.RtcPBStatusInfo="RCRTCPBStatusInfo",e.RtcPBStreamInfo="RCRTCPBStreamInfo"}(os||(os={}));var Ns,As=((rs={})[os.RtcInput]=["roomType","broadcastType","extraInnerData","needSysChatroom","identityChangeType","joinType","innerDatas","outerDatas","supportNtf"],rs[os.RtcOutput]=["version"],rs[os.RtcUserListOutput]=["users","token","sessionId","roomInfo","version"],rs[os.SetUserStatusInput]=["status"],rs[os.RtcSetDataInput]=["interior","target","key","value","objectName","content"],rs[os.RtcUserSetDataInput]=["valueInfo","objectName","content"],rs[os.RtcDataInput]=["interior","target","key","objectName","content"],rs[os.RtcSetOutDataInput]=["target","valueInfo","objectName","content"],rs[os.MCFollowInput]=["state"],rs[os.RtcTokenOutput]=["rtcToken"],rs[os.RtcQryOutput]=["outInfo"],rs[os.RtcQryUserOutDataInput]=["userId"],rs[os.RtcUserOutDataOutput]=["user"],rs[os.RtcQueryListInput]=["order"],rs[os.RtcRoomInfoOutput]=["roomId","roomData","userCount","list"],rs[os.RtcValueInfo]=["key","value"],rs[os.RtcKeyDeleteInput]=["key"],rs[os.RtcNotifyMsg]=["type","time","roomId"],rs[os.RtcPullKV]=["timestamp","roomId"],rs[os.RtcKVOutput]=["entries","bFullUpdate","syncTime"],rs[os.RtcQueryUserJoinedInput]=["userId"],rs[os.RtcQueryUserJoinedOutput]=["info"],rs[os.RtcInviteInput]=["invitedUserId","timeoutTime","invitedRoomId","inviteInfo","inviteSessionId"],rs[os.RtcCancelInviteInput]=["invitedUserId","invitedRoomId","inviteInfo","inviteSessionId"],rs[os.RtcInviteAnswerInput]=["inviteUserId","answerCode","inviteRoomId","inviteSessionId","content","key","value"],rs[os.RtcEndInviteInput]=["inviteRoomId","inviteSessionId","inviteContent","inviteRoomKeys"],rs[os.RtcRoomStatusInput]=["version"],rs[os.RtcRoomStatusOutput]=["bFullStatus","version","usersData","roomStatus"],rs[os.RtcReportSDKInput]=["sdkInfo"],rs[os.RtcPBPolaris]=["type","appKey","sessionId","roomId","roomCreateTime","userId","userRole","joinTime","signalDataCenter","r1Info","r2Info","r3Info","r4Info"],rs[os.RtcPBR1Info]=["joinTime","rtcVersion","imVersion","platform","device","os","browserName","browserVersion"],rs[os.RtcPBR2Info]=["joinTime","sendTime","rtcActionType","rtcActionStatus","trackId"],rs[os.RtcPBR3Info]=["info"],rs[os.RtcPBR4Info]=["info"],rs[os.RtcPBStatusInfo]=["joinTime","receiveTime","totalBitRate","appCPUUsage","systemCPUUsage","systemCPUFrequency","networkStatus","googleRTTNetwork","ipAddress","useReceiveBroadBand","useSendBroadBand","packetLossCount","streams"],rs[os.RtcPBStreamInfo]=["trackId","codeName","volume","samplingRate","bitRate","packetLossRate","frameRate","resolution","blockTime","jitterData","nAckCount","pliCount","googleRTTTotalTime","isReceiveFirstFrameRate","codeType","isEnabled"],rs),ws="\npackage Modules;\nmessage probuf {\n enum JoinType {\n KICK = 0; //踢前一个设备\n REFUSE = 1; //当前加入拒绝\n COEXIST = 2; //两个设备共存\n }\n enum targetType {\n ROOM =1 ;\n PERSON = 2;\n }\n message ".concat(os.SetUserStatusInput,"\n {\n optional int32 status=1;\n }\n message ").concat(os.MCFollowInput,"\n {\n required string state = 1;\n }\n message ").concat(os.RtcQueryListInput,"{\n optional int32 order=1;\n }\n message ").concat(os.RtcKeyDeleteInput,"{\n repeated string key=1;\n }\n message ").concat(os.RtcValueInfo,"{\n required string key=1;\n required string value=2;\n }\n message RtcUserInfo{\n required string userId=1;\n repeated ").concat(os.RtcValueInfo," userData=2; //用户资源信息\n }\n message ").concat(os.RtcRoomStatusInput,"{ // rtc 和 living room 拉房间资源状态使用的参数\n required int64 version =1; //当前客户端最大的房间状态的version\n }\n message ").concat(os.RtcRoomStatusOutput,"{ // rtc 和 living room 拉房间资源状态返回的数据\n required bool bFullStatus =1; //标识此次给的数据是否是全量数据\n required int64 version =2; //当前获取后房间的最大版本号\n repeated RtcUserInfo usersData=3;//如果是全量数据,这个不为空,给的是房间全部的人以及发布的资源\n repeated RtcRoomStatus roomStatus=4;//房间增量数据\n }\n message RtcRoomStatus{ //房间状态变动\n required string userId = 1;//用户ID\n required int32 event = 2;//房间状态变更的event(人员加入/退出/离线/发布资源) (0:加入;1:离开;2:离线;3:资源变动) \n required int64 time = 3;//本次变更的版本号\n repeated RtcValueInfo userData = 4;//用户变更的资源(event为0或者3时可能有值)\n optional int32 switchRoleType = 5;//如果是切换角色导致的加入房间或退出房间的类型\n optional string extra = 6;\n }\n message ").concat(os.RtcUserListOutput,"{\n repeated RtcUserInfo users=1;\n optional string token=2;\n optional string sessionId=3;\n repeated RtcValueInfo roomInfo = 4; //房间key value\n repeated RtcKVEntity entries = 5;//直播KV属性对象集合\n optional int64 syncTime = 6;//所有属性的最大时间戳(下次拉取KV时用)。\n optional int32 offlineKickTime = 7;//server超时踢人时间,默认60s\n repeated string codeFormat = 8; //当前房间用户支持的编码交集\n optional int64 roomCreateTime = 9;//房间创建时间\n optional int64 userJoinTime = 10;//用户加入房间\n optional int64 version = 11;//当前房间的版本号\n }\n message RtcRoomInfoOutput{\n optional string roomId = 1;\n repeated ").concat(os.RtcValueInfo," roomData = 2;\n optional int32 userCount = 3;\n repeated RtcUserInfo list=4;\n }\n message ").concat(os.RtcInput,"{\n required int32 roomType=1;\n optional int32 broadcastType=2;\n optional RtcValueInfo extraInnerData = 3;\n optional bool needSysChatroom = 4; //是否需要同步聊天室\n optional IdentityChangeType identityChangeType = 5; //身份变更类型\n optional JoinType joinType = 6; // 加入房间类型\n repeated ").concat(os.RtcValueInfo," innerDatas = 7; //用户内部inner数据,角色或者连麦信息等\n repeated ").concat(os.RtcValueInfo," outerDatas = 8; //用户内部outer数据,自定义数据结构RtcInput。\n optional bool supportNtf = 9; //是否支持房间状态的变更通过通知拉取的方式获取\n }\n message ").concat(os.RtcQryOutput,"{\n repeated ").concat(os.RtcValueInfo," outInfo=1;\n }\n message ").concat(os.RtcDataInput,"{\n required bool interior=1;\n required targetType target=2;\n repeated string key=3;\n optional string objectName=4;\n optional string content=5;\n }\n message ").concat(os.RtcSetDataInput,"{\n required bool interior=1;\n required targetType target=2;\n required string key=3;\n required string value=4;\n optional string objectName=5;\n optional string content=6;\n }\n message ").concat(os.RtcUserSetDataInput," {\n repeated ").concat(os.RtcValueInfo," valueInfo = 1;\n required string objectName = 2;\n repeated ").concat(os.RtcValueInfo," content = 3;\n }\n message RtcQryInput{\n required bool isInterior=1;\n required targetType target=2;\n repeated string key=3;\n }\n message RtcDelDataInput{\n repeated string key=1;\n required bool isInterior=2;\n required targetType target=3;\n }\n message RtcOutput\n {\n optional int32 nothing=1;\n optional int64 version=2;\n }\n message ").concat(os.RtcTokenOutput,"{\n required string rtcToken=1;\n }\n message ").concat(os.RtcSetOutDataInput,"{\n required targetType target=1;\n repeated ").concat(os.RtcValueInfo," valueInfo=2;\n optional string objectName=3;\n optional string content=4;\n }\n message ").concat(os.RtcQryUserOutDataInput,"{\n repeated string userId = 1;\n }\n message ").concat(os.RtcUserOutDataOutput,"{\n repeated RtcUserInfo user = 1;\n }\n message ").concat(os.RtcNotifyMsg," \n {\n required int32 type= 1; //(通知类型 1:rtc房间状态KV变更通知)\n optional int64 time= 2; //消息产生时间\n optional string roomId=3; //主播房间id\n }\n message ").concat(os.RtcPullKV,"\n {\n required int64 timestamp = 1;\n required string roomId = 2;\n }\n message RtcKVEntity \n {\n required string key = 1;\n required string value = 2;\n optional int32 status = 3;\n optional int64 timestamp = 4;\n optional string uid = 5;\n }\n message ").concat(os.RtcKVOutput,"\n {\n repeated RtcKVEntity entries = 1;\n optional bool bFullUpdate = 2;\n optional int64 syncTime = 3; \n }\n enum IdentityChangeType \n {\n AnchorToViewer = 1; //1为主播变观众\n ViewerToAnchor = 2; //2为观众变主播\n }\n message ").concat(os.RtcQueryUserJoinedInput,"\n {\n required string userId = 1;\n }\n message RtcJoinedInfo\n {\n required string deviceId = 1; //设备ID\n required string roomId = 2; //加入的房间ID\n optional int64 joinTime = 3; //加入的时间\n }\n message ").concat(os.RtcQueryUserJoinedOutput,"\n {\n repeated RtcJoinedInfo info = 1;\n }\n message ").concat(os.RtcViewerJoinedOutput,"\n {\n required string rtcToken=1;\n repeated RtcKVEntity entries = 2;//KV属性对象集合\n optional int64 syncTime = 3;//所有属性的最大时间戳(下次拉取KV时用)。\n optional string sessionId=4;\n optional int64 roomCreateTime = 5;//房间创建时间\n optional int64 userJoinTime = 6;//用户加入房间\n }\n message ").concat(os.RtcInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n optional int32 timeoutTime=2; //邀请超时时间(秒),默认三十秒\n required string invitedRoomId=3; //被邀请的房间\n required string inviteInfo=4; //邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId= 5; //客户端保证唯一性(建议roomid_userid_时间戳_随机数)\n }\n message ").concat(os.RtcCancelInviteInput,"\n {\n required string invitedUserId=1; //被邀请的人的uid\n required string invitedRoomId=2; //被邀请的房间\n required string inviteInfo=3; //取消邀请的信息(包含邀请人,被邀请人,各自userid)客户端定义好.协议栈和server透传\n required string inviteSessionId=4; //邀请的sessionId,客户端发起邀请时产生\n }\n message ").concat(os.RtcInviteAnswerInput,"\n {\n required string inviteUserId=1; //邀请的人的uid\n required int32 answerCode=2; //是否接受连麦邀请.0为拒绝,1为接受\n required string inviteRoomId=3; //邀请的房间\n required string inviteSessionId=4; //邀请的sessionId\n required string content=5; //需要转发的content\n optional string key=6; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n optional string value=7; //如果接受的话,需要加这个字段,放在room级别的k和v,新加入房间的能拉取到\n }\n message ").concat(os.RtcEndInviteInput,"\n {\n required string inviteRoomId=1; //邀请的房间\n required string inviteSessionId=2; //邀请的sessionId\n required string inviteContent=3; //结束连麦的信息(需要透传给房间内其他人)\n repeated string inviteRoomKeys=4; //需要删除连麦的信息的key\n }\n message ").concat(os.RtcReportSDKInput,' {\n required string sdkInfo=1; // 用户集成的 sdk 信息,json 格式 {"web-rtc": "4.0.3.7"}\n }\n // ---- 北极星数据上报 -------\n message ').concat(os.RtcPBPolaris," {\n required string type = 1;//上报数据类型 R1-R4\n required string appKey = 2;\n required string sessionId = 3;//房间通话id\n required string roomId = 4;\n required int64 roomCreateTime = 5;//房间创建时间\n required string userId = 6;\n required int32 userRole = 7;\n required int64 joinTime = 8;\n required string signalDataCenter = 9;//signal数据中心\n optional ").concat(os.RtcPBR1Info," r1Info = 10;\n optional ").concat(os.RtcPBR2Info," r2Info = 11;\n optional ").concat(os.RtcPBR3Info," r3Info = 12;\n optional ").concat(os.RtcPBR4Info," r4Info = 13;\n }\n message ").concat(os.RtcPBR1Info," {\n required int64 joinTime = 1;//用户加入房间的时间\n required string rtcVersion = 2;//Rtc版本号\n required string imVersion = 3;//IM SDK 版本\n required string platform = 4;//平台(如:Android、iOS、Web)\n required string device = 5; //设备信息(手机名称+型号)\n required string os = 6;//系统版本(手机系统版本)\n optional string browserName = 7; //浏览器名称, 没有用 -1 表示\n optional string browserVersion = 8;//浏览器版本, 没有用 -1 表示\n optional int64 receiveTime = 9; // 发送数据的时间\n }\n message ").concat(os.RtcPBR2Info," {\n required int64 joinTime = 1;\n required int64 sendTime = 2;\n required string rtcActionType = 3;//发布类型 subscribe : 订阅 publish : 发布\n required string rtcActionStatus = 4;//发布状态 begin : 开始 tend : 结束\n repeated string trackId = 5;\n optional int64 receiveTime = 6; // 发送数据的时间\n }\n message ").concat(os.RtcPBR3Info," {\n required ").concat(os.RtcPBStatusInfo," info = 1;\n }\n message ").concat(os.RtcPBR4Info," {\n required ").concat(os.RtcPBStatusInfo," info = 1;\n }\n message ").concat(os.RtcPBStatusInfo," {\n optional int64 joinTime = 1;//用户加入房间的时间\n optional int64 receiveTime = 2;//用户发布数据流的时间(毫秒),暂时由客户端生成,后期如果有问题服务端做兜底处理\n optional int64 totalBitRate = 3;//总码率\n optional float appCPUUsage = 4;//APP CPU占用率\n optional float systemCPUUsage = 5;////系统 CPU占用率\n optional float systemCPUFrequency = 6;//系统CPU频率 (安卓8.0以上)\n optional string networkStatus = 7;//实时网络状态(2g、3g、4g、wifi)\n optional int32 googleRTTNetwork = 8;//Goog rtt 网络延迟\n optional string ipAddress = 9;//ip地址\n optional string useReceiveBroadBand = 10; //可接收带宽(单位: bit)\n optional string useSendBroadBand = 11;//可用发送带宽(单位: bit)\n optional string packetLossCount = 12;//丢包数\n repeated ").concat(os.RtcPBStreamInfo," streams = 13;\n }\n message ").concat(os.RtcPBStreamInfo," {\n required string trackId = 1;\n optional string codeName = 2;//编解码名称\n optional string volume = 3;//音频播放音量\n optional int32 samplingRate = 4; //音频采样率\n optional float bitRate = 5;//下行码率\n optional float packetLossRate = 6;\n optional int32 frameRate = 7;//视频接收帧率(单位:fps)\n optional string resolution = 8;//视频分辨率(格式:640*480)\n optional int64 blockTime = 9;//接收卡顿(间隔时间, 单位: ms)\n optional int32 jitterData = 10;//jitter数据抖动\n optional string nAckCount = 11;//nack数量\n optional string pliCount = 12; //PLI请求数\n optional int64 googleRTTTotalTime = 13; //googRtt往返时长\n optional int32 isReceiveFirstFrameRate = 14;//第一个关键帧是否正常收到\n optional string codeType = 15;//编码方式\n optional int32 isEnabled = 16; //当前流的状态是否可用\n }\n // ---- 北极星数据上报 -------\n}\n"),Ds=function(e,t,r,i,n,o,a){var s=n?Object.keys(n).map((function(t){return e.encode(os.RtcValueInfo,{key:t,value:n[t]},!0)})):void 0,c=o?Object.keys(o).map((function(t){return e.encode(os.RtcValueInfo,{key:t,value:o[t]},!0)})):void 0;return e.encode(os.RtcInput,{roomType:t,broadcastType:r,joinType:i,innerDatas:s,outerDatas:c,supportNtf:a})},ks=function(t,r){var i=t.decode(os.RtcUserListOutput,r),n=i.users,o=i.token,a=i.sessionId,s=i.roomInfo,c=i.entries,u=i.offlineKickTime,l=void 0===u?60:u,d=i.codeFormat,_=i.roomCreateTime,p=i.userJoinTime,f=i.version,h={};return e.forEach(n,(function(t){var r=t.userId,i=t.userData,n={};e.forEach(i,(function(e){var t=e.key,r=e.value;n[t]=r})),h[r]=n})),{users:h,token:o,sessionId:a,roomInfo:s,kvEntries:c,offlineKickTime:l,codeFormat:d,roomCreateTime:Pt(_),userJoinTime:Pt(p),version:f}},Us=function(){function t(e,t,r){Object.defineProperty(this,"context",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"codec",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"roomCreateTime",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"userJoinTime",{enumerable:!0,configurable:!0,writable:!0,value:0})}return Object.defineProperty(t.prototype,"joinRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n,o,a,u){return s(this,void 0,void 0,(function(){var s,l,d,_,p,f,h,b,R,g,m,C,v,O;return c(this,(function(c){switch(c.label){case 0:return s=Ds(this.codec,r,i,n,o,a,u),[4,this.context.rtcSignaling(t,as,!0,s)];case 1:return l=c.sent(),d=l.code,_=l.buffer,d===e.ErrorCode.SUCCESS&&_?(p=ks(this.codec,_),f=p.users,h=p.token,b=p.sessionId,R=p.roomInfo,g=p.kvEntries,m=p.offlineKickTime,C=p.roomCreateTime,v=p.userJoinTime,O=p.version,this.roomCreateTime=C,this.userJoinTime=v,[2,{code:d,data:{users:f,token:h,sessionId:b,roomInfo:R,kvEntries:g,offlineKickTime:m,version:O}}]):[2,{code:d,data:p}]}}))}))}}),Object.defineProperty(t.prototype,"quitRTCRoom",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(os.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,ss,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCRoomInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(os.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,cs,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o&&(a=this.codec.decode(os.RtcRoomInfoOutput,o)),[2,{code:n,data:a}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfoList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return r=this.codec.encode(os.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,us,!0,r)];case 1:return i=c.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o&&(s=ks(this.codec,o),a={users:s.users}),[2,{code:n,data:a}]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){throw new Error("Method not implemented.")}}),Object.defineProperty(t.prototype,"removeRTCUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this.codec.encode(os.RtcKeyDeleteInput,{key:t}),[4,this.context.rtcSignaling(e,ls,!1,r)];case 1:return[2,i.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o){return s(this,void 0,void 0,(function(){var a;return c(this,(function(s){switch(s.label){case 0:return a=this.codec.encode(os.RtcSetDataInput,{interior:i,target:n,key:t,value:r,objectName:null==o?void 0:o.name,content:null==o?void 0:o.content}),[4,this.context.rtcSignaling(e,ds,!1,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCTotalRes",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n,o){return s(this,void 0,void 0,(function(){var a,s,u=this;return c(this,(function(c){switch(c.label){case 0:return a={objectName:i,content:[],valueInfo:[this.codec.encode(os.RtcValueInfo,{key:"uris",value:r},!0)]},t.forEach((function(e){var t=u.codec.encode(os.RtcValueInfo,{key:e.name,value:e.content},!0);a.content.push(t)})),n&&a.valueInfo.push(this.codec.encode(os.RtcValueInfo,{key:"mcu_uris",value:n},!0)),o&&a.valueInfo.push(this.codec.encode(os.RtcValueInfo,{key:"cdn_uris",value:o},!0)),s=this.codec.encode(os.RtcUserSetDataInput,a),[4,this.context.rtcSignaling(e,_s,!0,s)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCCDNUris",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return s(this,void 0,void 0,(function(){var i;return c(this,(function(n){switch(n.label){case 0:return i=this.codec.encode(os.RtcUserSetDataInput,{objectName:t,valueInfo:this.codec.encode(os.RtcValueInfo,{key:"cdn_uris",value:r},!0)}),[4,this.context.rtcSignaling(e,_s,!0,i)];case 1:return[2,n.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){return s(this,void 0,void 0,(function(){var o,a,s,u,l,d;return c(this,(function(c){switch(c.label){case 0:return o=this.codec.encode(os.RtcDataInput,{interior:i,target:n,key:r}),[4,this.context.rtcSignaling(t,ps,!0,o)];case 1:return a=c.sent(),s=a.code,u=a.buffer,s===e.ErrorCode.SUCCESS&&u?(l=this.codec.decode(os.RtcQryOutput,u).outInfo,d={},l.forEach((function(e){d[e.key]=e.value})),[2,{code:s,data:d}]):[2,{code:s}]}}))}))}}),Object.defineProperty(t.prototype,"removeRTCData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i,n){return s(this,void 0,void 0,(function(){var o;return c(this,(function(a){switch(a.label){case 0:return o=this.codec.encode(os.RtcDataInput,{interior:r,target:i,key:t,objectName:(null==n?void 0:n.name)||"",content:(null==n?void 0:n.content)||""}),[4,this.context.rtcSignaling(e,fs,!1,o)];case 1:return[2,a.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r,i){return s(this,void 0,void 0,(function(){return c(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCOutData",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){return c(this,(function(e){throw new Error("JSEngine's method not implemented.")}))}))}}),Object.defineProperty(t.prototype,"getRTCToken",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=Ds(this.codec,r,i),[4,this.context.rtcSignaling(t,hs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=this.codec.decode(os.RtcTokenOutput,s).rtcToken,[2,{code:a,data:{rtcToken:u}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"setRTCState",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t){return s(this,void 0,void 0,(function(){var r;return c(this,(function(i){switch(i.label){case 0:return r=this.codec.encode(os.MCFollowInput,{state:t}),[4,this.context.rtcSignaling(e,bs,!0,r)];case 1:return[2,i.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"setRTCStateByHttp",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i,n){var o;return s(this,void 0,void 0,(function(){var s,u,l;return c(this,(function(c){switch(c.label){case 0:s=function(e,t,r){var i=t.type,n=t.appKey,o=t.sessionId,s=t.roomId,c=t.roomCreateTime,u=t.userId,l=t.userRole,d=t.joinTime,_=t.signalDataCenter,p=t.r1Info,f=t.r2Info,h=t.r3Info,b=t.r4Info,R={type:i,appKey:n,sessionId:o,roomId:s,roomCreateTime:c,userId:u,userRole:l,joinTime:d,signalDataCenter:_};if(r===Ea.R1&&p){var g=e.encode(os.RtcPBR1Info,p,!0);return e.encode(os.RtcPBPolaris,a(a({},R),{r1Info:g}))}if(r===Ea.R2&&f){var m=e.encode(os.RtcPBR2Info,f,!0);return e.encode(os.RtcPBPolaris,a(a({},R),{r2Info:m}))}if(r===Ea.R3&&h){var C=(E=h.info).streams,v=Array.isArray(C)&&C.map((function(t){return t&&e.encode(os.RtcPBStreamInfo,t,!0)})),O=e.encode(os.RtcPBStatusInfo,a(a({},E),{streams:v}),!0),T=e.encode(os.RtcPBR3Info,{info:O},!0);return e.encode(os.RtcPBPolaris,a(a({},R),{r3Info:T}))}if(r===Ea.R4&&b){C=(E=b.info).streams,v=Array.isArray(C)&&C.map((function(t){return t&&e.encode(os.RtcPBStreamInfo,t,!0)})),O=e.encode(os.RtcPBStatusInfo,a(a({},E),{streams:v}),!0);var E,I=e.encode(os.RtcPBR4Info,{info:O},!0);return e.encode(os.RtcPBPolaris,a(a({},R),{r4Info:I}))}return{}}(this.codec,i,n),u=t,/^https:\/\//.test(t)||(u="https://".concat(t)),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,r.httpReq({url:"".concat(u,"/rtc/logserver/polaris"),body:s,method:e.HttpMethod.POST,headers:{jwt:(null===(o=this.context.getNaviInfo())||void 0===o?void 0:o.jwt)||""},timeout:2e3})];case 2:if(!(l=c.sent()).data)throw new Error("http request fail");return[2,JSON.parse(l.data).resultCode];case 3:return c.sent(),[2,Ta.REPORT_FAIL];case 4:return[2]}}))}))}}),Object.defineProperty(t.prototype,"getRTCUserList",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(os.RtcQueryListInput,{order:2}),[4,this.context.rtcSignaling(t,Rs,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o?(a=ks(this.codec,o),[2,{code:n,data:a}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"joinLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u,l,d,_,p;return c(this,(function(c){switch(c.label){case 0:return n=Ds(this.codec,r,i),[4,this.context.rtcSignaling(t,gs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=this.codec.decode(os.RtcViewerJoinedOutput,s),l=u.rtcToken,d=u.entries,_=u.roomCreateTime,p=u.userJoinTime,this.roomCreateTime=Pt(_),this.userJoinTime=Pt(p),[2,{code:a,data:{token:l,kvEntries:d}}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"quitLivingRoomAsAudience",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t;return c(this,(function(r){switch(r.label){case 0:return t=this.codec.encode(os.SetUserStatusInput,{status:0}),[4,this.context.rtcSignaling(e,ms,!0,t)];case 1:return[2,r.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"rtcIdentityChange",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=this.codec.encode(os.RtcInput,{roomType:exports.RTCMode.LIVE,broadcastType:i,identityChangeType:r,needSysChatroom:!1}),[4,this.context.rtcSignaling(t,vs,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a===e.ErrorCode.SUCCESS&&s?(u=ks(this.codec,s),[2,{code:a,data:u}]):[2,{code:a}]}}))}))}}),Object.defineProperty(t.prototype,"requestRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,n=e.inviteTimeout,o=e.inviteInfo,a=e.roomId,s=this.codec.encode(os.RtcInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:i,timeoutTime:n,inviteInfo:o}),[4,this.context.rtcSignaling(a,Os,!0,s)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"cancelRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return t=e.invitedRoomId,r=e.invitedUserId,i=e.inviteSessionId,n=e.inviteInfo,o=e.roomId,a=this.codec.encode(os.RtcCancelInviteInput,{invitedRoomId:t,invitedUserId:r,inviteSessionId:i,inviteInfo:n}),[4,this.context.rtcSignaling(o,Ts,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"responseRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,u,l;return c(this,(function(c){switch(c.label){case 0:return t=e.inviteUserId,r=e.inviteRoomId,i=e.inviteSessionId,n=e.content,o=e.key,a=e.value,s=e.agree,u=e.roomId,l=this.codec.encode(os.RtcInviteAnswerInput,{inviteUserId:t,inviteRoomId:r,inviteSessionId:i,content:n,key:o,value:a,answerCode:s?1:0}),[4,this.context.rtcSignaling(u,Es,!0,l)];case 1:return[2,c.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"endRoomPK",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return s(this,void 0,void 0,(function(){var t,r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return t=e.endRoomId,r=e.sessionId,i=e.content,n=e.keys,o=e.roomId,a=this.codec.encode(os.RtcEndInviteInput,{inviteRoomId:t,inviteSessionId:r,inviteContent:i,inviteRoomKeys:n}),[4,this.context.rtcSignaling(o,Is,!0,a)];case 1:return[2,s.sent().code]}}))}))}}),Object.defineProperty(t.prototype,"getRTCJoinedUserInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,a;return c(this,(function(s){switch(s.label){case 0:return r=this.codec.encode(os.RtcQueryUserJoinedInput,{userId:t}),[4,this.context.rtcSignaling("",Ss,!0,r)];case 1:return i=s.sent(),n=i.code,o=i.buffer,n===e.ErrorCode.SUCCESS&&o?(a=this.codec.decode(os.RtcQueryUserJoinedOutput,o).info||[],[2,{code:n,data:a.map((function(e){return{deviceId:e.deviceId,roomId:e.roomId,joinTime:Pt(e.joinTime)}}))}]):[2,{code:n}]}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomEntry",{enumerable:!1,configurable:!0,writable:!0,value:function(t){return s(this,void 0,void 0,(function(){var r,i,n,o,s,u,l;return c(this,(function(c){switch(c.label){case 0:return r=this.codec.encode(os.RtcPullKV,{timestamp:0,roomId:t}),[4,this.context.rtcSignaling(t,Cs,!0,r)];case 1:return i=c.sent(),n=i.code,o=i.buffer,n!==e.ErrorCode.SUCCESS?[2,{code:n}]:(s=this.codec.decode(os.RtcKVOutput,o),u=s.entries,l=s.syncTime,u=(u||[]).map((function(e){return a(a({},e),{timestamp:Pt(e.timestamp)})})),[2,{code:n,data:{kvEntries:u,syncTime:Pt(l)}}])}}))}))}}),Object.defineProperty(t.prototype,"pullRTCRoomStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r){return s(this,void 0,void 0,(function(){var i,n,o,a,s;return c(this,(function(c){switch(c.label){case 0:return i=this.codec.encode(os.RtcRoomStatusInput,{version:r}),[4,this.context.rtcSignaling(t,ys,!0,i)];case 1:return n=c.sent(),o=n.code,a=n.buffer,o!==e.ErrorCode.SUCCESS?[2,{code:o}]:(s=this.codec.decode(os.RtcRoomStatusOutput,a),[2,{code:o,data:s}])}}))}))}}),Object.defineProperty(t.prototype,"decodeRtcNotify",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.decode(os.RtcNotifyMsg,e),r=t.time,i=t.type,n=t.roomId;return{time:Pt(r),type:i,roomId:n}}}),Object.defineProperty(t.prototype,"getCurrentId",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCurrentId()}}),Object.defineProperty(t.prototype,"getNaviInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getNaviInfo()}}),Object.defineProperty(t.prototype,"getConnectionStatus",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getConnectionStatus()}}),Object.defineProperty(t.prototype,"getAppkey",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getAppkey()}}),Object.defineProperty(t.prototype,"webRtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(t,r,i){return s(this,void 0,void 0,(function(){var n,o,a,s,u;return c(this,(function(c){switch(c.label){case 0:return n=this.codec.encode(os.RtcInput,{roomType:r,broadcastType:i}),[4,this.context.rtcSignaling(t,Ps,!0,n)];case 1:return o=c.sent(),a=o.code,s=o.buffer,a!==e.ErrorCode.SUCCESS?[2,{code:a}]:((u=this.codec.decode(os.RtcOutput,s)).version=Pt(u.version),[2,{code:a,data:u}])}}))}))}}),Object.defineProperty(t.prototype,"rtcPing",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return/Electron/.test(navigator.userAgent)?this.context.rtcPingResVersion(e,t,r):this.webRtcPing(e,t,r)}}),Object.defineProperty(t.prototype,"sendMessage",{enumerable:!1,configurable:!0,writable:!0,value:function(e,t,r){return this.context.sendMessage(e,t,r)}}),Object.defineProperty(t.prototype,"registerRTCSignalListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.registerRTCSignalListener(e)}}),Object.defineProperty(t.prototype,"registerConnectionStateChangeListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onconnectionstatechange=e}}),Object.defineProperty(t.prototype,"registerDisconnectListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondisconnect=e}}),Object.defineProperty(t.prototype,"registerDestroyListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.ondestroy=e}}),Object.defineProperty(t.prototype,"registerMessageListener",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.context.onmessage=e}}),Object.defineProperty(t.prototype,"getCoreVersion",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context.getCoreVersion()}}),Object.defineProperty(t.prototype,"getPluginContext",{enumerable:!1,configurable:!0,writable:!0,value:function(){return this.context}}),Object.defineProperty(t.prototype,"reportSDKInfo",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var t=this.codec.encode(os.RtcReportSDKInput,{sdkInfo:JSON.stringify(e)});this.context.rtcSignaling("",Ls,!0,t)}}),t}();!function(e){e.RTC="RTC"}(Ns||(Ns={})),e.VersionManage.add("rtclib","5.16.0");var Ms={tag:"RCRTC",verify:function(t){return"undefined"==typeof isSecureContext||isSecureContext?!!e.VersionManage.validEngine("5.16.0")||(console.error("The current engine version '".concat(e.VersionManage.getInfo().engine,"' error, plugin-rtc required engine version at least '").concat("5.16.0","'.")),!1):(console.error("Please use the https protocol or use `http://localhost` to open the page!"),!1)},setup:function(t,r,i){void 0===i&&(i={});var o=t.createLogger("RCRTC",Ns.RTC);if(i.logLevel&&o.setOutputLevel(i.logLevel),o.warn(n.L_INDEX_INSTALL_RTC_PLUGIN_O,JSON.stringify({"RCRTC Version":"5.16.0",Commit:"4b4b6ca97d6ba33cc29dc68bc39389395bb05530","browserInfo.browser":Ct.browser,"browserInfo.supportsUnifiedPlan":Ct.supportsUnifiedPlan,"browserInfo.version":Ct.version})),e.assert("options",i,e.AssertRules.OBJECT,!0),e.assert("options.mediaServer",i.mediaServer,(function(t){return!(!e.isHttpUrl(t)||"https:"===location.protocol&&!/^https/.test(t))})),e.assert("options.timeout",i.timeout,(function(t){return e.isNumber(t)&&t>=5e3&&t<=3e4})),e.assert("options.pingGap",i.pingGap,(function(t){return e.isNumber(t)&&t>=3e3&&t<=1e4})),i.AAAWorklet){e.assert("options.AAAWorklet",i.AAAWorklet,e.AssertRules.OBJECT,!0);var a=i.AAAWorklet,s=a.scriptUrl,c=a.wasmUrl;e.assert("AAAWorklet.scriptUrl",s,e.AssertRules.STRING,!0),e.assert("AAAWorklet.wasmUrl",c,e.AssertRules.STRING,!0),He.SCRIPT_URL=s,He.WASM_URL=c}return i.encryptor&&(e.assert("options.encrypt",i.encryptor,e.AssertRules.OBJECT,!0),e.assert("options.encrypt.decodeAudio",i.encryptor.decodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.decodeVideo",i.encryptor.decodeVideo,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeAudio",i.encryptor.encodeAudio,(function(e){return"function"==typeof e}),!0),e.assert("options.encrypt.encodeVideo",i.encryptor.encodeVideo,(function(e){return"function"==typeof e}),!0),uo.init(i.encryptor,o)),new ns(new Us(t,o,t.createCodec(As,ws)),r,i)}},xs={transResolution:bt,transFrameRate:mt,parseTrackId:dt,ifSupportLocalFileTrack:vt,ifSupportScreenShare:Ot};exports.RCAbstractRoom=wa,exports.RCAudienceClient=Za,exports.RCAudienceLivingRoom=es,exports.RCCameraVideoTrack=Xe,exports.RCLivingRoom=Wa,exports.RCLocalAudioTrack=We,exports.RCLocalFileAudioTrack=Qe,exports.RCLocalFileTrack=ze,exports.RCLocalFileVideoTrack=qe,exports.RCLocalTrack=Ke,exports.RCLocalVideoTrack=Ye,exports.RCMCUConfigBuilder=Ma,exports.RCMediaStreamCapture=is,exports.RCMicphoneAudioTrack=Ze,exports.RCRTCClient=ns,exports.RCRTCRoom=Ya,exports.RCRemoteAudioTrack=rt,exports.RCRemoteTrack=tt,exports.RCRemoteVideoTrack=it,exports.RCScreenAudioTrack=et,exports.RCScreenVideoTrack=$e,exports.RCTag={DEFAULT:"RongCloudRTC"},exports.RCTrack=Ve,exports.device=Me,exports.helper=xs,exports.installer=Ms;