UNPKG

zego-mini-game-engine

Version:

ZEGO GAME ENGINE

1 lines 1.03 MB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n,r=t();for(n in r)("object"==typeof exports?exports:e)[n]=r[n]}}("undefined"!=typeof self?self:this,(function(){return function(e){var t={};function n(r){var o;return(t[r]||(o=t[r]={i:r,l:!1,exports:{}},e[r].call(o.exports,o,o.exports,n),o.l=!0,o)).exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=32)}([function(e,t,n){"use strict";n(12);var r=n(13),o=(n.d(t,"j",(function(){return r.a})),n.d(t,"o",(function(){return r.b})),n(14)),i=(n.d(t,"n",(function(){return o.a})),n(15)),a=(n.d(t,"d",(function(){return i.a})),n(16)),s=(n.d(t,"e",(function(){return a.a})),n(17)),c=(n.d(t,"g",(function(){return s.a})),n.d(t,"h",(function(){return s.b})),n.d(t,"i",(function(){return s.c})),n.d(t,"l",(function(){return s.d})),n.d(t,"m",(function(){return s.e})),n(18),n(19));n.d(t,"a",(function(){return c.a})),n.d(t,"b",(function(){return c.b})),n.d(t,"c",(function(){return c.c})),n.d(t,"f",(function(){return c.d})),n.d(t,"k",(function(){return c.e}))},function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"e",(function(){return s})),n.d(t,"c",(function(){return c})),n.d(t,"d",(function(){return u})),n.d(t,"a",(function(){return l})),n.d(t,"h",(function(){return r})),n.d(t,"f",(function(){return o})),n.d(t,"g",(function(){return i}));var r,o,i,a={DISPATCH_RESULT_UPDATE:"dispatchResultUpdate",DISCONNECTED:"disconnected",CONNECTED:"connected",BROKEN:"broken"},s=15e3,c="wss://accesshub-wss.zego.im/accesshub",u=37,l="accesshubDispatchServers";(n=r=r||{})[n.BROWSER=0]="BROWSER",n[n.WEIXINMINI=1]="WEIXINMINI",(t=o=o||{}).LOGIN="/v1/sdk/login",t.GET_GAME_LIST="/v1/sdk/mg_list",t.GET_GAME_INFO="/v1/sdk/mg_info",t.CREATE_GAME="/v1/sdk/create_game",t.CLOSE_GAME="/v1/sdk/close_game",t.HEARTBEAT="/v1/sdk/heartbeat",t.START_GAME="/v1/sdk/start_game",t.REFRESH_TOKEN="/v1/sdk/refresh_token",t.START_CLOUD_GAME="/v1/sdk/cloudgame/start_game",t.STOP_CLOUD_GAME="/v1/sdk/cloudgame/stop_game",t.START_PUBLISH_STREAM="/v1/sdk/cloudgame/start_publish_stream",t.STOP_PUBLISH_STREAM="/v1/sdk/cloudgame/stop_publish_stream",(n=i=i||{}).Init="init",n.UnInit="unInit",n.GetGameList="getGameList",n.GetGameInfo="getGameInfo",n.CreateGameRoom="createGameRoom",n.CloseGameRoom="closeGameRoom",n.LoadGame="loadGame",n.LoadingTime="loadingTime",n.LoadedTime="loadedTime",n.UnloadGame="unloadGame",n.GetGameParams="getGameParams",n.SetGameParams="setGameParams",n.GetGameComponentList="getGameComponentList",n.SetGameComponent="setGameComponent",n.GetGameFunctionList="getGameFunctionList",n.RunGameFunction="runGameFunction",n.GameError="gameError",n.GameDestroy="gameDestroy",n.ButtonEvent="buttonEvent",n.PlayerState="playerState",n.GameState="gameState",n.UpdateCode="updateCode",n.UpdateToken="updateToken",n.RefreshPoint="refreshPoint",n.ToGameInfo="toGameInfo",n.FromGameInfo="fromGameInfo",n.On="on",n.Off="off",n.Visibilitychange="visibilitychange",n.startGame="startGame",n.InitCloudGame="initCloudGame",n.StartCloudGame="startCloudGame",n.StopCloudGame="stopCloudGame",n.SetStreamProfile="setStreamProfile",n.SetPlayVolume="setPlayVolume",n.GetPlayVolume="getPlayVolume",n.SendKeyboardEvent="sendKeyboardEvent",n.CloudGameFirstFrame="cloudGameFirstFrame",n.CloudGameError="cloudGameError",n.CEngineInited="cengineInited",n.CGameInited="cgameInited",n.CGameRendered="cgameRendered",n.CGameScene="cgameScene"},function(e,t,n){"use strict";var r=n(20),o=(n.d(t,"e",(function(){return r.a})),n.d(t,"g",(function(){return r.b})),n(21)),i=(n.d(t,"c",(function(){return o.a})),n.d(t,"d",(function(){return o.b})),n.d(t,"f",(function(){return o.c})),n(22)),a=(n.d(t,"h",(function(){return i.a})),n(23)),s=(n.d(t,"b",(function(){return a.a})),n(24));n.d(t,"a",(function(){return s.a}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(25),o=n(6),i=(t=n(2),a.getDeviceId=function(){var e=localStorage.getItem("device");return e||(e="device-web-".concat(String((new Date).getTime()).substr(1)),localStorage.setItem("device",e)),e},a.createTracer=function(e,t,n,r){var o=this;this.init(t,n,r),e.getDomain().then((function(e){var n;null!=(n=o.tracer)&&n.setConfig({serverUrl:"wss://weblogger".concat(t,"-api.").concat(e,"/zglog/tlog")})}))},a.init=function(e,t,n){var i=this;this.tracer||(this.tracer=new r.ZegoTracer,this.tracer.init({product:this.PRODUCT,version:o.a.getVersion(),appID:e,deviceID:this.getDeviceId(),env:0,importantLevel:0,levels:[0,10,30,50,80],spanStart:function(e){},spanBeforeEnd:function(e){var t={},n={};Object.keys(e.attributes).forEach((function(r){-1!==i.stringifyWhitelist.indexOf(r)?t[r]=e.attributes[r]:n[r]=e.attributes[r]})),t.detail=JSON.stringify(n),e.attributes=t},spanEnd:function(e){},resources:{product:this.PRODUCT,version:o.a.getVersion(),system:this.systemInfo.system,browser:this.systemInfo.browser,user_agent:this.systemInfo.ua,device_id:this.getDeviceId(),platform:"W",appid:+e,app_id:+e,user_id:n,report_version:3}}),(e=new Map).set("userID",n),e.set("token",t),this.tracer.startReport(e))},a.unInit=function(){this.tracer=null},a.createSpan=function(e,t){return this.tracer.createSpan(0,e,{kind:2,attributes:t})},a.PRODUCT="zegominigame",a.systemInfo=(new t.b).getInfo(),a.domain="imzego.com",a.stringifyWhitelist=["e_time_s","error","elapsed_time","game_id","room_id"],a);function a(){}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));t=n(0);var r=(o.language=t.n.zh_CN,o);function o(){}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=n(1),i=n(3),a=n(2),s=n(28),c=(u.initGame=function(e,t,n,r){Object.keys(n).includes("minGamePoint")&&((o={}).minGameCoin=n.minGamePoint,delete n.minGamePoint,n=Object.assign(o,n)),Object.keys(n).includes("pointIconUrl")&&((o={}).coinIconUrl=n.pointIconUrl,delete n.pointIconUrl,n=Object.assign(o,n));var o=document.querySelector(e);e=new s.a(e,t,n,r,o.offsetWidth,o.offsetHeight),u.gameInsMap.set(r.miniGameId,e),u.currentGameId=r.miniGameId,t=r.mgUrl;return t+=-1!==t.indexOf("?")?"&zego_platform=web":"?zego_platform=web",o.src=t,o.removeEventListener("visibilitychange",this.visibilitychange),{dom:o,width:o.offsetWidth,height:o.offsetHeight,url:t}},u.unInitGame=function(){var e=document.querySelector(this.getCurrentGame().domId);e.src="",u.currentGameId="",e.removeEventListener("visibilitychange",this.visibilitychange)},u.getCurrentGame=function(){if(u.currentGameId&&u.gameInsMap.has(u.currentGameId))return u.gameInsMap.get(u.currentGameId);throw new Error(JSON.stringify(Object(a.h)(r.d.ErrorGameIsNotRunning)))},u.visibilitychange=function(e){e=e.currentTarget,i.a.createSpan(o.g.Visibilitychange,{game_id:this.currentGameId,hidden:e.hidden}).end(!0)},u.gameInsMap=new Map,u);function u(){}},function(e,t,n){"use strict";n.d(t,"a",(function(){return f}));var r=n(0),o=n(4),i=n(1),a=n(26),s=n(29),c=n(3),u=n(30),l=n(31),p=n(5),d=n(2),h=function(){return(h=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},f=(g.getVersion=function(){return"2.0.1"},g.prototype.registerInnerEvent=function(){this.eventBus.add(r.f.Init,this.onGameInit.bind(this)),this.eventBus.add(r.f.GameOverDetail,this.onGameOverDetail.bind(this)),this.eventBus.add(r.f.GameLoading,this.onGameLoadStateUpdate.bind(this)),this.eventBus.add(r.f.GameLoaded,this.onGameLoadStateUpdate.bind(this)),this.eventBus.add(r.f.ActionEvents,this.onActionEvents.bind(this)),this.eventBus.add(r.f.UserMicChange,this.onUserMicChange.bind(this)),this.eventBus.add(r.f.UserSpeakerChange,this.onUserSpeakerChange.bind(this)),this.eventBus.add(r.f.CEngineInited,this.onCGameActionEvents.bind(this)),this.eventBus.add(r.f.CGameInited,this.onCGameActionEvents.bind(this)),this.eventBus.add(r.f.CGameRendered,this.onCGameActionEvents.bind(this)),this.eventBus.add(r.f.CGameScene,this.onCGameActionEvents.bind(this)),this.eventBus.add(r.k.Destroy,this.onGameDestroy.bind(this)),this.eventBus.add(r.k.GameOrientation,this.onGameOrientationUpdate.bind(this)),this.eventBus.add(r.k.GameRecharge,this.onGameRechargeUpdate.bind(this)),this.eventBus.add(r.k.GameIntroduction,this.onGameIntroductionUpdate.bind(this)),this.eventBus.add(r.k.GetConfig,this.onGetConfig.bind(this)),this.eventBus.add(r.k.PlayerPlaying,this.onPlayerPlayingChanged.bind(this)),this.eventBus.add(r.k.GameState,this.onGameStateUpdate.bind(this)),this.eventBus.add(r.k.GameUploadError,this.onGameUploadError.bind(this)),this.eventBus.add(r.k.PlayGameSound,this.onPlayGameSound.bind(this)),this.eventBus.add(r.k.ChangeGameSoundVolume,this.onChangeGameSoundVolume.bind(this)),this.eventBus.add(r.k.GetRobotSetting,this.onGetRobotSetting.bind(this)),this.eventBus.add(r.a.CloudGameFirstFrame,this.onCloudGameFirstFrame.bind(this)),this.eventBus.add(r.a.CloudGameError,this.onCloudGameError.bind(this)),this.eventBus.add(r.k.ActionRequest,this.onActionRequest.bind(this)),this.eventBus.add(r.f.SetCustomComponent,this.onCustomComponetListUpdate.bind(this))},g.prototype.onCustomComponetListUpdate=function(e){this.eventBus.emit(r.e.ComponentListUpdate,{list:e})},g.prototype.onGameInit=function(e){var t=p.a.getCurrentGame();t.version=e.version,this.startHeartbeat(o.a.heartbeatInterval,t.gameInfo.miniGameId,e.version)},g.prototype.onGameLoadStateUpdate=function(e,t){var n=p.a.getCurrentGame();if(t.command!==r.f.GameLoading){if(0!==n.loadedTime)return;n.loadedTime=Date.now()}c.a.createSpan(t.command===r.f.GameLoading?i.g.LoadingTime:i.g.LoadedTime,{game_id:n.gameInfo.miniGameId,room_id:n.config.roomId,error:r.d.Success,elapsed_time:Date.now()-n.startTime,data:e}).end(!0),n=t.command===r.f.GameLoading?r.g.Loading:r.g.Loaded,this.eventBus.emit(r.e.GameLoadStateUpdate,{state:n,data:e})},g.prototype.onGameOverDetail=function(e){this.eventBus.emit(r.e.GameResult,h({},e))},g.prototype.onActionEvents=function(e){var t=p.a.getCurrentGame();c.a.createSpan(i.g.ButtonEvent,{game_id:t.gameInfo.miniGameId,room_id:t.config.roomId,button_id:e.eventType,data:e.data}).end(!0),this.eventBus.emit(r.e.ActionEventUpdate,{eventType:e.eventType,data:e.data})},g.prototype.onActionRequest=function(e,t){var n=this,o=p.a.getCurrentGame();c.a.createSpan(i.g.ButtonEvent,{game_id:o.gameInfo.miniGameId,room_id:o.config.roomId,action_id:e.actionID,data:e.data}).end(!0),this.eventBus.emit(r.e.ActionRequest,{actionID:e.actionID,actionCallback:{success:function(){n.gameConnect.request({command:r.k.ActionRequest,data:{responseCode:0},seq:t.seq,gameCallback:!0})},fail:function(e){n.gameConnect.request({command:r.k.ActionRequest,data:{responseCode:e||1},seq:t.seq,gameCallback:!0})}},data:e.data})},g.prototype.onUserMicChange=function(e){this.eventBus.emit(r.e.MicStateChange,{mute:!!e.isMute})},g.prototype.onUserSpeakerChange=function(e){this.eventBus.emit(r.e.SpeakerStateChange,{mute:!!e.isMute,userIdList:e.userIDList})},g.prototype.onCGameActionEvents=function(e,t){var n,o=p.a.getCurrentGame();switch(t.command){case"zego_game_cengine_inited":n=i.g.CEngineInited;break;case"zego_game_cgame_inited":n=i.g.CGameInited;break;case"zego_game_cgame_rendered":n=i.g.CGameRendered;break;case"zego_game_cgame_scene":n=i.g.CGameScene}c.a.createSpan(n,{game_id:o.gameInfo.miniGameId,room_id:o.config.roomId,error:r.d.Success,data:e}).end(!0)},g.prototype.onGameDestroy=function(){var e=p.a.getCurrentGame(),t=c.a.createSpan(i.g.GameDestroy,{game_id:e.gameInfo.miniGameId,room_id:e.config.roomId});p.a.unInitGame(),this.stopHeartbeat(),this.eventBus.emit(r.e.Unloaded,{miniGameId:e.gameInfo.miniGameId}),t.end(!0)},g.prototype.onGameOrientationUpdate=function(e,t){this.gameConnect.request({command:r.k.GameOrientation,data:{code:r.d.Success},seq:t.seq,gameCallback:!0})},g.prototype.onGameRechargeUpdate=function(e,t){var n=p.a.getCurrentGame();this.gameConnect.request({command:r.k.GameRecharge,data:{code:r.d.Success},seq:t.seq,gameCallback:!0}),this.eventBus.emit(r.e.PointsInsufficient,{miniGameId:n.gameInfo.miniGameId})},g.prototype.onGameIntroductionUpdate=function(e,t){this.gameConnect.request({command:r.k.GameIntroduction,data:{code:r.d.Success},seq:t.seq,gameCallback:!0})},g.prototype.onGetConfig=function(e,t){var n=p.a.getCurrentGame();this.gameConnect.request({command:r.k.GetConfig,data:{code:o.a.userCode,roomID:n.config.roomId,appID:o.a.appId,role:r.o.Audience,language:o.a.language,userID:o.a.gameUserInfo.userId,customPlaySound:n.config.customPlaySound,gameMode:n.gameMode,gameConfig:h({},n.config),container:{gameOrientation:n.gameInfo.gameOrientation,width:n.webViewWidth,height:n.webViewHeight},engineVersion:"2.0.1"},seq:t.seq,gameCallback:!0})},g.prototype.onPlayerPlayingChanged=function(e){var t=p.a.getCurrentGame();c.a.createSpan(i.g.PlayerState,{game_id:t.gameInfo.miniGameId,room_id:t.config.roomId,is_play:e.isPlaying}).end(!0),this.eventBus.emit(r.e.PlayerStateUpdate,{isPlaying:e.isPlaying?r.j.ZegoGamePlayerStartPlay:r.j.ZegoGamePlayerStopPlay})},g.prototype.onGameStateUpdate=function(e){var t=p.a.getCurrentGame();c.a.createSpan(i.g.GameState,{game_id:t.gameInfo.miniGameId,room_id:t.config.roomId,state:e.status,reasonCode:e.reasonCode}).end(!0),this.eventBus.emit(r.e.GameStateUpdate,{state:e.status,reasonCode:e.reasonCode})},g.prototype.onPlayGameSound=function(e){this.eventBus.emit(r.e.GameSoundPlay,{name:e.name,isPlay:e.isPlay,volume:e.volume,url:e.url,playType:e.playType})},g.prototype.onChangeGameSoundVolume=function(e){this.eventBus.emit(r.e.GameSoundVolumeChange,{name:e.name,volume:e.volume})},g.prototype.onGameUploadError=function(e,t){var n=p.a.getCurrentGame();c.a.createSpan(i.g.GameError,{game_id:n.gameInfo.miniGameId,room_id:n.config.roomId,error:e.errorCode,msg:e.message}).end(!0),this.gameConnect.request({command:r.k.GameUploadError,data:{code:r.d.Success},seq:t.seq,gameCallback:!0}),this.eventBus.emit(r.e.GameError,h({},e))},g.prototype.onGetRobotSetting=function(e,t){var n=this;this.eventBus.emit(r.e.RobotConfigRequire,{done:function(e,o,i,a,s,c){n.gameConnect.request({command:r.k.GetRobotSetting,data:{robotLevel:e=e<0?0:e,robotName:o,robotAvatar:i,useRobotAfterSeconds:a,minCoin:s,maxCoin:c},seq:t.seq,gameCallback:!0})}})},g.prototype.onCloudGameFirstFrame=function(){c.a.createSpan(i.g.CloudGameFirstFrame,{}).end(!0),this.eventBus.emit(r.e.CloudGameFirstFrame,{})},g.prototype.onCloudGameError=function(e){c.a.createSpan(i.g.CloudGameError,{}).end(!0),this.eventBus.emit(r.e.CloudGameError,h({},e))},g.prototype.login=function(){var e=this;return this.serverConnect.request(i.f.LOGIN,{userName:o.a.gameUserInfo.userName,userAvatar:o.a.gameUserInfo.avatar}).then((function(t){return t.code===r.d.Success&&(o.a.userCode=t.data.code,o.a.heartbeatInterval=1e3*t.data.heartbeatInterval,e.setUpdateCodeAlarm(t.data.expireDate-Date.now()-3e4),e.setTokenAlarm(o.a.token)),t}))},g.prototype.refreshToken=function(){return this.serverConnect.request(i.f.REFRESH_TOKEN,{}).then((function(e){return e}))},g.prototype.getGameList=function(e,t,n){return this.serverConnect.request(i.f.GET_GAME_LIST,{pageIndex:e,pageSize:t,gameMode:n,gameOrientation:r.i.OrientationBoth})},g.prototype.getGameInfo=function(e){var t=this,n=c.a.createSpan(i.g.GetGameInfo,{game_id:e});return e?this.serverConnect.request(i.f.GET_GAME_INFO,{miniGameId:e}).then((function(e){return n.setAttributes({error:e.code}),n.end(!0),e.code===r.d.Success&&t.gameInfoDetailMap.set(e.data.miniGameId,JSON.parse(JSON.stringify(e.data))),e})):(n.setAttributes({error:r.d.ErrorInvalidGameId}),n.end(!0),Promise.reject(Object(d.h)(r.d.ErrorInvalidGameId)))},g.prototype.createGameRoom=function(e,t,n,r,o,a){return this.serverConnect.request(i.f.CREATE_GAME,{miniGameId:e,roomId:t,player:n,spin:r,taxType:o,taxRate:a})},g.prototype.closeGameRoom=function(e,t){return this.serverConnect.request(i.f.CLOSE_GAME,{miniGameId:e,roomId:t})},g.prototype.loadGame=function(e,t,n,o){function i(e){var r=(e=p.a.initGame(a.domId,t,n,e)).dom,i=e.width,s=e.height;e=e.url;return o.setAttributes({game_url:e,web_view_width:i,web_view_height:s}),r}var a=this,s=this.gameInfoDetailMap.get(e);return s?Promise.resolve(i(s)):this.getGameInfo(e).then((function(e){return e.code===r.d.Success?i(s=e.data):Promise.reject(e)}))},g.prototype.unloadGame=function(e,t){try{var n=p.a.getCurrentGame();return t.setAttributes({game_id:n.gameInfo.miniGameId,room_id:n.config.roomId}),this.gameConnect.request({command:r.b.BeforeDestroy,data:{gameID:n.gameInfo.miniGameId},gameCallback:!1}),e&&this.onGameDestroy(),Promise.resolve({code:r.d.Success})}catch(e){return Promise.reject(e)}},g.prototype.startGame=function(e,t,n,r){var o=p.a.getCurrentGame();r.setAttributes({room_id:o.config.roomId,mini_game_id:o.gameInfo.miniGameId}),r=t.map((function(e){return{robotName:e.robotName,robotLevel:e.robotLevel,robotAvatar:e.robotAvatar,robotCurrencyBalance:e.robotPoint,seatIndex:e.seatIndex}}));return this.serverConnect.request(i.f.START_GAME,{miniGameId:o.gameInfo.miniGameId,roomId:o.config.roomId,gameCfg:n.customConfig,taxType:n.taxType,taxRate:n.taxRate,minGameCoin:n.minGamePoint,timeout:n.timeout,userList:e,robotList:r},["game_cfg"])},g.prototype.setCloudGameContainer=function(e){this.cloudGameConnect.domId=e},g.prototype.startCloudGame=function(e,t,n){var r=this;return new Promise((function(a,s){r.cloudGameConnect.domId||s("还未调用 setCloudGameDomId 接口设置父容器");try{r.getGameInfo(e).then((function(u){var l=u.data.CloudType||1,p=c.a.createSpan(i.g.InitCloudGame,{game_id:e,room_id:t,cloud_type:l,container:r.cloudGameConnect.domId});u={command:"zego_cloud_game_init",data:{appid:o.a.appId,cloudType:l,container:r.cloudGameConnect.domId},callback:function(o){p.setAttributes({cloudGameRes:o,error:o.data.code}),p.end(!0),0===o.data.code?r.serverConnect.request(i.f.START_CLOUD_GAME,{miniGameId:e,roomId:t,cloudType:l,txRequest:{clientSession:o.data.clientSession||""},wlRequest:{bizData:o.data.bizData||"",node:o.data.node||"",resolution:n.resolution,codecType:n.codecType,bitRate:n.bitRate,fps:n.fps},appParameters:n.runningParameters}).then((function(n){var o,u;0===n.code?(o=c.a.createSpan(i.g.StartCloudGame,{game_id:e,room_id:t,cloud_type:l,server_session:n.data.txResponse.serverSession,sdk_msg:n.data.wlResponse.sdkMsg}),u={command:"zego_cloud_game_start",data:{serverSession:n.data.txResponse.serverSession,sdkMsg:n.data.wlResponse.sdkMsg},callback:function(e){o.setAttributes({cloudGameRes:e,error:e.data.code}),o.end(!0),a(e.data)}},r.cloudGameConnect.request(u)):s(n)})).catch((function(e){s(e)})):s(o.data)}};r.cloudGameConnect.request(u)}))}catch(e){s(e)}}))},g.prototype.stopCloudGame=function(e,t){var n=this;return new Promise((function(r,o){var a=c.a.createSpan(i.g.StopCloudGame,{game_id:e,room_id:t});try{n.serverConnect.request(i.f.STOP_CLOUD_GAME,{miniGameId:e,roomId:t}).then((function(e){a.setAttributes({cloudGameSeverRes:e}),a.end(!0)})).catch((function(e){}));var s={command:"zego_cloud_game_destroy",callback:function(e){document.querySelector(n.cloudGameConnect.domId),a.setAttributes({cloudGameRes:e,error:e.data.code}),r(e.data)}};n.cloudGameConnect.request(s)}catch(s){a.end(!0),o(s)}}))},g.prototype.startPublishCloudGameStream=function(e,t,n){return this.serverConnect.request(i.f.START_PUBLISH_STREAM,{miniGameId:e,roomId:t,streamId:n})},g.prototype.stopPublishCloudGameStream=function(e,t,n){return this.serverConnect.request(i.f.STOP_PUBLISH_STREAM,{miniGameId:e,roomId:t,streamId:n})},g.prototype.setStreamProfile=function(e){var t=c.a.createSpan(i.g.SetStreamProfile,{stream_profile:e});try{var n={command:"zego_cloud_game_set_stream_profile",data:{fps:e.fps,min_bitrate:e.minBitrate,max_bitrate:e.maxBitrate},callback:function(){t.end(!0)}};this.cloudGameConnect.request(n)}catch(e){t.end(!0)}},g.prototype.setPlayVolume=function(e){var t=c.a.createSpan(i.g.SetPlayVolume,{volume:e});try{var n={command:"zego_cloud_game_set_video_volume",data:{value:e},callback:function(){t.end(!0)}};this.cloudGameConnect.request(n)}catch(e){t.end(!0)}},g.prototype.getPlayVolume=function(){var e=this,t=c.a.createSpan(i.g.GetPlayVolume,{});return new Promise((function(n,r){try{var o={command:"zego_cloud_game_video_volume",callback:function(e){t.setAttributes({cloudGameRes:e}),t.end(!0),n(e.data)}};e.cloudGameConnect.request(o)}catch(o){t.end(!0),r(o)}}))},g.prototype.sendKeyboardEvent=function(e){var t=c.a.createSpan(i.g.SendKeyboardEvent,{key:e});try{var n={command:"zego_cloud_game_send_keyboard_event",data:{key:e},callback:function(){t.end(!0)}};this.cloudGameConnect.request(n)}catch(e){t.end(!0)}},g.prototype.setGameSetting=function(e){var t=p.a.getCurrentGame();c.a.createSpan(i.g.SetGameParams,{game_id:t.gameInfo.miniGameId,room_id:t.config.roomId,param_type:e.settingType,param_value:e.settingValue,error:r.d.Success}).end(!0),this.gameConnect.request({command:r.b.SetGameSetting,data:e,gameCallback:!1})},g.prototype.getGameSetting=function(e){var t=this,n=p.a.getCurrentGame(),o=c.a.createSpan(i.g.GetGameParams,{game_id:n.gameInfo.miniGameId,room_id:n.config.roomId});return new Promise((function(n,i){try{t.gameConnect.request({command:r.c.GetGameSetting,data:{},gameCallback:!1,callback:function(t){t=t.data.settings,o.setAttributes({settings:t,error:r.d.Success}),o.end(!0),n(t[e])}})}catch(e){o.end(!0),i(e)}}))},g.prototype.refreshGamePoint=function(e){var t=p.a.getCurrentGame();e.setAttributes({game_id:t.gameInfo.miniGameId}),this.gameConnect.request({command:r.b.WalletUpdate,data:{gameID:t.gameInfo.miniGameId},gameCallback:!1})},g.prototype.getGameComponentList=function(e){var t=this;return new Promise((function(n,o){try{var i=p.a.getCurrentGame();t.gameConnect.request({command:r.c.GetCustomComponents,data:{},gameCallback:!1,callback:function(t){e.setAttributes({game_id:i.gameInfo.miniGameId,room_id:i.config.roomId,error:t.code,component_list:t.data.webviews}),n(t.data.webviews)}})}catch(e){o(e)}}))},g.prototype.getGameFunctionList=function(e){var t=this;return new Promise((function(n,o){try{var i=p.a.getCurrentGame();t.gameConnect.request({command:r.c.GetCustomFunctions,data:{},gameCallback:!1,callback:function(t){e.setAttributes({game_id:i.gameInfo.miniGameId,room_id:i.config.roomId,error:t.code,function_list:t.data.functions}),n(t.data.functions)}})}catch(e){o(e)}}))},g.prototype.setGameComponent=function(e,t,n){var o=this;return new Promise((function(i,a){try{var s=p.a.getCurrentGame();o.gameConnect.request({command:r.c.RunCustomComponent,data:{name:e,isShow:t},gameCallback:!1,callback:function(e){n.setAttributes({game_id:s.gameInfo.miniGameId,room_id:s.config.roomId,error:e.code}),i(e.data.isSuccess)}})}catch(e){a(e)}}))},g.prototype.runGameFunction=function(e,t){var n=this;return new Promise((function(o,i){try{var a=p.a.getCurrentGame();n.gameConnect.request({command:r.c.RunCustomFunction,data:{name:e,params:[]},gameCallback:!1,callback:function(e){t.setAttributes({game_id:a.gameInfo.miniGameId,room_id:a.config.roomId,error:e.code}),o(e.data.isSuccess)}})}catch(e){i(e)}}))},g.prototype.updateCode=function(e){},g.prototype.on=function(e,t){this.eventBus.on(e,t)},g.prototype.off=function(e){this.eventBus.off(e)},g.prototype.isConnected=function(){return this.serverConnect.isConnected()},g.prototype.setTokenAlarm=function(e){var t=this;(e=(this.tokenTimeout&&(clearTimeout(this.tokenTimeout),this.tokenTimeout=0),1e3*d.a.decodeTokenExpire(e.substring(2))-3e4-Date.now()))<0&&(e=0),this.tokenTimeout=window.setTimeout((function(){t.eventBus.emit(r.e.TokenWillExpire,{})}),e)},g.prototype.setUpdateCodeAlarm=function(e){var t=this;this.codeTimeout&&(clearTimeout(this.codeTimeout),this.codeTimeout=0),this.codeTimeout=window.setTimeout((function(){var e=c.a.createSpan(i.g.UpdateCode,{});t.login().then((function(n){e.setAttributes({error:n.code,code:n.data.code}),n.code!==r.d.Success&&t.setUpdateCodeAlarm(0)})).finally((function(){e.end(!0)}))}),e)},g.prototype.stopHeartbeat=function(){this.heartbeatTimeout&&(clearTimeout(this.heartbeatTimeout),this.heartbeatTimeout=0)},g.prototype.startHeartbeat=function(e,t,n){var o=this,a=p.a.getCurrentGame(),s=a.config.roomId||"";a.gameMode===r.h.GameModeMallGame&&(s=""),this.serverConnect.request(i.f.HEARTBEAT,{miniGameId:t,h5Version:n,roomId:s}),this.stopHeartbeat(),this.heartbeatTimeout=window.setTimeout((function(){o.startHeartbeat(e,t,n)}),e)},g.prototype.refreshMicAndSpeakerState=function(){this.gameConnect.request({command:r.b.RefreshMicAndSpeakerState,data:{},gameCallback:!1})},g);function g(){this.codeTimeout=0,this.tokenTimeout=0,this.heartbeatTimeout=0,this.gameInfoDetailMap=new Map,this.domId="",this.serverConnect=new s.a,this.eventBus=new l.a,this.gameConnect=new a.a(this.eventBus),this.cloudGameConnect=new u.a(this.eventBus),this.registerInnerEvent(),c.a.createTracer(this.serverConnect,o.a.appId,o.a.token,o.a.gameUserInfo.userId)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));class r{constructor(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(e){var t,n=r.hexChars,o=r.hexOut;let i,a,s;for(s=0;s<4;s+=1)for(t=8*s,i=e[s],a=0;a<8;a+=2)o[1+t+a]=n.charAt(15&i),i>>>=4,o[0+t+a]=n.charAt(15&i),i>>>=4;return o.join("")}static _md5cycle(e,t){var n=e[0],r=e[1],o=e[2],i=e[3];r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[0]-680876936|0)<<7|n>>>25)+r|0)&r|~n&o)+t[1]-389564586|0)<<12|i>>>20)+n|0)&n|~i&r)+t[2]+606105819|0)<<17|o>>>15)+i|0)&i|~o&n)+t[3]-1044525330|0)<<22|r>>>10)+o|0;r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[4]-176418897|0)<<7|n>>>25)+r|0)&r|~n&o)+t[5]+1200080426|0)<<12|i>>>20)+n|0)&n|~i&r)+t[6]-1473231341|0)<<17|o>>>15)+i|0)&i|~o&n)+t[7]-45705983|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[8]+1770035416|0)<<7|n>>>25)+r|0)&r|~n&o)+t[9]-1958414417|0)<<12|i>>>20)+n|0)&n|~i&r)+t[10]-42063|0)<<17|o>>>15)+i|0)&i|~o&n)+t[11]-1990404162|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&o|~r&i)+t[12]+1804603682|0)<<7|n>>>25)+r|0)&r|~n&o)+t[13]-40341101|0)<<12|i>>>20)+n|0)&n|~i&r)+t[14]-1502002290|0)<<17|o>>>15)+i|0)&i|~o&n)+t[15]+1236535329|0)<<22|r>>>10)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[1]-165796510|0)<<5|n>>>27)+r|0)&o|r&~o)+t[6]-1069501632|0)<<9|i>>>23)+n|0)&r|n&~r)+t[11]+643717713|0)<<14|o>>>18)+i|0)&n|i&~n)+t[0]-373897302|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[5]-701558691|0)<<5|n>>>27)+r|0)&o|r&~o)+t[10]+38016083|0)<<9|i>>>23)+n|0)&r|n&~r)+t[15]-660478335|0)<<14|o>>>18)+i|0)&n|i&~n)+t[4]-405537848|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[9]+568446438|0)<<5|n>>>27)+r|0)&o|r&~o)+t[14]-1019803690|0)<<9|i>>>23)+n|0)&r|n&~r)+t[3]-187363961|0)<<14|o>>>18)+i|0)&n|i&~n)+t[8]+1163531501|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r&i|o&~i)+t[13]-1444681467|0)<<5|n>>>27)+r|0)&o|r&~o)+t[2]-51403784|0)<<9|i>>>23)+n|0)&r|n&~r)+t[7]+1735328473|0)<<14|o>>>18)+i|0)&n|i&~n)+t[12]-1926607734|0)<<20|r>>>12)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[5]-378558|0)<<4|n>>>28)+r|0)^r^o)+t[8]-2022574463|0)<<11|i>>>21)+n|0)^n^r)+t[11]+1839030562|0)<<16|o>>>16)+i|0)^i^n)+t[14]-35309556|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[1]-1530992060|0)<<4|n>>>28)+r|0)^r^o)+t[4]+1272893353|0)<<11|i>>>21)+n|0)^n^r)+t[7]-155497632|0)<<16|o>>>16)+i|0)^i^n)+t[10]-1094730640|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[13]+681279174|0)<<4|n>>>28)+r|0)^r^o)+t[0]-358537222|0)<<11|i>>>21)+n|0)^n^r)+t[3]-722521979|0)<<16|o>>>16)+i|0)^i^n)+t[6]+76029189|0)<<23|r>>>9)+o|0,r=((r+=((o=((o+=((i=((i+=((n=((n+=(r^o^i)+t[9]-640364487|0)<<4|n>>>28)+r|0)^r^o)+t[12]-421815835|0)<<11|i>>>21)+n|0)^n^r)+t[15]+530742520|0)<<16|o>>>16)+i|0)^i^n)+t[2]-995338651|0)<<23|r>>>9)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[0]-198630844|0)<<6|n>>>26)+r|0)|~o))+t[7]+1126891415|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[14]-1416354905|0)<<15|o>>>17)+i|0)|~n))+t[5]-57434055|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[12]+1700485571|0)<<6|n>>>26)+r|0)|~o))+t[3]-1894986606|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[10]-1051523|0)<<15|o>>>17)+i|0)|~n))+t[1]-2054922799|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[8]+1873313359|0)<<6|n>>>26)+r|0)|~o))+t[15]-30611744|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[6]-1560198380|0)<<15|o>>>17)+i|0)|~n))+t[13]+1309151649|0)<<21|r>>>11)+o|0,r=((r+=((i=((i+=(r^((n=((n+=(o^(r|~i))+t[4]-145523070|0)<<6|n>>>26)+r|0)|~o))+t[11]-1120210379|0)<<10|i>>>22)+n|0)^((o=((o+=(n^(i|~r))+t[2]+718787259|0)<<15|o>>>17)+i|0)|~n))+t[9]-343485551|0)<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(r.stateIdentity),this}appendStr(e){var t,n=this._buffer8,o=this._buffer32;let i,a=this._bufferLength;for(i=0;i<e.length;i+=1){if((t=e.charCodeAt(i))<128)n[a++]=t;else{if(t<2048)n[a++]=192+(t>>>6);else{if(t<55296||56319<t)n[a++]=224+(t>>>12);else{if(1114111<(t=1024*(t-55296)+(e.charCodeAt(++i)-56320)+65536))throw new Error("Unicode standard supports code points up to U+10FFFF");n[a++]=240+(t>>>18),n[a++]=t>>>12&63|128}n[a++]=t>>>6&63|128}n[a++]=63&t|128}64<=a&&(this._dataLength+=64,r._md5cycle(this._state,o),a-=64,o[0]=o[16])}return this._bufferLength=a,this}appendAsciiStr(e){var t=this._buffer8,n=this._buffer32;let o,i=this._bufferLength,a=0;for(;;){for(o=Math.min(e.length-a,64-i);o--;)t[i++]=e.charCodeAt(a++);if(i<64)break;this._dataLength+=64,r._md5cycle(this._state,n),i=0}return this._bufferLength=i,this}appendByteArray(e){var t=this._buffer8,n=this._buffer32;let o,i=this._bufferLength,a=0;for(;;){for(o=Math.min(e.length-a,64-i);o--;)t[i++]=e[a++];if(i<64)break;this._dataLength+=64,r._md5cycle(this._state,n),i=0}return this._bufferLength=i,this}getState(){var e=this._state;return{buffer:String.fromCharCode.apply(null,Array.from(this._buffer8)),buflen:this._bufferLength,length:this._dataLength,state:[e[0],e[1],e[2],e[3]]}}setState(e){var t=e.buffer,n=e.state,r=this._state;let o;for(this._dataLength=e.length,this._bufferLength=e.buflen,r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],o=0;o<t.length;o+=1)this._buffer8[o]=t.charCodeAt(o)}end(e=!1){var t=this._bufferLength,n=this._buffer8,o=this._buffer32,i=1+(t>>2),a=(this._dataLength+=t,8*this._dataLength);if(n[t]=128,n[t+1]=n[t+2]=n[t+3]=0,o.set(r.buffer32Identity.subarray(i),i),55<t&&(r._md5cycle(this._state,o),o.set(r.buffer32Identity)),a<=4294967295)o[14]=a;else{if(null===(n=a.toString(16).match(/(.*?)(.{0,8})$/)))return;i=parseInt(n[2],16),t=parseInt(n[1],16)||0,o[14]=i,o[15]=t}return r._md5cycle(this._state,o),e?this._state:r._hex(this._state)}}if(r.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),r.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),r.hexChars="0123456789abcdef",r.hexOut=[],r.onePassHasher=new r,"5d41402abc4b2a76b9719d911017c592"!==r.hashStr("hello"))throw new Error("Md5 self test failed.")},function(module,exports,__webpack_require__){var e;e=function(){return function(e){var t={};function n(r){var o;return(t[r]||(o=t[r]={i:r,l:!1,exports:{}},e[r].call(o.exports,o,o.exports,n),o.l=!0,o)).exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t,n){"use strict";var r,o;Object.defineProperty(t,"__esModule",{value:!0}),t.typeMap=t.BrokenType=t.ConnectedType=t.DisconnectedType=t.Method=t.ConnectionClosedAction=t.NetWorkState=t.externalErrorList=t.Stick=t.PcConnectState=t.ENUM_CONNECT_STATE=t.StreamType=t.Mode=t.ZegoconnRunEnv=t.BusinessService=t.AccessHub_Error_Code=t.AccessHubMessageType=t.ENUM_NETWORK_STATE=void 0,(o=t.ENUM_NETWORK_STATE||(t.ENUM_NETWORK_STATE={}))[o.offline=0]="offline",o[o.online=1]="online",(o=t.AccessHubMessageType||(t.AccessHubMessageType={}))[o.MSG_TYPE_STREAM_CLOSED=2]="MSG_TYPE_STREAM_CLOSED",o[o.MSG_TYPE_CLOSE_CONNECTION=3]="MSG_TYPE_CLOSE_CONNECTION",o[o.MSG_TYPE_HTTP_REQUEST=4]="MSG_TYPE_HTTP_REQUEST",o[o.MSG_TYPE_HTTP_RESPONSE=5]="MSG_TYPE_HTTP_RESPONSE",o[o.MSG_TYPE_HB_REQUEST=12]="MSG_TYPE_HB_REQUEST",o[o.MSG_TYPE_HB_RESPONSE=13]="MSG_TYPE_HB_RESPONSE",o[o.MSG_TYPE_GET_CONFIG_REQUEST=14]="MSG_TYPE_GET_CONFIG_REQUEST",o[o.MSG_TYPE_GET_CONFIG_RESPONSE=15]="MSG_TYPE_GET_CONFIG_RESPONSE",o[o.MSG_TYPE_HTTP_REQUEST_ACK=16]="MSG_TYPE_HTTP_REQUEST_ACK",o[o.MSG_TYPE_PC_UPWARD_MESSAGE=17]="MSG_TYPE_PC_UPWARD_MESSAGE",o[o.MSG_TYPE_PC_UPWARD_MESSAGE_ACK=18]="MSG_TYPE_PC_UPWARD_MESSAGE_ACK",o[o.MSG_TYPE_PC_ESTABLISHED=19]="MSG_TYPE_PC_ESTABLISHED",o[o.MSG_TYPE_PC_BROKEN=20]="MSG_TYPE_PC_BROKEN",o[o.MSG_TYPE_PC_DOWNWARD_MESSAGE=21]="MSG_TYPE_PC_DOWNWARD_MESSAGE",o[o.MSG_TYPE_REDIRECT=22]="MSG_TYPE_REDIRECT",o[o.MSG_TYPE_GET_APPCONFIG_REQUEST=23]="MSG_TYPE_GET_APPCONFIG_REQUEST",o[o.MSG_TYPE_GET_APPCONFIG_RESPONSE=24]="MSG_TYPE_GET_APPCONFIG_RESPONSE",o[o.MSG_TYPE_PUSH_APPCONFIG=25]="MSG_TYPE_PUSH_APPCONFIG",o[o.MSG_TYPE_ACCESSHUB_DISPATCH_REQUEST=26]="MSG_TYPE_ACCESSHUB_DISPATCH_REQUEST",o[o.MSG_TYPE_ACCESSHUB_DISPATCH_RESPONSE=27]="MSG_TYPE_ACCESSHUB_DISPATCH_RESPONSE",o[o.MSG_TYPE_PUSH_EXCEPTION=30]="MSG_TYPE_PUSH_EXCEPTION",(r=o=t.AccessHub_Error_Code||(t.AccessHub_Error_Code={}))[r.ACCESSHUB_INVALID_FRAME=2e4]="ACCESSHUB_INVALID_FRAME",r[r.ACCESSHUB_NEED_ENCRYPT=20001]="ACCESSHUB_NEED_ENCRYPT",r[r.ACCESSHUB_DECRYPT=20002]="ACCESSHUB_DECRYPT",r[r.ACCESSHUB_MSGTYPE=20003]="ACCESSHUB_MSGTYPE",r[r.ACCESSHUB_UNMARSHAL=20004]="ACCESSHUB_UNMARSHAL",r[r.ACCESSHUB_TIMEOUT=20005]="ACCESSHUB_TIMEOUT",r[r.ACCESSHUB_CONNECT=20006]="ACCESSHUB_CONNECT",r[r.ACCESSHUB_BROKEN=20007]="ACCESSHUB_BROKEN",r[r.ACCESSHUB_INTERNAL_ERROR=20008]="ACCESSHUB_INTERNAL_ERROR",r[r.ACCESSHUB_MARSHAL=20009]="ACCESSHUB_MARSHAL",r[r.ACCESSHUB_UNSUPPORTED_SERVICE=20010]="ACCESSHUB_UNSUPPORTED_SERVICE",r[r.ACCESSHUB_TOO_FREQUENTLY=20011]="ACCESSHUB_TOO_FREQUENTLY",r[r.ACCESSHUB_INVALID_APPID=20012]="ACCESSHUB_INVALID_APPID",r[r.ACCESSHUB_HB_TIMEOUT=20013]="ACCESSHUB_HB_TIMEOUT",r[r.ACCESSHUB_INVALID_SIGNATURE=20014]="ACCESSHUB_INVALID_SIGNATURE",(r=t.BusinessService||(t.BusinessService={}))[r.SERVICE_UNSET=0]="SERVICE_UNSET",r[r.SERVICE_MEDIAGW=1]="SERVICE_MEDIAGW",r[r.SERVICE_LIVEROOM=2]="SERVICE_LIVEROOM",r[r.SERVICE_MIX=3]="SERVICE_MIX",r[r.SERVICE_ZEUS=4]="SERVICE_ZEUS",r[r.SERVICE_ZPUSH=5]="SERVICE_ZPUSH",r[r.SERVICE_L3=6]="SERVICE_L3",r[r.SERVICE_TALKLINE=7]="SERVICE_TALKLINE",r[r.SERVICE_EDUSUITE=8]="SERVICE_EDUSUITE",r[r.SERVICE_ZIM=9]="SERVICE_ZIM",r[r.SERVICE_ClOUD_SETTING=10]="SERVICE_ClOUD_SETTING",r[r.SERVICE_ZEUSHB=11]="SERVICE_ZEUSHB",r[r.SERVICE_USER_LOGIC=12]="SERVICE_USER_LOGIC",r[r.SERVICE_UNIFYDISPATCH=13]="SERVICE_UNIFYDISPATCH",r[r.SERVICE_QUALITY=14]="SERVICE_QUALITY",r[r.SERVICE_SECURITY=15]="SERVICE_SECURITY",r[r.SERVICE_KTVCPR=16]="SERVICE_KTVCPR",r[r.SERVICE_SWITCH4LIVEROOM=17]="SERVICE_SWITCH4LIVEROOM",r[r.SERVICE_WEBRTC_SIGNAL=18]="SERVICE_WEBRTC_SIGNAL",r[r.SERVICE_L3_WEBRTC_SIGNAL=19]="SERVICE_L3_WEBRTC_SIGNAL",r[r.SERVICE_VIDEOCPR=20]="SERVICE_VIDEOCPR",r[r.SERVICE_CDN=21]="SERVICE_CDN",r[r.SERVICE_CLOUDRECORD=22]="SERVICE_CLOUDRECORD",r[r.SERVICE_INNER_ECHO=23]="SERVICE_INNER_ECHO",r[r.SERVICE_OUTER_ECHO=24]="SERVICE_OUTER_ECHO",r[r.SERVICE_LOCALHOST_ECHO=25]="SERVICE_LOCALHOST_ECHO",r[r.SERVICE_ECHO=26]="SERVICE_ECHO",r[r.SERVICE_DOCSERVICE=27]="SERVICE_DOCSERVICE",r[r.SERVICE_AUTHSVR=28]="SERVICE_AUTHSVR",(r=t.ZegoconnRunEnv||(t.ZegoconnRunEnv={}))[r.ZEGOCONN_RUN_ENV_UNSET=0]="ZEGOCONN_RUN_ENV_UNSET",r[r.ZEGOCONN_RUN_ENV_BROWSER=1]="ZEGOCONN_RUN_ENV_BROWSER",r[r.ZEGOCONN_RUN_ENV_APPLET=2]="ZEGOCONN_RUN_ENV_APPLET",(r=t.Mode||(t.Mode={}))[r.Mode_UNSET=0]="Mode_UNSET",r[r.MODE_ONLINE=1]="MODE_ONLINE",r[r.MODE_TEST=2]="MODE_TEST",r[r.MODE_ALPHA=3]="MODE_ALPHA",(r=t.StreamType||(t.StreamType={}))[r.HTTP=0]="HTTP",r[r.PC=1]="PC",r[r.OTHER=2]="OTHER",t.ENUM_CONNECT_STATE={disconnect:0,connecting:1,connected:2},(r=t.PcConnectState||(t.PcConnectState={}))[r.CONNECTED=0]="CONNECTED",r[r.DISCONNECT=1]="DISCONNECT",r[r.BROKEN=2]="BROKEN",t.Stick={DISPATCH:"zego-action-dispatch",RETRY:"zego-action-retry",ABORT:"zego-action-abort",NEXT_GROUP:"zego-action-next-group",PUSH_APP_CONFIG:"push-app-config:"},t.externalErrorList=[o.ACCESSHUB_INVALID_APPID,o.ACCESSHUB_INVALID_SIGNATURE],(r=t.NetWorkState||(t.NetWorkState={}))[r.offline=0]="offline",r[r.online=1]="online",(o=t.ConnectionClosedAction||(t.ConnectionClosedAction={}))[o.ACTION_RESERVED=0]="ACTION_RESERVED",o[o.ACTION_DISPATCH=1]="ACTION_DISPATCH",o[o.ACTION_RETRY=2]="ACTION_RETRY",o[o.ACTION_NEXT_NODE=3]="ACTION_NEXT_NODE",o[o.ACTION_ABORT=4]="ACTION_ABORT",o[o.ACTION_NEXT_GROUP=5]="ACTION_NEXT_GROUP",(r=t.Method||(t.Method={}))[r.METHOD_UNSET=0]="METHOD_UNSET",r[r.METHOD_GET=1]="METHOD_GET",r[r.METHOD_POST=2]="METHOD_POST",(o=t.DisconnectedType||(t.DisconnectedType={}))[o.CLOSE=0]="CLOSE",o[o.TEMP=1]="TEMP",o[o.TIMEOUT=2]="TIMEOUT",(r=t.ConnectedType||(t.ConnectedType={}))[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL",(o=t.BrokenType||(t.BrokenType={}))[o.EMPTY=0]="EMPTY",o[o.CLOSE=1]="CLOSE",t.typeMap={2:"stream_closed",3:"close_connection",4:"http_request",5:"http_response",12:"hb_request",13:"hb_response",14:"get_config_request",15:"get_config_response",16:"http_request_ack",17:"pc_upward_message",18:"pc_upward_message_ack",19:"pc_established",20:"pc_broken",21:"pc_downward_message",22:"redirect",23:"get_appconfig_request",24:"get_appconfig_response",25:"push_appconfig",26:"accesshub_dispatch_request",27:"accesshub_dispatch_response",30:"push_exception"}},function(e,t,n){"use strict";(function(e){var r=t;function o(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;++o)void 0!==e[r[o]]&&n||(e[r[o]]=t[r[o]]);return e}function i(e){function t(e,n){if(!(this instanceof t))return new t(e,n);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&o(this,n)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}r.asPromise=n(17),r.base64=n(18),r.EventEmitter=n(19),r.float=n(20),r.inquire=n(21),r.utf8=n(22),r.pool=n(23),r.LongBits=n(24),r.isNode=Boolean(void 0!==e&&e&&e.process&&e.process.versions&&e.process.versions.node),r.global=r.isNode&&e||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,r.emptyArray=Object.freeze?Object.freeze([]):[],r.emptyObject=Object.freeze?Object.freeze({}):{},r.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isObject=function(e){return e&&"object"==typeof e},r.isset=r.isSet=function(e,t){var n=e[t];return!(null==n||!e.hasOwnProperty(t))&&("object"!=typeof n||0<(Array.isArray(n)?n:Object.keys(n)).length)},r.Buffer=function(){try{var e=r.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),r._Buffer_from=null,r._Buffer_allocUnsafe=null,r.newBuffer=function(e){return"number"==typeof e?r.Buffer?r._Buffer_allocUnsafe(e):new r.Array(e):r.Buffer?r._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},r.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,r.Long=r.global.dcodeIO&&r.global.dcodeIO.Long||r.global.Long||r.inquire("long"),r.key2Re=/^true|false|0|1$/,r.key32Re=/^-?(?:0|[1-9][0-9]*)$/,r.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,r.longToHash=function(e){return e?r.LongBits.from(e).toHash():r.LongBits.zeroHash},r.longFromHash=function(e,t){return e=r.LongBits.fromHash(e),r.Long?r.Long.fromBits(e.lo,e.hi,t):e.toNumber(Boolean(t))},r.merge=o,r.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},r.newError=i,r.ProtocolError=i("ProtocolError"),r.oneOfGetter=function(e){for(var t={},n=0;n<e.length;++n)t[e[n]]=1;return function(){for(var e=Object.keys(this),n=e.length-1;-1<n;--n)if(1===t[e[n]]&&void 0!==this[e[n]]&&null!==this[e[n]])return e[n]}},r.oneOfSetter=function(e){return function(t){for(var n=0;n<e.length;++n)e[n]!==t&&delete this[e[n]]}},r.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},r._configure=function(){var e=r.Buffer;e?(r._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,n){return new e(t,n)},r._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):r._Buffer_from=r._Buffer_allocUnsafe=null}}).call(this,n(16))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.APP_CONFIG_KEY=t.NET_ACCESS_SERVERS=t.NET_ACCESS_CONFIG=void 0,n=n(0),t.NET_ACCESS_CONFIG={domains:["accesshub-wss.zego.im"],mode:"online",modeNo:n.Mode.MODE_ONLINE,sdkType:3,connectVer:2,pcEstablishTimeout:15,scheme:"wss",location:"accesshub",wssMessageType:1},t.NET_ACCESS_SERVERS="z_net_access_servers",t.APP_CONFIG_KEY="z_appconfig"},function(e,t,n){"use strict";e.exports=n(15)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorCodeList=void 0,t.errorCodeList={TIMEOUT:{code:1100002,msg:"network timeout."},SOCKET_CLOSE:{code:1100003,msg:"socket close"},NET_SOCKET_TIMEOUT:{code:1100004,msg:"net agent timeout"},NET_HB_TIMEOUT:{code:1100005,msg:"net hb timeout"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uuidNum=t.decodeString=t.encodeString=void 0,t.encodeString=function(e){return Uint8Array.from(Array.from(unescape(encodeURIComponent(e))).map((function(e){return e.charCodeAt(0)})))},t.decodeString=function(e){return decodeURIComponent(escape(String.fromCharCode.apply(String,Array.from(e))))},t.uuidNum=function(e,t){var n,r,o="0123456789".split(""),i=[];if(t=o.length,e)for(n=0;n<e;n++)i[n]=o[0|Math.random()*t];else for(i[8]=i[13]=i[18]=i[23]="-",i[14]="4",n=0;n<36;n++)i[n]||(r=0|16*Math.random(),i[n]=o[19==n?3&r|8:r]);return i.join("")}},function(e,t,n){"use strict";e.exports=p;var r,o=n(1),i=o.LongBits,a=o.base64,s=o.utf8;function c(e,t,n){this.fn=e,this.len=t,this.next=void 0,this.val=n}function u(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function p(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}function d(){return o.Buffer?function(){return(p.create=function(){return new r})()}:function(){return new p}}function h(e,t,n){t[n]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function g(e,t,n){for(;e.hi;)t[n++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;127<e.lo;)t[n++]=127&e.lo|128,e.lo=e.lo>>>7;t[n++]=e.lo}function m(e,t,n){t[n]=255&e,t[n+1]=e>>>8&255,t[n+2]=e>>>16&255,t[n+3]=e>>>24}p.create=d(),p.alloc=function(e){return new o.Array(e)},o.Array!==Array&&(p.alloc=o.pool(p.alloc,o.Array.prototype.subarray)),p.prototype._push=function(e,t,n){return this.tail=this.tail.next=new c(e,t,n),this.len+=t,this},(f.prototype=Object.create(c.prototype)).fn=function(e,t,n){for(;127<e;)t[n++]=127&e|128,e>>>=7;t[n]=e},p.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},p.prototype.int32=function(e){return e<0?this._push(g,10,i.fromNumber(e)):this.uint32(e)},p.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},p.prototype.int64=p.prototype.uint64=function(e){return e=i.from(e),this._push(g,e.length(),e)},p.prototype.sint64=function(e){return e=i.from(e).zzEncode(),this._push(g,e.length(),e)},p.prototype.bool=function(e){return this._push(h,1,e?1:0)},p.prototype.sfixed32=p.prototype.fixed32=function(e){return this._push(m,4,e>>>0)},p.prototype.sfixed64=p.prototype.fixed64=function(e){return e=i.from(e),this._push(m,4,e.lo)._push(m,4,e.hi)},p.prototype.float=function(e){return this._push(o.float.writeFloatLE,4,e)},p.prototype.double=function(e){return this._push(o.float.writeDoubleLE,8,e)};var y=o.Array.prototype.set?function(e,t,n){t.set(e,n)}:function(e,t,n){for(var r=0;r<e.length;++r)t[n+r]=e[r]};p.prototype.bytes=function(e){var t,n=e.length>>>0;return n?(o.isString(e)&&(t=p.alloc(n=a.length(e)),a.decode(e,t,0),e=t),this.uint32(n)._push(y,n,e)):this._push(h,1,0)},p.prototype.string=function(e){var t=s.length(e);return t?this.uint32(t)._push(s.write,t,e):this._push(h,1,0)},p.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new c(u,0,0),this.len=0,this},p.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(u,0,0),this.len=0),this},p.prototype.ldelim=function(){var e=this.head,t=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=t,this.len+=n),this},p.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,t,n),n+=e.len,e=e.next;return t},p._configure=function(e){r=e,p.create=d(),r._configure()}},function(e,t,n){"use strict";e.exports=c;var r,o=n(1),i=o.LongBits,a=o.utf8;function s(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function c(e){this.buf=e,this.pos=0,this.len=e.length}function u(){return o.Buffer?function(e){return(c.create=function(e){return o.Buffer.isBuffer(e)?new r(e):p(e)})(e)}:p}var l,p="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new c(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new c(e);throw Error("illegal buffer")};function d(){var e=new i(0,0),t=0;if(!(4<this.len-this.pos)){for(;t<3;++t){if(this.pos>=this.len)throw s(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,4<this.len-this.pos){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw s(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw s(this,8);return new i(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}c.create=u(),c.prototype._slice=o.Array.prototype.subarray||o.Array.prototype.slice,c.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)||(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)||(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)||!((this.pos+=5)>this.len))return l;throw this.pos=this.len,s(this,10)}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return h(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|h(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var e=o.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},c.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var e=o.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},c.prototype.bytes=function(){var e=this.uint32(),t=this.pos,n=this.pos+e;if(n>this.len)throw s(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,n):t===n?new this.buf.constructor(0):this._slice.call(this.buf,t,n)},c.prototype.string=function(){var e=this.bytes();return a.read(e,0,e.length)},c.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw s(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw s(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}retur