jd-minigame-ci 0.7.2 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/jgc.js +1 -1
  2. package/package.json +1 -1
package/dist/jgc.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(global,(()=>(()=>{var e={85:e=>{e.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}var i=r(652),c=r(928),s=r(172),u=r(410).globSync;function l(e){try{if(i.pathExistsSync(e))return!0;if(l(c.dirname(e)))return i.mkdirsSync(e),!0}catch(e){console.log("make dir error,",e)}}t.writeFile=function(){var e,t=(e=o().mark((function e(t,r){var n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=a.length>2&&void 0!==a[2]?a[2]:"utf8",l(c.posix.parse(t).dir)&&i.writeFileSync(t,r,n);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function c(e){a(i,n,o,c,s,"next",e)}function s(e){a(i,n,o,c,s,"throw",e)}c(void 0)}))});return function(e,r){return t.apply(this,arguments)}}(),t.verifyGameRequiredFilesExist=function(e,t){return i.pathExistsSync(e)?"game"===t?f(e):"plugin"===t?p(e):{code:0,err_msg:"ok"}:{code:-1,err_msg:"当前入口文件目录不存在!"}};var f=function(e){var t=u("game.json",{cwd:e,ignore:"node_modules/**"}),r=u("game.js",{cwd:e,ignore:"node_modules/**"});return 0===t.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},p=function(e){return 0===u("plugin.json",{cwd:e,ignore:"node_modules/**"}).length?{code:-1,err_msg:"被打包的插件的目录下不存在plugin.json!"}:{code:0,err_msg:"ok"}};t.hasJgcConfigFile=function(e){try{return i.accessSync(e,i.constants.F_OK),!0}catch(e){return console.log("文件不存在"),!1}},t.compressDirectory=function(e,t){return new Promise((function(r,n){var o=i.createWriteStream(t),a=s("zip",{zlib:{level:9}});o.on("close",(function(){return r(a.pointer())})),a.on("warning",(function(e){return"ENOENT"!==e.code&&n(e)})),a.on("error",n),a.pipe(o),a.glob("**/*",{cwd:e,ignore:["**/.*","**/*.js.map"]}),a.finalize()}))},t.deleteFile=function(e){i.existsSync(e)&&i.unlink(e,(function(e){e&&console.log("删除zip文件失败: ",e)}))}},522:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"type",type:"list",message:"请选择项目类型:",choices:[{name:"游戏",value:"game"},{name:"插件",value:"plugin"}],default:"game"},{name:"appId",type:"input",message:"请输入appId:",validate:function(e){return!!e||"appId不能为空"}},{name:"requestToken",type:"input",message:"请输入代码上传秘钥:",validate:function(e){return!!e||"代码上传秘钥不能为空"}},{name:"entry",type:"input",message:"请输入需要被打包的游戏(或者插件)的路径:",default:"./"},{name:"versionName",type:"input",message:"请输入需要被打包的游戏(或者插件)的版本号:",default:"1.0.0"},{name:"description",type:"input",message:"请输入需要被打包的游戏的备注:",when:function(e){return"game"===e.type},default:""}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},593:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"versionName",type:"input",message:"版本号:",default:"1.0.0"},{name:"versionFeature",type:"input",message:"版本特性(长度为10~30个字符):",default:""},{name:"useGuide",type:"input",message:"使用指南(仅限文字和代码,长度为20~1000个字符):",default:"插件使用指南不建议在这里填写,建议到小游戏插件MP控制台提审时修改,这里是占位文本"}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},890:(e,t,r)=>{var n=r(420),o=r(241),a=r(268);t.showQrCode=function(e){return new Promise((function(t,r){n.read(e).then((function(e){var r=e.bitmap,n=r.width,i=r.height,c=r.data,s=new Uint8ClampedArray(c),u=a(s,n,i);o.generate(u.data,{small:!1}),t(!0)})).catch((function(e){r(!1)}))}))},t.getBase64=function(e){return n.read(e).then((function(e){return e.getBase64Async("image/png")})).catch((function(){throw new Error("获取二维码base64失败")}))}},425:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:O(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&o.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(a,i,c,s){var u=h(e[a],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a<t.length;)if(o.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(P,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function s(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){s(a,n,o,i,c,"next",e)}function c(e){s(a,n,o,i,c,"throw",e)}i(void 0)}))}}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var p=r(938),h=r(305),d=r(652),m=r(85),y=m.FAIL_CODE,v=m.SUCCEED_CODE,g=(r(60).checkConfigOptions,{dev:"http://beta-vapp-ide.jd.com",prod:"https://vapp-ide-pack.jd.com",test:"http://test-vapp-ide.jdtest.net"}),b=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prod";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.URL=g[t]},t=[{key:"uploadProject",value:(E=u(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.pack(t);case 3:if((r=e.sent).code===v){e.next=6;break}return e.abrupt("return",r);case 6:return n=r.data.result,e.next=9,this.loopQuery(t,n);case 9:if((o=e.sent).code===v){e.next=12;break}return e.abrupt("return",o);case 12:return e.abrupt("return",{code:v,packId:o.data});case 15:return e.prev=15,e.t0=e.catch(0),e.abrupt("return",{code:y,err_msg:e.t0 instanceof Error?e.t0.message:"上传失败"});case 18:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(e){return E.apply(this,arguments)})},{key:"sendPostRequest",value:(S=u(c().mark((function e(t,r){var n,o,i,s,u=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(i in n=u.length>2&&void 0!==u[2]?u[2]:"请求失败",o=new h,r)o.append(i,r[i]);return e.prev=3,e.next=6,p.post(t,o,{headers:a({},o.getHeaders())});case 6:if((s=e.sent).data.code!==v){e.next=9;break}return e.abrupt("return",{code:v,data:s.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(s.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t){return S.apply(this,arguments)})},{key:"pluginPublishRequest",value:(k=u(c().mark((function e(t,r,n,o){var a,i,s,u,l=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=l.length>4&&void 0!==l[4]?l[4]:"请求失败",i=JSON.stringify(r),s={method:"post",maxBodyLength:1/0,url:"".concat(t,"?appId=").concat(n,"&requestToken=").concat(o),headers:{"Content-Type":"application/json"},data:i},e.prev=3,e.next=6,p.request(s);case 6:if((u=e.sent).data.code!==v){e.next=9;break}return e.abrupt("return",{code:v,data:u.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(a,": ").concat(u.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(a,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t,r,n){return k.apply(this,arguments)})},{key:"pack",value:(x=u(c().mark((function e(t){var r,n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,a="".concat(this.URL,"/v1/devops/pack"),i={appId:n,requestToken:o,sourceFile:d.createReadStream(r)},e.abrupt("return",this.sendPostRequest(a,i,"文件上传报错"));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"loopQuery",value:(w=u(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now(),o=2e6,a=3e3;case 3:if(!(Date.now()-n<o)){e.next=15;break}return e.next=6,new Promise((function(e){return setTimeout(e,a)}));case 6:return e.next=8,this.queryPkgId(t,r);case 8:if((i=e.sent).code===v){e.next=11;break}return e.abrupt("return",{code:y,err_msg:i.err_msg});case 11:if(!i.data.result){e.next=13;break}return e.abrupt("return",{code:v,data:i.data.result});case 13:e.next=3;break;case 15:return e.abrupt("return",{code:y,err_msg:"查询超时"});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"queryPkgId",value:(b=u(c().mark((function e(t,r){var n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,a={appId:n,requestToken:o,uuid:r},e.abrupt("return",this.sendPostRequest("".concat(this.URL,"/v1/ci/queryPackIdByUuid"),a,"获取构建包id失效"));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"generateQrCode",value:(m=u(c().mark((function e(t){var r,n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.packId,a={appId:r,requestToken:n,packId:o},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryQrcodeByPackId"),a,"获取二维码失效");case 4:if((i=e.sent).code===v){e.next=7;break}return e.abrupt("return",{code:y,err_msg:i.err_msg});case 7:if(!i.data.result){e.next=13;break}return(s=new Date).setMinutes(s.getMinutes()+25),e.abrupt("return",{code:v,imgUrl:i.data.result,expiredTime:"".concat(this.addZeroForShort(s.getHours()),":").concat(this.addZeroForShort(s.getMinutes()))});case 13:return e.abrupt("return",{code:y,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"addZeroForShort",value:function(e){return String(e).length<2?"0".concat(String(e)):String(e)}},{key:"commitDevVersion",value:(f=u(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,a=t.versionName,i=t.description,s={packId:r,appId:n,requestToken:o,versionName:a,description:i},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/commitDevVersion"),s,"设置为开发版失效");case 4:if((u=e.sent).code===v){e.next=7;break}return e.abrupt("return",u);case 7:return e.abrupt("return",{code:v,devId:u.data.result});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"setDevExperience",value:(s=u(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,a={appId:n,requestToken:o,devId:r},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/devExperience"),a,"设置为体验版失效");case 4:if((i=e.sent).code===v){e.next=7;break}return e.abrupt("return",i);case 7:return e.abrupt("return",{code:v});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"queryExperienceQrcodeByPackId",value:(i=u(c().mark((function e(t){var r,n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o={appId:r,requestToken:n},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((a=e.sent).code===v){e.next=7;break}return e.abrupt("return",{code:y,err_msg:a.err_msg});case 7:return i=a.data.result,(s=new Date).setMinutes(s.getMinutes()+25),e.abrupt("return",{code:v,imgUrl:i,expiredTime:"".concat(this.addZeroForShort(s.getHours()),":").concat(this.addZeroForShort(s.getMinutes()))});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"uploadPlugin",value:(o=u(c().mark((function e(t){var r,n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,a=t.versionName,i="".concat(this.URL,"/v1/ci/pluginPack"),s={appId:n,requestToken:o,versionName:a,sourceFile:d.createReadStream(r)},e.next=6,this.sendPostRequest(i,s,"插件构建报错");case 6:if((u=e.sent).code===v){e.next=9;break}return e.abrupt("return",{code:y,err_msg:u.err_msg});case 9:return e.abrupt("return",{code:v,result:u.data.result});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"publishPlugin",value:(n=u(c().mark((function e(t){var r,n,o,a,i,s,u,l,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.versionName,n=t.versionFeature,o=t.useGuide,a=t.packId,i=t.appId,s=t.requestToken,u="".concat(this.URL,"/v1/ci/plugin-dev"),l={versionName:r,versionFeature:n,useGuide:o,packId:a},e.next=6,this.pluginPublishRequest(u,l,i,s,"插件上传报错");case 6:if((f=e.sent).code===v){e.next=9;break}return e.abrupt("return",{code:y,err_msg:f.err_msg});case 9:return e.abrupt("return",{code:v});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}],t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,o,i,s,f,m,b,w,x,k,S,E}();e.exports=b},60:(e,t)=>{function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e){return"string"==typeof e&&!!e.trim()}t.checkConfigOptions=function(e,t){var n=e||{},a=n.type,i=n.appId,c=n.requestToken,s=n.entry,u=n.versionName,l=n.description;if("game"!==a)return{code:-1,err_msg:"请选择项目构建类型为小游戏"};for(var f=1===t?{appId:i,requestToken:c,entry:s}:{appId:i,requestToken:c,entry:s,versionName:u,description:l},p=0,h=Object.entries(f);p<h.length;p++){var d=r(h[p],2),m=d[0];if(!o(d[1]))return{code:-1,err_msg:"".concat(m," 不能为空")}}return{code:0,err_msg:"ok"}},t.checkPluginConfig=function(e){var t=e||{},n=t.type,a=t.appId,i=t.requestToken,c=t.entry,s=t.versionName;if("plugin"!==n)return{code:-1,err_msg:"请选择项目构建类型为插件"};for(var u={appId:a,requestToken:i,entry:c,versionName:s},l=0,f=Object.entries(u);l<f.length;l++){var p=r(f[l],2),h=p[0];if(!o(p[1]))return{code:-1,err_msg:"".concat(h," 不能为空")}}return{code:0,err_msg:"ok"}}},664:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return(t=h(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:O(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&o.call(E,c)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(a,i,c,s){var u=h(e[a],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a<t.length;)if(o.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(P,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,s,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,c,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function l(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function f(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){l(a,n,o,i,c,"next",e)}function c(e){l(a,n,o,i,c,"throw",e)}i(void 0)}))}}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h(n.key),n)}}function h(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var d=r(938),m=r(305),y=r(896),v=r(626),g=(r(759),r(427).downloadFile),b=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.apiUrls=v.getApiUrls(),this.defaultTimeout=6e4},t=[{key:"setEnv",value:function(e){e?(v.currentEnv="wasmdev",this.apiUrls=v.getApiUrls("wasmdev")):(v.currentEnv="wasmprod",this.apiUrls=v.getApiUrls("wasmprod"))}},{key:"downloadFile",value:(x=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.filePath,n=t.url,e.abrupt("return",new Promise((function(e,t){g({filePath:r,url:n,success:e,fail:t})})));case 2:case"end":return e.stop()}}),e)}))),function(e){return x.apply(this,arguments)})},{key:"uploadFile",value:(w=f(u().mark((function e(t){var r,n,o,a,i,s,l,f,p,h;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.filePath,a=t.category,(i=new m).append("category",a),i.append("appId",r),i.append("requestToken",n),i.append("sourceFile",y.createReadStream(o)),s={method:"post",url:this.apiUrls.UPLOAD_FILE,headers:c(c({},i.getHeaders()),{},{appId:r,requestToken:n}),data:i,maxBodyLength:1/0,maxContentLength:1/0,timeout:6e5},e.prev=7,e.next=10,d(s);case 10:if(l=e.sent,f=l.data,p=f.code,h=f.result,0!==p){e.next=16;break}return e.abrupt("return",h);case 16:throw new Error(l.data.errorMessage);case 17:e.next=22;break;case 19:throw e.prev=19,e.t0=e.catch(7),new Error("上传文件失败 File upload failed: ".concat(e.t0.message));case 22:case"end":return e.stop()}}),e,this,[[7,19]])}))),function(e){return w.apply(this,arguments)})},{key:"addGameVersion",value:(b=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({method:"post",url:this.apiUrls.ADD_GAME_VERSION,data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"initialize",value:(h=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({method:"post",url:this.apiUrls.INIT,timeout:this.defaultTimeout,data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getInitResult",value:(l=f(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({method:"get",url:this.apiUrls.GET_INIT_RES,timeout:this.defaultTimeout,params:t});case 2:if(0===(r=e.sent).data.code){e.next=5;break}throw new Error(r.data.errorMessage);case 5:return e.abrupt("return",r.data);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"split",value:(s=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({url:this.apiUrls.SPLIT,method:"post",data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getGameSplitInfo",value:(i=f(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({url:this.apiUrls.GET_GAME_SPLIT_INFO,method:"get",params:t});case 2:if(0===(r=e.sent).data.code){e.next=5;break}throw new Error(r.data.errorMessage);case 5:return e.abrupt("return",r.data);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getSymbolSize",value:(a=f(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({method:"get",url:this.apiUrls.GET_SYMBOL_SIZE,params:t});case 2:if(0===(r=e.sent).data.code){e.next=5;break}throw new Error(r.data.errorMessage);case 5:return e.abrupt("return",r.data);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"reportCalledFuncs",value:(n=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({url:this.apiUrls.REPORT_FUNS,method:"post",data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}],t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,a,i,s,l,h,b,w,x}();e.exports=new b},626:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i=r(928),c=r(896),s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.environments={wasmdev:"http://beta-vapp-ide.jd.com",wasmprod:"https://vapp-ide-pack.jd.com"},this.currentEnv="wasmdev"},t=[{key:"getBaseUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentEnv;return this.environments[e]}},{key:"getApiUrls",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentEnv,t=this.getBaseUrl(e);return{UPLOAD_FILE:"".concat(t,"/wasm/upload"),ADD_GAME_VERSION:"".concat(t,"/wasm/packageBind"),INIT:"".concat(t,"/wasm/initialize"),SPLIT:"".concat(t,"/wasm/build"),GET_GAME_SPLIT_INFO:"".concat(t,"/wasm/queryBuildResultBySubVersion"),DOWNLOAD_FILE:"".concat(t,"/wasm/download"),GET_SYMBOL_SIZE:"".concat(t,"/wasm/getSymbolSize"),GET_INIT_RES:"".concat(t,"/wasm/queryInitResult"),REPORT_FUNS:"".concat(t,"/wasm/reportWasmFunction")}}},{key:"loadProjectConfig",value:function(e){var t=i.resolve(e,"./jgc.config.js"),n="function"==typeof require?require:r(220);delete n.cache[n.resolve(t)];var o=n(t),a=o.type,s=void 0===a?"game":a,u=o.entry,l=o.appId,f=o.requestToken,p=i.resolve(e,u),h=i.resolve(p,"./.codesplitcache"),d=i.resolve(h,"./original"),m=i.resolve(d,"./wasmcode/");return c.existsSync(h)||c.mkdirSync(h,{recursive:!0}),c.existsSync(d)||c.mkdirSync(d,{recursive:!0}),c.existsSync(m)||c.mkdirSync(m,{recursive:!0}),{type:s,entry:u,appId:l,requestToken:f,mainWasmCachePath:c.readdirSync(m).filter((function(e){return".br"===i.extname(e)}))[0],originalCacheDir:d,fullEntryPath:p}}}],t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=new s},46:e=>{e.exports={createWasmSplitCodeBySimd:function(){return'import {\n tableSize,\n setImportGlobal\n } from "./import-func-index";\n import {\n\n isIOS\n } from "./check-version";\n\n let b = (wx.getAccountInfoSync() || {}).miniProgram;\n const isTrial = b && "release" != b.envVersion;\n let subpackageTask,\n callbackArray = [],\n isLoaded = false;\n\n function loadSubWasmPackage(doneCallback, needBlock) {\n if (isLoaded) {\n doneCallback(needBlock);\n return;\n }\n let loadStart = Date.now();\n GameGlobal.unityNamespace.eventLog("start loadSubPackage wasmcode1");\n callbackArray.push({\n callback: doneCallback,\n needBlock: needBlock,\n });\n if (!subpackageTask) {\n subpackageTask = wx.loadSubpackage({\n name: "wasmcode1",\n success() {\n let a = Date.now() - loadStart;\n GameGlobal.unityNamespace.eventLog("下载代码分包1完毕: ", (a / 1e3).toFixed(2), "s");\n GameGlobal.manager.subWasmDownloaded(a);\n isLoaded = true;\n callbackArray.forEach((a) => a.callback(a.needBlock));\n callbackArray = [];\n },\n fail(a) {\n GameGlobal.manager.Logger.pluginError("load wasmcode1 fail:", a);\n GameGlobal.manager.subWasmDownloadError(a);\n },\n });\n let currentProgress = 0;\n subpackageTask.onProgressUpdate((e) => {\n var t = Math.floor(e.progress / 10);\n if (t != currentProgress) {\n let a = (e.totalBytesWritten / 1048576).toFixed(2),\n t = (e.totalBytesExpectedToWrite / 1048576).toFixed(2);\n console.log("代码分包1下载进度", e.progress, a, "MB;", t, "MB");\n }\n currentProgress = t;\n });\n }\n\n }\n let loadedSub = false,\n isInstanced = false;\n\n function h(needBlock) {\n GameGlobal.unityNamespace.eventLog("start compileSubWasm: needBlock ", needBlock);\n GameGlobal.manager.beforeLoadSubWasm();\n let instanceStart = Date.now();\n const subWasmPath = "wasmcode1/" + GameGlobal.unityNamespace.CODE_FILE_MD5 + "." + GameGlobal.unityNamespace.GAME_NAME + ".wasm.code.unityweb.wasm.br";\n let callback = (a) => {\n let cost = Date.now() - instanceStart;\n GameGlobal.manager.subWasmCompiled(cost);\n GameGlobal.unityNamespace.eventLog("[PLUGIN SUBWASM LOG]subwasm loaded: ", cost);\n isInstanced = true;\n\n };\n WXWebAssembly.instantiate(subWasmPath, wasm_split_info)\n .then(callback)\n .catch((a) => {\n console.error("wasmcode1 catch ", a);\n });\n }\n\n\n function invokeWait(needBlock) {\n if (!isInstanced) {\n if (!loadedSub) {\n loadedSub = true;\n GameGlobal.unityNamespace.eventLog("start instantiateSubWasm: needBlock ", needBlock);\n loadSubWasmPackage(h, needBlock);\n }\n\n }\n }\n\n function innerInvokeWasmBuffer(funcName, e) {\n\n GameGlobal.manager.wasmsplit.innerInvokeWasmBuffer({\n funcName: funcName,\n importObj: window.wasm_split_info,\n fail(t) {\n if (e > 0) {\n GameGlobal.unityNamespace.eventLog("fetch table_id: ", funcName, "; remainRetryTimes: ", e);\n return innerInvokeWasmBuffer(funcName, e - 1);\n }\n GameGlobal.unityNamespace.eventLog(\n "fetch table_id:",\n funcName,\n "; md5: ",\n GameGlobal.unityNamespace.CODE_FILE_MD5,\n "; subversion: ",\n GameGlobal.unityNamespace.WASM_SPLIT_SUB_VERSION,\n "; err: ",\n t\n );\n if ("system error" === t.errmsg || "content is null" === t.errmsg) {\n GameGlobal.onCrash();\n } else {\n invokeWait(true);\n\n }\n },\n });\n }\n window.Math_abs = Math.abs;\n window.Math_cos = Math.cos;\n window.Math_sin = Math.sin;\n window.Math_sqrt = Math.sqrt;\n window.Math_ceil = Math.ceil;\n window.Math_floor = Math.floor;\n window.Math_pow = Math.pow;\n window.Math_min = Math.min;\n window.Math_max = Math.max;\n window.Math_fround = Math.fround;\n window.Math_imul = Math.imul;\n window.Math_clz32 = Math.clz32;\n window.Math_trunc = Math.trunc;\n window.FUNCTION_TABLE = [];\n let subCalledSet = new Set(),\n globalCalledSet = new Set();;\n\n function _reportCalledFunc() {\n\n if (subCalledSet.size > 0) {\n GameGlobal.manager.reportCalledFuncs({\n called_func_list: Array.from(subCalledSet),\n sub_version: GameGlobal.unityNamespace.WASM_SPLIT_SUB_VERSION,\n func_type: 1,\n });\n subCalledSet.clear();\n }\n\n setTimeout(_reportCalledFunc, 5000);\n }\n\n GameGlobal.unityNamespace.reportCalledFunc = _reportCalledFunc;\n\n if (!GameGlobal.unityNamespace.pluginCalledMainCbs) {\n GameGlobal.unityNamespace.pluginCalledMainCbs = [];\n }\n\n if (!GameGlobal.unityNamespace.pluginCalledMainCb) {\n GameGlobal.unityNamespace.pluginCalledMainCb = function () {\n this.pluginCalledMainCbs.forEach((a) => a());\n };\n }\n\n isTrial && !GameGlobal.canUseH5Renderer && GameGlobal.unityNamespace.pluginCalledMainCbs.push(_reportCalledFunc);\n\n GameGlobal.unityNamespace.instantiateWasm = function (instantiateWasmInfo, receiveInstance) {\n console.log("in wasm-split instantiateWasm");\n const module = GameGlobal.manager.gameInstance.Module,\n asm2wasm = (instantiateWasmInfo.asm2wasm = instantiateWasmInfo.asm2wasm || {});\n asm2wasm["f64-to-int"] =\n asm2wasm["f64-to-int"] ||\n function (a) {\n return 0 | a;\n };\n asm2wasm["f64-rem"] =\n asm2wasm["f64-rem"] ||\n function (a, e) {\n return a % e;\n };\n\n instantiateWasmInfo.env = instantiateWasmInfo.env || {};\n\n instantiateWasmInfo.primary = {\n table: instantiateWasmInfo.env.table ||\n new WebAssembly.Table({\n initial: tableSize,\n maximum: tableSize,\n element: "anyfunc",\n }),\n memory: instantiateWasmInfo.env.memory,\n };\n\n setImportGlobal(instantiateWasmInfo);\n\n instantiateWasmInfo.wasm_split = instantiateWasmInfo.wasm_split || {};\n instantiateWasmInfo.wasm_split.wait = function () {\n let waitTableId = GameGlobal.unityNamespace.waitTableId.value;\n GameGlobal.unityNamespace.eventLog("wait for func: ", waitTableId);\n if (isIOS && canUseH5Renderer) {\n return innerInvokeWasmBuffer(waitTableId.toString(), 3);\n }\n invokeWait(true);\n if (GameGlobal.manager.wasmsplit && GameGlobal.manager.wasmsplit.checkNeedReportMissPatchFunc) {\n GameGlobal.manager.wasmsplit.checkNeedReportMissPatchFunc(waitTableId);\n }\n };\n\n if (GameGlobal.canUseH5Renderer) {\n instantiateWasmInfo.wasm_split.logCall = function (a, e) {};\n } else {\n instantiateWasmInfo.wasm_split.logCall = function (a, e) {\n if (e) {\n if (!globalCalledSet.has(a)) {\n globalCalledSet.add(a);\n subCalledSet.add(a);\n }\n }\n };\n }\n instantiateWasmInfo.wasm_split.__wasm_split_waitTableId = GameGlobal.unityNamespace.waitTableId = new WebAssembly.Global({\n value: "i32",\n mutable: true,\n });\n\n window.wasm_split_info = instantiateWasmInfo;\n let wasmPath = module.wasmPath;\n WebAssembly.instantiate(wasmPath, instantiateWasmInfo).then((resultObject) => {\n let primaryTable = instantiateWasmInfo.primary.table;\n for (var o = 0; o < primaryTable.length; ++o) {\n window.FUNCTION_TABLE[o] = primaryTable.get(o);\n }\n //instance: 包含所有导出的 WebAssembly 函数的 WebAssembly.Instance 对象。\n Object.entries(resultObject.instance.exports).forEach((instanceFunc) => {\n //["ur", Memory(4096)], ["vr", ƒ]\n if ("object" == typeof instanceFunc[1] && instanceFunc[1] instanceof WebAssembly.Memory) {\n instantiateWasmInfo.primary.memory = instanceFunc[1];\n asm2wasm.__wasm_memory_size = window.__wasm_memory_size = () => (instanceFunc[1].buffer.byteLength / 65536) | 0;\n }\n if (instanceFunc[0].startsWith("wasm_split.")) {\n instantiateWasmInfo.primary[instanceFunc[0]] = instanceFunc[1];\n }\n });\n instantiateWasmInfo.primary["wasm_split.initGlobal"] = resultObject.instance.exports.initGlobal;\n resultObject.instance.exports.initGlobal();\n module.asm = resultObject.instance.exports;\n receiveInstance(resultObject.instance, resultObject.module)\n });\n return {};\n };\n GameGlobal.unityNamespace.compileSubWasm = function () {\n return new Promise((reslove) => {\n GameGlobal.unityNamespace.eventLog("start asyncCompileSubWasm");\n if (isInstanced) return reslove();\n loadSubWasmPackage(() => {\n GameGlobal.unityNamespace.eventLog("async load subpackage done");\n }, false);\n });\n };'},createImportFuncIndexCodeBySimd:function(e,t,r,n,o){return"export const importSubFuncIndexList = [];\nexport const tableSize = ".concat(e,";\nGameGlobal.unityNamespace.wasmSubVersion =").concat(t,';\nGameGlobal.unityNamespace.baseUrl ="').concat(r?"http://beta-vapp-ide.jd.com":"https://vapp-ide-pack.jd.com",'";\nGameGlobal.unityNamespace.requestToken = "').concat(n,'";\n').concat(r?" wx.requestWebCookie && wx.requestWebCookie({needpin: 1,success(e){ GameGlobal.unityNamespace.webcookieInfo = {pt_pin: e.pt_pin, pt_ket: e.ticket}}});":"",'\nexport function setImportGlobal(info) {info["primary"] = info["primary"] || {};info["primary"]["__stack_pointer"] = new WebAssembly.Global({\n value: "i32",\n mutable: true\n });info["primary"]["__stack_end"] = new WebAssembly.Global({\n value: "i32",\n mutable: true\n });info["primary"]["__stack_base"] = new WebAssembly.Global({\n value: "i32",\n mutable: true\n });};\n \n export function setStackPointer(info) {\n\n }\n \n export function setImportFunc(info, jCall) {\n \n }\n \n ')}}},225:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}var s=r(896),u=r(23).promisify,l=r(759),f=u(s.readFile),p=u(s.writeFile);function h(){var e;return e=o().mark((function e(t,r){var n,a,i,c,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=!(s.length>2&&void 0!==s[2])||s[2],e.prev=1,e.next=4,f(t,"utf8");case 4:if(a=e.sent,i=JSON.parse(a),c=d(i),!n){e.next=11;break}return e.next=10,p(r,JSON.stringify(c,null,2));case 10:return e.abrupt("return");case 11:return e.abrupt("return",c);case 14:throw e.prev=14,e.t0=e.catch(1),l.logErr("处理文件时发生错误: ".concat(e.t0.message)),e.t0;case 18:case"end":return e.stop()}}),e,null,[[1,14]])})),h=function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,s,"next",e)}function s(e){c(a,n,o,i,s,"throw",e)}i(void 0)}))},h.apply(this,arguments)}function d(e){var t={"\\28":"(","\\29":")","\\5b":"[","\\5d":"]","\\2c":",","\\20":" "},r={};return Object.entries(e).forEach((function(e){var n=a(e,2),o=n[0],i=n[1];Object.entries(t).forEach((function(e){var t=a(e,2),r=t[0],n=t[1];i=i.replace(new RegExp(r,"g"),n)})),r[o]=i})),r}e.exports=function(e,t){return h.apply(this,arguments)}},427:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function c(e){a(i,n,o,c,s,"next",e)}function s(e){a(i,n,o,c,s,"throw",e)}c(void 0)}))}}var c,s=r(896),u=s.promises,l=r(928),f=r(938),p=function(e,t){return{filePath:e?t:void 0,tempFilePath:t,statusCode:200}},h=function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,u.access(t);case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),e.next=9,u.mkdir(t,{recursive:!0});case 9:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t){return e.apply(this,arguments)}}(),d=function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,u.stat(t);case 3:if(!e.sent.isDirectory()){e.next=7;break}return e.next=7,u.rm(t,{recursive:!0});case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(0);case 11:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}();e.exports={downloadFile:(c=i(o().mark((function e(t){var r,n,a,c,m,y,v,g,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.url,n=t.filePath,a=t.success,c=t.fail,m=t.complete,y={success:a,fail:c,complete:m},e.prev=2,e.next=5,h(l.dirname(n));case 5:return e.next=7,d(n);case 7:return e.next=9,f({method:"get",url:r,responseType:"stream"});case 9:return v=e.sent,g=s.createWriteStream(n),v.data.pipe(g),e.abrupt("return",new Promise((function(e,t){var r=0,a=parseInt(v.headers["content-length"]),c=v.headers["transfer-encoding"];g.on("finish",i(o().mark((function i(){var s,l,f;return o().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,"chunked"===c||!a||r===a){o.next=5;break}return o.next=4,u.unlink(n);case 4:throw new Error("Download incomplete: Received ".concat(r," of ").concat(a," bytes"));case 5:null===(s=y.success)||void 0===s||s.call(y,p(!0,n)),e(p(!0,n)),o.next=13;break;case 9:o.prev=9,o.t0=o.catch(0),null===(l=y.fail)||void 0===l||l.call(y,{errMsg:o.t0.message}),t(o.t0);case 13:return o.prev=13,null===(f=y.complete)||void 0===f||f.call(y),o.finish(13);case 16:case"end":return o.stop()}}),i,null,[[0,9,13,16]])})))),g.on("error",function(){var e=i(o().mark((function e(r){var a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.unlink(n).catch((function(){}));case 2:null===(a=y.fail)||void 0===a||a.call(y,{errMsg:"Write failed: ".concat(r.message)}),t(r);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),v.data.on("data",(function(e){r+=e.length}))})));case 15:return e.prev=15,e.t0=e.catch(2),e.next=19,u.unlink(n).catch((function(){}));case 19:throw null===(b=y.fail)||void 0===b||b.call(y,{errMsg:"Download failed: ".concat(e.t0.message)}),e.t0;case 21:case"end":return e.stop()}}),e,null,[[2,15]])}))),function(e){return c.apply(this,arguments)})}},322:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i=r(896),c=r(928),s=r(410),u=r(46),l=u.createWasmSplitCodeBySimd,f=u.createImportFuncIndexCodeBySimd,p=r(377),h=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},r=[{key:"syncPluginCacheFiles",value:function(e,t){this.ensureDirectoryExists(t),this.copyBrFiles(e,t),this.copyFixedFiles(e,t)}},{key:"ensureDirectoryExists",value:function(e){i.existsSync(e)||i.mkdirSync(e,{recursive:!0})}},{key:"copyBrFiles",value:function(e,t){var r=this,n=c.join(e,"wasmcode1");if(i.existsSync(n))throw new Error("文件备份错误,检查wasm文件是否是已分包版本");var o=c.join(t,"wasmcode");i.existsSync(o)&&i.rmSync(o,{recursive:!0,force:!0}),i.mkdirSync(o,{recursive:!0});var a=c.join(e,"wasmcode","*.br");s.sync(a).forEach((function(n){var o=c.relative(e,n),a=c.join(t,o),s=c.dirname(a);r.ensureDirectoryExists(s),i.copyFileSync(n,a)}))}},{key:"copyFixedFiles",value:function(e,t){["game.js","game.json","webgl.wasm.framework.unityweb.js","weapp-adapter.js"].forEach((function(r){var n=c.join(e,r),o=c.join(t,r);if(!i.existsSync(o)){if(!i.existsSync(n))throw new Error("Source file missing: ".concat(n));i.copyFileSync(n,o)}}))}},{key:"processJavaScriptFiles",value:function(e,t,r){this.config=r,i.copyFileSync(c.resolve(r.originalCacheDir,"./game.json"),c.resolve(t,"game.json"));var n=f(e.tableSize,e.subVersion,r.isPre,r.requestToken,r.isRelease);i.writeFileSync(c.resolve(t,"./import-func-index.js"),n);var o=l("");i.writeFileSync(c.resolve(t,"./wasm-split.js"),o);var a=c.resolve(t,"./wasmcode1/");i.writeFileSync(c.resolve(a,"game.js"),"")}},{key:"updateConfigFiles",value:function(e,t,r){this.config=r,this.updateGameJson(e,t),this.updateFrameworkJs(e,t),this.updateGameJs(e,t),this.updateAdapterJs(e,t)}},{key:"updateGameJson",value:function(e,t){var r=JSON.parse(i.readFileSync(c.resolve(this.config.originalCacheDir,"game.json")));r.subpackages.push({name:"wasmcode1",root:"wasmcode1/"}),r.plugins.UnityPlugin.version="1.2.58",i.writeFileSync(c.resolve(t,"game.json"),JSON.stringify(r,null,2))}},{key:"updateFrameworkJs",value:function(e,t){var r=c.resolve(this.config.originalCacheDir,"./webgl.wasm.framework.unityweb.js"),n=c.resolve(t,"./webgl.wasm.framework.unityweb.js"),o=i.readFileSync(r,"utf-8");p.forEach((function(e){o=o.replace(e.reg,e.replaceMethod)})),o+=";\nGameGlobal.unityNamespace.useWasmCodeSplit=true;GameGlobal.unityNamespace.WASM_SPLIT_SUB_VERSION=".concat(e.subVersion,";\n"),i.writeFileSync(n,o)}},{key:"updateGameJs",value:function(e,t){var r=this,n=c.resolve(this.config.originalCacheDir,"./game.js"),o=c.resolve(t,"./game.js"),a=i.readFileSync(n,"utf-8");[{reg:/const\s*_unityNamespace\s*=\s*_interopRequireDefault\(require\('\.\/unity-namespace'\)\)/gi,replaceMethod:function(){return"const _unityNamespace = _interopRequireDefault(require('./unity-namespace')); \n require('./wasm-split.js')"}},{reg:"GameGlobal.managerConfig = managerConfig;",replaceMethod:function(){return"GameGlobal.managerConfig = managerConfig; \nGameGlobal.canUseH5Renderer = ".concat(!!r.config.isRelease,";")}},{reg:"import unityNamespace from './unity-namespace';",replaceMethod:function(){return"import unityNamespace from './unity-namespace';\n import wasm_split from './wasm-split'"}},{reg:/APPID:\s*['"][^'"]*['"]/gi,replaceMethod:function(){return"APPID:'".concat(r.config.appId,"'")}}].forEach((function(e){a=a.replace(e.reg,e.replaceMethod)})),i.writeFileSync(o,a)}},{key:"updateAdapterJs",value:function(e,t){var r=c.resolve(this.config.originalCacheDir,"./weapp-adapter.js"),n=c.resolve(t,"./weapp-adapter.js"),o=i.readFileSync(r,"utf-8");o='"function" == typeof XMLHttpRequest&&(GameGlobal.nativeXHR = XMLHttpRequest);\n"object" == typeof WebAssembly&&(GameGlobal.nativeWASM = WebAssembly);'+o,i.writeFileSync(n,o)}}],(t=null)&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();e.exports=h},471:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i,c,s,u=r(896),l=r(928),f=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},r=[{key:"validateProjectStructure",value:function(e,t,r){var n=l.resolve(r,"./jgc.config.js");if(!this.isReadable(n))return{code:-1,msg:null,errMsg:"请先创建配置文件!"};if(!this.isReadable(t.fullEntryPath))return this.ERROR_MESSAGES[e].ENTRY_NOT_FOUND;var o=l.resolve(t.fullEntryPath,"game.json");try{var a;if(null===(a=JSON.parse(u.readFileSync(o,"utf-8")).plugins)||void 0===a||!a.UnityPlugin)return this.ERROR_MESSAGES[e].NOT_UNITY_GAME}catch(t){return this.ERROR_MESSAGES[e].GAME_JSON_NOT_FOUND}return{valid:!0}}},{key:"isReadable",value:function(e){try{return u.accessSync(e,u.constants.R_OK),!0}catch(e){return!1}}}],(t=null)&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();i=f,s={init:{ENTRY_NOT_FOUND:{code:-1,msg:"分包初始化失败",errMsg:"请检查entry是否存在"},NOT_UNITY_GAME:{code:-1,msg:"分包初始化失败",errMsg:"该游戏不是unity游戏"},GAME_JSON_NOT_FOUND:{code:-1,msg:"分包初始化失败",errMsg:"请检查game.json是否存在"}},split:{ENTRY_NOT_FOUND:{code:-1,msg:"WASM分包失败",errMsg:"请检查entry是否存在"},NOT_UNITY_GAME:{code:-1,msg:"WASM分包失败",errMsg:"该游戏不是unity游戏"},GAME_JSON_NOT_FOUND:{code:-1,msg:"WASM分包失败",errMsg:"请检查game.json是否存在"}}},(c=a(c="ERROR_MESSAGES"))in i?Object.defineProperty(i,c,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[c]=s,e.exports=f},377:e=>{e.exports=[{reg:/Module\[('|")HEAP8('|")\]\s*=\s*HEAP8\s*=\s*new\s*Int8Array/gi,replaceMethod:function(){return'Module["HEAP8"] = window.EMSCRIPTEN_HEAP8 = HEAP8 = new Int8Array'}},{reg:/Module\[('|")HEAP16('|")\]\s*=\s*HEAP16\s*=\s*new\s*Int16Array/gi,replaceMethod:function(){return'Module["HEAP16"] = window.EMSCRIPTEN_HEAP16 = HEAP16 = new Int16Array'}},{reg:/Module\[('|")HEAP32('|")\]\s*=\s*HEAP32\s*=\s*new\s*Int32Array/gi,replaceMethod:function(){return'Module["HEAP32"] = window.EMSCRIPTEN_HEAP32 = HEAP32 = new Int32Array'}},{reg:/Module\[('|")HEAPU8('|")\]\s*=\s*HEAPU8\s*=\s*new\s*Uint8Array/gi,replaceMethod:function(){return'Module["HEAPU8"] = window.EMSCRIPTEN_HEAPU8 = HEAPU8 = new Uint8Array'}},{reg:/Module\[('|")HEAPU16('|")\]\s*=\s*HEAPU16\s*=\s*new\s*Uint16Array/gi,replaceMethod:function(){return'Module["HEAPU16"] = window.EMSCRIPTEN_HEAPU16 = HEAPU16 = new Uint16Array'}},{reg:/Module\[('|")HEAPU32('|")\]\s*=\s*HEAPU32\s*=\s*new\s*Uint32Array/gi,replaceMethod:function(){return'Module["HEAPU32"] = window.EMSCRIPTEN_HEAPU32 = HEAPU32 = new Uint32Array'}},{reg:/Module\[('|")HEAPF32('|")\]\s*=\s*HEAPF32\s*=\s*new\s*Float32Array/gi,replaceMethod:function(){return'Module["HEAPF32"] = window.EMSCRIPTEN_HEAPF32 = HEAPF32 = new Float32Array'}},{reg:/Module\[('|")HEAPF64('|")\]\s*=\s*HEAPF64\s*=\s*new\s*Float64Array/gi,replaceMethod:function(){return'Module["HEAPF64"] = window.EMSCRIPTEN_HEAPF64 = HEAPF64 = new Float64Array'}},{reg:"calledMain = true;",replaceMethod:function(){return"if (GameGlobal.unityNamespace.pluginCalledMainCb) {\n GameGlobal.unityNamespace.pluginCalledMainCb()\n }\n calledMain = true;"}}]},175:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function a(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var s=r(320),u=new(a((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"wasmInit",(function(e){return s.init(e)})),i(this,"wasmUpdate",(function(e){return s.init(Object.assign(e,{isUpdate:!0}))})),i(this,"wasmSplitDev",(function(e){return s.splitBase(Object.assign(e,{isRelease:!1}))})),i(this,"wasmSplitProd",(function(e){return s.splitBase(Object.assign(e,{isRelease:!0}))})),i(this,"wasmSplitInfo",(function(e){return s.getSplitInfo(e)})),i(this,"wasmSplitReport",(function(e){return s.reportCalledFuncs(e)}))}))),l=u.wasmInit,f=u.wasmUpdate,p=u.wasmSplitDev,h=u.wasmSplitProd,d=u.wasmSplitInfo,m=u.wasmSplitReport;e.exports={wasmInit:l,wasmUpdate:f,wasmSplitDev:p,wasmSplitProd:h,wasmSplitInfo:d,wasmSplitReport:m}},759:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i,c=r(895),s=r(720);e.exports=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},r=[{key:"logStep",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).log.apply(t,[c.green("> ".concat(e))].concat(n))}},{key:"log",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];setTimeout((function(){var t;(t=console).log.apply(t,[c.green(e)].concat(r))}),0)}},{key:"logInfo",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).log.apply(t,[e].concat(n))}},{key:"logErr",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).log.apply(t,[c.red(e)].concat(n))}},{key:"startLogProcess",value:function(e){var t=s(e).start(),r={stop:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e+" 失败";"fail"==(arguments.length>1?arguments[1]:void 0)?t.fail(e):t.succeed(e)}};return i=r,r}},{key:"endLogProcess",value:function(e,t){e||(e=i),e&&"function"==typeof e.stop&&e.stop(t,"fail")}}],(t=null)&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}()},901:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"entry",type:"input",message:"请输入函数名文件所在路径:",default:"./"}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},320:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){s=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(s)throw a}}}}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */s=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:O(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&o.call(E,c)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(a,i,c,s){var u=h(e[a],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a<t.length;)if(o.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(P,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,c,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function u(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function l(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){u(a,n,o,i,c,"next",e)}function c(e){u(a,n,o,i,c,"throw",e)}i(void 0)}))}}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var h=r(928),d=r(896),m=r(626),y=r(471),v=r(664),g=r(322),b=r(759),w=r(225),x=(r(427).downloadFile,r(901)),k=r(937),S=function(){return e=function e(){var t,r,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,r="downloadSplitedFiles",n=function(){var e=l(s().mark((function e(t){var r,n,o,a,i,c,u,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.md5,a=t.subVersion,i=t.mainWasmFileUrl,c=t.mainWasmFilePath,u=t.subWasmFileUrl,l=t.subWasmFilePath,e.abrupt("return",Promise.all([v.downloadFile({appId:r,requestToken:n,md5:o,subVersion:a,category:3,filePath:c,url:i}),v.downloadFile({appId:r,requestToken:n,md5:o,subVersion:a,category:4,filePath:l,url:u})]));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(r=p(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.config=null,this.codeMd5=null,this.uploadedWasmCodeBlobId=null,this.uploadedSymbolBlobId=null,this.importLength=null,this.tableSize=null},t=[{key:"validateProject",value:function(e,t,r,n){v.setEnv(r);try{return this.config=m.loadProjectConfig(t),this.config.isPre=r,n&&(this.config.isRelease=!0),y.validateProjectStructure(e,this.config,t)}catch(e){return{code:-1,msg:null,errMsg:"配置加载失败: ".concat(e.message)}}}},{key:"uploadSplitBaseFiles",value:(F=l(s().mark((function e(t){var r,n,o,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.wasmFilePath,a=t.symbolFilePath,e.abrupt("return",Promise.all([v.uploadFile({appId:r,requestToken:n,filePath:o,category:0}),v.uploadFile({appId:r,requestToken:n,filePath:a,category:1})]));case 2:case"end":return e.stop()}}),e)}))),function(e){return F.apply(this,arguments)})},{key:"addGameVersion",value:(N=l(s().mark((function e(){var t;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={appId:this.config.appId,md5:this.codeMd5,versionDesc:"test",unityVersion:"1.0.0",unityPluginVersion:"1.0.0",wasmSplitPluginVersion:"1.0.0",wasmFileId:this.uploadedWasmCodeBlobId,symbolFileId:this.uploadedSymbolBlobId,requestToken:this.config.requestToken},e.next=3,v.addGameVersion(t);case 3:if(0===e.sent.code){e.next=6;break}throw new Error("游戏版本已经存在");case 6:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"initialize",value:(G=l(s().mark((function e(t){var r,n,o,a,i,c=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.isUpdate,n={appId:this.config.appId,md5:this.codeMd5,requestToken:this.config.requestToken,incrementUpdate:!!r},e.next=4,v.initialize(n);case 4:return o=e.sent,a=o.result,i={appId:this.config.appId,md5:this.codeMd5,requestToken:this.config.requestToken,uuid:a},e.abrupt("return",this.pollForResult((function(){return v.getInitResult(i)}),(function(e){if(e.result){var t=e.result,r=t.importSize,n=t.tableSize;return c.importLength=r,c.tableSize=n,b.log("importLength: ",c.importLength),b.log("tableSize: ",c.tableSize),!0}return!1})));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"pollForResult",value:(T=l(s().mark((function e(t,r){var n,o=arguments;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:5e3,e.abrupt("return",new Promise((function(e,o){var a=function(){var i=l(s().mark((function i(){var c;return s().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,t();case 3:c=i.sent,r(c)?e(c):setTimeout(a,n),i.next=10;break;case 7:i.prev=7,i.t0=i.catch(0),o(i.t0);case 10:case"end":return i.stop()}}),i,null,[[0,7]])})));return function(){return i.apply(this,arguments)}}();a()})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return T.apply(this,arguments)})},{key:"init",value:(I=l(s().mark((function e(t){var r,n,o,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this.validateProject("init",t.srcPath,t.isPreEnv)).valid){e.next=3;break}return e.abrupt("return",r);case 3:return e.prev=3,n=h.resolve(this.config.entry,"./.codesplitcache"),o=h.resolve(n,"./original"),this.setupCacheDirectories(n,o),a=b.startLogProcess("文件备份开始"),g.syncPluginCacheFiles(this.config.entry,o),a.stop("文件备份完成"),e.next=12,this.processSymbolFiles(n,o,t.isUpdate);case 12:return a=b.startLogProcess("开始上传文件"),e.next=15,this.uploadFiles(o,n);case 15:return a.stop("上传文件成功"),a=b.startLogProcess("添加游戏版本"),e.next=19,this.addGameVersion();case 19:return a.stop("添加游戏版本成功"),a=b.startLogProcess("初始化启动"),e.next=23,this.initialize({isUpdate:t.isUpdate});case 23:return a.stop("初始化完成"),this.saveSplitConfig(n),e.abrupt("return",{code:0,msg:"WASM分包初始化完成",errMsg:null});case 28:return e.prev=28,e.t0=e.catch(3),b.endLogProcess(null,e.t0.message),e.abrupt("return",{code:-1,msg:"初始化失败",errMsg:e.t0.message});case 32:case"end":return e.stop()}}),e,this,[[3,28]])}))),function(e){return I.apply(this,arguments)})},{key:"setupCacheDirectories",value:function(e,t){var r=h.resolve(t,"./wasmcode/"),n=h.resolve(t,this.config.entry,"./wasmcode1/");[t,r].forEach((function(e){d.existsSync(e)||d.mkdirSync(e,{recursive:!0})})),d.existsSync(n)&&d.rmSync(n,{recursive:!0})}},{key:"processSymbolFiles",value:(L=l(s().mark((function e(t,r,n){var o,a,i,c,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=h.resolve(t,"./unpack"),a=h.resolve(this.config.entry,"./webgl.wasm.symbols.unityweb"),i=h.resolve(o,"./symbol.json"),n||d.existsSync(o)||d.mkdirSync(o,{recursive:!0}),e.next=6,w(a,i);case 6:return c=h.resolve(r,"./wasmcode/"),u=d.readdirSync(c).find((function(e){return".br"===h.extname(e)})),this.codeMd5=u.split(".")[0],e.abrupt("return",{unpackSymbolsPath:i,mainWasmCachePath:u,mainWasmCacheDir:c});case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return L.apply(this,arguments)})},{key:"uploadFiles",value:(O=l(s().mark((function e(t,r){var n,o,i,c,u,l,f;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.processSymbolFiles(r,t,!1);case 2:return n=e.sent,o=n.unpackSymbolsPath,i=n.mainWasmCachePath,n.mainWasmCacheDir,e.next=8,this.uploadSplitBaseFiles({appId:this.config.appId,requestToken:this.config.requestToken,wasmFilePath:h.join(t,"wasmcode",i),symbolFilePath:o});case 8:if(c=e.sent,u=a(c,2),l=u[0],f=u[1],l&&f){e.next=14;break}throw new Error("上传文件失败");case 14:this.uploadedWasmCodeBlobId=l,this.uploadedSymbolBlobId=f;case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"saveSplitConfig",value:function(e){var t=h.resolve(e,"./codesplit-config.json"),r={appId:this.config.appId,codeMd5:this.codeMd5,tableSize:this.tableSize,uploadedWasmCodeBlobId:this.uploadedWasmCodeBlobId,uploadedSymbolBlobId:this.uploadedSymbolBlobId,importLength:this.importLength};d.writeFileSync(t,JSON.stringify(r,null,2))}},{key:"getSplitInfo",value:(_=l(s().mark((function e(t){var r,n,o;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this.validateProject("getSplitInfo",t.srcPath,t.isPreEnv)).valid){e.next=3;break}return e.abrupt("return",r);case 3:return e.prev=3,e.next=6,this.readSplitConfig();case 6:if(n=e.sent,(o={appId:this.config.appId,md5:n.codeMd5,requestToken:this.config.requestToken,subVersion:n.subVersion}).subVersion){e.next=10;break}throw new Error("暂无分包信息");case 10:return e.next=12,this.querySplitInfo(o);case 12:return e.abrupt("return",e.sent);case 15:return e.prev=15,e.t0=e.catch(3),b.endLogProcess(null,e.t0.message),e.abrupt("return",{code:-1,msg:"获取分包信息失败",errMsg:e.t0.message});case 19:case"end":return e.stop()}}),e,this,[[3,15]])}))),function(e){return _.apply(this,arguments)})},{key:"readSplitConfig",value:(j=l(s().mark((function e(){var t,r,n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.resolve(this.config.entry,"./.codesplitcache"),r=h.resolve(t,"./codesplit-config.json"),e.prev=2,e.next=5,d.promises.readFile(r,"utf-8");case 5:return n=e.sent,e.abrupt("return",JSON.parse(n));case 9:throw e.prev=9,e.t0=e.catch(2),new Error("读取分包配置文件失败: ".concat(e.t0.message));case 12:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(){return j.apply(this,arguments)})},{key:"querySplitInfo",value:(P=l(s().mark((function e(t){var r,n,o,a,i,c,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.md5,a=t.subVersion,e.prev=1,i={appId:r,md5:o,requestToken:n,subVersion:a},e.next=5,v.getSymbolSize(i);case 5:if(c=e.sent,null!=(u=c.result).mainSymbolSize&&null!=u.patchSymbolSize){e.next=9;break}throw new Error("未查询到分包函数信息");case 9:return e.abrupt("return",{code:0,msg:"查询分包信息成功 \n主包函数数量:".concat(u.mainSymbolSize," \n子包函数数量:").concat(u.patchSymbolSize),errMsg:"查询分包信息成功"});case 12:throw e.prev=12,e.t0=e.catch(1),e.t0;case 15:case"end":return e.stop()}}),e,null,[[1,12]])}))),function(e){return P.apply(this,arguments)})},{key:"getGameSplitRes",value:(E=l(s().mark((function e(t){var r=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var o=function(){var a=l(s().mark((function a(i){var c,u,l;return s().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return c=null,a.prev=1,u={appId:r.config.appId,md5:r.codeMd5,subVersion:t.subVersion,requestToken:r.config.requestToken},a.next=5,v.getGameSplitInfo(u);case 5:null!==(l=a.sent).result?(c&&clearTimeout(c),e(l.result)):(c&&clearTimeout(c),c=setTimeout((function(){return o()}),5e3)),a.next=13;break;case 9:a.prev=9,a.t0=a.catch(1),c&&clearTimeout(c),n(a.t0);case 13:case"end":return a.stop()}}),a,null,[[1,9]])})));return function(e){return a.apply(this,arguments)}}();o()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return E.apply(this,arguments)})},{key:"splitBase",value:(S=l(s().mark((function e(t){var r,n,o,a,i,c,u,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(new Date).getTime(),(n=this.validateProject("split",t.srcPath,t.isPreEnv,t.isRelease)).valid){e.next=4;break}return e.abrupt("return",n);case 4:return e.prev=4,(o=this.initializeSplitConfig()).cacheDir,a=o.codeSplitConfigPath,i=o.splitConfig,this.codeMd5=i.codeMd5,c=b.startLogProcess("发送分包请求"),e.next=10,this.buildSubPackage(t,i,a);case 10:if(u=e.sent,c.stop("当前分包版本:"+u),u){e.next=14;break}return e.abrupt("return",{code:-1,msg:"分包构建失败",errMsg:"服务正忙"});case 14:return c=b.startLogProcess("获取分包结果,请稍等"),e.next=17,this.getGameSplitRes({subVersion:u});case 17:return l=e.sent,c.stop("获取分包结果完成"),c=b.startLogProcess("下载分包代码中"),e.next=22,this.processSplitFiles(l,i);case 22:return c.stop("下载分包代码完成"),e.next=25,this.querySplitInfo({appId:this.config.appId,md5:i.codeMd5,requestToken:this.config.requestToken,subVersion:i.subVersion});case 25:return e.sent,e.abrupt("return",{code:0,msg:"WASM分包成功 \n分包总耗时:".concat((new Date).getTime()-r,"ms"),errMsg:null});case 29:return e.prev=29,e.t0=e.catch(4),b.endLogProcess(null,e.t0.message),e.abrupt("return",{code:-1,msg:"分包构建失败",errMsg:e.t0.message});case 33:case"end":return e.stop()}}),e,this,[[4,29]])}))),function(e){return S.apply(this,arguments)})},{key:"initializeSplitConfig",value:function(){var e=h.resolve(this.config.entry,"./.codesplitcache"),t=h.resolve(e,"./codesplit-config.json");return{cacheDir:e,codeSplitConfigPath:t,splitConfig:JSON.parse(d.readFileSync(t,"utf-8"))}}},{key:"buildSubPackage",value:(u=l(s().mark((function e(t,r,n){var o,a,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={appId:this.config.appId,md5:this.codeMd5,requestToken:this.config.requestToken,isRelease:!!t.isRelease},e.next=3,v.split(o);case 3:if(0===(a=e.sent).code){e.next=15;break}if(!this.isRetryableError(a.errorMessage)){e.next=12;break}if(i=r.subVersion,b.logInfo("尝试查找历史版本,subVersion:",i),i){e.next=10;break}return e.abrupt("return",!1);case 10:e.next=13;break;case 12:throw new Error(a.errorMessage);case 13:e.next=18;break;case 15:i=a.result,r.subVersion=i,d.writeFileSync(n,JSON.stringify(r,null,2));case 18:return e.abrupt("return",i);case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"isRetryableError",value:function(e){return["当前md5有正在执行的构建任务,请稍后重试","资源超负荷运行啦,请稍后再试"].includes(e)}},{key:"processSplitFiles",value:(c=l(s().mark((function e(t,r){var n,o,a,i,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.mainWasmFilePath,o=t.subWasmFilePath,a=this.config.fullEntryPath,i=this.config.mainWasmCachePath,c=this.createWasmPaths(a,i),e.next=6,this.downloadWasmFiles(n,o,c);case 6:g.processJavaScriptFiles(r,a,this.config),g.updateConfigFiles(r,a,this.config);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"createWasmPaths",value:function(e,t){var r=h.resolve(e,"./wasmcode/",t),n=h.resolve(e,"./wasmcode1/",t);return d.existsSync(n)||d.mkdirSync(n,{recursive:!0}),{mainWasmPath:r,subWasmPath:n}}},{key:"downloadWasmFiles",value:(i=l(s().mark((function e(t,r,n){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.downloadSplitedFiles({mainWasmFileUrl:t,mainWasmFilePath:n.mainWasmPath,subWasmFileUrl:r,subWasmFilePath:n.subWasmPath});case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return i.apply(this,arguments)})},{key:"reportCalledFuncs",value:(n=l(s().mark((function e(t){var r,n,i,c,u,l,f,p,m,y,g,w,S,E,P,j,_,O,L,I,T,G,N;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this.validateProject("getSplitInfo",t.srcPath,t.isPreEnv)).valid){e.next=3;break}return e.abrupt("return",r);case 3:return e.prev=3,n=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,r=[],n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r},i=(new x).getPrompts(),e.next=8,k.prompt(i);case 8:if(c=e.sent,u=h.resolve(c.entry),d.existsSync(u)||(u=h.resolve(this.config.fullEntryPath,c.entry),d.existsSync(u)||(u=h.resolve(c.entry))),d.existsSync(u)){e.next=13;break}throw new Error("文件路径错误");case 13:return l=b.startLogProcess("文件解析中"),f=[],e.next=17,d.readFileSync(u,"utf8");case 17:for(p=e.sent,(m=p.split(/\r?\n/)).shift(),y=h.resolve(this.config.fullEntryPath,"./.codesplitcache"),g=h.resolve(y,"./unpack"),w=h.resolve(g,"./symbol.json"),S=d.readFileSync(w,"utf8"),E=JSON.parse(S),P=0,j=Object.entries(E);P<j.length;P++)_=a(j[P],2),O=_[0],L=_[1],m.includes(L)&&f.push(O);return e.next=28,this.readSplitConfig();case 28:I=e.sent,l.stop("文件解析成功"),l=b.startLogProcess("上报中,请稍等"),T=o(n(f)),e.prev=32,T.s();case 34:if((G=T.n()).done){e.next=40;break}return N=G.value,e.next=38,v.reportCalledFuncs({appId:this.config.appId,requestToken:this.config.requestToken,calledFuncList:N,subVersion:I.subVersion,md5:I.codeMd5});case 38:e.next=34;break;case 40:e.next=45;break;case 42:e.prev=42,e.t0=e.catch(32),T.e(e.t0);case 45:return e.prev=45,T.f(),e.finish(45);case 48:return l.stop("上报函数名成功"),e.abrupt("return",{code:0,msg:"上报函数名完成,数量".concat(f.length,"个"),errMsg:null});case 52:return e.prev=52,e.t1=e.catch(3),b.endLogProcess(null,e.t1.message),e.abrupt("return",{code:-1,msg:"上传函数名失败",errMsg:e.t1.message});case 56:case"end":return e.stop()}}),e,this,[[3,52],[32,42,45,48]])}))),function(e){return n.apply(this,arguments)})}],t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,i,c,u,S,E,P,j,_,O,L,I,T,G,N,F}();e.exports=new S},220:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=220,e.exports=t},589:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=589,e.exports=t},172:e=>{"use strict";e.exports=require("archiver")},938:e=>{"use strict";e.exports=require("axios")},895:e=>{"use strict";e.exports=require("chalk")},858:e=>{"use strict";e.exports=require("commander")},305:e=>{"use strict";e.exports=require("form-data")},652:e=>{"use strict";e.exports=require("fs-extra")},410:e=>{"use strict";e.exports=require("glob")},937:e=>{"use strict";e.exports=require("inquirer")},420:e=>{"use strict";e.exports=require("jimp")},268:e=>{"use strict";e.exports=require("jsqr")},720:e=>{"use strict";e.exports=require("ora")},205:e=>{"use strict";e.exports=require("picocolors")},241:e=>{"use strict";e.exports=require("qrcode-terminal")},896:e=>{"use strict";e.exports=require("fs")},857:e=>{"use strict";e.exports=require("os")},928:e=>{"use strict";e.exports=require("path")},23:e=>{"use strict";e.exports=require("util")},330:e=>{"use strict";e.exports=JSON.parse('{"name":"jd-minigame-ci","version":"0.7.2","description":"The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.","author":"chenlong328","license":"ISC","main":"dist/index.js","bin":{"jgc":"./dist/jgc.js"},"scripts":{"config":"NODE_ENV=development node ./dist/jgc.js config","preview":"NODE_ENV=development node ./dist/jgc.js preview","dev:config":"NODE_ENV=development node ./src/jgc.js config","dev:preview":"NODE_ENV=development node ./src/jgc.js preview","dev:upload":"NODE_ENV=development node ./src/jgc.js upload","dev:publish":"NODE_ENV=development node ./src/jgc.js publish","build":"webpack --mode production --progress --config webpack.config.js && chmod 777 ./dist/index.js && chmod 777 ./dist/jgc.js"},"dependencies":{"@babel/cli":"^7.23.9","@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","archiver":"^6.0.1","axios":"^1.7.3","commander":"^11.1.0","fs-extra":"^11.2.0","glob":"^10.3.10","inquirer":"8.2.6","jimp":"^0.22.12","jsqr":"1.4.0","minimist":"^1.2.8","ora":"5.4.1","qrcode":"^1.5.3","qrcode-terminal":"^0.12.0","string-width":"4.2.3","strip-ansi":"6.0.1"},"devDependencies":{"babel-loader":"^9.1.3","babel-minify-webpack-plugin":"^0.3.1","clean-webpack-plugin":"^4.0.0","terser-webpack-plugin":"^5.3.10","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"files":["dist","package.json","README.md"]}')}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function c(e){a(i,n,o,c,s,"next",e)}function s(e){a(i,n,o,c,s,"throw",e)}c(void 0)}))}}var c=r(928),s=r(857),u=r(720),l=r(205),f=new(0,r(858).Command),p=r(937),h=r(938),d=r(522),m=r(593),y=r(538),v=r(60),g=r(425),b=r(890),w=r(85).SUCCEED_CODE,x=r(330),k=r(175);function S(e){return E.apply(this,arguments)}function E(){return E=i(o().mark((function e(t){var n,a,i,f,p,h,d,m,x,k,S,E,P,j,_,O,L,I,T,G,N,F,M,A,C,q,D,W,U,R,B,H,V=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(V.length>1&&void 0!==V[1])||V[1],a=Date.now(),i=1===t?"preview":"upload",f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=7;break}return e.abrupt("return",console.log("".concat(l.red("请先创建配置文件!"))));case 7:if(p="function"==typeof require?require:r(589),h=p(f),(d=v.checkConfigOptions(h,t)).code===w){e.next=12;break}return e.abrupt("return",console.log(d.err_msg));case 12:if(m=h.appId,x=h.requestToken,k=h.versionName,S=h.entry,E=h.description,(P=y.verifyGameRequiredFilesExist(S)).code===w){e.next=16;break}return e.abrupt("return",console.log(P.err_msg));case 16:return j=s.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(j),_=u("文件压缩").start(),e.prev=19,e.next=22,y.compressDirectory(S,j);case 22:O=e.sent,_.succeed("压缩完成,共"+O/1e3+"KB"),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(19),_.fail("压缩失败:",e.t0),process.exit(1);case 30:return _.start(),_.text="上传中",L=new g(n?"prod":"dev"),e.prev=34,e.next=37,L.uploadProject({sourceFile:j,appId:m,requestToken:x,isProd:n});case 37:if((I=e.sent).code!==w&&(_.fail(I.err_msg),process.exit(1)),T=I.packId,_.succeed("上传完成,packId:".concat(T)),"preview"!==i){e.next=57;break}return e.next=44,L.generateQrCode({packId:T,appId:m,requestToken:x});case 44:return(G=e.sent).code!==w&&(_.fail(G.err_msg),process.exit(1)),N=G.imgUrl,F=G.expiredTime,e.next=49,b.showQrCode(N);case 49:_.succeed("二维码生成完成,将于".concat(F,"过期")),_.info("二维码imgUrl(如二维码不清晰,浏览器打开): ".concat(N)),_.info("二维码仅支持协作成员访问"),M=Date.now(),A=(M-a)/1e3,_.info("本次耗费时长:".concat(A,"s")),e.next=82;break;case 57:if("upload"!==i){e.next=82;break}return _.start(),e.next=61,L.commitDevVersion({appId:m,requestToken:x,versionName:k,description:E},T);case 61:return(C=e.sent).code!==w&&(_.fail(C.err_msg),process.exit(1)),q=C.devId,_.succeed("开发版设置完成, devId:"+q),e.next=67,L.setDevExperience({appId:m,requestToken:x},q);case 67:return(D=e.sent).code!==w&&(_.fail(D.err_msg),process.exit(1)),_.succeed("体验版设置完成"),e.next=72,L.queryExperienceQrcodeByPackId({appId:m,requestToken:x});case 72:return(W=e.sent).code!==w&&(_.fail(W.err_msg),process.exit(1)),U=W.imgUrl,R=W.expiredTime,e.next=77,b.showQrCode(U);case 77:_.info("二维码仅支持协作成员访问"),_.succeed("二维码生成完成,将于".concat(R,"过期")),B=Date.now(),H=(B-a)/1e3,_.info("本次耗费时长:".concat(H,"s"));case 82:e.next=88;break;case 84:e.prev=84,e.t1=e.catch(34),_.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 88:case"end":return e.stop()}}),e,null,[[19,26],[34,84]])}))),E.apply(this,arguments)}function P(e){return j.apply(this,arguments)}function j(){return(j=i(o().mark((function e(t){var n,a,i,f,h,d,b,x,k,S,E,P,j,_,O,L,I,T,G;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new m).getPrompts(),e.next=3,p.prompt(n);case 3:if(a=e.sent,i=Date.now(),f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=9;break}return e.abrupt("return",console.log("".concat(l.red("请先创建配置文件!"))));case 9:if(h="function"==typeof require?require:r(589),d=h(f),(b=v.checkPluginConfig(d)).code===w){e.next=14;break}return e.abrupt("return",console.log(b.err_msg));case 14:return x=d.appId,k=d.requestToken,S=d.entry,E=d.versionName,P=s.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(P),j=u("文件压缩").start(),e.prev=18,e.next=21,y.compressDirectory(S,P);case 21:(_=e.sent)>4194304&&(j.fail("压缩包超过4MB,请检查文件大小"),process.exit(1)),j.succeed("压缩完成,共"+_/1e3+"KB"),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(18),j.fail("压缩失败:",e.t0),process.exit(1);case 30:return O=new g(t),e.prev=31,e.next=34,O.uploadPlugin({sourceFile:P,appId:x,requestToken:k,versionName:E});case 34:if((L=e.sent).code===w){e.next=40;break}j.fail(L.err_msg),process.exit(1),e.next=49;break;case 40:return j.succeed("插件构建成功"),e.next=43,O.publishPlugin({versionName:a.versionName,versionFeature:a.versionFeature,useGuide:a.useGuide,packId:L.result.packId,appId:x,requestToken:k});case 43:(I=e.sent).code!==w&&(j.fail(I.err_msg),process.exit(1)),j.succeed("插件发布成功"),T=Date.now(),G=(T-i)/1e3,j.info("本次耗费时长:".concat(G,"s"));case 49:e.next=55;break;case 51:e.prev=51,e.t1=e.catch(31),j.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 55:case"end":return e.stop()}}),e,null,[[18,26],[31,51]])})))).apply(this,arguments)}function _(e){return O.apply(this,arguments)}function O(){return(O=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitInfo(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("查询函数符号表失败:",e)})).catch((function(e){console.error("查询函数符号表异常:",e)}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return f.command("config").description("小游戏配置").action(i(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(new d).getPrompts(),e.next=3,p.prompt(t);case 3:if(r=e.sent,(n=y.verifyGameRequiredFilesExist(r.entry,r.type)).code===w){e.next=7;break}return e.abrupt("return",console.log("".concat(l.red(n.err_msg))));case 7:return e.prev=7,y.writeFile("./".concat("jgc.config.js"),"module.exports = ".concat(JSON.stringify(r,null,2)),"utf-8"),e.abrupt("return",console.log("✨ ".concat(l.green("创建小游戏配置文件成功"))));case 13:e.prev=13,e.t0=e.catch(7),console.log("创建小游戏配置文件失败:",e.t0);case 16:case"end":return e.stop()}}),e,null,[[7,13]])})))),f.command("preview").description("小游戏真机预览").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏真机预览-预发环境"),e.abrupt("return",S(1,!1));case 3:return e.abrupt("return",S(1,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("upload").description("小游戏发布").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏发布-预发环境"),e.abrupt("return",S(2,!1));case 3:return e.abrupt("return",S(2,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("publish").description("插件发布").option("-D","预发环境").option("-T","测试环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=5;break}return console.log("插件发布-预发环境"),e.abrupt("return",P("dev"));case 5:if(!t.T){e.next=10;break}return console.log("插件发布-测试环境"),e.abrupt("return",P("test"));case 10:return console.log("插件发布-生产环境"),e.abrupt("return",P("prod"));case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.version(x.version,"-v, -V").description("获取本地京东小游戏CLI工具版本"),f.command("latest").description("获取并对比京东小游戏CLI工具最新版本").action(i(o().mark((function e(){var t,r,n,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=u("npm最新版本获取中……").start(),e.next=4,h.get("https://registry.npmjs.org/jd-minigame-ci/latest");case 4:r=e.sent,n=r.data.version,a=x.version,t.succeed("最新版本: ".concat(n)),n===a?t.info("当前版本 (".concat(a,") 已是最新版本。")):(t.info("本地版本: ".concat(a)),t.info("请更新到最新版本以获取最新功能和修复。")),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),spinner.fail("获取最新版本信息失败: ".concat(e.t0));case 14:case"end":return e.stop()}}),e,null,[[0,11]])})))),f.command("wasm-init").description("WASM分包初始化").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmInit(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("WASM分包初始化失败:",e)})).catch((function(e){console.error("WASM分包初始化异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-update").description("WASM分包增量更新").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmUpdate(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("WASM分包增量更新失败:",e)})).catch((function(e){console.error("WASM分包增量更新异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-dev").description("WASM分包dev").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitDev(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var r=e.code,n=e.msg;0===r?(console.log(n),_(t)):console.error("WASM分包失败:",e)})).catch((function(e){console.error("WASM分包异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-prod").description("WASM分包prod").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitProd(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var r=e.code,n=e.msg;0===r?(console.log(n),_(t)):console.error("WASM分包失败:",e)})).catch((function(e){console.error("WASM分包异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-info").description("查询函数符号表").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:_(t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-report").description("上报函数名").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitReport(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("上报函数名失败:",e)})).catch((function(e){console.error("上报函数名异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.parse(process.argv),{}})()));
2
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(global,(()=>(()=>{var e={85:e=>{e.exports={FAIL_CODE:-1,SUCCEED_CODE:0}},538:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}var i=r(652),c=r(928),s=r(172),u=r(410).globSync;function l(e){try{if(i.pathExistsSync(e))return!0;if(l(c.dirname(e)))return i.mkdirsSync(e),!0}catch(e){console.log("make dir error,",e)}}t.writeFile=function(){var e,t=(e=o().mark((function e(t,r){var n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=a.length>2&&void 0!==a[2]?a[2]:"utf8",l(c.posix.parse(t).dir)&&i.writeFileSync(t,r,n);case 4:case"end":return e.stop()}}),e)})),function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function c(e){a(i,n,o,c,s,"next",e)}function s(e){a(i,n,o,c,s,"throw",e)}c(void 0)}))});return function(e,r){return t.apply(this,arguments)}}(),t.verifyGameRequiredFilesExist=function(e,t){return i.pathExistsSync(e)?"game"===t?f(e):"plugin"===t?p(e):{code:0,err_msg:"ok"}:{code:-1,err_msg:"当前入口文件目录不存在!"}};var f=function(e){var t=u("game.json",{cwd:e,ignore:"node_modules/**"}),r=u("game.js",{cwd:e,ignore:"node_modules/**"});return 0===t.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.json!"}:0===r.length?{code:-1,err_msg:"被打包的游戏的目录下不存在game.js!"}:{code:0,err_msg:"ok"}},p=function(e){return 0===u("plugin.json",{cwd:e,ignore:"node_modules/**"}).length?{code:-1,err_msg:"被打包的插件的目录下不存在plugin.json!"}:{code:0,err_msg:"ok"}};t.hasJgcConfigFile=function(e){try{return i.accessSync(e,i.constants.F_OK),!0}catch(e){return console.log("文件不存在"),!1}},t.compressDirectory=function(e,t){return new Promise((function(r,n){var o=i.createWriteStream(t),a=s("zip",{zlib:{level:9}});o.on("close",(function(){return r(a.pointer())})),a.on("warning",(function(e){return"ENOENT"!==e.code&&n(e)})),a.on("error",n),a.pipe(o),a.glob("**/*",{cwd:e,ignore:["**/.*","**/*.js.map"]}),a.finalize()}))},t.deleteFile=function(e){i.existsSync(e)&&i.unlink(e,(function(e){e&&console.log("删除zip文件失败: ",e)}))}},522:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"type",type:"list",message:"请选择项目类型:",choices:[{name:"游戏",value:"game"},{name:"插件",value:"plugin"}],default:"game"},{name:"appId",type:"input",message:"请输入appId:",validate:function(e){return!!e||"appId不能为空"}},{name:"requestToken",type:"input",message:"请输入代码上传秘钥:",validate:function(e){return!!e||"代码上传秘钥不能为空"}},{name:"entry",type:"input",message:"请输入需要被打包的游戏(或者插件)的路径:",default:"./"},{name:"versionName",type:"input",message:"请输入需要被打包的游戏(或者插件)的版本号:",default:"1.0.0"},{name:"description",type:"input",message:"请输入需要被打包的游戏的备注:",when:function(e){return"game"===e.type},default:""}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},593:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"versionName",type:"input",message:"版本号:",default:"1.0.0"},{name:"versionFeature",type:"input",message:"版本特性(长度为10~30个字符):",default:""},{name:"useGuide",type:"input",message:"使用指南(仅限文字和代码,长度为20~1000个字符):",default:"插件使用指南不建议在这里填写,建议到小游戏插件MP控制台提审时修改,这里是占位文本"}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},890:(e,t,r)=>{var n=r(420),o=r(241),a=r(268);t.showQrCode=function(e){return new Promise((function(t,r){n.read(e).then((function(e){var r=e.bitmap,n=r.width,i=r.height,c=r.data,s=new Uint8ClampedArray(c),u=a(s,n,i);o.generate(u.data,{small:!1}),t(!0)})).catch((function(e){r(!1)}))}))},t.getBase64=function(e){return n.read(e).then((function(e){return e.getBase64Async("image/png")})).catch((function(){throw new Error("获取二维码base64失败")}))}},425:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */c=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:O(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&o.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(a,i,c,s){var u=h(e[a],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a<t.length;)if(o.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(P,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function s(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){s(a,n,o,i,c,"next",e)}function c(e){s(a,n,o,i,c,"throw",e)}i(void 0)}))}}function l(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var p=r(938),h=r(305),d=r(652),m=r(85),y=m.FAIL_CODE,v=m.SUCCEED_CODE,g=(r(60).checkConfigOptions,{dev:"http://beta-vapp-ide.jd.com",prod:"https://vapp-ide-pack.jd.com",test:"http://test-vapp-ide.jdtest.net"}),b=function(){return e=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prod";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.URL=g[t]},t=[{key:"uploadProject",value:(E=u(c().mark((function e(t){var r,n,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.pack(t);case 3:if((r=e.sent).code===v){e.next=6;break}return e.abrupt("return",r);case 6:return n=r.data.result,e.next=9,this.loopQuery(t,n);case 9:if((o=e.sent).code===v){e.next=12;break}return e.abrupt("return",o);case 12:return e.abrupt("return",{code:v,packId:o.data});case 15:return e.prev=15,e.t0=e.catch(0),e.abrupt("return",{code:y,err_msg:e.t0 instanceof Error?e.t0.message:"上传失败"});case 18:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(e){return E.apply(this,arguments)})},{key:"sendPostRequest",value:(S=u(c().mark((function e(t,r){var n,o,i,s,u=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(i in n=u.length>2&&void 0!==u[2]?u[2]:"请求失败",o=new h,r)o.append(i,r[i]);return e.prev=3,e.next=6,p.post(t,o,{headers:a({},o.getHeaders())});case 6:if((s=e.sent).data.code!==v){e.next=9;break}return e.abrupt("return",{code:v,data:s.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(s.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(n,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t){return S.apply(this,arguments)})},{key:"pluginPublishRequest",value:(k=u(c().mark((function e(t,r,n,o){var a,i,s,u,l=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=l.length>4&&void 0!==l[4]?l[4]:"请求失败",i=JSON.stringify(r),s={method:"post",maxBodyLength:1/0,url:"".concat(t,"?appId=").concat(n,"&requestToken=").concat(o),headers:{"Content-Type":"application/json"},data:i},e.prev=3,e.next=6,p.request(s);case 6:if((u=e.sent).data.code!==v){e.next=9;break}return e.abrupt("return",{code:v,data:u.data});case 9:return e.abrupt("return",{code:y,err_msg:"".concat(a,": ").concat(u.data.errorMessage)});case 12:return e.prev=12,e.t0=e.catch(3),e.abrupt("return",{code:y,err_msg:"".concat(a,": ").concat(e.t0)});case 15:case"end":return e.stop()}}),e,null,[[3,12]])}))),function(e,t,r,n){return k.apply(this,arguments)})},{key:"pack",value:(x=u(c().mark((function e(t){var r,n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,a="".concat(this.URL,"/v1/devops/pack"),i={appId:n,requestToken:o,sourceFile:d.createReadStream(r)},e.abrupt("return",this.sendPostRequest(a,i,"文件上传报错"));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"loopQuery",value:(w=u(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=Date.now(),o=2e6,a=3e3;case 3:if(!(Date.now()-n<o)){e.next=15;break}return e.next=6,new Promise((function(e){return setTimeout(e,a)}));case 6:return e.next=8,this.queryPkgId(t,r);case 8:if((i=e.sent).code===v){e.next=11;break}return e.abrupt("return",{code:y,err_msg:i.err_msg});case 11:if(!i.data.result){e.next=13;break}return e.abrupt("return",{code:v,data:i.data.result});case 13:e.next=3;break;case 15:return e.abrupt("return",{code:y,err_msg:"查询超时"});case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"queryPkgId",value:(b=u(c().mark((function e(t,r){var n,o,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,a={appId:n,requestToken:o,uuid:r},e.abrupt("return",this.sendPostRequest("".concat(this.URL,"/v1/ci/queryPackIdByUuid"),a,"获取构建包id失效"));case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"generateQrCode",value:(m=u(c().mark((function e(t){var r,n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.packId,a={appId:r,requestToken:n,packId:o},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryQrcodeByPackId"),a,"获取二维码失效");case 4:if((i=e.sent).code===v){e.next=7;break}return e.abrupt("return",{code:y,err_msg:i.err_msg});case 7:if(!i.data.result){e.next=13;break}return(s=new Date).setMinutes(s.getMinutes()+25),e.abrupt("return",{code:v,imgUrl:i.data.result,expiredTime:"".concat(this.addZeroForShort(s.getHours()),":").concat(this.addZeroForShort(s.getMinutes()))});case 13:return e.abrupt("return",{code:y,err_msg:"二维码生成完成请求返回为空"});case 14:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"addZeroForShort",value:function(e){return String(e).length<2?"0".concat(String(e)):String(e)}},{key:"commitDevVersion",value:(f=u(c().mark((function e(t,r){var n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,a=t.versionName,i=t.description,s={packId:r,appId:n,requestToken:o,versionName:a,description:i},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/commitDevVersion"),s,"设置为开发版失效");case 4:if((u=e.sent).code===v){e.next=7;break}return e.abrupt("return",u);case 7:return e.abrupt("return",{code:v,devId:u.data.result});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return f.apply(this,arguments)})},{key:"setDevExperience",value:(s=u(c().mark((function e(t,r){var n,o,a,i;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.appId,o=t.requestToken,a={appId:n,requestToken:o,devId:r},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/devExperience"),a,"设置为体验版失效");case 4:if((i=e.sent).code===v){e.next=7;break}return e.abrupt("return",i);case 7:return e.abrupt("return",{code:v});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"queryExperienceQrcodeByPackId",value:(i=u(c().mark((function e(t){var r,n,o,a,i,s;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o={appId:r,requestToken:n},e.next=4,this.sendPostRequest("".concat(this.URL,"/v1/ci/queryExperienceQrcode"),o,"获取体验二维码失效");case 4:if((a=e.sent).code===v){e.next=7;break}return e.abrupt("return",{code:y,err_msg:a.err_msg});case 7:return i=a.data.result,(s=new Date).setMinutes(s.getMinutes()+25),e.abrupt("return",{code:v,imgUrl:i,expiredTime:"".concat(this.addZeroForShort(s.getHours()),":").concat(this.addZeroForShort(s.getMinutes()))});case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"uploadPlugin",value:(o=u(c().mark((function e(t){var r,n,o,a,i,s,u;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.sourceFile,n=t.appId,o=t.requestToken,a=t.versionName,i="".concat(this.URL,"/v1/ci/pluginPack"),s={appId:n,requestToken:o,versionName:a,sourceFile:d.createReadStream(r)},e.next=6,this.sendPostRequest(i,s,"插件构建报错");case 6:if((u=e.sent).code===v){e.next=9;break}return e.abrupt("return",{code:y,err_msg:u.err_msg});case 9:return e.abrupt("return",{code:v,result:u.data.result});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"publishPlugin",value:(n=u(c().mark((function e(t){var r,n,o,a,i,s,u,l,f;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.versionName,n=t.versionFeature,o=t.useGuide,a=t.packId,i=t.appId,s=t.requestToken,u="".concat(this.URL,"/v1/ci/plugin-dev"),l={versionName:r,versionFeature:n,useGuide:o,packId:a},e.next=6,this.pluginPublishRequest(u,l,i,s,"插件上传报错");case 6:if((f=e.sent).code===v){e.next=9;break}return e.abrupt("return",{code:y,err_msg:f.err_msg});case 9:return e.abrupt("return",{code:v});case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}],t&&l(e.prototype,t),r&&l(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,o,i,s,f,m,b,w,x,k,S,E}();e.exports=b},60:(e,t)=>{function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function o(e){return"string"==typeof e&&!!e.trim()}t.checkConfigOptions=function(e,t){var n=e||{},a=n.type,i=n.appId,c=n.requestToken,s=n.entry,u=n.versionName,l=n.description;if("game"!==a)return{code:-1,err_msg:"请选择项目构建类型为小游戏"};for(var f=1===t?{appId:i,requestToken:c,entry:s}:{appId:i,requestToken:c,entry:s,versionName:u,description:l},p=0,h=Object.entries(f);p<h.length;p++){var d=r(h[p],2),m=d[0];if(!o(d[1]))return{code:-1,err_msg:"".concat(m," 不能为空")}}return{code:0,err_msg:"ok"}},t.checkPluginConfig=function(e){var t=e||{},n=t.type,a=t.appId,i=t.requestToken,c=t.entry,s=t.versionName;if("plugin"!==n)return{code:-1,err_msg:"请选择项目构建类型为插件"};for(var u={appId:a,requestToken:i,entry:c,versionName:s},l=0,f=Object.entries(u);l<f.length;l++){var p=r(f[l],2),h=p[0];if(!o(p[1]))return{code:-1,err_msg:"".concat(h," 不能为空")}}return{code:0,err_msg:"ok"}}},664:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return(t=h(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:O(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&o.call(E,c)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(a,i,c,s){var u=h(e[a],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a<t.length;)if(o.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(P,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,s,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,c,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function l(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function f(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){l(a,n,o,i,c,"next",e)}function c(e){l(a,n,o,i,c,"throw",e)}i(void 0)}))}}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,h(n.key),n)}}function h(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var d=r(938),m=r(305),y=r(896),v=r(626),g=(r(759),r(427).downloadFile),b=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.apiUrls=v.getApiUrls(),this.defaultTimeout=6e4},t=[{key:"setEnv",value:function(e){e?(v.currentEnv="wasmdev",this.apiUrls=v.getApiUrls("wasmdev")):(v.currentEnv="wasmprod",this.apiUrls=v.getApiUrls("wasmprod"))}},{key:"downloadFile",value:(x=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.filePath,n=t.url,e.abrupt("return",new Promise((function(e,t){g({filePath:r,url:n,success:e,fail:t})})));case 2:case"end":return e.stop()}}),e)}))),function(e){return x.apply(this,arguments)})},{key:"uploadFile",value:(w=f(u().mark((function e(t){var r,n,o,a,i,s,l,f,p,h;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.filePath,a=t.category,(i=new m).append("category",a),i.append("appId",r),i.append("requestToken",n),i.append("sourceFile",y.createReadStream(o)),s={method:"post",url:this.apiUrls.UPLOAD_FILE,headers:c(c({},i.getHeaders()),{},{appId:r,requestToken:n}),data:i,maxBodyLength:1/0,maxContentLength:1/0,timeout:6e5},e.prev=7,e.next=10,d(s);case 10:if(l=e.sent,f=l.data,p=f.code,h=f.result,0!==p){e.next=16;break}return e.abrupt("return",h);case 16:throw new Error(l.data.errorMessage);case 17:e.next=22;break;case 19:throw e.prev=19,e.t0=e.catch(7),new Error("上传文件失败 File upload failed: ".concat(e.t0.message));case 22:case"end":return e.stop()}}),e,this,[[7,19]])}))),function(e){return w.apply(this,arguments)})},{key:"addGameVersion",value:(b=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({method:"post",url:this.apiUrls.ADD_GAME_VERSION,data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"initialize",value:(h=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({method:"post",url:this.apiUrls.INIT,timeout:this.defaultTimeout,data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getInitResult",value:(l=f(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({method:"get",url:this.apiUrls.GET_INIT_RES,timeout:this.defaultTimeout,params:t});case 2:if(0===(r=e.sent).data.code){e.next=5;break}throw new Error(r.data.errorMessage);case 5:return e.abrupt("return",r.data);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"split",value:(s=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({url:this.apiUrls.SPLIT,method:"post",data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getGameSplitInfo",value:(i=f(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({url:this.apiUrls.GET_GAME_SPLIT_INFO,method:"get",params:t});case 2:if(0===(r=e.sent).data.code){e.next=5;break}throw new Error(r.data.errorMessage);case 5:return e.abrupt("return",r.data);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getSymbolSize",value:(a=f(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d({method:"get",url:this.apiUrls.GET_SYMBOL_SIZE,params:t});case 2:if(0===(r=e.sent).data.code){e.next=5;break}throw new Error(r.data.errorMessage);case 5:return e.abrupt("return",r.data);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"reportCalledFuncs",value:(n=f(u().mark((function e(t){var r,n;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new FormData,Object.entries(t).forEach((function(e){var t=o(e,2),n=t[0],a=t[1];return r.append(n,a)})),e.next=4,d({url:this.apiUrls.REPORT_FUNS,method:"post",data:r});case 4:if(0===(n=e.sent).data.code){e.next=7;break}throw new Error(n.data.errorMessage);case 7:return e.abrupt("return",n.data);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})}],t&&p(e.prototype,t),r&&p(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,a,i,s,l,h,b,w,x}();e.exports=new b},626:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i=r(928),c=r(896),s=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.environments={wasmdev:"http://beta-vapp-ide.jd.com",wasmprod:"https://vapp-ide-pack.jd.com"},this.currentEnv="wasmdev"},t=[{key:"getBaseUrl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentEnv;return this.environments[e]}},{key:"getApiUrls",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.currentEnv,t=this.getBaseUrl(e);return{UPLOAD_FILE:"".concat(t,"/wasm/upload"),ADD_GAME_VERSION:"".concat(t,"/wasm/packageBind"),INIT:"".concat(t,"/wasm/initialize"),SPLIT:"".concat(t,"/wasm/build"),GET_GAME_SPLIT_INFO:"".concat(t,"/wasm/queryBuildResultBySubVersion"),DOWNLOAD_FILE:"".concat(t,"/wasm/download"),GET_SYMBOL_SIZE:"".concat(t,"/wasm/getSymbolSize"),GET_INIT_RES:"".concat(t,"/wasm/queryInitResult"),REPORT_FUNS:"".concat(t,"/wasm/reportWasmFunction")}}},{key:"loadProjectConfig",value:function(e){var t=i.resolve(e,"./jgc.config.js"),n="function"==typeof require?require:r(220);delete n.cache[n.resolve(t)];var o=n(t),a=o.type,s=void 0===a?"game":a,u=o.entry,l=o.appId,f=o.requestToken,p=i.resolve(e,u),h=i.resolve(p,"./.codesplitcache"),d=i.resolve(h,"./original"),m=i.resolve(d,"./wasmcode/");return c.existsSync(h)||c.mkdirSync(h,{recursive:!0}),c.existsSync(d)||c.mkdirSync(d,{recursive:!0}),c.existsSync(m)||c.mkdirSync(m,{recursive:!0}),{type:s,entry:u,appId:l,requestToken:f,mainWasmCachePath:c.readdirSync(m).filter((function(e){return".br"===i.extname(e)}))[0],originalCacheDir:d,fullEntryPath:p}}}],t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=new s},46:e=>{e.exports={createWasmSplitCodeBySimd:function(){return'import {\n tableSize,\n setImportGlobal\n } from "./import-func-index";\n import {\n\n isIOS\n } from "./check-version";\n\n let b = (wx.getAccountInfoSync() || {}).miniProgram;\n const isTrial = b && "release" != b.envVersion;\n let subpackageTask,\n callbackArray = [],\n isLoaded = false;\n\n function loadSubWasmPackage(doneCallback, needBlock) {\n if (isLoaded) {\n doneCallback(needBlock);\n return;\n }\n let loadStart = Date.now();\n GameGlobal.unityNamespace.eventLog("start loadSubPackage wasmcode1");\n callbackArray.push({\n callback: doneCallback,\n needBlock: needBlock,\n });\n if (!subpackageTask) {\n subpackageTask = wx.loadSubpackage({\n name: "wasmcode1",\n success() {\n let a = Date.now() - loadStart;\n GameGlobal.unityNamespace.eventLog("下载代码分包1完毕: ", (a / 1e3).toFixed(2), "s");\n GameGlobal.manager.subWasmDownloaded(a);\n isLoaded = true;\n callbackArray.forEach((a) => a.callback(a.needBlock));\n callbackArray = [];\n },\n fail(a) {\n GameGlobal.manager.Logger.pluginError("load wasmcode1 fail:", a);\n GameGlobal.manager.subWasmDownloadError(a);\n },\n });\n let currentProgress = 0;\n subpackageTask.onProgressUpdate((e) => {\n var t = Math.floor(e.progress / 10);\n if (t != currentProgress) {\n let a = (e.totalBytesWritten / 1048576).toFixed(2),\n t = (e.totalBytesExpectedToWrite / 1048576).toFixed(2);\n console.log("代码分包1下载进度", e.progress, a, "MB;", t, "MB");\n }\n currentProgress = t;\n });\n }\n\n }\n let loadedSub = false,\n isInstanced = false;\n function reTry(a) {\n let e = function () {\n isInstanced ? a() : setTimeout(e, 1);\n };\n setTimeout(e, 1);\n }\n\n function h(needBlock) {\n GameGlobal.unityNamespace.eventLog("start compileSubWasm: needBlock ", needBlock);\n GameGlobal.manager.beforeLoadSubWasm();\n let instanceStart = Date.now();\n const subWasmPath = "wasmcode1/" + GameGlobal.unityNamespace.CODE_FILE_MD5 + "." + GameGlobal.unityNamespace.GAME_NAME + ".wasm.code.unityweb.wasm.br";\n let callback = (a) => {\n let cost = Date.now() - instanceStart;\n GameGlobal.manager.subWasmCompiled(cost);\n GameGlobal.unityNamespace.eventLog("[PLUGIN SUBWASM LOG]subwasm loaded: ", cost);\n isInstanced = true;\n\n };\n WXWebAssembly.instantiate(subWasmPath, wasm_split_info)\n .then(callback)\n .catch((a) => {\n console.error("wasmcode1 catch ", a);\n });\n }\n\n\n function invokeWait(needBlock) {\n if (!isInstanced) {\n if (!loadedSub) {\n loadedSub = true;\n GameGlobal.unityNamespace.eventLog("start instantiateSubWasm: needBlock ", needBlock);\n loadSubWasmPackage(h, needBlock);\n }\n\n }\n }\n\n function innerInvokeWasmBuffer(funcName, e) {\n\n GameGlobal.manager.wasmsplit.innerInvokeWasmBuffer({\n funcName: funcName,\n importObj: window.wasm_split_info,\n fail(t) {\n if (e > 0) {\n GameGlobal.unityNamespace.eventLog("fetch table_id: ", funcName, "; remainRetryTimes: ", e);\n return innerInvokeWasmBuffer(funcName, e - 1);\n }\n GameGlobal.unityNamespace.eventLog(\n "fetch table_id:",\n funcName,\n "; md5: ",\n GameGlobal.unityNamespace.CODE_FILE_MD5,\n "; subversion: ",\n GameGlobal.unityNamespace.WASM_SPLIT_SUB_VERSION,\n "; err: ",\n t\n );\n if ("system error" === t.errmsg || "content is null" === t.errmsg) {\n GameGlobal.onCrash();\n } else {\n invokeWait(true);\n\n }\n },\n });\n }\n window.Math_abs = Math.abs;\n window.Math_cos = Math.cos;\n window.Math_sin = Math.sin;\n window.Math_sqrt = Math.sqrt;\n window.Math_ceil = Math.ceil;\n window.Math_floor = Math.floor;\n window.Math_pow = Math.pow;\n window.Math_min = Math.min;\n window.Math_max = Math.max;\n window.Math_fround = Math.fround;\n window.Math_imul = Math.imul;\n window.Math_clz32 = Math.clz32;\n window.Math_trunc = Math.trunc;\n window.FUNCTION_TABLE = [];\n let subCalledSet = new Set(),\n globalCalledSet = new Set();;\n\n function _reportCalledFunc() {\n\n if (subCalledSet.size > 0) {\n GameGlobal.manager.reportCalledFuncs({\n called_func_list: Array.from(subCalledSet),\n sub_version: GameGlobal.unityNamespace.WASM_SPLIT_SUB_VERSION,\n func_type: 1,\n });\n subCalledSet.clear();\n }\n\n setTimeout(_reportCalledFunc, 5000);\n }\n\n GameGlobal.unityNamespace.reportCalledFunc = _reportCalledFunc;\n\n if (!GameGlobal.unityNamespace.pluginCalledMainCbs) {\n GameGlobal.unityNamespace.pluginCalledMainCbs = [];\n }\n\n if (!GameGlobal.unityNamespace.pluginCalledMainCb) {\n GameGlobal.unityNamespace.pluginCalledMainCb = function () {\n this.pluginCalledMainCbs.forEach((a) => a());\n };\n }\n\n isTrial && !GameGlobal.canUseH5Renderer && GameGlobal.unityNamespace.pluginCalledMainCbs.push(_reportCalledFunc);\n\n GameGlobal.unityNamespace.instantiateWasm = function (instantiateWasmInfo, receiveInstance) {\n console.log("in wasm-split instantiateWasm");\n const module = GameGlobal.manager.gameInstance.Module,\n asm2wasm = (instantiateWasmInfo.asm2wasm = instantiateWasmInfo.asm2wasm || {});\n asm2wasm["f64-to-int"] =\n asm2wasm["f64-to-int"] ||\n function (a) {\n return 0 | a;\n };\n asm2wasm["f64-rem"] =\n asm2wasm["f64-rem"] ||\n function (a, e) {\n return a % e;\n };\n\n instantiateWasmInfo.env = instantiateWasmInfo.env || {};\n\n instantiateWasmInfo.primary = {\n table: instantiateWasmInfo.env.table ||\n new WebAssembly.Table({\n initial: tableSize,\n maximum: tableSize,\n element: "anyfunc",\n }),\n memory: instantiateWasmInfo.env.memory,\n };\n\n setImportGlobal(instantiateWasmInfo);\n\n instantiateWasmInfo.wasm_split = instantiateWasmInfo.wasm_split || {};\n instantiateWasmInfo.wasm_split.wait = function () {\n let waitTableId = GameGlobal.unityNamespace.waitTableId.value;\n GameGlobal.unityNamespace.eventLog("wait for func: ", waitTableId);\n if (isIOS && GameGlobal.canUseH5Renderer) {\n return innerInvokeWasmBuffer(waitTableId.toString(), 3);\n }\n invokeWait(true);\n if (GameGlobal.manager.wasmsplit && GameGlobal.manager.wasmsplit.checkNeedReportMissPatchFunc) {\n GameGlobal.manager.wasmsplit.checkNeedReportMissPatchFunc(waitTableId);\n }\n };\n\n if (GameGlobal.canUseH5Renderer) {\n instantiateWasmInfo.wasm_split.logCall = function (a, e) {};\n } else {\n instantiateWasmInfo.wasm_split.logCall = function (a, e) {\n if (e) {\n if (!globalCalledSet.has(a)) {\n globalCalledSet.add(a);\n subCalledSet.add(a);\n }\n }\n };\n }\n instantiateWasmInfo.wasm_split.__wasm_split_waitTableId = GameGlobal.unityNamespace.waitTableId = new WebAssembly.Global({\n value: "i32",\n mutable: true,\n });\n\n window.wasm_split_info = instantiateWasmInfo;\n let wasmPath = module.wasmPath;\n WebAssembly.instantiate(wasmPath, instantiateWasmInfo).then((resultObject) => {\n let primaryTable = instantiateWasmInfo.primary.table;\n for (var o = 0; o < primaryTable.length; ++o) {\n window.FUNCTION_TABLE[o] = primaryTable.get(o);\n }\n //instance: 包含所有导出的 WebAssembly 函数的 WebAssembly.Instance 对象。\n Object.entries(resultObject.instance.exports).forEach((instanceFunc) => {\n //["ur", Memory(4096)], ["vr", ƒ]\n if ("object" == typeof instanceFunc[1] && instanceFunc[1] instanceof WebAssembly.Memory) {\n instantiateWasmInfo.primary.memory = instanceFunc[1];\n asm2wasm.__wasm_memory_size = window.__wasm_memory_size = () => (instanceFunc[1].buffer.byteLength / 65536) | 0;\n }\n if (instanceFunc[0].startsWith("wasm_split.")) {\n instantiateWasmInfo.primary[instanceFunc[0]] = instanceFunc[1];\n }\n });\n instantiateWasmInfo.primary["wasm_split.initGlobal"] = resultObject.instance.exports.initGlobal;\n resultObject.instance.exports.initGlobal();\n module.asm = resultObject.instance.exports;\n if(isIOS && GameGlobal.canUseH5Renderer){\n receiveInstance(resultObject.instance, resultObject.module)\n }else{\n invokeWait(true);\n reTry(() => receiveInstance(resultObject.instance, resultObject.module));\n }\n });\n return {};\n };\n GameGlobal.unityNamespace.compileSubWasm = function () {\n return new Promise((reslove) => {\n GameGlobal.unityNamespace.eventLog("start asyncCompileSubWasm");\n if (isInstanced) return reslove();\n loadSubWasmPackage(() => {\n GameGlobal.unityNamespace.eventLog("async load subpackage done");\n }, false);\n });\n };'},createImportFuncIndexCodeBySimd:function(e,t,r,n,o){return"export const importSubFuncIndexList = [];\nexport const tableSize = ".concat(e,";\nGameGlobal.unityNamespace.wasmSubVersion =").concat(t,';\nGameGlobal.unityNamespace.baseUrl ="').concat(r?"http://beta-vapp-ide.jd.com":"https://vapp-ide-pack.jd.com",'";\nGameGlobal.unityNamespace.requestToken = "').concat(n,'";\n').concat(r?" wx.requestWebCookie && wx.requestWebCookie({needpin: 1,success(e){ GameGlobal.unityNamespace.webcookieInfo = {pt_pin: e.pt_pin, pt_ket: e.ticket}}});":"",'\nexport function setImportGlobal(info) {info["primary"] = info["primary"] || {};info["primary"]["__stack_pointer"] = new WebAssembly.Global({\n value: "i32",\n mutable: true\n });info["primary"]["__stack_end"] = new WebAssembly.Global({\n value: "i32",\n mutable: true\n });info["primary"]["__stack_base"] = new WebAssembly.Global({\n value: "i32",\n mutable: true\n });};\n \n export function setStackPointer(info) {\n\n }\n \n export function setImportFunc(info, jCall) {\n \n }\n \n ')}}},225:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function c(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}var s=r(896),u=r(23).promisify,l=r(759),f=u(s.readFile),p=u(s.writeFile);function h(){var e;return e=o().mark((function e(t,r){var n,a,i,c,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=!(s.length>2&&void 0!==s[2])||s[2],e.prev=1,e.next=4,f(t,"utf8");case 4:if(a=e.sent,i=JSON.parse(a),c=d(i),!n){e.next=11;break}return e.next=10,p(r,JSON.stringify(c,null,2));case 10:return e.abrupt("return");case 11:return e.abrupt("return",c);case 14:throw e.prev=14,e.t0=e.catch(1),l.logErr("处理文件时发生错误: ".concat(e.t0.message)),e.t0;case 18:case"end":return e.stop()}}),e,null,[[1,14]])})),h=function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){c(a,n,o,i,s,"next",e)}function s(e){c(a,n,o,i,s,"throw",e)}i(void 0)}))},h.apply(this,arguments)}function d(e){var t={"\\28":"(","\\29":")","\\5b":"[","\\5d":"]","\\2c":",","\\20":" "},r={};return Object.entries(e).forEach((function(e){var n=a(e,2),o=n[0],i=n[1];Object.entries(t).forEach((function(e){var t=a(e,2),r=t[0],n=t[1];i=i.replace(new RegExp(r,"g"),n)})),r[o]=i})),r}e.exports=function(e,t){return h.apply(this,arguments)}},427:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function c(e){a(i,n,o,c,s,"next",e)}function s(e){a(i,n,o,c,s,"throw",e)}c(void 0)}))}}var c,s=r(896),u=s.promises,l=r(928),f=r(938),p=function(e,t){return{filePath:e?t:void 0,tempFilePath:t,statusCode:200}},h=function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,u.access(t);case 3:e.next=9;break;case 5:return e.prev=5,e.t0=e.catch(0),e.next=9,u.mkdir(t,{recursive:!0});case 9:case"end":return e.stop()}}),e,null,[[0,5]])})));return function(t){return e.apply(this,arguments)}}(),d=function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,u.stat(t);case 3:if(!e.sent.isDirectory()){e.next=7;break}return e.next=7,u.rm(t,{recursive:!0});case 7:e.next=11;break;case 9:e.prev=9,e.t0=e.catch(0);case 11:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(t){return e.apply(this,arguments)}}();e.exports={downloadFile:(c=i(o().mark((function e(t){var r,n,a,c,m,y,v,g,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.url,n=t.filePath,a=t.success,c=t.fail,m=t.complete,y={success:a,fail:c,complete:m},e.prev=2,e.next=5,h(l.dirname(n));case 5:return e.next=7,d(n);case 7:return e.next=9,f({method:"get",url:r,responseType:"stream"});case 9:return v=e.sent,g=s.createWriteStream(n),v.data.pipe(g),e.abrupt("return",new Promise((function(e,t){var r=0,a=parseInt(v.headers["content-length"]),c=v.headers["transfer-encoding"];g.on("finish",i(o().mark((function i(){var s,l,f;return o().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(o.prev=0,"chunked"===c||!a||r===a){o.next=5;break}return o.next=4,u.unlink(n);case 4:throw new Error("Download incomplete: Received ".concat(r," of ").concat(a," bytes"));case 5:null===(s=y.success)||void 0===s||s.call(y,p(!0,n)),e(p(!0,n)),o.next=13;break;case 9:o.prev=9,o.t0=o.catch(0),null===(l=y.fail)||void 0===l||l.call(y,{errMsg:o.t0.message}),t(o.t0);case 13:return o.prev=13,null===(f=y.complete)||void 0===f||f.call(y),o.finish(13);case 16:case"end":return o.stop()}}),i,null,[[0,9,13,16]])})))),g.on("error",function(){var e=i(o().mark((function e(r){var a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,u.unlink(n).catch((function(){}));case 2:null===(a=y.fail)||void 0===a||a.call(y,{errMsg:"Write failed: ".concat(r.message)}),t(r);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),v.data.on("data",(function(e){r+=e.length}))})));case 15:return e.prev=15,e.t0=e.catch(2),e.next=19,u.unlink(n).catch((function(){}));case 19:throw null===(b=y.fail)||void 0===b||b.call(y,{errMsg:"Download failed: ".concat(e.t0.message)}),e.t0;case 21:case"end":return e.stop()}}),e,null,[[2,15]])}))),function(e){return c.apply(this,arguments)})}},322:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i=r(896),c=r(928),s=r(410),u=r(46),l=u.createWasmSplitCodeBySimd,f=u.createImportFuncIndexCodeBySimd,p=r(377),h=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},r=[{key:"syncPluginCacheFiles",value:function(e,t){this.ensureDirectoryExists(t),this.copyBrFiles(e,t),this.copyFixedFiles(e,t)}},{key:"ensureDirectoryExists",value:function(e){i.existsSync(e)||i.mkdirSync(e,{recursive:!0})}},{key:"copyBrFiles",value:function(e,t){var r=this,n=c.join(e,"wasmcode1");if(i.existsSync(n))throw new Error("文件备份错误,检查wasm文件是否是已分包版本");var o=c.join(t,"wasmcode");i.existsSync(o)&&i.rmSync(o,{recursive:!0,force:!0}),i.mkdirSync(o,{recursive:!0});var a=c.join(e,"wasmcode","*.br");s.sync(a).forEach((function(n){var o=c.relative(e,n),a=c.join(t,o),s=c.dirname(a);r.ensureDirectoryExists(s),i.copyFileSync(n,a)}))}},{key:"copyFixedFiles",value:function(e,t){["game.js","game.json","webgl.wasm.framework.unityweb.js","weapp-adapter.js"].forEach((function(r){var n=c.join(e,r),o=c.join(t,r);if(!i.existsSync(o)){if(!i.existsSync(n))throw new Error("Source file missing: ".concat(n));i.copyFileSync(n,o)}}))}},{key:"processJavaScriptFiles",value:function(e,t,r){this.config=r,i.copyFileSync(c.resolve(r.originalCacheDir,"./game.json"),c.resolve(t,"game.json"));var n=f(e.tableSize,e.subVersion,r.isPre,r.requestToken,r.isRelease);i.writeFileSync(c.resolve(t,"./import-func-index.js"),n);var o=l("");i.writeFileSync(c.resolve(t,"./wasm-split.js"),o);var a=c.resolve(t,"./wasmcode1/");i.writeFileSync(c.resolve(a,"game.js"),"")}},{key:"updateConfigFiles",value:function(e,t,r){this.config=r,this.updateGameJson(e,t),this.updateFrameworkJs(e,t),this.updateGameJs(e,t),this.updateAdapterJs(e,t)}},{key:"updateGameJson",value:function(e,t){var r=JSON.parse(i.readFileSync(c.resolve(this.config.originalCacheDir,"game.json")));r.subpackages.push({name:"wasmcode1",root:"wasmcode1/"}),r.plugins.UnityPlugin.version="1.2.58",i.writeFileSync(c.resolve(t,"game.json"),JSON.stringify(r,null,2))}},{key:"updateFrameworkJs",value:function(e,t){var r=c.resolve(this.config.originalCacheDir,"./webgl.wasm.framework.unityweb.js"),n=c.resolve(t,"./webgl.wasm.framework.unityweb.js"),o=i.readFileSync(r,"utf-8");p.forEach((function(e){o=o.replace(e.reg,e.replaceMethod)})),o+=";\nGameGlobal.unityNamespace.useWasmCodeSplit=true;GameGlobal.unityNamespace.WASM_SPLIT_SUB_VERSION=".concat(e.subVersion,";\n"),i.writeFileSync(n,o)}},{key:"updateGameJs",value:function(e,t){var r=this,n=c.resolve(this.config.originalCacheDir,"./game.js"),o=c.resolve(t,"./game.js"),a=i.readFileSync(n,"utf-8");[{reg:/const\s*_unityNamespace\s*=\s*_interopRequireDefault\(require\('\.\/unity-namespace'\)\)/gi,replaceMethod:function(){return"const _unityNamespace = _interopRequireDefault(require('./unity-namespace')); \n require('./wasm-split.js')"}},{reg:"GameGlobal.managerConfig = managerConfig;",replaceMethod:function(){return"GameGlobal.managerConfig = managerConfig; \nGameGlobal.canUseH5Renderer = ".concat(!!r.config.isRelease,";")}},{reg:"import unityNamespace from './unity-namespace';",replaceMethod:function(){return"import unityNamespace from './unity-namespace';\n import wasm_split from './wasm-split'"}},{reg:/APPID:\s*['"][^'"]*['"]/gi,replaceMethod:function(){return"APPID:'".concat(r.config.appId,"'")}}].forEach((function(e){a=a.replace(e.reg,e.replaceMethod)})),i.writeFileSync(o,a)}},{key:"updateAdapterJs",value:function(e,t){var r=c.resolve(this.config.originalCacheDir,"./weapp-adapter.js"),n=c.resolve(t,"./weapp-adapter.js"),o=i.readFileSync(r,"utf-8");o='"function" == typeof XMLHttpRequest&&(GameGlobal.nativeXHR = XMLHttpRequest);\n"object" == typeof WebAssembly&&(GameGlobal.nativeWASM = WebAssembly);'+o,i.writeFileSync(n,o)}}],(t=null)&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();e.exports=h},471:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i,c,s,u=r(896),l=r(928),f=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},r=[{key:"validateProjectStructure",value:function(e,t,r){var n=l.resolve(r,"./jgc.config.js");if(!this.isReadable(n))return{code:-1,msg:null,errMsg:"请先创建配置文件!"};if(!this.isReadable(t.fullEntryPath))return this.ERROR_MESSAGES[e].ENTRY_NOT_FOUND;var o=l.resolve(t.fullEntryPath,"game.json");try{var a;if(null===(a=JSON.parse(u.readFileSync(o,"utf-8")).plugins)||void 0===a||!a.UnityPlugin)return this.ERROR_MESSAGES[e].NOT_UNITY_GAME}catch(t){return this.ERROR_MESSAGES[e].GAME_JSON_NOT_FOUND}return{valid:!0}}},{key:"isReadable",value:function(e){try{return u.accessSync(e,u.constants.R_OK),!0}catch(e){return!1}}}],(t=null)&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}();i=f,s={init:{ENTRY_NOT_FOUND:{code:-1,msg:"分包初始化失败",errMsg:"请检查entry是否存在"},NOT_UNITY_GAME:{code:-1,msg:"分包初始化失败",errMsg:"该游戏不是unity游戏"},GAME_JSON_NOT_FOUND:{code:-1,msg:"分包初始化失败",errMsg:"请检查game.json是否存在"}},split:{ENTRY_NOT_FOUND:{code:-1,msg:"WASM分包失败",errMsg:"请检查entry是否存在"},NOT_UNITY_GAME:{code:-1,msg:"WASM分包失败",errMsg:"该游戏不是unity游戏"},GAME_JSON_NOT_FOUND:{code:-1,msg:"WASM分包失败",errMsg:"请检查game.json是否存在"}}},(c=a(c="ERROR_MESSAGES"))in i?Object.defineProperty(i,c,{value:s,enumerable:!0,configurable:!0,writable:!0}):i[c]=s,e.exports=f},377:e=>{e.exports=[{reg:/Module\[('|")HEAP8('|")\]\s*=\s*HEAP8\s*=\s*new\s*Int8Array/gi,replaceMethod:function(){return'Module["HEAP8"] = window.EMSCRIPTEN_HEAP8 = HEAP8 = new Int8Array'}},{reg:/Module\[('|")HEAP16('|")\]\s*=\s*HEAP16\s*=\s*new\s*Int16Array/gi,replaceMethod:function(){return'Module["HEAP16"] = window.EMSCRIPTEN_HEAP16 = HEAP16 = new Int16Array'}},{reg:/Module\[('|")HEAP32('|")\]\s*=\s*HEAP32\s*=\s*new\s*Int32Array/gi,replaceMethod:function(){return'Module["HEAP32"] = window.EMSCRIPTEN_HEAP32 = HEAP32 = new Int32Array'}},{reg:/Module\[('|")HEAPU8('|")\]\s*=\s*HEAPU8\s*=\s*new\s*Uint8Array/gi,replaceMethod:function(){return'Module["HEAPU8"] = window.EMSCRIPTEN_HEAPU8 = HEAPU8 = new Uint8Array'}},{reg:/Module\[('|")HEAPU16('|")\]\s*=\s*HEAPU16\s*=\s*new\s*Uint16Array/gi,replaceMethod:function(){return'Module["HEAPU16"] = window.EMSCRIPTEN_HEAPU16 = HEAPU16 = new Uint16Array'}},{reg:/Module\[('|")HEAPU32('|")\]\s*=\s*HEAPU32\s*=\s*new\s*Uint32Array/gi,replaceMethod:function(){return'Module["HEAPU32"] = window.EMSCRIPTEN_HEAPU32 = HEAPU32 = new Uint32Array'}},{reg:/Module\[('|")HEAPF32('|")\]\s*=\s*HEAPF32\s*=\s*new\s*Float32Array/gi,replaceMethod:function(){return'Module["HEAPF32"] = window.EMSCRIPTEN_HEAPF32 = HEAPF32 = new Float32Array'}},{reg:/Module\[('|")HEAPF64('|")\]\s*=\s*HEAPF64\s*=\s*new\s*Float64Array/gi,replaceMethod:function(){return'Module["HEAPF64"] = window.EMSCRIPTEN_HEAPF64 = HEAPF64 = new Float64Array'}},{reg:"calledMain = true;",replaceMethod:function(){return"if (GameGlobal.unityNamespace.pluginCalledMainCb) {\n GameGlobal.unityNamespace.pluginCalledMainCb()\n }\n calledMain = true;"}}]},175:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,c(n.key),n)}}function a(e,t,r){return t&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t,r){return(t=c(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function c(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var s=r(320),u=new(a((function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),i(this,"wasmInit",(function(e){return s.init(e)})),i(this,"wasmUpdate",(function(e){return s.init(Object.assign(e,{isUpdate:!0}))})),i(this,"wasmSplitDev",(function(e){return s.splitBase(Object.assign(e,{isRelease:!1}))})),i(this,"wasmSplitProd",(function(e){return s.splitBase(Object.assign(e,{isRelease:!0}))})),i(this,"wasmSplitInfo",(function(e){return s.getSplitInfo(e)})),i(this,"wasmSplitReport",(function(e){return s.reportCalledFuncs(e)}))}))),l=u.wasmInit,f=u.wasmUpdate,p=u.wasmSplitDev,h=u.wasmSplitProd,d=u.wasmSplitInfo,m=u.wasmSplitReport;e.exports={wasmInit:l,wasmUpdate:f,wasmSplitDev:p,wasmSplitProd:h,wasmSplitInfo:d,wasmSplitReport:m}},759:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,a(n.key),n)}}function a(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var i,c=r(895),s=r(720);e.exports=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)},r=[{key:"logStep",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).log.apply(t,[c.green("> ".concat(e))].concat(n))}},{key:"log",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];setTimeout((function(){var t;(t=console).log.apply(t,[c.green(e)].concat(r))}),0)}},{key:"logInfo",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).log.apply(t,[e].concat(n))}},{key:"logErr",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];(t=console).log.apply(t,[c.red(e)].concat(n))}},{key:"startLogProcess",value:function(e){var t=s(e).start(),r={stop:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e+" 失败";"fail"==(arguments.length>1?arguments[1]:void 0)?t.fail(e):t.succeed(e)}};return i=r,r}},{key:"endLogProcess",value:function(e,t){e||(e=i),e&&"function"==typeof e.stop&&e.stop(t,"fail")}}],(t=null)&&o(e.prototype,t),r&&o(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}()},901:e=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,n(o.key),o)}}function n(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}var o=function(){return e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.configPrompts=[{name:"entry",type:"input",message:"请输入函数名文件所在路径:",default:"./"}]},(t=[{key:"getPrompts",value:function(){return this.configPrompts}}])&&r(e.prototype,t),n&&r(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,n}();e.exports=o},320:(e,t,r)=>{function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return c=e.done,e},e:function(e){s=!0,a=e},f:function(){try{c||null==r.return||r.return()}finally{if(s)throw a}}}}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,a,i,c=[],s=!0,u=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=a.call(r)).done)&&(c.push(n.value),c.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return c}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){if(e){if("string"==typeof e)return c(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function s(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */s=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",u=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),c=new G(n||[]);return a(i,"_invoke",{value:O(e,r,c)}),i}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,c,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&o.call(E,c)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(a,i,c,s){var u=h(e[a],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var i;a(this,"_invoke",{value:function(e,n){function o(){return new t((function(t,o){r(e,n,t,o)}))}return i=i?i.then(o,o):o()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,i=function r(){for(;++a<t.length;)if(o.call(t,a))return r.value=t[a],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,a(P,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,c,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function u(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function l(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function i(e){u(a,n,o,i,c,"next",e)}function c(e){u(a,n,o,i,c,"throw",e)}i(void 0)}))}}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,p(n.key),n)}}function p(e){var t=function(e,t){if("object"!=n(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!=n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==n(t)?t:t+""}var h=r(928),d=r(896),m=r(626),y=r(471),v=r(664),g=r(322),b=r(759),w=r(225),x=(r(427).downloadFile,r(901)),k=r(937),S=function(){return e=function e(){var t,r,n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,r="downloadSplitedFiles",n=function(){var e=l(s().mark((function e(t){var r,n,o,a,i,c,u,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.md5,a=t.subVersion,i=t.mainWasmFileUrl,c=t.mainWasmFilePath,u=t.subWasmFileUrl,l=t.subWasmFilePath,e.abrupt("return",Promise.all([v.downloadFile({appId:r,requestToken:n,md5:o,subVersion:a,category:3,filePath:c,url:i}),v.downloadFile({appId:r,requestToken:n,md5:o,subVersion:a,category:4,filePath:l,url:u})]));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),(r=p(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.config=null,this.codeMd5=null,this.uploadedWasmCodeBlobId=null,this.uploadedSymbolBlobId=null,this.importLength=null,this.tableSize=null},t=[{key:"validateProject",value:function(e,t,r,n){v.setEnv(r);try{return this.config=m.loadProjectConfig(t),this.config.isPre=r,n&&(this.config.isRelease=!0),y.validateProjectStructure(e,this.config,t)}catch(e){return{code:-1,msg:null,errMsg:"配置加载失败: ".concat(e.message)}}}},{key:"uploadSplitBaseFiles",value:(F=l(s().mark((function e(t){var r,n,o,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.wasmFilePath,a=t.symbolFilePath,e.abrupt("return",Promise.all([v.uploadFile({appId:r,requestToken:n,filePath:o,category:0}),v.uploadFile({appId:r,requestToken:n,filePath:a,category:1})]));case 2:case"end":return e.stop()}}),e)}))),function(e){return F.apply(this,arguments)})},{key:"addGameVersion",value:(N=l(s().mark((function e(){var t;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={appId:this.config.appId,md5:this.codeMd5,versionDesc:"test",unityVersion:"1.0.0",unityPluginVersion:"1.0.0",wasmSplitPluginVersion:"1.0.0",wasmFileId:this.uploadedWasmCodeBlobId,symbolFileId:this.uploadedSymbolBlobId,requestToken:this.config.requestToken},e.next=3,v.addGameVersion(t);case 3:if(0===e.sent.code){e.next=6;break}throw new Error("游戏版本已经存在");case 6:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"initialize",value:(G=l(s().mark((function e(t){var r,n,o,a,i,c=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.isUpdate,n={appId:this.config.appId,md5:this.codeMd5,requestToken:this.config.requestToken,incrementUpdate:!!r},e.next=4,v.initialize(n);case 4:return o=e.sent,a=o.result,i={appId:this.config.appId,md5:this.codeMd5,requestToken:this.config.requestToken,uuid:a},e.abrupt("return",this.pollForResult((function(){return v.getInitResult(i)}),(function(e){if(e.result){var t=e.result,r=t.importSize,n=t.tableSize;return c.importLength=r,c.tableSize=n,b.log("importLength: ",c.importLength),b.log("tableSize: ",c.tableSize),!0}return!1})));case 8:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"pollForResult",value:(T=l(s().mark((function e(t,r){var n,o=arguments;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:5e3,e.abrupt("return",new Promise((function(e,o){var a=function(){var i=l(s().mark((function i(){var c;return s().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.prev=0,i.next=3,t();case 3:c=i.sent,r(c)?e(c):setTimeout(a,n),i.next=10;break;case 7:i.prev=7,i.t0=i.catch(0),o(i.t0);case 10:case"end":return i.stop()}}),i,null,[[0,7]])})));return function(){return i.apply(this,arguments)}}();a()})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return T.apply(this,arguments)})},{key:"init",value:(I=l(s().mark((function e(t){var r,n,o,a;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this.validateProject("init",t.srcPath,t.isPreEnv)).valid){e.next=3;break}return e.abrupt("return",r);case 3:return e.prev=3,n=h.resolve(this.config.entry,"./.codesplitcache"),o=h.resolve(n,"./original"),this.setupCacheDirectories(n,o),a=b.startLogProcess("文件备份开始"),g.syncPluginCacheFiles(this.config.entry,o),a.stop("文件备份完成"),e.next=12,this.processSymbolFiles(n,o,t.isUpdate);case 12:return a=b.startLogProcess("开始上传文件"),e.next=15,this.uploadFiles(o,n);case 15:return a.stop("上传文件成功"),a=b.startLogProcess("添加游戏版本"),e.next=19,this.addGameVersion();case 19:return a.stop("添加游戏版本成功"),a=b.startLogProcess("初始化启动"),e.next=23,this.initialize({isUpdate:t.isUpdate});case 23:return a.stop("初始化完成"),this.saveSplitConfig(n),e.abrupt("return",{code:0,msg:"WASM分包初始化完成",errMsg:null});case 28:return e.prev=28,e.t0=e.catch(3),b.endLogProcess(null,e.t0.message),e.abrupt("return",{code:-1,msg:"初始化失败",errMsg:e.t0.message});case 32:case"end":return e.stop()}}),e,this,[[3,28]])}))),function(e){return I.apply(this,arguments)})},{key:"setupCacheDirectories",value:function(e,t){var r=h.resolve(t,"./wasmcode/"),n=h.resolve(t,this.config.entry,"./wasmcode1/");[t,r].forEach((function(e){d.existsSync(e)||d.mkdirSync(e,{recursive:!0})})),d.existsSync(n)&&d.rmSync(n,{recursive:!0})}},{key:"processSymbolFiles",value:(L=l(s().mark((function e(t,r,n){var o,a,i,c,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=h.resolve(t,"./unpack"),a=h.resolve(this.config.entry,"./webgl.wasm.symbols.unityweb"),i=h.resolve(o,"./symbol.json"),n||d.existsSync(o)||d.mkdirSync(o,{recursive:!0}),e.next=6,w(a,i);case 6:return c=h.resolve(r,"./wasmcode/"),u=d.readdirSync(c).find((function(e){return".br"===h.extname(e)})),this.codeMd5=u.split(".")[0],e.abrupt("return",{unpackSymbolsPath:i,mainWasmCachePath:u,mainWasmCacheDir:c});case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return L.apply(this,arguments)})},{key:"uploadFiles",value:(O=l(s().mark((function e(t,r){var n,o,i,c,u,l,f;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.processSymbolFiles(r,t,!1);case 2:return n=e.sent,o=n.unpackSymbolsPath,i=n.mainWasmCachePath,n.mainWasmCacheDir,e.next=8,this.uploadSplitBaseFiles({appId:this.config.appId,requestToken:this.config.requestToken,wasmFilePath:h.join(t,"wasmcode",i),symbolFilePath:o});case 8:if(c=e.sent,u=a(c,2),l=u[0],f=u[1],l&&f){e.next=14;break}throw new Error("上传文件失败");case 14:this.uploadedWasmCodeBlobId=l,this.uploadedSymbolBlobId=f;case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return O.apply(this,arguments)})},{key:"saveSplitConfig",value:function(e){var t=h.resolve(e,"./codesplit-config.json"),r={appId:this.config.appId,codeMd5:this.codeMd5,tableSize:this.tableSize,uploadedWasmCodeBlobId:this.uploadedWasmCodeBlobId,uploadedSymbolBlobId:this.uploadedSymbolBlobId,importLength:this.importLength};d.writeFileSync(t,JSON.stringify(r,null,2))}},{key:"getSplitInfo",value:(_=l(s().mark((function e(t){var r,n,o;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this.validateProject("getSplitInfo",t.srcPath,t.isPreEnv)).valid){e.next=3;break}return e.abrupt("return",r);case 3:return e.prev=3,e.next=6,this.readSplitConfig();case 6:if(n=e.sent,(o={appId:this.config.appId,md5:n.codeMd5,requestToken:this.config.requestToken,subVersion:n.subVersion}).subVersion){e.next=10;break}throw new Error("暂无分包信息");case 10:return e.next=12,this.querySplitInfo(o);case 12:return e.abrupt("return",e.sent);case 15:return e.prev=15,e.t0=e.catch(3),b.endLogProcess(null,e.t0.message),e.abrupt("return",{code:-1,msg:"获取分包信息失败",errMsg:e.t0.message});case 19:case"end":return e.stop()}}),e,this,[[3,15]])}))),function(e){return _.apply(this,arguments)})},{key:"readSplitConfig",value:(j=l(s().mark((function e(){var t,r,n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.resolve(this.config.entry,"./.codesplitcache"),r=h.resolve(t,"./codesplit-config.json"),e.prev=2,e.next=5,d.promises.readFile(r,"utf-8");case 5:return n=e.sent,e.abrupt("return",JSON.parse(n));case 9:throw e.prev=9,e.t0=e.catch(2),new Error("读取分包配置文件失败: ".concat(e.t0.message));case 12:case"end":return e.stop()}}),e,this,[[2,9]])}))),function(){return j.apply(this,arguments)})},{key:"querySplitInfo",value:(P=l(s().mark((function e(t){var r,n,o,a,i,c,u;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.appId,n=t.requestToken,o=t.md5,a=t.subVersion,e.prev=1,i={appId:r,md5:o,requestToken:n,subVersion:a},e.next=5,v.getSymbolSize(i);case 5:if(c=e.sent,null!=(u=c.result).mainSymbolSize&&null!=u.patchSymbolSize){e.next=9;break}throw new Error("未查询到分包函数信息");case 9:return e.abrupt("return",{code:0,msg:"查询分包信息成功 \n主包函数数量:".concat(u.mainSymbolSize," \n子包函数数量:").concat(u.patchSymbolSize),errMsg:"查询分包信息成功"});case 12:throw e.prev=12,e.t0=e.catch(1),e.t0;case 15:case"end":return e.stop()}}),e,null,[[1,12]])}))),function(e){return P.apply(this,arguments)})},{key:"getGameSplitRes",value:(E=l(s().mark((function e(t){var r=this;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){var o=function(){var a=l(s().mark((function a(i){var c,u,l;return s().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return c=null,a.prev=1,u={appId:r.config.appId,md5:r.codeMd5,subVersion:t.subVersion,requestToken:r.config.requestToken},a.next=5,v.getGameSplitInfo(u);case 5:null!==(l=a.sent).result?(c&&clearTimeout(c),e(l.result)):(c&&clearTimeout(c),c=setTimeout((function(){return o()}),5e3)),a.next=13;break;case 9:a.prev=9,a.t0=a.catch(1),c&&clearTimeout(c),n(a.t0);case 13:case"end":return a.stop()}}),a,null,[[1,9]])})));return function(e){return a.apply(this,arguments)}}();o()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return E.apply(this,arguments)})},{key:"splitBase",value:(S=l(s().mark((function e(t){var r,n,o,a,i,c,u,l;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=(new Date).getTime(),(n=this.validateProject("split",t.srcPath,t.isPreEnv,t.isRelease)).valid){e.next=4;break}return e.abrupt("return",n);case 4:return e.prev=4,(o=this.initializeSplitConfig()).cacheDir,a=o.codeSplitConfigPath,i=o.splitConfig,this.codeMd5=i.codeMd5,c=b.startLogProcess("发送分包请求"),e.next=10,this.buildSubPackage(t,i,a);case 10:if(u=e.sent,c.stop("当前分包版本:"+u),u){e.next=14;break}return e.abrupt("return",{code:-1,msg:"分包构建失败",errMsg:"服务正忙"});case 14:return c=b.startLogProcess("获取分包结果,请稍等"),e.next=17,this.getGameSplitRes({subVersion:u});case 17:return l=e.sent,c.stop("获取分包结果完成"),c=b.startLogProcess("下载分包代码中"),e.next=22,this.processSplitFiles(l,i);case 22:return c.stop("下载分包代码完成"),e.next=25,this.querySplitInfo({appId:this.config.appId,md5:i.codeMd5,requestToken:this.config.requestToken,subVersion:i.subVersion});case 25:return e.sent,e.abrupt("return",{code:0,msg:"WASM分包成功 \n分包总耗时:".concat((new Date).getTime()-r,"ms"),errMsg:null});case 29:return e.prev=29,e.t0=e.catch(4),b.endLogProcess(null,e.t0.message),e.abrupt("return",{code:-1,msg:"分包构建失败",errMsg:e.t0.message});case 33:case"end":return e.stop()}}),e,this,[[4,29]])}))),function(e){return S.apply(this,arguments)})},{key:"initializeSplitConfig",value:function(){var e=h.resolve(this.config.entry,"./.codesplitcache"),t=h.resolve(e,"./codesplit-config.json");return{cacheDir:e,codeSplitConfigPath:t,splitConfig:JSON.parse(d.readFileSync(t,"utf-8"))}}},{key:"buildSubPackage",value:(u=l(s().mark((function e(t,r,n){var o,a,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o={appId:this.config.appId,md5:this.codeMd5,requestToken:this.config.requestToken,isRelease:!!t.isRelease},e.next=3,v.split(o);case 3:if(0===(a=e.sent).code){e.next=15;break}if(!this.isRetryableError(a.errorMessage)){e.next=12;break}if(i=r.subVersion,b.logInfo("尝试查找历史版本,subVersion:",i),i){e.next=10;break}return e.abrupt("return",!1);case 10:e.next=13;break;case 12:throw new Error(a.errorMessage);case 13:e.next=18;break;case 15:i=a.result,r.subVersion=i,d.writeFileSync(n,JSON.stringify(r,null,2));case 18:return e.abrupt("return",i);case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"isRetryableError",value:function(e){return["当前md5有正在执行的构建任务,请稍后重试","资源超负荷运行啦,请稍后再试"].includes(e)}},{key:"processSplitFiles",value:(c=l(s().mark((function e(t,r){var n,o,a,i,c;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.mainWasmFilePath,o=t.subWasmFilePath,a=this.config.fullEntryPath,i=this.config.mainWasmCachePath,c=this.createWasmPaths(a,i),e.next=6,this.downloadWasmFiles(n,o,c);case 6:g.processJavaScriptFiles(r,a,this.config),g.updateConfigFiles(r,a,this.config);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"createWasmPaths",value:function(e,t){var r=h.resolve(e,"./wasmcode/",t),n=h.resolve(e,"./wasmcode1/",t);return d.existsSync(n)||d.mkdirSync(n,{recursive:!0}),{mainWasmPath:r,subWasmPath:n}}},{key:"downloadWasmFiles",value:(i=l(s().mark((function e(t,r,n){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.downloadSplitedFiles({mainWasmFileUrl:t,mainWasmFilePath:n.mainWasmPath,subWasmFileUrl:r,subWasmFilePath:n.subWasmPath});case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return i.apply(this,arguments)})},{key:"reportCalledFuncs",value:(n=l(s().mark((function e(t){var r,n,i,c,u,l,f,p,m,y,g,w,S,E,P,j,_,O,L,I,T,G,N;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=this.validateProject("getSplitInfo",t.srcPath,t.isPreEnv)).valid){e.next=3;break}return e.abrupt("return",r);case 3:return e.prev=3,n=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:500,r=[],n=0;n<e.length;n+=t)r.push(e.slice(n,n+t));return r},i=(new x).getPrompts(),e.next=8,k.prompt(i);case 8:if(c=e.sent,u=h.resolve(c.entry),d.existsSync(u)||(u=h.resolve(this.config.fullEntryPath,c.entry),d.existsSync(u)||(u=h.resolve(c.entry))),d.existsSync(u)){e.next=13;break}throw new Error("文件路径错误");case 13:return l=b.startLogProcess("文件解析中"),f=[],e.next=17,d.readFileSync(u,"utf8");case 17:for(p=e.sent,(m=p.split(/\r?\n/)).shift(),y=h.resolve(this.config.fullEntryPath,"./.codesplitcache"),g=h.resolve(y,"./unpack"),w=h.resolve(g,"./symbol.json"),S=d.readFileSync(w,"utf8"),E=JSON.parse(S),P=0,j=Object.entries(E);P<j.length;P++)_=a(j[P],2),O=_[0],L=_[1],m.includes(L)&&f.push(O);return e.next=28,this.readSplitConfig();case 28:I=e.sent,l.stop("文件解析成功"),l=b.startLogProcess("上报中,请稍等"),T=o(n(f)),e.prev=32,T.s();case 34:if((G=T.n()).done){e.next=40;break}return N=G.value,e.next=38,v.reportCalledFuncs({appId:this.config.appId,requestToken:this.config.requestToken,calledFuncList:N,subVersion:I.subVersion,md5:I.codeMd5});case 38:e.next=34;break;case 40:e.next=45;break;case 42:e.prev=42,e.t0=e.catch(32),T.e(e.t0);case 45:return e.prev=45,T.f(),e.finish(45);case 48:return l.stop("上报函数名成功"),e.abrupt("return",{code:0,msg:"上报函数名完成,数量".concat(f.length,"个"),errMsg:null});case 52:return e.prev=52,e.t1=e.catch(3),b.endLogProcess(null,e.t1.message),e.abrupt("return",{code:-1,msg:"上传函数名失败",errMsg:e.t1.message});case 56:case"end":return e.stop()}}),e,this,[[3,52],[32,42,45,48]])}))),function(e){return n.apply(this,arguments)})}],t&&f(e.prototype,t),r&&f(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r,n,i,c,u,S,E,P,j,_,O,L,I,T,G,N,F}();e.exports=new S},220:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=220,e.exports=t},589:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=589,e.exports=t},172:e=>{"use strict";e.exports=require("archiver")},938:e=>{"use strict";e.exports=require("axios")},895:e=>{"use strict";e.exports=require("chalk")},858:e=>{"use strict";e.exports=require("commander")},305:e=>{"use strict";e.exports=require("form-data")},652:e=>{"use strict";e.exports=require("fs-extra")},410:e=>{"use strict";e.exports=require("glob")},937:e=>{"use strict";e.exports=require("inquirer")},420:e=>{"use strict";e.exports=require("jimp")},268:e=>{"use strict";e.exports=require("jsqr")},720:e=>{"use strict";e.exports=require("ora")},205:e=>{"use strict";e.exports=require("picocolors")},241:e=>{"use strict";e.exports=require("qrcode-terminal")},896:e=>{"use strict";e.exports=require("fs")},857:e=>{"use strict";e.exports=require("os")},928:e=>{"use strict";e.exports=require("path")},23:e=>{"use strict";e.exports=require("util")},330:e=>{"use strict";e.exports=JSON.parse('{"name":"jd-minigame-ci","version":"0.7.8","description":"The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.","author":"chenlong328","license":"ISC","main":"dist/index.js","bin":{"jgc":"./dist/jgc.js"},"scripts":{"config":"NODE_ENV=development node ./dist/jgc.js config","preview":"NODE_ENV=development node ./dist/jgc.js preview","dev:config":"NODE_ENV=development node ./src/jgc.js config","dev:preview":"NODE_ENV=development node ./src/jgc.js preview","dev:upload":"NODE_ENV=development node ./src/jgc.js upload","dev:publish":"NODE_ENV=development node ./src/jgc.js publish","build":"webpack --mode production --progress --config webpack.config.js && chmod 777 ./dist/index.js && chmod 777 ./dist/jgc.js"},"dependencies":{"@babel/cli":"^7.23.9","@babel/core":"^7.23.9","@babel/preset-env":"^7.23.9","archiver":"^6.0.1","axios":"^1.7.3","commander":"^11.1.0","fs-extra":"^11.2.0","glob":"^10.3.10","inquirer":"8.2.6","jimp":"^0.22.12","jsqr":"1.4.0","minimist":"^1.2.8","ora":"5.4.1","qrcode":"^1.5.3","qrcode-terminal":"^0.12.0","string-width":"4.2.3","strip-ansi":"6.0.1"},"devDependencies":{"babel-loader":"^9.1.3","babel-minify-webpack-plugin":"^0.3.1","clean-webpack-plugin":"^4.0.0","terser-webpack-plugin":"^5.3.10","webpack":"^5.90.3","webpack-cli":"^5.1.4","webpack-node-externals":"^3.0.0"},"files":["dist","package.json","README.md"]}')}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n](a,a.exports,r),a.exports}r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */o=function(){return t};var e,t={},r=Object.prototype,a=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},c="function"==typeof Symbol?Symbol:{},s=c.iterator||"@@iterator",u=c.asyncIterator||"@@asyncIterator",l=c.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,a=Object.create(o.prototype),c=new G(n||[]);return i(a,"_invoke",{value:O(e,r,c)}),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function b(){}function w(){}function x(){}var k={};f(k,s,(function(){return this}));var S=Object.getPrototypeOf,E=S&&S(S(N([])));E&&E!==r&&a.call(E,s)&&(k=E);var P=x.prototype=b.prototype=Object.create(k);function j(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function _(e,t){function r(o,i,c,s){var u=h(e[o],e,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,c,s)}),(function(e){r("throw",e,c,s)})):t.resolve(f).then((function(e){l.value=e,c(l)}),(function(e){return r("throw",e,c,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,n){function a(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(a,a):a()}})}function O(t,r,n){var o=d;return function(a,i){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var c=n.delegate;if(c){var s=L(c,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=h(t,r,n);if("normal"===u.type){if(o=n.done?v:m,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function L(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,L(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,g;var i=a.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function G(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[s];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function r(){for(;++o<t.length;)if(a.call(t,o))return r.value=t[o],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(n(t)+" is not iterable")}return w.prototype=x,i(P,"constructor",{value:x,configurable:!0}),i(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,f(e,l,"GeneratorFunction")),e.prototype=Object.create(P),e},t.awrap=function(e){return{__await:e}},j(_.prototype),f(_.prototype,u,(function(){return this})),t.AsyncIterator=_,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new _(p(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},j(P),f(P,l,"Generator"),f(P,s,(function(){return this})),f(P,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e,t,r,n,o,a,i){try{var c=e[a](i),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function c(e){a(i,n,o,c,s,"next",e)}function s(e){a(i,n,o,c,s,"throw",e)}c(void 0)}))}}var c=r(928),s=r(857),u=r(720),l=r(205),f=new(0,r(858).Command),p=r(937),h=r(938),d=r(522),m=r(593),y=r(538),v=r(60),g=r(425),b=r(890),w=r(85).SUCCEED_CODE,x=r(330),k=r(175);function S(e){return E.apply(this,arguments)}function E(){return E=i(o().mark((function e(t){var n,a,i,f,p,h,d,m,x,k,S,E,P,j,_,O,L,I,T,G,N,F,M,A,C,q,D,W,U,R,B,H,V=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(V.length>1&&void 0!==V[1])||V[1],a=Date.now(),i=1===t?"preview":"upload",f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=7;break}return e.abrupt("return",console.log("".concat(l.red("请先创建配置文件!"))));case 7:if(p="function"==typeof require?require:r(589),h=p(f),(d=v.checkConfigOptions(h,t)).code===w){e.next=12;break}return e.abrupt("return",console.log(d.err_msg));case 12:if(m=h.appId,x=h.requestToken,k=h.versionName,S=h.entry,E=h.description,(P=y.verifyGameRequiredFilesExist(S)).code===w){e.next=16;break}return e.abrupt("return",console.log(P.err_msg));case 16:return j=s.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(j),_=u("文件压缩").start(),e.prev=19,e.next=22,y.compressDirectory(S,j);case 22:O=e.sent,_.succeed("压缩完成,共"+O/1e3+"KB"),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(19),_.fail("压缩失败:",e.t0),process.exit(1);case 30:return _.start(),_.text="上传中",L=new g(n?"prod":"dev"),e.prev=34,e.next=37,L.uploadProject({sourceFile:j,appId:m,requestToken:x,isProd:n});case 37:if((I=e.sent).code!==w&&(_.fail(I.err_msg),process.exit(1)),T=I.packId,_.succeed("上传完成,packId:".concat(T)),"preview"!==i){e.next=57;break}return e.next=44,L.generateQrCode({packId:T,appId:m,requestToken:x});case 44:return(G=e.sent).code!==w&&(_.fail(G.err_msg),process.exit(1)),N=G.imgUrl,F=G.expiredTime,e.next=49,b.showQrCode(N);case 49:_.succeed("二维码生成完成,将于".concat(F,"过期")),_.info("二维码imgUrl(如二维码不清晰,浏览器打开): ".concat(N)),_.info("二维码仅支持协作成员访问"),M=Date.now(),A=(M-a)/1e3,_.info("本次耗费时长:".concat(A,"s")),e.next=82;break;case 57:if("upload"!==i){e.next=82;break}return _.start(),e.next=61,L.commitDevVersion({appId:m,requestToken:x,versionName:k,description:E},T);case 61:return(C=e.sent).code!==w&&(_.fail(C.err_msg),process.exit(1)),q=C.devId,_.succeed("开发版设置完成, devId:"+q),e.next=67,L.setDevExperience({appId:m,requestToken:x},q);case 67:return(D=e.sent).code!==w&&(_.fail(D.err_msg),process.exit(1)),_.succeed("体验版设置完成"),e.next=72,L.queryExperienceQrcodeByPackId({appId:m,requestToken:x});case 72:return(W=e.sent).code!==w&&(_.fail(W.err_msg),process.exit(1)),U=W.imgUrl,R=W.expiredTime,e.next=77,b.showQrCode(U);case 77:_.info("二维码仅支持协作成员访问"),_.succeed("二维码生成完成,将于".concat(R,"过期")),B=Date.now(),H=(B-a)/1e3,_.info("本次耗费时长:".concat(H,"s"));case 82:e.next=88;break;case 84:e.prev=84,e.t1=e.catch(34),_.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 88:case"end":return e.stop()}}),e,null,[[19,26],[34,84]])}))),E.apply(this,arguments)}function P(e){return j.apply(this,arguments)}function j(){return(j=i(o().mark((function e(t){var n,a,i,f,h,d,b,x,k,S,E,P,j,_,O,L,I,T,G;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(new m).getPrompts(),e.next=3,p.prompt(n);case 3:if(a=e.sent,i=Date.now(),f=c.posix.resolve("","./jgc.config.js"),y.hasJgcConfigFile(f)){e.next=9;break}return e.abrupt("return",console.log("".concat(l.red("请先创建配置文件!"))));case 9:if(h="function"==typeof require?require:r(589),d=h(f),(b=v.checkPluginConfig(d)).code===w){e.next=14;break}return e.abrupt("return",console.log(b.err_msg));case 14:return x=d.appId,k=d.requestToken,S=d.entry,E=d.versionName,P=s.tmpdir()+c.sep+"jd_game_temp.zip",y.deleteFile(P),j=u("文件压缩").start(),e.prev=18,e.next=21,y.compressDirectory(S,P);case 21:(_=e.sent)>4194304&&(j.fail("压缩包超过4MB,请检查文件大小"),process.exit(1)),j.succeed("压缩完成,共"+_/1e3+"KB"),e.next=30;break;case 26:e.prev=26,e.t0=e.catch(18),j.fail("压缩失败:",e.t0),process.exit(1);case 30:return O=new g(t),e.prev=31,e.next=34,O.uploadPlugin({sourceFile:P,appId:x,requestToken:k,versionName:E});case 34:if((L=e.sent).code===w){e.next=40;break}j.fail(L.err_msg),process.exit(1),e.next=49;break;case 40:return j.succeed("插件构建成功"),e.next=43,O.publishPlugin({versionName:a.versionName,versionFeature:a.versionFeature,useGuide:a.useGuide,packId:L.result.packId,appId:x,requestToken:k});case 43:(I=e.sent).code!==w&&(j.fail(I.err_msg),process.exit(1)),j.succeed("插件发布成功"),T=Date.now(),G=(T-i)/1e3,j.info("本次耗费时长:".concat(G,"s"));case 49:e.next=55;break;case 51:e.prev=51,e.t1=e.catch(31),j.fail("CLI执行报错 --\x3e".concat(e.t1)),process.exit(1);case 55:case"end":return e.stop()}}),e,null,[[18,26],[31,51]])})))).apply(this,arguments)}function _(e){return O.apply(this,arguments)}function O(){return(O=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitInfo(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("查询函数符号表失败:",e)})).catch((function(e){console.error("查询函数符号表异常:",e)}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}return f.command("config").description("小游戏配置").action(i(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=(new d).getPrompts(),e.next=3,p.prompt(t);case 3:if(r=e.sent,(n=y.verifyGameRequiredFilesExist(r.entry,r.type)).code===w){e.next=7;break}return e.abrupt("return",console.log("".concat(l.red(n.err_msg))));case 7:return e.prev=7,y.writeFile("./".concat("jgc.config.js"),"module.exports = ".concat(JSON.stringify(r,null,2)),"utf-8"),e.abrupt("return",console.log("✨ ".concat(l.green("创建小游戏配置文件成功"))));case 13:e.prev=13,e.t0=e.catch(7),console.log("创建小游戏配置文件失败:",e.t0);case 16:case"end":return e.stop()}}),e,null,[[7,13]])})))),f.command("preview").description("小游戏真机预览").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏真机预览-预发环境"),e.abrupt("return",S(1,!1));case 3:return e.abrupt("return",S(1,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("upload").description("小游戏发布").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=3;break}return console.log("小游戏发布-预发环境"),e.abrupt("return",S(2,!1));case 3:return e.abrupt("return",S(2,!0));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("publish").description("插件发布").option("-D","预发环境").option("-T","测试环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.D){e.next=5;break}return console.log("插件发布-预发环境"),e.abrupt("return",P("dev"));case 5:if(!t.T){e.next=10;break}return console.log("插件发布-测试环境"),e.abrupt("return",P("test"));case 10:return console.log("插件发布-生产环境"),e.abrupt("return",P("prod"));case 12:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.version(x.version,"-v, -V").description("获取本地京东小游戏CLI工具版本"),f.command("latest").description("获取并对比京东小游戏CLI工具最新版本").action(i(o().mark((function e(){var t,r,n,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,t=u("npm最新版本获取中……").start(),e.next=4,h.get("https://registry.npmjs.org/jd-minigame-ci/latest");case 4:r=e.sent,n=r.data.version,a=x.version,t.succeed("最新版本: ".concat(n)),n===a?t.info("当前版本 (".concat(a,") 已是最新版本。")):(t.info("本地版本: ".concat(a)),t.info("请更新到最新版本以获取最新功能和修复。")),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),spinner.fail("获取最新版本信息失败: ".concat(e.t0));case 14:case"end":return e.stop()}}),e,null,[[0,11]])})))),f.command("wasm-init").description("WASM分包初始化").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmInit(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("WASM分包初始化失败:",e)})).catch((function(e){console.error("WASM分包初始化异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-update").description("WASM分包增量更新").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmUpdate(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("WASM分包增量更新失败:",e)})).catch((function(e){console.error("WASM分包增量更新异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-dev").description("WASM分包dev").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitDev(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var r=e.code,n=e.msg;0===r?(console.log(n),_(t)):console.error("WASM分包失败:",e)})).catch((function(e){console.error("WASM分包异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-prod").description("WASM分包prod").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitProd(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var r=e.code,n=e.msg;0===r?(console.log(n),_(t)):console.error("WASM分包失败:",e)})).catch((function(e){console.error("WASM分包异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-info").description("查询函数符号表").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:_(t);case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.command("wasm-split-report").description("上报函数名").option("-D","预发环境").action(function(){var e=i(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:k.wasmSplitReport(Object.assign(t,{srcPath:"",isPreEnv:t.D})).then((function(e){var t=e.code,r=e.msg;0===t?console.log(r):console.error("上报函数名失败:",e)})).catch((function(e){console.error("上报函数名异常:",e)}));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f.parse(process.argv),{}})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jd-minigame-ci",
3
- "version": "0.7.2",
3
+ "version": "0.7.8",
4
4
  "description": "The jd-minigame-ci is a toolkit provided for developers of JD Mini Games. Developers can complete code upload and preview operations for JD Mini Games without the need to open the developer tools, simply by using this toolkit.",
5
5
  "author": "chenlong328",
6
6
  "license": "ISC",