@realsee/live 0.6.0-alpha.5 → 0.6.0-alpha.6

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,29 +1,29 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ke=require("trtc-js-sdk"),te=require("amazon-chime-sdk-js"),M=require("react"),ve=Symbol("$$REALSEE_LIVE_EVENT$$");function Oe(r){return r[ve]||(r[ve]={}),r[ve]}function fn(r){r[ve]||delete r[ve]}let me=class{hasListener(t){const e=Oe(this);return e&&e[t]&&e[t].length>0}on(t,e,n){const i=Oe(this);return i[t]||(i[t]=[]),i[t].push([e,n||!1]),()=>this.off(t,e)}once(t,e){return this.on(t,e,!0)}off(t,e){if(t===void 0){fn(this);return}const n=Oe(this);if(n[t]||(n[t]=[]),e===void 0){n[t].length=0;return}let i=0;for(;i<n[t].length&&n[t][i][0]!==e;i++);i<n[t].length&&n[t].splice(i,1)}emit(t,...e){let n=!1;const o=Oe(this)[t]||[];for(let a of o.slice()){const[c,l=!1]=a,u=c(...e);l&&this.off(t,c),u===!1&&(n=!0)}return n}};class Ne extends me{}var oe=(r=>(r.RealseeBrowserRTC="RealseeBrowserRTC",r.RealseeVRWebViewRTC="RealseeVRWebViewRTC",r.RealseeBrowserChimeRTC="RealseeBrowserChimeRTC",r))(oe||{}),it=(r=>(r.RealseeXTRTC="trtc",r.RealseeXChimeRTC="chime",r))(it||{});const dn=()=>{const r=new Date,t=r.getFullYear(),e=(r.getMonth()+1).toString().padStart(2,"0"),n=r.getDate().toString().padStart(2,"0"),i=r.getHours().toString().padStart(2,"0"),o=r.getMinutes().toString().padStart(2,"0"),a=r.getSeconds().toString().padStart(2,"0"),c=r.getMilliseconds();return`[${t}-${e}-${n} ${i}:${o}:${a}.${c}]`},je=(r,t=[])=>{switch(t.unshift(`Realsee Live ${dn()} <${r}> `),r){case"INFO":return console.info(...t);case"ERROR":return console.error(...t);case"WARN":return console.warn(...t);default:return console.log(...t)}},hn=(...r)=>je("LOG",r),vn=(...r)=>je("INFO",r),gn=(...r)=>je("ERROR",r),pn=(...r)=>je("WARN",r),mn={log:hn,info:vn,error:gn,warn:pn},V=mn;function ne(){return((1+Math.random())*65536|0).toString(16).substring(1)}function Ae(){return(ne()+ne()+"-"+ne()+"-4"+ne().substr(0,3)+"-"+ne()+"-"+ne()+ne()+ne()).toLowerCase()}class Xe extends Ne{type=oe.RealseeBrowserRTC;joined=!1;micro=!1;voiceId="";_getVoiceSign=()=>{throw new Error("方法 getVoiceSign 未实现")};_autoPlayConfirm;checkRequirement=()=>Ke.checkSystemRequirements();$dom=document.createElement("div");_trtc={client:null,stream:null};constructor(t){super(),this._getVoiceSign=t.getVoiceSign,this._autoPlayConfirm=t.autoPlayConfirm,this._initParentDom()}_initParentDom(){this.$dom.id=`rs-rtc-${Ae()}`,this.$dom.style.display="none",document.body.appendChild(this.$dom)}join=async t=>{this.emit("joinWillStart");const e=await this._getVoiceSign({voiceId:t.voiceId,roomId:t.roomId,userId:t.userId});this._trtc.client=Ke.createClient({mode:"rtc",...e,enableAutoPlayDialog:typeof this._autoPlayConfirm!="function"}),this._trtc.client?.enableAudioVolumeEvaluation(),this._registerRtcEvent();let n=await new Promise(i=>{this._trtc.client?.join({roomId:Number(t.voiceId)}).then(()=>i(!0)).catch(()=>i(!1))});return this.joined=n,n?(this._trtc.stream=Ke.createStream({userId:e.userId,audio:!0,video:!1}),n=await new Promise(i=>{this._trtc.stream?.initialize().then(()=>i(!0)).catch(()=>i(!1))}),n=await new Promise(i=>{this._trtc.client?.publish(this._trtc.stream).then(()=>i(!0)).catch(()=>i(!1))}),this.joined=n,this.joined&&this.emit("joined"),n):!1};quit(){return new Promise(async t=>{this.joined=!1,this._trtc.stream&&(await this._trtc.client?.unpublish(this._trtc.stream),this._trtc.stream.stop(),this._trtc.stream.close(),this._trtc.stream=null),this._trtc.client?.leave().then(()=>this._trtc.client=null).then(()=>t(!0)).catch(()=>t(!1)),t(!0)})}detectMicro(){return new Promise(t=>{const e={audio:!0,video:!1};try{navigator.mediaDevices.getUserMedia(e).then(()=>t(!0)).catch(n=>{V.error(n.message),t(!1)})}catch(n){console.error(n),t(!1)}})}toggleMicro(t){return Promise.resolve((t?this._trtc?.stream?.unmuteAudio():this._trtc?.stream?.muteAudio())||!1)}shock(){throw new Error("Method not implemented.")}_registerRtcEvent(){this._trtc.client?.on("stream-added",this._handleStreamAdded),this._trtc.client?.on("stream-subscribed",this._handleStreamSubscribed),this._trtc.client?.on("audio-volume",t=>this.emit("userVolumes",t.result.map(({userId:e,audioVolume:n})=>({userId:e,audioVolume:n})))),this._trtc.client?.on("error",t=>this.emit("error",t))}_handleStreamAdded=t=>{const e=t.stream;console.log("远端流增加: "+e.getId()),this._trtc.client?.subscribe(e)};_handleStreamSubscribed=t=>{const e=t.stream;console.log("远端流订阅成功:"+e.getId());const i=`rs-rtc-remote_stream-${e.getId()}`,o=document.createElement("div");o.id=i,this.$dom.appendChild(o),typeof this._autoPlayConfirm=="function"?(e.play(i).catch(a=>{}),e.on("error",a=>{if(a.getCode()===16451){const l=()=>e.resume();this._autoPlayConfirm({onConfirm:l})}})):e.play(i)}}class Ze extends Ne{type=oe.RealseeBrowserChimeRTC;joined=!1;micro=!1;voiceId="";userId="";logger;deviceController;meetingSession;audioInput;audioOutput;deviceChangeObserver={};audioVideoObserver={};_getVoiceSign=()=>{throw new Error("方法 getVoiceSign 未实现")};$dom=document.createElement("div");$audio=document.createElement("audio");constructor(t){super(),this._getVoiceSign=t.getVoiceSign,this._initDom(),this.logger=new te.ConsoleLogger("WebRTCLogger",t.logLevel||te.LogLevel.INFO),this.deviceController=new te.DefaultDeviceController(this.logger),this.initObservers()}_initDom=()=>{this.$audio.id=`rs-rtc-${Ae()}`,this.$dom.id=`rs-rtc-${Ae()}`,this.$dom.appendChild(this.$audio),document.body.appendChild(this.$dom)};initObservers=()=>{this.deviceChangeObserver={audioInputsChanged:t=>{t?.forEach(e=>{this.logger.info(`Device ID: ${e.deviceId} Microphone: ${e.label}`)})},audioOutputsChanged:t=>{this.logger.info(`Audio outputs updated: ${t}`)},videoInputsChanged:t=>{this.logger.info(`Video inputs updated: ${t}`)},audioInputMuteStateChanged:(t,e)=>{this.logger.info(`Device ${t.toString()} ${e?"is muted in hardware":"is not muted"}`)}},this.audioVideoObserver={audioVideoDidStart:()=>{this.logger.info("Started")},audioVideoDidStop:t=>{this.logger.info(`Stopped with a session status code: ${t.statusCode()}`)},audioVideoDidStartConnecting:t=>{t&&this.logger.info("Attempting to reconnect")}}};async join(t){return new Promise(async(e,n)=>{this.emit("joinWillStart");try{const{sdkAppId:i,userId:o,roomId:a,userSig:c}=await this._getVoiceSign({...t,roomId:t.roomId||0});this.userId=o;const{attendence:l,vendor_wrapper:u}=JSON.parse(decodeURIComponent(c)),f=new te.MeetingSessionConfiguration({Meeting:u},{Attendee:{ExternalUserId:l.external_user_id,AttendeeId:l.attendee_id,JoinToken:l.join_token}});this.meetingSession=new te.DefaultMeetingSession(f,this.logger,this.deviceController),this._registerRtcEvent(),this.meetingSession.audioVideo.addDeviceChangeObserver(this.deviceChangeObserver),this.meetingSession.audioVideo.addObserver(this.audioVideoObserver),this.meetingSession.audioVideo.bindAudioElement(this.$audio);const h={audioVideoDidStart:()=>{this.meetingSession?.audioVideo.realtimeMuteLocalAudio(),this.joined=!0,this.emit("joined"),e(!0)},audioVideoDidStop:()=>{this.joined=!1,e(!1)}};this.meetingSession.audioVideo.addObserver(h);const _=await this.deviceController.listAudioInputDevices(!0),y=_.find(A=>A.deviceId==="default"),O=_.find(A=>A.deviceId!=="");this.audioInput=y||O,await this.meetingSession.audioVideo.startAudioInput(this.audioInput?.deviceId||"default"),this.meetingSession.audioVideo.start()}catch(i){this.emit("error",i),this.logger.error(i.message),e(!1)}})}_registerRtcEvent=()=>{const t=this.meetingSession?.configuration?.credentials?.attendeeId||"";if(t){const e=new Map,n=()=>{const i=[];return e.forEach((o,a)=>{i.push({userId:o.userId,volume:o.muted||o.signalStrength===0||!Boolean(o.volume)?0:o.volume})}),i};this.meetingSession?.audioVideo.realtimeSubscribeToAttendeeIdPresence((i,o,a)=>{if(!o){e.delete(i),this.emit("userVolumes",n());return}this.meetingSession?.audioVideo.realtimeSubscribeToVolumeIndicator(i,(c,l,u,f)=>{new te.DefaultModality(c).base()===c&&(e.set(c,{userId:a||c,volume:l,muted:u,signalStrength:f}),this.emit("userVolumes",n()))})}),this.meetingSession?.audioVideo.realtimeSubscribeToVolumeIndicator(t,(i,o,a,c)=>{new te.DefaultModality(i).base()===i&&c!==null&&c!==1&&this.emit("weakNetwork")}),this.meetingSession?.audioVideo.realtimeSubscribeToFatalError(i=>this.emit("error",i))}};quit(){return this.joined?new Promise((t,e)=>{this.joined=!1;const n={audioVideoDidStop:async i=>{const o=i.statusCode();this.meetingSession?.deviceController.destroy(),o===te.MeetingSessionStatusCode.Left?(this.logger.info("You left the session"),t(!0)):(this.logger.info(`Stopped with a session status code: ${o}`),t(!0))}};this.meetingSession?.audioVideo.addObserver(n),this.meetingSession?.audioVideo.stop()}):Promise.resolve(!0)}async detectMicro(){return new Promise(t=>{const e={audio:!0,video:!1};try{navigator.mediaDevices.getUserMedia(e).then(()=>t(!0)).catch(()=>t(!1))}catch(n){this.logger.error(n.message),t(!1)}})}async toggleMicro(t){t?this.meetingSession?.audioVideo.realtimeUnmuteLocalAudio():this.meetingSession?.audioVideo.realtimeMuteLocalAudio();const e=this.meetingSession?.audioVideo.realtimeIsLocalAudioMuted();return e!==void 0?t!==e:!1}shock(){throw new Error("Method not implemented.")}}var ot=(r=>(r[r.Success=0]="Success",r[r.Failure=1]="Failure",r[r.ReJoin=2]="ReJoin",r[r.NoMicroPermission=3]="NoMicroPermission",r))(ot||{});class Qe extends Ne{type=oe.RealseeVRWebViewRTC;joined=!1;micro=!1;voiceId="";options;get jsBridge(){return this.options.jsBridge}constructor({jsBridge:t,getVoiceSign:e}){super(),this.options={jsBridge:t,getVoiceSign:e},this.jsBridge.webViewType!=="WxMiniProgramWebView"&&this.jsBridge.callAndListen("live/userVolumes",n=>{this.emit("userVolumes",n)}),this.jsBridge.callAndListen("live/weakNetwork",n=>{n&&this.emit("weakNetwork")})}async join(t){try{this.emit("joinWillStart");const{sdkAppId:e,userId:n,userSig:i}=await this.options.getVoiceSign(t);if(!(Boolean(e)&&Boolean(n)&&Boolean(i)))return this.emit("error",new Error("加入房间失败:rtc 签名请求异常")),this.joined=!1,this.joined;this.type=t.type;const[o,a]=await this.jsBridge.callAndBackfeed(`live/join?sdkAppID=${e}&userID=${n}&roomID=${Number(t.voiceId)}&userSig=${i}`);return o?o.code===ot.Success?(this.emit("joined"),this.joined=!0):(this.emit("error",o),this.joined=!1):(this.emit("error",a||new Error("加入房间失败:未知异常。")),this.joined=!1),this.joined}catch(e){return this.emit("error",new Error("加入房间失败:"+e.message)),this.joined=!1,this.joined}}async quit(){const[t,e]=await this.jsBridge.callAndBackfeed("live/quit");return t===null&&this.emit("error",e||new Error("退出房间失败:未知异常。")),this.joined=!1,!!t}async detectMicro(){const[t,e]=await this.jsBridge.detectMicro();return t===null?(this.emit("error",e||new Error("麦克风监测异常!")),!1):t}async toggleMicro(t){const[e,n]=await this.jsBridge.callAndBackfeed(`live/toggleMicro?flag=${t?1:0}`);return e===null?(this.emit("error",n||new Error("麦克风监测异常!")),!1):(this.micro=e,e)}shock(){this.jsBridge.shock(1)}}var q=(r=>(r.SelfUserInfo="SELF_USER_INFO",r.RoomInfo="ROOM_INFO",r.RTCInfo="RTC_INFO",r.UserList="USER_LIST",r.BuiltinMsg="BUILTIN_MSG",r.CustomEvent="CUSTOM_EVENT",r.KeyframeSync="KEYFRAME_SYNC",r.UserKickOut="USER_KICK_OUT",r))(q||{}),F=(r=>(r.UserChange="user_change",r.RoomChange="room_change",r))(F||{}),Y=(r=>(r.UserMicroStatus="change_micro_status",r.UserMicroStatusSync="sync_micro_status",r.UserPermission="change_permission",r.UserStatus="change_status",r.UserInfo="change_info",r.RoomClose="close",r))(Y||{}),ie=(r=>(r.OPEN="OPEN",r.CLOSE="CLOSE",r))(ie||{});function _n(r){try{const t=JSON.parse(r),e={code:t.code,message:t.message,command:t.command,roomCode:t.room_code,appID:t.app_id,requestId:t.request_id,frontRequestId:t.front_request_id,triggerUserID:t.trigger_user_id,data:t.data||{}},n=Object.keys(e).filter(i=>e[i]===void 0);return n.length>0&&console.warn(`推送数据格式异常:${n.join(" ")} 值不存在!`),e}catch{return!1}}var U=(r=>(r[r.NOTINITIALIZED=-1]="NOTINITIALIZED",r[r.CONNECTING=0]="CONNECTING",r[r.OPEN=1]="OPEN",r[r.CLOSED=3]="CLOSED",r))(U||{}),Bt=(r=>(r[r.Normal=0]="Normal",r[r.Removed=1]="Removed",r[r.Replaced=2]="Replaced",r))(Bt||{}),Lt=(r=>(r.WAIT_ENTER="WAIT_ENTER",r.ONLINE="ONLINE",r.LEAVE="LEAVE",r.KICK_OUT="KICK_OUT",r.BE_REPLACE="BE_REPLACE",r.EXCEPTION="EXCEPTION",r))(Lt||{}),Pe=(r=>(r[r.NOTINITIALIZED=-1]="NOTINITIALIZED",r[r.CONNECTING=0]="CONNECTING",r[r.OPEN=1]="OPEN",r[r.CLOSING=2]="CLOSING",r[r.CLOSED=3]="CLOSED",r))(Pe||{}),Nt=(r=>(r.Error="Error",r.Close="Close",r.MicroAuth="MicroAuth",r.DuplicateConnect="DuplicateConnect",r.IllegalURL="IllegalURL",r.Unknown="Unknown",r.IllegalArgs="IllegalArgs",r))(Nt||{}),jt=(r=>(r.Err_1000="CLOSE_NORMAL",r.Err_1001="CLOSE_GOING_AWAY",r.Err_1002="CLOSE_PROTOCOL_ERROR",r.Err_1003="CLOSE_UNSUPPORTED",r.Err_1006="CLOSE_ABNORMAL",r.Err_1007="Unsupported Data",r.Err_1008="Policy Violation",r.Err_1009="CLOSE_TOO_LARGE",r.Err_unknown="unknown",r))(jt||{});function Wt(r){switch(r){case 1e3:return"CLOSE_NORMAL";case 1001:return"CLOSE_GOING_AWAY";case 1002:return"CLOSE_PROTOCOL_ERROR";case 1003:return"CLOSE_UNSUPPORTED";case 1006:return"CLOSE_ABNORMAL";case 1007:return"Unsupported Data";case 1008:return"Policy Violation";case 1009:return"CLOSE_TOO_LARGE"}return"unknown"}var et=function(r,t){return et=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])},et(r,t)};function se(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");et(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}var Be=function(){return Be=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++){e=arguments[n];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},Be.apply(this,arguments)};function g(r,t,e,n){function i(o){return o instanceof e?o:new e(function(a){a(o)})}return new(e||(e=Promise))(function(o,a){function c(f){try{u(n.next(f))}catch(h){a(h)}}function l(f){try{u(n.throw(f))}catch(h){a(h)}}function u(f){f.done?o(f.value):i(f.value).then(c,l)}u((n=n.apply(r,t||[])).next())})}function p(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function c(u){return function(f){return l([u,f])}}function l(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(e=0)),e;)try{if(n=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return e.label++,{value:u[1],done:!1};case 5:e.label++,i=u[1],u=[0];continue;case 7:u=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){e=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){e.label=u[1];break}if(u[0]===6&&e.label<o[1]){e.label=o[1],o=u;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(u);break}o[2]&&e.ops.pop(),e.trys.pop();continue}u=t.call(r,e)}catch(f){u=[6,f],i=0}finally{n=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}var z={};function ee(r,t,e){var n;if(e===void 0&&(e=!0),z[r])z[r].queue.push({once:e,callback:t});else{var i="$jsBridgeFn_"+Date.now().toString(16).toUpperCase()+"_"+Math.ceil(Math.random()*1e4).toString(16).toUpperCase();z[r]={uuid:i,queue:[{once:e,callback:t}]}}return Object.assign(window,(n={},n[z[r].uuid]=function(o){z[r].queue=z[r].queue.reduce(function(a,c){var l=c.once,u=c.callback;return l||a.push(c),u(o),a},[])},n)),z[r].uuid}var st=function(){function r(){}return r.prototype.checkReady=function(t){return Promise.resolve([!1,null])},r.prototype.callAndBackfeed=function(t){return Promise.resolve([!1,null])},r.prototype.callAndListen=function(t,e){return Promise.resolve([!1,null])},r}(),bn="HybridBridgeLJ",Rt=window,yn=function(r){se(t,r);function t(){var e=r.call(this)||this;return Promise.resolve().then(function(){return g(e,void 0,void 0,function(){var n;return p(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.checkBridgeReady()];case 1:return i.sent(),[3,3];case 2:return n=i.sent(),console.warn(n),[3,3];case 3:return[2]}})})}),e}return t.prototype.checkBridgeReady=function(e){var n=this;if(e===void 0&&(e=6e3),this.hybridBridge)return!0;var i=performance.now();return new Promise(function(o,a){var c=function(){if(n.hybridBridge)return o(!0);if(Rt.HybridBridgeLJ){var l=Rt[bn];l?.getStaticData(ee("HYBRID_BRIDGE_NAME",function(u){return n.deviceInfo=JSON.parse(u),n.hybridBridge=l,o(!0)}))}if(performance.now()-i>(e||6e3))return a(new Error("HybridBridge 初始化超时~"));requestAnimationFrame(c)};c()})},t.prototype.checkReady=function(e){return e===void 0&&(e=6e3),g(this,void 0,void 0,function(){var n,i,o,a;return p(this,function(c){switch(c.label){case 0:if(n=[null,null],this.hybridBridge)return n[0]=!0,[2,n];c.label=1;case 1:return c.trys.push([1,3,,4]),i=n,o=0,[4,this.checkBridgeReady(e)];case 2:return i[o]=c.sent(),[3,4];case 3:return a=c.sent(),n[0]=!1,n[1]=a,[3,4];case 4:return[2,n]}})})},Object.defineProperty(t.prototype,"ready",{get:function(){return!!this.hybridBridge},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scheme",{get:function(){var e;return((e=this.deviceInfo)===null||e===void 0?void 0:e.scheme)||""},enumerable:!1,configurable:!0}),t.prototype.createSchemeLink=function(e){return e.startsWith(this.scheme)?e:this.scheme+"://"+e},t.prototype.callAndBackfeed=function(e){return g(this,void 0,void 0,function(){var n,i,o,a,c=this;return p(this,function(l){switch(l.label){case 0:return n=[!1,null],[4,this.checkReady()];case 1:return i=l.sent(),o=i[0],a=i[1],o?[4,new Promise(function(u){return g(c,void 0,void 0,function(){var f,h;return p(this,function(_){return f=this.createSchemeLink(e),h=JSON.stringify({actionUrl:f,functionName:ee(this.createSchemeLink(e),function(y){var O=function(){try{return JSON.parse(y)}catch{return y}}();n[0]=function(){return O===1?!0:O===0?!1:O}(),u(n)})}),this.hybridBridge.callAndBackfeed(h),[2]})})})]:(n[0]=!1,n[1]=a,[2,n]);case 2:return[2,l.sent()]}})})},t.prototype.callAndListen=function(e,n){return g(this,void 0,void 0,function(){var i,o,a,c,l=this;return p(this,function(u){switch(u.label){case 0:return i=[!1,null],[4,this.checkReady()];case 1:return o=u.sent(),a=o[0],c=o[1],a?[4,new Promise(function(f){return g(l,void 0,void 0,function(){var h,_,y;return p(this,function(O){return h=this.createSchemeLink(e),_=function(A){var N=function(){try{return JSON.parse(A)}catch{return A}}(),B=function(){return N===1?!0:N===0?!1:N}();n(B),i[0]=function(){var x=z[h];if(x){var R=x.queue.findIndex(function(m){return m.callback===_});R!==-1&&x.queue.splice(R,1)}},f(i)},y=JSON.stringify({actionUrl:h,functionName:ee(h,_,!1)}),this.hybridBridge.callAndListen(y),[2]})})})]:(i[0]=!1,i[1]=c,[2,i]);case 2:return[2,u.sent()]}})})},t}(st),Ot;(function(r){r.callAndBackfeed="callAndBack",r.callAndListen="callAndListen"})(Ot||(Ot={}));var Ce=window,wn=function(){function r(){this.checkBridgeReady()}return r.prototype.checkBridgeReady=function(t){var e=this;if(t===void 0&&(t=6e3),this.worker)return!0;var n=performance.now();return new Promise(function(i,o){var a=function(){if(e.worker)return i(!0);if(Ce.webkit&&Ce.webkit.messageHandlers&&Ce.webkit.messageHandlers.realsee){var c=Ce.webkit.messageHandlers.realsee;c.postMessage(JSON.stringify({type:"getStaticData",param:JSON.stringify({functionName:ee("HYBRID_BRIDGE_NAME",function(l){return e.deviceInfo=JSON.parse(l),e.worker=c,i(!0)})})}));return}if(performance.now()-n>(t||6e3))return o(new Error("HybridBridge 初始化超时~"));requestAnimationFrame(a)};a()})},r.prototype.checkReady=function(t){return t===void 0&&(t=6e3),g(this,void 0,void 0,function(){var e,n,i,o;return p(this,function(a){switch(a.label){case 0:if(e=[null,null],this.worker)return e[0]=!0,[2,e];a.label=1;case 1:return a.trys.push([1,3,,4]),n=e,i=0,[4,this.checkBridgeReady(t)];case 2:return n[i]=a.sent(),[3,4];case 3:return o=a.sent(),e[0]=!1,e[1]=o,[3,4];case 4:return[2,e]}})})},Object.defineProperty(r.prototype,"ready",{get:function(){return!!this.worker},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"scheme",{get:function(){var t;return((t=this.deviceInfo)===null||t===void 0?void 0:t.scheme)||""},enumerable:!1,configurable:!0}),r.prototype.createSchemeLink=function(t){return t.startsWith(this.scheme)?t:this.scheme+"://"+t},r.prototype.callAndBackfeed=function(t){return g(this,void 0,void 0,function(){var e,n,i,o,a=this;return p(this,function(c){switch(c.label){case 0:return e=[!1,null],[4,this.checkReady()];case 1:return n=c.sent(),i=n[0],o=n[1],i?[4,new Promise(function(l){return g(a,void 0,void 0,function(){var u,f;return p(this,function(h){return u=this.createSchemeLink(t),f=JSON.stringify({actionUrl:u,functionName:ee(this.createSchemeLink(t),function(_){var y=function(){try{return JSON.parse(_)}catch{return _}}();e[0]=function(){return y===1?!0:y===0?!1:y}(),l(e)})}),this.worker.postMessage(JSON.stringify({type:"callAndBackfeed",param:f})),[2]})})})]:(e[0]=!1,e[1]=o,[2,e]);case 2:return[2,c.sent()]}})})},r.prototype.callAndListen=function(t,e){return g(this,void 0,void 0,function(){var n,i,o,a,c=this;return p(this,function(l){switch(l.label){case 0:return n=[!1,null],[4,this.checkReady()];case 1:return i=l.sent(),o=i[0],a=i[1],o?[4,new Promise(function(u){return g(c,void 0,void 0,function(){var f,h,_;return p(this,function(y){return f=this.createSchemeLink(t),h=function(O){var A=function(){try{return JSON.parse(O)}catch{return O}}(),N=function(){return A===1?!0:A===0?!1:A}();e(N),n[0]=function(){var B=z[f];if(B){var x=B.queue.findIndex(function(R){return R.callback===h});x!==-1&&B.queue.splice(x,1)}},u(n)},_=JSON.stringify({actionUrl:f,functionName:ee(f,h,!1)}),this.worker.postMessage(JSON.stringify({type:"callAndListen",param:_})),[2]})})})]:(n[0]=!1,n[1]=a,[2,n]);case 2:return[2,l.sent()]}})})},r}();function re(){return((1+Math.random())*65536|0).toString(16).substring(1)}function Ie(){return(re()+re()+"-"+re()+"-4"+re().substr(0,3)+"-"+re()+"-"+re()+re()+re()).toLowerCase()}var K;(function(r){r.isReady="Are You OK?",r.ready="I`m OK!",r.ping="ping",r.pong="pong",r.alive="I`m alive!"})(K||(K={}));var Sn="wss://ws.realsee.com",En=Sn,kn=function(r,t){var e=Object.keys(t).reduce(function(n,i){return n.replace("{{".concat(i,"}}"),"".concat(t[i]))},r);return encodeURI(e)},Rn=kn,On=function(r,t){return r in t},Cn=On,In=function(r){return r===void 0&&(r=""),r.replace("?","").split("&").map(function(t){var e,n=t.split("="),i=n[0],o=n[1];return e={},e[i]=decodeURIComponent(o),e}).reduce(function(t,e){return Be(Be({},t),e)},{})},Tn=In,ge="$$REALSEE_JSBRIDGE_EVENT$$";function Te(r){return r[ge]||(r[ge]={}),r[ge]}function An(r){r[ge]||delete r[ge]}var Mt=function(){function r(){}return r.prototype.hasListener=function(t){var e=Te(this);return e&&e[t]&&e[t].length>0},r.prototype.on=function(t,e,n){var i=this,o=Te(this);return o[t]||(o[t]=[]),o[t].push([e,n||!1]),function(){return i.off(t,e)}},r.prototype.once=function(t,e){return this.on(t,e,!0)},r.prototype.off=function(t,e){if(t===void 0){An(this);return}var n=Te(this);if(n[t]||(n[t]=[]),e===void 0){n[t].length=0;return}for(var i=0;i<n[t].length&&n[t][i][0]!==e;i++);i<n[t].length&&n[t].splice(i,1)},r.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var i=!1,o=Te(this),a=o[t]||[],c=0,l=a.slice();c<l.length;c++){var u=l[c],f=u[0],h=u[1],_=h===void 0?!1:h,y=f.apply(void 0,e);_&&this.off(t,f),y===!1&&(i=!0)}return i},r}(),Pn=function(r){se(t,r);function t(e){var n=r.call(this)||this;return n._options={timeout:1e4,shouldReconnect:function(i,o){if(!(i.code===1008||i.code===1011))return[0,3e3,1e4][o.attempts]},should1000Reconnect:!1,ignoreConnectivityEvents:!1,automaticOpen:!1},n._attempts=0,n._reconnects=-1,n._reconnectWhenOnlineAgain=!1,n._explicitlyClosed=!1,n._connectivityEventsAttached=!1,n._clearPendingReconnectIfNeeded=function(){n._pendingReconnect&&(clearTimeout(n._pendingReconnect),n._pendingReconnect=void 0)},n._online=function(i){n._reconnectWhenOnlineAgain&&(n._clearPendingReconnectIfNeeded(),n._reconnect(i))},n._offline=function(){var i;n._reconnectWhenOnlineAgain=!0,(i=n._realWebSocket)===null||i===void 0||i.close(1e3)},n._detachConnectivityEvents=function(){n._connectivityEventsAttached&&(globalThis?.removeEventListener("online",n._online),globalThis?.removeEventListener("offline",n._offline),n._connectivityEventsAttached=!1)},n._attachConnectivityEvents=function(){n._connectivityEventsAttached||(globalThis?.addEventListener("online",n._online),globalThis?.addEventListener("offline",n._offline),n._connectivityEventsAttached=!0)},n.send=function(i){var o,a,c;((o=n._realWebSocket)===null||o===void 0?void 0:o.readyState)===((a=n._realWebSocket)===null||a===void 0?void 0:a.OPEN)&&((c=n._realWebSocket)===null||c===void 0||c.send(i))},n.close=function(i,o){var a;return typeof i!="number"&&(o=i,i=1e3),n._clearPendingReconnectIfNeeded(),n._reconnectWhenOnlineAgain=!1,n._explicitlyClosed=!0,n._detachConnectivityEvents(),(a=n._realWebSocket)===null||a===void 0?void 0:a.close(i,o)},n.open=function(i){var o,a;i&&(n._url=i),((o=n._realWebSocket)===null||o===void 0?void 0:o.readyState)!==WebSocket.OPEN&&((a=n._realWebSocket)===null||a===void 0?void 0:a.readyState)!==WebSocket.CONNECTING&&(n._clearPendingReconnectIfNeeded(),n._reconnectWhenOnlineAgain=!1,n._explicitlyClosed=!1,n._createWebSocket())},n._createWebSocket=function(){var i,o,a,c=typeof n._url=="string"?n._url:(i=n._url)===null||i===void 0?void 0:i.call(n,n);if(c){n._pendingReconnect=void 0,n._removeWebSocketEvent(),n._realWebSocket=new WebSocket(c,n._protocols||void 0),n._attempts=n._attempts+1,n.emit("connecting",new CustomEvent("connecting",{detail:{attempts:n._attempts,reconnects:n._reconnects}}));var l=function(){n._connectTimeout=void 0,n._detachConnectivityEvents(),n.emit("timeout",new CustomEvent("connecting",{detail:{attempts:n._attempts,reconnects:n._reconnects}}))};n._connectTimeout=setTimeout(l,(o=n._options)===null||o===void 0?void 0:o.timeout),n._dispatchWebSocketEvent(),!((a=n._options)===null||a===void 0)&&a.ignoreConnectivityEvents||n._attachConnectivityEvents()}},n._removeWebSocketEvent=function(){var i,o,a,c;(i=n._realWebSocket)===null||i===void 0||i.removeEventListener("open",n._webSocketOpenHandler),(o=n._realWebSocket)===null||o===void 0||o.removeEventListener("close",n._webSocketCloseHandler),(a=n._realWebSocket)===null||a===void 0||a.removeEventListener("error",n._webSocketErrorHandler),(c=n._realWebSocket)===null||c===void 0||c.removeEventListener("message",n._webSocketMessageHandler)},n._dispatchWebSocketEvent=function(){var i,o,a,c;(i=n._realWebSocket)===null||i===void 0||i.addEventListener("open",n._webSocketOpenHandler),(o=n._realWebSocket)===null||o===void 0||o.addEventListener("close",n._webSocketCloseHandler),(a=n._realWebSocket)===null||a===void 0||a.addEventListener("error",n._webSocketErrorHandler),(c=n._realWebSocket)===null||c===void 0||c.addEventListener("message",n._webSocketMessageHandler)},n._webSocketOpenHandler=function(i){n._connectTimeout&&(clearTimeout(n._connectTimeout),n._connectTimeout=void 0);var o=++n._reconnects,a=n._attempts;return n._attempts=0,n._reconnectWhenOnlineAgain=!1,n.emit("open",Object.assign(i,{detail:{reconnects:o,attempts:a}}))},n._webSocketCloseHandler=function(i){return n._reconnect(i),n.emit("close",i)},n._webSocketErrorHandler=function(i){return n.emit("error",new CustomEvent("error",{detail:{error:i}}))},n._webSocketMessageHandler=function(i){return n.emit("message",i)},e&&n.setOptions(e),n}return Object.defineProperty(t.prototype,"attempts",{get:function(){return this._attempts},enumerable:!1,configurable:!0}),t.prototype.setOptions=function(e){if(e){this._url=e.url,this._protocols=e.protocols;var n=Object.assign(this._options,e.robustOptions||{});if(typeof n?.timeout!="number")throw new Error("timeout must be the number of milliseconds to timeout a connection attempt");if(typeof n?.shouldReconnect!="function")throw new Error("shouldReconnect must be a function that returns the number of milliseconds to wait for a reconnect attempt, or null or undefined to not reconnect.");this._options=n,this._options.automaticOpen&&this._createWebSocket()}},t.prototype._reconnect=function(e){var n,i,o,a;if(!(!((n=this._options)===null||n===void 0)&&n.should1000Reconnect)&&e.code===1e3||this._explicitlyClosed){this._attempts=0;return}if(((i=globalThis?.navigator)===null||i===void 0?void 0:i.onLine)===!1){this._reconnectWhenOnlineAgain=!0;return}var c=(a=(o=this._options)===null||o===void 0?void 0:o.shouldReconnect)===null||a===void 0?void 0:a.call(o,e,this);typeof c=="number"&&(this._pendingReconnect=setTimeout(this._createWebSocket,c))},t}(Mt),Bn=function(){function r(){var t=this,e,n;if(this._rsWeappBridgeMethodAdapter={},this._ws=new Pn,this._readyState="close",this.initialize=function(i){return i===void 0&&(i=6e3),g(t,void 0,void 0,function(){var o,a,c,l,u,f,h,_,y,O,A,N;return p(this,function(B){switch(B.label){case 0:if(o=[!1,null],a=Tn(globalThis.location.search),c=a.wssid,l=a.wstsp,u=a.wssig,f=a.wsmnt,h=f===void 0?En:f,!(c&&l&&u&&h))return o[1]=new Error("HybridBridge 参数缺失,初始化失败~"),[2,o];_=Rn("{{origin}}/{{endpoint}}/{{uuid}}/{{member}}/{{ak}}/{{ts}}/{{sign}}",{origin:h,endpoint:"proxy",uuid:c,member:"webview",ak:"vr_live_miniapp",ts:l,sign:u}),B.label=1;case 1:return B.trys.push([1,6,,7]),[4,this._open(_)];case 2:return y=B.sent(),y?(this.initBuiltInHandlers(),O=o,A=0,[4,this.waitReady(i)]):[3,4];case 3:return O[A]=B.sent(),[3,5];case 4:o[1]=new Error("HybridBridge ws未连接,初始化失败~"),B.label=5;case 5:return[3,7];case 6:return N=B.sent(),o[1]=N,[3,7];case 7:return[2,o]}})})},this.initBuiltInHandlers=function(){t._registerLifecycleHandler(),t._registerHeartbeatHandler(),t._registerMessageHandler(),t._registerBridgeRequestHandler(),t._registerReadyHandler()},this._open=function(i){return new Promise(function(o){var a=function(){t._receivedMessage(K.ready,function(){return o(!0)},!0),t._ws.once("timeout",function(){return o(!1)}),t.send(K.isReady)};t._ws.once("open",a),t._ws.open(i)})},this._registerLifecycleHandler=function(){t._ws.on("connecting",function(){console.log("RsWeappBridge connecting"),t._readyState="connecting"}),t._ws.on("open",function(){console.log("RsWeappBridge open"),t._readyState="open"}),t._ws.on("close",function(){t._readyState="close"}),t._ws.on("error",function(){console.log("RsWeappBridge error"),t._readyState="close"}),t._ws.on("timeout",function(){console.log("RsWeappBridge timeout"),t._readyState="close"})},this._registerHeartbeatHandler=function(){t._receivedMessage(K.ping,function(){return setTimeout(function(){return t._ws.send(K.pong)},500)}),t._receivedMessage(K.pong,function(){return setTimeout(function(){return t._ws.send(K.ping)},1e3)})},this._receivedMessage=function(i,o,a){var c=function(l){l.data===i&&(o(),a&&t._ws.off("message",c))};t._ws.on("message",c)},this._registerReadyHandler=function(){t._receivedMessage(K.isReady,function(){return t._ws.send(K.ready)})},this.send=function(i){t._ws.send(i)},this.waitReady=function(i){return i===void 0&&(i=6e3),new Promise(function(o,a){t._receivedMessage(K.ready,function(){return o(!0)}),t.send(K.isReady),setTimeout(function(){return a("HybridBridge 初始化超时~")},i)})},this._parseMessage=function(i){try{return JSON.parse(i.data)}catch{return i.data}},this._registerMessageHandler=function(){t._ws.on("message",function(i){var o=t._parseMessage(i);if(typeof o=="object"){var a=o.id,c=o.command,l=o.data;c==="message"&&typeof t._rsWeappBridgeMethodAdapter.bindMessage=="function"&&t._rsWeappBridgeMethodAdapter.bindMessage({id:a,data:l})}})},this.getStaticData=function(i){t.callAndBackfeed(JSON.stringify({actionUrl:"common/staticData",functionName:i}))},this.callAndBackfeed=function(i){var o=JSON.parse(i),a=o.actionUrl,c=a===void 0?"":a,l=o.functionName,u=l===void 0?"":l;if(!c)throw new Error("callAndBackfeed actionUrl is empty!");if(!u)throw new Error("callAndBackfeed functionName is empty!");var f=function(h){typeof globalThis[u]=="function"&&globalThis[u](h)};t._callAndBackfeed(c,f)},this.callAndListen=function(i){var o=JSON.parse(i),a=o.actionUrl,c=o.functionName;if(!a)throw new Error("callAndListen actionUrl is empty!");if(!c)throw new Error("callAndListen functionName is empty!");var l=function(u){typeof globalThis[c]=="function"&&globalThis[c](u)};try{t._callAndListen(a,l)}catch(u){console.warn(u),l(!1)}},this.execute=function(i,o){return g(t,void 0,void 0,function(){return p(this,function(a){switch(a.label){case 0:return[4,this._invokeBridgeMethod(i,o)];case 1:return[2,a.sent()]}})})},this._invokeBridgeMethod=function(i,o){return new Promise(function(a,c){var l=Ie(),u=function(f){var h=t._parseMessage(f);typeof h=="object"&&h.method===i&&h.id===l&&(t._ws.off("message",u),h.error?c(h.error):a(h.data))};t._ws.on("message",u),t.send(JSON.stringify({method:i,args:o,id:l}))})},((e=globalThis?.window)===null||e===void 0?void 0:e.__Realsee_WxMini_HybridBridge__)instanceof r)return(n=globalThis?.window)===null||n===void 0?void 0:n.__Realsee_WxMini_HybridBridge__;globalThis?.window&&(globalThis.window.__Realsee_WxMini_HybridBridge__=this,this.initBuiltInHandlers())}return Object.defineProperty(r.prototype,"isReady",{get:function(){return this._readyState==="open"},enumerable:!1,configurable:!0}),r.prototype._registerBridgeRequestHandler=function(){var t=this;this._ws.on("message",function(e){return g(t,void 0,void 0,function(){var n,i,o,a,c,l,u,f,h;return p(this,function(_){switch(_.label){case 0:if(n=this._parseMessage(e),typeof n!="object")return[3,7];if(i=n.id,o=n.method,a=n.args,c=n.command,c!=="request")return[3,7];if(!o)return[3,7];if(l=null,u=null,f=null,typeof this._rsWeappBridgeMethodAdapter[o]=="function"?f=this._rsWeappBridgeMethodAdapter[o]:globalThis&&Cn(o,globalThis)&&(f=globalThis[o]),typeof f!="function")return[3,5];_.label=1;case 1:return _.trys.push([1,3,,4]),[4,f(a)];case 2:return l=_.sent(),[3,4];case 3:return h=_.sent(),u=h.message||h,[3,4];case 4:return[3,6];case 5:u="Method not implemented.",_.label=6;case 6:this.send(JSON.stringify({id:i,method:o,result:l,error:u,command:"response"})),_.label=7;case 7:return[2]}})})})},r.prototype._callAndBackfeed=function(t,e){var n=this,i=Ie(),o=JSON.stringify({id:i,actionUrl:t,command:"rsSchemeRequest",type:"callAndBackfeed"}),a=null,c=function(l){var u=n._parseMessage(l);if(typeof u=="object"){var f=u.id,h=u.result,_=u.errmsg,y=u.command;y==="rsSchemeResponse"&&f===i&&(n._ws.off("message",c),a&&clearTimeout(a),_?(console.warn(_),e(0)):e(h))}};this._ws.on("message",c),this.send(o),a=globalThis.setTimeout(function(){console.warn("callAndBackfeed timeout"),e(0)},3e4)},r.prototype._callAndListen=function(t,e){var n=this,i=Ie(),o=JSON.stringify({id:i,actionUrl:t,command:"rsSchemeRequest",type:"callAndListen"}),a=function(c){var l=n._parseMessage(c);if(typeof l=="object"){var u=l.id,f=l.result,h=l.errmsg,_=l.command;_==="rsSchemeResponse"&&u===i&&(h?(console.warn(h),e(!1)):e(f))}};this._ws.on("message",a),this.send(o)},r.prototype.invoke=function(t,e){return g(this,void 0,void 0,function(){var n=this;return p(this,function(i){return[2,new Promise(function(o,a){var c=Ie(),l=JSON.stringify({id:c,method:t,args:e,command:"request"}),u=null,f=function(h){var _=n._parseMessage(h);if(typeof _=="object"){var y=_.id,O=_.result,A=_.error,N=_.command;N==="response"&&y===c&&_.method===t&&(n._ws.off("message",f),u&&clearTimeout(u),A?a(A):o(O))}};n._ws.on("message",f),n.send(l),u=setTimeout(function(){return a("method invoke timeout")},3e4)})]})})},r}(),Ln=Bn,Nn=function(r){se(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e._hybridBridge=new Ln,e.initializing=!1,e}return Object.defineProperty(t.prototype,"hybridBridge",{get:function(){return this._hybridBridge},enumerable:!1,configurable:!0}),t.prototype.checkBridgeReady=function(e){var n=this;return e===void 0&&(e=6e4),this.ready?!0:new Promise(function(i,o){return g(n,void 0,void 0,function(){var a,c,l,u,f=this;return p(this,function(h){switch(h.label){case 0:return this.ready?[2,i(!0)]:this.initializing?(a=function(){if(f.ready)return i(!0);requestAnimationFrame(a)},a(),[3,3]):[3,1];case 1:return this.initializing=!0,[4,this._hybridBridge.initialize(e)];case 2:if(c=h.sent(),l=c[0],u=c[1],!l||u)throw u||new Error("HybridBridge 初始化失败~");return this._hybridBridge.getStaticData(ee("HYBRID_BRIDGE_NAME",function(_){f.deviceInfo=function(){try{return JSON.parse(_)}catch{return _}}()})),this.initializing=!1,[2,i(!0)];case 3:return[2]}})})})},t.prototype.checkReady=function(e){return e===void 0&&(e=6e4),g(this,void 0,void 0,function(){var n,i,o,a;return p(this,function(c){switch(c.label){case 0:if(n=[null,null],this.ready)return n[0]=!0,[2,n];c.label=1;case 1:return c.trys.push([1,3,,4]),i=n,o=0,[4,this.checkBridgeReady(e)];case 2:return i[o]=c.sent(),[3,4];case 3:return a=c.sent(),n[0]=!1,n[1]=a,[3,4];case 4:return[2,n]}})})},Object.defineProperty(t.prototype,"ready",{get:function(){return!!this._hybridBridge.isReady},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scheme",{get:function(){var e;return((e=this.deviceInfo)===null||e===void 0?void 0:e.scheme)||""},enumerable:!1,configurable:!0}),t.prototype.createSchemeLink=function(e){return e.startsWith(this.scheme)?e:this.scheme+"://"+e},t.prototype.callAndBackfeed=function(e){return g(this,void 0,void 0,function(){var n,i,o,a,c=this;return p(this,function(l){switch(l.label){case 0:return n=[!1,null],[4,this.checkReady()];case 1:return i=l.sent(),o=i[0],a=i[1],o?[4,new Promise(function(u){return g(c,void 0,void 0,function(){var f,h;return p(this,function(_){return f=this.createSchemeLink(e),h=JSON.stringify({actionUrl:f,functionName:ee(this.createSchemeLink(e),function(y){var O=y;try{O=JSON.parse(y)}catch{}n[0]=function(){return O===1?!0:O===0?!1:O}(),u(n)})}),this._hybridBridge.callAndBackfeed(h),[2]})})})]:(n[0]=!1,n[1]=a,[2,n]);case 2:return[2,l.sent()]}})})},t.prototype.callAndListen=function(e,n){return g(this,void 0,void 0,function(){var i,o,a,c,l=this;return p(this,function(u){switch(u.label){case 0:return i=[!1,null],[4,this.checkReady()];case 1:return o=u.sent(),a=o[0],c=o[1],a?[4,new Promise(function(f){return g(l,void 0,void 0,function(){var h,_,y;return p(this,function(O){return h=this.createSchemeLink(e),_=function(A){var N=A;try{N=JSON.parse(A)}catch{}var B=function(){return N===1?!0:N===0?!1:N}();n(B),i[0]=function(){var x=z[h];if(x){var R=x.queue.findIndex(function(m){return m.callback===_});R!==-1&&x.queue.splice(R,1)}},f(i)},y=JSON.stringify({actionUrl:h,functionName:ee(h,_,!1)}),this._hybridBridge.callAndListen(y),[2]})})})]:(i[0]=!1,i[1]=c,[2,i]);case 2:return[2,u.sent()]}})})},t.prototype.invoke=function(e,n){var i,o;return g(this,void 0,void 0,function(){var a,c,l,u;return p(this,function(f){switch(f.label){case 0:return a=[!1,null],[4,this.checkReady()];case 1:if(c=f.sent(),l=c[0],u=c[1],l)return[3,2];throw a[0]=!1,a[1]=u,u;case 2:return[4,(o=(i=this._hybridBridge).invoke)===null||o===void 0?void 0:o.call(i,e,n)];case 3:return[2,f.sent()]}})})},t}(st),H;(function(r){r.WebView="WebKit",r.WKWebview="WKWebview",r.UIWebview="UIWebview",r.Browser="Browser",r.WeChatMPWebView="WxMiniProgramWebView",r.Unsupported="Unsupported"})(H||(H={}));var We=function(r){se(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.webViewType=H.Unsupported,e}return t}(Mt),_e=globalThis.navigator.userAgent,tt=/android/gi.test(_e),nt=/iPhone|iPad\s+OS/gi.test(_e),Vt=/MicroMessenger/gi.test(_e)&&/miniProgram/gi.test(_e),Dt=/realsee/gi.test(_e),jn={timeout:6e3},Wn=function(r){se(t,r);function t(e){e===void 0&&(e={});var n=r.call(this)||this;return n.options=Object.assign(jn,e),Dt||console.warn("未知容器:此版本 `jsBridge` 不支持当前 WebView 容器 ... "),n.webViewType=function(){return tt?H.WebView:nt?H.WKWebview:H.Browser}(),n._controller=function(){return tt?new yn:nt?new wn:new st}(),n.callAndListen("common/webViewState",function(i){n.emit("webViewStateChange",i)}),n.callAndListen("common/webViewError",function(i){n.emit("error",i)}),n}return t.prototype.ready=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this._controller.checkReady(this.options.timeout)];case 1:return[2,e.sent()]}})})},t.prototype.callAndBackfeed=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this._controller.callAndBackfeed(e)];case 1:return[2,n.sent()]}})})},t.prototype.callAndListen=function(e,n){var i;return g(this,void 0,void 0,function(){return p(this,function(o){switch(o.label){case 0:return[4,(i=this._controller)===null||i===void 0?void 0:i.callAndListen(e,n)];case 1:return[2,o.sent()]}})})},t.prototype.setLeftTopBackButton=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return this.webViewType===H.WebView?[2,[!0,null]]:[4,this.callAndBackfeed("common/setLeftTopBackButton?enable=".concat(e?1:0))];case 1:return[2,n.sent()]}})})},t.prototype.getBangsHeight=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getBangsHeight")];case 1:return[2,e.sent()]}})})},t.prototype.shock=function(e){return e===void 0&&(e=4),g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/shock?duration=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.minimize=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/minimize")];case 1:return[2,e.sent()]}})})},t.prototype.loadProgress=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return e=e<0?0:e>100?100:e,[4,this.callAndBackfeed("common/loadProgress?progress=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.closeLoading=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/closeLoading")];case 1:return[2,e.sent()]}})})},t.prototype.setOrientation=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/setOrientation?orientation=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.keepScreenLight=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/keepScreenLight?enable=".concat(e?1:0))];case 1:return[2,n.sent()]}})})},t.prototype.closeWebView=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/closeWebView")];case 1:return[2,e.sent()]}})})},t.prototype.openWebView=function(e,n){return g(this,void 0,void 0,function(){return p(this,function(i){switch(i.label){case 0:return[4,this.callAndBackfeed("common/openWebView?way=".concat(n,"&url=").concat(encodeURIComponent(e)))];case 1:return[2,i.sent()]}})})},t.prototype.saveImage2Album=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/saveImage2Album?base64=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.actionShare=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/actionShare?json=".concat(JSON.stringify(e)))];case 1:return[2,n.sent()]}})})},t.prototype.getDeviceInfo=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getDeviceInfo")];case 1:return[2,e.sent()]}})})},t.prototype.getUserInfo=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getUserInfo")];case 1:return[2,e.sent()]}})})},t.prototype.getWebViewState=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getWebViewState")];case 1:return[2,e.sent()]}})})},t.prototype.login=function(){return g(this,void 0,void 0,function(){var e;return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/login")];case 1:return e=n.sent(),e[0]?[4,this.getUserInfo()]:[3,3];case 2:return[2,n.sent()];case 3:return[2,e]}})})},t.prototype.logout=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/logout")];case 1:return[2,e.sent()]}})})},t.prototype.detectMicro=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/detectMicro")];case 1:return[2,e.sent()]}})})},t.prototype.preload=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return e=e.map(function(i){return i.startsWith("//")?"https:"+i:i}),[4,this.callAndBackfeed("common/preload?urls=".concat(JSON.stringify(e)))];case 1:return[2,n.sent()]}})})},t.prototype.createCacheProxyUrl=function(e){var n=this;e=Array.isArray(e)?e:[e];var i=window.navigator.userAgent;if(!/supportCache/i.test(i))return e;var o=function(a){return n.webViewType===H.WKWebview?a.replace(/https*:/,"").replace(/\/\//,"realseeproxycache://"):n.webViewType===H.WebView?a+(a.indexOf("?")!==-1?"&":"?")+"realseeproxycache=1":a};return e.map(o)},t}(We),pe;(function(r){r.Append="Append",r.Replace="Replace",r.Single="Single"})(pe||(pe={}));var Mn=function(r){se(t,r);function t(){var e=r!==null&&r.apply(this,arguments)||this;return e.webViewType=H.Browser,e}return t.prototype.ready=function(){return Promise.resolve([!0,null])},t.prototype.callAndBackfeed=function(e){return Promise.resolve([!1,null])},t.prototype.callAndListen=function(e,n){return Promise.resolve([function(){},null])},t.prototype.loadProgress=function(e){return Promise.resolve([!0,null])},t.prototype.closeLoading=function(){return Promise.resolve([!0,null])},t.prototype.getDeviceInfo=function(){return Promise.resolve([!1,null])},t.prototype.getWebViewState=function(){return Promise.resolve([!1,null])},t.prototype.setLeftTopBackButton=function(e){return Promise.resolve([!1,null])},t.prototype.login=function(){return Promise.resolve([!1,null])},t.prototype.logout=function(){return Promise.resolve([!1,null])},t.prototype.getUserInfo=function(){return Promise.resolve([!1,null])},t.prototype.openWebView=function(e,n){switch(n){case pe.Replace:case pe.Single:{setTimeout(function(){return globalThis.location.replace(e)},200);break}case pe.Append:default:{setTimeout(function(){return globalThis.location.href=e},200);break}}return Promise.resolve([!0,null])},t.prototype.closeWebView=function(){return globalThis.close(),Promise.resolve([!0,null])},t.prototype.getBangsHeight=function(){return Promise.resolve([0,null])},t.prototype.setOrientation=function(e){return Promise.resolve([!1,null])},t.prototype.keepScreenLight=function(e){return Promise.resolve([!1,null])},t.prototype.shock=function(e){return Promise.resolve([!1,null])},t.prototype.minimize=function(){return Promise.resolve([!1,null])},t.prototype.saveImage2Album=function(e){return Promise.resolve([!1,null])},t.prototype.detectMicro=function(){return new Promise(function(e){var n={audio:!0,video:!1};try{globalThis.navigator.mediaDevices.getUserMedia(n).then(function(){return e([!0,null])}).catch(function(i){return e([!1,i])})}catch(i){console.error(i),e([!1,i])}})},t.prototype.actionShare=function(e){return Promise.resolve([!1,null])},t.prototype.preload=function(e){return Promise.resolve([!1,null])},t.prototype.createCacheProxyUrl=function(e){return[]},t}(We),Vn={timeout:6e4},Dn=function(r){se(t,r);function t(e){e===void 0&&(e={});var n=r.call(this)||this;return n._controller=new Nn,n.options=Object.assign(Vn,e),Vt||console.warn("未知容器:此版本 `jsBridge` 不支持当前 WebView 容器 ... "),n.webViewType=H.WeChatMPWebView,n.callAndListen("common/webViewState",function(i){n.emit("webViewStateChange",i)}),n.callAndListen("common/webViewError",function(i){n.emit("error",i)}),n}return t.prototype.ready=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this._controller.checkReady(this.options.timeout)];case 1:return[2,e.sent()]}})})},t.prototype.callAndBackfeed=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this._controller.callAndBackfeed(e)];case 1:return[2,n.sent()]}})})},t.prototype.callAndListen=function(e,n){return g(this,void 0,void 0,function(){return p(this,function(i){switch(i.label){case 0:return[4,this._controller.callAndListen(e,n)];case 1:return[2,i.sent()]}})})},t.prototype.setLeftTopBackButton=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return this.webViewType===H.WebView?[2,[!0,null]]:[4,this.callAndBackfeed("common/setLeftTopBackButton?enable=".concat(e?1:0))];case 1:return[2,n.sent()]}})})},t.prototype.getBangsHeight=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getBangsHeight")];case 1:return[2,e.sent()]}})})},t.prototype.shock=function(e){return e===void 0&&(e=4),g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/shock?duration=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.minimize=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/minimize")];case 1:return[2,e.sent()]}})})},t.prototype.loadProgress=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return e=e<0?0:e>100?100:e,[4,this.callAndBackfeed("common/loadProgress?progress=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.closeLoading=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/closeLoading")];case 1:return[2,e.sent()]}})})},t.prototype.setOrientation=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/setOrientation?orientation=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.keepScreenLight=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/keepScreenLight?enable=".concat(e?1:0))];case 1:return[2,n.sent()]}})})},t.prototype.closeWebView=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/closeWebView")];case 1:return[2,e.sent()]}})})},t.prototype.openWebView=function(e,n){return g(this,void 0,void 0,function(){return p(this,function(i){switch(i.label){case 0:return[4,this.callAndBackfeed("common/openWebView?way=".concat(n,"&url=").concat(encodeURIComponent(e)))];case 1:return[2,i.sent()]}})})},t.prototype.saveImage2Album=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/saveImage2Album?base64=".concat(e))];case 1:return[2,n.sent()]}})})},t.prototype.actionShare=function(e){var n,i,o;return g(this,void 0,void 0,function(){var a;return p(this,function(c){switch(c.label){case 0:return a={path:(n=e.miniprogram)===null||n===void 0?void 0:n[0].path,title:(i=e.miniprogram)===null||i===void 0?void 0:i[0].title,imageUrl:(o=e.miniprogram)===null||o===void 0?void 0:o[0].hdImageData},[4,this.callAndBackfeed("common/actionShare?json=".concat(JSON.stringify(a)))];case 1:return[2,c.sent()]}})})},t.prototype.getDeviceInfo=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getDeviceInfo")];case 1:return[2,e.sent()]}})})},t.prototype.getUserInfo=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getUserInfo")];case 1:return[2,e.sent()]}})})},t.prototype.getWebViewState=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/getWebViewState")];case 1:return[2,e.sent()]}})})},t.prototype.login=function(){return g(this,void 0,void 0,function(){var e;return p(this,function(n){switch(n.label){case 0:return[4,this.callAndBackfeed("common/login")];case 1:return e=n.sent(),e[0]?[4,this.getUserInfo()]:[3,3];case 2:return[2,n.sent()];case 3:return[2,e]}})})},t.prototype.logout=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/logout")];case 1:return[2,e.sent()]}})})},t.prototype.detectMicro=function(){return g(this,void 0,void 0,function(){return p(this,function(e){switch(e.label){case 0:return[4,this.callAndBackfeed("common/detectMicro")];case 1:return[2,e.sent()]}})})},t.prototype.preload=function(e){return g(this,void 0,void 0,function(){return p(this,function(n){switch(n.label){case 0:return e=e.map(function(i){return i.startsWith("//")?"https:"+i:i}),[4,this.callAndBackfeed("common/preload?urls=".concat(JSON.stringify(e)))];case 1:return[2,n.sent()]}})})},t.prototype.createCacheProxyUrl=function(e){var n=this;e=Array.isArray(e)?e:[e];var i=window.navigator.userAgent;if(!/supportCache/i.test(i))return e;var o=function(a){return n.webViewType===H.WKWebview?a.replace(/https*:/,"").replace(/\/\//,"realseeproxycache://"):n.webViewType===H.WebView?a+(a.indexOf("?")!==-1?"&":"?")+"realseeproxycache=1":a};return e.map(o)},t.prototype.invokeNativeApi=function(e,n){return g(this,void 0,void 0,function(){return p(this,function(i){switch(i.label){case 0:return[4,this._controller.invoke(e,n)];case 1:return[2,i.sent()]}})})},t.prototype.execute=function(e,n){var i,o,a;return g(this,void 0,void 0,function(){return p(this,function(c){switch(c.label){case 0:return[4,(a=(o=(i=this._controller)===null||i===void 0?void 0:i.hybridBridge)===null||o===void 0?void 0:o.execute)===null||a===void 0?void 0:a.call(o,e,n)];case 1:return[2,c.sent()]}})})},t}(We),xn=function(r){se(t,r);function t(e){return e===void 0&&(e={}),r.call(this),Dt&&(tt||nt)?new Wn(e):Vt?new Dn(e):new Mn}return t}(We);function Un(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xt={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.LogLevel=void 0;var t;(function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.OFF=4]="OFF"})(t=r.LogLevel||(r.LogLevel={})),r.default=t})(xt);const Ct=Un(xt);function $n(r,t={}){const e=r.indexOf("?")!==-1,n=Object.keys(t).reduce((i,o,a)=>`${i}${a===0&&!e?"?":"&"}${o}=${t[o]}`,"");return r+n}const be=globalThis.navigator.userAgent,Hn=/android/gi.test(be),qn=/iPhone|iPad\s+OS/gi.test(be),Jn=/MicroMessenger/gi.test(be)&&/miniProgram/gi.test(be),Fn=/realsee/gi.test(be);function Le(r){return Object.prototype.toString.call(r)==="[object Object]"}function Me(r,t){return r===t?!0:typeof r!=typeof t?!1:!!(Number.isNaN(r)&&Number.isNaN(t))}function Kn(r,t){const e=Object.getOwnPropertyNames(r),n=Object.getOwnPropertyNames(t);if(e.length!==n.length)return!1;for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!Me(r[a],t[a]))return!1}return!0}function Gn(r,t){if(r.length!==t.length)return!1;for(let e=0,n=r.length;e<n;e++)if(!Me(r[e],t[e]))return!1;return!0}function Yn(r,t){return Me(r,t)?!0:Le(r)&&Le(t)?Kn(r,t):Array.isArray(r)&&Array.isArray(t)?Gn(r,t):!1}function at(r,t){return Me(r,t)?!0:Le(r)&&Le(t)?Xn(r,t):Array.isArray(r)&&Array.isArray(t)?zn(r,t):!1}function zn(r,t){if(r.length!==t.length)return!1;for(let e=0,n=r.length;e<n;e++)if(!at(r[e],t[e]))return!1;return!0}function Xn(r,t){const e=Object.getOwnPropertyNames(r),n=Object.getOwnPropertyNames(t);if(e.length!==n.length)return!1;for(let i=0,o=e.length;i<o;i++){const a=e[i];if(!at(r[a],t[a]))return!1}return!0}function It(r,t,e={deep:!1}){return e.deep?at(r,t):Yn(r,t)}class Zn extends me{_realWebSocket;_url;_protocols;_readyState=Pe.NOTINITIALIZED;_options={timeout:1e4,shouldReconnect:(t,e)=>{if(!(t.code===1008||t.code===1011))return[0,3e3,1e4][e.attempts]},should1000Reconnect:!1,ignoreConnectivityEvents:!1,automaticOpen:!1};_connectTimeout;_attempts=0;_reconnects=-1;_reconnectWhenOnlineAgain=!1;_explicitlyClosed=!1;_pendingReconnect;_connectivityEventsAttached=!1;_heathCheckTimer;get attempts(){return this._attempts}constructor(t){super(),t&&this.setOptions(t),this._startHealthCheck()}setOptions(t){if(!t)return;this._url=t.url,this._protocols=t.protocols;const e=Object.assign(this._options,t.robustOptions||{});if(typeof e?.timeout!="number")throw new Error("timeout must be the number of milliseconds to timeout a connection attempt");if(typeof e?.shouldReconnect!="function")throw new Error("shouldReconnect must be a function that returns the number of milliseconds to wait for a reconnect attempt, or null or undefined to not reconnect.");this._options=e,this._options.automaticOpen&&this._createWebSocket()}_healthCheck=async()=>{this._realWebSocket&&this._realWebSocket.readyState!==this._readyState&&(this._readyState=this._realWebSocket.readyState,this._readyState===Pe.CLOSING&&this.emit("closing")),await new Promise(t=>setTimeout(t,2e3)),this._heathCheckTimer=requestAnimationFrame(this._healthCheck)};_clearHeathCheckIfNeed=()=>{this._heathCheckTimer&&(cancelAnimationFrame(this._heathCheckTimer),this._heathCheckTimer=void 0)};_startHealthCheck=()=>{this._clearHeathCheckIfNeed(),this._heathCheckTimer=requestAnimationFrame(this._healthCheck)};_stopHealthCheck=()=>{this._clearHeathCheckIfNeed()};_clearPendingReconnectIfNeeded=()=>{this._pendingReconnect&&(clearTimeout(this._pendingReconnect),this._pendingReconnect=void 0)};_online=t=>{this._reconnectWhenOnlineAgain&&(this._clearPendingReconnectIfNeeded(),this._reconnect(t))};_offline=()=>{this._reconnectWhenOnlineAgain=!0,this._realWebSocket?.close(1e3,"offline")};_detachConnectivityEvents=()=>{this._connectivityEventsAttached&&(globalThis?.removeEventListener("online",this._online),globalThis?.removeEventListener("offline",this._offline),this._connectivityEventsAttached=!1)};_attachConnectivityEvents=()=>{this._connectivityEventsAttached||(globalThis?.addEventListener("online",this._online),globalThis?.addEventListener("offline",this._offline),this._connectivityEventsAttached=!0)};send=t=>{this._realWebSocket?.readyState===this._realWebSocket?.OPEN&&this._realWebSocket?.send(t)};close=(t,e)=>(typeof t!="number"&&(e=t,t=1e3),this._clearPendingReconnectIfNeeded(),this._reconnectWhenOnlineAgain=!1,this._explicitlyClosed=!0,this._detachConnectivityEvents(),this._realWebSocket?.close(t,e));open=t=>{t&&(this._url=t),this._realWebSocket?.readyState!==WebSocket.OPEN&&this._realWebSocket?.readyState!==WebSocket.CONNECTING&&(this._clearPendingReconnectIfNeeded(),this._reconnectWhenOnlineAgain=!1,this._explicitlyClosed=!1,this._createWebSocket())};_createWebSocket=()=>{const t=typeof this._url=="string"?this._url:this._url?.(this);if(!t)return;this._pendingReconnect=void 0,this._removeWebSocketEvent(),this._realWebSocket=new WebSocket(t,this._protocols||void 0),this._attempts=this._attempts+1,this.emit("connecting",new CustomEvent("connecting",{detail:{attempts:this._attempts,reconnects:this._reconnects}}));const e=()=>{this._connectTimeout=void 0,this._detachConnectivityEvents(),this.emit("timeout",new CustomEvent("connecting",{detail:{attempts:this._attempts,reconnects:this._reconnects}}))};this._connectTimeout=setTimeout(e,this._options?.timeout),this._dispatchWebSocketEvent(),this._options?.ignoreConnectivityEvents||this._attachConnectivityEvents()};_removeWebSocketEvent=()=>{this._realWebSocket?.removeEventListener("open",this._webSocketOpenHandler),this._realWebSocket?.removeEventListener("close",this._webSocketCloseHandler),this._realWebSocket?.removeEventListener("error",this._webSocketErrorHandler),this._realWebSocket?.removeEventListener("message",this._webSocketMessageHandler)};_dispatchWebSocketEvent=()=>{this._realWebSocket?.addEventListener("open",this._webSocketOpenHandler),this._realWebSocket?.addEventListener("close",this._webSocketCloseHandler),this._realWebSocket?.addEventListener("error",this._webSocketErrorHandler),this._realWebSocket?.addEventListener("message",this._webSocketMessageHandler)};_webSocketOpenHandler=t=>{this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=void 0);const e=++this._reconnects,n=this._attempts;return this._attempts=0,this._reconnectWhenOnlineAgain=!1,this._startHealthCheck(),this.emit("open",Object.assign(t,{detail:{reconnects:e,attempts:n}}))};_webSocketCloseHandler=t=>(this._reconnect(t),this._stopHealthCheck(),this.emit("close",t));_webSocketErrorHandler=t=>this.emit("error",new CustomEvent("error",{detail:{error:t}}));_webSocketMessageHandler=t=>this.emit("message",t);_reconnect(t){if(!this._options?.should1000Reconnect&&t.code===1e3||this._explicitlyClosed){this._attempts=0;return}if(globalThis?.navigator?.onLine===!1){this._reconnectWhenOnlineAgain=!0;return}const e=this._options?.shouldReconnect?.(t,this);typeof e=="number"&&(this._pendingReconnect=setTimeout(this._createWebSocket,e))}}class Qn extends me{_ws=new Zn({url:"",robustOptions:{timeout:18e4}});_state=U.NOTINITIALIZED;set state(t){const e=JSON.parse(JSON.stringify(this._state));this._state=t,this.emit("stateChange",this.state,e)}get state(){return this._state}constructor(){super(),this._addWebSocketEventListeners()}_addWebSocketEventListeners=()=>{this._ws.on("close",this._handleCloseEvent),this._ws.on("closing",this._handleClosingEvent),this._ws.on("connecting",this._handleConnectingEvent),this._ws.on("error",this._handleErrorEvent),this._ws.on("message",this._handleMessageEvent),this._ws.on("open",this._handleOpenEvent),this._ws.on("timeout",this._handleTimeoutEvent)};_removeWebSocketEventListeners=()=>{this._ws.off("close",this._handleCloseEvent),this._ws.off("closing",this._handleClosingEvent),this._ws.off("connecting",this._handleConnectingEvent),this._ws.off("error",this._handleErrorEvent),this._ws.off("message",this._handleMessageEvent),this._ws.off("open",this._handleOpenEvent),this._ws.off("timeout",this._handleTimeoutEvent)};_handleCloseEvent=t=>{V.info(`live room closed bacause of ${t.code}-${t.reason||Wt(t.code)}`),this.state=U.CLOSED};_handleClosingEvent=()=>{V.info("live room is closing, onLine:",globalThis?.navigator?.onLine),this.state=U.CLOSED};_handleConnectingEvent=()=>{V.info("live room is connecting"),this.state=U.CONNECTING};_handleErrorEvent=t=>{V.error("live room error",t),this.state=U.CLOSED};_handleMessageEvent=t=>{let e=(()=>{try{return JSON.parse(t.data)}catch{return t.data}})();this.emit("message",e)};_handleOpenEvent=t=>{V.info("live room open",t.detail),this.state=U.OPEN,t.detail.reconnects>0&&this.emit("reconnected",t.detail)};_handleTimeoutEvent=t=>{V.error("live room connect timeout!",t.detail),this.state=U.CLOSED};dispose=async()=>(this._removeWebSocketEventListeners(),await this.close("live room close by controller disposed!"));open=t=>this._ws.open(t);close=(t,e)=>new Promise(n=>{this._ws.once("close",()=>n(!0)),this._ws.close(t,e)});sendMessage(t=""){if(t==null||t==="")throw new Error("live message is empty!");if(this.state===U.OPEN)return this._ws.send(JSON.stringify(t));throw new Error("live has not yet been initialized!")}}const er=r=>Promise.reject("unimplemented method GetVoiceSign"),Ge=(r,t={},e=[])=>({command:r,front_request_id:Ae(),data:{...t,to_user_ids:Array.isArray(e)?e:[e]}}),tr=()=>{window?.__Realsee_Live__&&(window?.__Realsee_Live__?.dispose?.(),window.__Realsee_Live__=null)};class nr extends me{_options={};get options(){return Object.freeze(this._options||{})}get state(){return this._controller.state}get readyState(){return this._controller.state}get url(){return this.options.url}get $RTC(){return this._options.rtc}get jsBridge(){return this._options.jsBridge}keyframes=new me;_buildInData={keyframes:{}};get snapshot(){return this._buildInData.keyframes}getFramesByKey=t=>this.snapshot[t];sendKeyframe=(t,e)=>{if(this.state!==U.OPEN)return!1;this._buildInData.keyframes={...this._buildInData.keyframes,[t]:e};const n=Ge(q.KeyframeSync,this.snapshot);try{return this._controller.sendMessage(n),!0}catch(i){return V.error(i),!1}};get selfInfo(){return this._buildInData.selfInfo}get userList(){return this._buildInData.userList||[]}get roomInfo(){return this._buildInData.roomInfo}_controller=new Qn;constructor(t){super(),this._addLiveControllerEventListeners(),this._options=Object.assign({initialMicroStatus:ie.OPEN},t),this._options.jsBridge=(()=>{if(t.jsBridge)return t.jsBridge;if(t.useBuiltInJsBridge)return new xn})(),this._options.getVoiceSign=t.getVoiceSign??er,this._options.autoPlayConfirm=t.autoPlayConfirm,this._options.rtc=(()=>{if(t.rtc)return t.rtc;if(t.rtcType)switch(t.getVoiceSign||V.error("GetVoiceSign method must be passed when using built-in RTC instances"),t.rtcType){case oe.RealseeVRWebViewRTC:{if(this._options.jsBridge)return new Qe({jsBridge:this._options.jsBridge,getVoiceSign:this._options.getVoiceSign});V.error("JsBridge instance must be passed when using built-in VRWebViewRTC instances");return}case oe.RealseeBrowserChimeRTC:return new Ze({getVoiceSign:this._options.getVoiceSign,logLevel:t.__debug__?Ct.DEBUG:Ct.ERROR});case oe.RealseeBrowserRTC:return this._options.autoPlayConfirm||V.error("autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances"),new Xe({getVoiceSign:this._options.getVoiceSign,autoPlayConfirm:this._options.autoPlayConfirm});default:{V.error("unknown built-in RTC type");return}}if(t.useBuiltInRTC){if(t.getVoiceSign||V.error("GetVoiceSign method must be passed when using built-in RTC instances"),this._options.jsBridge)return Fn&&(Hn||qn)||Jn?new Qe({jsBridge:this._options.jsBridge,getVoiceSign:this._options.getVoiceSign}):t.builtInRTCType===it.RealseeXChimeRTC?new Ze({getVoiceSign:this._options.getVoiceSign}):new Xe({getVoiceSign:this._options.getVoiceSign,autoPlayConfirm:this._options.autoPlayConfirm});V.error("jsBridge instance must be passed when using built-in RTC instances");return}})(),this._options.rtc||V.warn("unused rtc"),this._options.url&&this._options.getTicket&&this.connect(),this._options.__debug__&&Object.assign(window,{$liveController:this._controller,$live:this})}_addLiveControllerEventListeners=()=>{this._controller.on("stateChange",this._handleStateChange),this._controller.on("message",this._handleMessage)};_removeLiveControllerEventListeners=()=>{this._controller.off("stateChange",this._handleStateChange),this._controller.off("message",this._handleMessage)};_handleStateChange=(t,e)=>this.emit("stateChange",t,e);_handleMessage=async t=>{if(typeof t=="object"){const{command:e,data:n={},frontRequestId:i,code:o,message:a}=t;if(o==="SUCCESS")switch(e){case q.SelfUserInfo:{const c=n;It(this.selfInfo,c,{deep:!0})||(this._buildInData.selfInfo=c,this.emit("selfInfoUpdate",this._buildInData.selfInfo,i));break}case q.RoomInfo:{const c=n;this._buildInData.roomInfo=Object.assign({},c),this.emit("readyKeyframeSync",c.last_frame||{});break}case q.RTCInfo:{const{voice_id:c,type:l}=n;if(this._buildInData.rtcInfo={voiceId:c,type:l},this.$RTC?.joined)V.warn("已加入语音房间,无需重复加入!");else if(await this.$RTC?.join({voiceId:c,userId:this.selfInfo?.id||"",roomId:this.roomInfo?.info.room_code,type:l})){const f=this._options.initialMicroStatus??ie.OPEN;await this.toggleMicro(f===ie.OPEN)}else V.error("加入语音房间失败");break}case q.UserList:{const c=n;this._buildInData.userList=c,this.emit("userListUpdate",this.userList,i);break}case q.CustomEvent:{const c=n;this.emit("broadcast",c,i);break}case q.KeyframeSync:{const c=n,l=Object.keys(c).reduce((u,f)=>{if(It(c[f],this._buildInData.keyframes[f],{deep:!0}))return u;const h=[c[f],this._buildInData.keyframes[f],i],_=f;return this.keyframes.emit(_,...h),this._buildInData.keyframes[f]=c[f],u[f]=c[f],u},{});this.emit("keyframes",l,i);break}case q.BuiltinMsg:{const c=n;this.emit("builtinEvent",c),c.event_type===F.UserChange&&this.emit("userChange",c),c.event_type===F.RoomChange&&this.emit("roomChange",c),c.event_type===F.UserChange&&c.action===Y.UserMicroStatus&&await this.toggleMicro(c.data.status===ie.OPEN),c.event_type===F.RoomChange&&c.action===Y.RoomClose&&await this.exit();break}case q.UserKickOut:{this.emit("kickOut");break}default:console.warn("unknown command: ",e)}else this.emit("error",t)}};_clearLiveData=()=>{this._buildInData={keyframes:{}}};connect=async(t={})=>{if(this._options.url=t.url??this._options.url??"",this._options.getTicket=t.getTicket??this._options.getTicket,this._options.initialMicroStatus=t.rtcMicStatus??this._options.initialMicroStatus,!/^ws(s):\/\//.test(this._options.url)||typeof this._options.getTicket!="function")return/^ws(s):\/\//.test(this._options.url)?typeof this._options.getTicket!="function"?new Error("getTicket muse be function"):!1:new Error("Illegal realsee live room link");const{force:e=!1}=t;if(this._options.rtc&&!await this._options.rtc.detectMicro())return new Error("Failed to obtain microphone authorization");const n=this.state;if(n===U.CONNECTING||n===U.OPEN)if(e)try{await this._controller.close("force close by connect")}catch(o){console.warn(o)}else return new Error("已有Live实例正在连接中,请勿重复连接!");this._clearLiveData();const i=$n(this._options.url,{ticket:await this._options.getTicket(),force:Number(!!e)});return this._controller.open(i),!0};exit=async()=>{if(this._clearLiveData(),this.state!==U.OPEN)return!0;try{await this.$RTC?.quit()}catch(t){V.warn(t)}return await this._controller.close()};close=async()=>{if(this.selfInfo?.permission?.close_live_room)return await this.updateStatus(F.RoomChange,Y.RoomClose,{})};dispose=async()=>(this._removeLiveControllerEventListeners(),this._clearLiveData(),await this._controller.dispose());async updateStatus(t,e,n,i){if(this.state!==U.OPEN)return!1;const o=Object.assign({event_type:t,action:e},{data:n}),a=Ge(q.BuiltinMsg,o,i);try{return this._controller.sendMessage(a),!0}catch(c){return V.error(c),!1}}setSelfInfo=async t=>await this.updateStatus(F.UserChange,Y.UserInfo,t);broadcast(t,e,n){return this.state!==U.OPEN?!1:new Promise((i,o)=>{const a=Ge(q.CustomEvent,t,e),c=a.front_request_id,l=n?setTimeout(()=>{o(new Error("RESPONSE TIMEOUT")),this.off("broadcast",u)},n):void 0,u=(f,h)=>{h===c&&(l&&clearTimeout(l),this.off("broadcast",u),i(f))};this.on("broadcast",u);try{this._controller.sendMessage(a)}catch(f){o(f)}})}toggleMicro=async t=>{if(!this.selfInfo?.permission?.control_own_micro)return!1;const e=await this.$RTC?.toggleMicro(t);return e&&await this.updateStatus(F.UserChange,Y.UserMicroStatus,{status:t?ie.OPEN:ie.CLOSE},[]),e};forbidMicro=async(t,e)=>typeof this._options.canForbidUserMicro=="function"&&!this._options.canForbidUserMicro(e)||!this.selfInfo?.permission?.control_other_micro?!1:await this.updateStatus(F.UserChange,Y.UserMicroStatus,{status:t},e);forbidSync=async(t,e)=>typeof this._options.canForbidUserSync=="function"&&!this._options.canForbidUserSync(e)||!this.selfInfo?.permission?.control_other_sync?!1:await this.updateStatus(F.UserChange,Y.UserPermission,{sync_frame:t},e);kick=async t=>typeof this._options.canForbidUserKick=="function"&&!this._options.canForbidUserKick(t)||!this.selfInfo?.permission?.change_other_status?!1:await this.updateStatus(F.UserChange,Y.UserStatus,{status:"KICK_OUT"},t)}const Ut=r=>(tr(),new nr(r));var rt={},rr={get exports(){return rt},set exports(r){rt=r}},fe={};/*
1
+ "use strict";var Ut=Object.defineProperty;var Bt=(t,s,e)=>s in t?Ut(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var o=(t,s,e)=>(Bt(t,typeof s!="symbol"?s+"":s,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Wt=require("@realsee/jsbridge-x"),Ne=require("trtc-js-sdk"),X=require("amazon-chime-sdk-js"),A=require("react"),ae=Symbol("$$REALSEE_LIVE_EVENT$$");function me(t){return t[ae]||(t[ae]={}),t[ae]}function Ft(t){t[ae]||delete t[ae]}class ce{hasListener(s){const e=me(this);return e&&e[s]&&e[s].length>0}on(s,e,n){const i=me(this);return i[s]||(i[s]=[]),i[s].push([e,n||!1]),()=>this.off(s,e)}once(s,e){return this.on(s,e,!0)}off(s,e){if(s===void 0){Ft(this);return}const n=me(this);if(n[s]||(n[s]=[]),e===void 0){n[s].length=0;return}let i=0;for(;i<n[s].length&&n[s][i][0]!==e;i++);i<n[s].length&&n[s].splice(i,1)}emit(s,...e){let n=!1;const a=me(this)[s]||[];for(let u of a.slice()){const[f,v=!1]=u,h=f(...e);v&&this.off(s,f),h===!1&&(n=!0)}return n}}class be extends ce{}var ee=(t=>(t.RealseeBrowserRTC="RealseeBrowserRTC",t.RealseeVRWebViewRTC="RealseeVRWebViewRTC",t.RealseeBrowserChimeRTC="RealseeBrowserChimeRTC",t))(ee||{}),Ue=(t=>(t.RealseeXTRTC="trtc",t.RealseeXChimeRTC="chime",t))(Ue||{});const qt=()=>{const t=new Date,s=t.getFullYear(),e=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0"),u=t.getSeconds().toString().padStart(2,"0"),f=t.getMilliseconds();return`[${s}-${e}-${n} ${i}:${a}:${u}.${f}]`},Ce=(t,s=[])=>{switch(s.unshift(`Realsee Live ${qt()} <${t}> `),t){case"INFO":return console.info(...s);case"ERROR":return console.error(...s);case"WARN":return console.warn(...s);default:return console.log(...s)}},Kt=(...t)=>Ce("LOG",t),Yt=(...t)=>Ce("INFO",t),Gt=(...t)=>Ce("ERROR",t),Ht=(...t)=>Ce("WARN",t),Jt={log:Kt,info:Yt,error:Gt,warn:Ht},D=Jt;function Z(){return((1+Math.random())*65536|0).toString(16).substring(1)}function ve(){return(Z()+Z()+"-"+Z()+"-4"+Z().substr(0,3)+"-"+Z()+"-"+Z()+Z()+Z()).toLowerCase()}class Me extends be{constructor(e){super();o(this,"type",ee.RealseeBrowserRTC);o(this,"joined",!1);o(this,"micro",!1);o(this,"voiceId","");o(this,"_getVoiceSign",()=>{throw new Error("方法 getVoiceSign 未实现")});o(this,"_autoPlayConfirm");o(this,"checkRequirement",()=>Ne.checkSystemRequirements());o(this,"$dom",document.createElement("div"));o(this,"_trtc",{client:null,stream:null});o(this,"join",async e=>{var a;this.emit("joinWillStart");const n=await this._getVoiceSign({voiceId:e.voiceId,roomId:e.roomId,userId:e.userId});this._trtc.client=Ne.createClient({mode:"rtc",...n,enableAutoPlayDialog:typeof this._autoPlayConfirm!="function"}),(a=this._trtc.client)==null||a.enableAudioVolumeEvaluation(),this._registerRtcEvent();let i=await new Promise(u=>{var f;(f=this._trtc.client)==null||f.join({roomId:Number(e.voiceId)}).then(()=>u(!0)).catch(()=>u(!1))});return this.joined=i,i?(this._trtc.stream=Ne.createStream({userId:n.userId,audio:!0,video:!1}),i=await new Promise(u=>{var f;(f=this._trtc.stream)==null||f.initialize().then(()=>u(!0)).catch(()=>u(!1))}),i=await new Promise(u=>{var f;(f=this._trtc.client)==null||f.publish(this._trtc.stream).then(()=>u(!0)).catch(()=>u(!1))}),this.joined=i,this.joined&&this.emit("joined"),i):!1});o(this,"_handleStreamAdded",e=>{var i;const n=e.stream;console.log("远端流增加: "+n.getId()),(i=this._trtc.client)==null||i.subscribe(n)});o(this,"_handleStreamSubscribed",e=>{const n=e.stream;console.log("远端流订阅成功:"+n.getId());const a=`rs-rtc-remote_stream-${n.getId()}`,u=document.createElement("div");u.id=a,this.$dom.appendChild(u),typeof this._autoPlayConfirm=="function"?(n.play(a).catch(f=>{}),n.on("error",f=>{if(f.getCode()===16451){const h=()=>n.resume();this._autoPlayConfirm({onConfirm:h})}})):n.play(a)});this._getVoiceSign=e.getVoiceSign,this._autoPlayConfirm=e.autoPlayConfirm,this._initParentDom()}_initParentDom(){this.$dom.id=`rs-rtc-${ve()}`,this.$dom.style.display="none",document.body.appendChild(this.$dom)}quit(){return new Promise(async e=>{var n,i;this.joined=!1,this._trtc.stream&&(await((n=this._trtc.client)==null?void 0:n.unpublish(this._trtc.stream)),this._trtc.stream.stop(),this._trtc.stream.close(),this._trtc.stream=null),(i=this._trtc.client)==null||i.leave().then(()=>this._trtc.client=null).then(()=>e(!0)).catch(()=>e(!1)),e(!0)})}detectMicro(){return new Promise(e=>{const n={audio:!0,video:!1};try{navigator.mediaDevices.getUserMedia(n).then(()=>e(!0)).catch(i=>{D.error(i.message),e(!1)})}catch(i){console.error(i),e(!1)}})}toggleMicro(e){var n,i,a,u;return Promise.resolve((e?(i=(n=this._trtc)==null?void 0:n.stream)==null?void 0:i.unmuteAudio():(u=(a=this._trtc)==null?void 0:a.stream)==null?void 0:u.muteAudio())||!1)}shock(){throw new Error("Method not implemented.")}_registerRtcEvent(){var e,n,i,a;(e=this._trtc.client)==null||e.on("stream-added",this._handleStreamAdded),(n=this._trtc.client)==null||n.on("stream-subscribed",this._handleStreamSubscribed),(i=this._trtc.client)==null||i.on("audio-volume",u=>this.emit("userVolumes",u.result.map(({userId:f,audioVolume:v})=>({userId:f,audioVolume:v})))),(a=this._trtc.client)==null||a.on("error",u=>this.emit("error",u))}}class Ve extends be{constructor(e){super();o(this,"type",ee.RealseeBrowserChimeRTC);o(this,"joined",!1);o(this,"micro",!1);o(this,"voiceId","");o(this,"userId","");o(this,"logger");o(this,"deviceController");o(this,"meetingSession");o(this,"audioInput");o(this,"audioOutput");o(this,"deviceChangeObserver",{});o(this,"audioVideoObserver",{});o(this,"_getVoiceSign",()=>{throw new Error("方法 getVoiceSign 未实现")});o(this,"$dom",document.createElement("div"));o(this,"$audio",document.createElement("audio"));o(this,"_initDom",()=>{this.$audio.id=`rs-rtc-${ve()}`,this.$dom.id=`rs-rtc-${ve()}`,this.$dom.appendChild(this.$audio),document.body.appendChild(this.$dom)});o(this,"initObservers",()=>{this.deviceChangeObserver={audioInputsChanged:e=>{e==null||e.forEach(n=>{this.logger.info(`Device ID: ${n.deviceId} Microphone: ${n.label}`)})},audioOutputsChanged:e=>{this.logger.info(`Audio outputs updated: ${e}`)},videoInputsChanged:e=>{this.logger.info(`Video inputs updated: ${e}`)},audioInputMuteStateChanged:(e,n)=>{this.logger.info(`Device ${e.toString()} ${n?"is muted in hardware":"is not muted"}`)}},this.audioVideoObserver={audioVideoDidStart:()=>{this.logger.info("Started")},audioVideoDidStop:e=>{this.logger.info(`Stopped with a session status code: ${e.statusCode()}`)},audioVideoDidStartConnecting:e=>{e&&this.logger.info("Attempting to reconnect")}}});o(this,"_registerRtcEvent",()=>{var n,i,a,u,f,v;const e=((a=(i=(n=this.meetingSession)==null?void 0:n.configuration)==null?void 0:i.credentials)==null?void 0:a.attendeeId)||"";if(e){const h=new Map,_=()=>{const E=[];return h.forEach((S,m)=>{E.push({userId:S.userId,volume:S.muted||S.signalStrength===0||!Boolean(S.volume)?0:S.volume})}),E};(u=this.meetingSession)==null||u.audioVideo.realtimeSubscribeToAttendeeIdPresence((E,S,m)=>{var P;if(!S){h.delete(E),this.emit("userVolumes",_());return}(P=this.meetingSession)==null||P.audioVideo.realtimeSubscribeToVolumeIndicator(E,(V,j,x,J)=>{new X.DefaultModality(V).base()===V&&(h.set(V,{userId:m||V,volume:j,muted:x,signalStrength:J}),this.emit("userVolumes",_()))})}),(f=this.meetingSession)==null||f.audioVideo.realtimeSubscribeToVolumeIndicator(e,(E,S,m,P)=>{new X.DefaultModality(E).base()===E&&P!==null&&P!==1&&this.emit("weakNetwork")}),(v=this.meetingSession)==null||v.audioVideo.realtimeSubscribeToFatalError(E=>this.emit("error",E))}});this._getVoiceSign=e.getVoiceSign,this._initDom(),this.logger=new X.ConsoleLogger("WebRTCLogger",e.logLevel||X.LogLevel.INFO),this.deviceController=new X.DefaultDeviceController(this.logger),this.initObservers()}async join(e){return new Promise(async(n,i)=>{var a;this.emit("joinWillStart");try{const{sdkAppId:u,userId:f,roomId:v,userSig:h}=await this._getVoiceSign({...e,roomId:e.roomId||0});this.userId=f;const{attendence:_,vendor_wrapper:E}=JSON.parse(decodeURIComponent(h)),S=new X.MeetingSessionConfiguration({Meeting:E},{Attendee:{ExternalUserId:_.external_user_id,AttendeeId:_.attendee_id,JoinToken:_.join_token}});this.meetingSession=new X.DefaultMeetingSession(S,this.logger,this.deviceController),this._registerRtcEvent(),this.meetingSession.audioVideo.addDeviceChangeObserver(this.deviceChangeObserver),this.meetingSession.audioVideo.addObserver(this.audioVideoObserver),this.meetingSession.audioVideo.bindAudioElement(this.$audio);const m={audioVideoDidStart:()=>{var x;(x=this.meetingSession)==null||x.audioVideo.realtimeMuteLocalAudio(),this.joined=!0,this.emit("joined"),n(!0)},audioVideoDidStop:()=>{this.joined=!1,n(!1)}};this.meetingSession.audioVideo.addObserver(m);const P=await this.deviceController.listAudioInputDevices(!0),V=P.find(x=>x.deviceId==="default"),j=P.find(x=>x.deviceId!=="");this.audioInput=V||j,await this.meetingSession.audioVideo.startAudioInput(((a=this.audioInput)==null?void 0:a.deviceId)||"default"),this.meetingSession.audioVideo.start()}catch(u){this.emit("error",u),this.logger.error(u.message),n(!1)}})}quit(){return this.joined?new Promise((e,n)=>{var a,u;this.joined=!1;const i={audioVideoDidStop:async f=>{var h;const v=f.statusCode();(h=this.meetingSession)==null||h.deviceController.destroy(),v===X.MeetingSessionStatusCode.Left?(this.logger.info("You left the session"),e(!0)):(this.logger.info(`Stopped with a session status code: ${v}`),e(!0))}};(a=this.meetingSession)==null||a.audioVideo.addObserver(i),(u=this.meetingSession)==null||u.audioVideo.stop()}):Promise.resolve(!0)}async detectMicro(){return new Promise(e=>{const n={audio:!0,video:!1};try{navigator.mediaDevices.getUserMedia(n).then(()=>e(!0)).catch(()=>e(!1))}catch(i){this.logger.error(i.message),e(!1)}})}async toggleMicro(e){var i,a,u;e?(i=this.meetingSession)==null||i.audioVideo.realtimeUnmuteLocalAudio():(a=this.meetingSession)==null||a.audioVideo.realtimeMuteLocalAudio();const n=(u=this.meetingSession)==null?void 0:u.audioVideo.realtimeIsLocalAudioMuted();return n!==void 0?e!==n:!1}shock(){throw new Error("Method not implemented.")}}var Be=(t=>(t[t.Success=0]="Success",t[t.Failure=1]="Failure",t[t.ReJoin=2]="ReJoin",t[t.NoMicroPermission=3]="NoMicroPermission",t))(Be||{});class $e extends be{constructor({jsBridge:e,getVoiceSign:n}){super();o(this,"type",ee.RealseeVRWebViewRTC);o(this,"joined",!1);o(this,"micro",!1);o(this,"voiceId","");o(this,"options");this.options={jsBridge:e,getVoiceSign:n},this.jsBridge.webViewType!=="WxMiniProgramWebView"&&this.jsBridge.callAndListen("live/userVolumes",i=>{this.emit("userVolumes",i)}),this.jsBridge.callAndListen("live/weakNetwork",i=>{i&&this.emit("weakNetwork")})}get jsBridge(){return this.options.jsBridge}async join(e){try{this.emit("joinWillStart");const{sdkAppId:n,userId:i,userSig:a}=await this.options.getVoiceSign(e);if(!(Boolean(n)&&Boolean(i)&&Boolean(a)))return this.emit("error",new Error("加入房间失败:rtc 签名请求异常")),this.joined=!1,this.joined;this.type=e.type;const[u,f]=await this.jsBridge.callAndBackfeed(`live/join?sdkAppID=${n}&userID=${i}&roomID=${Number(e.voiceId)}&userSig=${a}`);return u?u.code===Be.Success?(this.emit("joined"),this.joined=!0):(this.emit("error",u),this.joined=!1):(this.emit("error",f||new Error("加入房间失败:未知异常。")),this.joined=!1),this.joined}catch(n){return this.emit("error",new Error("加入房间失败:"+n.message)),this.joined=!1,this.joined}}async quit(){const[e,n]=await this.jsBridge.callAndBackfeed("live/quit");return e===null&&this.emit("error",n||new Error("退出房间失败:未知异常。")),this.joined=!1,!!e}async detectMicro(){const[e,n]=await this.jsBridge.detectMicro();return e===null?(this.emit("error",n||new Error("麦克风监测异常!")),!1):e}async toggleMicro(e){const[n,i]=await this.jsBridge.callAndBackfeed(`live/toggleMicro?flag=${e?1:0}`);return n===null?(this.emit("error",i||new Error("麦克风监测异常!")),!1):(this.micro=n,n)}shock(){this.jsBridge.shock(1)}}var B=(t=>(t.SelfUserInfo="SELF_USER_INFO",t.RoomInfo="ROOM_INFO",t.RTCInfo="RTC_INFO",t.UserList="USER_LIST",t.BuiltinMsg="BUILTIN_MSG",t.CustomEvent="CUSTOM_EVENT",t.KeyframeSync="KEYFRAME_SYNC",t.UserKickOut="USER_KICK_OUT",t))(B||{}),q=(t=>(t.UserChange="user_change",t.RoomChange="room_change",t))(q||{}),Y=(t=>(t.UserMicroStatus="change_micro_status",t.UserMicroStatusSync="sync_micro_status",t.UserPermission="change_permission",t.UserStatus="change_status",t.UserInfo="change_info",t.RoomClose="close",t))(Y||{}),Q=(t=>(t.OPEN="OPEN",t.CLOSE="CLOSE",t))(Q||{});function zt(t){try{const s=JSON.parse(t),e={code:s.code,message:s.message,command:s.command,roomCode:s.room_code,appID:s.app_id,requestId:s.request_id,frontRequestId:s.front_request_id,triggerUserID:s.trigger_user_id,data:s.data||{}},n=Object.keys(e).filter(i=>e[i]===void 0);return n.length>0&&console.warn(`推送数据格式异常:${n.join(" ")} 值不存在!`),e}catch(s){return!1}}var $=(t=>(t[t.NOTINITIALIZED=-1]="NOTINITIALIZED",t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED",t))($||{}),ft=(t=>(t[t.Normal=0]="Normal",t[t.Removed=1]="Removed",t[t.Replaced=2]="Replaced",t))(ft||{}),dt=(t=>(t.WAIT_ENTER="WAIT_ENTER",t.ONLINE="ONLINE",t.LEAVE="LEAVE",t.KICK_OUT="KICK_OUT",t.BE_REPLACE="BE_REPLACE",t.EXCEPTION="EXCEPTION",t))(dt||{}),pe=(t=>(t[t.NOTINITIALIZED=-1]="NOTINITIALIZED",t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSING=2]="CLOSING",t[t.CLOSED=3]="CLOSED",t))(pe||{}),ht=(t=>(t.Error="Error",t.Close="Close",t.MicroAuth="MicroAuth",t.DuplicateConnect="DuplicateConnect",t.IllegalURL="IllegalURL",t.Unknown="Unknown",t.IllegalArgs="IllegalArgs",t))(ht||{}),_t=(t=>(t.Err_1000="CLOSE_NORMAL",t.Err_1001="CLOSE_GOING_AWAY",t.Err_1002="CLOSE_PROTOCOL_ERROR",t.Err_1003="CLOSE_UNSUPPORTED",t.Err_1006="CLOSE_ABNORMAL",t.Err_1007="Unsupported Data",t.Err_1008="Policy Violation",t.Err_1009="CLOSE_TOO_LARGE",t.Err_unknown="unknown",t))(_t||{});function gt(t){switch(t){case 1e3:return"CLOSE_NORMAL";case 1001:return"CLOSE_GOING_AWAY";case 1002:return"CLOSE_PROTOCOL_ERROR";case 1003:return"CLOSE_UNSUPPORTED";case 1006:return"CLOSE_ABNORMAL";case 1007:return"Unsupported Data";case 1008:return"Policy Violation";case 1009:return"CLOSE_TOO_LARGE"}return"unknown"}function Xt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mt={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.LogLevel=void 0;var s;(function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.OFF=4]="OFF"})(s=t.LogLevel||(t.LogLevel={})),t.default=s})(mt);const ot=Xt(mt);function Zt(t,s={}){const e=t.indexOf("?")!==-1,n=Object.keys(s).reduce((i,a,u)=>`${i}${u===0&&!e?"?":"&"}${a}=${s[a]}`,"");return t+n}const ue=globalThis.navigator.userAgent,Qt=/android/gi.test(ue),er=/iPhone|iPad\s+OS/gi.test(ue),tr=/MicroMessenger/gi.test(ue)&&/miniProgram/gi.test(ue),rr=/realsee/gi.test(ue);function Ee(t){return Object.prototype.toString.call(t)==="[object Object]"}function ye(t,s){return t===s?!0:typeof t!=typeof s?!1:!!(Number.isNaN(t)&&Number.isNaN(s))}function nr(t,s){const e=Object.getOwnPropertyNames(t),n=Object.getOwnPropertyNames(s);if(e.length!==n.length)return!1;for(let i=0,a=e.length;i<a;i++){const u=e[i];if(!ye(t[u],s[u]))return!1}return!0}function ir(t,s){if(t.length!==s.length)return!1;for(let e=0,n=t.length;e<n;e++)if(!ye(t[e],s[e]))return!1;return!0}function sr(t,s){return ye(t,s)?!0:Ee(t)&&Ee(s)?nr(t,s):Array.isArray(t)&&Array.isArray(s)?ir(t,s):!1}function We(t,s){return ye(t,s)?!0:Ee(t)&&Ee(s)?ar(t,s):Array.isArray(t)&&Array.isArray(s)?or(t,s):!1}function or(t,s){if(t.length!==s.length)return!1;for(let e=0,n=t.length;e<n;e++)if(!We(t[e],s[e]))return!1;return!0}function ar(t,s){const e=Object.getOwnPropertyNames(t),n=Object.getOwnPropertyNames(s);if(e.length!==n.length)return!1;for(let i=0,a=e.length;i<a;i++){const u=e[i];if(!We(t[u],s[u]))return!1}return!0}function at(t,s,e={deep:!1}){return e.deep?We(t,s):sr(t,s)}class cr extends ce{constructor(e){super();o(this,"_realWebSocket");o(this,"_url");o(this,"_protocols");o(this,"_readyState",pe.NOTINITIALIZED);o(this,"_options",{timeout:1e4,shouldReconnect:(e,n)=>{if(!(e.code===1008||e.code===1011))return[0,3e3,1e4][n.attempts]},should1000Reconnect:!1,ignoreConnectivityEvents:!1,automaticOpen:!1});o(this,"_connectTimeout");o(this,"_attempts",0);o(this,"_reconnects",-1);o(this,"_reconnectWhenOnlineAgain",!1);o(this,"_explicitlyClosed",!1);o(this,"_pendingReconnect");o(this,"_connectivityEventsAttached",!1);o(this,"_heathCheckTimer");o(this,"_healthCheck",async()=>{this._realWebSocket&&this._realWebSocket.readyState!==this._readyState&&(this._readyState=this._realWebSocket.readyState,this._readyState===pe.CLOSING&&this.emit("closing")),await new Promise(e=>setTimeout(e,2e3)),this._heathCheckTimer=requestAnimationFrame(this._healthCheck)});o(this,"_clearHeathCheckIfNeed",()=>{this._heathCheckTimer&&(cancelAnimationFrame(this._heathCheckTimer),this._heathCheckTimer=void 0)});o(this,"_startHealthCheck",()=>{this._clearHeathCheckIfNeed(),this._heathCheckTimer=requestAnimationFrame(this._healthCheck)});o(this,"_stopHealthCheck",()=>{this._clearHeathCheckIfNeed()});o(this,"_clearPendingReconnectIfNeeded",()=>{this._pendingReconnect&&(clearTimeout(this._pendingReconnect),this._pendingReconnect=void 0)});o(this,"_online",e=>{this._reconnectWhenOnlineAgain&&(this._clearPendingReconnectIfNeeded(),this._reconnect(e))});o(this,"_offline",()=>{var e;this._reconnectWhenOnlineAgain=!0,(e=this._realWebSocket)==null||e.close(1e3,"offline")});o(this,"_detachConnectivityEvents",()=>{this._connectivityEventsAttached&&(globalThis==null||globalThis.removeEventListener("online",this._online),globalThis==null||globalThis.removeEventListener("offline",this._offline),this._connectivityEventsAttached=!1)});o(this,"_attachConnectivityEvents",()=>{this._connectivityEventsAttached||(globalThis==null||globalThis.addEventListener("online",this._online),globalThis==null||globalThis.addEventListener("offline",this._offline),this._connectivityEventsAttached=!0)});o(this,"send",e=>{var n,i,a;((n=this._realWebSocket)==null?void 0:n.readyState)===((i=this._realWebSocket)==null?void 0:i.OPEN)&&((a=this._realWebSocket)==null||a.send(e))});o(this,"close",(e,n)=>{var i;return typeof e!="number"&&(n=e,e=1e3),this._clearPendingReconnectIfNeeded(),this._reconnectWhenOnlineAgain=!1,this._explicitlyClosed=!0,this._detachConnectivityEvents(),(i=this._realWebSocket)==null?void 0:i.close(e,n)});o(this,"open",e=>{var n,i;e&&(this._url=e),((n=this._realWebSocket)==null?void 0:n.readyState)!==WebSocket.OPEN&&((i=this._realWebSocket)==null?void 0:i.readyState)!==WebSocket.CONNECTING&&(this._clearPendingReconnectIfNeeded(),this._reconnectWhenOnlineAgain=!1,this._explicitlyClosed=!1,this._createWebSocket())});o(this,"_createWebSocket",()=>{var i,a,u;const e=typeof this._url=="string"?this._url:(i=this._url)==null?void 0:i.call(this,this);if(!e)return;this._pendingReconnect=void 0,this._removeWebSocketEvent(),this._realWebSocket=new WebSocket(e,this._protocols||void 0),this._attempts=this._attempts+1,this.emit("connecting",new CustomEvent("connecting",{detail:{attempts:this._attempts,reconnects:this._reconnects}}));const n=()=>{this._connectTimeout=void 0,this._detachConnectivityEvents(),this.emit("timeout",new CustomEvent("connecting",{detail:{attempts:this._attempts,reconnects:this._reconnects}}))};this._connectTimeout=setTimeout(n,(a=this._options)==null?void 0:a.timeout),this._dispatchWebSocketEvent(),(u=this._options)!=null&&u.ignoreConnectivityEvents||this._attachConnectivityEvents()});o(this,"_removeWebSocketEvent",()=>{var e,n,i,a;(e=this._realWebSocket)==null||e.removeEventListener("open",this._webSocketOpenHandler),(n=this._realWebSocket)==null||n.removeEventListener("close",this._webSocketCloseHandler),(i=this._realWebSocket)==null||i.removeEventListener("error",this._webSocketErrorHandler),(a=this._realWebSocket)==null||a.removeEventListener("message",this._webSocketMessageHandler)});o(this,"_dispatchWebSocketEvent",()=>{var e,n,i,a;(e=this._realWebSocket)==null||e.addEventListener("open",this._webSocketOpenHandler),(n=this._realWebSocket)==null||n.addEventListener("close",this._webSocketCloseHandler),(i=this._realWebSocket)==null||i.addEventListener("error",this._webSocketErrorHandler),(a=this._realWebSocket)==null||a.addEventListener("message",this._webSocketMessageHandler)});o(this,"_webSocketOpenHandler",e=>{this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=void 0);const n=++this._reconnects,i=this._attempts;return this._attempts=0,this._reconnectWhenOnlineAgain=!1,this._startHealthCheck(),this.emit("open",Object.assign(e,{detail:{reconnects:n,attempts:i}}))});o(this,"_webSocketCloseHandler",e=>(this._reconnect(e),this._stopHealthCheck(),this.emit("close",e)));o(this,"_webSocketErrorHandler",e=>this.emit("error",new CustomEvent("error",{detail:{error:e}})));o(this,"_webSocketMessageHandler",e=>this.emit("message",e));e&&this.setOptions(e),this._startHealthCheck()}get attempts(){return this._attempts}setOptions(e){if(!e)return;this._url=e.url,this._protocols=e.protocols;const n=Object.assign(this._options,e.robustOptions||{});if(typeof(n==null?void 0:n.timeout)!="number")throw new Error("timeout must be the number of milliseconds to timeout a connection attempt");if(typeof(n==null?void 0:n.shouldReconnect)!="function")throw new Error("shouldReconnect must be a function that returns the number of milliseconds to wait for a reconnect attempt, or null or undefined to not reconnect.");this._options=n,this._options.automaticOpen&&this._createWebSocket()}_reconnect(e){var i,a,u,f;if(!((i=this._options)!=null&&i.should1000Reconnect)&&e.code===1e3||this._explicitlyClosed){this._attempts=0;return}if(((a=globalThis==null?void 0:globalThis.navigator)==null?void 0:a.onLine)===!1){this._reconnectWhenOnlineAgain=!0;return}const n=(f=(u=this._options)==null?void 0:u.shouldReconnect)==null?void 0:f.call(u,e,this);typeof n=="number"&&(this._pendingReconnect=setTimeout(this._createWebSocket,n))}}class ur extends ce{constructor(){super();o(this,"_ws",new cr({url:"",robustOptions:{timeout:18e4}}));o(this,"_state",$.NOTINITIALIZED);o(this,"_addWebSocketEventListeners",()=>{this._ws.on("close",this._handleCloseEvent),this._ws.on("closing",this._handleClosingEvent),this._ws.on("connecting",this._handleConnectingEvent),this._ws.on("error",this._handleErrorEvent),this._ws.on("message",this._handleMessageEvent),this._ws.on("open",this._handleOpenEvent),this._ws.on("timeout",this._handleTimeoutEvent)});o(this,"_removeWebSocketEventListeners",()=>{this._ws.off("close",this._handleCloseEvent),this._ws.off("closing",this._handleClosingEvent),this._ws.off("connecting",this._handleConnectingEvent),this._ws.off("error",this._handleErrorEvent),this._ws.off("message",this._handleMessageEvent),this._ws.off("open",this._handleOpenEvent),this._ws.off("timeout",this._handleTimeoutEvent)});o(this,"_handleCloseEvent",e=>{D.info(`live room closed bacause of ${e.code}-${e.reason||gt(e.code)}`),this.state=$.CLOSED});o(this,"_handleClosingEvent",()=>{var e;D.info("live room is closing, onLine:",(e=globalThis==null?void 0:globalThis.navigator)==null?void 0:e.onLine),this.state=$.CLOSED});o(this,"_handleConnectingEvent",()=>{D.info("live room is connecting"),this.state=$.CONNECTING});o(this,"_handleErrorEvent",e=>{D.error("live room error",e),this.state=$.CLOSED});o(this,"_handleMessageEvent",e=>{let n=(()=>{try{return JSON.parse(e.data)}catch(i){return e.data}})();this.emit("message",n)});o(this,"_handleOpenEvent",e=>{D.info("live room open",e.detail),this.state=$.OPEN,e.detail.reconnects>0&&this.emit("reconnected",e.detail)});o(this,"_handleTimeoutEvent",e=>{D.error("live room connect timeout!",e.detail),this.state=$.CLOSED});o(this,"dispose",async()=>(this._removeWebSocketEventListeners(),await this.close("live room close by controller disposed!")));o(this,"open",e=>this._ws.open(e));o(this,"close",(e,n)=>new Promise(i=>{this._ws.once("close",()=>i(!0)),this._ws.close(e,n)}));this._addWebSocketEventListeners()}set state(e){const n=JSON.parse(JSON.stringify(this._state));this._state=e,this.emit("stateChange",this.state,n)}get state(){return this._state}sendMessage(e=""){if(e==null||e==="")throw new Error("live message is empty!");if(this.state===$.OPEN)return this._ws.send(JSON.stringify(e));throw new Error("live has not yet been initialized!")}}const lr=t=>Promise.reject("unimplemented method GetVoiceSign"),Le=(t,s={},e=[])=>({command:t,front_request_id:ve(),data:{...s,to_user_ids:Array.isArray(e)?e:[e]}}),fr=()=>{var t,s;window!=null&&window.__Realsee_Live__&&((s=(t=window==null?void 0:window.__Realsee_Live__)==null?void 0:t.dispose)==null||s.call(t),window.__Realsee_Live__=null)};class dr extends ce{constructor(e){var n;super();o(this,"_options",{});o(this,"keyframes",new ce);o(this,"_buildInData",{keyframes:{}});o(this,"getFramesByKey",e=>this.snapshot[e]);o(this,"sendKeyframe",(e,n)=>{if(this.state!==$.OPEN)return!1;this._buildInData.keyframes={...this._buildInData.keyframes,[e]:n};const i=Le(B.KeyframeSync,this.snapshot);try{return this._controller.sendMessage(i),!0}catch(a){return D.error(a),!1}});o(this,"_controller",new ur);o(this,"_addLiveControllerEventListeners",()=>{this._controller.on("stateChange",this._handleStateChange),this._controller.on("message",this._handleMessage)});o(this,"_removeLiveControllerEventListeners",()=>{this._controller.off("stateChange",this._handleStateChange),this._controller.off("message",this._handleMessage)});o(this,"_handleStateChange",(e,n)=>this.emit("stateChange",e,n));o(this,"_handleMessage",async e=>{var n,i,a,u,f;if(typeof e=="object"){const{command:v,data:h={},frontRequestId:_,code:E,message:S}=e;if(E==="SUCCESS")switch(v){case B.SelfUserInfo:{const m=h;at(this.selfInfo,m,{deep:!0})||(this._buildInData.selfInfo=m,this.emit("selfInfoUpdate",this._buildInData.selfInfo,_));break}case B.RoomInfo:{const m=h;this._buildInData.roomInfo=Object.assign({},m),this.emit("readyKeyframeSync",m.last_frame||{});break}case B.RTCInfo:{const{voice_id:m,type:P}=h;if(this._buildInData.rtcInfo={voiceId:m,type:P},(n=this.$RTC)!=null&&n.joined)D.warn("已加入语音房间,无需重复加入!");else if(await((u=this.$RTC)==null?void 0:u.join({voiceId:m,userId:((i=this.selfInfo)==null?void 0:i.id)||"",roomId:(a=this.roomInfo)==null?void 0:a.info.room_code,type:P}))){const j=(f=this._options.initialMicroStatus)!=null?f:Q.OPEN;await this.toggleMicro(j===Q.OPEN)}else D.error("加入语音房间失败");break}case B.UserList:{const m=h;this._buildInData.userList=m,this.emit("userListUpdate",this.userList,_);break}case B.CustomEvent:{const m=h;this.emit("broadcast",m,_);break}case B.KeyframeSync:{const m=h,P=Object.keys(m).reduce((V,j)=>{if(at(m[j],this._buildInData.keyframes[j],{deep:!0}))return V;const x=[m[j],this._buildInData.keyframes[j],_],J=j;return this.keyframes.emit(J,...x),this._buildInData.keyframes[j]=m[j],V[j]=m[j],V},{});this.emit("keyframes",P,_);break}case B.BuiltinMsg:{const m=h;this.emit("builtinEvent",m),m.event_type===q.UserChange&&this.emit("userChange",m),m.event_type===q.RoomChange&&this.emit("roomChange",m),m.event_type===q.UserChange&&m.action===Y.UserMicroStatus&&await this.toggleMicro(m.data.status===Q.OPEN),m.event_type===q.RoomChange&&m.action===Y.RoomClose&&await this.exit();break}case B.UserKickOut:{this.emit("kickOut");break}default:console.warn("unknown command: ",v)}else this.emit("error",e)}});o(this,"_clearLiveData",()=>{this._buildInData={keyframes:{}}});o(this,"connect",async(e={})=>{var u,f,v,h;if(this._options.url=(f=(u=e.url)!=null?u:this._options.url)!=null?f:"",this._options.getTicket=(v=e.getTicket)!=null?v:this._options.getTicket,this._options.initialMicroStatus=(h=e.rtcMicStatus)!=null?h:this._options.initialMicroStatus,!/^ws(s):\/\//.test(this._options.url)||typeof this._options.getTicket!="function")return/^ws(s):\/\//.test(this._options.url)?typeof this._options.getTicket!="function"?new Error("getTicket muse be function"):!1:new Error("Illegal realsee live room link");const{force:n=!1}=e;if(this._options.rtc&&!await this._options.rtc.detectMicro())return new Error("Failed to obtain microphone authorization");const i=this.state;if(i===$.CONNECTING||i===$.OPEN)if(n)try{await this._controller.close("force close by connect")}catch(_){console.warn(_)}else return new Error("已有Live实例正在连接中,请勿重复连接!");this._clearLiveData();const a=Zt(this._options.url,{ticket:await this._options.getTicket(),force:Number(!!n)});return this._controller.open(a),!0});o(this,"exit",async()=>{var e;if(this._clearLiveData(),this.state!==$.OPEN)return!0;try{await((e=this.$RTC)==null?void 0:e.quit())}catch(n){D.warn(n)}return await this._controller.close()});o(this,"close",async()=>{var e,n;if((n=(e=this.selfInfo)==null?void 0:e.permission)!=null&&n.close_live_room)return await this.updateStatus(q.RoomChange,Y.RoomClose,{})});o(this,"dispose",async()=>(this._removeLiveControllerEventListeners(),this._clearLiveData(),await this._controller.dispose()));o(this,"setSelfInfo",async e=>await this.updateStatus(q.UserChange,Y.UserInfo,e));o(this,"toggleMicro",async e=>{var i,a,u;if(!((a=(i=this.selfInfo)==null?void 0:i.permission)!=null&&a.control_own_micro))return!1;const n=await((u=this.$RTC)==null?void 0:u.toggleMicro(e));return n&&await this.updateStatus(q.UserChange,Y.UserMicroStatus,{status:e?Q.OPEN:Q.CLOSE},[]),n});o(this,"forbidMicro",async(e,n)=>{var i,a;return typeof this._options.canForbidUserMicro=="function"&&!this._options.canForbidUserMicro(n)||!((a=(i=this.selfInfo)==null?void 0:i.permission)!=null&&a.control_other_micro)?!1:await this.updateStatus(q.UserChange,Y.UserMicroStatus,{status:e},n)});o(this,"forbidSync",async(e,n)=>{var i,a;return typeof this._options.canForbidUserSync=="function"&&!this._options.canForbidUserSync(n)||!((a=(i=this.selfInfo)==null?void 0:i.permission)!=null&&a.control_other_sync)?!1:await this.updateStatus(q.UserChange,Y.UserPermission,{sync_frame:e},n)});o(this,"kick",async e=>{var n,i;return typeof this._options.canForbidUserKick=="function"&&!this._options.canForbidUserKick(e)||!((i=(n=this.selfInfo)==null?void 0:n.permission)!=null&&i.change_other_status)?!1:await this.updateStatus(q.UserChange,Y.UserStatus,{status:"KICK_OUT"},e)});this._addLiveControllerEventListeners(),this._options=Object.assign({initialMicroStatus:Q.OPEN},e),this._options.jsBridge=(()=>{if(e.jsBridge)return e.jsBridge;if(e.useBuiltInJsBridge)return new Wt})(),this._options.getVoiceSign=(n=e.getVoiceSign)!=null?n:lr,this._options.autoPlayConfirm=e.autoPlayConfirm,this._options.rtc=(()=>{if(e.rtc)return e.rtc;if(e.rtcType)switch(e.getVoiceSign||D.error("GetVoiceSign method must be passed when using built-in RTC instances"),e.rtcType){case ee.RealseeVRWebViewRTC:{if(this._options.jsBridge)return new $e({jsBridge:this._options.jsBridge,getVoiceSign:this._options.getVoiceSign});D.error("JsBridge instance must be passed when using built-in VRWebViewRTC instances");return}case ee.RealseeBrowserChimeRTC:return new Ve({getVoiceSign:this._options.getVoiceSign,logLevel:e.__debug__?ot.DEBUG:ot.ERROR});case ee.RealseeBrowserRTC:return this._options.autoPlayConfirm||D.error("autoPlayConfirm method must be passed when using built-in RealseeBrowserRTC instances"),new Me({getVoiceSign:this._options.getVoiceSign,autoPlayConfirm:this._options.autoPlayConfirm});default:{D.error("unknown built-in RTC type");return}}if(e.useBuiltInRTC){if(e.getVoiceSign||D.error("GetVoiceSign method must be passed when using built-in RTC instances"),this._options.jsBridge)return rr&&(Qt||er)||tr?new $e({jsBridge:this._options.jsBridge,getVoiceSign:this._options.getVoiceSign}):e.builtInRTCType===Ue.RealseeXChimeRTC?new Ve({getVoiceSign:this._options.getVoiceSign}):new Me({getVoiceSign:this._options.getVoiceSign,autoPlayConfirm:this._options.autoPlayConfirm});D.error("jsBridge instance must be passed when using built-in RTC instances");return}})(),this._options.rtc||D.warn("unused rtc"),this._options.url&&this._options.getTicket&&this.connect(),this._options.__debug__&&Object.assign(window,{$liveController:this._controller,$live:this})}get options(){return Object.freeze(this._options||{})}get state(){return this._controller.state}get readyState(){return this._controller.state}get url(){return this.options.url}get $RTC(){return this._options.rtc}get jsBridge(){return this._options.jsBridge}get snapshot(){return this._buildInData.keyframes}get selfInfo(){return this._buildInData.selfInfo}get userList(){return this._buildInData.userList||[]}get roomInfo(){return this._buildInData.roomInfo}async updateStatus(e,n,i,a){if(this.state!==$.OPEN)return!1;const u=Object.assign({event_type:e,action:n},{data:i}),f=Le(B.BuiltinMsg,u,a);try{return this._controller.sendMessage(f),!0}catch(v){return D.error(v),!1}}broadcast(e,n,i){return this.state!==$.OPEN?!1:new Promise((a,u)=>{const f=Le(B.CustomEvent,e,n),v=f.front_request_id,h=i?setTimeout(()=>{u(new Error("RESPONSE TIMEOUT")),this.off("broadcast",_)},i):void 0,_=(E,S)=>{S===v&&(h&&clearTimeout(h),this.off("broadcast",_),a(E))};this.on("broadcast",_);try{this._controller.sendMessage(f)}catch(E){u(E)}})}}const vt=t=>(fr(),new dr(t));var xe={},hr={get exports(){return xe},set exports(t){xe=t}},se={};/*
2
2
  object-assign
3
3
  (c) Sindre Sorhus
4
4
  @license MIT
5
- */var Ye,Tt;function $t(){if(Tt)return Ye;Tt=1;var r=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;function n(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var a={},c=0;c<10;c++)a["_"+String.fromCharCode(c)]=c;var l=Object.getOwnPropertyNames(a).map(function(f){return a[f]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(f){u[f]=f}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Ye=i()?Object.assign:function(o,a){for(var c,l=n(o),u,f=1;f<arguments.length;f++){c=Object(arguments[f]);for(var h in c)t.call(c,h)&&(l[h]=c[h]);if(r){u=r(c);for(var _=0;_<u.length;_++)e.call(c,u[_])&&(l[u[_]]=c[u[_]])}}return l},Ye}/** @license React v17.0.2
5
+ */var Ae,ct;function pt(){if(ct)return Ae;ct=1;var t=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,e=Object.prototype.propertyIsEnumerable;function n(a){if(a==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(a)}function i(){try{if(!Object.assign)return!1;var a=new String("abc");if(a[5]="de",Object.getOwnPropertyNames(a)[0]==="5")return!1;for(var u={},f=0;f<10;f++)u["_"+String.fromCharCode(f)]=f;var v=Object.getOwnPropertyNames(u).map(function(_){return u[_]});if(v.join("")!=="0123456789")return!1;var h={};return"abcdefghijklmnopqrst".split("").forEach(function(_){h[_]=_}),Object.keys(Object.assign({},h)).join("")==="abcdefghijklmnopqrst"}catch(_){return!1}}return Ae=i()?Object.assign:function(a,u){for(var f,v=n(a),h,_=1;_<arguments.length;_++){f=Object(arguments[_]);for(var E in f)s.call(f,E)&&(v[E]=f[E]);if(t){h=t(f);for(var S=0;S<h.length;S++)e.call(f,h[S])&&(v[h[S]]=f[h[S]])}}return v},Ae}/** @license React v17.0.2
6
6
  * react-jsx-runtime.production.min.js
7
7
  *
8
8
  * Copyright (c) Facebook, Inc. and its affiliates.
9
9
  *
10
10
  * This source code is licensed under the MIT license found in the
11
11
  * LICENSE file in the root directory of this source tree.
12
- */var At;function ir(){if(At)return fe;At=1,$t();var r=M,t=60103;if(fe.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var e=Symbol.for;t=e("react.element"),fe.Fragment=e("react.fragment")}var n=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i=Object.prototype.hasOwnProperty,o={key:!0,ref:!0,__self:!0,__source:!0};function a(c,l,u){var f,h={},_=null,y=null;u!==void 0&&(_=""+u),l.key!==void 0&&(_=""+l.key),l.ref!==void 0&&(y=l.ref);for(f in l)i.call(l,f)&&!o.hasOwnProperty(f)&&(h[f]=l[f]);if(c&&c.defaultProps)for(f in l=c.defaultProps,l)h[f]===void 0&&(h[f]=l[f]);return{$$typeof:t,type:c,key:_,ref:y,props:h,_owner:n.current}}return fe.jsx=a,fe.jsxs=a,fe}var ze={};/** @license React v17.0.2
12
+ */var ut;function _r(){if(ut)return se;ut=1,pt();var t=A,s=60103;if(se.Fragment=60107,typeof Symbol=="function"&&Symbol.for){var e=Symbol.for;s=e("react.element"),se.Fragment=e("react.fragment")}var n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i=Object.prototype.hasOwnProperty,a={key:!0,ref:!0,__self:!0,__source:!0};function u(f,v,h){var _,E={},S=null,m=null;h!==void 0&&(S=""+h),v.key!==void 0&&(S=""+v.key),v.ref!==void 0&&(m=v.ref);for(_ in v)i.call(v,_)&&!a.hasOwnProperty(_)&&(E[_]=v[_]);if(f&&f.defaultProps)for(_ in v=f.defaultProps,v)E[_]===void 0&&(E[_]=v[_]);return{$$typeof:s,type:f,key:S,ref:m,props:E,_owner:n.current}}return se.jsx=u,se.jsxs=u,se}var De={};/** @license React v17.0.2
13
13
  * react-jsx-runtime.development.js
14
14
  *
15
15
  * Copyright (c) Facebook, Inc. and its affiliates.
16
16
  *
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
- */var Pt;function or(){return Pt||(Pt=1,function(r){process.env.NODE_ENV!=="production"&&function(){var t=M,e=$t(),n=60103,i=60106;r.Fragment=60107;var o=60108,a=60114,c=60109,l=60110,u=60112,f=60113,h=60120,_=60115,y=60116,O=60121,A=60122,N=60117,B=60129,x=60131;if(typeof Symbol=="function"&&Symbol.for){var R=Symbol.for;n=R("react.element"),i=R("react.portal"),r.Fragment=R("react.fragment"),o=R("react.strict_mode"),a=R("react.profiler"),c=R("react.provider"),l=R("react.context"),u=R("react.forward_ref"),f=R("react.suspense"),h=R("react.suspense_list"),_=R("react.memo"),y=R("react.lazy"),O=R("react.block"),A=R("react.server.block"),N=R("react.fundamental"),R("react.scope"),R("react.opaque.id"),B=R("react.debug_trace_mode"),R("react.offscreen"),x=R("react.legacy_hidden")}var m=typeof Symbol=="function"&&Symbol.iterator,C="@@iterator";function W(s){if(s===null||typeof s!="object")return null;var d=m&&s[m]||s[C];return typeof d=="function"?d:null}var S=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(s){{for(var d=arguments.length,v=new Array(d>1?d-1:0),b=1;b<d;b++)v[b-1]=arguments[b];D("error",s,v)}}function D(s,d,v){{var b=S.ReactDebugCurrentFrame,I=b.getStackAddendum();I!==""&&(d+="%s",v=v.concat([I]));var T=v.map(function(k){return""+k});T.unshift("Warning: "+d),Function.prototype.apply.call(console[s],console,T)}}var X=!1;function de(s){return!!(typeof s=="string"||typeof s=="function"||s===r.Fragment||s===a||s===B||s===o||s===f||s===h||s===x||X||typeof s=="object"&&s!==null&&(s.$$typeof===y||s.$$typeof===_||s.$$typeof===c||s.$$typeof===l||s.$$typeof===u||s.$$typeof===N||s.$$typeof===O||s[0]===A))}function ye(s,d,v){var b=d.displayName||d.name||"";return s.displayName||(b!==""?v+"("+b+")":v)}function Ve(s){return s.displayName||"Context"}function G(s){if(s==null)return null;if(typeof s.tag=="number"&&E("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case r.Fragment:return"Fragment";case i:return"Portal";case a:return"Profiler";case o:return"StrictMode";case f:return"Suspense";case h:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case l:var d=s;return Ve(d)+".Consumer";case c:var v=s;return Ve(v._context)+".Provider";case u:return ye(s,s.render,"ForwardRef");case _:return G(s.type);case O:return G(s._render);case y:{var b=s,I=b._payload,T=b._init;try{return G(T(I))}catch{return null}}}return null}var ae=0,P,J,ce,we,ct,ut,lt;function ft(){}ft.__reactDisabledLog=!0;function Ht(){{if(ae===0){P=console.log,J=console.info,ce=console.warn,we=console.error,ct=console.group,ut=console.groupCollapsed,lt=console.groupEnd;var s={configurable:!0,enumerable:!0,value:ft,writable:!0};Object.defineProperties(console,{info:s,log:s,warn:s,error:s,group:s,groupCollapsed:s,groupEnd:s})}ae++}}function qt(){{if(ae--,ae===0){var s={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:e({},s,{value:P}),info:e({},s,{value:J}),warn:e({},s,{value:ce}),error:e({},s,{value:we}),group:e({},s,{value:ct}),groupCollapsed:e({},s,{value:ut}),groupEnd:e({},s,{value:lt})})}ae<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var De=S.ReactCurrentDispatcher,xe;function Se(s,d,v){{if(xe===void 0)try{throw Error()}catch(I){var b=I.stack.trim().match(/\n( *(at )?)/);xe=b&&b[1]||""}return`
20
- `+xe+s}}var Ue=!1,Ee;{var Jt=typeof WeakMap=="function"?WeakMap:Map;Ee=new Jt}function dt(s,d){if(!s||Ue)return"";{var v=Ee.get(s);if(v!==void 0)return v}var b;Ue=!0;var I=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=De.current,De.current=null,Ht();try{if(d){var k=function(){throw Error()};if(Object.defineProperty(k.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(k,[])}catch(Q){b=Q}Reflect.construct(s,[],k)}else{try{k.call()}catch(Q){b=Q}s.call(k.prototype)}}else{try{throw Error()}catch(Q){b=Q}s()}}catch(Q){if(Q&&b&&typeof Q.stack=="string"){for(var w=Q.stack.split(`
21
- `),$=b.stack.split(`
22
- `),L=w.length-1,j=$.length-1;L>=1&&j>=0&&w[L]!==$[j];)j--;for(;L>=1&&j>=0;L--,j--)if(w[L]!==$[j]){if(L!==1||j!==1)do if(L--,j--,j<0||w[L]!==$[j]){var Z=`
23
- `+w[L].replace(" at new "," at ");return typeof s=="function"&&Ee.set(s,Z),Z}while(L>=1&&j>=0);break}}}finally{Ue=!1,De.current=T,qt(),Error.prepareStackTrace=I}var le=s?s.displayName||s.name:"",kt=le?Se(le):"";return typeof s=="function"&&Ee.set(s,kt),kt}function ht(s,d,v){return dt(s,!1)}function Ft(s){var d=s.prototype;return!!(d&&d.isReactComponent)}function ke(s,d,v){if(s==null)return"";if(typeof s=="function")return dt(s,Ft(s));if(typeof s=="string")return Se(s);switch(s){case f:return Se("Suspense");case h:return Se("SuspenseList")}if(typeof s=="object")switch(s.$$typeof){case u:return ht(s.render);case _:return ke(s.type,d,v);case O:return ht(s._render);case y:{var b=s,I=b._payload,T=b._init;try{return ke(T(I),d,v)}catch{}}}return""}var vt={},gt=S.ReactDebugCurrentFrame;function Re(s){if(s){var d=s._owner,v=ke(s.type,s._source,d?d.type:null);gt.setExtraStackFrame(v)}else gt.setExtraStackFrame(null)}function Kt(s,d,v,b,I){{var T=Function.call.bind(Object.prototype.hasOwnProperty);for(var k in s)if(T(s,k)){var w=void 0;try{if(typeof s[k]!="function"){var $=Error((b||"React class")+": "+v+" type `"+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof s[k]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw $.name="Invariant Violation",$}w=s[k](d,k,b,v,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(L){w=L}w&&!(w instanceof Error)&&(Re(I),E("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",b||"React class",v,k,typeof w),Re(null)),w instanceof Error&&!(w.message in vt)&&(vt[w.message]=!0,Re(I),E("Failed %s type: %s",v,w.message),Re(null))}}}var he=S.ReactCurrentOwner,$e=Object.prototype.hasOwnProperty,Gt={key:!0,ref:!0,__self:!0,__source:!0},pt,mt,He;He={};function Yt(s){if($e.call(s,"ref")){var d=Object.getOwnPropertyDescriptor(s,"ref").get;if(d&&d.isReactWarning)return!1}return s.ref!==void 0}function zt(s){if($e.call(s,"key")){var d=Object.getOwnPropertyDescriptor(s,"key").get;if(d&&d.isReactWarning)return!1}return s.key!==void 0}function Xt(s,d){if(typeof s.ref=="string"&&he.current&&d&&he.current.stateNode!==d){var v=G(he.current.type);He[v]||(E('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',G(he.current.type),s.ref),He[v]=!0)}}function Zt(s,d){{var v=function(){pt||(pt=!0,E("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};v.isReactWarning=!0,Object.defineProperty(s,"key",{get:v,configurable:!0})}}function Qt(s,d){{var v=function(){mt||(mt=!0,E("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",d))};v.isReactWarning=!0,Object.defineProperty(s,"ref",{get:v,configurable:!0})}}var en=function(s,d,v,b,I,T,k){var w={$$typeof:n,type:s,key:d,ref:v,props:k,_owner:T};return w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(w,"_self",{configurable:!1,enumerable:!1,writable:!1,value:b}),Object.defineProperty(w,"_source",{configurable:!1,enumerable:!1,writable:!1,value:I}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w};function tn(s,d,v,b,I){{var T,k={},w=null,$=null;v!==void 0&&(w=""+v),zt(d)&&(w=""+d.key),Yt(d)&&($=d.ref,Xt(d,I));for(T in d)$e.call(d,T)&&!Gt.hasOwnProperty(T)&&(k[T]=d[T]);if(s&&s.defaultProps){var L=s.defaultProps;for(T in L)k[T]===void 0&&(k[T]=L[T])}if(w||$){var j=typeof s=="function"?s.displayName||s.name||"Unknown":s;w&&Zt(k,j),$&&Qt(k,j)}return en(s,w,$,I,b,he.current,k)}}var qe=S.ReactCurrentOwner,_t=S.ReactDebugCurrentFrame;function ue(s){if(s){var d=s._owner,v=ke(s.type,s._source,d?d.type:null);_t.setExtraStackFrame(v)}else _t.setExtraStackFrame(null)}var Je;Je=!1;function Fe(s){return typeof s=="object"&&s!==null&&s.$$typeof===n}function bt(){{if(qe.current){var s=G(qe.current.type);if(s)return`
19
+ */var lt;function gr(){return lt||(lt=1,function(t){process.env.NODE_ENV!=="production"&&function(){var s=A,e=pt(),n=60103,i=60106;t.Fragment=60107;var a=60108,u=60114,f=60109,v=60110,h=60112,_=60113,E=60120,S=60115,m=60116,P=60121,V=60122,j=60117,x=60129,J=60131;if(typeof Symbol=="function"&&Symbol.for){var I=Symbol.for;n=I("react.element"),i=I("react.portal"),t.Fragment=I("react.fragment"),a=I("react.strict_mode"),u=I("react.profiler"),f=I("react.provider"),v=I("react.context"),h=I("react.forward_ref"),_=I("react.suspense"),E=I("react.suspense_list"),S=I("react.memo"),m=I("react.lazy"),P=I("react.block"),V=I("react.server.block"),j=I("react.fundamental"),I("react.scope"),I("react.opaque.id"),x=I("react.debug_trace_mode"),I("react.offscreen"),J=I("react.legacy_hidden")}var d=typeof Symbol=="function"&&Symbol.iterator,w="@@iterator";function L(r){if(r===null||typeof r!="object")return null;var c=d&&r[d]||r[w];return typeof c=="function"?c:null}var b=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function C(r){{for(var c=arguments.length,l=new Array(c>1?c-1:0),g=1;g<c;g++)l[g-1]=arguments[g];M("error",r,l)}}function M(r,c,l){{var g=b.ReactDebugCurrentFrame,R=g.getStackAddendum();R!==""&&(c+="%s",l=l.concat([R]));var O=l.map(function(y){return""+y});O.unshift("Warning: "+c),Function.prototype.apply.call(console[r],console,O)}}var W=!1;function z(r){return!!(typeof r=="string"||typeof r=="function"||r===t.Fragment||r===u||r===x||r===a||r===_||r===E||r===J||W||typeof r=="object"&&r!==null&&(r.$$typeof===m||r.$$typeof===S||r.$$typeof===f||r.$$typeof===v||r.$$typeof===h||r.$$typeof===j||r.$$typeof===P||r[0]===V))}function le(r,c,l){var g=c.displayName||c.name||"";return r.displayName||(g!==""?l+"("+g+")":l)}function Se(r){return r.displayName||"Context"}function K(r){if(r==null)return null;if(typeof r.tag=="number"&&C("Received an unexpected object in getComponentName(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case t.Fragment:return"Fragment";case i:return"Portal";case u:return"Profiler";case a:return"StrictMode";case _:return"Suspense";case E:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case v:var c=r;return Se(c)+".Consumer";case f:var l=r;return Se(l._context)+".Provider";case h:return le(r,r.render,"ForwardRef");case S:return K(r.type);case P:return K(r._render);case m:{var g=r,R=g._payload,O=g._init;try{return K(O(R))}catch(y){return null}}}return null}var te=0,T,F,re,fe,Fe,qe,Ke;function Ye(){}Ye.__reactDisabledLog=!0;function Et(){{if(te===0){T=console.log,F=console.info,re=console.warn,fe=console.error,Fe=console.group,qe=console.groupCollapsed,Ke=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Ye,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}te++}}function bt(){{if(te--,te===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:e({},r,{value:T}),info:e({},r,{value:F}),warn:e({},r,{value:re}),error:e({},r,{value:fe}),group:e({},r,{value:Fe}),groupCollapsed:e({},r,{value:qe}),groupEnd:e({},r,{value:Ke})})}te<0&&C("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var we=b.ReactCurrentDispatcher,Re;function de(r,c,l){{if(Re===void 0)try{throw Error()}catch(R){var g=R.stack.trim().match(/\n( *(at )?)/);Re=g&&g[1]||""}return`
20
+ `+Re+r}}var Oe=!1,he;{var Ct=typeof WeakMap=="function"?WeakMap:Map;he=new Ct}function Ge(r,c){if(!r||Oe)return"";{var l=he.get(r);if(l!==void 0)return l}var g;Oe=!0;var R=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var O;O=we.current,we.current=null,Et();try{if(c){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(H){g=H}Reflect.construct(r,[],y)}else{try{y.call()}catch(H){g=H}r.call(y.prototype)}}else{try{throw Error()}catch(H){g=H}r()}}catch(H){if(H&&g&&typeof H.stack=="string"){for(var p=H.stack.split(`
21
+ `),U=g.stack.split(`
22
+ `),k=p.length-1,N=U.length-1;k>=1&&N>=0&&p[k]!==U[N];)N--;for(;k>=1&&N>=0;k--,N--)if(p[k]!==U[N]){if(k!==1||N!==1)do if(k--,N--,N<0||p[k]!==U[N]){var G=`
23
+ `+p[k].replace(" at new "," at ");return typeof r=="function"&&he.set(r,G),G}while(k>=1&&N>=0);break}}}finally{Oe=!1,we.current=O,bt(),Error.prepareStackTrace=R}var ie=r?r.displayName||r.name:"",st=ie?de(ie):"";return typeof r=="function"&&he.set(r,st),st}function He(r,c,l){return Ge(r,!1)}function yt(r){var c=r.prototype;return!!(c&&c.isReactComponent)}function _e(r,c,l){if(r==null)return"";if(typeof r=="function")return Ge(r,yt(r));if(typeof r=="string")return de(r);switch(r){case _:return de("Suspense");case E:return de("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case h:return He(r.render);case S:return _e(r.type,c,l);case P:return He(r._render);case m:{var g=r,R=g._payload,O=g._init;try{return _e(O(R),c,l)}catch(y){}}}return""}var Je={},ze=b.ReactDebugCurrentFrame;function ge(r){if(r){var c=r._owner,l=_e(r.type,r._source,c?c.type:null);ze.setExtraStackFrame(l)}else ze.setExtraStackFrame(null)}function St(r,c,l,g,R){{var O=Function.call.bind(Object.prototype.hasOwnProperty);for(var y in r)if(O(r,y)){var p=void 0;try{if(typeof r[y]!="function"){var U=Error((g||"React class")+": "+l+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw U.name="Invariant Violation",U}p=r[y](c,y,g,l,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(k){p=k}p&&!(p instanceof Error)&&(ge(R),C("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",g||"React class",l,y,typeof p),ge(null)),p instanceof Error&&!(p.message in Je)&&(Je[p.message]=!0,ge(R),C("Failed %s type: %s",l,p.message),ge(null))}}}var oe=b.ReactCurrentOwner,Ie=Object.prototype.hasOwnProperty,wt={key:!0,ref:!0,__self:!0,__source:!0},Xe,Ze,Te;Te={};function Rt(r){if(Ie.call(r,"ref")){var c=Object.getOwnPropertyDescriptor(r,"ref").get;if(c&&c.isReactWarning)return!1}return r.ref!==void 0}function Ot(r){if(Ie.call(r,"key")){var c=Object.getOwnPropertyDescriptor(r,"key").get;if(c&&c.isReactWarning)return!1}return r.key!==void 0}function It(r,c){if(typeof r.ref=="string"&&oe.current&&c&&oe.current.stateNode!==c){var l=K(oe.current.type);Te[l]||(C('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',K(oe.current.type),r.ref),Te[l]=!0)}}function Tt(r,c){{var l=function(){Xe||(Xe=!0,C("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};l.isReactWarning=!0,Object.defineProperty(r,"key",{get:l,configurable:!0})}}function kt(r,c){{var l=function(){Ze||(Ze=!0,C("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",c))};l.isReactWarning=!0,Object.defineProperty(r,"ref",{get:l,configurable:!0})}}var Pt=function(r,c,l,g,R,O,y){var p={$$typeof:n,type:r,key:c,ref:l,props:y,_owner:O};return p._store={},Object.defineProperty(p._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(p,"_self",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.defineProperty(p,"_source",{configurable:!1,enumerable:!1,writable:!1,value:R}),Object.freeze&&(Object.freeze(p.props),Object.freeze(p)),p};function jt(r,c,l,g,R){{var O,y={},p=null,U=null;l!==void 0&&(p=""+l),Ot(c)&&(p=""+c.key),Rt(c)&&(U=c.ref,It(c,R));for(O in c)Ie.call(c,O)&&!wt.hasOwnProperty(O)&&(y[O]=c[O]);if(r&&r.defaultProps){var k=r.defaultProps;for(O in k)y[O]===void 0&&(y[O]=k[O])}if(p||U){var N=typeof r=="function"?r.displayName||r.name||"Unknown":r;p&&Tt(y,N),U&&kt(y,N)}return Pt(r,p,U,R,g,oe.current,y)}}var ke=b.ReactCurrentOwner,Qe=b.ReactDebugCurrentFrame;function ne(r){if(r){var c=r._owner,l=_e(r.type,r._source,c?c.type:null);Qe.setExtraStackFrame(l)}else Qe.setExtraStackFrame(null)}var Pe;Pe=!1;function je(r){return typeof r=="object"&&r!==null&&r.$$typeof===n}function et(){{if(ke.current){var r=K(ke.current.type);if(r)return`
24
24
 
25
- Check the render method of \``+s+"`."}return""}}function nn(s){{if(s!==void 0){var d=s.fileName.replace(/^.*[\\\/]/,""),v=s.lineNumber;return`
25
+ Check the render method of \``+r+"`."}return""}}function Nt(r){{if(r!==void 0){var c=r.fileName.replace(/^.*[\\\/]/,""),l=r.lineNumber;return`
26
26
 
27
- Check your code at `+d+":"+v+"."}return""}}var yt={};function rn(s){{var d=bt();if(!d){var v=typeof s=="string"?s:s.displayName||s.name;v&&(d=`
27
+ Check your code at `+c+":"+l+"."}return""}}var tt={};function Lt(r){{var c=et();if(!c){var l=typeof r=="string"?r:r.displayName||r.name;l&&(c=`
28
28
 
29
- Check the top-level render call using <`+v+">.")}return d}}function wt(s,d){{if(!s._store||s._store.validated||s.key!=null)return;s._store.validated=!0;var v=rn(d);if(yt[v])return;yt[v]=!0;var b="";s&&s._owner&&s._owner!==qe.current&&(b=" It was passed a child from "+G(s._owner.type)+"."),ue(s),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',v,b),ue(null)}}function St(s,d){{if(typeof s!="object")return;if(Array.isArray(s))for(var v=0;v<s.length;v++){var b=s[v];Fe(b)&&wt(b,d)}else if(Fe(s))s._store&&(s._store.validated=!0);else if(s){var I=W(s);if(typeof I=="function"&&I!==s.entries)for(var T=I.call(s),k;!(k=T.next()).done;)Fe(k.value)&&wt(k.value,d)}}}function on(s){{var d=s.type;if(d==null||typeof d=="string")return;var v;if(typeof d=="function")v=d.propTypes;else if(typeof d=="object"&&(d.$$typeof===u||d.$$typeof===_))v=d.propTypes;else return;if(v){var b=G(d);Kt(v,s.props,"prop",b,s)}else if(d.PropTypes!==void 0&&!Je){Je=!0;var I=G(d);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",I||"Unknown")}typeof d.getDefaultProps=="function"&&!d.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sn(s){{for(var d=Object.keys(s.props),v=0;v<d.length;v++){var b=d[v];if(b!=="children"&&b!=="key"){ue(s),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",b),ue(null);break}}s.ref!==null&&(ue(s),E("Invalid attribute `ref` supplied to `React.Fragment`."),ue(null))}}function Et(s,d,v,b,I,T){{var k=de(s);if(!k){var w="";(s===void 0||typeof s=="object"&&s!==null&&Object.keys(s).length===0)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var $=nn(I);$?w+=$:w+=bt();var L;s===null?L="null":Array.isArray(s)?L="array":s!==void 0&&s.$$typeof===n?(L="<"+(G(s.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):L=typeof s,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",L,w)}var j=tn(s,d,v,I,T);if(j==null)return j;if(k){var Z=d.children;if(Z!==void 0)if(b)if(Array.isArray(Z)){for(var le=0;le<Z.length;le++)St(Z[le],s);Object.freeze&&Object.freeze(Z)}else E("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else St(Z,s)}return s===r.Fragment?sn(j):on(j),j}}function an(s,d,v){return Et(s,d,v,!0)}function cn(s,d,v){return Et(s,d,v,!1)}var un=cn,ln=an;r.jsx=un,r.jsxs=ln}()}(ze)),ze}(function(r){process.env.NODE_ENV==="production"?r.exports=ir():r.exports=or()})(rr);const sr=rt.jsx;function ar(r){const t=M.createContext(null),e=Ut(r),n=e.jsBridge,i=m=>sr(t.Provider,{value:e,children:m.children}),o=()=>{const m=M.useContext(t);if(!m)throw new Error("LiveProvider never found.");return m},a=()=>e,c=()=>e.$RTC,l=()=>c(),u=()=>async m=>await e.connect(m);function f(m,C,W=[]){const S=o(),E=[S,name,...W],D=()=>S.keyframes.off(m,C);return M.useEffect(()=>(S.keyframes.on(m,C),D),E),D}function h(){const m=o();return{connect:async P=>await m.connect(P),broadcast:async(P,J,ce=0)=>await m.broadcast(P,J,ce),exit:async()=>await m.exit(),kick:async P=>await m.kick(P),toggleMicro:P=>m.toggleMicro(P),forbidMicro:async(P,J=[])=>await m.forbidMicro(P,J),forbidSync:(P,J=[])=>m.forbidSync(P,J),sendKeyframe:(P,J)=>m.sendKeyframe(P,J),getFramesByKey:P=>m.getFramesByKey(P),setSelfInfo:P=>m.setSelfInfo(P),updateStatus:(P,J,ce,we)=>m.updateStatus(P,J,ce,we)}}function _(m){const C=o(),[W,S]=M.useState(C.getFramesByKey(m));M.useEffect(()=>{const D=ye=>S(ye),X=m,de=D;return C.keyframes.on(X,de),()=>C.keyframes.off(X,de)},[C]);const E=M.useCallback(D=>C.sendKeyframe(m,D),[C]);return[W,E]}function y(m,C,W=[]){const S=o(),E=()=>S.off(m,C),D=[S,m,...W];return M.useEffect(()=>(S.on(m,C),E),D),E}function O(){const m=o(),[C,W]=M.useState(m.state);return M.useEffect(()=>{const S=E=>W(E);return m.on("stateChange",S),()=>m.off("stateChange",S)},[m]),C}function A(){const m=o();return{join:X=>m.$RTC.join(X),quit:()=>m.$RTC.quit(),shock:()=>m.$RTC.shock?.(),toggleMicro:X=>m.$RTC.toggleMicro(X),detectMicro:()=>m.$RTC.detectMicro()}}function N(m,C,W=[]){const S=o(),E=()=>S.$RTC.off(m,C),D=[S,m,...W];return M.useEffect(()=>(S.$RTC.on(m,C),E),D),E}function B(){const m=o(),[C,W]=M.useState(m.selfInfo||{}),S=D=>W(D);M.useEffect(()=>(m.on("selfInfoUpdate",S),()=>m.off("selfInfoUpdate",S)),[m]);const E=M.useCallback(async D=>await m.setSelfInfo(D),[m]);return[C,E]}function x(){const m=o(),[C,W]=M.useState(m.snapshot);return M.useEffect(()=>{const S=E=>W(E);return m.on("keyframes",S),()=>m.off("keyframes",S)}),C}function R(){const m=o(),[C,W]=M.useState(m.userList),S=E=>W(E);return M.useEffect(()=>(m.on("userListUpdate",S),()=>m.off("userListUpdate",S)),[m]),C}return{live:e,jsBridge:n,LiveProvider:i,unsafe__useLiveInstance:a,unsafe__useRTCInstance:l,useConnect:u,useKeyframe:_,useKeyframeUpdateCallback:f,useLiveAction:h,useLiveEventCallback:y,useLiveState:O,useRTCAction:A,useRTCEventCallback:N,useSelfInfo:B,useKeyframesSnapshot:x,useUserList:R}}exports.BrowserRTC=Xe;exports.BrowserRTC4Chime=Ze;exports.BuiltInRTCType=it;exports.BuiltinActionType=Y;exports.BuiltinEventType=F;exports.Command=q;exports.CoreRTC=Ne;exports.LiveState=U;exports.MemUserStatus=Lt;exports.MicroStatus=ie;exports.RTCJoinedInfoCodeEnum=ot;exports.RTCType=oe;exports.UserStatus=Bt;exports.VRWebViewRTC=Qe;exports.WebSocketCloseError=jt;exports.WebSocketErrorType=Nt;exports.WebSocketState=Pe;exports.createLive=Ut;exports.createLiveReact=ar;exports.parseLiveMsg=_n;exports.parseWSClsErr=Wt;
29
+ Check the top-level render call using <`+l+">.")}return c}}function rt(r,c){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var l=Lt(c);if(tt[l])return;tt[l]=!0;var g="";r&&r._owner&&r._owner!==ke.current&&(g=" It was passed a child from "+K(r._owner.type)+"."),ne(r),C('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',l,g),ne(null)}}function nt(r,c){{if(typeof r!="object")return;if(Array.isArray(r))for(var l=0;l<r.length;l++){var g=r[l];je(g)&&rt(g,c)}else if(je(r))r._store&&(r._store.validated=!0);else if(r){var R=L(r);if(typeof R=="function"&&R!==r.entries)for(var O=R.call(r),y;!(y=O.next()).done;)je(y.value)&&rt(y.value,c)}}}function At(r){{var c=r.type;if(c==null||typeof c=="string")return;var l;if(typeof c=="function")l=c.propTypes;else if(typeof c=="object"&&(c.$$typeof===h||c.$$typeof===S))l=c.propTypes;else return;if(l){var g=K(c);St(l,r.props,"prop",g,r)}else if(c.PropTypes!==void 0&&!Pe){Pe=!0;var R=K(c);C("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof c.getDefaultProps=="function"&&!c.getDefaultProps.isReactClassApproved&&C("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Dt(r){{for(var c=Object.keys(r.props),l=0;l<c.length;l++){var g=c[l];if(g!=="children"&&g!=="key"){ne(r),C("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",g),ne(null);break}}r.ref!==null&&(ne(r),C("Invalid attribute `ref` supplied to `React.Fragment`."),ne(null))}}function it(r,c,l,g,R,O){{var y=z(r);if(!y){var p="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(p+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var U=Nt(R);U?p+=U:p+=et();var k;r===null?k="null":Array.isArray(r)?k="array":r!==void 0&&r.$$typeof===n?(k="<"+(K(r.type)||"Unknown")+" />",p=" Did you accidentally export a JSX literal instead of a component?"):k=typeof r,C("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",k,p)}var N=jt(r,c,l,R,O);if(N==null)return N;if(y){var G=c.children;if(G!==void 0)if(g)if(Array.isArray(G)){for(var ie=0;ie<G.length;ie++)nt(G[ie],r);Object.freeze&&Object.freeze(G)}else C("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else nt(G,r)}return r===t.Fragment?Dt(N):At(N),N}}function Mt(r,c,l){return it(r,c,l,!0)}function Vt(r,c,l){return it(r,c,l,!1)}var $t=Vt,xt=Mt;t.jsx=$t,t.jsxs=xt}()}(De)),De}(function(t){process.env.NODE_ENV==="production"?t.exports=_r():t.exports=gr()})(hr);const mr=xe.jsx;function vr(t){const s=A.createContext(null),e=vt(t),n=e.jsBridge,i=d=>mr(s.Provider,{value:e,children:d.children}),a=()=>{const d=A.useContext(s);if(!d)throw new Error("LiveProvider never found.");return d},u=()=>e,f=()=>e.$RTC,v=()=>f(),h=()=>async d=>await e.connect(d);function _(d,w,L=[]){const b=a(),C=[b,name,...L],M=()=>b.keyframes.off(d,w);return A.useEffect(()=>(b.keyframes.on(d,w),M),C),M}function E(){const d=a();return{connect:async T=>await d.connect(T),broadcast:async(T,F,re=0)=>await d.broadcast(T,F,re),exit:async()=>await d.exit(),kick:async T=>await d.kick(T),toggleMicro:T=>d.toggleMicro(T),forbidMicro:async(T,F=[])=>await d.forbidMicro(T,F),forbidSync:(T,F=[])=>d.forbidSync(T,F),sendKeyframe:(T,F)=>d.sendKeyframe(T,F),getFramesByKey:T=>d.getFramesByKey(T),setSelfInfo:T=>d.setSelfInfo(T),updateStatus:(T,F,re,fe)=>d.updateStatus(T,F,re,fe)}}function S(d){const w=a(),[L,b]=A.useState(w.getFramesByKey(d));A.useEffect(()=>{const M=le=>b(le),W=d,z=M;return w.keyframes.on(W,z),()=>w.keyframes.off(W,z)},[w]);const C=A.useCallback(M=>w.sendKeyframe(d,M),[w]);return[L,C]}function m(d,w,L=[]){const b=a(),C=()=>b.off(d,w),M=[b,d,...L];return A.useEffect(()=>(b.on(d,w),C),M),C}function P(){const d=a(),[w,L]=A.useState(d.state);return A.useEffect(()=>{const b=C=>L(C);return d.on("stateChange",b),()=>d.off("stateChange",b)},[d]),w}function V(){const d=a();return{join:W=>d.$RTC.join(W),quit:()=>d.$RTC.quit(),shock:()=>{var W,z;return(z=(W=d.$RTC).shock)==null?void 0:z.call(W)},toggleMicro:W=>d.$RTC.toggleMicro(W),detectMicro:()=>d.$RTC.detectMicro()}}function j(d,w,L=[]){const b=a(),C=()=>b.$RTC.off(d,w),M=[b,d,...L];return A.useEffect(()=>(b.$RTC.on(d,w),C),M),C}function x(){const d=a(),[w,L]=A.useState(d.selfInfo||{}),b=M=>L(M);A.useEffect(()=>(d.on("selfInfoUpdate",b),()=>d.off("selfInfoUpdate",b)),[d]);const C=A.useCallback(async M=>await d.setSelfInfo(M),[d]);return[w,C]}function J(){const d=a(),[w,L]=A.useState(d.snapshot);return A.useEffect(()=>{const b=C=>L(C);return d.on("keyframes",b),()=>d.off("keyframes",b)}),w}function I(){const d=a(),[w,L]=A.useState(d.userList),b=C=>L(C);return A.useEffect(()=>(d.on("userListUpdate",b),()=>d.off("userListUpdate",b)),[d]),w}return{live:e,jsBridge:n,LiveProvider:i,unsafe__useLiveInstance:u,unsafe__useRTCInstance:v,useConnect:h,useKeyframe:S,useKeyframeUpdateCallback:_,useLiveAction:E,useLiveEventCallback:m,useLiveState:P,useRTCAction:V,useRTCEventCallback:j,useSelfInfo:x,useKeyframesSnapshot:J,useUserList:I}}exports.BrowserRTC=Me;exports.BrowserRTC4Chime=Ve;exports.BuiltInRTCType=Ue;exports.BuiltinActionType=Y;exports.BuiltinEventType=q;exports.Command=B;exports.CoreRTC=be;exports.LiveState=$;exports.MemUserStatus=dt;exports.MicroStatus=Q;exports.RTCJoinedInfoCodeEnum=Be;exports.RTCType=ee;exports.UserStatus=ft;exports.VRWebViewRTC=$e;exports.WebSocketCloseError=_t;exports.WebSocketErrorType=ht;exports.WebSocketState=pe;exports.createLive=vt;exports.createLiveReact=vr;exports.parseLiveMsg=zt;exports.parseWSClsErr=gt;