@revues/web-sdk-core 1.2.2-alpha.2 → 1.2.2-alpha.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/web-sdk-core.js +2 -2
- package/package.json +4 -4
package/dist/web-sdk-core.js
CHANGED
@@ -39,7 +39,7 @@
|
|
39
39
|
*
|
40
40
|
* MIT License
|
41
41
|
*/
|
42
|
-
function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var o=this;return o.ctx&&o.ctx.listener?(n="number"!=typeof n?o._pos[1]:n,t="number"!=typeof t?o._pos[2]:t,"number"!=typeof e?o._pos:(o._pos=[e,n,t],void 0!==o.ctx.listener.positionX?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]),o)):o},HowlerGlobal.prototype.orientation=function(e,n,t,o,r,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var c=a._orientation;return n="number"!=typeof n?c[1]:n,t="number"!=typeof t?c[2]:t,o="number"!=typeof o?c[3]:o,r="number"!=typeof r?c[4]:r,i="number"!=typeof i?c[5]:i,"number"!=typeof e?c:(a._orientation=[e,n,t,o,r,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,o,r,i),a)},Howl.prototype.init=(e=Howl.prototype.init,function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}),Howl.prototype.stereo=function(e,t){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"stereo",action:function(){o.stereo(e,t)}}),o;var r=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof e)return o._stereo;o._stereo=e,o._pos=[e,0,0]}for(var i=o._getSoundIds(t),a=0;a<i.length;a++){var c=o._soundById(i[a]);if(c){if("number"!=typeof e)return c._stereo;c._stereo=e,c._pos=[e,0,0],c._node&&(c._pannerAttr.panningModel="equalpower",c._panner&&c._panner.pan||n(c,r),"spatial"===r?void 0!==c._panner.positionX?(c._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),c._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),c._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):c._panner.setPosition(e,0,0):c._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),o._emit("stereo",c._id)}}return o},Howl.prototype.pos=function(e,t,o,r){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(e,t,o,r)}}),i;if(t="number"!=typeof t?0:t,o="number"!=typeof o?-.5:o,void 0===r){if("number"!=typeof e)return i._pos;i._pos=[e,t,o]}for(var a=i._getSoundIds(r),c=0;c<a.length;c++){var u=i._soundById(a[c]);if(u){if("number"!=typeof e)return u._pos;u._pos=[e,t,o],u._node&&(u._panner&&!u._panner.pan||n(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setPosition(e,t,o)),i._emit("pos",u._id)}}return i},Howl.prototype.orientation=function(e,t,o,r){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(e,t,o,r)}}),i;if(t="number"!=typeof t?i._orientation[1]:t,o="number"!=typeof o?i._orientation[2]:o,void 0===r){if("number"!=typeof e)return i._orientation;i._orientation=[e,t,o]}for(var a=i._getSoundIds(r),c=0;c<a.length;c++){var u=i._soundById(a[c]);if(u){if("number"!=typeof e)return u._orientation;u._orientation=[e,t,o],u._node&&(u._panner||(u._pos||(u._pos=i._pos||[0,0,-.5]),n(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setOrientation(e,t,o)),i._emit("orientation",u._id)}}return i},Howl.prototype.pannerAttr=function(){var e,t,o,r=this,i=arguments;if(!r._webAudio)return r;if(0===i.length)return r._pannerAttr;if(1===i.length){if("object"!=typeof i[0])return(o=r._soundById(parseInt(i[0],10)))?o._pannerAttr:r._pannerAttr;e=i[0],void 0===t&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),r._pannerAttr={coneInnerAngle:void 0!==e.pannerAttr.coneInnerAngle?e.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:void 0!==e.pannerAttr.coneOuterAngle?e.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:void 0!==e.pannerAttr.coneOuterGain?e.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:void 0!==e.pannerAttr.distanceModel?e.pannerAttr.distanceModel:r._distanceModel,maxDistance:void 0!==e.pannerAttr.maxDistance?e.pannerAttr.maxDistance:r._maxDistance,refDistance:void 0!==e.pannerAttr.refDistance?e.pannerAttr.refDistance:r._refDistance,rolloffFactor:void 0!==e.pannerAttr.rolloffFactor?e.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:void 0!==e.pannerAttr.panningModel?e.pannerAttr.panningModel:r._panningModel})}else 2===i.length&&(e=i[0],t=parseInt(i[1],10));for(var a=r._getSoundIds(t),c=0;c<a.length;c++)if(o=r._soundById(a[c])){var u=o._pannerAttr;u={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==e.distanceModel?e.distanceModel:u.distanceModel,maxDistance:void 0!==e.maxDistance?e.maxDistance:u.maxDistance,refDistance:void 0!==e.refDistance?e.refDistance:u.refDistance,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:u.rolloffFactor,panningModel:void 0!==e.panningModel?e.panningModel:u.panningModel};var s=o._panner;s||(o._pos||(o._pos=r._pos||[0,0,-.5]),n(o,"spatial"),s=o._panner),s.coneInnerAngle=u.coneInnerAngle,s.coneOuterAngle=u.coneOuterAngle,s.coneOuterGain=u.coneOuterGain,s.distanceModel=u.distanceModel,s.maxDistance=u.maxDistance,s.refDistance=u.refDistance,s.rolloffFactor=u.rolloffFactor,s.panningModel=u.panningModel}return r},Sound.prototype.init=function(e){return function(){var n=this,t=n._parent;n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,e.call(this),n._stereo?t.stereo(n._stereo):n._pos&&t.pos(n._pos[0],n._pos[1],n._pos[2],n._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var n=this,t=n._parent;return n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,n._stereo?t.stereo(n._stereo):n._pos?t.pos(n._pos[0],n._pos[1],n._pos[2],n._id):n._panner&&(n._panner.disconnect(0),n._panner=void 0,t._refreshBuffer(n)),e.call(this)}}(Sound.prototype.reset);var n=function(e,n){"spatial"===(n=n||"spatial")?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}()}));function re(e,n,t){U(q).invokeCallbackHandler(e,n,t)}function ie(e,n,t){var o,r=null===(o=Pn.currPage)||void 0===o?void 0:o.children;if(Array.isArray(r)&&r.length>0){var i=r[0];i&&i.isWebView&&i.postMessageToWebView({callbackId:e,type:"webInvokeCallbackHandler",params:n})}}var ae={},ce={};function ue(e,n){var t=ae[e],o=ce[e];return null!=t?""!=n.src&&o!=n.src?(t.unload(),delete ae[e],delete ce[e],ue(e,n)):t:(ce[e]=n.src,ae[e]=function(e,n){var t=new oe.Howl({autoplay:e.autoplay,loop:e.loop,src:e.src,rate:e.playbackRate,onend:function(){X(de,{innerAudioContextId:n,method:le.onEnded,data:{}})},onplay:function(){X(de,{innerAudioContextId:n,method:le.onPlay,data:{buffered:0,currentTime:0,duration:0}})},onpause:function(e){X(de,{innerAudioContextId:e,method:le.onPause,data:{}})},onstop:function(){X(de,{innerAudioContextId:n,method:le.onStop,data:{}})},onseek:function(){X(de,{innerAudioContextId:n,method:le.onSeeked,data:{}})},onplayerror:function(e,n){X(de,{innerAudioContextId:e,method:le.onError,data:{errMsg:"播放失败 :"+n,errCode:-1}})},onloaderror:function(e,n){X(de,{innerAudioContextId:e,method:le.onError,data:{errMsg:"播放失败 :"+n,errCode:10002}})},onrate:function(e){console.log("audio进度改变")},onload:function(){X(de,{innerAudioContextId:n,method:le.onCanplay,data:{}})}});return t}(n,e))}function se(e,n,t){var o=ae[n];if(null==o){var r=e+":fail 无法找到innerAudioContextId:"+n+"对应的audio实例";throw re(t,{errMsg:r}),new Error(r)}return o}oe.Howler.autoSuspend=!1;var le={onCanplay:"onCanplay",onEnded:"onEnded",onError:"onError",onPause:"onPause",onPlay:"onPlay",onSeeked:"onSeeked",onSeeking:"onSeeking",onStop:"onStop",onTimeUpdate:"onTimeUpdate",onWaiting:"onWaiting"},de="onInnerAudio";var fe={innerAudio:function(e,n){var t,o=e.method,r=e.data,i=e.innerAudioContextId;switch(o){case"create":break;case"play":(t=ue(i,r)).loop(r.loop),t.volume(r.volume),r.isPlayMethod&&t.play();break;case"stop":se(o,i,n).stop();break;case"seek":(t=se(o,i,n)).seek(r.position);break;case"pause":se(o,i,n).pause();break;case"destroy":se(o,i,n).unload();break;default:throw new Error("无法处理音频method:"+o)}return{errMsg:"innerAudio:ok"}}};function pe(e){return/^http(s?)\:\/\//.test(e)}function ve(e,n,t){var o=new XMLHttpRequest,r=!0;if(null!=n.sync&&(r=!n.sync),null!=n.responseType&&(o.responseType=n.responseType),o.open("GET",e,r),null!=n.header)for(var i in n.header)o.setRequestHeader(i,n.header[i]);o.onload=function(e){t(null,o.response,{e:e,xhr:o})},o.onerror=function(e){t(new Error("request settings failed!"),null,{e:e,xhr:o})},o.send(null)}var he={readFileSync:function(e){var n,t=e.filePath;if(t.startsWith(j))return{data:null,errMsg:"readFileSync:fail not support local file."};t=pe(t=(n=t).endsWith(".wasm")?n+".txt":n)?t:M+t;var o=null,r=null;return ve(t,{sync:!0},(function(e,n){o=n,r=e})),null!=o?{data:o,errMsg:"readFileSync:ok"}:null!=r?{data:null,errMsg:"readFileSync:fail "+r.message}:{data:null,errMsg:"readFileSync:fail"}},readFile:function(e,n){var t=e.filePath,o="base64"===e.encoding,r=pe(t)?t:M+t;t.startsWith(j)?re(n,{errMsg:"readFile:fail not support local file: "+t}):ve(r,{responseType:o?"arraybuffer":""},(function(e,t){re(n,null==e?{data:o?h(t):t,errMsg:"readFile:ok"}:{errMsg:"readFile:fail "+e.message})}))},access:function(){return{errMsg:"access:ok"}},rename:function(){return{errMsg:"rename:ok"}},mkdirSync:function(){return{errMsg:"mkdirSync:ok"}},writeFile:function(){return{errMsg:"writeFile:ok"}},writeFileSync:function(e){return e.filePath,e.data,{errMsg:"writeFileSync:ok"}},unlink:function(e,n){return e.filePath,{errMsg:"unlink:ok"}},downloadFile:function(e,n){var t=e.url,o=e.timeout,r=void 0===o?6e3:o;e.taskId,e.header,e.filePath,g(r,function(e){var n=e.url,t=e.callbackId;return e.filePath,e.header,s(this,void 0,void 0,(function(){return l(this,(function(e){return X(R,{cookies:[],progress:100,totalBytesExpectedToWrite:100,totalBytesWritten:100}),X(H,{cookies:[],header:{}}),re(t,{filePath:n,tempFilePath:n,profile:[],statusCode:200,errMsg:"downloadFile:ok"}),[2]}))}))}({url:t,callbackId:n}),(function(e){re(n,{errMsg:"downloadFile:fail timeout in "+e+"ms."})}))},copyFile:function(e,n){return e.srcPath,e.destPath,re(n,{errMsg:"copyFile:ok fake subpport."},"copyFile")}};function ge(e){return ne().invokeHandler({callbackId:e.callbackId||-1,apiName:e.apiName,params:e.params,from:"service"})}var me,we,ye,be=G?he:(me=he,we={readFileSync:{onMobile:_e},readFile:{onMobile:_e},access:{onMobile:_e},rename:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e.shift();return t&&t.fatNewPath&&(t.newPath=t.fatNewPath,delete t.fatNewPath),t&&e.unshift(t),e}},downloadFile:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0];if(null!=t){var o=t.header;if(o&&o.Referer)throw new Error("header不能设置Referer字段");t.source="miniGame"}return e}}},ye=we||{},Object.keys(me).reduce((function(e,n){var t=me[n];return e[n]=function(){for(var e,o,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=p(),c=ye[n],u={callNativeApi:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ge({apiName:n,params:e[0],callbackId:e[1]})},callPatchApi:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(void 0,e)}};try{return c&&"function"==typeof c.onCallBefore&&(r=(e=c.onCallBefore).call.apply(e,d([u],r))),a?c&&"function"==typeof c.onMobile?(o=c.onMobile).call.apply(o,d([u],r)):u.callNativeApi.apply(u,r):u.callPatchApi.apply(u,r)}catch(e){return{errMsg:n+":fail error occured in polyfill api, "+e.message}}},e}),{}));function _e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0],o=t.filePath||t.path,r=this;return o.startsWith(N)?r.callNativeApi.apply(r,e):r.callPatchApi.apply(r,e)}var xe=new(function(){function e(){this.reportedEventType=new Set(["ErrorType"])}return Object.defineProperty(e.prototype,"sentry",{get:function(){return window.Sentry},enumerable:!1,configurable:!0}),e.prototype.captureException=function(e,n){var t=this.sentry;if(null!=t){var o=n.event_desc;delete n.event_desc,t.captureException(function(e,n){var t=new Error,o=e.charAt(0).toUpperCase()+e.slice(1),r=function(e){try{return JSON.parse(e)}catch(n){return e}}(n);"string"==typeof r?(t.stack=r,t.message=r):(t.message=o+": "+r.msg,t.stack=r.stack);return t}(e,o))}else console.log("Sentry is not ready yet.")},e.prototype.captureLoadGameEntryError=function(e){xe.captureException("LoadGameEntryError",{event_desc:"load game entry bundle fail: \n"+e.message+"\n"+e.stack})},e}()),Ae=null;function ke(){if(null==Ae)throw new Error("WxConfig is not ready.");return Ae}function Se(e){var n=ke(),t=n.windows.pages;return null!=t&&t[e]?Object.assign({},n.window,t[e]):null}var Ie=new i;function Ce(){Ie.on("NavigatorBarTools:onMore",(function(){bn.showToast({title:"暂未实现该功能"})})),Ie.on("NavigatorBarTools:onClose",(function(){var e=ne();null!=e&&e.invokeHandler({callbackId:-1,apiName:"exitMiniProgram",params:{},from:"service"})})),Ie.on("NavigatorBar:onBack",(function(){je.navigateBack({delta:1}),console.log("onBack")})),Ie.on("TabBar:change",(function(e){var n,t,o;X("onTabItemTap",{index:e.index,pagePath:e.item.pagePath,text:e.item.text}),je.switchTab({url:e.item.pagePath},-1),n=e.item.pagePath,t={},null!=(o=Se(n))&&(t.windowConfig=o),Ie.emit("tabItemChanged",t)})),Ie.on("invokeCallbackHandler",(function(e){re(e.callbackId,e.data)})),Ie.on("dispatchServiceEvent",(function(e){X(e.event,e.payload)}))}function Te(e){void 0!==window.__initWebFrame&&window.__initWebFrame(e,Ie)}var Me={getGlobalVariables:function(e){return"_launchOption"===e.variable?{_launchOption:F}:null},onWindowResize:function(){},offWindowResize:function(){},reportApmMonitor:function(e){var n=e.eventName,t=e.payload,o=e.eventType;e.timestamp,xe.reportedEventType.has(o)?xe.captureException(n,t):"LogReport"===o&&t.event},addPerformance:function(e){},initReady:function(){},updateAppData:function(){},injectHtmlCallback:function(e,n,t){"service"===t&&J().events.emit($.onInjectHTMLCallback)},pageScrollTo:function(e,n){var t=e.scrollTop;e.duration;var o=Pn.currPage.getWindow();return null==o||o.scrollTo({top:t,behavior:"smooth"}),{errMsg:"pageScrollTo:ok"}},getMenuButtonBoundingClientRect:function(e,n){Ie.emit("getMenuButtonBoundingClientRect",e,n)},getAccountInfoSync:function(){var e=window.__extInfo;return{data:{miniProgram:u(u({},e),{appId:null==e?void 0:e.extUuid,envVersion:null==e?void 0:e.envVersion,version:"",forceUsePatchApi:G}),plugin:{appId:"",version:""}}}},jssdkConfig:function(e,n){var t=e.jsApiList,o=[];if((void 0===t?[]:t).forEach((function(e){null==bn[e]&&o.push(e)})),!(o.length>0))return ie(n,{errMsg:"jssdkConfig:ok"});ie(n,{errMsg:"jssdkConfig:fail "+o.join(",")+" 未实现."})}},Pe={hideToast:function(e){return Ie.emit("hideToast",e),{errMsg:"hideToast:ok"}},showToast:function(e){return Ie.emit("showToast",e),{errMsg:"showToast:ok"}},showLoading:function(e){return Ie.emit("showLoading",e),{errMsg:"showLoading:ok"}},hideLoading:function(e){return Ie.emit("hideLoading",e),{errMsg:"hideLoading:ok"}},showModal:function(e,n){Ie.emit("showModal",e,n)},showActionSheet:function(e,n){Ie.emit("showActionSheet",e,n)}},Ee={showGameKeyboard:function(e){return p()?ge({apiName:"showGameKeyboard",params:e}):Ie.emit("showKeyboard",e),{}},hideGameKeyboard:function(e){return p()||Ie.emit("hideKeyboard",e),{}},updateGameKeyboard:function(e){return p()||Ie.emit("updateKeyboard",e),{}},showKeyboard:function(e){return p()?ge({apiName:"showGameKeyboard",params:e}):Ie.emit("showKeyboard",e),{}},hideKeyboard:function(e){return Ie.emit("hideKeyboard",e),{}},updateKeyboard:function(e){return Ie.emit("updateKeyboard",e),{}}};function Be(e,n){if(e===D)return'<script charset="utf-8" src="'+n.moduleName+'game.js"><\/script>';if("miniProgram"===e)return n.content;throw Error("unsupported projectType: "+e)}var Oe=function(e){function n(n){return e.call(this,u(u({},n),{projectType:D}))||this}return c(n,e),n.prototype.injectScript=function(){var e=U(q).getWindow();e.injectHtml(e.document.body,{content:Be(this.projectType,{moduleName:this.moduleName})})},n.prototype.getEntry=function(){return e=this.projectType,n={moduleName:this.moduleName},e===D?n.moduleName+"game.js":"";var e,n},n}(function(){function e(e){this.taskId=e.taskId,this.moduleName=e.moduleName,this.projectType=e.projectType,this.status="none"}return e.prototype.notifyProgressUpdate=function(e,n){X("onLoadSubPackageTaskStateChange",u({moduleName:this.moduleName,state:e,taskId:this.taskId},n))},e.prototype.injectScript=function(){},e.prototype.getEntry=function(){},e.prototype.load=function(e,n){return s(this,void 0,void 0,(function(){return l(this,(function(e){return this.notifyProgressUpdate("progressUpdate",{progress:0}),this.notifyProgressUpdate("progressUpdate",{progress:50}),this.injectScript(),this.notifyProgressUpdate("progressUpdate",{progress:100}),[2]}))}))},e}()),Le=0,Fe={},Re={createLoadSubPackageTask:function(e,n){var t=e.moduleName,o=Fe[t];if(o&&"success"===o.status)return{errMsg:"createLoadSubPackageTask:fail sub package already loaded."};++Le;var r=String(Le);return o=new Oe({taskId:r,moduleName:t}),J().events.once($.onInjectHTMLCallback,(function(){o.status="success",o.notifyProgressUpdate("success",{entryPath:o.getEntry()})})),Fe[t]=o,o.load(r,n),{errMsg:"createLoadSubPackageTask:ok",loadTaskId:Le}}},He={showNavigationBarLoading:function(){return Ie.emit("showNavigationBarLoading"),{errMsg:"showNavigationBarLoading:ok"}},setNavigationBarTitle:function(e){return Ie.emit("setNavigationBarTitle",e),{errMsg:"setNavigationBarTitle:ok"}},setNavigationBarColor:function(e){return Ie.emit("setNavigationBarColor",e),{errMsg:"setNavigationBarColor:ok"}},hideNavigationBarLoading:function(){return Ie.emit("hideNavigationBarLoading"),{errMsg:"hideNavigationBarLoading:ok"}},hideHomeButton:function(){}};function De(e,n){var t,o=function(e){e=e.replace(/\.html$/,"");var n=ke(),t=n.subpackages;if(Array.isArray(t)&&t.length>0)return t.find((function(n){return n.pageFullPath.includes(e)}));return null}(e);null==o||(t=o.root,V[t])?n():function(e,n){var t=U(q);t.events.once($.onInjectHTMLCallback,n),t.loadSubBundle(e.root,e.packageName+".js")}(o,n)}var je={navigateTo:function(e,n){var t=e.url;if(Pn.stack.length>10)return{errMsg:"navigateTo:fail 已到达页面栈上限:10。"};var o=v(t),r=o.path,i=o.query;return De(r,(function(){var e=Pn.go(r);J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:r,openType:"navigateTo",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId)}))})),{errMsg:"navigateTo:ok"}},navigateBack:function(e){var n=e.delta;try{Pn.back(n)}catch(e){return{errMsg:"navigateBack:fail "+e.message}}var t=Pn.currPage;return X("onAppRoute",{path:t.pagePath,openType:"navigateBack",options:{delta:n},pipMode:"",query:void 0,webviewId:t.webviewId},t.webviewId),{errMsg:"navigateBack:ok"}},reLaunch:function(e,n){var t=e.url,o=v(t),r=o.path,i=o.query;De(r,(function(){Pn.reLaunch(t);var e=Pn.currPage;J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:r,openType:"reLaunch",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"reLaunch:ok"})}))}))},redirectTo:function(e,n){var t=v(e.url),o=t.path,r=t.query;De(o,(function(){try{Pn.redirectTo(o)}catch(e){return void re(n,{errMsg:"redirectTo:fail "+e.message})}var e=Pn.currPage;J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:o,openType:"redirectTo",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"redirectTo:ok"})}))}))},switchTab:function(e,n){var t=v(e.url),o=t.path,r=t.query;De(o,(function(){try{Pn.switch(o)}catch(e){return void re(n,{errMsg:"switchTab:fail "+e.message})}var e=Pn.currPage;e.isReady?(X("onAppRoute",{path:o,openType:"switchTab",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"switchTab:ok"})):J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:o,openType:"switchTab",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"switchTab:ok"})}))}))}};function Ne(e){setTimeout(e,16)}function Ge(e){var n=b();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return n+"-"+e}function We(e){var n=b();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return e.replace(new RegExp("^"+n+"-"),"")}function $e(e){return Number((e/1024).toFixed(2))}var Ve={getStorageSync:function(e){return{data:localStorage.getItem(Ge(e.key))||null}},getStorage:function(e,n){Ne((function(){re(n,{data:Ve.getStorageSync(e)})}))},setStorageSync:function(e){return localStorage.setItem(Ge(e.key),e.data),{errMsg:"setStorageSync:ok"}},setStorage:function(e,n){Ne((function(){localStorage.setItem(e.key,e.data),re(n,{errMsg:"setStorage:ok"})}))},removeStorageSync:function(e){return localStorage.removeItem(Ge(e.key)),{errMsg:"removeStorageSync:ok"}},removeStorage:function(e,n){Ne((function(){localStorage.removeItem(Ge(e.key)),re(n,{errMsg:"removeStorage:ok"})}))},clearStorageSync:function(){return localStorage.clear(),{errMsg:"clearStorageSync:ok"}},clearStorage:function(e,n){Ne((function(){localStorage.clear(),re(n,{errMsg:"clearStorage:ok"})}))},getStorageInfoSync:function(){var e=function(){var e=0,n=[];for(var t in localStorage)Object.prototype.hasOwnProperty.call(localStorage,t)&&(e+=localStorage[t].length,n.push(We(t)));return{size:e,keys:n}}(),n=e.size;return{keys:e.keys,currentSize:$e(n),limitSize:$e(10485760)}},getStorageInfo:function(e,n){Ne((function(){re(n,u(u({},Ve.getStorageInfoSync()),{errMsg:"getStorageInfo:ok"}))}))}};function ze(){var e=f();return("Android"===e||"IOS"===e)&&window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape"}function qe(){var e,n,t,o=null===(e=Pn.currPage)||void 0===e?void 0:e.getWindow();if(null!=o){var r=o.document;return(null===(n=r.documentElement)||void 0===n?void 0:n.scrollTop)||(null===(t=r.body)||void 0===t?void 0:t.scrollTop)||0}return 0}function Ke(){return u(u({patch:!0},(e=window.innerWidth||375,n=window.innerHeight||375,t=f().toLocaleLowerCase().includes("window")?0:50,o=window.devicePixelRatio||2,{screenWidth:e,screenHeight:n,statusBarHeight:t,devicePixelRatio:o,pixelRatio:o,windowHeight:n,windowWidth:e,safeArea:{height:n-t,widows:e,top:t,left:0,right:0}})),{scrollY:qe()});var e,n,t,o}var Ue={onMemoryWarning:function(){console.warn("The onMemoryWarning api is not implement.")},showShareMenu:function(){console.warn("The showShareMenu api is not implement.")},getSystemInfoSync:function(){var e,n=Qe(),t=ze(),o=f(),r=(e=y().extType||"").startsWith("app_")?f().toLowerCase():e.startsWith("pc_")?"pc":"web";return k.info("getSystemInfoSync",{windowInfo:n,deviceOrientation:t,system:o,platform:r}),u({deviceOrientation:t,SDKVersion:"1.0.0",appVersion:"12.1.0",batteryLevel:98,benchmarkLevel:1,bluetoothEnabled:!1,brand:"huya",cameraAuthorized:!1,deviceId:"none",enableDebug:!1,fontSizeSetting:15,frameworkVersion:"1.0.0",inHUYA:!0,language:"zh_CN",locationAuthorized:!1,locationEnabled:!1,microphoneAuthorized:!0,mode:"default",model:"none",notificationAuthorized:!0,platform:r,system:o,theme:void 0,version:"8.0.28 "},n)},getWindowInfo:function(){return Qe()},getSetting:function(){return{authSetting:{"scope.userInfo":!0},subscriptionsSetting:{},miniprogramAuthSetting:{"scope.userInfo":!0}}},getNetworkType:function(){return{networkType:"wifi",signalStrength:100,hasSystemProxy:!1}}};function Qe(){return p()&&"web_hd_inner"!==(y().extType||"")?function(e){_()?(e.screenWidth=e.windowWidth||window.innerWidth||e.screenWidth,e.screenHeight=e.windowHeight||window.innerHeight||e.screenHeight):(e.screenWidth=e.windowWidth||window.innerWidth,e.screenHeight=e.windowHeight||window.innerHeight);return e}(ge({apiName:"getWindowInfo",params:{}})):Ke()}var Je={showTabBar:function(e){return Ie.emit("showTabBar",e),{errMsg:"showTabBar:ok"}},hideTabBar:function(e){return Ie.emit("hideTabBar",e),{errMsg:"hideTabBar:ok"}},setTabBarStyle:function(e){return Ie.emit("setTabBarStyle",e),{errMsg:"setTabBarStyle:ok"}},setTabBarItem:function(e){return Ie.emit("setTabBarItem",e),{errMsg:"setTabBarItem:ok"}},setTabBarBadge:function(e){return Ie.emit("setTabBarBadge",e),{errMsg:"setTabBarBadge:ok"}},removeTabBarBadge:function(e){return Ie.emit("removeTabBarBadge",e),{errMsg:"removeTabBarBadge:ok"}},hideTabBarRedDot:function(e){return Ie.emit("hideTabBarRedDot",e),{errMsg:"hideTabBarRedDot:ok"}},showTabBarRedDot:function(e){return Ie.emit("showTabBarRedDot",e),{errMsg:"showTabBarRedDot:ok"}}},Ze="insertHTMLWebView",Xe="onWebviewLoad",Ye={insertHTMLWebView:function(e,n,t,o){Pn.initNextWebView(Pn.currPage,e.src,e.src).el.addEventListener("load",(function(){X(Xe,{webviewId:o},o),Y(te+"pageonshow",{})})),X(Ze,e,o)},invokeMiniProgramAPI:function(e,n){console.log(e,n);var t=e.name,o=e.arg,r=bn[t];null!=r&&r(o,n)},postMessage:function(e,n){X("onBindMessage",e,Pn.currPage.webviewId),ie(n,{errMsg:"postMessage:ok"})},canGoBack:function(e,n){ie(n,{errMsg:"canGoBack:fail default to fail"})},canNavigateBack:function(e,n){var t=!1;Pn.allPages.length>1&&(t=!0),ie(n,{errMsg:"canNavigateBack:"+(t?"ok":"fail")})}},en={},nn="onAd";function tn(e){var n=e.type,t=e.adUnitId,o=en[t];if(null!=o)return o;if("rewardedVideo"===n)o=function(e){var n=e.adUnitId,t=ge({apiName:"createRewardedVideoAd",params:{adUnitId:n}});return t.onLoad((function(e){X(nn,{method:"onLoad",adUnitId:n,data:e})})),t.onClose((function(e){X(nn,{method:"onClose",adUnitId:n,data:e})})),t.onError((function(e){X(nn,{method:"onError",adUnitId:n,data:e})})),t}(e);return null!=o&&(en[t]=o),o}var on={ad:function(e,n){return s(void 0,void 0,void 0,(function(){var t,o,r,i;return l(this,(function(a){switch(a.label){case 0:if(t=e.method,e.adUnitId,o=e.type,null==(r=tn(e)))return re(n,{errMsg:"ad:fail 获取"+o+"广告实例失败"}),[2];a.label=1;case 1:switch(a.trys.push([1,12,,13]),t){case"load":return[3,2];case"destroy":return[3,4];case"show":return[3,6];case"hide":return[3,8]}return[3,10];case 2:return[4,r.load()];case 3:return a.sent(),[3,11];case 4:return[4,r.destroy()];case 5:return a.sent(),[3,11];case 6:return[4,r.show()];case 7:return a.sent(),[3,11];case 8:return[4,r.hide()];case 9:return a.sent(),[3,11];case 10:throw new Error("unsupported method: "+t);case 11:return re(n,{errMsg:"ad:ok"}),[3,13];case 12:return i=a.sent(),re(n,{errMsg:"ad:fail adInstance."+t+" call fail, "+(i.mssage||"unknown")}),[3,13];case 13:return[2]}}))}))}},rn={appDataChange:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):(!function(e){var n=u({},e.data),t=Se(n.options.path);t&&(n.windowConfig=t),n.pages=Pn.allPages,Ie.emit("appDataChange",n)}(n),Z(r,n,o))},__updateAppData:function(e){var n,t,o;n={},t=Pn.currPage.pagePath.replace(/\.html$/,""),null!=(o=Se(t))&&(n.windowConfig=o),n.pages=Pn.allPages,n.currPage=t,Ie.emit("updateAppData",n)}};var an={canvasInsert:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},canvasRemove:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},CANVAS_EVENT_V2:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},onCanvasPreloadImage:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},onCanvasGetImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},onCanvasPutImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},canvasActionsChanged:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},invokeCanvasToDataUrl:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},invokeCanvasPutImageData:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},invokeCanvasGetImageData:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},getImageBase64:function(e){var n=e.params;e.from,e.webviewIds;var t,o=e.event,r=e.webviewId,i=n.src;ve(/^https?:\/\//.test(t=i)||/^hyfile:\/\//.test(t)?t:M+t,{responseType:"arraybuffer"},(function(e,n){if(null!=e)return"";var t=h(n),a=function(e){var n,t=e.split("/"),o=null===(n=t[t.length-1])||void 0===n?void 0:n.split("."),r=o[0],i=o[1];if(null==i||""==i)throw new Error("url:"+e+"格式错误,无法获取文件信息");return{filename:r,ext:i}}(i);Z(o,{src:i,data:"data:image/"+a.ext+";base64,"+t},[r])}))}};function cn(e,n){e.message=n+" stack: "+(null==e?void 0:e.message),Ie.emit("closeLaunchMask"),bn.showToast({title:"加载游戏脚本超时"}),k.error("load game.js error",e.message),xe.captureLoadGameEntryError(e)}var un={gameServiceReady:function(){!function(e){s(this,void 0,void 0,(function(){var n,t,o,r;return l(this,(function(i){switch(i.label){case 0:if(n=window.__deviceOrientation,t=ze(),o="string"==typeof n&&n.includes("landscape"),!("landscape"!==t&&o&&p()&&_()))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,g(5e3,new Promise((function(e){var n=ne();ge({apiName:"setDeviceOrientation",params:{value:"landscape"}}),n.$events.once("onDeviceOrientationChange",(function(n){"landscape"===n.value&&e(!0)}))})))];case 2:return i.sent(),e(),[3,4];case 3:return r=i.sent(),e(r),[3,4];case 4:return[3,6];case 5:e(),i.label=6;case 6:return[2]}}))}))}((function(e){null==e?Ne((function(){k.log("load game.js"),function(){s(this,void 0,void 0,(function(){function e(){return s(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,J().loadSubBundle("","game.js")];case 1:return e.sent(),Ie.emit("closeLaunchMask"),[2]}}))}))}return l(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,g(18e3,e())];case 1:return n.sent(),[3,3];case 2:return cn(n.sent(),"entry"),[3,3];case 3:return[2]}}))}))}()})):cn(e,"deviceOrientation")}))},gameConfigUpdate:function(e){var n=e.params;Te({windowInfo:bn.getWindowInfo(),wxConfig:n})}},sn=new(function(){function e(){this.reportedFirstScreenTime=!1}return e.prototype.reportFirstScreenTime=function(e){if(!this.reportedFirstScreenTime){var n=window.performanceInfo;null!=n&&(n.firstScreenTime=e),this.reportedFirstScreenTime=!0}},e}()),ln=new(function(){function e(){var e=this;this.__startTime=Date.now(),this.isServiceReady=!1,this.isViewReady=!1,this.showedFirstPage=!1,"miniProgram"===y().projectType&&window.addEventListener("load",(function(){e.initIframes()}))}return Object.defineProperty(e.prototype,"allReady",{get:function(){return this.isViewReady&&this.isServiceReady},enumerable:!1,configurable:!0}),e.prototype.initIframes=function(){var e=J(),n=Q();e.updateSrc("./service.html"),n.updateSrc("first")},e.prototype.handleServiceStart=function(e){var n=e.params;Ae=n,Te({wxConfig:n,windowInfo:bn.getWindowInfo()}),Ie.emit("serviceStart",n)},e.prototype.handleServiceReady=function(e){var n=this,t=J();if(!t.isReady){this.root=e.params.root,this.firstWebviewId=e.webviewIds[0],this.isServiceReady=!0;var o=this.firstWebviewId;t.events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:n.root,openType:"appLaunch",options:void 0,pipMode:"",query:void 0,webviewId:n.firstWebviewId},n.firstWebviewId)})),X("onServiceReadyDone",u(u({},F),{webviewId:o}),o),t.isReady=!0,this.launchPageShow()}},e.prototype.showPage=function(){var e=Pn.currPage;null!=e&&(e.isReady=!0,e.injectScript(),e.show(),this.showedFirstPage||(this.showedFirstPage=!0))},e.prototype.handleViewReady=function(){this.isViewReady=!0,this.showedFirstPage?this.showPage():this.launchPageShow()},e.prototype.handleViewDOMContentLoaded=function(e){var n=e.from,t=J();n===O&&(X("DOMContentLoaded",{},Pn.currPage.webviewId),t.events.emit($.onViewDOMContentLoaded)),Ie.emit("closeLaunchMask")},e.prototype.launchPageShow=function(){if(this.allReady){!function(e,n){var t=function(e){var n=e.tabBar;return null==n||0===(n.list||[]).length?[e.root]:n.list.map((function(e){return e.pagePath}))}(e);Pn.initFirstPage(t,e.root,n)}(ke(),Q()),Pn.initSlotWebviewId(this.firstWebviewId),this.showPage();var e=Date.now(),n=e-this.__startTime;sn.reportFirstScreenTime(e),k.info("init page consume time: "+n+"ms")}},e}()),dn={serviceStart:function(e){ln.handleServiceStart(e)},onLaunchCalled:function(e){},serviceReady:function(e){ln.handleServiceReady(e)},DOMContentLoaded:function(e){ln.handleViewDOMContentLoaded(e)},viewReady:function(){ln.handleViewReady()},DOMReady:function(){}},fn={info:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},log:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},warn:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},error:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},initLogs:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},clearLogs:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},onViewLogEvent:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)}},pn={INVOKE_METHOD:function(e){var n=e.params,t=e.from,o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},pageonshow:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):Z(r,n,o)},pageonhide:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):(Z(r,n,o),Y(r,n))},requestLoadFontFace:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):Z(r,n,o)},requestLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},responseLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):Z(r,n,o)}};function vn(e){return"string"==typeof e?JSON.parse(e):e}function hn(e){return JSON.parse(JSON.stringify(e))}var gn={SPECIAL_PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},setKeyboardValue:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},vdSync:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event,i=e.webviewId;t===O?X(r,hn(n),i):Z(r,hn(n),o)},vdSyncBatch:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event,i=e.webviewId;t===O?X(r,hn(n),i):Z(r,hn(n),o)}},mn={videoPlayerInsertFinish:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},videoActionChanged:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)}},wn={openTypeEvent:function(e){var n=e.event,t=e.params,o=e.from,r=e.webviewId;"view"===o&&X(n,t,r)},openTypeEventCallback:function(e){var n=e.event,t=e.params,o=e.from,r=e.webviewIds;"service"===o&&Z(n,t,r)}},yn=u(u(u(u(u(u(u(u(u({},un),dn),an),rn),fn),pn),gn),mn),wn),bn=u(u(u(u(u(u(u(u(u(u(u(u(u({},Me),be),Re),je),Pe),Ve),Ue),He),Je),Ye),fe),Ee),on);function _n(e){var n,t=e.replace(te,""),o=yn[t];if(null==o){var r=/^video_(.*)_actionChanged$/.test(n=t)?"videoActionChanged":/^canvas(.*)actionsChanged$/.test(n)?"canvasActionsChanged":/^invokeCanvasToDataUrl_(.*)$/.test(n)?"invokeCanvasToDataUrl":/^onCanvasToDataUrl_(.*)$/.test(n)?"onCanvasToDataUrl":/^invokeCanvasPutImageData_(.*)$/.test(n)?"invokeCanvasPutImageData":/^onCanvasPutImageData_(.*)$/.test(n)?"onCanvasPutImageData":/^invokeCanvasGetImageData_(.*)$/.test(n)?"invokeCanvasGetImageData":/^onCanvasGetImageData_(.*)$/.test(n)?"onCanvasGetImageData":n;return{handler:yn[r]||null,formatedEvent:r}}return{handler:o,formatedEvent:t}}var xn={invokeHandler:function(e){k.debug("invokeHander",e);var n=e.C,t=e.from,o=e.paramsString,r=e.webviewId,i=e.callbackId,a=vn(o),c=bn[n];if(null!=c){var u=c(a,i,t,r);return u&&u instanceof Promise?void 0:u}var s=ne();if(null!=s)return s.invokeHandler({apiName:n,params:a,callbackId:i,from:t})},publishHandler:function(e){k.debug("publishHandler",e);var n=e.event,t=e.from,o=e.paramsString,r=e.webviewId,i=e.webviewIds,a=_n(n),c=a.handler,u=a.formatedEvent,s=vn(o);if(null!=c)c({event:n,params:s,from:t,webviewId:r,webviewIds:B===t&&i?vn(i):void 0});else{var l=ne();null!=l&&l.publishHandler({formatedEvent:u,event:n,params:s,from:t})}},webInvokeHandler:function(e){E&&console.log("webInvokeHander",e),ie(e.callbackId,vn(e.paramsString))},webPublishHandler:function(e){E&&console.log("webPublishHandler",e),Y(e.event,vn(e.paramsString))}};var An=[],kn=function(e){An.push(e.el.src)},Sn=function(e){An.pop()},In=function(){function e(){this.block=!1,this.queue=[]}return e.prototype.collect=function(e){var n=this;this.block?this.queue.push(e):(this.block=!0,this.queue.push(e),this.timer=setTimeout((function(){n.block=!1,clearTimeout(n.timer),n.comsume()})))},e.prototype.comsume=function(){var e=this.queue;if(this.queue=[],1===e.length)e[0]();else for(var n=0;n<e.length;n++)e[n]()},e}();var Cn=function(e){function n(n){var t=e.call(this,n)||this;return t.webviewId=null,t.pagePath="",t.wrapper=null,t.isDestoryed=!1,t.active=!1,t.__isWebView=!1,t.tickQueue=new In,t}return c(n,e),Object.defineProperty(n.prototype,"isWebView",{get:function(){return this.__isWebView},set:function(e){this.__isWebView=e,e?kn(this):Sn(this)},enumerable:!1,configurable:!0}),n.prototype.appendContainer=function(){var e=this.el;e.className="webview",e.setAttribute("frameborder","0"),this.hide();var n=document.getElementById("webview-container");this.wrapper=n,null!=n&&n.appendChild(e)},n.prototype.show=function(){var e=this.el;e.style.zIndex="2",e.style.opacity="1",this.active=!0,Tn(this,"show")},n.prototype.hide=function(){var e=this.el;e.style.zIndex="1",e.style.opacity="0",this.active=!1,Tn(this,"hide")},n.prototype.updateWebviewId=function(e){this.webviewId=e,this.updateId()},n.prototype.updateId=function(){this.el.id="webview-"+this.webviewId},n.prototype.updateSrc=function(e,n){void 0===n&&(n=P),this.el.src=n,this.pagePath=e},n.prototype.updatePagePath=function(e){this.pagePath=e},n.prototype.injectScript=function(){var e=this.getWindow();if(null!=e&&""!=this.pagePath){var n=this.pagePath.replace(/\.html$/g,""),t=function(e){var n=e.pagePath;return"\n <script>\n var __path__ = '"+e.path+"';\n document.title = __path__;\n document.dispatchEvent(new CustomEvent(\"generateFuncReady\", {\n detail: {\n generateFunc: $gfc('"+n+".wxml') || $gfc('"+n+".hyml')\n }\n }))\n <\/script> \n "}({pagePath:"./"+n,path:n});e.injectHtml(e.document.body,{content:t})}},n.prototype.getBridge=function(){return this.getWindow().FinChatJSBridge},n.prototype.sendToView=function(e,n){var t=this;this.sync?(k.debug("%c "+e,{data:n,webviewId:this.webviewId}),this.getBridge().subscribeHandler(e,n,this.webviewId)):this.tickQueue.collect((function(){k.debug("%c "+e,{data:n,webviewId:t.webviewId}),t.getBridge().subscribeHandler(e,n,t.webviewId)}))},n.prototype.postMessageToWebView=function(e){var n;k.debug("%c postMessageToWebView",e),null===(n=this.el.contentWindow)||void 0===n||n.postMessage(e,"*")},n.prototype.destory=function(){null!==this.wrapper&&this.wrapper.removeChild(this.el),this.el=null,this.wrapper=null,this.isDestoryed=!0,this.active=!1,this.isWebView=!1,Tn(this,"destory")},n}(W);function Tn(e,n){e.isVHost&&e.children&&e.children.length>0&&e.children.forEach((function(e){e[n]()}))}function Mn(e,n){return e._slots.findIndex((function(e){return e===n.replace(/\.html$/,"")}))}var Pn=new(function(){function e(){this._slotStack=[],this._extraStack=[],this._slots=[],this._webviewId=0,this.rootIndex=0}return Object.defineProperty(e.prototype,"pagePath",{get:function(){var e;return(null===(e=this.currPage)||void 0===e?void 0:e.pagePath)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.stack[this.stack.length-2]||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.stack[this.stack.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stack",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:d([e],this._extraStack)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allPages",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:d([e],this._extraStack.slice(0,this._extraStack.length-1))},enumerable:!1,configurable:!0}),e.prototype.popExtraStack=function(){var e=this._extraStack,n=e.pop(),t=e.pop();return n&&e.push(n),t},e.prototype.resetExtraStack=function(){if(0!==this._extraStack.length){var e=this.top;this._extraStack.slice(0,this._extraStack.length-1).forEach((function(e){e.destory()})),this._extraStack=[e]}},e.prototype.initFirstPage=function(e,n,t){if(!Array.isArray(e)||0===e.length)throw new Error("slots must exist.");var o=Mn(this,n);o>-1&&(this.rootIndex=o),this._slots=e;for(var r=0;r<e.length;r++){var i=void 0;if(t&&r===this.rootIndex)i=t;else{var a=document.createElement("iframe");(i=new Cn(a)).appendContainer()}i&&this._slotStack.push(i)}var c=this._slotStack[this.rootIndex];t?c.updatePagePath(n):c.updateSrc(n),this.initEmptyPage()},e.prototype.initEmptyPage=function(){var e=document.createElement("iframe"),n=new Cn(e);n.appendContainer(),this._extraStack.push(n)},e.prototype.initNextPage=function(e,n){var t=this.currPage,o=this.top;return t.hide(),o.updateSrc(e,n),o.updateWebviewId(this._webviewId++),this.initEmptyPage(),o},e.prototype.initNextWebView=function(e,n,t){var o=this.initNextPage(n,t),r=this._extraStack.findIndex((function(e){return e.pagePath===n}));return r>-1&&this._extraStack.splice(r,1),e.children=[o],e.isVHost=!0,o.el.setAttribute("sandbox","allow-same-origin allow-scripts"),o.isWebView=!0,o.show(),o},e.prototype.initSlotWebviewId=function(e){this._webviewId=e,this._slotStack[this.rootIndex].updateWebviewId(this._webviewId++)},e.prototype.reinitPages=function(e){var n=this._slotStack,t=this._extraStack;n.forEach((function(e){e.destory()})),t.forEach((function(e){e.destory()})),this._slotStack=[],this._extraStack=[],this.initFirstPage(this._slots,e),this.currPage.updateWebviewId(this._webviewId++)},e.prototype.reLaunch=function(e){this.reinitPages(e)},e.prototype.redirectTo=function(e){if(Mn(this,e)>-1)throw new Error("不允许跳转到 tabbar 页面:"+e);var n=this._extraStack;if(n.length>1){var t=n.pop();n.pop().destory(),t.updateSrc(e),t.updateWebviewId(this._webviewId++),n.push(t),this.initEmptyPage()}else{null==(t=n.pop())||t.destory(),this._slotStack.forEach((function(e){e.destory()})),this.reinitPages(e)}},e.prototype.switch=function(e,n){n=null!=n?n:Mn(this,e);var t=this._slotStack,o=t[n];if(null==o)throw new Error("switchTab url is invalid: "+e);return this.resetExtraStack(),t.forEach((function(e){e.isReady&&e.hide()})),this.rootIndex=n,o.isReady?o.show():(o.updateWebviewId(this._webviewId++),o.updateSrc(e)),o},e.prototype.go=function(e){var n=Mn(this,e);return n>-1?this.switch(e,n):this.initNextPage(e)},e.prototype.back=function(e){var n,t=this._extraStack.slice(),o=t.pop(),r=t.length;if(e<=0)throw new Error("delta 不能 <= 0");if(r<e)throw new Error("delta 不能超过总栈长度:"+(r+1));var i=r-e,a=t.slice(0,i);(t.slice(i,r).forEach((function(e){e.destory()})),a.length>0)?a[a.length-1].show():null===(n=this._slotStack[this.rootIndex])||void 0===n||n.show();o&&a.push(o),this._extraStack=a},e}()),En=function(){function e(){this._invokeServiceCallbackHandler=re,this._dispatchViewEvent=Z,this._dispatchServiceEvent=X,this.$events=new i,this._getCurrentPage=function(){return Pn.currPage},this._getAllPages=function(){return Pn.allPages}}return e.prototype.init=function(){ee=this},e}(),Bn=r((function(e,n){
|
42
|
+
function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var o=this;return o.ctx&&o.ctx.listener?(n="number"!=typeof n?o._pos[1]:n,t="number"!=typeof t?o._pos[2]:t,"number"!=typeof e?o._pos:(o._pos=[e,n,t],void 0!==o.ctx.listener.positionX?(o.ctx.listener.positionX.setTargetAtTime(o._pos[0],Howler.ctx.currentTime,.1),o.ctx.listener.positionY.setTargetAtTime(o._pos[1],Howler.ctx.currentTime,.1),o.ctx.listener.positionZ.setTargetAtTime(o._pos[2],Howler.ctx.currentTime,.1)):o.ctx.listener.setPosition(o._pos[0],o._pos[1],o._pos[2]),o)):o},HowlerGlobal.prototype.orientation=function(e,n,t,o,r,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var c=a._orientation;return n="number"!=typeof n?c[1]:n,t="number"!=typeof t?c[2]:t,o="number"!=typeof o?c[3]:o,r="number"!=typeof r?c[4]:r,i="number"!=typeof i?c[5]:i,"number"!=typeof e?c:(a._orientation=[e,n,t,o,r,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,o,r,i),a)},Howl.prototype.init=(e=Howl.prototype.init,function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}),Howl.prototype.stereo=function(e,t){var o=this;if(!o._webAudio)return o;if("loaded"!==o._state)return o._queue.push({event:"stereo",action:function(){o.stereo(e,t)}}),o;var r=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof e)return o._stereo;o._stereo=e,o._pos=[e,0,0]}for(var i=o._getSoundIds(t),a=0;a<i.length;a++){var c=o._soundById(i[a]);if(c){if("number"!=typeof e)return c._stereo;c._stereo=e,c._pos=[e,0,0],c._node&&(c._pannerAttr.panningModel="equalpower",c._panner&&c._panner.pan||n(c,r),"spatial"===r?void 0!==c._panner.positionX?(c._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),c._panner.positionY.setValueAtTime(0,Howler.ctx.currentTime),c._panner.positionZ.setValueAtTime(0,Howler.ctx.currentTime)):c._panner.setPosition(e,0,0):c._panner.pan.setValueAtTime(e,Howler.ctx.currentTime)),o._emit("stereo",c._id)}}return o},Howl.prototype.pos=function(e,t,o,r){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"pos",action:function(){i.pos(e,t,o,r)}}),i;if(t="number"!=typeof t?0:t,o="number"!=typeof o?-.5:o,void 0===r){if("number"!=typeof e)return i._pos;i._pos=[e,t,o]}for(var a=i._getSoundIds(r),c=0;c<a.length;c++){var u=i._soundById(a[c]);if(u){if("number"!=typeof e)return u._pos;u._pos=[e,t,o],u._node&&(u._panner&&!u._panner.pan||n(u,"spatial"),void 0!==u._panner.positionX?(u._panner.positionX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.positionY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.positionZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setPosition(e,t,o)),i._emit("pos",u._id)}}return i},Howl.prototype.orientation=function(e,t,o,r){var i=this;if(!i._webAudio)return i;if("loaded"!==i._state)return i._queue.push({event:"orientation",action:function(){i.orientation(e,t,o,r)}}),i;if(t="number"!=typeof t?i._orientation[1]:t,o="number"!=typeof o?i._orientation[2]:o,void 0===r){if("number"!=typeof e)return i._orientation;i._orientation=[e,t,o]}for(var a=i._getSoundIds(r),c=0;c<a.length;c++){var u=i._soundById(a[c]);if(u){if("number"!=typeof e)return u._orientation;u._orientation=[e,t,o],u._node&&(u._panner||(u._pos||(u._pos=i._pos||[0,0,-.5]),n(u,"spatial")),void 0!==u._panner.orientationX?(u._panner.orientationX.setValueAtTime(e,Howler.ctx.currentTime),u._panner.orientationY.setValueAtTime(t,Howler.ctx.currentTime),u._panner.orientationZ.setValueAtTime(o,Howler.ctx.currentTime)):u._panner.setOrientation(e,t,o)),i._emit("orientation",u._id)}}return i},Howl.prototype.pannerAttr=function(){var e,t,o,r=this,i=arguments;if(!r._webAudio)return r;if(0===i.length)return r._pannerAttr;if(1===i.length){if("object"!=typeof i[0])return(o=r._soundById(parseInt(i[0],10)))?o._pannerAttr:r._pannerAttr;e=i[0],void 0===t&&(e.pannerAttr||(e.pannerAttr={coneInnerAngle:e.coneInnerAngle,coneOuterAngle:e.coneOuterAngle,coneOuterGain:e.coneOuterGain,distanceModel:e.distanceModel,maxDistance:e.maxDistance,refDistance:e.refDistance,rolloffFactor:e.rolloffFactor,panningModel:e.panningModel}),r._pannerAttr={coneInnerAngle:void 0!==e.pannerAttr.coneInnerAngle?e.pannerAttr.coneInnerAngle:r._coneInnerAngle,coneOuterAngle:void 0!==e.pannerAttr.coneOuterAngle?e.pannerAttr.coneOuterAngle:r._coneOuterAngle,coneOuterGain:void 0!==e.pannerAttr.coneOuterGain?e.pannerAttr.coneOuterGain:r._coneOuterGain,distanceModel:void 0!==e.pannerAttr.distanceModel?e.pannerAttr.distanceModel:r._distanceModel,maxDistance:void 0!==e.pannerAttr.maxDistance?e.pannerAttr.maxDistance:r._maxDistance,refDistance:void 0!==e.pannerAttr.refDistance?e.pannerAttr.refDistance:r._refDistance,rolloffFactor:void 0!==e.pannerAttr.rolloffFactor?e.pannerAttr.rolloffFactor:r._rolloffFactor,panningModel:void 0!==e.pannerAttr.panningModel?e.pannerAttr.panningModel:r._panningModel})}else 2===i.length&&(e=i[0],t=parseInt(i[1],10));for(var a=r._getSoundIds(t),c=0;c<a.length;c++)if(o=r._soundById(a[c])){var u=o._pannerAttr;u={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:u.coneInnerAngle,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:u.coneOuterAngle,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:u.coneOuterGain,distanceModel:void 0!==e.distanceModel?e.distanceModel:u.distanceModel,maxDistance:void 0!==e.maxDistance?e.maxDistance:u.maxDistance,refDistance:void 0!==e.refDistance?e.refDistance:u.refDistance,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:u.rolloffFactor,panningModel:void 0!==e.panningModel?e.panningModel:u.panningModel};var s=o._panner;s||(o._pos||(o._pos=r._pos||[0,0,-.5]),n(o,"spatial"),s=o._panner),s.coneInnerAngle=u.coneInnerAngle,s.coneOuterAngle=u.coneOuterAngle,s.coneOuterGain=u.coneOuterGain,s.distanceModel=u.distanceModel,s.maxDistance=u.maxDistance,s.refDistance=u.refDistance,s.rolloffFactor=u.rolloffFactor,s.panningModel=u.panningModel}return r},Sound.prototype.init=function(e){return function(){var n=this,t=n._parent;n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,e.call(this),n._stereo?t.stereo(n._stereo):n._pos&&t.pos(n._pos[0],n._pos[1],n._pos[2],n._id)}}(Sound.prototype.init),Sound.prototype.reset=function(e){return function(){var n=this,t=n._parent;return n._orientation=t._orientation,n._stereo=t._stereo,n._pos=t._pos,n._pannerAttr=t._pannerAttr,n._stereo?t.stereo(n._stereo):n._pos?t.pos(n._pos[0],n._pos[1],n._pos[2],n._id):n._panner&&(n._panner.disconnect(0),n._panner=void 0,t._refreshBuffer(n)),e.call(this)}}(Sound.prototype.reset);var n=function(e,n){"spatial"===(n=n||"spatial")?(e._panner=Howler.ctx.createPanner(),e._panner.coneInnerAngle=e._pannerAttr.coneInnerAngle,e._panner.coneOuterAngle=e._pannerAttr.coneOuterAngle,e._panner.coneOuterGain=e._pannerAttr.coneOuterGain,e._panner.distanceModel=e._pannerAttr.distanceModel,e._panner.maxDistance=e._pannerAttr.maxDistance,e._panner.refDistance=e._pannerAttr.refDistance,e._panner.rolloffFactor=e._pannerAttr.rolloffFactor,e._panner.panningModel=e._pannerAttr.panningModel,void 0!==e._panner.positionX?(e._panner.positionX.setValueAtTime(e._pos[0],Howler.ctx.currentTime),e._panner.positionY.setValueAtTime(e._pos[1],Howler.ctx.currentTime),e._panner.positionZ.setValueAtTime(e._pos[2],Howler.ctx.currentTime)):e._panner.setPosition(e._pos[0],e._pos[1],e._pos[2]),void 0!==e._panner.orientationX?(e._panner.orientationX.setValueAtTime(e._orientation[0],Howler.ctx.currentTime),e._panner.orientationY.setValueAtTime(e._orientation[1],Howler.ctx.currentTime),e._panner.orientationZ.setValueAtTime(e._orientation[2],Howler.ctx.currentTime)):e._panner.setOrientation(e._orientation[0],e._orientation[1],e._orientation[2])):(e._panner=Howler.ctx.createStereoPanner(),e._panner.pan.setValueAtTime(e._stereo,Howler.ctx.currentTime)),e._panner.connect(e._node),e._paused||e._parent.pause(e._id,!0).play(e._id,!0)}}()}));function re(e,n,t){U(q).invokeCallbackHandler(e,n,t)}function ie(e,n,t){var o,r=null===(o=Pn.currPage)||void 0===o?void 0:o.children;if(Array.isArray(r)&&r.length>0){var i=r[0];i&&i.isWebView&&i.postMessageToWebView({callbackId:e,type:"webInvokeCallbackHandler",params:n})}}var ae={},ce={};function ue(e,n){var t=ae[e],o=ce[e];return null!=t?""!=n.src&&o!=n.src?(t.unload(),delete ae[e],delete ce[e],ue(e,n)):t:(ce[e]=n.src,ae[e]=function(e,n){var t=new oe.Howl({autoplay:e.autoplay,loop:e.loop,src:e.src,rate:e.playbackRate,onend:function(){X(de,{innerAudioContextId:n,method:le.onEnded,data:{}})},onplay:function(){X(de,{innerAudioContextId:n,method:le.onPlay,data:{buffered:0,currentTime:0,duration:0}})},onpause:function(e){X(de,{innerAudioContextId:e,method:le.onPause,data:{}})},onstop:function(){X(de,{innerAudioContextId:n,method:le.onStop,data:{}})},onseek:function(){X(de,{innerAudioContextId:n,method:le.onSeeked,data:{}})},onplayerror:function(e,n){X(de,{innerAudioContextId:e,method:le.onError,data:{errMsg:"播放失败 :"+n,errCode:-1}})},onloaderror:function(e,n){X(de,{innerAudioContextId:e,method:le.onError,data:{errMsg:"播放失败 :"+n,errCode:10002}})},onrate:function(e){console.log("audio进度改变")},onload:function(){X(de,{innerAudioContextId:n,method:le.onCanplay,data:{}})}});return t}(n,e))}function se(e,n,t){var o=ae[n];if(null==o){var r=e+":fail 无法找到innerAudioContextId:"+n+"对应的audio实例";throw re(t,{errMsg:r}),new Error(r)}return o}oe.Howler.autoSuspend=!1;var le={onCanplay:"onCanplay",onEnded:"onEnded",onError:"onError",onPause:"onPause",onPlay:"onPlay",onSeeked:"onSeeked",onSeeking:"onSeeking",onStop:"onStop",onTimeUpdate:"onTimeUpdate",onWaiting:"onWaiting"},de="onInnerAudio";var fe={innerAudio:function(e,n){var t,o=e.method,r=e.data,i=e.innerAudioContextId;switch(o){case"create":break;case"play":(t=ue(i,r)).loop(r.loop),t.volume(r.volume),r.isPlayMethod&&t.play();break;case"stop":se(o,i,n).stop();break;case"seek":(t=se(o,i,n)).seek(r.position);break;case"pause":se(o,i,n).pause();break;case"destroy":se(o,i,n).unload();break;default:throw new Error("无法处理音频method:"+o)}return{errMsg:"innerAudio:ok"}}};function pe(e){return/^http(s?)\:\/\//.test(e)}function ve(e,n,t){var o=new XMLHttpRequest,r=!0;if(null!=n.sync&&(r=!n.sync),null!=n.responseType&&(o.responseType=n.responseType),o.open("GET",e,r),null!=n.header)for(var i in n.header)o.setRequestHeader(i,n.header[i]);o.onload=function(e){t(null,o.response,{e:e,xhr:o})},o.onerror=function(e){t(new Error("request settings failed!"),null,{e:e,xhr:o})},o.send(null)}var he={readFileSync:function(e){var n,t=e.filePath;if(t.startsWith(j))return{data:null,errMsg:"readFileSync:fail not support local file."};t=pe(t=(n=t).endsWith(".wasm")?n+".txt":n)?t:M+t;var o=null,r=null;return ve(t,{sync:!0},(function(e,n){o=n,r=e})),null!=o?{data:o,errMsg:"readFileSync:ok"}:null!=r?{data:null,errMsg:"readFileSync:fail "+r.message}:{data:null,errMsg:"readFileSync:fail"}},readFile:function(e,n){var t=e.filePath,o="base64"===e.encoding,r=pe(t)?t:M+t;t.startsWith(j)?re(n,{errMsg:"readFile:fail not support local file: "+t}):ve(r,{responseType:o?"arraybuffer":""},(function(e,t){re(n,null==e?{data:o?h(t):t,errMsg:"readFile:ok"}:{errMsg:"readFile:fail "+e.message})}))},access:function(){return{errMsg:"access:ok"}},rename:function(){return{errMsg:"rename:ok"}},mkdirSync:function(){return{errMsg:"mkdirSync:ok"}},writeFile:function(){return{errMsg:"writeFile:ok"}},writeFileSync:function(e){return e.filePath,e.data,{errMsg:"writeFileSync:ok"}},unlink:function(e,n){return e.filePath,{errMsg:"unlink:ok"}},downloadFile:function(e,n){var t=e.url,o=e.timeout,r=void 0===o?6e3:o;e.taskId,e.header,e.filePath,g(r,function(e){var n=e.url,t=e.callbackId;return e.filePath,e.header,s(this,void 0,void 0,(function(){return l(this,(function(e){return X(R,{cookies:[],progress:100,totalBytesExpectedToWrite:100,totalBytesWritten:100}),X(H,{cookies:[],header:{}}),re(t,{filePath:n,tempFilePath:n,profile:[],statusCode:200,errMsg:"downloadFile:ok"}),[2]}))}))}({url:t,callbackId:n}),(function(e){re(n,{errMsg:"downloadFile:fail timeout in "+e+"ms."})}))},copyFile:function(e,n){return e.srcPath,e.destPath,re(n,{errMsg:"copyFile:ok fake subpport."},"copyFile")}};function ge(e){return ne().invokeHandler({callbackId:e.callbackId||-1,apiName:e.apiName,params:e.params,from:"service"})}var me,we,ye,be=G?he:(me=he,we={readFileSync:{onMobile:_e},readFile:{onMobile:_e},access:{onMobile:_e},rename:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e.shift();return t&&t.fatNewPath&&(t.newPath=t.fatNewPath,delete t.fatNewPath),t&&e.unshift(t),e}},downloadFile:{onCallBefore:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0];if(null!=t){var o=t.header;if(o&&o.Referer)throw new Error("header不能设置Referer字段");t.source="miniGame"}return e}}},ye=we||{},Object.keys(me).reduce((function(e,n){var t=me[n];return e[n]=function(){for(var e,o,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=p(),c=ye[n],u={callNativeApi:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ge({apiName:n,params:e[0],callbackId:e[1]})},callPatchApi:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return t.apply(void 0,e)}};try{return c&&"function"==typeof c.onCallBefore&&(r=(e=c.onCallBefore).call.apply(e,d([u],r))),a?c&&"function"==typeof c.onMobile?(o=c.onMobile).call.apply(o,d([u],r)):u.callNativeApi.apply(u,r):u.callPatchApi.apply(u,r)}catch(e){return{errMsg:n+":fail error occured in polyfill api, "+e.message}}},e}),{}));function _e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var t=e[0],o=t.filePath||t.path,r=this;return o.startsWith(N)?r.callNativeApi.apply(r,e):r.callPatchApi.apply(r,e)}var xe=new(function(){function e(){this.reportedEventType=new Set(["ErrorType"])}return Object.defineProperty(e.prototype,"sentry",{get:function(){return window.Sentry},enumerable:!1,configurable:!0}),e.prototype.captureException=function(e,n){var t=this.sentry;if(null!=t){var o=n.event_desc;delete n.event_desc,t.captureException(function(e,n){var t=new Error,o=e.charAt(0).toUpperCase()+e.slice(1),r=function(e){try{return JSON.parse(e)}catch(n){return e}}(n);"string"==typeof r?(t.stack=r,t.message=r):(t.message=o+": "+r.msg,t.stack=r.stack);return t}(e,o))}else console.log("Sentry is not ready yet.")},e.prototype.captureLoadGameEntryError=function(e){xe.captureException("LoadGameEntryError",{event_desc:"load game entry bundle fail: \n"+e.message+"\n"+e.stack})},e}()),Ae=null;function ke(){if(null==Ae)throw new Error("WxConfig is not ready.");return Ae}function Se(e){var n=ke(),t=n.windows.pages;return null!=t&&t[e]?Object.assign({},n.window,t[e]):null}var Ie=new i;function Ce(){Ie.on("NavigatorBarTools:onMore",(function(){bn.showToast({title:"暂未实现该功能"})})),Ie.on("NavigatorBarTools:onClose",(function(){var e=ne();null!=e&&e.invokeHandler({callbackId:-1,apiName:"exitMiniProgram",params:{},from:"service"})})),Ie.on("NavigatorBar:onBack",(function(){je.navigateBack({delta:1}),console.log("onBack")})),Ie.on("TabBar:change",(function(e){var n,t,o;X("onTabItemTap",{index:e.index,pagePath:e.item.pagePath,text:e.item.text}),je.switchTab({url:e.item.pagePath},-1),n=e.item.pagePath,t={},null!=(o=Se(n))&&(t.windowConfig=o),Ie.emit("tabItemChanged",t)})),Ie.on("invokeCallbackHandler",(function(e){re(e.callbackId,e.data)})),Ie.on("dispatchServiceEvent",(function(e){X(e.event,e.payload)}))}function Te(e){void 0!==window.__initWebFrame&&window.__initWebFrame(e,Ie)}var Me={getGlobalVariables:function(e){return"_launchOption"===e.variable?{_launchOption:F}:null},onWindowResize:function(){},offWindowResize:function(){},reportApmMonitor:function(e){var n=e.eventName,t=e.payload,o=e.eventType;e.timestamp,xe.reportedEventType.has(o)?xe.captureException(n,t):"LogReport"===o&&t.event},addPerformance:function(e){},initReady:function(){},updateAppData:function(){},injectHtmlCallback:function(e,n,t){"service"===t&&J().events.emit($.onInjectHTMLCallback)},pageScrollTo:function(e,n){var t=e.scrollTop;e.duration;var o=Pn.currPage.getWindow();return null==o||o.scrollTo({top:t,behavior:"smooth"}),{errMsg:"pageScrollTo:ok"}},getMenuButtonBoundingClientRect:function(e,n){Ie.emit("getMenuButtonBoundingClientRect",e,n)},getAccountInfoSync:function(){var e=window.__extInfo;return{data:{miniProgram:u(u({},e),{appId:null==e?void 0:e.extUuid,envVersion:null==e?void 0:e.envVersion,version:"",forceUsePatchApi:G}),plugin:{appId:"",version:""}}}},jssdkConfig:function(e,n){var t=e.jsApiList,o=[];if((void 0===t?[]:t).forEach((function(e){null==bn[e]&&o.push(e)})),!(o.length>0))return ie(n,{errMsg:"jssdkConfig:ok"});ie(n,{errMsg:"jssdkConfig:fail "+o.join(",")+" 未实现."})}},Pe={hideToast:function(e){return Ie.emit("hideToast",e),{errMsg:"hideToast:ok"}},showToast:function(e){return Ie.emit("showToast",e),{errMsg:"showToast:ok"}},showLoading:function(e){return Ie.emit("showLoading",e),{errMsg:"showLoading:ok"}},hideLoading:function(e){return Ie.emit("hideLoading",e),{errMsg:"hideLoading:ok"}},showModal:function(e,n){Ie.emit("showModal",e,n)},showActionSheet:function(e,n){Ie.emit("showActionSheet",e,n)}},Ee={showGameKeyboard:function(e){return p()?ge({apiName:"showGameKeyboard",params:e}):Ie.emit("showKeyboard",e),{}},hideGameKeyboard:function(e){return p()||Ie.emit("hideKeyboard",e),{}},updateGameKeyboard:function(e){return p()||Ie.emit("updateKeyboard",e),{}},showKeyboard:function(e){return p()?ge({apiName:"showGameKeyboard",params:e}):Ie.emit("showKeyboard",e),{}},hideKeyboard:function(e){return Ie.emit("hideKeyboard",e),{}},updateKeyboard:function(e){return Ie.emit("updateKeyboard",e),{}}};function Be(e,n){if(e===D)return'<script charset="utf-8" src="'+n.moduleName+'game.js"><\/script>';if("miniProgram"===e)return n.content;throw Error("unsupported projectType: "+e)}var Oe=function(e){function n(n){return e.call(this,u(u({},n),{projectType:D}))||this}return c(n,e),n.prototype.injectScript=function(){var e=U(q).getWindow();e.injectHtml(e.document.body,{content:Be(this.projectType,{moduleName:this.moduleName})})},n.prototype.getEntry=function(){return e=this.projectType,n={moduleName:this.moduleName},e===D?n.moduleName+"game.js":"";var e,n},n}(function(){function e(e){this.taskId=e.taskId,this.moduleName=e.moduleName,this.projectType=e.projectType,this.status="none"}return e.prototype.notifyProgressUpdate=function(e,n){X("onLoadSubPackageTaskStateChange",u({moduleName:this.moduleName,state:e,taskId:this.taskId},n))},e.prototype.injectScript=function(){},e.prototype.getEntry=function(){},e.prototype.load=function(e,n){return s(this,void 0,void 0,(function(){return l(this,(function(e){return this.notifyProgressUpdate("progressUpdate",{progress:0}),this.notifyProgressUpdate("progressUpdate",{progress:50}),this.injectScript(),this.notifyProgressUpdate("progressUpdate",{progress:100}),[2]}))}))},e}()),Le=0,Fe={},Re={createLoadSubPackageTask:function(e,n){var t=e.moduleName,o=Fe[t];if(o&&"success"===o.status)return{errMsg:"createLoadSubPackageTask:fail sub package already loaded."};++Le;var r=String(Le);return o=new Oe({taskId:r,moduleName:t}),J().events.once($.onInjectHTMLCallback,(function(){o.status="success",o.notifyProgressUpdate("success",{entryPath:o.getEntry()})})),Fe[t]=o,o.load(r,n),{errMsg:"createLoadSubPackageTask:ok",loadTaskId:Le}}},He={showNavigationBarLoading:function(){return Ie.emit("showNavigationBarLoading"),{errMsg:"showNavigationBarLoading:ok"}},setNavigationBarTitle:function(e){return Ie.emit("setNavigationBarTitle",e),{errMsg:"setNavigationBarTitle:ok"}},setNavigationBarColor:function(e){return Ie.emit("setNavigationBarColor",e),{errMsg:"setNavigationBarColor:ok"}},hideNavigationBarLoading:function(){return Ie.emit("hideNavigationBarLoading"),{errMsg:"hideNavigationBarLoading:ok"}},hideHomeButton:function(){}};function De(e,n){var t,o=function(e){e=e.replace(/\.html$/,"");var n=ke(),t=n.subpackages;if(Array.isArray(t)&&t.length>0)return t.find((function(n){return n.pageFullPath.includes(e)}));return null}(e);null==o||(t=o.root,V[t])?n():function(e,n){var t=U(q);t.events.once($.onInjectHTMLCallback,n),t.loadSubBundle(e.root,e.packageName+".js")}(o,n)}var je={navigateTo:function(e,n){var t=e.url;if(Pn.stack.length>10)return{errMsg:"navigateTo:fail 已到达页面栈上限:10。"};var o=v(t),r=o.path,i=o.query;return De(r,(function(){var e=Pn.go(r);J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:r,openType:"navigateTo",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId)}))})),{errMsg:"navigateTo:ok"}},navigateBack:function(e){var n=e.delta;try{Pn.back(n)}catch(e){return{errMsg:"navigateBack:fail "+e.message}}var t=Pn.currPage;return X("onAppRoute",{path:t.pagePath,openType:"navigateBack",options:{delta:n},pipMode:"",query:void 0,webviewId:t.webviewId},t.webviewId),{errMsg:"navigateBack:ok"}},reLaunch:function(e,n){var t=e.url,o=v(t),r=o.path,i=o.query;De(r,(function(){Pn.reLaunch(t);var e=Pn.currPage;J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:r,openType:"reLaunch",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"reLaunch:ok"})}))}))},redirectTo:function(e,n){var t=v(e.url),o=t.path,r=t.query;De(o,(function(){try{Pn.redirectTo(o)}catch(e){return void re(n,{errMsg:"redirectTo:fail "+e.message})}var e=Pn.currPage;J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:o,openType:"redirectTo",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"redirectTo:ok"})}))}))},switchTab:function(e,n){var t=v(e.url),o=t.path,r=t.query;De(o,(function(){try{Pn.switch(o)}catch(e){return void re(n,{errMsg:"switchTab:fail "+e.message})}var e=Pn.currPage;e.isReady?(X("onAppRoute",{path:o,openType:"switchTab",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"switchTab:ok"})):J().events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:o,openType:"switchTab",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),re(n,{errMsg:"switchTab:ok"})}))}))}};function Ne(e){setTimeout(e,16)}function Ge(e){var n=b();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return n+"-"+e}function We(e){var n=b();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return e.replace(new RegExp("^"+n+"-"),"")}function $e(e){return Number((e/1024).toFixed(2))}var Ve={getStorageSync:function(e){return{data:localStorage.getItem(Ge(e.key))||null}},getStorage:function(e,n){Ne((function(){re(n,{data:Ve.getStorageSync(e)})}))},setStorageSync:function(e){return localStorage.setItem(Ge(e.key),e.data),{errMsg:"setStorageSync:ok"}},setStorage:function(e,n){Ne((function(){localStorage.setItem(e.key,e.data),re(n,{errMsg:"setStorage:ok"})}))},removeStorageSync:function(e){return localStorage.removeItem(Ge(e.key)),{errMsg:"removeStorageSync:ok"}},removeStorage:function(e,n){Ne((function(){localStorage.removeItem(Ge(e.key)),re(n,{errMsg:"removeStorage:ok"})}))},clearStorageSync:function(){return localStorage.clear(),{errMsg:"clearStorageSync:ok"}},clearStorage:function(e,n){Ne((function(){localStorage.clear(),re(n,{errMsg:"clearStorage:ok"})}))},getStorageInfoSync:function(){var e=function(){var e=0,n=[];for(var t in localStorage)Object.prototype.hasOwnProperty.call(localStorage,t)&&(e+=localStorage[t].length,n.push(We(t)));return{size:e,keys:n}}(),n=e.size;return{keys:e.keys,currentSize:$e(n),limitSize:$e(10485760)}},getStorageInfo:function(e,n){Ne((function(){re(n,u(u({},Ve.getStorageInfoSync()),{errMsg:"getStorageInfo:ok"}))}))}};function ze(){var e=f();return("Android"===e||"IOS"===e)&&window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape"}function qe(){var e,n,t,o=null===(e=Pn.currPage)||void 0===e?void 0:e.getWindow();if(null!=o){var r=o.document;return(null===(n=r.documentElement)||void 0===n?void 0:n.scrollTop)||(null===(t=r.body)||void 0===t?void 0:t.scrollTop)||0}return 0}function Ke(){return u(u({patch:!0},(e=window.innerWidth||375,n=window.innerHeight||375,t=f().toLocaleLowerCase().includes("window")?0:50,o=window.devicePixelRatio||2,{screenWidth:e,screenHeight:n,statusBarHeight:t,devicePixelRatio:o,pixelRatio:o,windowHeight:n,windowWidth:e,safeArea:{height:n-t,widows:e,top:t,left:0,right:0}})),{scrollY:qe()});var e,n,t,o}var Ue={onMemoryWarning:function(){console.warn("The onMemoryWarning api is not implement.")},showShareMenu:function(){console.warn("The showShareMenu api is not implement.")},getSystemInfoSync:function(){var e,n=Qe(),t=ze(),o=f(),r=(e=y().extType||"").startsWith("app_")?f().toLowerCase():e.startsWith("pc_")?"pc":"web";return k.info("getSystemInfoSync",{windowInfo:n,deviceOrientation:t,system:o,platform:r}),u({deviceOrientation:t,SDKVersion:"1.0.0",appVersion:"12.1.0",batteryLevel:98,benchmarkLevel:1,bluetoothEnabled:!1,brand:"huya",cameraAuthorized:!1,deviceId:"none",enableDebug:!1,fontSizeSetting:15,frameworkVersion:"1.0.0",inHUYA:!0,language:"zh_CN",locationAuthorized:!1,locationEnabled:!1,microphoneAuthorized:!0,mode:"default",model:"none",notificationAuthorized:!0,platform:r,system:o,theme:void 0,version:"8.0.28 "},n)},getWindowInfo:function(){return Qe()},getSetting:function(){return{authSetting:{"scope.userInfo":!0},subscriptionsSetting:{},miniprogramAuthSetting:{"scope.userInfo":!0}}},getNetworkType:function(){return{networkType:"wifi",signalStrength:100,hasSystemProxy:!1}}};function Qe(){return p()&&"web_hd_inner"!==(y().extType||"")?function(e){_()?(e.screenWidth=e.windowWidth||window.innerWidth||e.screenWidth,e.screenHeight=e.windowHeight||window.innerHeight||e.screenHeight):(e.screenWidth=e.windowWidth||window.innerWidth,e.screenHeight=e.windowHeight||window.innerHeight);return e}(ge({apiName:"getWindowInfo",params:{}})):Ke()}var Je={showTabBar:function(e){return Ie.emit("showTabBar",e),{errMsg:"showTabBar:ok"}},hideTabBar:function(e){return Ie.emit("hideTabBar",e),{errMsg:"hideTabBar:ok"}},setTabBarStyle:function(e){return Ie.emit("setTabBarStyle",e),{errMsg:"setTabBarStyle:ok"}},setTabBarItem:function(e){return Ie.emit("setTabBarItem",e),{errMsg:"setTabBarItem:ok"}},setTabBarBadge:function(e){return Ie.emit("setTabBarBadge",e),{errMsg:"setTabBarBadge:ok"}},removeTabBarBadge:function(e){return Ie.emit("removeTabBarBadge",e),{errMsg:"removeTabBarBadge:ok"}},hideTabBarRedDot:function(e){return Ie.emit("hideTabBarRedDot",e),{errMsg:"hideTabBarRedDot:ok"}},showTabBarRedDot:function(e){return Ie.emit("showTabBarRedDot",e),{errMsg:"showTabBarRedDot:ok"}}},Ze="insertHTMLWebView",Xe="onWebviewLoad",Ye={insertHTMLWebView:function(e,n,t,o){Pn.initNextWebView(Pn.currPage,e.src,e.src).el.addEventListener("load",(function(){X(Xe,{webviewId:o},o),Y(te+"pageonshow",{})})),X(Ze,e,o)},invokeMiniProgramAPI:function(e,n){console.log(e,n);var t=e.name,o=e.arg,r=bn[t];null!=r&&r(o,n)},postMessage:function(e,n){X("onBindMessage",e,Pn.currPage.webviewId),ie(n,{errMsg:"postMessage:ok"})},canGoBack:function(e,n){ie(n,{errMsg:"canGoBack:fail default to fail"})},canNavigateBack:function(e,n){var t=!1;Pn.allPages.length>1&&(t=!0),ie(n,{errMsg:"canNavigateBack:"+(t?"ok":"fail")})}},en={},nn="onAd";function tn(e){var n=e.type,t=e.adUnitId,o=en[t];if(null!=o)return o;if("rewardedVideo"===n)o=function(e){var n=e.adUnitId,t=ge({apiName:"createRewardedVideoAd",params:{adUnitId:n}});return t.onLoad((function(e){X(nn,{method:"onLoad",adUnitId:n,data:e})})),t.onClose((function(e){X(nn,{method:"onClose",adUnitId:n,data:e})})),t.onError((function(e){X(nn,{method:"onError",adUnitId:n,data:e})})),t}(e);return null!=o&&(en[t]=o),o}var on={ad:function(e,n){return s(void 0,void 0,void 0,(function(){var t,o,r,i;return l(this,(function(a){switch(a.label){case 0:if(t=e.method,e.adUnitId,o=e.type,null==(r=tn(e)))return re(n,{errMsg:"ad:fail 获取"+o+"广告实例失败"}),[2];a.label=1;case 1:switch(a.trys.push([1,12,,13]),t){case"load":return[3,2];case"destroy":return[3,4];case"show":return[3,6];case"hide":return[3,8]}return[3,10];case 2:return[4,r.load()];case 3:return a.sent(),[3,11];case 4:return[4,r.destroy()];case 5:return a.sent(),[3,11];case 6:return[4,r.show()];case 7:return a.sent(),[3,11];case 8:return[4,r.hide()];case 9:return a.sent(),[3,11];case 10:throw new Error("unsupported method: "+t);case 11:return re(n,{errMsg:"ad:ok"}),[3,13];case 12:return i=a.sent(),re(n,{errMsg:"ad:fail adInstance."+t+" call fail, "+(i.mssage||"unknown")}),[3,13];case 13:return[2]}}))}))}},rn={appDataChange:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):(!function(e){var n=u({},e.data),t=Se(n.options.path);t&&(n.windowConfig=t),n.pages=Pn.allPages,Ie.emit("appDataChange",n)}(n),Z(r,n,o))},__updateAppData:function(e){var n,t,o;n={},t=Pn.currPage.pagePath.replace(/\.html$/,""),null!=(o=Se(t))&&(n.windowConfig=o),n.pages=Pn.allPages,n.currPage=t,Ie.emit("updateAppData",n)}};var an={canvasInsert:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},canvasRemove:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},CANVAS_EVENT_V2:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},onCanvasPreloadImage:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},onCanvasGetImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},onCanvasPutImageData:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},canvasActionsChanged:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},invokeCanvasToDataUrl:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},invokeCanvasPutImageData:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},invokeCanvasGetImageData:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},getImageBase64:function(e){var n=e.params;e.from,e.webviewIds;var t,o=e.event,r=e.webviewId,i=n.src;ve(/^https?:\/\//.test(t=i)||/^hyfile:\/\//.test(t)?t:M+t,{responseType:"arraybuffer"},(function(e,n){if(null!=e)return"";var t=h(n),a=function(e){var n,t=e.split("/"),o=null===(n=t[t.length-1])||void 0===n?void 0:n.split("."),r=o[0],i=o[1];if(null==i||""==i)throw new Error("url:"+e+"格式错误,无法获取文件信息");return{filename:r,ext:i}}(i);Z(o,{src:i,data:"data:image/"+a.ext+";base64,"+t},[r])}))}};function cn(e,n){e.message=n+" stack: "+(null==e?void 0:e.message),Ie.emit("closeLaunchMask"),bn.showToast({title:"加载游戏脚本超时"}),k.error("load game.js error",e.message),xe.captureLoadGameEntryError(e)}var un={gameServiceReady:function(){!function(e){s(this,void 0,void 0,(function(){var n,t,o,r;return l(this,(function(i){switch(i.label){case 0:if(n=window.__deviceOrientation,t=ze(),o="string"==typeof n&&n.includes("landscape"),!("landscape"!==t&&o&&p()&&_()))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,g(5e3,new Promise((function(e){var n=ne();ge({apiName:"setDeviceOrientation",params:{value:"landscape"}}),n.$events.once("onDeviceOrientationChange",(function(n){"landscape"===n.value&&e(!0)}))})))];case 2:return i.sent(),e(),[3,4];case 3:return r=i.sent(),e(r),[3,4];case 4:return[3,6];case 5:e(),i.label=6;case 6:return[2]}}))}))}((function(e){null==e?Ne((function(){k.log("load game.js"),function(){s(this,void 0,void 0,(function(){function e(){return s(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,J().loadSubBundle("","game.js")];case 1:return e.sent(),Ie.emit("closeLaunchMask"),[2]}}))}))}return l(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,g(18e3,e())];case 1:return n.sent(),[3,3];case 2:return cn(n.sent(),"entry"),[3,3];case 3:return[2]}}))}))}()})):cn(e,"deviceOrientation")}))},gameConfigUpdate:function(e){var n=e.params;Te({windowInfo:bn.getWindowInfo(),wxConfig:n})}},sn=new(function(){function e(){this.reportedFirstScreenTime=!1}return e.prototype.reportFirstScreenTime=function(e){if(!this.reportedFirstScreenTime){var n=window.performanceInfo;null!=n&&(n.firstScreenTime=e),this.reportedFirstScreenTime=!0}},e}()),ln=new(function(){function e(){this.inited=!1,this.__startTime=Date.now(),this.isServiceReady=!1,this.isViewReady=!1,this.showedFirstPage=!1}return Object.defineProperty(e.prototype,"allReady",{get:function(){return this.isViewReady&&this.isServiceReady},enumerable:!1,configurable:!0}),e.prototype.init=function(e){this.inited||(this.inited=!0,this.initIframes(),k.info("initLauncher "+e+" consume: "+(Date.now()-this.__startTime)+"ms"))},e.prototype.initIframes=function(){var e=J(),n=Q();e.updateSrc("./service.html"),n.updateSrc("first")},e.prototype.handleServiceStart=function(e){var n=e.params;Ae=n,Te({wxConfig:n,windowInfo:bn.getWindowInfo()}),Ie.emit("serviceStart",n)},e.prototype.handleServiceReady=function(e){var n=this,t=J();if(!t.isReady){this.root=e.params.root,this.firstWebviewId=e.webviewIds[0],this.isServiceReady=!0;var o=this.firstWebviewId;t.events.once($.onViewDOMContentLoaded,(function(){X("onAppRoute",{path:n.root,openType:"appLaunch",options:void 0,pipMode:"",query:void 0,webviewId:n.firstWebviewId},n.firstWebviewId)})),X("onServiceReadyDone",u(u({},F),{webviewId:o}),o),t.isReady=!0,this.launchPageShow()}},e.prototype.showPage=function(){var e=Pn.currPage;null!=e&&(e.isReady=!0,e.injectScript(),e.show(),this.showedFirstPage||(this.showedFirstPage=!0))},e.prototype.handleViewReady=function(){this.isViewReady=!0,this.showedFirstPage?this.showPage():this.launchPageShow()},e.prototype.handleViewDOMContentLoaded=function(e){var n=e.from,t=J();n===O&&(X("DOMContentLoaded",{},Pn.currPage.webviewId),t.events.emit($.onViewDOMContentLoaded)),Ie.emit("closeLaunchMask")},e.prototype.launchPageShow=function(){if(this.allReady){!function(e,n){var t=function(e){var n=e.tabBar;return null==n||0===(n.list||[]).length?[e.root]:n.list.map((function(e){return e.pagePath}))}(e);Pn.initFirstPage(t,e.root,n)}(ke(),Q()),Pn.initSlotWebviewId(this.firstWebviewId),this.showPage();var e=Date.now(),n=e-this.__startTime;sn.reportFirstScreenTime(e),k.info("init page consume time: "+n+"ms")}},e}()),dn={serviceStart:function(e){ln.handleServiceStart(e)},onLaunchCalled:function(e){},serviceReady:function(e){ln.handleServiceReady(e)},DOMContentLoaded:function(e){ln.handleViewDOMContentLoaded(e)},viewReady:function(){ln.handleViewReady()},DOMReady:function(){}},fn={info:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},log:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},warn:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},error:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},initLogs:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},clearLogs:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},onViewLogEvent:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)}},pn={INVOKE_METHOD:function(e){var n=e.params,t=e.from,o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},pageonshow:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):Z(r,n,o)},pageonhide:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):(Z(r,n,o),Y(r,n))},requestLoadFontFace:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):Z(r,n,o)},requestLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},responseLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===O?console.error("not implement for "+t):Z(r,n,o)}};function vn(e){return"string"==typeof e?JSON.parse(e):e}function hn(e){return JSON.parse(JSON.stringify(e))}var gn={SPECIAL_PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},setKeyboardValue:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)},PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},vdSync:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event,i=e.webviewId;t===O?X(r,hn(n),i):Z(r,hn(n),o)},vdSyncBatch:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event,i=e.webviewId;t===O?X(r,hn(n),i):Z(r,hn(n),o)}},mn={videoPlayerInsertFinish:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===O?X(o,n,r):console.error("not implement for "+t)},videoActionChanged:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===O?console.error("not implement for "+t):Z(r,n,o)}},wn={openTypeEvent:function(e){var n=e.event,t=e.params,o=e.from,r=e.webviewId;"view"===o&&X(n,t,r)},openTypeEventCallback:function(e){var n=e.event,t=e.params,o=e.from,r=e.webviewIds;"service"===o&&Z(n,t,r)}},yn=u(u(u(u(u(u(u(u(u({},un),dn),an),rn),fn),pn),gn),mn),wn),bn=u(u(u(u(u(u(u(u(u(u(u(u(u({},Me),be),Re),je),Pe),Ve),Ue),He),Je),Ye),fe),Ee),on);function _n(e){var n,t=e.replace(te,""),o=yn[t];if(null==o){var r=/^video_(.*)_actionChanged$/.test(n=t)?"videoActionChanged":/^canvas(.*)actionsChanged$/.test(n)?"canvasActionsChanged":/^invokeCanvasToDataUrl_(.*)$/.test(n)?"invokeCanvasToDataUrl":/^onCanvasToDataUrl_(.*)$/.test(n)?"onCanvasToDataUrl":/^invokeCanvasPutImageData_(.*)$/.test(n)?"invokeCanvasPutImageData":/^onCanvasPutImageData_(.*)$/.test(n)?"onCanvasPutImageData":/^invokeCanvasGetImageData_(.*)$/.test(n)?"invokeCanvasGetImageData":/^onCanvasGetImageData_(.*)$/.test(n)?"onCanvasGetImageData":n;return{handler:yn[r]||null,formatedEvent:r}}return{handler:o,formatedEvent:t}}var xn={invokeHandler:function(e){k.debug("invokeHander",e);var n=e.C,t=e.from,o=e.paramsString,r=e.webviewId,i=e.callbackId,a=vn(o),c=bn[n];if(null!=c){var u=c(a,i,t,r);return u&&u instanceof Promise?void 0:u}var s=ne();if(null!=s)return s.invokeHandler({apiName:n,params:a,callbackId:i,from:t})},publishHandler:function(e){k.debug("publishHandler",e);var n=e.event,t=e.from,o=e.paramsString,r=e.webviewId,i=e.webviewIds,a=_n(n),c=a.handler,u=a.formatedEvent,s=vn(o);if(null!=c)c({event:n,params:s,from:t,webviewId:r,webviewIds:B===t&&i?vn(i):void 0});else{var l=ne();null!=l&&l.publishHandler({formatedEvent:u,event:n,params:s,from:t})}},webInvokeHandler:function(e){E&&console.log("webInvokeHander",e),ie(e.callbackId,vn(e.paramsString))},webPublishHandler:function(e){E&&console.log("webPublishHandler",e),Y(e.event,vn(e.paramsString))}};var An=[],kn=function(e){An.push(e.el.src)},Sn=function(e){An.pop()},In=function(){function e(){this.block=!1,this.queue=[]}return e.prototype.collect=function(e){var n=this;this.block?this.queue.push(e):(this.block=!0,this.queue.push(e),this.timer=setTimeout((function(){n.block=!1,clearTimeout(n.timer),n.comsume()})))},e.prototype.comsume=function(){var e=this.queue;if(this.queue=[],1===e.length)e[0]();else for(var n=0;n<e.length;n++)e[n]()},e}();var Cn=function(e){function n(n){var t=e.call(this,n)||this;return t.webviewId=null,t.pagePath="",t.wrapper=null,t.isDestoryed=!1,t.active=!1,t.__isWebView=!1,t.tickQueue=new In,t}return c(n,e),Object.defineProperty(n.prototype,"isWebView",{get:function(){return this.__isWebView},set:function(e){this.__isWebView=e,e?kn(this):Sn(this)},enumerable:!1,configurable:!0}),n.prototype.appendContainer=function(){var e=this.el;e.className="webview",e.setAttribute("frameborder","0"),this.hide();var n=document.getElementById("webview-container");this.wrapper=n,null!=n&&n.appendChild(e)},n.prototype.show=function(){var e=this.el;e.style.zIndex="2",e.style.opacity="1",this.active=!0,Tn(this,"show")},n.prototype.hide=function(){var e=this.el;e.style.zIndex="1",e.style.opacity="0",this.active=!1,Tn(this,"hide")},n.prototype.updateWebviewId=function(e){this.webviewId=e,this.updateId()},n.prototype.updateId=function(){this.el.id="webview-"+this.webviewId},n.prototype.updateSrc=function(e,n){void 0===n&&(n=P),this.el.src=n,this.pagePath=e},n.prototype.updatePagePath=function(e){this.pagePath=e},n.prototype.injectScript=function(){var e=this.getWindow();if(null!=e&&""!=this.pagePath){var n=this.pagePath.replace(/\.html$/g,""),t=function(e){var n=e.pagePath;return"\n <script>\n var __path__ = '"+e.path+"';\n document.title = __path__;\n document.dispatchEvent(new CustomEvent(\"generateFuncReady\", {\n detail: {\n generateFunc: $gfc('"+n+".wxml') || $gfc('"+n+".hyml')\n }\n }))\n <\/script> \n "}({pagePath:"./"+n,path:n});e.injectHtml(e.document.body,{content:t})}},n.prototype.getBridge=function(){return this.getWindow().FinChatJSBridge},n.prototype.sendToView=function(e,n){var t=this;this.sync?(k.debug("%c "+e,{data:n,webviewId:this.webviewId}),this.getBridge().subscribeHandler(e,n,this.webviewId)):this.tickQueue.collect((function(){k.debug("%c "+e,{data:n,webviewId:t.webviewId}),t.getBridge().subscribeHandler(e,n,t.webviewId)}))},n.prototype.postMessageToWebView=function(e){var n;k.debug("%c postMessageToWebView",e),null===(n=this.el.contentWindow)||void 0===n||n.postMessage(e,"*")},n.prototype.destory=function(){null!==this.wrapper&&this.wrapper.removeChild(this.el),this.el=null,this.wrapper=null,this.isDestoryed=!0,this.active=!1,this.isWebView=!1,Tn(this,"destory")},n}(W);function Tn(e,n){e.isVHost&&e.children&&e.children.length>0&&e.children.forEach((function(e){e[n]()}))}function Mn(e,n){return e._slots.findIndex((function(e){return e===n.replace(/\.html$/,"")}))}var Pn=new(function(){function e(){this._slotStack=[],this._extraStack=[],this._slots=[],this._webviewId=0,this.rootIndex=0}return Object.defineProperty(e.prototype,"pagePath",{get:function(){var e;return(null===(e=this.currPage)||void 0===e?void 0:e.pagePath)||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.stack[this.stack.length-2]||null},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.stack[this.stack.length-1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stack",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:d([e],this._extraStack)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"allPages",{get:function(){var e=this._slotStack[this.rootIndex];return null==e?[]:d([e],this._extraStack.slice(0,this._extraStack.length-1))},enumerable:!1,configurable:!0}),e.prototype.popExtraStack=function(){var e=this._extraStack,n=e.pop(),t=e.pop();return n&&e.push(n),t},e.prototype.resetExtraStack=function(){if(0!==this._extraStack.length){var e=this.top;this._extraStack.slice(0,this._extraStack.length-1).forEach((function(e){e.destory()})),this._extraStack=[e]}},e.prototype.initFirstPage=function(e,n,t){if(!Array.isArray(e)||0===e.length)throw new Error("slots must exist.");var o=Mn(this,n);o>-1&&(this.rootIndex=o),this._slots=e;for(var r=0;r<e.length;r++){var i=void 0;if(t&&r===this.rootIndex)i=t;else{var a=document.createElement("iframe");(i=new Cn(a)).appendContainer()}i&&this._slotStack.push(i)}var c=this._slotStack[this.rootIndex];t?c.updatePagePath(n):c.updateSrc(n),this.initEmptyPage()},e.prototype.initEmptyPage=function(){var e=document.createElement("iframe"),n=new Cn(e);n.appendContainer(),this._extraStack.push(n)},e.prototype.initNextPage=function(e,n){var t=this.currPage,o=this.top;return t.hide(),o.updateSrc(e,n),o.updateWebviewId(this._webviewId++),this.initEmptyPage(),o},e.prototype.initNextWebView=function(e,n,t){var o=this.initNextPage(n,t),r=this._extraStack.findIndex((function(e){return e.pagePath===n}));return r>-1&&this._extraStack.splice(r,1),e.children=[o],e.isVHost=!0,o.el.setAttribute("sandbox","allow-same-origin allow-scripts"),o.isWebView=!0,o.show(),o},e.prototype.initSlotWebviewId=function(e){this._webviewId=e,this._slotStack[this.rootIndex].updateWebviewId(this._webviewId++)},e.prototype.reinitPages=function(e){var n=this._slotStack,t=this._extraStack;n.forEach((function(e){e.destory()})),t.forEach((function(e){e.destory()})),this._slotStack=[],this._extraStack=[],this.initFirstPage(this._slots,e),this.currPage.updateWebviewId(this._webviewId++)},e.prototype.reLaunch=function(e){this.reinitPages(e)},e.prototype.redirectTo=function(e){if(Mn(this,e)>-1)throw new Error("不允许跳转到 tabbar 页面:"+e);var n=this._extraStack;if(n.length>1){var t=n.pop();n.pop().destory(),t.updateSrc(e),t.updateWebviewId(this._webviewId++),n.push(t),this.initEmptyPage()}else{null==(t=n.pop())||t.destory(),this._slotStack.forEach((function(e){e.destory()})),this.reinitPages(e)}},e.prototype.switch=function(e,n){n=null!=n?n:Mn(this,e);var t=this._slotStack,o=t[n];if(null==o)throw new Error("switchTab url is invalid: "+e);return this.resetExtraStack(),t.forEach((function(e){e.isReady&&e.hide()})),this.rootIndex=n,o.isReady?o.show():(o.updateWebviewId(this._webviewId++),o.updateSrc(e)),o},e.prototype.go=function(e){var n=Mn(this,e);return n>-1?this.switch(e,n):this.initNextPage(e)},e.prototype.back=function(e){var n,t=this._extraStack.slice(),o=t.pop(),r=t.length;if(e<=0)throw new Error("delta 不能 <= 0");if(r<e)throw new Error("delta 不能超过总栈长度:"+(r+1));var i=r-e,a=t.slice(0,i);(t.slice(i,r).forEach((function(e){e.destory()})),a.length>0)?a[a.length-1].show():null===(n=this._slotStack[this.rootIndex])||void 0===n||n.show();o&&a.push(o),this._extraStack=a},e}()),En=function(){function e(){this._invokeServiceCallbackHandler=re,this._dispatchViewEvent=Z,this._dispatchServiceEvent=X,this.$events=new i,this._getCurrentPage=function(){return Pn.currPage},this._getAllPages=function(){return Pn.allPages}}return e.prototype.init=function(){ee=this},e}(),Bn=r((function(e,n){
|
43
43
|
/*!
|
44
44
|
* @revues/hyext-adapter
|
45
45
|
* (c) 2024-2024 Alex
|
@@ -60,4 +60,4 @@ function(){var e;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._ori
|
|
60
60
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
61
61
|
PERFORMANCE OF THIS SOFTWARE.
|
62
62
|
***************************************************************************** */
|
63
|
-
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},t(e,n)},o=function(){return o=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},o.apply(this,arguments)};function r(e,n,t,o){return new(t||(t=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function c(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,c)}u((o=o.apply(e,n||[])).next())}))}function i(e,n){var t,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e],o=0}finally{t=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var a=function(){function e(){this._queue=[],this._queue=[]}return e.prototype.regist=function(e){this._queue.push(e)},e.prototype.start=function(e){this._queue.forEach((function(n){try{n.call(null,e)}catch(e){}}))},e}(),c=new a,u=[];function s(e){u.length>0&&(u.forEach((function(n){var t=e[n.method];t&&t.apply(e,n.args)})),u=[])}var l=function(){function e(){}return e.init=function(e){this.logger=e},e.log=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).log.apply(e,n)):u.push({method:"log",args:n})},e.info=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).info.apply(e,n)):u.push({method:"info",args:n})},e.warn=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).warn.apply(e,n)):u.push({method:"warn",args:n})},e.error=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).error.apply(e,n)):u.push({method:"error",args:n})},e}();function d(e,n){return function(e,n){var t=e,o=0;if(t){for(;o<n.length;){if(!(t=t[n[o]]))return;o++}return t}}(e,n.split("."))}function f(e){return e&&"function"==typeof e.then}function p(e){var n=e.SDK,t=e.path;return function(e){var n=e.fun,t=e.genFun,o=e.sync,r=e.onCall,i=e.onSucc,a=e.onFail,c=e.onComplete;return function(){for(var e=[],u=0;u<arguments.length;u++)e[u]=arguments[u];var s=("object"==typeof e[0]?e[0]:{})||{},l=s.success,d=s.fail,p=s.complete,v=function(){c&&c(),p&&p()},h=function(e){return i&&i(e),l&&l(e),e},g=function(e){var n=a&&a(e)||e;return d&&d(n),n},m=function(){r&&r(e);var o=t&&t()||n;if(!o)throw new Error("polyfill caller is undefined");return o.apply(null,e)};if(o)try{var w=h(m());return v(),w}catch(e){var y=g(e);throw v(),y}return new Promise((function(e,n){try{var t=m();f(t)?t.then((function(n){return e(h(n))})).catch((function(e){return n(g(e))})).finally(v):(e(h(t)),v())}catch(e){n(g(e)),v()}}))}}({genFun:function(){var e=d(n,t);if(!e)throw new Error("SDK."+t+" is undefined");return e},sync:e.sync,onCall:e.onCall,onSucc:e.onSucc,onFail:e.onFail,onComplete:e.onComplete})}function v(e,n,t){return Object.defineProperty(e,n,{enumerable:!0,configurable:!1,writable:!0,value:t})}var h,g=function(e){var n=e.SDK,t=e.onFail,o=e.onCall,r=e.onSucc,i={},a=function(e,a){e&&e.length&&e.forEach((function(e){var c=e.split(".").pop();if(c)switch(a){case"consts":var u=d(n,e);u&&v(i,c,u);break;case"async":case"sync":var s=p({SDK:n,sync:"sync"===a,path:e,onCall:function(n){return o&&o(n,c,e)},onSucc:function(n){return r&&r(n,c,e)},onFail:function(n){return t&&t(n,c,e)}});v(i,c,s)}}))};return a(e.constants,"consts"),a(e.methods,"async"),a(e.syncMethods,"sync"),l.log("[hyext adapter] polyfillSDK",i),i}({SDK:hyExt,constants:["consts"],methods:["request","panel.disposal","context.login","context.checkSession","device.setOrientation","device.onOrientationChange","device.offOrientationChange","ad.createAd","ad.loadAd","ad.showAd","ad.destroyAd","ad.onAdMessage","ad.offAdMessage","context.requestPayment","fs.downloadFile","fs.access","fs.appendFile","fs.close","fs.copyFile","fs.getFileInfo","fs.getSavedFileList","fs.mkdir","fs.open","fs.read","fs.readCompressedFile","fs.readdir","fs.readFile","fs.readZipEntry","fs.unzip","fs.removeSavedFile","fs.rename","fs.rmdir","fs.saveFile","fs.stat","fs.truncate","fs.unlink","fs.write","fs.writeFile","fs.fstat","fs.ftruncate","ui.showNativeInputBar","advance.getCurrentUserInfo","onEnterForeground","onLeaveForeground","onAppear","onDisappear","device.lockOrientation","ui.showKeyboard","ui.hideKeyboard","ui.updateKeyboard","ui.onKeyboardInput","ui.onKeyboardConfirm","ui.onKeyboardComplete","ui.onKeyboardHeightChange"],syncMethods:["device.getWindowInfo","fs.accessSync","fs.appendFileSync","fs.closeSync","fs.copyFileSync","fs.mkdirSync","fs.openSync","fs.readSync","fs.readCompressedFileSync","fs.readdirSync","fs.readFileSync","fs.renameSync","fs.rmdirSync","fs.saveFileSync","fs.statSync","fs.truncateSync","fs.unlinkSync","fs.writeSync","fs.writeFileSync","fs.fstatSync","fs.ftruncateSync"],onCall:function(e,n,t){l.log("[Polyfill] call "+t+" start:",e)},onSucc:function(e,n,t){l.log("[Polyfill] call "+t+" succ:",e)},onFail:function(e,n,t){l.info("[Polyfill] call "+t+" fail:",e)}});!function(e){e.onLoad="onLoad",e.onClose="onClose",e.onError="onError"}(h||(h={}));var m=new(function(){function e(){this.events={},this.invoked=!1}return e.prototype.invoke=function(){var e=this;this.invoked||(g.onAdMessage({callback:function(n){var t=n.instanceId,o=n.eventName,r=n.res;e.emit(t,o,r)}}),this.invoked=!0)},e.prototype.clear=function(){g.offAdMessage(),Object.values(this.events).forEach((function(e){return e.removeAllListeners()})),this.events={},this.invoked=!1},e.prototype.create=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.createAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.show=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.showAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.load=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.loadAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.destroy=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.destroyAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.emit=function(e,n,t){this.events[e]&&n&&this.events[e].emit(n,t)},e.prototype.on=function(e,t,o){this.events[e]||(this.events[e]=new n.EventEmitter),this.events[e].on(t,o)},e.prototype.off=function(e,n,t){this.events[e]&&(n?t?this.events[e].off(n,t):this.events[e].removeAllListeners(n):this.events[e].removeAllListeners())},e}()),w=function(){function e(e){var n,t,o;m.invoke(),this._getInstance=(n=function(){return m.create(e)},o=!1,function(){for(var e=this,a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return o?t:(o=!0,t=r(e,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,n.apply(void 0,a)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return[2]}}))})))})}return e.prototype.show=function(){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.show({instanceId:e})]}}))}))},e.prototype.load=function(){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.load({instanceId:e})]}}))}))},e.prototype.destroy=function(){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,m.off(e),[2,m.destroy({instanceId:e})]}}))}))},e.prototype.onLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.onClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onClose,e)})).catch((function(e){}))},e.prototype.onError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onError,e)})).catch((function(e){}))},e.prototype.offLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.offClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onClose,e)})).catch((function(e){}))},e.prototype.offError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onError,e)})).catch((function(e){}))},e}(),y=new(function(){function e(){this.isLandscape=!1}return e.prototype.changeOrientation=function(e){this.isLandscape=e},e.prototype.getWindowInfo=function(){try{var e=g.getWindowInfo();return l.info("getWindowInfo sync",e),e}catch(e){var n=Object.assign({safeArea:{left:0,right:0,top:0,bottom:0,width:0,height:0}},g.consts||{});return this.isLandscape?o(o({},n),{screenWidth:n.screenHeight,screenHeight:n.screenWidth,windowWidth:n.windowHeight,windowHeight:n.windowWidth,isLandscape:!0}):(n.isLandscape=!1,l.info("getWindowInfo consts",n),n)}},e}());c.regist((function(e){var n,t=e.emitter;n=window.navigator.userAgent.toLowerCase(),(/(iphone|ipad)/.test(n)||/android/.test(n))&&(l.log("[hyext adapter] device init"),g.onOrientationChange({callback:function(e){t({event:"onDeviceOrientationChange",data:e}),y.changeOrientation("landscape"===e.value)}}))}));var b={fn:function(e){return r(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n=e.defaultValue,e.maxLength,e.multiple,e.confirmHold,e.confirmType,[4,g.showNativeInputBar({text:n,btnText:"确认"})];case 1:return[2,t.sent()]}}))}))},onAfterSuccess:function(e,n){e._dispatchServiceEvent("onKeyboardInput",{value:n.text}),"mask"===n.from?e._dispatchServiceEvent("onKeyboardComplete",{value:n.text}):e._dispatchServiceEvent("onKeyboardConfirm",{value:n.text})}},_=function(){return r(void 0,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,g.getCurrentUserInfo()];case 1:return[2,{userInfo:{nickName:(e=n.sent()).name,avatarUrl:e.avatarUrl},rawData:"",signature:"",encryptedData:"",iv:"",cloudID:""}]}}))}))},x={webapi_getuserinfo:function(e){return _()}};c.regist((function(e){var n=e.emitter;l.log("[hyext adapter] app event init"),g.onEnterForeground((function(){n({event:"onAppEnterForeground",data:{}})})),g.onAppear((function(){n({event:"onAppShow",data:{}})})),g.onDisappear((function(){n({event:"onAppHide",data:{}})}))}));var A,k=Object.freeze({__proto__:null,createRewardedVideoAd:function(e){return new w(e)},createInterstitialAd:function(e){return new w(e)},setDeviceOrientation:function(e){var n=e||{},t=n.value,o=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}(n,["value"]);return o.orientation=t,g.setOrientation(o)},onDeviceOrientationChange:function(e){return g.onOrientationChange({callback:e})},offDeviceOrientationChange:function(e){return g.offOrientationChange()},getWindowInfo:function(){return y.getWindowInfo()},downloadFile:function(e){return r(this,void 0,void 0,(function(){var n,t,o,r,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),console.time("downloadFile url:"+e.url+",耗时:"),[4,g.downloadFile(e)];case 1:return n=i.sent(),console.timeEnd("downloadFile url:"+e.url+",耗时:"),o=(t=n||{}).tempFilePath,(r=t.filePath)||o?[2,{profile:{},statusCode:200,tempFilePath:o,filePath:r}]:[2,n];case 2:throw a=i.sent(),console.timeEnd("downloadFile url:"+e.url+"error:"+a.message),a;case 3:return[2]}}))}))},access:function(e){return g.access(e)},accessSync:function(e){return g.accessSync(e)},appendFile:function(e){return g.appendFile(e)},appendFileSync:function(e){return g.appendFileSync(e)},close:function(e){return g.close(e)},closeSync:function(e){return g.closeSync(e)},copyFile:function(e){return g.copyFile(e)},copyFileSync:function(e){return g.copyFileSync(e)},getFileInfo:function(e){return g.getFileInfo(e)},getSavedFileList:function(){return g.getSavedFileList()},mkdir:function(e){return g.mkdir(e)},mkdirSync:function(e){return g.mkdirSync(e)},open:function(e){return g.open(e)},openSync:function(e){return{data:g.openSync(e).fd}},read:function(e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,g.read(e)];case 1:return(n=t.sent()).arrayBuffer=n.originData,[2,n]}}))}))},readSync:function(e){var n=g.readSync(e);return n.arrayBuffer=n.originData,{data:n}},readCompressedFile:function(e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,g.readCompressedFile(e)];case 1:return[2,{data:(n=t.sent()).originData||n.data}]}}))}))},readCompressedFileSync:function(e){var n=g.readCompressedFileSync(e);return{data:n.originData||n.data}},readdir:function(e){return g.readdir(e)},readdirSync:function(e){return{data:g.readdirSync(e).files}},readFile:function(e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,g.readFile(e)];case 1:return(n=t.sent()).data=n.originData||n.data,[2,n]}}))}))},readFileSync:function(e){var n=g.readFileSync(e);return{data:n.originData||n.data}},readZipEntry:function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.readZipEntry(e)];case 1:return[2,n.sent()]}}))}))},unzip:function(e){return g.unzip(e)},removeSavedFile:function(e){return g.removeSavedFile(e)},rename:function(e){return g.rename(e)},renameSync:function(e){return g.renameSync(e)},rmdir:function(e){return g.rmdir(e)},rmdirSync:function(e){return g.rmdirSync(e)},saveFile:function(e){return g.saveFile(e)},saveFileSync:function(e){return{data:g.saveFileSync(e).savedFilePath}},stat:function(e){return g.stat(e)},statSync:function(e){return{data:g.statSync(e).stats}},truncate:function(e){return g.truncate(e)},truncateSync:function(e){return g.truncateSync(e)},unlink:function(e){return g.unlink(e)},unlinkSync:function(e){return g.unlinkSync(e)},write:function(e){return g.write(e)},writeSync:function(e){return{data:g.writeSync(e).bytesWritten}},writeFile:function(e){return g.writeFile(e)},writeFileSync:function(e){return g.writeFileSync(e)},fstat:function(e){return g.fstat(e)},fstatSync:function(e){return{data:g.fstatSync(e).stats}},ftruncate:function(e){return g.ftruncate(e)},ftruncateSync:function(e){return g.ftruncateSync(e)},exitMiniProgram:function(e){return g.disposal(e)},showGameKeyboard:b,hideGameKeyboard:function(){},updateGameKeyboard:function(e){},login:function(e){return g.login(e)},checkSession:function(e){return g.checkSession(e)},request:function(e){var n=e.data,t=e.dataType,o=e.header,r=e.method,i=e.url;return g.request({url:i,method:r,data:n,dataType:t,header:o})},getUserProfile:_,operateWXData:function(e){return r(this,void 0,void 0,(function(){var n,t,o,r;return i(this,(function(i){switch(i.label){case 0:return n=e.data,t=n.api_name,o=n.data,null==(r=x[t])?[3,2]:[4,r(o)];case 1:return[2,i.sent()];case 2:throw new Error("operateWXData:fail sdk not support "+t+" api.")}}))}))}}),S=(A={},function(e){var n=A[e];return null!=n?n:(n=function(e){var n=d(k,e);return n||g[e]||void 0}(e),A[e]=n)}),I=["enablePullDownRefresh","disablePullDownRefresh"];function C(e){var n=e.CoreAdapter,r=e.logger,i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(n,e),n.prototype.init=function(){var n=this;e.prototype.init.call(this),function(e,n){c.start(e),l.init(n)}({emitter:function(e){var t=e.event,o=e.data;r.debug("[hyext adapter] emit "+t,o),n._dispatchServiceEvent(t,o),n.$events.emit(t,o)}},r)},n.prototype.invokeHandler=function(e){var n=this,t=e.apiName,i=e.params,a=e.callbackId;if(!(I.indexOf(t)>-1)){r.debug("[hyext adapter] hyext call "+t,i);var c=function(e,n,t,r){try{var i=S(n);if(!i)throw new Error("The SDK API of "+n+" is not support yet.");var a=("function"==typeof i?i:i.fn).apply(null,t);if(!f(a))return a;a.then((function(t){r(o(o({},t||{}),{errMsg:n+":ok"})),i.onAfterSuccess&&i.onAfterSuccess(e,t)})).catch((function(t){t&&t.isCancel?(r({errMsg:n+":cancel"}),i.onAfterCancel&&i.onAfterCancel(e,t)):(r({errMsg:n+":fail "+t.message}),i.onAfterFail&&i.onAfterFail(e,t))}))}catch(e){return{errMsg:n+":fail "+e.message}}}(this,t,[i],(function(e){return r.debug("[hyext adapter] hyext callback "+t,e),n._invokeServiceCallbackHandler(a,e,t)}));return null!=c&&r.debug("[hyext adapter] hyext sync response "+t,c),c}},n.prototype.publishHandler=function(e){e.event,e.params,e.from,e.formatedEvent},n}(n);(new i).init()}window.__initAdapter=C,e.init=C,Object.defineProperty(e,"__esModule",{value:!0})}(n,t.default)}));window.addEventListener("message",(function(e){var n=e.data;if("object"==typeof n&&null!==n)switch(n.type){case"publish":X(n.event,JSON.parse(n.paramsString));break;case"invoke":return xn.invokeHandler(n)}})),window.addEventListener("resize",(function(){X("onWindowResize",{size:{windowWidth:window.innerWidth,windowHeight:window.innerHeight}})})),window.FinChatJSCore=xn,Bn.init({CoreAdapter:En,logger:k}),window.addEventListener("DOMContentLoaded",(function(){var e;e={windowInfo:bn.getWindowInfo(),extInfo:y()},void 0!==window.__initWebFrameOnContentLoad&&(Ce(),window.__initWebFrameOnContentLoad(e,Ie),_()&&ne().$events.on("onDeviceOrientationChange",(function(e){Ie.emit("onDeviceOrientationChange",e)})))}))}));
|
63
|
+
var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=n[t])},t(e,n)},o=function(){return o=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e},o.apply(this,arguments)};function r(e,n,t,o){return new(t||(t=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function c(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,c)}u((o=o.apply(e,n||[])).next())}))}function i(e,n){var t,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;a;)try{if(t=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=n.call(e,a)}catch(e){i=[6,e],o=0}finally{t=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var a=function(){function e(){this._queue=[],this._queue=[]}return e.prototype.regist=function(e){this._queue.push(e)},e.prototype.start=function(e){this._queue.forEach((function(n){try{n.call(null,e)}catch(e){}}))},e}(),c=new a,u=[];function s(e){u.length>0&&(u.forEach((function(n){var t=e[n.method];t&&t.apply(e,n.args)})),u=[])}var l=function(){function e(){}return e.init=function(e){this.logger=e},e.log=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).log.apply(e,n)):u.push({method:"log",args:n})},e.info=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).info.apply(e,n)):u.push({method:"info",args:n})},e.warn=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).warn.apply(e,n)):u.push({method:"warn",args:n})},e.error=function(){for(var e,n=[],t=0;t<arguments.length;t++)n[t]=arguments[t];this.logger?(s(this.logger),(e=this.logger).error.apply(e,n)):u.push({method:"error",args:n})},e}();function d(e,n){return function(e,n){var t=e,o=0;if(t){for(;o<n.length;){if(!(t=t[n[o]]))return;o++}return t}}(e,n.split("."))}function f(e){return e&&"function"==typeof e.then}function p(e){var n=e.SDK,t=e.path;return function(e){var n=e.fun,t=e.genFun,o=e.sync,r=e.onCall,i=e.onSucc,a=e.onFail,c=e.onComplete;return function(){for(var e=[],u=0;u<arguments.length;u++)e[u]=arguments[u];var s=("object"==typeof e[0]?e[0]:{})||{},l=s.success,d=s.fail,p=s.complete,v=function(){c&&c(),p&&p()},h=function(e){return i&&i(e),l&&l(e),e},g=function(e){var n=a&&a(e)||e;return d&&d(n),n},m=function(){r&&r(e);var o=t&&t()||n;if(!o)throw new Error("polyfill caller is undefined");return o.apply(null,e)};if(o)try{var w=h(m());return v(),w}catch(e){var y=g(e);throw v(),y}return new Promise((function(e,n){try{var t=m();f(t)?t.then((function(n){return e(h(n))})).catch((function(e){return n(g(e))})).finally(v):(e(h(t)),v())}catch(e){n(g(e)),v()}}))}}({genFun:function(){var e=d(n,t);if(!e)throw new Error("SDK."+t+" is undefined");return e},sync:e.sync,onCall:e.onCall,onSucc:e.onSucc,onFail:e.onFail,onComplete:e.onComplete})}function v(e,n,t){return Object.defineProperty(e,n,{enumerable:!0,configurable:!1,writable:!0,value:t})}var h,g=function(e){var n=e.SDK,t=e.onFail,o=e.onCall,r=e.onSucc,i={},a=function(e,a){e&&e.length&&e.forEach((function(e){var c=e.split(".").pop();if(c)switch(a){case"consts":var u=d(n,e);u&&v(i,c,u);break;case"async":case"sync":var s=p({SDK:n,sync:"sync"===a,path:e,onCall:function(n){return o&&o(n,c,e)},onSucc:function(n){return r&&r(n,c,e)},onFail:function(n){return t&&t(n,c,e)}});v(i,c,s)}}))};return a(e.constants,"consts"),a(e.methods,"async"),a(e.syncMethods,"sync"),l.log("[hyext adapter] polyfillSDK",i),i}({SDK:hyExt,constants:["consts"],methods:["request","panel.disposal","context.login","context.checkSession","device.setOrientation","device.onOrientationChange","device.offOrientationChange","ad.createAd","ad.loadAd","ad.showAd","ad.destroyAd","ad.onAdMessage","ad.offAdMessage","context.requestPayment","fs.downloadFile","fs.access","fs.appendFile","fs.close","fs.copyFile","fs.getFileInfo","fs.getSavedFileList","fs.mkdir","fs.open","fs.read","fs.readCompressedFile","fs.readdir","fs.readFile","fs.readZipEntry","fs.unzip","fs.removeSavedFile","fs.rename","fs.rmdir","fs.saveFile","fs.stat","fs.truncate","fs.unlink","fs.write","fs.writeFile","fs.fstat","fs.ftruncate","ui.showNativeInputBar","advance.getCurrentUserInfo","onEnterForeground","onLeaveForeground","onAppear","onDisappear","device.lockOrientation","ui.showKeyboard","ui.hideKeyboard","ui.updateKeyboard","ui.onKeyboardInput","ui.onKeyboardConfirm","ui.onKeyboardComplete","ui.onKeyboardHeightChange"],syncMethods:["device.getWindowInfo","fs.accessSync","fs.appendFileSync","fs.closeSync","fs.copyFileSync","fs.mkdirSync","fs.openSync","fs.readSync","fs.readCompressedFileSync","fs.readdirSync","fs.readFileSync","fs.renameSync","fs.rmdirSync","fs.saveFileSync","fs.statSync","fs.truncateSync","fs.unlinkSync","fs.writeSync","fs.writeFileSync","fs.fstatSync","fs.ftruncateSync"],onCall:function(e,n,t){l.log("[Polyfill] call "+t+" start:",e)},onSucc:function(e,n,t){l.log("[Polyfill] call "+t+" succ:",e)},onFail:function(e,n,t){l.info("[Polyfill] call "+t+" fail:",e)}});!function(e){e.onLoad="onLoad",e.onClose="onClose",e.onError="onError"}(h||(h={}));var m=new(function(){function e(){this.events={},this.invoked=!1}return e.prototype.invoke=function(){var e=this;this.invoked||(g.onAdMessage({callback:function(n){var t=n.instanceId,o=n.eventName,r=n.res;e.emit(t,o,r)}}),this.invoked=!0)},e.prototype.clear=function(){g.offAdMessage(),Object.values(this.events).forEach((function(e){return e.removeAllListeners()})),this.events={},this.invoked=!1},e.prototype.create=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.createAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.show=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.showAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.load=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.loadAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.destroy=function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.destroyAd(e)];case 1:return[2,n.sent()]}}))}))},e.prototype.emit=function(e,n,t){this.events[e]&&n&&this.events[e].emit(n,t)},e.prototype.on=function(e,t,o){this.events[e]||(this.events[e]=new n.EventEmitter),this.events[e].on(t,o)},e.prototype.off=function(e,n,t){this.events[e]&&(n?t?this.events[e].off(n,t):this.events[e].removeAllListeners(n):this.events[e].removeAllListeners())},e}()),w=function(){function e(e){var n,t,o;m.invoke(),this._getInstance=(n=function(){return m.create(e)},o=!1,function(){for(var e=this,a=[],c=0;c<arguments.length;c++)a[c]=arguments[c];return o?t:(o=!0,t=r(e,void 0,void 0,(function(){return i(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,n.apply(void 0,a)];case 1:return[2,e.sent()];case 2:throw e.sent();case 3:return[2]}}))})))})}return e.prototype.show=function(){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.show({instanceId:e})]}}))}))},e.prototype.load=function(){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,[2,m.load({instanceId:e})]}}))}))},e.prototype.destroy=function(){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,this._getInstance()];case 1:return e=n.sent().instanceId,m.off(e),[2,m.destroy({instanceId:e})]}}))}))},e.prototype.onLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.onClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onClose,e)})).catch((function(e){}))},e.prototype.onError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.on(t,h.onError,e)})).catch((function(e){}))},e.prototype.offLoad=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onLoad,e)})).catch((function(e){}))},e.prototype.offClose=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onClose,e)})).catch((function(e){}))},e.prototype.offError=function(e){this._getInstance().then((function(n){var t=n.instanceId;m.off(t,h.onError,e)})).catch((function(e){}))},e}(),y=new(function(){function e(){this.isLandscape=!1}return e.prototype.changeOrientation=function(e){this.isLandscape=e},e.prototype.getWindowInfo=function(){try{var e=g.getWindowInfo();return l.info("getWindowInfo sync",e),e}catch(e){var n=Object.assign({safeArea:{left:0,right:0,top:0,bottom:0,width:0,height:0}},g.consts||{});return this.isLandscape?o(o({},n),{screenWidth:n.screenHeight,screenHeight:n.screenWidth,windowWidth:n.windowHeight,windowHeight:n.windowWidth,isLandscape:!0}):(n.isLandscape=!1,l.info("getWindowInfo consts",n),n)}},e}());c.regist((function(e){var n,t=e.emitter;n=window.navigator.userAgent.toLowerCase(),(/(iphone|ipad)/.test(n)||/android/.test(n))&&(l.log("[hyext adapter] device init"),g.onOrientationChange({callback:function(e){t({event:"onDeviceOrientationChange",data:e}),y.changeOrientation("landscape"===e.value)}}))}));var b={fn:function(e){return r(void 0,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return n=e.defaultValue,e.maxLength,e.multiple,e.confirmHold,e.confirmType,[4,g.showNativeInputBar({text:n,btnText:"确认"})];case 1:return[2,t.sent()]}}))}))},onAfterSuccess:function(e,n){e._dispatchServiceEvent("onKeyboardInput",{value:n.text}),"mask"===n.from?e._dispatchServiceEvent("onKeyboardComplete",{value:n.text}):e._dispatchServiceEvent("onKeyboardConfirm",{value:n.text})}},_=function(){return r(void 0,void 0,void 0,(function(){var e;return i(this,(function(n){switch(n.label){case 0:return[4,g.getCurrentUserInfo()];case 1:return[2,{userInfo:{nickName:(e=n.sent()).name,avatarUrl:e.avatarUrl},rawData:"",signature:"",encryptedData:"",iv:"",cloudID:""}]}}))}))},x={webapi_getuserinfo:function(e){return _()}};c.regist((function(e){var n=e.emitter;l.log("[hyext adapter] app event init"),g.onEnterForeground((function(){n({event:"onAppEnterForeground",data:{}})})),g.onAppear((function(){n({event:"onAppShow",data:{}})})),g.onDisappear((function(){n({event:"onAppHide",data:{}})}))}));var A,k=Object.freeze({__proto__:null,createRewardedVideoAd:function(e){return new w(e)},createInterstitialAd:function(e){return new w(e)},setDeviceOrientation:function(e){var n=e||{},t=n.value,o=function(e,n){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&n.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)n.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(t[o[r]]=e[o[r]])}return t}(n,["value"]);return o.orientation=t,g.setOrientation(o)},onDeviceOrientationChange:function(e){return g.onOrientationChange({callback:e})},offDeviceOrientationChange:function(e){return g.offOrientationChange()},getWindowInfo:function(){return y.getWindowInfo()},downloadFile:function(e){return r(this,void 0,void 0,(function(){var n,t,o,r,a;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),console.time("downloadFile url:"+e.url+",耗时:"),[4,g.downloadFile(e)];case 1:return n=i.sent(),console.timeEnd("downloadFile url:"+e.url+",耗时:"),o=(t=n||{}).tempFilePath,(r=t.filePath)||o?[2,{profile:{},statusCode:200,tempFilePath:o,filePath:r}]:[2,n];case 2:throw a=i.sent(),console.timeEnd("downloadFile url:"+e.url+"error:"+a.message),a;case 3:return[2]}}))}))},access:function(e){return g.access(e)},accessSync:function(e){return g.accessSync(e)},appendFile:function(e){return g.appendFile(e)},appendFileSync:function(e){return g.appendFileSync(e)},close:function(e){return g.close(e)},closeSync:function(e){return g.closeSync(e)},copyFile:function(e){return g.copyFile(e)},copyFileSync:function(e){return g.copyFileSync(e)},getFileInfo:function(e){return g.getFileInfo(e)},getSavedFileList:function(){return g.getSavedFileList()},mkdir:function(e){return g.mkdir(e)},mkdirSync:function(e){return g.mkdirSync(e)},open:function(e){return g.open(e)},openSync:function(e){return{data:g.openSync(e).fd}},read:function(e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,g.read(e)];case 1:return(n=t.sent()).arrayBuffer=n.originData,[2,n]}}))}))},readSync:function(e){var n=g.readSync(e);return n.arrayBuffer=n.originData,{data:n}},readCompressedFile:function(e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,g.readCompressedFile(e)];case 1:return[2,{data:(n=t.sent()).originData||n.data}]}}))}))},readCompressedFileSync:function(e){var n=g.readCompressedFileSync(e);return{data:n.originData||n.data}},readdir:function(e){return g.readdir(e)},readdirSync:function(e){return{data:g.readdirSync(e).files}},readFile:function(e){return r(this,void 0,void 0,(function(){var n;return i(this,(function(t){switch(t.label){case 0:return[4,g.readFile(e)];case 1:return(n=t.sent()).data=n.originData||n.data,[2,n]}}))}))},readFileSync:function(e){var n=g.readFileSync(e);return{data:n.originData||n.data}},readZipEntry:function(e){return r(this,void 0,void 0,(function(){return i(this,(function(n){switch(n.label){case 0:return[4,g.readZipEntry(e)];case 1:return[2,n.sent()]}}))}))},unzip:function(e){return g.unzip(e)},removeSavedFile:function(e){return g.removeSavedFile(e)},rename:function(e){return g.rename(e)},renameSync:function(e){return g.renameSync(e)},rmdir:function(e){return g.rmdir(e)},rmdirSync:function(e){return g.rmdirSync(e)},saveFile:function(e){return g.saveFile(e)},saveFileSync:function(e){return{data:g.saveFileSync(e).savedFilePath}},stat:function(e){return g.stat(e)},statSync:function(e){return{data:g.statSync(e).stats}},truncate:function(e){return g.truncate(e)},truncateSync:function(e){return g.truncateSync(e)},unlink:function(e){return g.unlink(e)},unlinkSync:function(e){return g.unlinkSync(e)},write:function(e){return g.write(e)},writeSync:function(e){return{data:g.writeSync(e).bytesWritten}},writeFile:function(e){return g.writeFile(e)},writeFileSync:function(e){return g.writeFileSync(e)},fstat:function(e){return g.fstat(e)},fstatSync:function(e){return{data:g.fstatSync(e).stats}},ftruncate:function(e){return g.ftruncate(e)},ftruncateSync:function(e){return g.ftruncateSync(e)},exitMiniProgram:function(e){return g.disposal(e)},showGameKeyboard:b,hideGameKeyboard:function(){},updateGameKeyboard:function(e){},login:function(e){return g.login(e)},checkSession:function(e){return g.checkSession(e)},request:function(e){var n=e.data,t=e.dataType,o=e.header,r=e.method,i=e.url;return g.request({url:i,method:r,data:n,dataType:t,header:o})},getUserProfile:_,operateWXData:function(e){return r(this,void 0,void 0,(function(){var n,t,o,r;return i(this,(function(i){switch(i.label){case 0:return n=e.data,t=n.api_name,o=n.data,null==(r=x[t])?[3,2]:[4,r(o)];case 1:return[2,i.sent()];case 2:throw new Error("operateWXData:fail sdk not support "+t+" api.")}}))}))}}),S=(A={},function(e){var n=A[e];return null!=n?n:(n=function(e){var n=d(k,e);return n||g[e]||void 0}(e),A[e]=n)}),I=["enablePullDownRefresh","disablePullDownRefresh"];function C(e){var n=e.CoreAdapter,r=e.logger,i=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}(n,e),n.prototype.init=function(){var n=this;e.prototype.init.call(this),function(e,n){c.start(e),l.init(n)}({emitter:function(e){var t=e.event,o=e.data;r.debug("[hyext adapter] emit "+t,o),n._dispatchServiceEvent(t,o),n.$events.emit(t,o)}},r)},n.prototype.invokeHandler=function(e){var n=this,t=e.apiName,i=e.params,a=e.callbackId;if(!(I.indexOf(t)>-1)){r.debug("[hyext adapter] hyext call "+t,i);var c=function(e,n,t,r){try{var i=S(n);if(!i)throw new Error("The SDK API of "+n+" is not support yet.");var a=("function"==typeof i?i:i.fn).apply(null,t);if(!f(a))return a;a.then((function(t){r(o(o({},t||{}),{errMsg:n+":ok"})),i.onAfterSuccess&&i.onAfterSuccess(e,t)})).catch((function(t){t&&t.isCancel?(r({errMsg:n+":cancel"}),i.onAfterCancel&&i.onAfterCancel(e,t)):(r({errMsg:n+":fail "+t.message}),i.onAfterFail&&i.onAfterFail(e,t))}))}catch(e){return{errMsg:n+":fail "+e.message}}}(this,t,[i],(function(e){return r.debug("[hyext adapter] hyext callback "+t,e),n._invokeServiceCallbackHandler(a,e,t)}));return null!=c&&r.debug("[hyext adapter] hyext sync response "+t,c),c}},n.prototype.publishHandler=function(e){e.event,e.params,e.from,e.formatedEvent},n}(n);(new i).init()}window.__initAdapter=C,e.init=C,Object.defineProperty(e,"__esModule",{value:!0})}(n,t.default)}));function On(e){"miniProgram"===y().projectType&&ln.init(e)}var Ln=!1,Fn=!1;window.addEventListener("message",(function(e){var n=e.data;if("object"==typeof n&&null!==n)switch(n.type){case"publish":X(n.event,JSON.parse(n.paramsString));break;case"invoke":return xn.invokeHandler(n)}})),window.addEventListener("resize",(function(){X("onWindowResize",{size:{windowWidth:window.innerWidth,windowHeight:window.innerHeight}})})),window.FinChatJSCore=xn,Bn.init({CoreAdapter:En,logger:k}),window.addEventListener("DOMContentLoaded",(function(){var e;e={windowInfo:bn.getWindowInfo(),extInfo:y()},void 0!==window.__initWebFrameOnContentLoad&&(Ce(),window.__initWebFrameOnContentLoad(e,Ie),_()&&ne().$events.on("onDeviceOrientationChange",(function(e){Ie.emit("onDeviceOrientationChange",e)})))})),window.__handlePreloadLinkAllLoaded=function(){Fn=!0,Ln&&On("preloadReady")},window.addEventListener("DOMContentLoaded",(function(){Ln=!0,(Fn||window.__preloadSuccess)&&On("DOMContentLoaded")})),window.addEventListener("load",(function(){On("windowLoadReady")}))}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@revues/web-sdk-core",
|
3
|
-
"version": "1.2.2-alpha.
|
3
|
+
"version": "1.2.2-alpha.4",
|
4
4
|
"description": "> TODO: description",
|
5
5
|
"author": "loler",
|
6
6
|
"homepage": "",
|
@@ -23,13 +23,13 @@
|
|
23
23
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@revues/hyext-adapter": "1.2.2-alpha.
|
27
|
-
"@revues/web-frame": "1.2.2-alpha.
|
26
|
+
"@revues/hyext-adapter": "1.2.2-alpha.4",
|
27
|
+
"@revues/web-frame": "1.2.2-alpha.4",
|
28
28
|
"eventemitter3": "^5.0.1",
|
29
29
|
"howler": "^2.2.4"
|
30
30
|
},
|
31
31
|
"devDependencies": {
|
32
32
|
"@types/howler": "^2.2.11"
|
33
33
|
},
|
34
|
-
"gitHead": "
|
34
|
+
"gitHead": "cad331baba30c4f196f8e6425ad0bc0154cbd02c"
|
35
35
|
}
|