String.prototype.repeat||(String.prototype.repeat=function(e){for(var t="";e-- >0;)t+=this;return t}),String.random||(String.random=function(e){for(var t="",r="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";e-- >0;)t+=r[Math.floor(Math.random()*r.length)];return t}),String.prototype.leftPad||(String.prototype.leftPad=function(e,t){for(var r=this,n=this;(n=e+n).length<=t;)r=n;return r.length=1048576;)n++,r/=1024;return r>=1024&&(n++,r/=1024),{num:r>0?r.toFixed(t):"0",unit:["B","KB","MB","GB","TB","PB"][n]}});var EnumErrorCode={NOT_SUPPORT_IE_8:-10,NOT_SUPPORT_CANVAS:-11,DOWNLOAD_IE_PLUGIN:-12};function log(e,t){e||(e=""),t||(t="");e=t+" ----- "+e;console.dbg(e)}function adjustRange(e,t,r){var n=getFuncName(arguments);try{return t>r?(log(n,"range start is bigger than end"),-1):er?r:e}catch(e){return log(n,e.message),-1}}function isInRange(e,t,r){var n=getFuncName(arguments);try{return t>r?(log(n,"range start is bigger than end"),!1):!(t>e||r=1&&o<=127?t+=e.charAt(r):o>2047?(t+=String.fromCharCode(224|o>>12&15),t+=String.fromCharCode(128|o>>6&63),t+=String.fromCharCode(128|o>>0&63)):(t+=String.fromCharCode(192|o>>6&31),t+=String.fromCharCode(128|o>>0&63));return t}function utf8to16(e){var t,r,n,o,a,i;for(t="",n=e.length,r=0;r>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:t+=e.charAt(r-1);break;case 12:case 13:a=e.charCodeAt(r++),t+=String.fromCharCode((31&o)<<6|63&a);break;case 14:a=e.charCodeAt(r++),i=e.charCodeAt(r++),t+=String.fromCharCode((15&o)<<12|(63&a)<<6|(63&i)<<0)}return t}function base64encode(e){var t,r,n,o,a,i;for(n=e.length,r=0,t="";r>2),t+=base64EncodeChars.charAt((3&o)<<4),t+="==";break}if(a=e.charCodeAt(r++),r==n){t+=base64EncodeChars.charAt(o>>2),t+=base64EncodeChars.charAt((3&o)<<4|(240&a)>>4),t+=base64EncodeChars.charAt((15&a)<<2),t+="=";break}i=e.charCodeAt(r++),t+=base64EncodeChars.charAt(o>>2),t+=base64EncodeChars.charAt((3&o)<<4|(240&a)>>4),t+=base64EncodeChars.charAt((15&a)<<2|(192&i)>>6),t+=base64EncodeChars.charAt(63&i)}return t}function base64decode(e){var t,r,n,o,a,i,s;for(i=e.length,a=0,s="";a>4);do{if(61==(n=255&e.charCodeAt(a++)))return s;n=base64DecodeChars[n]}while(a>2);do{if(61==(o=255&e.charCodeAt(a++)))return s;o=base64DecodeChars[o]}while(a=0)return!0;return!1}function compareArrayElems(e,t){if(!e instanceof Array||!t instanceof Array)return!1;if(e.length!==t.length)return!1;for(var r=0;rnew Promise((t,r)=>{try{Promise.resolve(e.apply(s)).then(t,t)}catch(e){t()}});r&&!n?c().then(()=>{n=setTimeout(()=>{c().then(()=>{a()})},1e3*t)}):n=setTimeout(()=>{c().then(()=>{a()})},1e3*t)};return a}Array.prototype.in_array=function(e){for(var t=0;t=0&&(console.isDebug=!0);