@revues/web-sdk-core 1.2.1-alpha.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/web-sdk-core.js +3 -3
- package/package.json +4 -4
package/dist/web-sdk-core.js
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
18
18
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
19
19
|
PERFORMANCE OF THIS SOFTWARE.
|
20
|
-
***************************************************************************** */function c(e,n){function t(){this.constructor=e}a(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var u=function(){return u=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},u.apply(this,arguments)};function s(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 l(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=a.trys,(r=r.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])}}}function d(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var o=Array(e),r=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,c=i.length;a<c;a++,r++)o[r]=i[a];return o}function f(){var e=window.navigator.userAgent.toLowerCase();return/(iphone|ipad)/.test(e)?"IOS":/android/.test(e)?"Android":"Windows For HUYA"}function p(){var e=f();return"IOS"===e||"Android"===e}function v(e){var n=e.split("?"),t=n[0],o=n[1],r={};return null!=o&&""!==o&&o.split("&").reduce((function(e,n){var t=n.split("=");return e[t[0]]=decodeURIComponent(t[1]),e}),r),{path:t,query:r}}function h(e){for(var n="",t=new Uint8Array(e),o=t.byteLength,r=0;r<o;r++)n+=String.fromCharCode(t[r]);return window.btoa(n)}var g=function(e,n,t){var o,r=new Promise((function(n,r){o=setTimeout((function(){t&&t(e),r(new Error("Timed out in "+e+"ms."))}),e)}));return new Promise((function(e,t){Promise.race([n,r]).then((function(n){clearTimeout(o),e(n)})).catch(t)}))};var m,w=function(e){return 1===String(e).length?"0"+e:e};function y(){return window.__extInfo||{}}function b(){return y().extUuid}function _(){var e=y().extType||"";return/\_inner\_/gi.test(e)}
|
20
|
+
***************************************************************************** */function c(e,n){function t(){this.constructor=e}a(e,n),e.prototype=null===n?Object.create(n):(t.prototype=n.prototype,new t)}var u=function(){return u=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},u.apply(this,arguments)};function s(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 l(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=a.trys,(r=r.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])}}}function d(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var o=Array(e),r=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,c=i.length;a<c;a++,r++)o[r]=i[a];return o}function f(){var e=window.navigator.userAgent.toLowerCase();return/(iphone|ipad)/.test(e)?"IOS":/android/.test(e)?"Android":"Windows For HUYA"}function p(){var e=f();return"IOS"===e||"Android"===e}function v(e){var n=e.split("?"),t=n[0],o=n[1],r={};return null!=o&&""!==o&&o.split("&").reduce((function(e,n){var t=n.split("=");return e[t[0]]=decodeURIComponent(t[1]),e}),r),{path:t,query:r}}function h(e){for(var n="",t=new Uint8Array(e),o=t.byteLength,r=0;r<o;r++)n+=String.fromCharCode(t[r]);return window.btoa(n)}var g=function(e,n,t){var o,r=new Promise((function(n,r){o=setTimeout((function(){t&&t(e),r(new Error("Timed out in "+e+"ms."))}),e)}));return new Promise((function(e,t){Promise.race([n,r]).then((function(n){clearTimeout(o),e(n)})).catch(t)}))};var m,w=function(e){return 1===String(e).length?"0"+e:e};function y(){return window.__extInfo||{}}function b(){return y().extUuid}function _(){var e=y().extType||"";return/\_inner\_/gi.test(e)}!function(e){e[e.debug=0]="debug",e[e.log=1]="log",e[e.info=2]="info",e[e.warn=3]="warn",e[e.error=4]="error"}(m||(m={}));var x=Date.now();var A=function(){var e=localStorage.getItem("wsc_loglevel");if("string"==typeof e&&""!==e){var n=Number(e);if(!isNaN(n))return n}return null}(),k=function(e){var n=e.onBefore,t=e.onAfter,o=e.prefix,r=e.logColor,i=e.level,a=e.enableLog,c=Object.assign({info:"blue",warn:"orange",error:"red",log:"green",debug:"green"},r);function u(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];var r=e[0],c=e[1],u=e[2],l=e[3],d=s(),f={prefix:d,msg:c,data:u,desc:d+c};n&&n(f);var p=m[l]>=i;a(p)&&console.log("%c "+f.desc,"color: "+r+";",f.data),t&&t(f,p)}function s(){return"function"==typeof o?o():o||""}return{log:function(e,n){u(c.log,e,n,"log")},info:function(e,n){u(c.info,e,n,"info")},warn:function(e,n){u(c.warn,e,n,"warn")},error:function(e,n){u(c.error,e,n,"error")},debug:function(e,n){u(c.error,e,n,"debug")}}}({level:null!==A?A:m.info,onAfter:function(e,n){n&&null!=window.hyExt&&window.hyExt.logger.info(e.desc+" "+function(e){try{return JSON.stringify(e)}catch(e){return"stringify error"}}(e.data))},prefix:function(){return"web-sdk-core * date:"+(void 0===e&&(e=new Date),w(e.getHours())+":"+w(e.getMinutes())+":"+w(e.getSeconds())+" extName:")+y().extName+" extUuid:"+b()+" sessionId:"+x+" - ";var e},enableLog:function(e){return e}});var S,I,C=location.pathname.split("/"),T=C.slice(1,C.length-1),M=location.protocol+"//"+location.host+"/"+T.join("/")+"/",P=M+"view.html",E=window.__debug,B="service",O="view",L=window.__packageExtConfig,F={path:L?L.entryPagePath:"index",query:{},referrerInfo:{},scene:1001},R="onTaskProgressUpdate",H="onTaskHeadersReceived",D="miniGame",j="hyfile://",N="hyfile://",G=(S=v(location.href).query,I=y(),k.info("forceUsePatchApi",{fromQuery:S.forceUsePatchApi,fromLocal:I.forceUsePatchApi}),null!=S.forceUsePatchApi?"1"===S.forceUsePatchApi:null!=I.forceUsePatchApi&&I.forceUsePatchApi),W=function(){function e(e){this.sync=!1,this.events=new i,this.el=e,this.isReady=!1}return e.prototype.getWindow=function(){return this.el.contentWindow},e.prototype.getBridge=function(){},e.prototype.emitSync=function(e){for(var n,t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];this.sync=!0,(n=this.events).emit.apply(n,d([e],t)),this.sync=!1},e}(),$={onViewDOMContentLoaded:"onViewDOMContentLoaded",onInjectHTMLCallback:"onInjectHTMLCallback"},V={};var z=function(e){function n(n){return e.call(this,n)||this}return c(n,e),n.prototype.updateSrc=function(e){this.el.src=e},n.prototype.sendToSerivce=function(e,n,t){k.debug("%c "+e,{data:n,webviewId:t}),this.getBridge().subscribeHandler(e,n,t)},n.prototype.loadSubBundle=function(e,n){return s(this,void 0,void 0,(function(){var t=this;return l(this,(function(o){return[2,new Promise((function(o){if(!0!==V[e]){var r=t.getWindow();null!=r&&(t.events.once($.onInjectHTMLCallback,(function(){o()})),r.injectHtml(r.document.body,{content:'<script charset="utf-8" src="'+n+'"><\/script>'}),V[e]=!0)}}))]}))}))},n.prototype.invokeCallbackHandler=function(e,n,t){k.debug("%c "+(t||"API")+" call callback",{cbId:e,data:n}),this.getBridge().invokeCallbackHandler(e,n)},n.prototype.getBridge=function(){return this.getWindow().ServiceJSBridge},n}(W),q="webview-service",K=new Map;function U(e){var n=K.get(e);if(n)return n;var t=document.getElementById(e);if(null!=t){var o=new(e===q?z:Cn)(t);return K.set(e,o),o}throw new Error("获取IframeManager失败, id: "+e)}function Q(){return U("webview-first-view")}function J(){return U(q)}function Z(e,n,t){Pn.stack.forEach((function(o){null!=o.webviewId&&function(e,n){return 1===e.length&&e[0]===n.webviewId||e.indexOf(n.webviewId)>-1}(t,o)&&(o.isReady?o.sendToView(e,n):console.error("shouldn't exctute"))}))}function X(e,n,t){U(q).sendToSerivce(e,n,t)}function Y(e,n){var t,o=null===(t=Pn.currPage)||void 0===t?void 0:t.children;if(Array.isArray(o)&&o.length>0){var r=o[0];r&&r.isWebView&&r.postMessageToWebView({eventName:e,type:"subscribeHandler",params:n})}}var ee=null;function ne(){if(null==ee)throw new Error("AdapterTarget is not set yet.");return ee}var te="custom_event_";var oe=r((function(e,n){
|
21
21
|
/*!
|
22
22
|
* howler.js v2.2.4
|
23
23
|
* howlerjs.com
|
@@ -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 ie(e,n,t){Q(K).invokeCallbackHandler(e,n,t)}function ae(e,n,t){var o,r=null===(o=Bn.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 ce={},ue={};function se(e,n){var t=ce[e],o=ue[e];return null!=t?""!=n.src&&o!=n.src?(t.unload(),delete ce[e],delete ue[e],se(e,n)):t:(ue[e]=n.src,ce[e]=function(e,n){var t=new re.Howl({autoplay:e.autoplay,loop:e.loop,src:e.src,rate:e.playbackRate,onend:function(){Y(fe,{innerAudioContextId:n,method:de.onEnded,data:{}})},onplay:function(){Y(fe,{innerAudioContextId:n,method:de.onPlay,data:{buffered:0,currentTime:0,duration:0}})},onpause:function(e){Y(fe,{innerAudioContextId:e,method:de.onPause,data:{}})},onstop:function(){Y(fe,{innerAudioContextId:n,method:de.onStop,data:{}})},onseek:function(){Y(fe,{innerAudioContextId:n,method:de.onSeeked,data:{}})},onplayerror:function(e,n){Y(fe,{innerAudioContextId:e,method:de.onError,data:{errMsg:"播放失败 :"+n,errCode:-1}})},onloaderror:function(e,n){Y(fe,{innerAudioContextId:e,method:de.onError,data:{errMsg:"播放失败 :"+n,errCode:10002}})},onrate:function(e){console.log("audio进度改变")},onload:function(){Y(fe,{innerAudioContextId:n,method:de.onCanplay,data:{}})}});return t}(n,e))}function le(e,n,t){var o=ce[n];if(null==o){var r=e+":fail 无法找到innerAudioContextId:"+n+"对应的audio实例";throw ie(t,{errMsg:r}),new Error(r)}return o}re.Howler.autoSuspend=!1;var de={onCanplay:"onCanplay",onEnded:"onEnded",onError:"onError",onPause:"onPause",onPlay:"onPlay",onSeeked:"onSeeked",onSeeking:"onSeeking",onStop:"onStop",onTimeUpdate:"onTimeUpdate",onWaiting:"onWaiting"},fe="onInnerAudio";var pe={innerAudio:function(e,n){var t,o=e.method,r=e.data,i=e.innerAudioContextId;switch(o){case"create":break;case"play":(t=se(i,r)).loop(r.loop),t.volume(r.volume),r.isPlayMethod&&t.play();break;case"stop":le(o,i,n).stop();break;case"seek":(t=le(o,i,n)).seek(r.position);break;case"pause":le(o,i,n).pause();break;case"destroy":le(o,i,n).unload();break;default:throw new Error("无法处理音频method:"+o)}return{errMsg:"innerAudio:ok"}}};function ve(e){return/^http(s?)\:\/\//.test(e)}function he(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 ge={readFileSync:function(e){var n,t=e.filePath;if(t.startsWith(N))return{data:null,errMsg:"readFileSync:fail not support local file."};t=ve(t=(n=t).endsWith(".wasm")?n+".txt":n)?t:P+t;var o=null,r=null;return he(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=ve(t)?t:P+t;t.startsWith(N)?ie(n,{errMsg:"readFile:fail not support local file: "+t}):he(r,{responseType:o?"arraybuffer":""},(function(e,t){ie(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 Y(H,{cookies:[],progress:100,totalBytesExpectedToWrite:100,totalBytesWritten:100}),Y(D,{cookies:[],header:{}}),ie(t,{filePath:n,tempFilePath:n,profile:[],statusCode:200,errMsg:"downloadFile:ok"}),[2]}))}))}({url:t,callbackId:n}),(function(e){ie(n,{errMsg:"downloadFile:fail timeout in "+e+"ms."})}))},copyFile:function(e,n){return e.srcPath,e.destPath,ie(n,{errMsg:"copyFile:ok fake subpport."},"copyFile")}};function me(e){return te().invokeHandler({callbackId:e.callbackId||-1,apiName:e.apiName,params:e.params,from:"service"})}var we,ye,be,_e=W||x()?ge:(we=ge,ye={readFileSync:{onMobile:xe},readFile:{onMobile:xe},access:{onMobile:xe},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}}},be=ye||{},Object.keys(we).reduce((function(e,n){var t=we[n];return e[n]=function(){for(var e,o,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a=p(),c=be[n],u={callNativeApi:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return me({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 xe(){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(G)?r.callNativeApi.apply(r,e):r.callPatchApi.apply(r,e)}var Ae=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){Ae.captureException("LoadGameEntryError",{event_desc:"load game entry bundle fail: \n"+e.message+"\n"+e.stack})},e}()),ke=null;function Se(){if(null==ke)throw new Error("WxConfig is not ready.");return ke}function Ie(e){var n=Se(),t=n.windows.pages;return null!=t&&t[e]?Object.assign({},n.window,t[e]):null}var Ce=new i;function Te(){Ce.on("NavigatorBarTools:onMore",(function(){xn.showToast({title:"暂未实现该功能"})})),Ce.on("NavigatorBarTools:onClose",(function(){var e=te();null!=e&&e.invokeHandler({callbackId:-1,apiName:"exitMiniProgram",params:{},from:"service"})})),Ce.on("NavigatorBar:onBack",(function(){Ge.navigateBack({delta:1}),console.log("onBack")})),Ce.on("TabBar:change",(function(e){var n,t,o;Y("onTabItemTap",{index:e.index,pagePath:e.item.pagePath,text:e.item.text}),Ge.switchTab({url:e.item.pagePath},-1),n=e.item.pagePath,t={},null!=(o=Ie(n))&&(t.windowConfig=o),Ce.emit("tabItemChanged",t)})),Ce.on("invokeCallbackHandler",(function(e){ie(e.callbackId,e.data)})),Ce.on("dispatchServiceEvent",(function(e){Y(e.event,e.payload)}))}function Me(e){void 0!==window.__initWebFrame&&window.__initWebFrame(e,Ce)}var Pe={getGlobalVariables:function(e){return"_launchOption"===e.variable?{_launchOption:R}:null},onWindowResize:function(){},offWindowResize:function(){},reportApmMonitor:function(e){var n=e.eventName,t=e.payload,o=e.eventType;e.timestamp,Ae.reportedEventType.has(o)?Ae.captureException(n,t):"LogReport"===o&&t.event},addPerformance:function(e){},initReady:function(){},updateAppData:function(){},injectHtmlCallback:function(e,n,t){"service"===t&&Z().events.emit(V.onInjectHTMLCallback)},pageScrollTo:function(e,n){var t=e.scrollTop;e.duration;var o=Bn.currPage.getWindow();return null==o||o.scrollTo({top:t,behavior:"smooth"}),{errMsg:"pageScrollTo:ok"}},getMenuButtonBoundingClientRect:function(e,n){Ce.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:W}),plugin:{appId:"",version:""}}}},jssdkConfig:function(e,n){var t=e.jsApiList,o=[];if((void 0===t?[]:t).forEach((function(e){null==xn[e]&&o.push(e)})),!(o.length>0))return ae(n,{errMsg:"jssdkConfig:ok"});ae(n,{errMsg:"jssdkConfig:fail "+o.join(",")+" 未实现."})}},Ee={hideToast:function(e){return Ce.emit("hideToast",e),{errMsg:"hideToast:ok"}},showToast:function(e){return Ce.emit("showToast",e),{errMsg:"showToast:ok"}},showLoading:function(e){return Ce.emit("showLoading",e),{errMsg:"showLoading:ok"}},hideLoading:function(e){return Ce.emit("hideLoading",e),{errMsg:"hideLoading:ok"}},showModal:function(e,n){Ce.emit("showModal",e,n)},showActionSheet:function(e,n){Ce.emit("showActionSheet",e,n)}};function Be(){return p()&&!x()}var Oe={showGameKeyboard:function(e){return Be()?me({apiName:"showGameKeyboard",params:e}):Ce.emit("showKeyboard",e),{}},hideGameKeyboard:function(e){return Be()||Ce.emit("hideKeyboard",e),{}},updateGameKeyboard:function(e){return Be()||Ce.emit("updateKeyboard",e),{}},showKeyboard:function(e){return Be()?me({apiName:"showGameKeyboard",params:e}):Ce.emit("showKeyboard",e),{}},hideKeyboard:function(e){return Ce.emit("hideKeyboard",e),{}},updateKeyboard:function(e){return Ce.emit("updateKeyboard",e),{}}};function Le(e,n){if(e===j)return'<script charset="utf-8" src="'+n.moduleName+'game.js"><\/script>';if("miniProgram"===e)return n.content;throw Error("unsupported projectType: "+e)}var Fe=function(e){function n(n){return e.call(this,u(u({},n),{projectType:j}))||this}return c(n,e),n.prototype.injectScript=function(){var e=Q(K).getWindow();e.injectHtml(e.document.body,{content:Le(this.projectType,{moduleName:this.moduleName})})},n.prototype.getEntry=function(){return e=this.projectType,n={moduleName:this.moduleName},e===j?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){Y("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}()),Re=0,He={},De={createLoadSubPackageTask:function(e,n){var t=e.moduleName,o=He[t];if(o&&"success"===o.status)return{errMsg:"createLoadSubPackageTask:fail sub package already loaded."};++Re;var r=String(Re);return o=new Fe({taskId:r,moduleName:t}),Z().events.once(V.onInjectHTMLCallback,(function(){o.status="success",o.notifyProgressUpdate("success",{entryPath:o.getEntry()})})),He[t]=o,o.load(r,n),{errMsg:"createLoadSubPackageTask:ok",loadTaskId:Re}}},je={showNavigationBarLoading:function(){return Ce.emit("showNavigationBarLoading"),{errMsg:"showNavigationBarLoading:ok"}},setNavigationBarTitle:function(e){return Ce.emit("setNavigationBarTitle",e),{errMsg:"setNavigationBarTitle:ok"}},setNavigationBarColor:function(e){return Ce.emit("setNavigationBarColor",e),{errMsg:"setNavigationBarColor:ok"}},hideNavigationBarLoading:function(){return Ce.emit("hideNavigationBarLoading"),{errMsg:"hideNavigationBarLoading:ok"}},hideHomeButton:function(){}};function Ne(e,n){var t,o=function(e){e=e.replace(/\.html$/,"");var n=Se(),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,z[t])?n():function(e,n){var t=Q(K);t.events.once(V.onInjectHTMLCallback,n),t.loadSubBundle(e.root,e.packageName+".js")}(o,n)}var Ge={navigateTo:function(e,n){var t=e.url;if(Bn.stack.length>10)return{errMsg:"navigateTo:fail 已到达页面栈上限:10。"};var o=v(t),r=o.path,i=o.query;return Ne(r,(function(){var e=Bn.go(r);Z().events.once(V.onViewDOMContentLoaded,(function(){Y("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{Bn.back(n)}catch(e){return{errMsg:"navigateBack:fail "+e.message}}var t=Bn.currPage;return Y("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;Ne(r,(function(){Bn.reLaunch(t);var e=Bn.currPage;Z().events.once(V.onViewDOMContentLoaded,(function(){Y("onAppRoute",{path:r,openType:"reLaunch",options:void 0,pipMode:"",query:i,webviewId:e.webviewId},e.webviewId),ie(n,{errMsg:"reLaunch:ok"})}))}))},redirectTo:function(e,n){var t=v(e.url),o=t.path,r=t.query;Ne(o,(function(){try{Bn.redirectTo(o)}catch(e){return void ie(n,{errMsg:"redirectTo:fail "+e.message})}var e=Bn.currPage;Z().events.once(V.onViewDOMContentLoaded,(function(){Y("onAppRoute",{path:o,openType:"redirectTo",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),ie(n,{errMsg:"redirectTo:ok"})}))}))},switchTab:function(e,n){var t=v(e.url),o=t.path,r=t.query;Ne(o,(function(){try{Bn.switch(o)}catch(e){return void ie(n,{errMsg:"switchTab:fail "+e.message})}var e=Bn.currPage;e.isReady?(Y("onAppRoute",{path:o,openType:"switchTab",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),ie(n,{errMsg:"switchTab:ok"})):Z().events.once(V.onViewDOMContentLoaded,(function(){Y("onAppRoute",{path:o,openType:"switchTab",options:void 0,pipMode:"",query:r,webviewId:e.webviewId},e.webviewId),ie(n,{errMsg:"switchTab:ok"})}))}))}};function We(e){setTimeout(e,16)}function $e(e){var n=b();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return n+"-"+e}function Ve(e){var n=b();if(null==n)throw new Error("获取 extUuid 失败 by storage api");return e.replace(new RegExp("^"+n+"-"),"")}function ze(e){return Number((e/1024).toFixed(2))}var qe={getStorageSync:function(e){return{data:localStorage.getItem($e(e.key))||null}},getStorage:function(e,n){We((function(){ie(n,{data:qe.getStorageSync(e)})}))},setStorageSync:function(e){return localStorage.setItem($e(e.key),e.data),{errMsg:"setStorageSync:ok"}},setStorage:function(e,n){We((function(){localStorage.setItem(e.key,e.data),ie(n,{errMsg:"setStorage:ok"})}))},removeStorageSync:function(e){return localStorage.removeItem($e(e.key)),{errMsg:"removeStorageSync:ok"}},removeStorage:function(e,n){We((function(){localStorage.removeItem($e(e.key)),ie(n,{errMsg:"removeStorage:ok"})}))},clearStorageSync:function(){return localStorage.clear(),{errMsg:"clearStorageSync:ok"}},clearStorage:function(e,n){We((function(){localStorage.clear(),ie(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(Ve(t)));return{size:e,keys:n}}(),n=e.size;return{keys:e.keys,currentSize:ze(n),limitSize:ze(10485760)}},getStorageInfo:function(e,n){We((function(){ie(n,u(u({},qe.getStorageInfoSync()),{errMsg:"getStorageInfo:ok"}))}))}};function Ke(){var e=f();return("Android"===e||"IOS"===e)&&window.matchMedia("(orientation: portrait)").matches?"portrait":"landscape"}function Ue(){var e,n,t,o=null===(e=Bn.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 Qe(){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:Ue()});var e,n,t,o}var Je={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=Ze(),t=Ke(),o=f(),r=(e=y().extType||"").startsWith("app_")?f().toLowerCase():e.startsWith("pc_")?"pc":"web";return S.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 Ze()},getSetting:function(){return{authSetting:{"scope.userInfo":!0},subscriptionsSetting:{},miniprogramAuthSetting:{"scope.userInfo":!0}}},getNetworkType:function(){return{networkType:"wifi",signalStrength:100,hasSystemProxy:!1}}};function Ze(){return p()&&!x()?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}(me({apiName:"getWindowInfo",params:{}})):Qe()}var Xe={showTabBar:function(e){return Ce.emit("showTabBar",e),{errMsg:"showTabBar:ok"}},hideTabBar:function(e){return Ce.emit("hideTabBar",e),{errMsg:"hideTabBar:ok"}},setTabBarStyle:function(e){return Ce.emit("setTabBarStyle",e),{errMsg:"setTabBarStyle:ok"}},setTabBarItem:function(e){return Ce.emit("setTabBarItem",e),{errMsg:"setTabBarItem:ok"}},setTabBarBadge:function(e){return Ce.emit("setTabBarBadge",e),{errMsg:"setTabBarBadge:ok"}},removeTabBarBadge:function(e){return Ce.emit("removeTabBarBadge",e),{errMsg:"removeTabBarBadge:ok"}},hideTabBarRedDot:function(e){return Ce.emit("hideTabBarRedDot",e),{errMsg:"hideTabBarRedDot:ok"}},showTabBarRedDot:function(e){return Ce.emit("showTabBarRedDot",e),{errMsg:"showTabBarRedDot:ok"}}},Ye="insertHTMLWebView",en="onWebviewLoad",nn={insertHTMLWebView:function(e,n,t,o){Bn.initNextWebView(Bn.currPage,e.src,e.src).el.addEventListener("load",(function(){Y(en,{webviewId:o},o),ee(oe+"pageonshow",{})})),Y(Ye,e,o)},invokeMiniProgramAPI:function(e,n){console.log(e,n);var t=e.name,o=e.arg,r=xn[t];null!=r&&r(o,n)},postMessage:function(e,n){Y("onBindMessage",e,Bn.currPage.webviewId),ae(n,{errMsg:"postMessage:ok"})},canGoBack:function(e,n){ae(n,{errMsg:"canGoBack:fail default to fail"})},canNavigateBack:function(e,n){var t=!1;Bn.allPages.length>1&&(t=!0),ae(n,{errMsg:"canNavigateBack:"+(t?"ok":"fail")})}},tn={},on="onAd";function rn(e){var n=e.type,t=e.adUnitId,o=tn[t];if(null!=o)return o;if("rewardedVideo"===n)o=function(e){var n=e.adUnitId,t=me({apiName:"createRewardedVideoAd",params:{adUnitId:n}});return t.onLoad((function(e){Y(on,{method:"onLoad",adUnitId:n,data:e})})),t.onClose((function(e){Y(on,{method:"onClose",adUnitId:n,data:e})})),t.onError((function(e){Y(on,{method:"onError",adUnitId:n,data:e})})),t}(e);return null!=o&&(tn[t]=o),o}var an={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=rn(e)))return ie(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 ie(n,{errMsg:"ad:ok"}),[3,13];case 12:return i=a.sent(),ie(n,{errMsg:"ad:fail adInstance."+t+" call fail, "+(i.mssage||"unknown")}),[3,13];case 13:return[2]}}))}))}},cn={appDataChange:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):(!function(e){var n=u({},e.data),t=Ie(n.options.path);t&&(n.windowConfig=t),n.pages=Bn.allPages,Ce.emit("appDataChange",n)}(n),X(r,n,o))},__updateAppData:function(e){var n,t,o;n={},t=Bn.currPage.pagePath.replace(/\.html$/,""),null!=(o=Ie(t))&&(n.windowConfig=o),n.pages=Bn.allPages,n.currPage=t,Ce.emit("updateAppData",n)}};var un={canvasInsert:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===L?Y(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===L?Y(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===L?Y(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===L?Y(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===L?Y(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===L?Y(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===L?console.error("not implement for "+t):X(r,n,o)},invokeCanvasToDataUrl:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},invokeCanvasPutImageData:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},invokeCanvasGetImageData:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(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;he(/^https?:\/\//.test(t=i)||/^hyfile:\/\//.test(t)?t:P+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);X(o,{src:i,data:"data:image/"+a.ext+";base64,"+t},[r])}))}};function sn(e,n){e.message=n+" stack: "+(null==e?void 0:e.message),Ce.emit("closeLaunchMask"),xn.showToast({title:"加载游戏脚本超时"}),S.error("load game.js error",e.message),Ae.captureLoadGameEntryError(e)}var ln={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=Ke(),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=te();me({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?We((function(){S.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,Z().loadSubBundle("","game.js")];case 1:return e.sent(),Ce.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 sn(n.sent(),"entry"),[3,3];case 3:return[2]}}))}))}()})):sn(e,"deviceOrientation")}))},gameConfigUpdate:function(e){var n=e.params;Me({windowInfo:xn.getWindowInfo(),wxConfig:n})}},dn=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}()),fn=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=Z(),n=J();e.updateSrc("./service.html"),n.updateSrc("first")},e.prototype.handleServiceStart=function(e){var n=e.params;ke=n,Me({wxConfig:n,windowInfo:xn.getWindowInfo()}),Ce.emit("serviceStart",n)},e.prototype.handleServiceReady=function(e){var n=this,t=Z();if(!t.isReady){this.root=e.params.root,this.firstWebviewId=e.webviewIds[0],this.isServiceReady=!0;var o=this.firstWebviewId;t.events.once(V.onViewDOMContentLoaded,(function(){Y("onAppRoute",{path:n.root,openType:"appLaunch",options:void 0,pipMode:"",query:void 0,webviewId:n.firstWebviewId},n.firstWebviewId)})),Y("onServiceReadyDone",u(u({},R),{webviewId:o}),o),t.isReady=!0,this.launchPageShow()}},e.prototype.showPage=function(){var e=Bn.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=Z();n===L&&(Y("DOMContentLoaded",{},Bn.currPage.webviewId),t.events.emit(V.onViewDOMContentLoaded)),Ce.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);Bn.initFirstPage(t,e.root,n)}(Se(),J()),Bn.initSlotWebviewId(this.firstWebviewId),this.showPage();var e=Date.now(),n=e-this.__startTime;dn.reportFirstScreenTime(e),S.info("init page consume time: "+n+"ms")}},e}()),pn={serviceStart:function(e){fn.handleServiceStart(e)},onLaunchCalled:function(e){},serviceReady:function(e){fn.handleServiceReady(e)},DOMContentLoaded:function(e){fn.handleViewDOMContentLoaded(e)},viewReady:function(){fn.handleViewReady()},DOMReady:function(){}},vn={info:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},log:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},warn:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},error:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},initLogs:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},clearLogs:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;e.webviewId,t===L?console.error("not implement for "+t):X(r,n,o)},onViewLogEvent:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===L?Y(o,n,r):console.error("not implement for "+t)}},hn={INVOKE_METHOD:function(e){var n=e.params,t=e.from,o=e.event,r=e.webviewId;t===L?Y(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===L?console.error("not implement for "+t):X(r,n,o)},pageonhide:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===L?console.error("not implement for "+t):(X(r,n,o),ee(r,n))},requestLoadFontFace:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event;t===L?console.error("not implement for "+t):X(r,n,o)},requestLoadGlobalFontFaces:function(e){var n=e.params,t=e.from,o=e.event,r=e.webviewId;t===L?Y(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===L?console.error("not implement for "+t):X(r,n,o)}};function gn(e){return"string"==typeof e?JSON.parse(e):e}function mn(e){return JSON.parse(JSON.stringify(e))}var wn={SPECIAL_PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===L?Y(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===L?console.error("not implement for "+t):X(r,n,o)},PAGE_EVENT:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===L?Y(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===L?Y(r,mn(n),i):X(r,mn(n),o)},vdSyncBatch:function(e){var n=e.params,t=e.from,o=e.webviewIds,r=e.event,i=e.webviewId;t===L?Y(r,mn(n),i):X(r,mn(n),o)}},yn={videoPlayerInsertFinish:function(e){var n=e.params,t=e.from;e.webviewIds;var o=e.event,r=e.webviewId;t===L?Y(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===L?console.error("not implement for "+t):X(r,n,o)}},bn={openTypeEvent:function(e){var n=e.event,t=e.params,o=e.from,r=e.webviewId;"view"===o&&Y(n,t,r)},openTypeEventCallback:function(e){var n=e.event,t=e.params,o=e.from,r=e.webviewIds;"service"===o&&X(n,t,r)}},_n=u(u(u(u(u(u(u(u(u({},ln),pn),un),cn),vn),hn),wn),yn),bn),xn=u(u(u(u(u(u(u(u(u(u(u(u(u({},Pe),_e),De),Ge),Ee),qe),Je),je),Xe),nn),pe),Oe),an);function An(e){var n,t=e.replace(oe,""),o=_n[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:_n[r]||null,formatedEvent:r}}return{handler:o,formatedEvent:t}}var kn={invokeHandler:function(e){S.debug("invokeHander",e);var n=e.C,t=e.from,o=e.paramsString,r=e.webviewId,i=e.callbackId,a=gn(o),c=xn[n];if(null!=c){var u=c(a,i,t,r);return u&&u instanceof Promise?void 0:u}var s=te();if(null!=s)return s.invokeHandler({apiName:n,params:a,callbackId:i,from:t})},publishHandler:function(e){S.debug("publishHandler",e);var n=e.event,t=e.from,o=e.paramsString,r=e.webviewId,i=e.webviewIds,a=An(n),c=a.handler,u=a.formatedEvent,s=gn(o);if(null!=c)c({event:n,params:s,from:t,webviewId:r,webviewIds:O===t&&i?gn(i):void 0});else{var l=te();null!=l&&l.publishHandler({formatedEvent:u,event:n,params:s,from:t})}},webInvokeHandler:function(e){B&&console.log("webInvokeHander",e),ae(e.callbackId,gn(e.paramsString))},webPublishHandler:function(e){B&&console.log("webPublishHandler",e),ee(e.event,gn(e.paramsString))}};var Sn=[],In=function(e){Sn.push(e.el.src)},Cn=function(e){Sn.pop()},Tn=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 Mn=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 Tn,t}return c(n,e),Object.defineProperty(n.prototype,"isWebView",{get:function(){return this.__isWebView},set:function(e){this.__isWebView=e,e?In(this):Cn(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,Pn(this,"show")},n.prototype.hide=function(){var e=this.el;e.style.zIndex="1",e.style.opacity="0",this.active=!1,Pn(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=E),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?(S.debug("%c "+e,{data:n,webviewId:this.webviewId}),this.getBridge().subscribeHandler(e,n,this.webviewId)):this.tickQueue.collect((function(){S.debug("%c "+e,{data:n,webviewId:t.webviewId}),t.getBridge().subscribeHandler(e,n,t.webviewId)}))},n.prototype.postMessageToWebView=function(e){var n;S.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,Pn(this,"destory")},n}($);function Pn(e,n){e.isVHost&&e.children&&e.children.length>0&&e.children.forEach((function(e){e[n]()}))}function En(e,n){return e._slots.findIndex((function(e){return e===n.replace(/\.html$/,"")}))}var Bn=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=En(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 Mn(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 Mn(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(En(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:En(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=En(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}()),On=function(){function e(){this._invokeServiceCallbackHandler=ie,this._dispatchViewEvent=X,this._dispatchServiceEvent=Y,this.$events=new i,this._getCurrentPage=function(){return Bn.currPage},this._getAllPages=function(){return Bn.allPages}}return e.prototype.init=function(){ne=this},e}(),Ln=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(){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){
|
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":Y(n.event,JSON.parse(n.paramsString));break;case"invoke":return kn.invokeHandler(n)}})),window.addEventListener("resize",(function(){Y("onWindowResize",{size:{windowWidth:window.innerWidth,windowHeight:window.innerHeight}})})),window.FinChatJSCore=kn,Ln.init({CoreAdapter:On,logger:S}),window.addEventListener("DOMContentLoaded",(function(){var e;e={windowInfo:xn.getWindowInfo(),extInfo:y()},void 0!==window.__initWebFrameOnContentLoad&&(Te(),window.__initWebFrameOnContentLoad(e,Ce),_()&&te().$events.on("onDeviceOrientationChange",(function(e){Ce.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)}));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)})))}))}));
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@revues/web-sdk-core",
|
3
|
-
"version": "1.2.1
|
3
|
+
"version": "1.2.1",
|
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.1
|
27
|
-
"@revues/web-frame": "1.2.1
|
26
|
+
"@revues/hyext-adapter": "1.2.1",
|
27
|
+
"@revues/web-frame": "1.2.1",
|
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": "79614066d1dd187eeb95513903dfd0d350710c80"
|
35
35
|
}
|