utils-lib-js 2.0.19 → 2.0.20

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 (56) hide show
  1. package/README.en.md +27 -0
  2. package/README.md +21 -0
  3. package/package.json +51 -51
  4. package/dist/bundle/animate.d.ts +0 -25
  5. package/dist/bundle/array.d.ts +0 -10
  6. package/dist/bundle/base.d.ts +0 -17
  7. package/dist/bundle/element.d.ts +0 -6
  8. package/dist/bundle/event.d.ts +0 -14
  9. package/dist/bundle/function.d.ts +0 -13
  10. package/dist/bundle/index.d.ts +0 -76
  11. package/dist/bundle/index.js +0 -49
  12. package/dist/bundle/log.d.ts +0 -8
  13. package/dist/bundle/object.d.ts +0 -36
  14. package/dist/bundle/static.d.ts +0 -16
  15. package/dist/bundle/storage.d.ts +0 -9
  16. package/dist/bundle/types.d.ts +0 -69
  17. package/dist/cjs/animate.d.ts +0 -25
  18. package/dist/cjs/array.d.ts +0 -10
  19. package/dist/cjs/base.d.ts +0 -17
  20. package/dist/cjs/element.d.ts +0 -6
  21. package/dist/cjs/event.d.ts +0 -14
  22. package/dist/cjs/function.d.ts +0 -13
  23. package/dist/cjs/index.d.ts +0 -76
  24. package/dist/cjs/index.js +0 -49
  25. package/dist/cjs/log.d.ts +0 -8
  26. package/dist/cjs/object.d.ts +0 -36
  27. package/dist/cjs/package.json +0 -3
  28. package/dist/cjs/static.d.ts +0 -16
  29. package/dist/cjs/storage.d.ts +0 -9
  30. package/dist/cjs/types.d.ts +0 -69
  31. package/dist/esm/animate.d.ts +0 -25
  32. package/dist/esm/array.d.ts +0 -10
  33. package/dist/esm/base.d.ts +0 -17
  34. package/dist/esm/element.d.ts +0 -6
  35. package/dist/esm/event.d.ts +0 -14
  36. package/dist/esm/function.d.ts +0 -13
  37. package/dist/esm/index.d.ts +0 -76
  38. package/dist/esm/index.js +0 -49
  39. package/dist/esm/log.d.ts +0 -8
  40. package/dist/esm/object.d.ts +0 -36
  41. package/dist/esm/static.d.ts +0 -16
  42. package/dist/esm/storage.d.ts +0 -9
  43. package/dist/esm/types.d.ts +0 -69
  44. package/dist/umd/animate.d.ts +0 -25
  45. package/dist/umd/array.d.ts +0 -10
  46. package/dist/umd/base.d.ts +0 -17
  47. package/dist/umd/element.d.ts +0 -6
  48. package/dist/umd/event.d.ts +0 -14
  49. package/dist/umd/function.d.ts +0 -13
  50. package/dist/umd/index.d.ts +0 -76
  51. package/dist/umd/index.js +0 -49
  52. package/dist/umd/log.d.ts +0 -8
  53. package/dist/umd/object.d.ts +0 -36
  54. package/dist/umd/static.d.ts +0 -16
  55. package/dist/umd/storage.d.ts +0 -9
  56. package/dist/umd/types.d.ts +0 -69
package/dist/esm/index.js DELETED
@@ -1,49 +0,0 @@
1
- import e from"http";import t from"https";import n from"url";var r,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},o.apply(this,arguments)};function i(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(r||(r={}));var u={types:r},a=function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},c=function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},s=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},l=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return r[n]}return t},f=function(e,t){void 0===t&&(t=[]);var n=l(e);return t.indexOf(n)>0},p=function(e,t){return void 0===t&&(t="-"),e.replace(/[A-Z]/g,(function(e){return"".concat(t).concat(e.toLowerCase())}))},h={randomNum:a,urlSplit:c,urlJoin:s,getType:l,getTypeByList:f,toKebabCase:p},d=function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},v=function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},y=function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},g=function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},b=function(e,t){return"object"!=typeof e||"null"===t},m=function(e){var t=l(e);if(b(e,t))return e;var n=w(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,m(e))})):"set"===t?e.forEach((function(e){n.add(m(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=m(r)})),n},w=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},j=function(e){function t(){}return t.prototype=e,new t},E=function(e,t){return void 0===t&&(t=function(){}),t.prototype=j(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},O=function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,i([void 0],n,!1)))),e._instance},T=function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},S=function(e){if("string"!==l(e))return null;try{return JSON.parse(e)}catch(e){return null}},P=function(e){if(!f(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},x=function(e){return e&&e===e.window},q=function(e){void 0===e&&(e={});var t=Object.create(null);return Reflect.ownKeys(e).forEach((function(n){return t[n]=e[n]})),t},k=function(e){void 0===e&&(e={});var t=q(e);return Reflect.ownKeys(t).length<=0},A={getValue:d,setValue:v,mixIn:y,enumInversion:g,isNotObject:b,cloneDeep:m,createObjectVariable:w,createObject:j,inherit:E,getInstance:O,classDecorator:T,stringToJson:S,jsonToString:P,isWindow:x,emptyObject:q,isEmptyObject:k},H=function(e){return e.sort((function(){return Math.random()-.5}))},L=function(e){return Array.from(new Set(e))},M=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===l(e)?M(e,t):t.push(e)})),t},C={arrayRandom:H,arrayUniq:L,arrayDemote:M},D=void 0,B=function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,i([D],r,!1)),n=null}),t))}},I=function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,i([D],r,!1))}),t)}},R=function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},_=function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))},F=function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}},N={throttle:B,debounce:I,defer:R,catchAwait:_},W=function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a},J={createElement:W},V=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},G=function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},U=function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},z=function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},Q=function(e,t){var n=new Event(t);e.dispatchEvent(n)},K={addHandler:V,stopBubble:G,stopDefault:U,removeHandler:z,dispatchEvent:Q},$=function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},Y=function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},Z=function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}},X={setStorage:$,getStorage:Y,clearStorage:Z},ee=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},te=function(e){return ee(e,!0,!1)},ne=["\\","|","/","—","—"],re=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?ne:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return te("\n");s>=l-1&&(s=0);var f=r[s++];return te(f),setTimeout((function(){e.index=s,re(e)}),a),e},oe={logOneLine:ee,logLoop:re},ie=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function ue(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]}function ae(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]}function ce(e){return 0===e||1===e?1:e*ce(e-1)}function se(e,t){return ce(e)/(ce(t)*ce(e-t))}function le(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=se(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}var fe,pe={AnimateFrame:ie,quadraticBezier:ue,cubicBezier:ae,factorial:ce,combination:se,NBezier:le},he=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events=Object.create(null)}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events=Object.create(null),this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}(),de=he.Instance(he),ve=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new he),e},ye=function(){return ye=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ye.apply(this,arguments)};function ge(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(fe||(fe={}));var be={types:fe},me=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return fe[n]}return t},we=function(e,t){void 0===t&&(t=[]);var n=me(e);return t.indexOf(n)>0},je={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:me,getTypeByList:we},Ee=function(e,t){return"object"!=typeof e||"null"===t},Oe=function(e){var t=me(e);if(Ee(e,t))return e;var n=Te(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,Oe(e))})):"set"===t?e.forEach((function(e){n.add(Oe(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=Oe(r)})),n},Te=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Se=function(e){function t(){}return t.prototype=e,new t},Pe={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Ee,cloneDeep:Oe,createObjectVariable:Te,createObject:Se,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Se(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,ge([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==me(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!we(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window},emptyObject:function(e){void 0===e&&(e={});var t=Object.create(null);return Reflect.ownKeys(e).forEach((function(n){return t[n]=e[n]})),t}},xe=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===me(e)?xe(e,t):t.push(e)})),t},qe={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:xe},ke=void 0,Ae=function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},He={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,ge([ke],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,ge([ke],r,!1))}),t)}},defer:Ae,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Le={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Me={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Ce={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},De=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Be=function(e){return De(e,!0,!1)},Ie=["\\","|","/","—","—"],Re=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Ie:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Be("\n");s>=l-1&&(s=0);var f=r[s++];return Be(f),setTimeout((function(){e.index=s,Re(e)}),a),e},_e={logOneLine:De,logLoop:Re},Fe=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function Ne(e){return 0===e||1===e?1:e*Ne(e-1)}function We(e,t){return Ne(e)/(Ne(t)*Ne(e-t))}var Je={AnimateFrame:Fe,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Ne,combination:We,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=We(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Ve=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Ve.Instance(Ve);var Ge,Ue=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Ve),e},ze=function(){return ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ze.apply(this,arguments)},Qe=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Ke=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},$e=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Ye=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=ze(ze({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return Ke(t,void 0,void 0,(function(){var e,t,r,o,i;return $e(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Ue,Qe("design:paramtypes",[Object])],e),e}(),Ze=function(){return Ze=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ze.apply(this,arguments)};function Xe(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Ge||(Ge={}));var et={types:Ge},tt=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},nt=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Ge[n]}return t},rt=function(e,t){void 0===t&&(t=[]);var n=nt(e);return t.indexOf(n)>0},ot={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:tt,getType:nt,getTypeByList:rt},it=function(e,t){return"object"!=typeof e||"null"===t},ut=function(e){var t=nt(e);if(it(e,t))return e;var n=at(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,ut(e))})):"set"===t?e.forEach((function(e){n.add(ut(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=ut(r)})),n},at=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},ct=function(e){function t(){}return t.prototype=e,new t},st=function(e){if("string"!==nt(e))return null;try{return JSON.parse(e)}catch(e){return null}},lt=function(e){if(!rt(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},ft={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:it,cloneDeep:ut,createObjectVariable:at,createObject:ct,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=ct(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Xe([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:st,jsonToString:lt,isWindow:function(e){return e&&e===e.window}},pt=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===nt(e)?pt(e,t):t.push(e)})),t},ht={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:pt},dt=void 0,vt=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},yt={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Xe([dt],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Xe([dt],r,!1))}),t)}},defer:vt,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},gt={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},bt={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},mt={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},wt=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},jt=function(e){return wt(e,!0,!1)},Et=["\\","|","/","—","—"],Ot=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Et:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return jt("\n");s>=l-1&&(s=0);var f=r[s++];return jt(f),setTimeout((function(){e.index=s,Ot(e)}),a),e},Tt={logOneLine:wt,logLoop:Ot},St=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function Pt(e){return 0===e||1===e?1:e*Pt(e-1)}function xt(e,t){return Pt(e)/(Pt(t)*Pt(e-t))}var qt={AnimateFrame:St,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Pt,combination:xt,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=xt(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},kt=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();kt.Instance(kt);var At=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new kt),e},Ht=function(){return Ht=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ht.apply(this,arguments)},Lt=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Mt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},Ct=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Dt=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Ht(Ht({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return Mt(t,void 0,void 0,(function(){var e,t,r,o,i;return Ct(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([At,Lt("design:paramtypes",[Object])],e),e}();Ze(Ze(Ze(Ze(Ze(Ze(Ze(Ze(Ze(Ze(Ze({},ft),ot),ht),yt),gt),et),bt),mt),Tt),qt),{eventMessageCenter:kt,taskQueueLib:Dt});
2
- /**
3
- * @author Toru Nagashima <https://github.com/mysticatea>
4
- * @copyright 2015 Toru Nagashima. All rights reserved.
5
- * See LICENSE file in root directory for full license.
6
- */
7
- const Bt=new WeakMap,It=new WeakMap;function Rt(e){const t=Bt.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function _t(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function Ft(e,t){Bt.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,Nt(t))}}function Nt(e){return{get(){return Rt(this).event[e]},set(t){Rt(this).event[e]=t},configurable:!0,enumerable:!0}}function Wt(e){return{value(){const t=Rt(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function Jt(e){if(null==e||e===Object.prototype)return Ft;let t=It.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?Wt(i):Nt(i))}}return r}(Jt(Object.getPrototypeOf(e)),e),It.set(e,t)),t}function Vt(e){return Rt(e).immediateStopped}function Gt(e,t){Rt(e).passiveListener=t}Ft.prototype={get type(){return Rt(this).event.type},get target(){return Rt(this).eventTarget},get currentTarget(){return Rt(this).currentTarget},composedPath(){const e=Rt(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return Rt(this).eventPhase},stopPropagation(){const e=Rt(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=Rt(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(Rt(this).event.bubbles)},get cancelable(){return Boolean(Rt(this).event.cancelable)},preventDefault(){_t(Rt(this))},get defaultPrevented(){return Rt(this).canceled},get composed(){return Boolean(Rt(this).event.composed)},get timeStamp(){return Rt(this).timeStamp},get srcElement(){return Rt(this).eventTarget},get cancelBubble(){return Rt(this).stopped},set cancelBubble(e){if(!e)return;const t=Rt(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!Rt(this).canceled},set returnValue(e){e||_t(Rt(this))},initEvent(){}},Object.defineProperty(Ft.prototype,"constructor",{value:Ft,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(Ft.prototype,window.Event.prototype),It.set(window.Event.prototype,Ft));const Ut=new WeakMap,zt=3;function Qt(e){return null!==e&&"object"==typeof e}function Kt(e){const t=Ut.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function $t(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=Kt(this).get(e);for(;null!=t;){if(t.listenerType===zt)return t.listener;t=t.next}return null},set(t){"function"==typeof t||Qt(t)||(t=null);const n=Kt(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===zt?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:zt,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function Yt(e){function t(){Zt.call(this)}t.prototype=Object.create(Zt.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)$t(t.prototype,e[n]);return t}function Zt(){if(!(this instanceof Zt)){if(1===arguments.length&&Array.isArray(arguments[0]))return Yt(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return Yt(e)}throw new TypeError("Cannot call a class as a function")}Ut.set(this,new Map)}Zt.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!Qt(t))throw new TypeError("'listener' should be a function or an object.");const r=Kt(this),o=Qt(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=Kt(this),o=(Qt(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=Kt(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(Jt(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,Gt(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==zt&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(Vt(o))break;r=r.next}return Gt(o,null),function(e,t){Rt(e).eventPhase=t}(o,0),function(e,t){Rt(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(Zt.prototype,"constructor",{value:Zt,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(Zt.prototype,window.EventTarget.prototype);let Xt=class extends Zt{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=en.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};$t(Xt.prototype,"abort");const en=new WeakMap;Object.defineProperties(Xt.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Xt.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let tn=class{constructor(){nn.set(this,function(){const e=Object.create(Xt.prototype);return Zt.call(e),en.set(e,!1),e}())}get signal(){return rn(this)}abort(){var e;e=rn(this),!1===en.get(e)&&(en.set(e,!0),e.dispatchEvent({type:"abort"}))}};const nn=new WeakMap;function rn(e){const t=nn.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(tn.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(tn.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var on=function(e,t){return on=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},on(e,t)};function un(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}on(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var an,cn,sn,ln,fn=function(){return fn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},fn.apply(this,arguments)};function pn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var hn="undefined"!=typeof AbortController;"undefined"!=typeof window||hn?an=globalThis.AbortController:"undefined"!=typeof require?(cn=require("http").request,sn=require("https").request,ln=require("url").parse,an=require("abort-controller")):"object"==typeof globalThis?(cn=e.request,sn=t.request,ln=n.parse,an=tn):an=function(){throw new Error("AbortController is not defined")};var dn,vn=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),yn=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=st(e))&&void 0!==t?t:e},blob:function(){return st(e)},formData:function(){return st(e)},arrayBuffer:function(){return st(e)}}},n.origin=null!=t?t:"",n}return un(t,e),t}(vn),gn=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new an:v,g=t.type,b=void 0===g?"json":g,m=pn(t,["method","query","headers","body","timeout","controller","type"]),w=fn({url:e,method:u,query:c,headers:l,body:"GET"===u?null:lt(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=tt(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=ln(r.url,!0);return fn(fn({},r),o)},n}return un(t,e),t}(yn),bn=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=vt(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=pn(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=vt(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?sn:cn)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,fn({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,fn({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,fn({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,fn({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,fn({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,fn({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,fn({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return un(t,e),t}(gn),mn=function(){return mn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mn.apply(this,arguments)};function wn(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(dn||(dn={}));var jn={types:dn},En=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return dn[n]}return t},On=function(e,t){void 0===t&&(t=[]);var n=En(e);return t.indexOf(n)>0},Tn={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:En,getTypeByList:On},Sn=function(e,t){return"object"!=typeof e||"null"===t},Pn=function(e){var t=En(e);if(Sn(e,t))return e;var n=xn(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,Pn(e))})):"set"===t?e.forEach((function(e){n.add(Pn(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=Pn(r)})),n},xn=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},qn=function(e){function t(){}return t.prototype=e,new t},kn={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Sn,cloneDeep:Pn,createObjectVariable:xn,createObject:qn,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=qn(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,wn([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==En(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!On(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window}},An=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===En(e)?An(e,t):t.push(e)})),t},Hn={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:An},Ln=void 0,Mn={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,wn([Ln],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,wn([Ln],r,!1))}),t)}},defer:function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Cn={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Dn={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Bn={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},In=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Rn=function(e){return In(e,!0,!1)},_n=["\\","|","/","—","—"],Fn=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?_n:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Rn("\n");s>=l-1&&(s=0);var f=r[s++];return Rn(f),setTimeout((function(){e.index=s,Fn(e)}),a),e},Nn={logOneLine:In,logLoop:Fn},Wn=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function Jn(e){return 0===e||1===e?1:e*Jn(e-1)}function Vn(e,t){return Jn(e)/(Jn(t)*Jn(e-t))}var Gn={AnimateFrame:Wn,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Jn,combination:Vn,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=Vn(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Un=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Un.Instance(Un);var zn,Qn=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Un),e},Kn=function(){return Kn=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Kn.apply(this,arguments)},$n=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Yn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},Zn=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Xn=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Kn(Kn({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return Yn(t,void 0,void 0,(function(){var e,t,r,o,i;return Zn(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Qn,$n("design:paramtypes",[Object])],e),e}(),er=function(){return er=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},er.apply(this,arguments)};function tr(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(zn||(zn={}));var nr={types:zn},rr=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},or=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return zn[n]}return t},ir=function(e,t){void 0===t&&(t=[]);var n=or(e);return t.indexOf(n)>0},ur={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:rr,getType:or,getTypeByList:ir},ar=function(e,t){return"object"!=typeof e||"null"===t},cr=function(e){var t=or(e);if(ar(e,t))return e;var n=sr(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,cr(e))})):"set"===t?e.forEach((function(e){n.add(cr(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=cr(r)})),n},sr=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},lr=function(e){function t(){}return t.prototype=e,new t},fr=function(e){if("string"!==or(e))return null;try{return JSON.parse(e)}catch(e){return null}},pr=function(e){if(!ir(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},hr={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:ar,cloneDeep:cr,createObjectVariable:sr,createObject:lr,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=lr(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,tr([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:fr,jsonToString:pr,isWindow:function(e){return e&&e===e.window}},dr=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===or(e)?dr(e,t):t.push(e)})),t},vr={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:dr},yr=void 0,gr=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},br={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,tr([yr],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,tr([yr],r,!1))}),t)}},defer:gr,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},mr={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},wr={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},jr={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Er=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Or=function(e){return Er(e,!0,!1)},Tr=["\\","|","/","—","—"],Sr=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Tr:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Or("\n");s>=l-1&&(s=0);var f=r[s++];return Or(f),setTimeout((function(){e.index=s,Sr(e)}),a),e},Pr={logOneLine:Er,logLoop:Sr},xr=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function qr(e){return 0===e||1===e?1:e*qr(e-1)}function kr(e,t){return qr(e)/(qr(t)*qr(e-t))}var Ar={AnimateFrame:xr,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:qr,combination:kr,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=kr(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Hr=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Hr.Instance(Hr);var Lr=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Hr),e},Mr=function(){return Mr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Mr.apply(this,arguments)},Cr=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Dr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},Br=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Ir=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Mr(Mr({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return Dr(t,void 0,void 0,(function(){var e,t,r,o,i;return Br(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Lr,Cr("design:paramtypes",[Object])],e),e}();er(er(er(er(er(er(er(er(er(er(er({},hr),ur),vr),br),mr),nr),wr),jr),Pr),Ar),{eventMessageCenter:Hr,taskQueueLib:Ir});
8
- /**
9
- * @author Toru Nagashima <https://github.com/mysticatea>
10
- * @copyright 2015 Toru Nagashima. All rights reserved.
11
- * See LICENSE file in root directory for full license.
12
- */
13
- const Rr=new WeakMap,_r=new WeakMap;function Fr(e){const t=Rr.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function Nr(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function Wr(e,t){Rr.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,Jr(t))}}function Jr(e){return{get(){return Fr(this).event[e]},set(t){Fr(this).event[e]=t},configurable:!0,enumerable:!0}}function Vr(e){return{value(){const t=Fr(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function Gr(e){if(null==e||e===Object.prototype)return Wr;let t=_r.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?Vr(i):Jr(i))}}return r}(Gr(Object.getPrototypeOf(e)),e),_r.set(e,t)),t}function Ur(e){return Fr(e).immediateStopped}function zr(e,t){Fr(e).passiveListener=t}Wr.prototype={get type(){return Fr(this).event.type},get target(){return Fr(this).eventTarget},get currentTarget(){return Fr(this).currentTarget},composedPath(){const e=Fr(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return Fr(this).eventPhase},stopPropagation(){const e=Fr(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=Fr(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(Fr(this).event.bubbles)},get cancelable(){return Boolean(Fr(this).event.cancelable)},preventDefault(){Nr(Fr(this))},get defaultPrevented(){return Fr(this).canceled},get composed(){return Boolean(Fr(this).event.composed)},get timeStamp(){return Fr(this).timeStamp},get srcElement(){return Fr(this).eventTarget},get cancelBubble(){return Fr(this).stopped},set cancelBubble(e){if(!e)return;const t=Fr(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!Fr(this).canceled},set returnValue(e){e||Nr(Fr(this))},initEvent(){}},Object.defineProperty(Wr.prototype,"constructor",{value:Wr,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(Wr.prototype,window.Event.prototype),_r.set(window.Event.prototype,Wr));const Qr=new WeakMap,Kr=3;function $r(e){return null!==e&&"object"==typeof e}function Yr(e){const t=Qr.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function Zr(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=Yr(this).get(e);for(;null!=t;){if(t.listenerType===Kr)return t.listener;t=t.next}return null},set(t){"function"==typeof t||$r(t)||(t=null);const n=Yr(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===Kr?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:Kr,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function Xr(e){function t(){eo.call(this)}t.prototype=Object.create(eo.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)Zr(t.prototype,e[n]);return t}function eo(){if(!(this instanceof eo)){if(1===arguments.length&&Array.isArray(arguments[0]))return Xr(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return Xr(e)}throw new TypeError("Cannot call a class as a function")}Qr.set(this,new Map)}eo.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!$r(t))throw new TypeError("'listener' should be a function or an object.");const r=Yr(this),o=$r(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=Yr(this),o=($r(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=Yr(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(Gr(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,zr(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==Kr&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(Ur(o))break;r=r.next}return zr(o,null),function(e,t){Fr(e).eventPhase=t}(o,0),function(e,t){Fr(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(eo.prototype,"constructor",{value:eo,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(eo.prototype,window.EventTarget.prototype);let to=class extends eo{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=no.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};Zr(to.prototype,"abort");const no=new WeakMap;Object.defineProperties(to.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(to.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let ro=class{constructor(){oo.set(this,function(){const e=Object.create(to.prototype);return eo.call(e),no.set(e,!1),e}())}get signal(){return io(this)}abort(){var e;e=io(this),!1===no.get(e)&&(no.set(e,!0),e.dispatchEvent({type:"abort"}))}};const oo=new WeakMap;function io(e){const t=oo.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(ro.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ro.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var uo=function(e,t){return uo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},uo(e,t)};function ao(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}uo(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var co,so,lo,fo,po=function(){return po=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},po.apply(this,arguments)};function ho(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var vo="undefined"!=typeof AbortController;"undefined"!=typeof window||vo?co=globalThis.AbortController:"undefined"!=typeof require?(so=require("http").request,lo=require("https").request,fo=require("url").parse,co=require("abort-controller")):"object"==typeof globalThis?(so=e.request,lo=t.request,fo=n.parse,co=ro):co=function(){throw new Error("AbortController is not defined")};var yo=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),go=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=fr(e))&&void 0!==t?t:e},blob:function(){return fr(e)},formData:function(){return fr(e)},arrayBuffer:function(){return fr(e)}}},n.origin=null!=t?t:"",n}return ao(t,e),t}(yo),bo=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new co:v,g=t.type,b=void 0===g?"json":g,m=ho(t,["method","query","headers","body","timeout","controller","type"]),w=po({url:e,method:u,query:c,headers:l,body:"GET"===u?null:pr(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=rr(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=fo(r.url,!0);return po(po({},r),o)},n}return ao(t,e),t}(go),mo=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=gr(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=ho(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=gr(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?lo:so)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,po({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,po({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,po({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,po({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,po({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,po({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,po({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return ao(t,e),t}(bo);mn(mn(mn(mn(mn(mn(mn(mn(mn(mn(mn({},kn),Tn),Hn),Mn),Cn),jn),Dn),Bn),Nn),Gn),{eventMessageCenter:Un,taskQueueLib:Xn,JSRequest:mo});var wo=function(){return wo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},wo.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var jo={type:"interval",autoStop:!0},Eo=function(){function e(e){var t=this;this.__id=0,this.timers={},this.fixString="#@$&*",this.isFrame=function(){return"frame"===t.opts.type},this.opts=wo(wo({},jo),e)}return e.prototype.add=function(e,t){return this.initDelay(t),this.pushTimer(e,t)},e.prototype.delete=function(e){var t,n=e.id,r=e.delay,o=this.timers;r&&(null===(t=o[r])||void 0===t?void 0:t.handles)&&(o[r].handles=o[r].handles.filter((function(e){return e.id!==n})))},e.prototype.clear=function(){var e=this,t=this.timers;Object.keys(t).forEach((function(n){return e.stopTimer(t[n])})),this.timers={}},e.prototype.pushTimer=function(e,t){var n=this.timers,r={id:this.getId(),handle:e,delay:t};return n[t].handles.push(r),r},e.prototype.initDelay=function(e){var t=this.timers;t[e]||(t[e]={intervalId:null,handles:[],delay:e},this.startTimer(t[e]))},e.prototype.startTimer=function(e){var t=this;e.intervalId=this.delayHandle((function(){t.autoStopTimer(e),e.handles.forEach((function(e){return e.handle()}))}),e.delay)},e.prototype.stopTimer=function(e){var t=e.intervalId;this.isFrame()?t():clearInterval(t)},e.prototype.autoStopTimer=function(e){var t=this.opts.autoStop,n=this.timers,r=e.delay;t&&e.handles.length<=0&&(this.stopTimer(e),n[r]=null)},e.prototype.delayHandle=function(e,t){return this.isFrame()?function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}}(e,t):setInterval(e,t)},e.prototype.getId=function(){return"".concat(this.fixString,"-").concat(++this.__id)},e}();ye(ye(ye(ye(ye(ye(ye(ye(ye(ye(ye({},Pe),je),qe),He),Le),be),Me),Ce),_e),Je),{eventMessageCenter:Ve,taskQueueLib:Ye,JSRequest:bn,TimerManager:Eo});var Oo=function(e,t){return Oo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Oo(e,t)};var To=function(){return To=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},To.apply(this,arguments)};function So(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}function Po(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}var xo,qo=function(e){function t(t){var n=e.call(this)||this;return n.defaultKey="default",n.defaultLen=10,n.push=function(e,t){void 0===t&&(t=n.defaultKey),n.checkQueue(e,t);var r=Ae(),o=r.resolve,i=r.reject,u=r.promise;try{n.formatQueue(e,t),n.run()}catch(e){n.state="rejected",i(e)}return n.on(t,o),u},n.run=function(){return So(n,void 0,void 0,(function(){var e,t,n,r=this;return Po(this,(function(o){switch(o.label){case 0:return"pending"===this.state||0===this.queues.length&&(this.state="idle")?[3,2]:(this.state="pending",e=this.unshift(null===(n=this.props)||void 0===n?void 0:n.maxLen),[4,Promise.all(e.map((function(e){var t,n=e.queue();return r.isPromise(n)?null===(t=null==n?void 0:n.catch)||void 0===t?void 0:t.call(n,(function(e){return new Error(e)})):n})))]);case 1:return t=o.sent(),this.state="fulfilled",this.finish({result:t,queues:e}),[3,0];case 2:return[2]}}))}))},n.finish=function(e){var t=e.result,r=void 0===t?[]:t,o=e.queues,i=void 0===o?[]:o,u=n.queueTemp;i.forEach((function(e,t){var o,i,a=e.id,c=u[a];c.result.push(r[t]),(null===(o=c.result)||void 0===o?void 0:o.length)===(null===(i=c.queue)||void 0===i?void 0:i.length)&&(n.emit(a,c.result),n.state="idle",u[a]=null)}))},n.formatQueue=function(e,t){var r,o=n.queueTemp,i={id:t,result:[]},u=null!==(r=o[t])&&void 0!==r?r:To({queue:[]},i),a=null==u?void 0:u.queue;e.forEach((function(e){a.push(e),n.queues.push(To({queue:e},i))})),o[t]=u},n.isPromise=function(e){return e instanceof Promise},n.voidObj=function(){return Object.create(null)},n.unshift=function(e){return void 0===e&&(e=n.defaultLen),n.queues.splice(0,e)},n.clearQueue=function(){n.queues=[],n.queueTemp=n.voidObj(),n.props=null,n.state="idle",n.clear()},n.clearQueue(),n.props=t,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Oo(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.checkQueue=function(e,t){if(!e)throw new ReferenceError("queue is not defined");if(!(e instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue should be an array");if(0===(null==e?void 0:e.length))throw new Error("queue.length can not be 0");if(null==e?void 0:e.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have fn")},t}(Ve),ko=function(){return ko=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ko.apply(this,arguments)};function Ao(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(xo||(xo={}));var Ho={types:xo},Lo=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Mo=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return xo[n]}return t},Co=function(e,t){void 0===t&&(t=[]);var n=Mo(e);return t.indexOf(n)>0},Do={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Lo,getType:Mo,getTypeByList:Co},Bo=function(e,t){return"object"!=typeof e||"null"===t},Io=function(e){var t=Mo(e);if(Bo(e,t))return e;var n=Ro(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,Io(e))})):"set"===t?e.forEach((function(e){n.add(Io(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=Io(r)})),n},Ro=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},_o=function(e){function t(){}return t.prototype=e,new t},Fo=function(e){if("string"!==Mo(e))return null;try{return JSON.parse(e)}catch(e){return null}},No=function(e){if(!Co(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Wo={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Bo,cloneDeep:Io,createObjectVariable:Ro,createObject:_o,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=_o(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Ao([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Fo,jsonToString:No,isWindow:function(e){return e&&e===e.window}},Jo=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Mo(e)?Jo(e,t):t.push(e)})),t},Vo={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Jo},Go=void 0,Uo=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},zo={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Ao([Go],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Ao([Go],r,!1))}),t)}},defer:Uo,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Qo={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Ko={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},$o={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Yo=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Zo=function(e){return Yo(e,!0,!1)},Xo=["\\","|","/","—","—"],ei=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Xo:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Zo("\n");s>=l-1&&(s=0);var f=r[s++];return Zo(f),setTimeout((function(){e.index=s,ei(e)}),a),e},ti={logOneLine:Yo,logLoop:ei},ni=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function ri(e){return 0===e||1===e?1:e*ri(e-1)}function oi(e,t){return ri(e)/(ri(t)*ri(e-t))}var ii={AnimateFrame:ni,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:ri,combination:oi,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=oi(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},ui=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();ui.Instance(ui);var ai=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new ui),e},ci=function(){return ci=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ci.apply(this,arguments)},si=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},li=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},fi=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},pi=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=ci(ci({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return li(t,void 0,void 0,(function(){var e,t,r,o,i;return fi(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([ai,si("design:paramtypes",[Object])],e),e}();ko(ko(ko(ko(ko(ko(ko(ko(ko(ko(ko({},Wo),Do),Vo),zo),Qo),Ho),Ko),$o),ti),ii),{eventMessageCenter:ui,taskQueueLib:pi});
14
- /**
15
- * @author Toru Nagashima <https://github.com/mysticatea>
16
- * @copyright 2015 Toru Nagashima. All rights reserved.
17
- * See LICENSE file in root directory for full license.
18
- */
19
- const hi=new WeakMap,di=new WeakMap;function vi(e){const t=hi.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function yi(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function gi(e,t){hi.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,bi(t))}}function bi(e){return{get(){return vi(this).event[e]},set(t){vi(this).event[e]=t},configurable:!0,enumerable:!0}}function mi(e){return{value(){const t=vi(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function wi(e){if(null==e||e===Object.prototype)return gi;let t=di.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?mi(i):bi(i))}}return r}(wi(Object.getPrototypeOf(e)),e),di.set(e,t)),t}function ji(e){return vi(e).immediateStopped}function Ei(e,t){vi(e).passiveListener=t}gi.prototype={get type(){return vi(this).event.type},get target(){return vi(this).eventTarget},get currentTarget(){return vi(this).currentTarget},composedPath(){const e=vi(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return vi(this).eventPhase},stopPropagation(){const e=vi(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=vi(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(vi(this).event.bubbles)},get cancelable(){return Boolean(vi(this).event.cancelable)},preventDefault(){yi(vi(this))},get defaultPrevented(){return vi(this).canceled},get composed(){return Boolean(vi(this).event.composed)},get timeStamp(){return vi(this).timeStamp},get srcElement(){return vi(this).eventTarget},get cancelBubble(){return vi(this).stopped},set cancelBubble(e){if(!e)return;const t=vi(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!vi(this).canceled},set returnValue(e){e||yi(vi(this))},initEvent(){}},Object.defineProperty(gi.prototype,"constructor",{value:gi,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(gi.prototype,window.Event.prototype),di.set(window.Event.prototype,gi));const Oi=new WeakMap,Ti=3;function Si(e){return null!==e&&"object"==typeof e}function Pi(e){const t=Oi.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function xi(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=Pi(this).get(e);for(;null!=t;){if(t.listenerType===Ti)return t.listener;t=t.next}return null},set(t){"function"==typeof t||Si(t)||(t=null);const n=Pi(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===Ti?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:Ti,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function qi(e){function t(){ki.call(this)}t.prototype=Object.create(ki.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)xi(t.prototype,e[n]);return t}function ki(){if(!(this instanceof ki)){if(1===arguments.length&&Array.isArray(arguments[0]))return qi(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return qi(e)}throw new TypeError("Cannot call a class as a function")}Oi.set(this,new Map)}ki.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!Si(t))throw new TypeError("'listener' should be a function or an object.");const r=Pi(this),o=Si(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=Pi(this),o=(Si(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=Pi(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(wi(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,Ei(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==Ti&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(ji(o))break;r=r.next}return Ei(o,null),function(e,t){vi(e).eventPhase=t}(o,0),function(e,t){vi(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(ki.prototype,"constructor",{value:ki,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(ki.prototype,window.EventTarget.prototype);let Ai=class extends ki{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=Hi.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};xi(Ai.prototype,"abort");const Hi=new WeakMap;Object.defineProperties(Ai.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ai.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Li=class{constructor(){Mi.set(this,function(){const e=Object.create(Ai.prototype);return ki.call(e),Hi.set(e,!1),e}())}get signal(){return Ci(this)}abort(){var e;e=Ci(this),!1===Hi.get(e)&&(Hi.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Mi=new WeakMap;function Ci(e){const t=Mi.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Li.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Li.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var Di=function(e,t){return Di=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Di(e,t)};function Bi(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Di(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ii,Ri,_i,Fi,Ni=function(){return Ni=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ni.apply(this,arguments)};function Wi(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Ji="undefined"!=typeof AbortController;"undefined"!=typeof window||Ji?Ii=globalThis.AbortController:"undefined"!=typeof require?(Ri=require("http").request,_i=require("https").request,Fi=require("url").parse,Ii=require("abort-controller")):"object"==typeof globalThis?(Ri=e.request,_i=t.request,Fi=n.parse,Ii=Li):Ii=function(){throw new Error("AbortController is not defined")};var Vi,Gi=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),Ui=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Fo(e))&&void 0!==t?t:e},blob:function(){return Fo(e)},formData:function(){return Fo(e)},arrayBuffer:function(){return Fo(e)}}},n.origin=null!=t?t:"",n}return Bi(t,e),t}(Gi),zi=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new Ii:v,g=t.type,b=void 0===g?"json":g,m=Wi(t,["method","query","headers","body","timeout","controller","type"]),w=Ni({url:e,method:u,query:c,headers:l,body:"GET"===u?null:No(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Lo(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=Fi(r.url,!0);return Ni(Ni({},r),o)},n}return Bi(t,e),t}(Ui),Qi=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=Uo(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Wi(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=Uo(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?_i:Ri)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Ni({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Ni({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Ni({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Ni({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Ni({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Ni({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Ni({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return Bi(t,e),t}(zi),Ki=function(){return Ki=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ki.apply(this,arguments)};function $i(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Vi||(Vi={}));var Yi={types:Vi},Zi=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Vi[n]}return t},Xi=function(e,t){void 0===t&&(t=[]);var n=Zi(e);return t.indexOf(n)>0},eu={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:Zi,getTypeByList:Xi},tu=function(e,t){return"object"!=typeof e||"null"===t},nu=function(e){var t=Zi(e);if(tu(e,t))return e;var n=ru(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,nu(e))})):"set"===t?e.forEach((function(e){n.add(nu(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=nu(r)})),n},ru=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},ou=function(e){function t(){}return t.prototype=e,new t},iu={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:tu,cloneDeep:nu,createObjectVariable:ru,createObject:ou,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=ou(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,$i([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==Zi(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!Xi(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window}},uu=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Zi(e)?uu(e,t):t.push(e)})),t},au={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:uu},cu=void 0,su={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,$i([cu],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,$i([cu],r,!1))}),t)}},defer:function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},lu={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},fu={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},pu={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},hu=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},du=function(e){return hu(e,!0,!1)},vu=["\\","|","/","—","—"],yu=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?vu:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return du("\n");s>=l-1&&(s=0);var f=r[s++];return du(f),setTimeout((function(){e.index=s,yu(e)}),a),e},gu={logOneLine:hu,logLoop:yu},bu=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function mu(e){return 0===e||1===e?1:e*mu(e-1)}function wu(e,t){return mu(e)/(mu(t)*mu(e-t))}var ju={AnimateFrame:bu,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:mu,combination:wu,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=wu(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Eu=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Eu.Instance(Eu);var Ou,Tu=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Eu),e},Su=function(){return Su=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Su.apply(this,arguments)},Pu=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},xu=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},qu=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},ku=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Su(Su({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return xu(t,void 0,void 0,(function(){var e,t,r,o,i;return qu(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Tu,Pu("design:paramtypes",[Object])],e),e}(),Au=function(){return Au=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Au.apply(this,arguments)};function Hu(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Ou||(Ou={}));var Lu={types:Ou},Mu=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Cu=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Ou[n]}return t},Du=function(e,t){void 0===t&&(t=[]);var n=Cu(e);return t.indexOf(n)>0},Bu={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Mu,getType:Cu,getTypeByList:Du},Iu=function(e,t){return"object"!=typeof e||"null"===t},Ru=function(e){var t=Cu(e);if(Iu(e,t))return e;var n=_u(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,Ru(e))})):"set"===t?e.forEach((function(e){n.add(Ru(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=Ru(r)})),n},_u=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Fu=function(e){function t(){}return t.prototype=e,new t},Nu=function(e){if("string"!==Cu(e))return null;try{return JSON.parse(e)}catch(e){return null}},Wu=function(e){if(!Du(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Ju={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++){if(void 0===(e=e[o[r]]))return n}return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Iu,cloneDeep:Ru,createObjectVariable:_u,createObject:Fu,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Fu(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Hu([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Nu,jsonToString:Wu,isWindow:function(e){return e&&e===e.window}},Vu=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Cu(e)?Vu(e,t):t.push(e)})),t},Gu={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Vu},Uu=void 0,zu=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},Qu={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Hu([Uu],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Hu([Uu],r,!1))}),t)}},defer:zu,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Ku={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},$u={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Yu={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Zu=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Xu=function(e){return Zu(e,!0,!1)},ea=["\\","|","/","—","—"],ta=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?ea:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Xu("\n");s>=l-1&&(s=0);var f=r[s++];return Xu(f),setTimeout((function(){e.index=s,ta(e)}),a),e},na={logOneLine:Zu,logLoop:ta},ra=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function oa(e){return 0===e||1===e?1:e*oa(e-1)}function ia(e,t){return oa(e)/(oa(t)*oa(e-t))}var ua={AnimateFrame:ra,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:oa,combination:ia,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=ia(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},aa=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;this.checkHandler(e,t);return this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();aa.Instance(aa);var ca=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new aa),e},sa=function(){return sa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},sa.apply(this,arguments)},la=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},fa=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))},pa=function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!(o=u.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},ha=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=sa(sa({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return fa(t,void 0,void 0,(function(){var e,t,r,o,i;return pa(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([ca,la("design:paramtypes",[Object])],e),e}();Au(Au(Au(Au(Au(Au(Au(Au(Au(Au(Au({},Ju),Bu),Gu),Qu),Ku),Lu),$u),Yu),na),ua),{eventMessageCenter:aa,taskQueueLib:ha});
20
- /**
21
- * @author Toru Nagashima <https://github.com/mysticatea>
22
- * @copyright 2015 Toru Nagashima. All rights reserved.
23
- * See LICENSE file in root directory for full license.
24
- */
25
- const da=new WeakMap,va=new WeakMap;function ya(e){const t=da.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function ga(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function ba(e,t){da.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,ma(t))}}function ma(e){return{get(){return ya(this).event[e]},set(t){ya(this).event[e]=t},configurable:!0,enumerable:!0}}function wa(e){return{value(){const t=ya(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function ja(e){if(null==e||e===Object.prototype)return ba;let t=va.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?wa(i):ma(i))}}return r}(ja(Object.getPrototypeOf(e)),e),va.set(e,t)),t}function Ea(e){return ya(e).immediateStopped}function Oa(e,t){ya(e).passiveListener=t}ba.prototype={get type(){return ya(this).event.type},get target(){return ya(this).eventTarget},get currentTarget(){return ya(this).currentTarget},composedPath(){const e=ya(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return ya(this).eventPhase},stopPropagation(){const e=ya(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=ya(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(ya(this).event.bubbles)},get cancelable(){return Boolean(ya(this).event.cancelable)},preventDefault(){ga(ya(this))},get defaultPrevented(){return ya(this).canceled},get composed(){return Boolean(ya(this).event.composed)},get timeStamp(){return ya(this).timeStamp},get srcElement(){return ya(this).eventTarget},get cancelBubble(){return ya(this).stopped},set cancelBubble(e){if(!e)return;const t=ya(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!ya(this).canceled},set returnValue(e){e||ga(ya(this))},initEvent(){}},Object.defineProperty(ba.prototype,"constructor",{value:ba,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(ba.prototype,window.Event.prototype),va.set(window.Event.prototype,ba));const Ta=new WeakMap,Sa=3;function Pa(e){return null!==e&&"object"==typeof e}function xa(e){const t=Ta.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function qa(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=xa(this).get(e);for(;null!=t;){if(t.listenerType===Sa)return t.listener;t=t.next}return null},set(t){"function"==typeof t||Pa(t)||(t=null);const n=xa(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===Sa?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:Sa,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function ka(e){function t(){Aa.call(this)}t.prototype=Object.create(Aa.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)qa(t.prototype,e[n]);return t}function Aa(){if(!(this instanceof Aa)){if(1===arguments.length&&Array.isArray(arguments[0]))return ka(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return ka(e)}throw new TypeError("Cannot call a class as a function")}Ta.set(this,new Map)}Aa.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!Pa(t))throw new TypeError("'listener' should be a function or an object.");const r=xa(this),o=Pa(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=xa(this),o=(Pa(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=xa(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(ja(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,Oa(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==Sa&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(Ea(o))break;r=r.next}return Oa(o,null),function(e,t){ya(e).eventPhase=t}(o,0),function(e,t){ya(e).currentTarget=t}(o,null),!o.defaultPrevented}},Object.defineProperty(Aa.prototype,"constructor",{value:Aa,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(Aa.prototype,window.EventTarget.prototype);class Ha extends Aa{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=La.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}}qa(Ha.prototype,"abort");const La=new WeakMap;Object.defineProperties(Ha.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ha.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Ma=class{constructor(){Ca.set(this,function(){const e=Object.create(Ha.prototype);return Aa.call(e),La.set(e,!1),e}())}get signal(){return Da(this)}abort(){var e;e=Da(this),!1===La.get(e)&&(La.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Ca=new WeakMap;function Da(e){const t=Ca.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Ma.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ma.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var Ba=function(e,t){return Ba=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Ba(e,t)};function Ia(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Ba(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Ra,_a,Fa,Na,Wa=function(){return Wa=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Wa.apply(this,arguments)};function Ja(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Va="undefined"!=typeof AbortController;"undefined"!=typeof window||Va?Ra=globalThis.AbortController:"undefined"!=typeof require?(_a=require("http").request,Fa=require("https").request,Na=require("url").parse,Ra=require("abort-controller")):"object"==typeof globalThis?(_a=e.request,Fa=t.request,Na=n.parse,Ra=Ma):Ra=function(){throw new Error("AbortController is not defined")};var Ga=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),Ua=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Nu(e))&&void 0!==t?t:e},blob:function(){return Nu(e)},formData:function(){return Nu(e)},arrayBuffer:function(){return Nu(e)}}},n.origin=null!=t?t:"",n}return Ia(t,e),t}(Ga),za=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new Ra:v,g=t.type,b=void 0===g?"json":g,m=Ja(t,["method","query","headers","body","timeout","controller","type"]),w=Wa({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Wu(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Mu(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=Na(r.url,!0);return Wa(Wa({},r),o)},n}return Ia(t,e),t}(Ua),Qa=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=zu(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Ja(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=zu(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?Fa:_a)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Wa({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Wa({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Wa({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Wa({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Wa({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Wa({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Wa({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return Ia(t,e),t}(za);Ki(Ki(Ki(Ki(Ki(Ki(Ki(Ki(Ki(Ki(Ki({},iu),eu),au),su),lu),Yi),fu),pu),gu),ju),{eventMessageCenter:Eu,taskQueueLib:ku,JSRequest:Qa});var Ka=function(){return Ka=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ka.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var $a,Ya,Za={type:"interval",autoStop:!0},Xa=function(){function e(e){var t=this;this.__id=0,this.timers={},this.fixString="#@$&*",this.isFrame=function(){return"frame"===t.opts.type},this.opts=Ka(Ka({},Za),e)}return e.prototype.add=function(e,t){return this.initDelay(t),this.pushTimer(e,t)},e.prototype.delete=function(e){var t,n=e.id,r=e.delay,o=this.timers;r&&(null===(t=o[r])||void 0===t?void 0:t.handles)&&(o[r].handles=o[r].handles.filter((function(e){return e.id!==n})))},e.prototype.clear=function(){var e=this,t=this.timers;Object.keys(t).forEach((function(n){return e.stopTimer(t[n])})),this.timers={}},e.prototype.pushTimer=function(e,t){var n=this.timers,r={id:this.getId(),handle:e,delay:t};return n[t].handles.push(r),r},e.prototype.initDelay=function(e){var t=this.timers;t[e]||(t[e]={intervalId:null,handles:[],delay:e},this.startTimer(t[e]))},e.prototype.startTimer=function(e){var t=this;e.intervalId=this.delayHandle((function(){t.autoStopTimer(e),e.handles.forEach((function(e){return e.handle()}))}),e.delay)},e.prototype.stopTimer=function(e){var t=e.intervalId;this.isFrame()?t():clearInterval(t)},e.prototype.autoStopTimer=function(e){var t=this.opts.autoStop,n=this.timers,r=e.delay;t&&e.handles.length<=0&&(this.stopTimer(e),n[r]=null)},e.prototype.delayHandle=function(e,t){return this.isFrame()?function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}}(e,t):setInterval(e,t)},e.prototype.getId=function(){return"".concat(this.fixString,"-").concat(++this.__id)},e}(),ec=function(){return ec=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ec.apply(this,arguments)};function tc(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}(Ya=$a||($a={}))["[object Array]"]="array",Ya["[object Object]"]="object",Ya["[object Function]"]="function",Ya["[object Set]"]="set",Ya["[object Map]"]="map",Ya["[object WeakMap]"]="weakMap",Ya["[object WeakSet]"]="weakSet",Ya["[object Date]"]="date",Ya["[object RegExp]"]="regExp",Ya["[object Math]"]="math";var nc={types:$a},rc=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return $a[n]}return t},oc=function(e,t){void 0===t&&(t=[]);var n=rc(e);return t.indexOf(n)>0},ic=function(e,t){return void 0===t&&(t="-"),e.replace(/[A-Z]/g,(function(e){return"".concat(t).concat(e.toLowerCase())}))},uc={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:rc,getTypeByList:oc,toKebabCase:ic},ac=function(e,t){return"object"!=typeof e||"null"===t},cc=function(e){var t=rc(e);if(ac(e,t))return e;var n=sc(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,cc(e))})):"set"===t?e.forEach((function(e){n.add(cc(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=cc(r)})),n},sc=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},lc=function(e){function t(){}return t.prototype=e,new t},fc=function(e){void 0===e&&(e={});var t=Object.create(null);return Reflect.ownKeys(e).forEach((function(n){return t[n]=e[n]})),t},pc=function(e){void 0===e&&(e={});var t=fc(e);return Reflect.ownKeys(t).length<=0},hc={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:ac,cloneDeep:cc,createObjectVariable:sc,createObject:lc,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=lc(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,tc([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==rc(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!oc(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window},emptyObject:fc,isEmptyObject:pc},dc=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===rc(e)?dc(e,t):t.push(e)})),t},vc={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:dc},yc=void 0,gc={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,tc([yc],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,tc([yc],r,!1))}),t)}},defer:function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},bc={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},mc={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},wc={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},jc=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Ec=function(e){return jc(e,!0,!1)},Oc=["\\","|","/","—","—"],Tc=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Oc:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Ec("\n");s>=l-1&&(s=0);var f=r[s++];return Ec(f),setTimeout((function(){e.index=s,Tc(e)}),a),e},Sc={logOneLine:jc,logLoop:Tc},Pc=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function xc(e){return 0===e||1===e?1:e*xc(e-1)}function qc(e,t){return xc(e)/(xc(t)*xc(e-t))}var kc,Ac={AnimateFrame:Pc,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:xc,combination:qc,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=qc(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Hc=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events=Object.create(null)}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events=Object.create(null),this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Hc.Instance(Hc);var Lc=function(){return Lc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Lc.apply(this,arguments)};function Mc(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(kc||(kc={}));var Cc={types:kc},Dc=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return kc[n]}return t},Bc=function(e,t){void 0===t&&(t=[]);var n=Dc(e);return t.indexOf(n)>0},Ic={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:Dc,getTypeByList:Bc},Rc=function(e,t){return"object"!=typeof e||"null"===t},_c=function(e){var t=Dc(e);if(Rc(e,t))return e;var n=Fc(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,_c(e))})):"set"===t?e.forEach((function(e){n.add(_c(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=_c(r)})),n},Fc=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Nc=function(e){function t(){}return t.prototype=e,new t},Wc={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Rc,cloneDeep:_c,createObjectVariable:Fc,createObject:Nc,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Nc(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Mc([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==Dc(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!Bc(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window},emptyObject:function(e){void 0===e&&(e={});var t=Object.create(null);return Reflect.ownKeys(e).forEach((function(n){return t[n]=e[n]})),t}},Jc=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Dc(e)?Jc(e,t):t.push(e)})),t},Vc={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Jc},Gc=void 0,Uc=function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},zc={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Mc([Gc],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Mc([Gc],r,!1))}),t)}},defer:Uc,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Qc={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Kc={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},$c={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Yc=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Zc=function(e){return Yc(e,!0,!1)},Xc=["\\","|","/","—","—"],es=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Xc:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Zc("\n");s>=l-1&&(s=0);var f=r[s++];return Zc(f),setTimeout((function(){e.index=s,es(e)}),a),e},ts={logOneLine:Yc,logLoop:es},ns=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function rs(e){return 0===e||1===e?1:e*rs(e-1)}function os(e,t){return rs(e)/(rs(t)*rs(e-t))}var is={AnimateFrame:ns,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:rs,combination:os,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=os(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},us=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();us.Instance(us);var as,cs=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new us),e},ss=function(){return ss=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ss.apply(this,arguments)},ls=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},fs=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=ss(ss({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e,t,r,o,i;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([cs,ls("design:paramtypes",[Object])],e),e}(),ps=function(){return ps=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},ps.apply(this,arguments)};function hs(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(as||(as={}));var ds={types:as},vs=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},ys=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return as[n]}return t},gs=function(e,t){void 0===t&&(t=[]);var n=ys(e);return t.indexOf(n)>0},bs={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:vs,getType:ys,getTypeByList:gs},ms=function(e,t){return"object"!=typeof e||"null"===t},ws=function(e){var t=ys(e);if(ms(e,t))return e;var n=js(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,ws(e))})):"set"===t?e.forEach((function(e){n.add(ws(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=ws(r)})),n},js=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Es=function(e){function t(){}return t.prototype=e,new t},Os=function(e){if("string"!==ys(e))return null;try{return JSON.parse(e)}catch(e){return null}},Ts=function(e){if(!gs(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Ss={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:ms,cloneDeep:ws,createObjectVariable:js,createObject:Es,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Es(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,hs([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Os,jsonToString:Ts,isWindow:function(e){return e&&e===e.window}},Ps=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===ys(e)?Ps(e,t):t.push(e)})),t},xs={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Ps},qs=void 0,ks=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},As={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,hs([qs],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,hs([qs],r,!1))}),t)}},defer:ks,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Hs={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Ls={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Ms={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Cs=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Ds=function(e){return Cs(e,!0,!1)},Bs=["\\","|","/","—","—"],Is=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Bs:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Ds("\n");s>=l-1&&(s=0);var f=r[s++];return Ds(f),setTimeout((function(){e.index=s,Is(e)}),a),e},Rs={logOneLine:Cs,logLoop:Is},_s=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function Fs(e){return 0===e||1===e?1:e*Fs(e-1)}function Ns(e,t){return Fs(e)/(Fs(t)*Fs(e-t))}var Ws={AnimateFrame:_s,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Fs,combination:Ns,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=Ns(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Js=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Js.Instance(Js);var Vs=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Js),e},Gs=function(){return Gs=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Gs.apply(this,arguments)},Us=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},zs=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Gs(Gs({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e,t,r,o,i;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Vs,Us("design:paramtypes",[Object])],e),e}();ps(ps(ps(ps(ps(ps(ps(ps(ps(ps(ps({},Ss),bs),xs),As),Hs),ds),Ls),Ms),Rs),Ws),{eventMessageCenter:Js,taskQueueLib:zs});
26
- /**
27
- * @author Toru Nagashima <https://github.com/mysticatea>
28
- * @copyright 2015 Toru Nagashima. All rights reserved.
29
- * See LICENSE file in root directory for full license.
30
- */
31
- const Qs=new WeakMap,Ks=new WeakMap;function $s(e){const t=Qs.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function Ys(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function Zs(e,t){Qs.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,Xs(t))}}function Xs(e){return{get(){return $s(this).event[e]},set(t){$s(this).event[e]=t},configurable:!0,enumerable:!0}}function el(e){return{value(){const t=$s(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function tl(e){if(null==e||e===Object.prototype)return Zs;let t=Ks.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?el(i):Xs(i))}}return r}(tl(Object.getPrototypeOf(e)),e),Ks.set(e,t)),t}function nl(e){return $s(e).immediateStopped}function rl(e,t){$s(e).passiveListener=t}Zs.prototype={get type(){return $s(this).event.type},get target(){return $s(this).eventTarget},get currentTarget(){return $s(this).currentTarget},composedPath(){const e=$s(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return $s(this).eventPhase},stopPropagation(){const e=$s(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=$s(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean($s(this).event.bubbles)},get cancelable(){return Boolean($s(this).event.cancelable)},preventDefault(){Ys($s(this))},get defaultPrevented(){return $s(this).canceled},get composed(){return Boolean($s(this).event.composed)},get timeStamp(){return $s(this).timeStamp},get srcElement(){return $s(this).eventTarget},get cancelBubble(){return $s(this).stopped},set cancelBubble(e){if(!e)return;const t=$s(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!$s(this).canceled},set returnValue(e){e||Ys($s(this))},initEvent(){}},Object.defineProperty(Zs.prototype,"constructor",{value:Zs,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(Zs.prototype,window.Event.prototype),Ks.set(window.Event.prototype,Zs));const ol=new WeakMap,il=3;function ul(e){return null!==e&&"object"==typeof e}function al(e){const t=ol.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function cl(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=al(this).get(e);for(;null!=t;){if(t.listenerType===il)return t.listener;t=t.next}return null},set(t){"function"==typeof t||ul(t)||(t=null);const n=al(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===il?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:il,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function sl(e){function t(){ll.call(this)}t.prototype=Object.create(ll.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)cl(t.prototype,e[n]);return t}function ll(){if(!(this instanceof ll)){if(1===arguments.length&&Array.isArray(arguments[0]))return sl(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return sl(e)}throw new TypeError("Cannot call a class as a function")}ol.set(this,new Map)}ll.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!ul(t))throw new TypeError("'listener' should be a function or an object.");const r=al(this),o=ul(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=al(this),o=(ul(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=al(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(tl(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,rl(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==il&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(nl(o))break;r=r.next}return rl(o,null),function(e,t){$s(e).eventPhase=0}(o),function(e,t){$s(e).currentTarget=null}(o),!o.defaultPrevented}},Object.defineProperty(ll.prototype,"constructor",{value:ll,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(ll.prototype,window.EventTarget.prototype);let fl=class extends ll{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=pl.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};cl(fl.prototype,"abort");const pl=new WeakMap;Object.defineProperties(fl.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(fl.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let hl=class{constructor(){dl.set(this,function(){const e=Object.create(fl.prototype);return ll.call(e),pl.set(e,!1),e}())}get signal(){return vl(this)}abort(){var e;e=vl(this),!1===pl.get(e)&&(pl.set(e,!0),e.dispatchEvent({type:"abort"}))}};const dl=new WeakMap;function vl(e){const t=dl.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(hl.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(hl.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var yl=function(e,t){return yl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},yl(e,t)};function gl(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}yl(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var bl,ml,wl,jl,El=function(){return El=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},El.apply(this,arguments)};function Ol(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Tl="undefined"!=typeof AbortController;"undefined"!=typeof window||Tl?bl=globalThis.AbortController:"undefined"!=typeof require?(ml=require("http").request,wl=require("https").request,jl=require("url").parse,bl=require("abort-controller")):"object"==typeof globalThis?(ml=e.request,wl=t.request,jl=n.parse,bl=hl):bl=function(){throw new Error("AbortController is not defined")};var Sl,Pl=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),xl=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Os(e))&&void 0!==t?t:e},blob:function(){return Os(e)},formData:function(){return Os(e)},arrayBuffer:function(){return Os(e)}}},n.origin=null!=t?t:"",n}return gl(t,e),t}(Pl),ql=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new bl:v,g=t.type,b=void 0===g?"json":g,m=Ol(t,["method","query","headers","body","timeout","controller","type"]),w=El({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Ts(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=vs(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=jl(r.url,!0);return El(El({},r),o)},n}return gl(t,e),t}(xl),kl=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=ks(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Ol(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=ks(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?wl:ml)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,El({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,El({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,El({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,El({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,El({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,El({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,El({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return gl(t,e),t}(ql),Al=function(){return Al=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Al.apply(this,arguments)};function Hl(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Sl||(Sl={}));var Ll={types:Sl},Ml=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Sl[n]}return t},Cl=function(e,t){void 0===t&&(t=[]);var n=Ml(e);return t.indexOf(n)>0},Dl={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:Ml,getTypeByList:Cl},Bl=function(e,t){return"object"!=typeof e||"null"===t},Il=function(e){var t=Ml(e);if(Bl(e,t))return e;var n=Rl(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,Il(e))})):"set"===t?e.forEach((function(e){n.add(Il(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=Il(r)})),n},Rl=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},_l=function(e){function t(){}return t.prototype=e,new t},Fl={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Bl,cloneDeep:Il,createObjectVariable:Rl,createObject:_l,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=_l(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Hl([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==Ml(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!Cl(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window}},Nl=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Ml(e)?Nl(e,t):t.push(e)})),t},Wl={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Nl},Jl=void 0,Vl={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Hl([Jl],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Hl([Jl],r,!1))}),t)}},defer:function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Gl={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Ul={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},zl={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Ql=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Kl=function(e){return Ql(e,!0,!1)},$l=["\\","|","/","—","—"],Yl=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?$l:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Kl("\n");s>=l-1&&(s=0);var f=r[s++];return Kl(f),setTimeout((function(){e.index=s,Yl(e)}),a),e},Zl={logOneLine:Ql,logLoop:Yl},Xl=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function ef(e){return 0===e||1===e?1:e*ef(e-1)}function tf(e,t){return ef(e)/(ef(t)*ef(e-t))}var nf={AnimateFrame:Xl,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:ef,combination:tf,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=tf(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},rf=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();rf.Instance(rf);var of,uf=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new rf),e},af=function(){return af=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},af.apply(this,arguments)},cf=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},sf=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=af(af({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e,t,r,o,i;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([uf,cf("design:paramtypes",[Object])],e),e}(),lf=function(){return lf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},lf.apply(this,arguments)};function ff(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(of||(of={}));var pf={types:of},hf=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},df=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return of[n]}return t},vf=function(e,t){void 0===t&&(t=[]);var n=df(e);return t.indexOf(n)>0},yf={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:hf,getType:df,getTypeByList:vf},gf=function(e,t){return"object"!=typeof e||"null"===t},bf=function(e){var t=df(e);if(gf(e,t))return e;var n=mf(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,bf(e))})):"set"===t?e.forEach((function(e){n.add(bf(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=bf(r)})),n},mf=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},wf=function(e){function t(){}return t.prototype=e,new t},jf=function(e){if("string"!==df(e))return null;try{return JSON.parse(e)}catch(e){return null}},Ef=function(e){if(!vf(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Of={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:gf,cloneDeep:bf,createObjectVariable:mf,createObject:wf,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=wf(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,ff([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:jf,jsonToString:Ef,isWindow:function(e){return e&&e===e.window}},Tf=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===df(e)?Tf(e,t):t.push(e)})),t},Sf={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Tf},Pf=void 0,xf=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},qf={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,ff([Pf],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,ff([Pf],r,!1))}),t)}},defer:xf,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},kf={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Af={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Hf={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Lf=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},Mf=function(e){return Lf(e,!0,!1)},Cf=["\\","|","/","—","—"],Df=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?Cf:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return Mf("\n");s>=l-1&&(s=0);var f=r[s++];return Mf(f),setTimeout((function(){e.index=s,Df(e)}),a),e},Bf={logOneLine:Lf,logLoop:Df},If=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function Rf(e){return 0===e||1===e?1:e*Rf(e-1)}function _f(e,t){return Rf(e)/(Rf(t)*Rf(e-t))}var Ff={AnimateFrame:If,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Rf,combination:_f,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=_f(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Nf=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Nf.Instance(Nf);var Wf=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Nf),e},Jf=function(){return Jf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Jf.apply(this,arguments)},Vf=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Gf=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=Jf(Jf({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e,t,r,o,i;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([Wf,Vf("design:paramtypes",[Object])],e),e}();lf(lf(lf(lf(lf(lf(lf(lf(lf(lf(lf({},Of),yf),Sf),qf),kf),pf),Af),Hf),Bf),Ff),{eventMessageCenter:Nf,taskQueueLib:Gf});
32
- /**
33
- * @author Toru Nagashima <https://github.com/mysticatea>
34
- * @copyright 2015 Toru Nagashima. All rights reserved.
35
- * See LICENSE file in root directory for full license.
36
- */
37
- const Uf=new WeakMap,zf=new WeakMap;function Qf(e){const t=Uf.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function Kf(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function $f(e,t){Uf.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,Yf(t))}}function Yf(e){return{get(){return Qf(this).event[e]},set(t){Qf(this).event[e]=t},configurable:!0,enumerable:!0}}function Zf(e){return{value(){const t=Qf(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function Xf(e){if(null==e||e===Object.prototype)return $f;let t=zf.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?Zf(i):Yf(i))}}return r}(Xf(Object.getPrototypeOf(e)),e),zf.set(e,t)),t}function ep(e){return Qf(e).immediateStopped}function tp(e,t){Qf(e).passiveListener=t}$f.prototype={get type(){return Qf(this).event.type},get target(){return Qf(this).eventTarget},get currentTarget(){return Qf(this).currentTarget},composedPath(){const e=Qf(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return Qf(this).eventPhase},stopPropagation(){const e=Qf(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=Qf(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(Qf(this).event.bubbles)},get cancelable(){return Boolean(Qf(this).event.cancelable)},preventDefault(){Kf(Qf(this))},get defaultPrevented(){return Qf(this).canceled},get composed(){return Boolean(Qf(this).event.composed)},get timeStamp(){return Qf(this).timeStamp},get srcElement(){return Qf(this).eventTarget},get cancelBubble(){return Qf(this).stopped},set cancelBubble(e){if(!e)return;const t=Qf(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!Qf(this).canceled},set returnValue(e){e||Kf(Qf(this))},initEvent(){}},Object.defineProperty($f.prototype,"constructor",{value:$f,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf($f.prototype,window.Event.prototype),zf.set(window.Event.prototype,$f));const np=new WeakMap,rp=3;function op(e){return null!==e&&"object"==typeof e}function ip(e){const t=np.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function up(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=ip(this).get(e);for(;null!=t;){if(t.listenerType===rp)return t.listener;t=t.next}return null},set(t){"function"==typeof t||op(t)||(t=null);const n=ip(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===rp?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:rp,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function ap(e){function t(){cp.call(this)}t.prototype=Object.create(cp.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)up(t.prototype,e[n]);return t}function cp(){if(!(this instanceof cp)){if(1===arguments.length&&Array.isArray(arguments[0]))return ap(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return ap(e)}throw new TypeError("Cannot call a class as a function")}np.set(this,new Map)}cp.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!op(t))throw new TypeError("'listener' should be a function or an object.");const r=ip(this),o=op(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=ip(this),o=(op(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=ip(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(Xf(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,tp(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==rp&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(ep(o))break;r=r.next}return tp(o,null),function(e,t){Qf(e).eventPhase=0}(o),function(e,t){Qf(e).currentTarget=null}(o),!o.defaultPrevented}},Object.defineProperty(cp.prototype,"constructor",{value:cp,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(cp.prototype,window.EventTarget.prototype);let sp=class extends cp{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=lp.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};up(sp.prototype,"abort");const lp=new WeakMap;Object.defineProperties(sp.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(sp.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let fp=class{constructor(){pp.set(this,function(){const e=Object.create(sp.prototype);return cp.call(e),lp.set(e,!1),e}())}get signal(){return hp(this)}abort(){var e;e=hp(this),!1===lp.get(e)&&(lp.set(e,!0),e.dispatchEvent({type:"abort"}))}};const pp=new WeakMap;function hp(e){const t=pp.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(fp.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(fp.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var dp=function(e,t){return dp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},dp(e,t)};function vp(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}dp(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var yp,gp,bp,mp,wp=function(){return wp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},wp.apply(this,arguments)};function jp(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Ep="undefined"!=typeof AbortController;"undefined"!=typeof window||Ep?yp=globalThis.AbortController:"undefined"!=typeof require?(gp=require("http").request,bp=require("https").request,mp=require("url").parse,yp=require("abort-controller")):"object"==typeof globalThis?(gp=e.request,bp=t.request,mp=n.parse,yp=fp):yp=function(){throw new Error("AbortController is not defined")};var Op=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),Tp=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=jf(e))&&void 0!==t?t:e},blob:function(){return jf(e)},formData:function(){return jf(e)},arrayBuffer:function(){return jf(e)}}},n.origin=null!=t?t:"",n}return vp(t,e),t}(Op),Sp=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new yp:v,g=t.type,b=void 0===g?"json":g,m=jp(t,["method","query","headers","body","timeout","controller","type"]),w=wp({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Ef(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=hf(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=mp(r.url,!0);return wp(wp({},r),o)},n}return vp(t,e),t}(Tp),Pp=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=xf(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=jp(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=xf(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?bp:gp)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,wp({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,wp({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,wp({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,wp({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,wp({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,wp({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,wp({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return vp(t,e),t}(Sp);Al(Al(Al(Al(Al(Al(Al(Al(Al(Al(Al({},Fl),Dl),Wl),Vl),Gl),Ll),Ul),zl),Zl),nf),{eventMessageCenter:rf,taskQueueLib:sf,JSRequest:Pp});var xp=function(){return xp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},xp.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var qp={type:"interval",autoStop:!0},kp=function(){function e(e){var t=this;this.__id=0,this.timers={},this.fixString="#@$&*",this.isFrame=function(){return"frame"===t.opts.type},this.opts=xp(xp({},qp),e)}return e.prototype.add=function(e,t){return this.initDelay(t),this.pushTimer(e,t)},e.prototype.delete=function(e){var t,n=e.id,r=e.delay,o=this.timers;r&&(null===(t=o[r])||void 0===t?void 0:t.handles)&&(o[r].handles=o[r].handles.filter((function(e){return e.id!==n})))},e.prototype.clear=function(){var e=this,t=this.timers;Object.keys(t).forEach((function(n){return e.stopTimer(t[n])})),this.timers={}},e.prototype.pushTimer=function(e,t){var n=this.timers,r={id:this.getId(),handle:e,delay:t};return n[t].handles.push(r),r},e.prototype.initDelay=function(e){var t=this.timers;t[e]||(t[e]={intervalId:null,handles:[],delay:e},this.startTimer(t[e]))},e.prototype.startTimer=function(e){var t=this;e.intervalId=this.delayHandle((function(){t.autoStopTimer(e),e.handles.forEach((function(e){return e.handle()}))}),e.delay)},e.prototype.stopTimer=function(e){var t=e.intervalId;this.isFrame()?t():clearInterval(t)},e.prototype.autoStopTimer=function(e){var t=this.opts.autoStop,n=this.timers,r=e.delay;t&&e.handles.length<=0&&(this.stopTimer(e),n[r]=null)},e.prototype.delayHandle=function(e,t){return this.isFrame()?function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}}(e,t):setInterval(e,t)},e.prototype.getId=function(){return"".concat(this.fixString,"-").concat(++this.__id)},e}();Lc(Lc(Lc(Lc(Lc(Lc(Lc(Lc(Lc(Lc(Lc({},Wc),Ic),Vc),zc),Qc),Cc),Kc),$c),ts),is),{eventMessageCenter:us,taskQueueLib:fs,JSRequest:kl,TimerManager:kp});var Ap=function(e,t){return Ap=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Ap(e,t)},Hp=function(){return Hp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Hp.apply(this,arguments)};var Lp,Mp=function(e){function t(t){var n=e.call(this)||this;return n.defaultKey="default",n.defaultLen=10,n.push=function(e,t){void 0===t&&(t=n.defaultKey),n.checkQueue(e,t);var r=Uc(),o=r.resolve,i=r.reject,u=r.promise;try{n.formatQueue(e,t),n.run()}catch(e){n.state="rejected",i(e)}return n.on(t,o),u},n.run=function(){return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(n,void 0,void 0,(function(){var e,t,n,r=this;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(o){switch(o.label){case 0:return"pending"===this.state||0===this.queues.length&&(this.state="idle")?[3,2]:(this.state="pending",e=this.unshift(null===(n=this.props)||void 0===n?void 0:n.maxLen),[4,Promise.all(e.map((function(e){var t,n=e.queue();return r.isPromise(n)?null===(t=null==n?void 0:n.catch)||void 0===t?void 0:t.call(n,(function(e){return new Error(e)})):n})))]);case 1:return t=o.sent(),this.state="fulfilled",this.finish({result:t,queues:e}),[3,0];case 2:return[2]}}))}))},n.finish=function(e){var t=e.result,r=void 0===t?[]:t,o=e.queues,i=void 0===o?[]:o,u=n.queueTemp;i.forEach((function(e,t){var o,i,a=e.id,c=u[a];c.result.push(r[t]),(null===(o=c.result)||void 0===o?void 0:o.length)===(null===(i=c.queue)||void 0===i?void 0:i.length)&&(n.emit(a,c.result),n.state="idle",u[a]=null)}))},n.formatQueue=function(e,t){var r,o=n.queueTemp,i={id:t,result:[]},u=null!==(r=o[t])&&void 0!==r?r:Hp({queue:[]},i),a=null==u?void 0:u.queue;e.forEach((function(e){a.push(e),n.queues.push(Hp({queue:e},i))})),o[t]=u},n.isPromise=function(e){return e instanceof Promise},n.voidObj=function(){return Object.create(null)},n.unshift=function(e){return void 0===e&&(e=n.defaultLen),n.queues.splice(0,e)},n.clearQueue=function(){n.queues=[],n.queueTemp=n.voidObj(),n.props=null,n.state="idle",n.clear()},n.clearQueue(),n.props=t,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Ap(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.checkQueue=function(e,t){if(!e)throw new ReferenceError("queue is not defined");if(!(e instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue should be an array");if(0===(null==e?void 0:e.length))throw new Error("queue.length can not be 0");if(null==e?void 0:e.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have fn")},t}(us),Cp=function(){return Cp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Cp.apply(this,arguments)};function Dp(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Lp||(Lp={}));var Bp={types:Lp},Ip=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Rp=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Lp[n]}return t},_p=function(e,t){void 0===t&&(t=[]);var n=Rp(e);return t.indexOf(n)>0},Fp={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Ip,getType:Rp,getTypeByList:_p},Np=function(e,t){return"object"!=typeof e||"null"===t},Wp=function(e){var t=Rp(e);if(Np(e,t))return e;var n=Jp(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,Wp(e))})):"set"===t?e.forEach((function(e){n.add(Wp(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=Wp(r)})),n},Jp=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Vp=function(e){function t(){}return t.prototype=e,new t},Gp=function(e){if("string"!==Rp(e))return null;try{return JSON.parse(e)}catch(e){return null}},Up=function(e){if(!_p(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},zp={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Np,cloneDeep:Wp,createObjectVariable:Jp,createObject:Vp,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Vp(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Dp([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Gp,jsonToString:Up,isWindow:function(e){return e&&e===e.window}},Qp=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Rp(e)?Qp(e,t):t.push(e)})),t},Kp={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Qp},$p=void 0,Yp=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},Zp={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Dp([$p],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Dp([$p],r,!1))}),t)}},defer:Yp,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},Xp={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},eh={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},th={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},nh=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},rh=function(e){return nh(e,!0,!1)},oh=["\\","|","/","—","—"],ih=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?oh:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return rh("\n");s>=l-1&&(s=0);var f=r[s++];return rh(f),setTimeout((function(){e.index=s,ih(e)}),a),e},uh={logOneLine:nh,logLoop:ih},ah=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}();function ch(e){return 0===e||1===e?1:e*ch(e-1)}function sh(e,t){return ch(e)/(ch(t)*ch(e-t))}var lh={AnimateFrame:ah,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:ch,combination:sh,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=sh(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},fh=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();fh.Instance(fh);var ph=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new fh),e},hh=function(){return hh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},hh.apply(this,arguments)},dh=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},vh=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=hh(hh({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e,t,r,o,i;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([ph,dh("design:paramtypes",[Object])],e),e}();Cp(Cp(Cp(Cp(Cp(Cp(Cp(Cp(Cp(Cp(Cp({},zp),Fp),Kp),Zp),Xp),Bp),eh),th),uh),lh),{eventMessageCenter:fh,taskQueueLib:vh});
38
- /**
39
- * @author Toru Nagashima <https://github.com/mysticatea>
40
- * @copyright 2015 Toru Nagashima. All rights reserved.
41
- * See LICENSE file in root directory for full license.
42
- */
43
- const yh=new WeakMap,gh=new WeakMap;function bh(e){const t=yh.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function mh(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function wh(e,t){yh.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,jh(t))}}function jh(e){return{get(){return bh(this).event[e]},set(t){bh(this).event[e]=t},configurable:!0,enumerable:!0}}function Eh(e){return{value(){const t=bh(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function Oh(e){if(null==e||e===Object.prototype)return wh;let t=gh.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?Eh(i):jh(i))}}return r}(Oh(Object.getPrototypeOf(e)),e),gh.set(e,t)),t}function Th(e){return bh(e).immediateStopped}function Sh(e,t){bh(e).passiveListener=t}wh.prototype={get type(){return bh(this).event.type},get target(){return bh(this).eventTarget},get currentTarget(){return bh(this).currentTarget},composedPath(){const e=bh(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return bh(this).eventPhase},stopPropagation(){const e=bh(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=bh(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(bh(this).event.bubbles)},get cancelable(){return Boolean(bh(this).event.cancelable)},preventDefault(){mh(bh(this))},get defaultPrevented(){return bh(this).canceled},get composed(){return Boolean(bh(this).event.composed)},get timeStamp(){return bh(this).timeStamp},get srcElement(){return bh(this).eventTarget},get cancelBubble(){return bh(this).stopped},set cancelBubble(e){if(!e)return;const t=bh(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!bh(this).canceled},set returnValue(e){e||mh(bh(this))},initEvent(){}},Object.defineProperty(wh.prototype,"constructor",{value:wh,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(wh.prototype,window.Event.prototype),gh.set(window.Event.prototype,wh));const Ph=new WeakMap,xh=3;function qh(e){return null!==e&&"object"==typeof e}function kh(e){const t=Ph.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function Ah(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=kh(this).get(e);for(;null!=t;){if(t.listenerType===xh)return t.listener;t=t.next}return null},set(t){"function"==typeof t||qh(t)||(t=null);const n=kh(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===xh?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:xh,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function Hh(e){function t(){Lh.call(this)}t.prototype=Object.create(Lh.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)Ah(t.prototype,e[n]);return t}function Lh(){if(!(this instanceof Lh)){if(1===arguments.length&&Array.isArray(arguments[0]))return Hh(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return Hh(e)}throw new TypeError("Cannot call a class as a function")}Ph.set(this,new Map)}Lh.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!qh(t))throw new TypeError("'listener' should be a function or an object.");const r=kh(this),o=qh(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=kh(this),o=(qh(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=kh(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(Oh(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,Sh(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==xh&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(Th(o))break;r=r.next}return Sh(o,null),function(e,t){bh(e).eventPhase=0}(o),function(e,t){bh(e).currentTarget=null}(o),!o.defaultPrevented}},Object.defineProperty(Lh.prototype,"constructor",{value:Lh,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(Lh.prototype,window.EventTarget.prototype);let Mh=class extends Lh{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=Ch.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}};Ah(Mh.prototype,"abort");const Ch=new WeakMap;Object.defineProperties(Mh.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Mh.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Dh=class{constructor(){Bh.set(this,function(){const e=Object.create(Mh.prototype);return Lh.call(e),Ch.set(e,!1),e}())}get signal(){return Ih(this)}abort(){var e;e=Ih(this),!1===Ch.get(e)&&(Ch.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Bh=new WeakMap;function Ih(e){const t=Bh.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Dh.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Dh.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var Rh=function(e,t){return Rh=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Rh(e,t)};function _h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Rh(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Fh,Nh,Wh,Jh,Vh=function(){return Vh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Vh.apply(this,arguments)};function Gh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Uh="undefined"!=typeof AbortController;"undefined"!=typeof window||Uh?Fh=globalThis.AbortController:"undefined"!=typeof require?(Nh=require("http").request,Wh=require("https").request,Jh=require("url").parse,Fh=require("abort-controller")):"object"==typeof globalThis?(Nh=e.request,Wh=t.request,Jh=n.parse,Fh=Dh):Fh=function(){throw new Error("AbortController is not defined")};var zh,Qh=function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}(),Kh=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Gp(e))&&void 0!==t?t:e},blob:function(){return Gp(e)},formData:function(){return Gp(e)},arrayBuffer:function(){return Gp(e)}}},n.origin=null!=t?t:"",n}return _h(t,e),t}(Qh),$h=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new Fh:v,g=t.type,b=void 0===g?"json":g,m=Gh(t,["method","query","headers","body","timeout","controller","type"]),w=Vh({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Up(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Ip(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=Jh(r.url,!0);return Vh(Vh({},r),o)},n}return _h(t,e),t}(Kh),Yh=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=Yp(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Gh(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=Yp(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?Wh:Nh)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Vh({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Vh({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Vh({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Vh({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Vh({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Vh({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Vh({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return _h(t,e),t}($h),Zh=function(){return Zh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Zh.apply(this,arguments)};function Xh(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(zh||(zh={}));var ed={types:zh},td=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return zh[n]}return t},nd=function(e,t){void 0===t&&(t=[]);var n=td(e);return t.indexOf(n)>0},rd={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},getType:td,getTypeByList:nd},od=function(e,t){return"object"!=typeof e||"null"===t},id=function(e){var t=td(e);if(od(e,t))return e;var n=ud(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,id(e))})):"set"===t?e.forEach((function(e){n.add(id(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=id(r)})),n},ud=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},ad=function(e){function t(){}return t.prototype=e,new t},cd={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:od,cloneDeep:id,createObjectVariable:ud,createObject:ad,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=ad(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Xh([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:function(e){if("string"!==td(e))return null;try{return JSON.parse(e)}catch(e){return null}},jsonToString:function(e){if(!nd(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},isWindow:function(e){return e&&e===e.window}},sd=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===td(e)?sd(e,t):t.push(e)})),t},ld={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:sd},fd=void 0,pd={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Xh([fd],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Xh([fd],r,!1))}),t)}},defer:function(e){var t,n;return void 0===e&&(e=0),{promise:new Promise((function(r,o){t=r,n=o,e>0&&setTimeout((function(){return n("timeout")}),e)})),resolve:t,reject:n}},catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},hd={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},dd={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},vd={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},yd=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},gd=function(e){return yd(e,!0,!1)},bd=["\\","|","/","—","—"],md=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?bd:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return gd("\n");s>=l-1&&(s=0);var f=r[s++];return gd(f),setTimeout((function(){e.index=s,md(e)}),a),e},wd={logOneLine:yd,logLoop:md},jd=function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){if(!this.isActive)return this.duration=null!=e?e:1/0,this.isActive=!0,this.animate()},e.prototype.stop=function(e){void 0===e&&(e=this.id),this.isActive=!1,cancelAnimationFrame(e)},e.prototype.animate=function(e){if(void 0===e&&(e=0),this.isActive&&this.duration-- >0)return this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)),this.id},e}();function Ed(e){return 0===e||1===e?1:e*Ed(e-1)}function Od(e,t){return Ed(e)/(Ed(t)*Ed(e-t))}var Td={AnimateFrame:jd,quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:Ed,combination:Od,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=Od(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},Sd=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();Sd.Instance(Sd);var Pd,xd=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new Sd),e},qd=function(){return qd=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qd.apply(this,arguments)},kd=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Ad=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=qd(qd({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e,t,r,o,i;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([xd,kd("design:paramtypes",[Object])],e),e}(),Hd=function(){return Hd=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Hd.apply(this,arguments)};function Ld(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e["[object Array]"]="array",e["[object Object]"]="object",e["[object Function]"]="function",e["[object Set]"]="set",e["[object Map]"]="map",e["[object WeakMap]"]="weakMap",e["[object WeakSet]"]="weakSet",e["[object Date]"]="date",e["[object RegExp]"]="regExp",e["[object Math]"]="math"}(Pd||(Pd={}));var Md={types:Pd},Cd=function(e,t){void 0===t&&(t={});var n=Object.keys(t);if(0===n.length)return e;var r=n.map((function(e){return"".concat(e,"=").concat(t[e])}));return"".concat(e).concat(e.includes("?")?"&":"?").concat(r.join("&"))},Dd=function(e){var t=typeof e;if(null===e)return"null";if("object"===t){var n=Object.prototype.toString.call(e);return Pd[n]}return t},Bd=function(e,t){void 0===t&&(t=[]);var n=Dd(e);return t.indexOf(n)>0},Id={randomNum:function(e,t,n){return void 0===n&&(n=!1),Math.floor(Math.random()*(t-e+(n?1:0))+e)},urlSplit:function(e){var t={};return e.includes("?")?(e.split("?")[1].split("&").forEach((function(e){var n=e.split("=")[0];t[n]=e.split("=")[1]})),t):t},urlJoin:Cd,getType:Dd,getTypeByList:Bd},Rd=function(e,t){return"object"!=typeof e||"null"===t},_d=function(e){var t=Dd(e);if(Rd(e,t))return e;var n=Fd(t,e);return"map"===t?e.forEach((function(e,t){n.set(t,_d(e))})):"set"===t?e.forEach((function(e){n.add(_d(e))})):Reflect.ownKeys(e).forEach((function(t){var r=e[t];n[t]=_d(r)})),n},Fd=function(e,t){switch(void 0===t&&(t={}),e){case"array":return[];case"function":return t;case"set":return new Set;case"map":return new Map;case"date":return new Date(t);case"regExp":return new RegExp(t);case"math":return Math;default:return{}}},Nd=function(e){function t(){}return t.prototype=e,new t},Wd=function(e){if("string"!==Dd(e))return null;try{return JSON.parse(e)}catch(e){return null}},Jd=function(e){if(!Bd(e,["array","object","set","map"]))return"";try{return JSON.stringify(e)}catch(e){return""}},Vd={getValue:function(e,t,n){void 0===n&&(n="");for(var r=0,o=t.split(".");r<o.length;r++)if(void 0===(e=e[o[r]]))return n;return e},setValue:function(e,t,n){void 0===n&&(n={});for(var r=t.split("."),o=r[r.length-1],i=e,u=0,a=r;u<a.length;u++){var c=a[u];if("object"!=typeof i&&void 0!==i)return e;!i&&(i={}),!i[c]&&(i[c]={}),o===c&&(i[o]=n),i=i[c]}return e},mixIn:function(e,t,n){var r;for(var o in void 0===t&&(t={}),void 0===n&&(n=!1),t)for(var i in t[o]){var u=null!==(r=e.prototype)&&void 0!==r?r:e;(void 0===e[i]||n)&&(u[i]=t[o][i])}return e},enumInversion:function(e){for(var t in e){var n=e[t];"string"!=typeof n||e[n]||(e[n]=t)}return e},isNotObject:Rd,cloneDeep:_d,createObjectVariable:Fd,createObject:Nd,inherit:function(e,t){return void 0===t&&(t=function(){}),t.prototype=Nd(e.prototype),t.prototype.super=e,t.prototype.constructor=t,t},getInstance:function(e,t){void 0===t&&(t=!1);for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return e._instance&&!t||(e._instance=new(e.bind.apply(e,Ld([void 0],n,!1)))),e._instance},classDecorator:function(e){return function(t){for(var n in e)Reflect.has(t.prototype,n)||(t.prototype[n]=e[n])}},stringToJson:Wd,jsonToString:Jd,isWindow:function(e){return e&&e===e.window}},Gd=function(e,t){return void 0===t&&(t=[]),e.forEach((function(e){return"array"===Dd(e)?Gd(e,t):t.push(e)})),t},Ud={arrayRandom:function(e){return e.sort((function(){return Math.random()-.5}))},arrayUniq:function(e){return Array.from(new Set(e))},arrayDemote:Gd},zd=void 0,Qd=function(e){var t,n;return void 0===e&&(e=0),e>0&&setTimeout(n,e),{promise:new Promise((function(e,r){t=e,n=r})),resolve:t,reject:n}},Kd={throttle:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n||(n=setTimeout((function(){e.call.apply(e,Ld([zd],r,!1)),n=null}),t))}},debounce:function(e,t){var n=null;return function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n&&(clearTimeout(n),n=null),n=setTimeout((function(){e.call.apply(e,Ld([zd],r,!1))}),t)}},defer:Qd,catchAwait:function(e){return e.then((function(e){return[null,e]})).catch((function(e){return[e]}))}},$d={createElement:function(e){var t,n,r=e.ele,o=e.style,i=e.attr,u=e.parent,a=r instanceof HTMLElement?r:document.createElement(null!=r?r:"div");return o&&(null===(t=Object.keys(o))||void 0===t||t.forEach((function(e){return a.style[e]=o[e]}))),i&&(null===(n=Object.keys(i))||void 0===n||n.forEach((function(e){return a[e]=i[e]}))),u&&u.appendChild(a),a}},Yd={addHandler:function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e["on"+t]=n},stopBubble:function(e){(e=e||window.event).stopPropagation?e.stopPropagation():e.cancelBubble=!1},stopDefault:function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1},removeHandler:function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e["on"+t]=null},dispatchEvent:function(e,t){var n=new Event(t);e.dispatchEvent(n)}},Zd={setStorage:function(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(e)}},getStorage:function(e){try{var t=localStorage.getItem(e);return null==t?null:JSON.parse(t)}catch(e){return console.error(e),null}},clearStorage:function(e){try{e&&localStorage.removeItem(e),!e&&localStorage.clear()}catch(e){console.error(e)}}},Xd=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!0),t&&(process.stdout.clearLine(0),process.stdout.cursorTo(0)),process.stdout.write(e),n&&process.stdout.write("\n")},ev=function(e){return Xd(e,!0,!1)},tv=["\\","|","/","—","—"],nv=function(e){var t;void 0===e&&(e={});var n=e.loopList,r=void 0===n?tv:n,o=e.isStop,i=void 0!==o&&o,u=e.timer,a=void 0===u?100:u,c=e.index,s=void 0===c?0:c,l=null!==(t=null==r?void 0:r.length)&&void 0!==t?t:0;if(!l)return e;if(i)return ev("\n");s>=l-1&&(s=0);var f=r[s++];return ev(f),setTimeout((function(){e.index=s,nv(e)}),a),e},rv={logOneLine:Xd,logLoop:nv};function ov(e){return 0===e||1===e?1:e*ov(e-1)}function iv(e,t){return ov(e)/(ov(t)*ov(e-t))}var uv={AnimateFrame:function(){function e(e){this.fn=e,this.id=null,this.duration=1/0,this.isActive=!1}return e.prototype.start=function(e){this.isActive||(this.duration=null!=e?e:1/0,this.isActive=!0,this.animate())},e.prototype.stop=function(){this.isActive=!1,cancelAnimationFrame(this.id)},e.prototype.animate=function(e){void 0===e&&(e=0),this.isActive&&this.duration-- >0&&(this.fn(e),this.id=requestAnimationFrame(this.animate.bind(this)))},e}(),quadraticBezier:function(e,t,n){var r=1-n,o=n*n;return[2*r*n*e+o,2*r*n*t+o]},cubicBezier:function(e,t,n,r,o){var i=3*e,u=3*t,a=3*(n-e)-i,c=3*(r-t)-u,s=1-u-c;return[(1-i-a)*Math.pow(o,3)+a*Math.pow(o,2)+i*o,s*Math.pow(o,3)+c*Math.pow(o,2)+u*o]},factorial:ov,combination:iv,NBezier:function(e,t){for(var n=e.length-1,r=[0,0],o=0;o<=n;o++){var i=iv(n,o)*Math.pow(1-t,n-o)*Math.pow(t,o);r[0]+=i*e[o][0],r[1]+=i*e[o][1]}return r}},av=function(){function e(e){void 0===e&&(e={}),this.options=e,this.events={}}return e.prototype.on=function(e,t){return this.checkHandler(e,t),this.getHandler(e,[]).push(t),this},e.prototype.emit=function(e,t){return this.has(e)&&this.runHandler(e,t),this},e.prototype.un=function(e,t){return this.unHandler(e,t),this},e.prototype.once=function(e,t){var n=this;this.checkHandler(e,t);var r=function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];return n.un(e,r),t.apply(void 0,o)};return this.on(e,r),this},e.prototype.clear=function(){return this.events={},this},e.prototype.has=function(e){return!!this.getHandler(e)},e.prototype.getHandler=function(e,t){var n;return"object"==typeof t&&(this.events[e]=null!==(n=this.events[e])&&void 0!==n?n:t),this.events[e]},e.prototype.handlerLength=function(e){var t,n;return null!==(n=null===(t=this.getHandler(e))||void 0===t?void 0:t.length)&&void 0!==n?n:0},e.prototype.watch=function(e,t){var n=this;return this.checkHandler(e,t),this.on(e,(function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];n.emit(n.prefixStr(e),t.apply(void 0,r))})),this},e.prototype.invoke=function(e,t){var n=this;return new Promise((function(r){n.once(n.prefixStr(e),r),n.emit(e,t)}))},e.prototype.runHandler=function(e,t){for(var n=0,r=this.getHandler(e);n<r.length;n++){var o=r[n];o&&o(t)}},e.prototype.unHandler=function(e,t){var n=this.getHandler(e);!t&&(this.events[e]=[]),t&&this.checkHandler(e,t);for(var r=0;r<n.length;r++)n&&n[r]===t&&(n[r]=null)},e.prototype.prefixStr=function(e){return"@".concat(e)},e.prototype.checkHandler=function(e,t){var n=this.options,r=n.blackList,o=void 0===r?[]:r,i=n.maxLen,u=void 0===i?1/0:i,a=this.handlerLength(e);if(0===(null==e?void 0:e.length))throw new Error("type.length can not be 0");if(!t||!e)throw new ReferenceError("type or handler is not defined");if("function"!=typeof t||"string"!=typeof e)throw new TypeError("".concat(t," is not a function or ").concat(e," is not a string"));if(o.includes(e))throw new Error("".concat(e," is not allow"));if(u<=a)throw new Error("the number of ".concat(e," must be less than ").concat(u))},e.Instance=function(e){return e._instance||Object.defineProperty(e,"_instance",{value:new e}),e._instance},e}();av.Instance(av);var cv=function(e){return e.prototype.messageCenter||(e.prototype.messageCenter=new av),e},sv=function(){return sv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},sv.apply(this,arguments)},lv=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},fv=function(){function e(e){var t=this;this.fix="@~&$",this.init=function(){t.messageCenter.on("push:handler",t.run),t.messageCenter.on("run:success:handler",t.run),t.messageCenter.on("run:success:handler",t.finish),t.messageCenter.on("run:error:handler",t.run),t.messageCenter.on("run:error:handler",t.finish)},this.defineProps=function(e,n){Object.defineProperty(t,n,{value:e})},this.push=function(e){var n;t.checkHandler(e);var r=(n=t.defer()).resolve,o=n.reject,i=n.promise,u=t.fixStr(e.name);return t.queues=t.queues.concat(e.children.map((function(e){return{defer:e,name:u}}))),t.queueTemp[u]=sv(sv({},e),{result:[]}),t.messageCenter.emit("push:handler",o),t.messageCenter.on(u,r),i},this.unshift=function(e){return t.queues.splice(0,e)},this.run=function(e){var n=e.reject;return function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function u(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(u,a)}c((r=r.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e,t,r,o,i;return function(e,t){var n,r,o,i,u={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(u=0)),u;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return u.label++,{value:a[1],done:!1};case 5:u.label++,r=a[1],a=[0];continue;case 7:a=u.ops.pop(),u.trys.pop();continue;default:if(!((o=(o=u.trys).length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){u=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){u.label=a[1];break}if(6===a[0]&&u.label<o[1]){u.label=o[1],o=a;break}if(o&&u.label<o[2]){u.label=o[2],u.ops.push(a);break}o[2]&&u.ops.pop(),u.trys.pop();continue}a=t.call(e,u)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}(this,(function(u){switch(u.label){case 0:if("pending"===this.stateProxy())return[2,void 0];if(0===this.queues.length)return[2,this.stateProxy("idle")];this.stateProxy("pending"),e=this.unshift(null!==(i=null===(o=this.props)||void 0===o?void 0:o.maxLen)&&void 0!==i?i:10),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,Promise.all(e.map((function(e,t){return e.defer().catch((function(e){return e}))})))];case 2:return t=u.sent(),[2,this.handlerSuccess({res:t,queues:e})];case 3:return r=u.sent(),[2,this.handlerError({reject:n,error:r,queues:e})];case 4:return[2]}}))}))},this.clear=function(){t.queues=[],t.queueTemp={},t.props=null,t.stateProxy("idle"),t.messageCenter.clear()},this.finish=function(e){var n=e.res,r=void 0===n?[]:n,o=e.queues,i=e.error,u=void 0===i?"err":i,a=t.queueTemp;o.forEach((function(e,n){var o,i,c,s=a[e.name];null==s||s.result.push(null!==(o=r[n])&&void 0!==o?o:u),(null===(i=null==s?void 0:s.result)||void 0===i?void 0:i.length)===(null===(c=null==s?void 0:s.children)||void 0===c?void 0:c.length)&&(t.messageCenter.emit(e.name,null==s?void 0:s.result),a[e.name]=null)}))},this.handlerSuccess=function(e){return t.stateProxy("fulfilled"),t.messageCenter.emit("run:success:handler",e)},this.handlerError=function(e){var n=e.reject,r=e.error;return t.stateProxy("rejected"),n&&"function"==typeof n&&n(r),t.messageCenter.emit("run:error:handler",e)},this.stateProxy=function(e){return e&&(t.state=e),t.state},this.defer=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}},this.clear(),e&&this.defineProps(e,"props"),this.init()}return e.prototype.checkHandler=function(e){var t,n;if(!e)throw new ReferenceError("queue is not defined");if(!(e.children instanceof Array)||"object"!=typeof e)throw new TypeError("queue should be an object and queue.children should be an array");if(0===(null===(t=e.children)||void 0===t?void 0:t.length))throw new Error("queue.children.length can not be 0");if(null===(n=e.children)||void 0===n?void 0:n.find((function(e){return function(e){return!e||"function"!=typeof e}(e)})))throw new Error("queueList should have defer")},e.prototype.fixStr=function(e){return"".concat(this.fix).concat(e)},e=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}([cv,lv("design:paramtypes",[Object])],e),e}();Hd(Hd(Hd(Hd(Hd(Hd(Hd(Hd(Hd(Hd(Hd({},Vd),Id),Ud),Kd),$d),Md),Yd),Zd),rv),uv),{eventMessageCenter:av,taskQueueLib:fv});
44
- /**
45
- * @author Toru Nagashima <https://github.com/mysticatea>
46
- * @copyright 2015 Toru Nagashima. All rights reserved.
47
- * See LICENSE file in root directory for full license.
48
- */
49
- const pv=new WeakMap,hv=new WeakMap;function dv(e){const t=pv.get(e);return console.assert(null!=t,"'this' is expected an Event object, but got",e),t}function vv(e){null==e.passiveListener?e.event.cancelable&&(e.canceled=!0,"function"==typeof e.event.preventDefault&&e.event.preventDefault()):"undefined"!=typeof console&&"function"==typeof console.error&&console.error("Unable to preventDefault inside passive event listener invocation.",e.passiveListener)}function yv(e,t){pv.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});const n=Object.keys(t);for(let e=0;e<n.length;++e){const t=n[e];t in this||Object.defineProperty(this,t,gv(t))}}function gv(e){return{get(){return dv(this).event[e]},set(t){dv(this).event[e]=t},configurable:!0,enumerable:!0}}function bv(e){return{value(){const t=dv(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function mv(e){if(null==e||e===Object.prototype)return yv;let t=hv.get(e);return null==t&&(t=function(e,t){const n=Object.keys(t);if(0===n.length)return e;function r(t,n){e.call(this,t,n)}r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let o=0;o<n.length;++o){const i=n[o];if(!(i in e.prototype)){const e="function"==typeof Object.getOwnPropertyDescriptor(t,i).value;Object.defineProperty(r.prototype,i,e?bv(i):gv(i))}}return r}(mv(Object.getPrototypeOf(e)),e),hv.set(e,t)),t}function wv(e){return dv(e).immediateStopped}function jv(e,t){dv(e).passiveListener=t}yv.prototype={get type(){return dv(this).event.type},get target(){return dv(this).eventTarget},get currentTarget(){return dv(this).currentTarget},composedPath(){const e=dv(this).currentTarget;return null==e?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return dv(this).eventPhase},stopPropagation(){const e=dv(this);e.stopped=!0,"function"==typeof e.event.stopPropagation&&e.event.stopPropagation()},stopImmediatePropagation(){const e=dv(this);e.stopped=!0,e.immediateStopped=!0,"function"==typeof e.event.stopImmediatePropagation&&e.event.stopImmediatePropagation()},get bubbles(){return Boolean(dv(this).event.bubbles)},get cancelable(){return Boolean(dv(this).event.cancelable)},preventDefault(){vv(dv(this))},get defaultPrevented(){return dv(this).canceled},get composed(){return Boolean(dv(this).event.composed)},get timeStamp(){return dv(this).timeStamp},get srcElement(){return dv(this).eventTarget},get cancelBubble(){return dv(this).stopped},set cancelBubble(e){if(!e)return;const t=dv(this);t.stopped=!0,"boolean"==typeof t.event.cancelBubble&&(t.event.cancelBubble=!0)},get returnValue(){return!dv(this).canceled},set returnValue(e){e||vv(dv(this))},initEvent(){}},Object.defineProperty(yv.prototype,"constructor",{value:yv,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.Event&&(Object.setPrototypeOf(yv.prototype,window.Event.prototype),hv.set(window.Event.prototype,yv));const Ev=new WeakMap,Ov=3;function Tv(e){return null!==e&&"object"==typeof e}function Sv(e){const t=Ev.get(e);if(null==t)throw new TypeError("'this' is expected an EventTarget object, but got another value.");return t}function Pv(e,t){Object.defineProperty(e,`on${t}`,function(e){return{get(){let t=Sv(this).get(e);for(;null!=t;){if(t.listenerType===Ov)return t.listener;t=t.next}return null},set(t){"function"==typeof t||Tv(t)||(t=null);const n=Sv(this);let r=null,o=n.get(e);for(;null!=o;)o.listenerType===Ov?null!==r?r.next=o.next:null!==o.next?n.set(e,o.next):n.delete(e):r=o,o=o.next;if(null!==t){const o={listener:t,listenerType:Ov,passive:!1,once:!1,next:null};null===r?n.set(e,o):r.next=o}},configurable:!0,enumerable:!0}}(t))}function xv(e){function t(){qv.call(this)}t.prototype=Object.create(qv.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)Pv(t.prototype,e[n]);return t}function qv(){if(!(this instanceof qv)){if(1===arguments.length&&Array.isArray(arguments[0]))return xv(arguments[0]);if(arguments.length>0){const e=new Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return xv(e)}throw new TypeError("Cannot call a class as a function")}Ev.set(this,new Map)}qv.prototype={addEventListener(e,t,n){if(null==t)return;if("function"!=typeof t&&!Tv(t))throw new TypeError("'listener' should be a function or an object.");const r=Sv(this),o=Tv(n),i=(o?Boolean(n.capture):Boolean(n))?1:2,u={listener:t,listenerType:i,passive:o&&Boolean(n.passive),once:o&&Boolean(n.once),next:null};let a=r.get(e);if(void 0===a)return void r.set(e,u);let c=null;for(;null!=a;){if(a.listener===t&&a.listenerType===i)return;c=a,a=a.next}c.next=u},removeEventListener(e,t,n){if(null==t)return;const r=Sv(this),o=(Tv(n)?Boolean(n.capture):Boolean(n))?1:2;let i=null,u=r.get(e);for(;null!=u;){if(u.listener===t&&u.listenerType===o)return void(null!==i?i.next=u.next:null!==u.next?r.set(e,u.next):r.delete(e));i=u,u=u.next}},dispatchEvent(e){if(null==e||"string"!=typeof e.type)throw new TypeError('"event.type" should be a string.');const t=Sv(this),n=e.type;let r=t.get(n);if(null==r)return!0;const o=function(e,t){return new(mv(Object.getPrototypeOf(t)))(e,t)}(this,e);let i=null;for(;null!=r;){if(r.once?null!==i?i.next=r.next:null!==r.next?t.set(n,r.next):t.delete(n):i=r,jv(o,r.passive?r.listener:null),"function"==typeof r.listener)try{r.listener.call(this,o)}catch(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e)}else r.listenerType!==Ov&&"function"==typeof r.listener.handleEvent&&r.listener.handleEvent(o);if(wv(o))break;r=r.next}return jv(o,null),function(e,t){dv(e).eventPhase=0}(o),function(e,t){dv(e).currentTarget=null}(o),!o.defaultPrevented}},Object.defineProperty(qv.prototype,"constructor",{value:qv,configurable:!0,writable:!0}),"undefined"!=typeof window&&void 0!==window.EventTarget&&Object.setPrototypeOf(qv.prototype,window.EventTarget.prototype);class kv extends qv{constructor(){throw super(),new TypeError("AbortSignal cannot be constructed directly")}get aborted(){const e=Av.get(this);if("boolean"!=typeof e)throw new TypeError("Expected 'this' to be an 'AbortSignal' object, but got "+(null===this?"null":typeof this));return e}}Pv(kv.prototype,"abort");const Av=new WeakMap;Object.defineProperties(kv.prototype,{aborted:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(kv.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"});let Hv=class{constructor(){Lv.set(this,function(){const e=Object.create(kv.prototype);return qv.call(e),Av.set(e,!1),e}())}get signal(){return Mv(this)}abort(){var e;e=Mv(this),!1===Av.get(e)&&(Av.set(e,!0),e.dispatchEvent({type:"abort"}))}};const Lv=new WeakMap;function Mv(e){const t=Lv.get(e);if(null==t)throw new TypeError("Expected 'this' to be an 'AbortController' object, but got "+(null===e?"null":typeof e));return t}Object.defineProperties(Hv.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),"function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Hv.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"});var Cv=function(e,t){return Cv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Cv(e,t)};function Dv(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Cv(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var Bv,Iv,Rv,_v,Fv=function(){return Fv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Fv.apply(this,arguments)};function Nv(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var Wv="undefined"!=typeof AbortController;"undefined"!=typeof window||Wv?Bv=globalThis.AbortController:"undefined"!=typeof require?(Iv=require("http").request,Rv=require("https").request,_v=require("url").parse,Bv=require("abort-controller")):"object"==typeof globalThis?(Iv=e.request,Rv=t.request,_v=n.parse,Bv=Hv):Bv=function(){throw new Error("AbortController is not defined")};var Jv=function(e){function t(t){var n=e.call(this)||this;return n.chackUrl=function(e){return e.startsWith("/")},n.checkIsHttps=function(e){return e.startsWith("https")},n.fixOrigin=function(e){return n.chackUrl(e)?n.origin+e:e},n.envDesc=function(){return"undefined"!=typeof Window?"Window":"Node"},n.errorFn=function(e){return function(t){var r,o;return e(null!==(o=null===(r=n.errFn)||void 0===r?void 0:r.call(n,t))&&void 0!==o?o:t)}},n.clearTimer=function(e){return!!e.timer&&(clearTimeout(e.timer),e.timer=null)},n.initAbort=function(e){var t=e.controller,n=e.timer,r=e.timeout;return!n&&(e.timer=setTimeout((function(){return t.abort()}),r)),e},n.requestType=function(){switch(n.envDesc()){case"Window":return n.fetch;case"Node":return n.http}},n.getDataByType=function(e,t){switch(e){case"text":case"json":case"blob":case"formData":case"arrayBuffer":return t[e]();default:return t.json()}},n.formatBodyString=function(e){return{text:function(){return e},json:function(){var t;return null!==(t=Wd(e))&&void 0!==t?t:e},blob:function(){return Wd(e)},formData:function(){return Wd(e)},arrayBuffer:function(){return Wd(e)}}},n.origin=null!=t?t:"",n}return Dv(t,e),t}(function(){function e(){}return e.prototype.use=function(e,t){switch(e){case"request":this.requestSuccess=t;break;case"response":this.responseSuccess=t;break;case"error":this.error=t}return this},Object.defineProperty(e.prototype,"reqFn",{get:function(){return this.requestSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"resFn",{get:function(){return this.responseSuccess},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errFn",{get:function(){return this.error},enumerable:!1,configurable:!0}),e}()),Vv=function(e){function t(t){var n=e.call(this,t)||this;return n.initDefaultParams=function(e,t){var r,o,i=t.method,u=void 0===i?"GET":i,a=t.query,c=void 0===a?{}:a,s=t.headers,l=void 0===s?{}:s,f=t.body,p=void 0===f?null:f,h=t.timeout,d=void 0===h?3e4:h,v=t.controller,y=void 0===v?new Bv:v,g=t.type,b=void 0===g?"json":g,m=Nv(t,["method","query","headers","body","timeout","controller","type"]),w=Fv({url:e,method:u,query:c,headers:l,body:"GET"===u?null:Jd(p),timeout:d,signal:null==y?void 0:y.signal,controller:y,type:b,timer:null},m),j=null!==(o=null===(r=n.reqFn)||void 0===r?void 0:r.call(n,w))&&void 0!==o?o:w;return j.url=Cd(n.fixOrigin(e),w.query),j},n.initFetchParams=function(e,t){return n.initAbort(n.initDefaultParams(e,t))},n.initHttpParams=function(e,t){var r=n.initAbort(n.initDefaultParams(e,t)),o=_v(r.url,!0);return Fv(Fv({},r),o)},n}return Dv(t,e),t}(Jv),Gv=function(e){function t(t){var n=e.call(this,t)||this;return n.fetch=function(e,t){var r=Qd(),o=r.promise,i=r.resolve,u=r.reject,a=n.initFetchParams(e,t),c=a.url,s=Nv(a,["url"]),l=s.signal;return o.finally((function(){return n.clearTimer(s)})),l.addEventListener("abort",(function(){return n.errorFn(u)})),fetch(c,s).then((function(e){return(null==e?void 0:e.status)>=200&&(null==e?void 0:e.status)<300?n.getDataByType(s.type,e):n.errorFn(u)})).then((function(e){var t,r;return i(null!==(r=null===(t=n.resFn)||void 0===t?void 0:t.call(n,e))&&void 0!==r?r:e)})).catch(n.errorFn(u)),o},n.http=function(e,t){var r=Qd(),o=r.promise,i=r.resolve,u=r.reject,a=n.initHttpParams(e,t),c=a.signal,s=a.url,l=a.body;o.finally((function(){return n.clearTimer(a)}));var f=(n.checkIsHttps(s)?Rv:Iv)(a,(function(e){var t=e.statusCode,r=e.statusMessage,o="";return e.setEncoding("utf8"),e.on("data",(function(e){return o+=e})),e.on("end",(function(){var e,c,s=n.getDataByType(a.type,n.formatBodyString(o));return t>=200&&t<300?i(null!==(c=null===(e=n.resFn)||void 0===e?void 0:e.call(n,s))&&void 0!==c?c:s):n.errorFn(u)({statusCode:t,statusMessage:r,result:s,data:o})}))}));return c.addEventListener("abort",(function(){return n.errorFn(u)(f.destroy(new Error("request timeout")))})),l&&f.write(l),f.on("error",n.errorFn(u)),f.end(),o},n.GET=function(e,t,r,o){return n.request(e,Fv({query:t,method:"GET"},o))},n.POST=function(e,t,r,o){return n.request(e,Fv({query:t,method:"POST",body:r},o))},n.PUT=function(e,t,r,o){return n.request(e,Fv({query:t,method:"PUT",body:r},o))},n.DELETE=function(e,t,r,o){return n.request(e,Fv({query:t,method:"DELETE",body:r},o))},n.OPTIONS=function(e,t,r,o){return n.request(e,Fv({query:t,method:"OPTIONS",body:r},o))},n.HEAD=function(e,t,r,o){return n.request(e,Fv({query:t,method:"HEAD",body:r},o))},n.PATCH=function(e,t,r,o){return n.request(e,Fv({query:t,method:"PATCH",body:r},o))},n.request=n.requestType(),n}return Dv(t,e),t}(Vv);Zh(Zh(Zh(Zh(Zh(Zh(Zh(Zh(Zh(Zh(Zh({},cd),rd),ld),pd),hd),ed),dd),vd),wd),Td),{eventMessageCenter:Sd,taskQueueLib:Ad,JSRequest:Gv});var Uv=function(){return Uv=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Uv.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var zv={type:"interval",autoStop:!0},Qv=function(){function e(e){var t=this;this.__id=0,this.timers={},this.fixString="#@$&*",this.isFrame=function(){return"frame"===t.opts.type},this.opts=Uv(Uv({},zv),e)}return e.prototype.add=function(e,t){return this.initDelay(t),this.pushTimer(e,t)},e.prototype.delete=function(e){var t,n=e.id,r=e.delay,o=this.timers;r&&(null===(t=o[r])||void 0===t?void 0:t.handles)&&(o[r].handles=o[r].handles.filter((function(e){return e.id!==n})))},e.prototype.clear=function(){var e=this,t=this.timers;Object.keys(t).forEach((function(n){return e.stopTimer(t[n])})),this.timers={}},e.prototype.pushTimer=function(e,t){var n=this.timers,r={id:this.getId(),handle:e,delay:t};return n[t].handles.push(r),r},e.prototype.initDelay=function(e){var t=this.timers;t[e]||(t[e]={intervalId:null,handles:[],delay:e},this.startTimer(t[e]))},e.prototype.startTimer=function(e){var t=this;e.intervalId=this.delayHandle((function(){t.autoStopTimer(e),e.handles.forEach((function(e){return e.handle()}))}),e.delay)},e.prototype.stopTimer=function(e){var t=e.intervalId;this.isFrame()?t():clearInterval(t)},e.prototype.autoStopTimer=function(e){var t=this.opts.autoStop,n=this.timers,r=e.delay;t&&e.handles.length<=0&&(this.stopTimer(e),n[r]=null)},e.prototype.delayHandle=function(e,t){return this.isFrame()?function(e,t){if(void 0===t&&(t=0),!e)throw Error("callback is empty");var n="undefined"!=typeof process?setImmediate:requestAnimationFrame,r=performance,o=r.now(),i=!1,u=function(){i||(r.now()-o>=t&&(o=r.now(),e(o)),n(u))};return u(),function(){return i=!0}}(e,t):setInterval(e,t)},e.prototype.getId=function(){return"".concat(this.fixString,"-").concat(++this.__id)},e}();ec(ec(ec(ec(ec(ec(ec(ec(ec(ec(ec({},hc),uc),vc),gc),bc),nc),mc),wc),Sc),Ac),{eventMessageCenter:Hc,taskQueueLib:Mp,JSRequest:Yh,TimerManager:Qv});var Kv=function(e,t){return Kv=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Kv(e,t)};var $v=function(){return $v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},$v.apply(this,arguments)};function Yv(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Zv={colorMode:{trueColor:"2",compatibility:"5"},colorType:{foreground:"38",background:"48"},color:{black:30,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,bgBlack:40,bgRed:41,bgGreen:42,bgYellow:43,bgBlue:44,bgMagenta:45,bgCyan:46,bgWhite:47,brightBlack:90,brightRed:91,brightGreen:92,brightYellow:93,brightBlue:94,brightMagenta:95,brightCyan:96,brightWhite:97,bgBrightBlack:100,bgBrightRed:101,bgBrightGreen:102,bgBrightYellow:103,bgBrightBlue:104,bgBrightMagenta:105,bgBrightCyan:106,bgBrightWhite:107},textStyle:{reset:0,bold:1,dim:2,italic:3,underline:4,inverse:7,hidden:8,strikethrough:9,noBold:21,noItalic:23,noUnderline:24,noBlink:25,noInverse:27,noHidden:28,noStrikethrough:29},cursor:{savePosition:"s",restorePosition:"u",reportPosition:"6n",toStart:"H",toLineStart:"E",toLineEnd:"F",eraseDisplay:"2J",eraseLine:"K",direct:{custom:"H",up:"A",down:"B",right:"C",left:"D"}},scroll:{up:"S",down:"T"}},Xv=function(){var e=this;this.moveTo=function(e){var t,n=null!=e?e:{},r=n.direct,o=n.position;if(!r||!o)return"";var i="";if("custom"===r&&"object"==typeof o){var u=o.col,a=o.row;i="".concat(a,";").concat(u)}else"object"!=typeof o&&(i="".concat(o));return i?"".concat(i).concat(null!==(t=Zv.cursor.direct[r])&&void 0!==t?t:""):""},this.scrollTo=function(e){if(!e)return"";var t=Zv.scroll.down;return e<0&&(t=Zv.scroll.up),"".concat(Math.abs(e)).concat(t)},this.getCursor=function(e){var t;return e?";".concat(null!==(t=Zv.cursor[e])&&void 0!==t?t:""):""},this.getColorMode=function(e){var t;return e?";".concat(null!==(t=Zv.colorMode[e])&&void 0!==t?t:"2"):";2"},this.getColorType=function(e){var t;return e?";".concat(null!==(t=Zv.colorType[e])&&void 0!==t?t:"38"):";38"},this.getRGB=function(t){var n=t.type,r=t.colorMode,o=t.red,i=void 0===o?0:o,u=t.green,a=void 0===u?0:u,c=t.blue,s=void 0===c?0:c;return"".concat(e.getColorType(n)).concat(e.getColorMode(r),";").concat(i,";").concat(a,";").concat(s)},this.getColor=function(e){var t;return e?";".concat(null!==(t=Zv.color[e])&&void 0!==t?t:""):""},this.getTextStyle=function(e){var t;return e?";".concat(null!==(t=Zv.textStyle[e])&&void 0!==t?t:""):""},this.getANSI=function(e,t){return void 0===t&&(t=!0),e?"[".concat(e).concat(t?"m":""):""},this.reset=function(){return e.getANSI("0")}},ey={reset:!0,type:"log",split:!0},ty=function(e){function t(t){var n=e.call(this)||this;return n.stylePlaceholder="%c",n.isNode="undefined"!=typeof process,n.globalOpts=ey,n.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length<=0)return n;var r=n.createQueue(e),o=r.logQueue,i=r.styleQueue;return n.logFn(o,i),n},n.createQueue=function(e){var t=[],r=[],o=n,i=o.isNode,u=o.stylePlaceholder,a=o.globalOpts;return e.forEach((function(e){n.checkOptions(e);var o=e.text,i=void 0===o?"":o,c=fc($v($v({},a),e)),s=c.reset,l=c.style,f=void 0===l?{}:l,p=!pc(f);if(r.push("".concat(n.formate(c)).concat(p?u:"").concat(i).concat(s?n.reset():"")),p){var h=n.formatStyle(f);h&&t.push(h)}})),i&&a.split?{logQueue:r,styleQueue:t}:{logQueue:r.join(""),styleQueue:t}},n.checkOptions(t),n.mixins(t),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Kv(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.mixins=function(e){return this.globalOpts=fc($v($v({},this.globalOpts),e)),this.globalOpts},t.prototype.clear=function(){this.globalOpts=fc(ey)},t.prototype.formate=function(e){var t=e.color,n=e.textStyle,r=e.cursor,o=e.move,i=e.scroll;return this.getANSI("".concat(this.formatCursor(r)).concat(this.moveTo(o)).concat(this.scrollTo(i)),!1)+this.getANSI("".concat(this.formatColor(t)).concat(this.formatText(n)))},t.prototype.formatCursor=function(e){return"string"==typeof e?this.getCursor(e):""},t.prototype.formatText=function(e){var t=this;if("string"==typeof e)return this.getTextStyle(e);if("object"==typeof e){var n="";return e.forEach((function(e){return n+=t.getTextStyle(e)})),n}return""},t.prototype.formatColor=function(e){var t=this;if("string"==typeof e)return this.getColor(e);if("object"==typeof e){if("array"===rc(e)){var n="";return e.forEach((function(e){return n+=t.formatColor(e)})),n}return this.getRGB(e)}return""},t.prototype.formatStyle=function(e){var t="";return Reflect.ownKeys(e).forEach((function(n){"string"==typeof n&&(t+="".concat(ic(n),":").concat(e[n],";"))})),t},t.prototype.logFn=function(e,t){var n=this.globalOpts.type;return"string"==typeof e?console[n].apply(console,Yv([e],t,!1)):console[n].apply(console,Yv(Yv([],e,!1),t,!1))},t.prototype.checkOptions=function(e){void 0===e&&(e={});var t=this.isNode,n=e.cursor,r=e.move,o=e.scroll,i=e.style,u=e.color,a=e.textStyle;if(t&&i)throw Error("node环境下无法使用style相关属性");if(!t&&(n||r||o))throw Error("window环境下无法使用光标相关属性");!t&&i&&(u||a)&&console.warn("请注意:样式可能会冲突")},t}(Xv),ny=o(o(o(o(o(o(o(o(o(o(o({},A),h),C),N),J),u),K),X),oe),pe),{eventMessageCenter:he,taskQueueLib:qo,JSRequest:Qi,TimerManager:Xa,JSLogLib:ty});export{ie as AnimateFrame,ty as JSLog,he as MessageCenter,le as NBezier,Qi as Request,qo as TaskQueue,Xa as TimerManager,V as addHandler,M as arrayDemote,H as arrayRandom,L as arrayUniq,_ as catchAwait,T as classDecorator,Z as clearStorage,m as cloneDeep,se as combination,W as createElement,j as createObject,w as createObjectVariable,ae as cubicBezier,I as debounce,ve as decoratorMessageCenter,ny as default,Za as defaultOptions,R as defer,Q as dispatchEvent,q as emptyObject,g as enumInversion,ce as factorial,O as getInstance,Y as getStorage,l as getType,f as getTypeByList,d as getValue,E as inherit,k as isEmptyObject,b as isNotObject,x as isWindow,P as jsonToString,re as logLoop,ee as logOneLine,de as messageCenter,y as mixIn,ue as quadraticBezier,a as randomNum,z as removeHandler,F as requestFrame,$ as setStorage,v as setValue,G as stopBubble,U as stopDefault,S as stringToJson,B as throttle,p as toKebabCase,r as types,s as urlJoin,c as urlSplit};