jsdk-offical
Version:
JSDK is the most comprehensive TypeScript framework, like JDK.
2 lines • 74.1 kB
JavaScript
//JSDK 2.7.0 MIT
var JS;(function(JS){let lang;(function(lang){let Type;(function(Type){Type["null"]="null";Type["undefined"]="undefined";Type["string"]="string";Type["boolean"]="boolean";Type["number"]="number";Type["date"]="date";Type["array"]="array";Type["json"]="json";Type["object"]="object";Type["function"]="function";Type["class"]="class";Type["symbol"]="symbol"})(Type=lang.Type||(lang.Type={}))})(lang=JS.lang||(JS.lang={}))})(JS||(JS={}));var Type=JS.lang.Type;var JS;(function(JS){let util;(function(util){let _of=function(a,s){return typeof a===s},_is=function(a,s){return toString.call(a)===`[object ${s}]`},_isKlass=function(obj){if(typeof obj!="function")return false;let proto=obj.prototype;if(proto===undefined||proto.constructor!==obj)return false;if(Object.getOwnPropertyNames(proto).length>=2)return true;var str=obj.toString();if(str.slice(0,5)=="class")return true;if(/^function\s+\(|^function\s+anonymous\(/.test(str))return false;if(/\b\(this\b|\bthis[\.\[]\b/.test(str)){if(/classCallCheck\(this/.test(str))return true;return/^function\sdefault_\d+\s*\(/.test(str)}return false},_superklass=klass=>{if(Object===klass)return null;let sup=Object.getPrototypeOf(klass);return Object.getPrototypeOf(Object)===sup?Object:sup};class Types{static isSymbol(o){return _of(o,"symbol")}static isArguments(o){return _is(o,"Arguments")}static isNaN(n){return n!=null&&isNaN(n)}static isNumber(n){return _of(n,"number")}static isNumeric(n){return(this.isNumber(n)||this.isString(n))&&!isNaN(n-parseFloat(n))}static isFloat(n){return Number(n).isFloat()}static isInt(n){return Number(n).isInt()}static isBoolean(obj){return _of(obj,"boolean")}static isString(obj){return _of(obj,"string")}static isDate(obj){return _is(obj,"Date")}static isDefined(obj){return obj!=void 0}static isNull(obj){return obj===null}static isUndefined(obj){return obj===void 0}static isObject(obj){return _is(obj,"Object")}static isJsonObject(obj){let OP=Object.prototype;if(!obj||OP.toString.call(obj)!=="[object Object]")return false;let proto=Object.getPrototypeOf(obj);if(!proto)return true;let ctor=OP.hasOwnProperty.call(proto,"constructor")&&proto.constructor,fnToString=Function.prototype.toString;return typeof ctor==="function"&&fnToString.call(ctor)===fnToString.call(Object)}static isArray(obj){return Array.isArray(obj)||obj instanceof Array}static isArrayLike(obj){if(this.isString(obj))return false;let l=obj&&obj["length"]||null;return typeof l=="number"&&l>=0&&l<=Number.MAX_SAFE_INTEGER}static isError(obj){return _of(obj,"Error")}static isFile(obj){return _is(obj,"File")}static isFormData(obj){return _is(obj,"FormData")}static isBlob(obj){return _is(obj,"Blob")}static isFunction(fn,pure){return _of(fn,"function")&&(!pure?true:!this.equalKlass(fn))}static isRegExp(obj){return _is(obj,"RegExp")}static isArrayBuffer(obj){return _is(obj,"ArrayBuffer")}static isTypedArray(value){return value&&this.isNumber(value.length)&&/^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array]$/.test(toString.call(value))}static isElement(el){return el&&typeof el==="object"&&(el.nodeType===1||el.nodeType===9)}static isWindow(el){return el!=null&&el===el.window}static isKlass(obj,klass){if(!this.ofKlass(obj,klass))return false;return obj.constructor&&obj.constructor===klass}static ofKlass(obj,klass){return obj instanceof klass}static equalKlass(kls,klass){if(!_isKlass(kls))return false;return klass?kls===klass:true}static subklassOf(kls1,kls2){if(kls2===Object||kls1===kls2)return true;let superXls=_superklass(kls1);while(superXls!=null){if(superXls===kls2)return true;superXls=_superklass(superXls)}return false}static type(obj){if(obj===null)return Type.null;let type=typeof obj;if(type=="number"||type=="bigint")return Type.number;if(type=="object"){if(this.isJsonObject(obj))return Type.json;if(this.isArray(obj))return Type.array;if(this.isDate(obj))return Type.date;return Type.object}return _isKlass(obj)?Type.class:type}}util.Types=Types})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Types=JS.util.Types;var JS;(function(JS){let util;(function(util){let N=Number,_test=function(s,exp){return s&&exp.test(s.trim())},EMAIL=/^[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@([A-Za-z0-9]+(?:-[A-Za-z0-9]+)?\.)+[A-Za-z0-9]+(?:-[A-Za-z0-9]+)?$/,EMAIL_DOMAIN=/^@([A-Za-z0-9]+(?:-[A-Za-z0-9]+)?\.)+[A-Za-z0-9]+(?:-[A-Za-z0-9]+)?$/,YYYY_MM_DD=/^(\d{1,4})(-|\/)(\d{1,2})(-|\/)(\d{1,2})$/,HALFWIDTH_CHARS=/^[\u0000-\u00FF]+$/,FULLWIDTH_CHARS=/^[\u0391-\uFFE5]+$/,NUMBERS_ONLY=/^\d+$/,LETTERS_ONLY=/^[A-Za-z]+$/,LETTERS_OR_NUMBERS=/^[A-Za-z\d]+$/,ENGLISH_ONLY=/^[A-Za-z\d\s\`\~\!\@\#\$\%\^\&\*\(\)\_\-\+\=\[\]\{\}\|\:\;\"\'\<\>\,\.\?\\\/]+$/,CHINESE_ONLY=/^[\u4E00-\u9FA5]+$/,IP=/^(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5]).(0|[1-9]\d?|[0-1]\d{2}|2[0-4]\d|25[0-5])$/;class Check{static isEmpty(v){return v==void 0||v===""||v.hasOwnProperty("length")&&v.length==0||Check.isEmptyObject(v)}static isEmptyObject(v){var name;for(name in v){return false}return true}static isBlank(s){return s==void 0||s.trim()===""}static isFormatDate(s,format){return _test(s,format||YYYY_MM_DD)}static isEmail(s,exp){return _test(s,exp?exp:EMAIL)}static isEmails(s,exp){s=s||"";if(this.isBlank(s))return false;return s.split(/;|\s+/).every(as=>{return as.length==0||this.isEmail(as,exp)})}static isEmailDomain(str){return _test(str,EMAIL_DOMAIN)}static isOnlyNumber(str){return _test(str,NUMBERS_ONLY)}static isPositive(n){return N(n).isPositive()}static isNegative(n){return N(n).isNegative()}static isHalfwidthChars(str){return _test(str,HALFWIDTH_CHARS)}static isFullwidthChars(str){return _test(str,FULLWIDTH_CHARS)}static isEnglishOnly(str){return _test(str,ENGLISH_ONLY)}static isChineseOnly(str){return _test(str,CHINESE_ONLY)}static isFormatNumber(n,iLength,fLength){if(!util.Types.isNumeric(n))return false;let num=N(n),iLen=num.integerLength(),dLen=num.fractionLength();if(iLen>iLength)return false;if(util.Types.isDefined(fLength)&&dLen>fLength)return false;return true}static greater(n1,n2){return N(n1)>N(n2)}static greaterEqual(n1,n2){return N(n1)>=N(n2)}static less(n1,n2){return N(n1)<N(n2)}static lessEqual(n1,n2){return N(n1)<=N(n2)}static isBetween(n,min,max){let num=N(n);return num>N(min)&&num<N(max)}static shorter(s,len){return s&&s.length<len}static longer(s,len){return s&&s.length>len}static equalLength(s,len){return s&&s.length==len}static isLettersOnly(s){return _test(s,LETTERS_ONLY)}static isLettersOrNumbers(s){return _test(s,LETTERS_OR_NUMBERS)}static isIP(s){return _test(s.trim(),IP)}static isExistUrl(url){let xhr=new XMLHttpRequest;return new Promise(function(resolve,reject){xhr.onreadystatechange=(()=>{if(xhr.readyState==4)xhr.status==200?resolve(true):reject(false)});xhr.open("HEAD",url,true);xhr.send()})}static isPattern(s,exp){return _test(s,exp)}static byServer(req,judge){return new Promise(function(resolve,reject){Http.send(req).then(res=>{judge.apply(null,[res])?resolve(true):reject(false)})})}}util.Check=Check})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Check=JS.util.Check;(function(){var AP=Array.prototype;AP.add=function(obj,from){let m=this;if(obj==void 0)return m;let a=obj instanceof Array?obj:[obj],i=from==void 0?m.length:from<0?0:from;AP.splice.apply(m,[i,0].concat(a));return m};AP.remove=function(f){let i=typeof f==="number"?f:this.findIndex(f);if(i<0||i>=this.length)return false;this.splice(i,1);return true}})();var JS;(function(JS){let util;(function(util){let E=util.Check.isEmpty,AS=Array.prototype.slice;class Arrays{static newArray(a,from){return a==void 0?[]:AS.apply(a,[from==void 0?0:from])}static toArray(a){return a==void 0?[]:util.Types.isArray(a)?a:[a]}static equal(a1,a2,eq){if(a1===a2)return true;let y1=E(a1),y2=E(a2);if(y1&&y2)return true;if(y1!==y2)return false;if(a1.length!=a2.length)return false;return a1.every((item1,i)=>{return eq?eq(item1,a2[i],i):item1===a2[i]})}static equalToString(a1,a2){if(a1===a2)return true;if(a1==void 0&&a2==void 0)return true;if(!a1||!a2)return false;if(a1.length!=a2.length)return false;return a1.toString()==a2.toString()}static same(a1,a2,eq){if(a1===a2||E(a1)&&E(a2))return true;if(a1.length!=a2.length)return false;let na=a2.slice(),fail=a1.some(t1=>{let r=na.remove(t2=>{return eq?eq(t1,t2):t1===t2});return!r});if(fail)return false;return na.length==0}static slice(args,fromIndex,endIndex){return AS.apply(args,[fromIndex||0,endIndex||args.length])}}util.Arrays=Arrays})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Arrays=JS.util.Arrays;var JS;(function(JS){let util;(function(util){let R=false,W=self;class Bom{static ready(fn){if(R){fn();return}let D=document,callback=function(){R=true;fn();callback=null};let wc=W["HTMLImports"]&&W["HTMLImports"].whenReady;if(wc)return wc(callback);if(D.readyState==="complete"){setTimeout(callback,1)}else if(D.addEventListener){D.addEventListener("DOMContentLoaded",callback,false);W.addEventListener("load",callback,false)}else{D["attachEvent"]("onreadystatechange",callback);W["attachEvent"]("onload",callback);var top=false;try{top=W.frameElement==null&&D.documentElement?true:false}catch(e){}if(top&&top["doScroll"]){(function doScrollCheck(){if(!R){try{top["doScroll"]("left")}catch(e){return setTimeout(doScrollCheck,50)}callback()}})()}}}static iframeWindow(el){let e=util.Dom.$1(el);if(!e)return null;return e["contentWindow"]}static iframeDocument(el){let e=util.Dom.$1(el);if(!e)return null;return e["contentDocument"]||e["contentWindow"].document}static fullscreen(){let de=document.documentElement;let fnName=de["mozRequestFullScreen"]?"mozRequestFullScreen":de["webkitRequestFullScreen"]?"webkitRequestFullScreen":"requestFullscreen";if(de[fnName])de[fnName]()}static normalscreen(){let D=document,fnName=D["mozCancelFullScreen"]?"mozCancelFullScreen":D["webkitCancelFullScreen"]?"webkitCancelFullScreen":"exitFullscreen";if(D[fnName])D[fnName]()}}util.Bom=Bom})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Bom=JS.util.Bom;var JS;(function(JS){let util;(function(util){let _num=s=>{let n=parseFloat(s);return n.isNaN()?0:n};class CssTool{static isHEX(a){return/^#[0-9A-F]{3,8}$/i.test(a)}static isRGB(a){return/^rgb/.test(a)}static isHSL(a){return/^hsl/.test(a)}static isColor(a){return this.isHEX(a)||this.isRGB(a)||this.isHSL(a)}static rgb2hex(r,g,b,a){let s=[r,g,b];if(a!=void 0)s.push(Number((a*255).integralPart()));return"#"+s.map(x=>{let h=x.toString(16);return h.length===1?"0"+h:h}).join("")}static hex2rgb(hex){if(!this.isHEX(hex))return null;let a=false,h=hex.slice(hex.startsWith("#")?1:0),l=h.length;if(l==4||l==8)a=true;if(l==3||l==4)h=[...h].map(x=>x+x).join("");let n=parseInt(h,16);return{r:n>>>(a?24:16),g:(n&(a?16711680:65280))>>>(a?16:8),b:(n&(a?65280:255))>>>(a?8:0),a:a?Number((n&255)/255).round(2):1}}static rgbString(c){if(!c)return"";let has=c.a!=void 0;return`rgb${has?"a":""}(${c.r},${c.g},${c.b}${has?`,${c.a}`:""})`}static toTRGB(s){if(s.startsWith("rgba(")){let r=/^rgba\((.+),(.+),(.+),(.+)\)$/.exec(s);if(r)return{r:Number(r[1]),g:Number(r[2]),b:Number(r[3]),a:Number(r[4])}}else if(s.startsWith("rgb(")){let r=/^rgb\((.+),(.+),(.+)\)$/.exec(s);if(r)return{r:Number(r[1]),g:Number(r[2]),b:Number(r[3])}}return null}static convertToRGB(val){if(this.isHEX(val))return this.hex2rgb(val);if(this.isHSL(val))return this.hsl2rgb(val);return this.toTRGB(val)}static hslString(c){if(!c)return"";let has=c.a!=void 0;return`hsl(${c.h},${(c.s*100).round(2)}%,${(c.l*100).round(2)}%${has?`,${c.a}`:""})`}static hsl2rgb(hsl){if(!this.isHSL(hsl))return null;let hsla=this.toTHSL(hsl),h=hsla.h,s=hsla.s,l=hsla.l,r,g,b;if(s==0){r=g=b=l}else{var hue2rgb=(p,q,t)=>{if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p};var q=l<.5?l*(1+s):l+s-l*s,p=2*l-q;r=hue2rgb(p,q,h+1/3);g=hue2rgb(p,q,h);b=hue2rgb(p,q,h-1/3)}return{r:Math.round(r*255),g:Math.round(g*255),b:Math.round(b*255),a:hsla.a}}static rgb2hsl(rgb){if(!rgb)return null;let r=rgb.r,g=rgb.g,b=rgb.b;r/=255,g/=255,b/=255;var max=Math.max(r,g,b),min=Math.min(r,g,b),h,s,l=(max+min)/2;if(max==min){h=s=0}else{var d=max-min;s=l>.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break}h/=6}return{h,s,l,a:rgb.a}}static hyphenCase(name){return name.replace(/([A-Z])/g,(a,b)=>{return"-"+b.toLowerCase()})}static numberOf(val){return util.Types.isNumber(val)?val:_num(val)}static unitOf(val){if(val==void 0||util.Types.isNumber(val))return"";let split=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(val);return split?split[1]:""}static calcValue(v,baseVal){if(!v)return baseVal+"";if(v.indexOf(",")>0||v.indexOf(" ")>0)return v;let u=this.unitOf(v)||this.unitOf(baseVal)||"px";if(v.startsWith("+=")||v.startsWith("-=")){let ov=this.numberOf(baseVal),nv=_num(v.replace("=",""));return ov+nv+u}else if(v.startsWith("*=")){let ov=this.numberOf(baseVal),nv=_num(v.replace("*=",""));return ov*nv+u}return parseFloat(v).isNaN()?v:_num(v)+u}static normValue(v,df,du){if(v==void 0)return df;return util.Types.isNumber(v)?v+(du===undefined?"px":du||""):v}}CssTool.toTHSL=(h=>{var hsl=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(h)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(h);return{h:parseInt(hsl[1],10)/360,s:parseInt(hsl[2],10)/100,l:parseInt(hsl[3],10)/100,a:parseFloat(hsl[4])||1}});util.CssTool=CssTool})(util=JS.util||(JS.util={}))})(JS||(JS={}));var CssTool=JS.util.CssTool;var JS;(function(JS){let util;(function(util){class Dates{static isValidDate(d){if(d==null)return false;return!isNaN(new Date(d).getTime())}static isLeapYear(y){return y%4===0&&y%100!==0||y%400===0}static getDaysOfMonth(m,y){y=y||(new Date).getFullYear();return[31,this.isLeapYear(y)?29:28,31,30,31,30,31,31,30,31,30,31][m]}static getFirstDayOfMonth(d){return d.clone().set({day:1})}static getLastDayOfMonth(d){return d.clone().set({day:Dates.getDaysOfMonth(d.getMonth(),d.getFullYear())})}static getDayOfWeek(d,dayOfWeek){let d2=dayOfWeek!=void 0?dayOfWeek:1,d1=d.getDay();if(d2==0)d2=7;if(d1==0)d1=7;return d.clone().add((d2-d1)%7,"d")}}Dates.I18N_RESOURCE={AM:"AM",PM:"PM",WEEK_DAY_NAMES:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],WEEK_DAY_SHORT_NAMES:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MONTH_NAMES:["January","February","March","April","May","June","July","August","September","October","November","December"],MONTH_SHORT_NAMES:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]};util.Dates=Dates})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Dates=JS.util.Dates;(function(){var D=Date,$P=D.prototype,pad=function(s,l){new D;if(!l){l=2}return("000"+s).slice(l*-1)};$P.getWeek=function(){let date0=new D(this.getFullYear(),0,1),diff=Math.round((this.valueOf()-date0.valueOf())/864e5);return Math.ceil((diff+(date0.getDay()+1-1))/7)};$P.setWeek=function(week,dayOfWeek){let dw=Types.isDefined(dayOfWeek)?dayOfWeek:1;return this.setTime(Dates.getDayOfWeek(this,dw).add(week-this.getWeek(),"w").getTime())};$P.clone=function(){return new D(this.getTime())};$P.setZeroTime=function(){let T=this;T.setHours(0);T.setMinutes(0);T.setSeconds(0);T.setMilliseconds(0);return T};$P.setLastTime=function(){let T=this;T.setHours(23);T.setMinutes(59);T.setSeconds(59);T.setMilliseconds(999);return T};$P.setNowTime=function(){let T=this,n=new D;T.setHours(n.getHours());T.setMinutes(n.getMinutes());T.setSeconds(n.getSeconds());T.setMilliseconds(n.getMilliseconds());return T};$P.equals=function(d,p="ms"){let T=this;if(p=="ms")return T.diff(d)==0;if(p=="s")return T.getSeconds()==d.getSeconds();if(p=="m")return T.getMinutes()==d.getMinutes();if(p=="h")return T.getHours()==d.getHours();if(p=="y")return T.getFullYear()==d.getFullYear();if(p=="M")return T.getMonth()==d.getMonth();if(p=="d")return T.getFullYear()==d.getFullYear()&&T.getMonth()==d.getMonth()&&T.getDate()==d.getDate();if(p=="w")return T.getWeek()==d.getWeek();return false};$P.between=function(start,end){return this.diff(start)>=0&&this.diff(end)<=0};$P.isAfter=function(d){return this.diff(d)>0};$P.isBefore=function(d){return this.diff(d)<0};$P.isToday=function(){return this.equals(new D,"d")};$P.add=function(v,type){let T=this;if(v==0)return T;switch(type){case"ms":{T.setMilliseconds(T.getMilliseconds()+v);return T}case"s":{return T.add(v*1e3,"ms")}case"m":{return T.add(v*6e4,"ms")}case"h":{return T.add(v*36e5,"ms")}case"d":{T.setDate(T.getDate()+v);return T}case"w":{return T.add(v*7,"d")}case"M":{var n=T.getDate();T.setDate(1);T.setMonth(T.getMonth()+v);T.setDate(Math.min(n,Dates.getDaysOfMonth(T.getMonth(),T.getFullYear())));return T}case"y":{return T.add(v*12,"M")}}return T};$P.setTimezoneOffset=function(offset){var here=this.getTimezoneOffset(),there=Number(offset)*-6/10;return this.add(there-here,"m")};$P.formatTimezoneOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-1e4).toString();return r.charAt(0)+r.substr(2)}else{r=(n+1e4).toString();return"+"+r.substr(1)}};let vt=function(n,min,max){if(!Types.isDefined(n)){return false}else if(n<min||n>max){throw new RangeError(n+" is not a valid value")}return true};$P.set=function(config){let T=this;if(vt(config.millisecond,0,999)){T.add(config.millisecond-T.getMilliseconds(),"ms")}if(vt(config.second,0,59)){T.add(config.second-T.getSeconds(),"s")}if(vt(config.minute,0,59)){T.add(config.minute-T.getMinutes(),"m")}if(vt(config.hour,0,23)){T.add(config.hour-T.getHours(),"h")}if(vt(config.day,1,Dates.getDaysOfMonth(T.getMonth(),T.getFullYear()))){T.add(config.day-T.getDate(),"d")}if(vt(config.week,0,53)){T.setWeek(config.week)}if(vt(config.month,0,11)){T.add(config.month-T.getMonth(),"M")}if(vt(config.year,0,9999)){T.add(config.year-T.getFullYear(),"y")}if(config.timezoneOffset){T.setTimezoneOffset(config.timezoneOffset)}return T};$P.diff=function(date){return this-(date||new D)};$P.format=function(format,locale){let T=this,fmt=format||"YYYY-MM-DD HH:mm:ss",i18n=new I18N(locale).set(Dates.I18N_RESOURCE);return fmt.replace(/YYYY|YY|MMMM|MMM|MM|M|DD|D|hh|h|HH|H|mm|m|ss|s|dddd|ddd|A/g,function(m){switch(m){case"YYYY":return pad(T.getFullYear(),4);case"YY":return pad(T.getFullYear());case"MMMM":return i18n.get("MONTH_NAMES")[T.getMonth()];case"MMM":return i18n.get("MONTH_SHORT_NAMES")[T.getMonth()];case"MM":return pad(T.getMonth()+1);case"M":return T.getMonth()+1;case"DD":return pad(T.getDate());case"D":return T.getDate();case"hh":{let h=T.getHours();return pad(h<13?h===0?12:h:h-12)}case"h":{let h=T.getHours();return h<13?h===0?12:h:h-12}case"HH":return pad(T.getHours());case"H":return T.getHours();case"mm":return pad(T.getMinutes());case"m":return T.getMinutes();case"ss":return pad(T.getSeconds());case"s":return T.getSeconds();case"dddd":return i18n.get("WEEK_DAY_NAMES")[T.getDay()];case"ddd":return i18n.get("WEEK_DAY_SHORT_NAMES")[T.getDay()];case"A":return i18n.get(T.getHours()<12?"AM":"PM");default:return m}})}})();if(self["HTMLElement"])(function(){const D=document,HP=HTMLElement.prototype,oa=HP.append,op=HP.prepend,or=HP.remove,_ad=function(html){if(!html)return;let div=D.createElement("div"),nodes=null,fg=D.createDocumentFragment();div.innerHTML=html;nodes=div.childNodes;for(let i=0,len=nodes.length;i<len;i++){fg.appendChild(nodes[i].cloneNode(true))}this.appendChild(fg);nodes=null;fg=null},_pd=function(html){if(!html)return;let div=D.createElement("div"),nodes=null,fg=D.createDocumentFragment();div.innerHTML=html;nodes=div.childNodes;for(let i=0,len=nodes.length;i<len;i++){fg.appendChild(nodes[i].cloneNode(true))}this.insertBefore(fg,this.firstChild);nodes=null;fg=null};HP.append=function(...nodes){nodes.forEach(n=>{typeof n=="string"?_ad.call(this,n):oa.call(this,n.cloneNode(true))})};HP.prepend=function(...nodes){nodes.forEach(n=>{typeof n=="string"?_pd.call(this,n):op.call(this,n)})};HP.box=function(){let box=this.computedStyle();return{x:parseFloat(box.left)+System.display().docScrollX,y:parseFloat(box.top)+System.display().docScrollY,w:parseFloat(box.width),h:parseFloat(box.height)}};HP.attr=function(key,val){if(arguments.length==1)return this.getAttribute(key);this.setAttribute(key,val);return this};let _on=function(type,fn,opts){if(!this["_bus"])this["_bus"]=new EventBus(this);let bus=this["_bus"],cb=e=>{bus.fire(e)},once=opts&&opts["once"]?true:false;bus.on(type,fn,once);if(this.addEventListener)this.addEventListener(type,cb,opts)};HP.on=function(type,fn,opts){let types=type.split(" ");types.forEach(t=>{_on.call(this,t,fn,opts)});return this};let _rm=function(type,fn,opts){if(!fn)return;if(this.removeEventListener)this.removeEventListener(type,fn,opts||false)},_rms=function(type,fns,opts){if(fns)fns.forEach(f=>{_rm.call(this,type,f,opts)})},_off=function(type,fn,opts){let bus=this["_bus"];if(bus){let oFn=fn?bus.original(type,fn["euid"]):undefined;bus.off(type,oFn);_rm.call(this,type,oFn,opts)}else{_rm.call(this,type,fn,opts)}};HP.off=function(type,fn,capture){if(!type){let bus=this["_bus"];if(bus){let types=bus.types();for(let i=0,len=types.length;i<len;i++){let ty=types[i];_rms.call(this,ty,bus.original(ty),capture)}bus.off()}}else{let types=type.split(" ");types.forEach(t=>{_off.call(this,t,fn,capture)})}return this};HP.find=HP.querySelector;HP.findAll=HP.querySelectorAll;HP.computedStyle=function(p){return document.defaultView.getComputedStyle(this,p||null)};let _getV=function(){if(this instanceof HTMLTextAreaElement){return this.value||""}else if(this instanceof HTMLInputElement){if(this.type=="checkbox"){let chks=document.getElementsByName(this.name);if(chks.length>0){let a=[];[].forEach.call(chks,function(chk){if(chk.checked)a.push(chk.value)});return a}return this.checked?[this.value]:[]}if(this.type=="radio"){let rds=document.getElementsByName(this.name);if(rds.length>0){for(let i=0,l=rds.length;i<l;i++){let rd=rds.item(i);if(rd.checked)return rd.value}return null}return this.checked?this.value:null}return this.value||""}else if(this instanceof HTMLSelectElement){let opts=this.findAll("option:checked");if(opts.length>0){let a=[];for(let i=0,l=opts.length;i<l;i++){let opt=opts.item(i);if(this.multiple){if(opt.selected)a.push(opt.value)}else{if(opt.selected)return opt.value}}return a}return[]}return undefined},_setV=function(v){if(this instanceof HTMLTextAreaElement){this.value=v||""}else if(this instanceof HTMLInputElement){if(this.type=="checkbox"){let chks=document.getElementsByName(this.name),vs=v;if(chks.length>0){[].forEach.call(chks,function(chk){chk.checked=vs.indexOf(chk.value)>-1})}else{if(vs.indexOf(this.value)>-1)this.checked=true}return this}if(this.type=="radio"){let rds=document.getElementsByName(this.name);if(rds.length>0){for(let i=0,l=rds.length;i<l;i++){let rd=rds.item(i);if(v==rd.value){rd.checked=true;return this}}}else{if(v==this.value)this.checked=true}return this}this.value=v}else if(this instanceof HTMLSelectElement){let opts=this.findAll("option"),vs=typeof v=="string"?[v]:v;if(opts.length>0){for(let i=0,l=opts.length;i<l;i++){let opt=opts.item(i);opt.selected=vs.indexOf(opt.value)>-1}}}return this};HP.val=function(v){return arguments.length==0?_getV.call(this):_setV.call(this,v)};let setCssValue=(el,k,v)=>{let st=el.style;if(v===undefined){st.removeProperty(CssTool.hyphenCase(k))}else if(v!=null){let w=v+"";st.setProperty(CssTool.hyphenCase(k),CssTool.calcValue(w,el.css(k)),w.endsWith(" !important")?"important":"")}};HP.css=function(name,val){if(arguments.length==1){if(typeof name=="string"){let key=CssTool.hyphenCase(name);return this.style.getPropertyValue(key)||this.computedStyle().getPropertyValue(key)}else{let s="";Jsons.forEach(name,(v,k)=>{if(v!=void 0)s+=`${CssTool.hyphenCase(k)}:${CssTool.calcValue(v,this.style.getPropertyValue(k))};`});this.style.cssText+=s}}else{setCssValue(this,name,val)}return this};HP.empty=function(s){let chs=this.findAll(s||"*");if(chs.length>0)[].forEach.call(chs,function(node){if(node.nodeType==1)node.off().remove()});return this};HP.remove=function(s){this.empty.call(this,s);if(!s)or.call(this.off())};let DP=Document.prototype;DP.on=HP.addEventListener;DP.off=HP.removeEventListener;let WP=Window.prototype;WP.on=HP.addEventListener;WP.off=HP.removeEventListener})();var JS;(function(JS){let util;(function(util){let D;if(self["HTMLElement"])D=document;class Dom{static $1(selector){return typeof selector=="string"?D.querySelector(selector):selector}static $L(selector){return D.querySelectorAll(selector)}static rename(node,newTagName){let newNode=D.createElement(newTagName),aNames=node["getAttributeNames"]();if(aNames)aNames.forEach(name=>{newNode.setAttribute(name,node.getAttribute(name))});newNode.append.apply(newNode,node.childNodes);node.parentNode.replaceChild(newNode,node)}static applyStyle(code,id){if(!code)return;this.$1("head").append(`<style${id?' id="'+id+'"':""}>${code}</style>`)}static applyHtml(html,appendTo,ignore){if(!html)return Promise.reject(null);return Promises.create(function(){let doc=typeof html=="string"?(new DOMParser).parseFromString(html,"text/html"):html,url=doc.URL,el=Dom.$1(appendTo||D.body);el.append.apply(el,doc.body.childNodes);let ignoreCss=ignore===true||ignore&&ignore.css?true:false;if(!ignoreCss){let cssFiles=doc.querySelectorAll("link[rel=stylesheet]");if(cssFiles){for(let i=0,len=cssFiles.length;i<len;i++){let css=cssFiles[i],href=css.getAttribute("href");if(href)Loader.css(href,false)}}}let ignoreScript=ignore===true||ignore&&ignore.script?true:false;if(!ignoreScript){let scs=doc.getElementsByTagName("script"),syncs=[],back=()=>{syncs=null;scs=null;if(typeof html=="string")doc=null;this.resolve(url)};if(scs&&scs.length>0){for(let i=0,len=scs.length;i<len;i++){let sc=scs[i];sc.src?sc.async?Loader.js(sc.src,true):syncs.push(Loader.js(sc.src,false)):eval(sc.text)}Promises.order(syncs).then(()=>{back()}).catch(u=>{JSLogger.error("Load inner script fail: "+u+"\n; parent html:"+url);back()})}else{back()}}else{if(typeof html=="string")doc=null;this.resolve(url)}})}static loadHTML(url,async,opts){if(!url)return Promise.reject(null);return Promises.create(function(){Http.get({responseType:"html",url,cache:false,async}).then(res=>{let fn=opts&&opts.prehandle;Dom.applyHtml(fn?fn(res.data):res.data,opts&&opts.appendTo,opts&&opts.ignore).then(()=>{this.resolve(url)})})})}}util.Dom=Dom})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Dom=JS.util.Dom;const $1=Dom.$1;const $L=Dom.$L;var JS;(function(JS){let util;(function(util){let EUID=1,E=util.Check.isEmpty;class EventBus{constructor(context){this._isD=false;this._map=new Map;this._ctx=util.Jsons.clone(context)}context(ctx){if(arguments.length==0)return this._ctx;this._ctx=ctx}destroy(){this.off();this._ctx=null;this._isD=true}isDestroyed(){return this._isD}_add(type,h){let fns=this._map.get(type)||[];fns[fns.length]=h;this._map.set(type,fns)}_remove(type,h){if(!h){this._map.set(type,[])}else{let fns=this._map.get(type);if(!E(fns)){fns.remove(fn=>{return fn["euid"]===h["euid"]});this._map.set(type,fns)}}}_removeByEuid(type,euid){let fns=this._map.get(type);if(!E(fns)){fns.remove(fn=>{return fn["euid"]===euid});this._map.set(type,fns)}}_euid(h,one,type){let me=this,euid=h["euid"]||EUID++,fn=function(){if(one)me._removeByEuid(type,euid);return h.apply(this,arguments)};fn["euid"]=h["euid"]=euid;return fn}on(types,handler,once){if(this.isDestroyed())return false;types.split(" ").forEach(tp=>{this._add(tp,this._euid(handler,once,tp))});return true}original(type,euid){let fns=this._map.get(type);if(arguments.length>=1){if(!E(fns)){let i=fns.findIndex(fn=>{return fn["euid"]===euid});if(i>-1)return fns[i]}return null}return fns||null}types(){return Array.from(this._map.keys())}off(types,handler){if(this.isDestroyed())return false;if(types){types.split(" ").forEach(tp=>{this._remove(tp,handler)})}else{this._map.clear()}return true}_call(e,fn,args,that){let evt=e["originalEvent"]?e["originalEvent"]:e,arr=[evt];if(args&&args.length>0)arr=arr.concat(args);let rst=fn.apply(that||this._ctx,arr);if(rst===false){evt.stopPropagation();evt.preventDefault()}}fire(e,args,that){let is=util.Types.isString(e),fns=this._map.get(is?e:e.type);if(!E(fns)){let evt=is?new CustomEvent(e):e;fns.forEach(fn=>{this._call(evt,fn,args,that)})}}}util.EventBus=EventBus})(util=JS.util||(JS.util={}))})(JS||(JS={}));var EventBus=JS.util.EventBus;var JS;(function(JS){let util;(function(util){class FileTypes{}FileTypes.CODES="c,h,cpp,ini,idl,hpp,hxx,hp,hh,cxx,cc,s,asm,log,bak,"+"as,ts,js,json,xml,html,htm,xhtml,xht,css,md,mkd,markdown,"+"java,properties,jsp,vm,ftl,"+"swift,m,mm,"+"cgi,sh,applescript,bat,sql,rb,py,php,php3,php4,"+"p,pp,pas,dpr,cls,frm,vb,bas,vbs,"+"cs,config,asp,aspx,"+"yaml,vhd,vhdl,cbl,cob,coffee,clj,lisp,lsp,cl,jl,el,erl,groovy,less,lua,go,ml,pl,pm,al,perl,r,scala,st,tcl,tk,itk,v,y,d,"+"xq,xql,xqm,xqy,xquery";FileTypes.IMAGES="pic,jpg,jpeg,png,gif,bmp,webp,tif,tiff,svg,wbmp,tga,pcx,ico,psd,ai";FileTypes.DOCS="md,markdown,msg,eml,txt,rtf,pdf,doc,docx,csv,xls,xlsx,ppt,pptx,wps";FileTypes.ZIPS="zip,7z,z,bz2,gz,tar,taz,tgz,rar,arj,lzh";FileTypes.VIDEOS="mp4,rm,rmvb,mpg,mpeg,mpg4,avi,dv,3gpp,asf,asx,wmv,qt,mov,ogv,flv,mkv,webm";FileTypes.AUDIOS="ogg,wav,mpga,mp2,mp3,au,snd,mid,midi,ra,ram,aif,aiff,webm";util.FileTypes=FileTypes;let FileSizeUnit;(function(FileSizeUnit){FileSizeUnit["B"]="B";FileSizeUnit["KB"]="KB";FileSizeUnit["MB"]="MB";FileSizeUnit["GB"]="GB";FileSizeUnit["TB"]="TB"})(FileSizeUnit=util.FileSizeUnit||(util.FileSizeUnit={}));class Files{static getFileName(path){let pos=path.lastIndexOf("/");if(pos<0)return path;return path.slice(pos+1)}static getFileType(path){let pos=path.lastIndexOf(".");if(pos<0)return"";return path.slice(pos+1)}static isFileType(path,exts){if(!path||!exts)return false;let ext=this.getFileType(path);return ext?(exts.toLowerCase()+",").indexOf(ext+",")>=0:false}static convertSize(size,orgUnit,tarUnit){if(!size)return 0;let s=Number(size);if(s<=0)return 0;let map={B:0,KB:1,MB:2,GB:3,TB:4},r1=map[orgUnit],r2=map[tarUnit];return s*Math.pow(1024,r1-r2)}static toSizeString(byte,sizeUnit){let unit=sizeUnit||FileSizeUnit.B,TC=this.convertSize;if(!byte)return"0"+unit;let kb=TC(byte,unit,FileSizeUnit.KB);if(kb==0)return"0"+unit;if(kb<1)return byte+"B";let mb=TC(byte,unit,FileSizeUnit.MB);if(mb<1)return kb+"KB";let gb=TC(byte,unit,FileSizeUnit.GB);if(gb<1)return mb+"MB";let tb=TC(byte,unit,FileSizeUnit.TB);return tb<1?gb+"GB":tb+"TB"}}Files.ONE_KB=1024;Files.ONE_MB=1048576;Files.ONE_GB=1073741824;Files.ONE_TB=1099511627776;util.Files=Files})(util=JS.util||(JS.util={}))})(JS||(JS={}));var FileSizeUnit=JS.util.FileSizeUnit;var Files=JS.util.Files;var FileTypes=JS.util.FileTypes;var JS;(function(JS){let util;(function(util){class Functions{static call(fb){let isFn=util.Types.isFunction(fb),fn=isFn?fb:fb.fn,ctx=isFn?undefined:fb.ctx,args=isFn?undefined:fb.args;return fn.apply(ctx,args)}static execute(code,ctx,argsExpression,args){let argsList=argsExpression||"";return Function.constructor.apply(null,argsList.split(",").concat([code])).apply(ctx,util.Arrays.newArray(args))}}util.Functions=Functions})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Functions=JS.util.Functions;var JS;(function(JS){let util;(function(util){class I18N{constructor(lc){this._d={};this.locale(lc)}_load(lc,prefix,suffix){let lang=util.Locales.lang(lc),country=util.Locales.country(lc);if(country){let rst=this._loadJson(`${prefix}_${lang}_${country}.${suffix}`);if(rst)return true}if(lang){let rst=this._loadJson(`${prefix}_${lang}.${suffix}`);if(rst)return true}return this._loadJson(`${prefix}.${suffix}`)}_loadJson(u){let xhr=new XMLHttpRequest;xhr.open("GET",u,false);xhr.responseType="json";xhr.send();if(xhr.status!=200)return false;this.set(xhr.response);return true}load(url,locale){let T=this,lc=locale||T._lc,pos=url.lastIndexOf("."),suffix=pos<0?"":url.slice(pos+1),prefix=pos<0?url:url.slice(0,pos);return T._load(lc,prefix,suffix)}get(k){if(arguments.length==0)return this._d;return k&&this._d?this._d[k]:undefined}getKeys(){return Reflect.ownKeys(this._d)}hasKey(k){return this._d.hasOwnProperty(k)}locale(lc){if(arguments.length==0)return this._lc;this._lc=lc||System.info().locale;return this}set(d){let T=this;d=d||{};if(d.hasOwnProperty(T._lc)){this._d=d[T._lc]}else{let lang=util.Locales.lang(T._lc);this._d=d.hasOwnProperty(lang)?d[lang]:d}return this}}util.I18N=I18N})(util=JS.util||(JS.util={}))})(JS||(JS={}));var I18N=JS.util.I18N;var JS;(function(JS){let util;(function(util){class Images{static parseFrames(frames){let frs=[],items=frames.items,isA=util.Types.isArray(items),len=isA?items.length:items.total;for(let i=0;i<len;i++){let x,y;if(isA){x=items[0];y=items[1]}else{let offs=items,axis=offs.axis,sign=axis.startsWith("-")?-1:1;x=axis.endsWith("x")?offs.ox+sign*i*(frames.w+(offs.split||0)):offs.ox;y=axis.endsWith("y")?offs.oy+sign*i*(frames.h+(offs.split||0)):offs.oy}frs.push({src:frames.src,w:frames.w,h:frames.h,x,y})}return frs}}util.Images=Images})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Images=JS.util.Images;var JS;(function(JS){let util;(function(util){let A=Array,Y=util.Types,E=util.Check.isEmpty;class Jsons{static parse(text,reviver){return text?JSON.parse(text,reviver):null}static stringify(value,replacer,space){return JSON.stringify(value,replacer,space)}static clone(obj){if(obj==void 0||"object"!=typeof obj)return obj;let copy;if(obj instanceof Date){copy=new Date;copy.setTime(obj.getTime());return copy}if(obj instanceof A){copy=[];for(var i=0,len=obj.length;i<len;++i){copy[i]=this.clone(obj[i])}return copy}if(Y.isJsonObject(obj)){copy={};var keys=Reflect.ownKeys(obj);keys.forEach(key=>{copy[key]=this.clone(obj[key])});return copy}return obj}static forEach(json,fn,that){if(!json)return;let keys=Object.keys(json);keys.forEach((key,i)=>{fn.apply(that||json,[json[key],key])})}static some(json,fn,that){if(!json)return;let keys=Object.keys(json);return keys.some((key,i)=>{return fn.apply(that||json,[json[key],key])})}static hasKey(json,key){return json&&key!=void 0&&json.hasOwnProperty(key)}static values(json){if(!json)return null;let arr=[];this.forEach(json,v=>{arr[arr.length]=v});return arr}static keys(json){if(!json)return null;let keys=[];this.forEach(json,(v,k)=>{keys[keys.length]=k});return keys}static equalKeys(json1,json2){let empty1=E(json1),empty2=E(json2);if(empty1&&empty2)return true;if(empty1||empty2)return false;let map2=this.clone(json2);this.forEach(json1,(v,k)=>{delete map2[k]});return E(map2)}static equal(json1,json2){let empty1=E(json1),empty2=E(json2);if(empty1&&empty2)return true;if(empty1||empty2)return false;let map2=this.clone(json2);this.forEach(json1,(v,k)=>{if(k in map2&&map2[k]===v)delete map2[k]});return E(map2)}static replaceKeys(json,keyMapping,needClone){if(!keyMapping)return json;let clone=needClone?this.clone(json):json;this.forEach(clone,function(val,oldKey){let newKey=Y.isFunction(keyMapping)?keyMapping.apply(clone,[val,oldKey]):keyMapping[oldKey];if(newKey!=oldKey&&clone.hasOwnProperty(oldKey)){let temp=clone[oldKey];delete clone[oldKey];clone[newKey]=temp}});return clone}static _union(...args){var options,name,src,copy,copyIsArray,clone,target=arguments[0]||{},i=1,length=arguments.length,deep=false;if(typeof target==="boolean"){deep=target;target=arguments[i]||{};i++}if(typeof target!=="object"&&!Y.isFunction(target)){target={}}for(;i<length;i++){if((options=arguments[i])!=null){for(name in options){src=target[name];copy=options[name];if(target===copy){continue}if(deep&©&&(Y.isJsonObject(copy)||(copyIsArray=A.isArray(copy)))){if(copyIsArray){copyIsArray=false;clone=src&&A.isArray(src)?src:[]}else{clone=src&&Y.isJsonObject(src)?src:{}}target[name]=this._union(deep,clone,copy)}else if(copy!==undefined){target[name]=copy}}}}return target}static union(...jsons){if(arguments.length<=1)return jsons[0];return this._union.apply(this,[true,{}].concat(jsons))}static minus(json1,json2){if(E(json1)||E(json2))return json1;let newJson={};this.forEach(json1,(v,k)=>{if(!json2.hasOwnProperty(k))newJson[k]=v});return newJson}static intersect(json1,json2){if(E(json1)||E(json2))return json1;let newJson={};this.forEach(json1,(v,k)=>{if(json2.hasOwnProperty(k))newJson[k]=v});return newJson}static filter(json,fn){let newJson={};this.forEach(json,(v,k)=>{if(fn.apply(json,[v,k]))newJson[k]=v});return newJson}static find(data,path){if(!path)return data;const array=path.split(".");if(array.length==1)return data[path];let v=data;array.forEach(a=>{if(v&&a)v=v[a]});return v}}util.Jsons=Jsons})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Jsons=JS.util.Jsons;var JS;(function(JS){let util;(function(util){class Konsole{static clear(){console.clear()}static count(label){console.count(label)}static countReset(label){console.countReset(label)}static time(label){console.time(label)}static timeEnd(label){console.timeEnd(label)}static trace(data,css){if(!data)console.trace();let arr=[data];if(typeof data=="string"&&css)arr[arr.length]=css;console.trace.apply(null,arr)}static text(data,css){typeof css?console.log("%c"+data,css):console.log(data)}static _print(d){typeof d=="string"?console.log(d):console.dirxml(d)}static print(...data){data.forEach(d=>{this._print(d)})}}util.Konsole=Konsole})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Konsole=JS.util.Konsole;var JS;(function(JS){let util;(function(util){class Locales{static lang(locale){if(!locale)return null;let arr=locale.split("-");if(arr.length==1)return locale;return arr[0]}static country(locale){if(!locale)return null;let arr=locale.split("-");if(arr.length==1)return null;return arr[1]}}util.Locales=Locales})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Locales=JS.util.Locales;var JS;(function(JS){let util;(function(util){let LogLevel;(function(LogLevel){LogLevel[LogLevel["ALL"]=6]="ALL";LogLevel[LogLevel["TRACE"]=5]="TRACE";LogLevel[LogLevel["DEBUG"]=4]="DEBUG";LogLevel[LogLevel["INFO"]=3]="INFO";LogLevel[LogLevel["WARN"]=2]="WARN";LogLevel[LogLevel["ERROR"]=1]="ERROR";LogLevel[LogLevel["OFF"]=0]="OFF"})(LogLevel=util.LogLevel||(util.LogLevel={}));let LEVELS=["OFF","ERROR","WARN","INFO","DEBUG","TRACE","ALL"],STYLES=["","color:red;background-color:#fff0f0;","color:orange;background-color:#fffbe6;","color:black;background-color:white;","color:white;background-color:gray;","color:white;background-color:black;",""];class ConsoleAppender{constructor(name){this.name="";this.name=name}log(level,...data){this._log(LEVELS[level],STYLES[level],data)}_log(cmd,css,data){console.group(`%c${cmd} ${this.name?"["+this.name+"] ":""}${(new Date).toISOString()}`,css);if(data)data.forEach(a=>{cmd!="INFO"&&cmd!="WARN"?util.Konsole.trace(a):util.Konsole.print(a)});console.groupEnd()}}util.ConsoleAppender=ConsoleAppender;class Log{constructor(name,level,appender){this._appender=!appender?new ConsoleAppender(name):Reflect.construct(appender,name);this.level=level||LogLevel.ALL;this._name=name}name(){return this._name}_log(level,data){if(level<=this.level){this._appender.log.apply(this._appender,[level].concat(data))}}trace(...data){this._log(LogLevel.TRACE,data)}debug(...data){this._log(LogLevel.DEBUG,data)}info(...data){this._log(LogLevel.INFO,data)}warn(...data){this._log(LogLevel.WARN,data)}error(...data){this._log(LogLevel.ERROR,data)}clear(){this._appender.clear()}}util.Log=Log})(util=JS.util||(JS.util={}))})(JS||(JS={}));var LogLevel=JS.util.LogLevel;var Log=JS.util.Log;let JSLogger=new Log(`JSDK ${JS.version}`,LogLevel.INFO);Konsole.text(`Powered by JSDK ${JS.version}`,"font-weight:bold;");(function(){var N=Number,$N=N.prototype;$N.stringify=function(){if(this.isNaN())return null;if(this.isZero())return"0";let t=this.toString(),m=t.match(/^(\+|\-)?(\d+)\.?(\d*)[Ee](\+|\-)(\d+)$/);if(!m)return t;let zhe=m[2],xiao=m[3],zhi=N(m[5]),fu=m[1]=="-"?"-":"",zfu=m[4],ws=(zfu=="-"?-1:1)*zhi-xiao.length,n=zhe+xiao;if(ws==0)return fu+n;if(ws>0)return fu+n+Strings.padEnd("",ws,"0");let dws=n.length+ws;if(dws<=0)return fu+"0."+Strings.padEnd("",-1*dws,"0")+n;return n.slice(0,dws-1)+"."+n.slice(dws)};$N.round=function(d){if(this.isNaN()||this.isInt()||!N.isFinite(d))return N(this);let n=!d||d<0?0:d,pow=Math.pow(10,n);return Math.round(this*pow)/pow};$N.toInt=function(){return this.round(0)};var f3=s=>{return s.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")};$N.format=function(dLen){let d=dLen==void 0||!Number.isFinite(dLen)?this.fractionLength():dLen,s=this.round(d).abs().stringify(),sign=this.isNegative()?"-":"";let sn=N(s);if(sn.isInt())return sign+f3(sn.toString())+(d<1?"":"."+Strings.padEnd("",d,"0"));let p=s.indexOf("."),ints=s.slice(0,p),digs=s.slice(p+1);return sign+f3(ints)+"."+Strings.padEnd(digs,d,"0")};$N.equals=function(n,dLen){if(this.isNaN())throw new TypeError("This number is NaN!");let num=N(n);if(num.isNaN())throw new TypeError("The compared number is NaN!");return this.round(dLen).valueOf()==num.round(dLen).valueOf()};$N.add=function(n){const v=N(n);if(this.valueOf()==0)return v;if(v.valueOf()==0)return this;if(this.isInt()&&v.isInt())return this.valueOf()+v.valueOf();let m=Math.pow(10,Math.max(this.fractionLength(),v.fractionLength())),n1=this.mul(m).valueOf(),n2=v.mul(m).valueOf();return(n1+n2)/m};$N.sub=function(n){const v=N(n);if(v.valueOf()==0)return this;if(this.isInt()&&v.isInt())return this.valueOf()-v.valueOf();let m=Math.pow(10,Math.max(this.fractionLength(),v.fractionLength())),n1=this.mul(m).valueOf(),n2=v.mul(m).valueOf();return(n1-n2)/m};$N.mul=function(n){if(this.valueOf()==0)return 0;const v=N(n);if(v.valueOf()==0)return 0;if(this.isInt()&&v.isInt())return v.valueOf()*this.valueOf();let s1=this.stringify(this),s2=v.stringify(),m1=s1.indexOf(".")>=0?s1.split(".")[1].length:0,m2=s2.indexOf(".")>=0?s2.split(".")[1].length:0,n1=N(s1.replace(".","")),n2=N(s2.replace(".",""));return n1*n2/Math.pow(10,m1+m2)};$N.div=function(n){if(this.valueOf()==0)return 0;const v=N(n);if(v.valueOf()==0)throw new ArithmeticError("Can not divide an Zero.");let s1=this.stringify(),s2=v.stringify(),m1=s1.indexOf(".")>=0?s1.split(".")[1].length:0,m2=s2.indexOf(".")>=0?s2.split(".")[1].length:0,n1=N(s1.replace(".","")),n2=N(s2.replace(".",""));return n1/n2*Math.pow(10,m2-m1)};$N.isNaN=function(){return isNaN(this)};$N.isFinite=function(){return isFinite(this)};$N.isZero=function(){return this==0};$N.isFloat=function(){if(isNaN(this))return false;return!this.isInt()};$N.isInt=function(){return Math.floor(this)==this};$N.isPositive=function(){if(isNaN(this))return false;return this>0};$N.isNegative=function(){if(isNaN(this))return false;return this<0};$N.isOdd=function(){if(!this.isInt())return false;return(this.valueOf()&1)!=0};$N.isEven=function(){if(!this.isInt())return false;return(this.valueOf()&1)==0};$N.abs=function(){return Math.abs(this)};$N.fractionLength=function(){if(this.isInt()||this.isNaN())return 0;let s=this.stringify();return s.slice(s.indexOf(".")+1).length};$N.integerLength=function(){if(this.isNaN())return 0;return this.abs().toFixed(0).length};$N.fractionalPart=function(){if(this.isInt()||this.isNaN())return"";let s=this.stringify();return s.slice(s.indexOf(".")+1)};$N.integralPart=function(){if(this.isNaN())return"";let s=this.stringify(),i=s.indexOf(".");if(i<0)return s;return s.slice(0,i)}})();var JS;(function(JS){let util;(function(util){let N=Number,_opt=function(v1,opt,v2){var rst=null,v=N(v1);switch(opt){case"+":rst=v.add(v2);break;case"-":rst=v.sub(v2);break;case"*":rst=v.mul(v2);break;case"/":rst=v.div(v2);break}return rst};class Numbers{static min(...numbers){let m=0;numbers.forEach((n,i)=>{if(i==0||n<m)m=n});return m}static max(...numbers){let m=0;numbers.forEach((n,i)=>{if(i==0||n>m)m=n});return m}static termwise(...args){if(arguments.length<=0)return 0;if(arguments.length==1)return N(args[0]).valueOf();var rst=null;for(var i=1;i<args.length;i=i+2){if(i==1){rst=_opt(args[i-1],args[i],args[i+1])}else{rst=_opt(rst,args[i],args[i+1])}}return rst}static algebra(expression,values){let exp=expression.replace(/\s+/g,"");if(values){util.Jsons.forEach(values,(n,k)=>{exp=exp.replace(new RegExp(k,"g"),N(n)+"")})}exp=exp.replace(/\-{2}(\d+\.*\d*)/g,"+$1");exp=exp.replace(/(\(|^)\++(\d+\.*\d*)/g,"$1$2");exp=exp.replace(/(^|\(|\D^\))\-(\d+\.*\d*)/g,"$1(0-$2)");JSLogger.debug(exp);let opts=exp.split(/(\d+\.?\d*)/);opts.forEach((v,i,array)=>{if(v&&v.length>0){if(util.Types.isNumeric(v)){array[i]=`(Number(${v}))`}else{v=v.replace(/[\+\-\*\/]/g,m=>{if(m=="+"){return".add"}else if(m=="-"){return".sub"}else if(m=="*"){return".mul"}else if(m=="/"){return".div"}return m});array[i]=v}}});JSLogger.debug(opts.join(""));return eval(opts.join("")).valueOf()}}util.Numbers=Numbers})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Numbers=JS.util.Numbers;var JS;(function(JS){let util;(function(util){class Objects{static readwrite(obj,props,listeners){let ps=typeof props=="string"?[props]:props,fs=listeners;ps.forEach(p=>{Object.defineProperty(obj,p,{configurable:true,enumerable:true,writable:true,get:()=>{return obj[p]},set:val=>{let oVal=obj[p];if(fs&&fs.changing)fs.changing.call(obj,p,val,oVal);obj[p]=val;if(fs&&fs.changed)fs.changed.call(obj,p,val,oVal)}})})}static readonly(obj,props){let ps=typeof props=="string"?[props]:props;ps.forEach(p=>{Object.defineProperty(obj,p,{configurable:true,enumerable:true,writable:false})})}}util.Objects=Objects})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Objects=JS.util.Objects;var JS;(function(JS){let util;(function(util){var CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");class Random{static number(range,isInt){let num=0,min=0,max=1;if(util.Types.isNumber(range)){max=range}else{min=range.min||0;max=range.max}num=Math.random()*(max-min)+min;return isInt?Number(num).toInt():num}static string(len,chars){return this._str(chars?chars.split(""):CHARS,len)}static uuid(len,radix){return this._str(CHARS,len,radix)}static _str(chars,len,radix){var uuid=[],i;radix=radix||chars.length;if(len){for(i=0;i<len;i++)uuid[i]=chars[0|Math.random()*radix]}else{var r;uuid[8]=uuid[13]=uuid[18]=uuid[23]="-";uuid[14]="4";for(i=0;i<36;i++){if(!uuid[i]){r=0|Math.random()*16;uuid[i]=chars[i==19?r&3|8:r]}}}return uuid.join("")}}util.Random=Random})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Random=JS.util.Random;var JS;(function(JS){let util;(function(util){class Strings{static padStart(text,maxLength,fill){let s=text||"";if(s.length>=maxLength)return s;let fs=fill?fill:" ";for(let i=0;i<maxLength;i++){let tmp=fs+s,d=tmp.length-maxLength;if(d<0){s=tmp}else{s=fs.substr(0,fs.length-d)+s;break}}return s}static padEnd(text,maxLength,fill){let s=text||"";if(s.length>=maxLength)return s;let fs=fill?fill:" ";for(let i=0;i<maxLength;i++){let tmp=s+fs,d=tmp.length-maxLength;if(d<0){s=tmp}else{s+=fs.substr(0,fs.length-d);break}}return s}static nodeHTML(nodeType,attrs,text){let a="";if(attrs)util.Jsons.forEach(attrs,(v,k)=>{if(v!=void 0){if(util.Types.isBoolean(v)){if(v===true)a+=` ${k}`}else{a+=` ${k}="${v||""}"`}}});return`<${nodeType}${a}>${text||""}</${nodeType}>`}static escapeHTML(html){if(!html)return"";let chars={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};return html.replace(/[&<>"'`=\/]/g,function(s){return chars[s]})}static format(tpl,...data){if(!tpl)return tpl;let i=0;data=data||[];return tpl.replace(/\%(%|s|b|d|f|n)/gm,(s,...args)=>{let v=i>=data.length?"":data[i++];switch(args[0]){case"b":{v=Boolean(v).toString();break}case"d":{v=Number(v).toInt().toString();break}case"f":{v=Number(v).stringify();break}case"n":{v="\n";break}case"%":{v="%"}}return v})}static merge(tpl,data){if(!tpl||!data)return tpl;return tpl.replace(/\{(\w+)\}/g,(str,...args)=>{let m=args[0],s=data[m];return s===undefined?str:util.Types.isFunction(s)?s(data,str,m):s==null?"":String(s)})}}util.Strings=Strings})(util=JS.util||(JS.util={}))})(JS||(JS={}));var Strings=JS.util.Strings;var JS;(function(JS){let util;(function(util){let TimerState;(function(TimerState){TimerState[TimerState["STOPPED"]=0]="STOPPED";TimerState[TimerState["RUNNING"]=1]="RUNNING";TimerState[TimerState["PAUSED"]=2]="PAUSED"})(TimerState=util.TimerState||(util.TimerState={}));class Timer{constructor(task,cfg){this._bus=new util.EventBus(this);this._sta=TimerState.STOPPED;this._ts=0;this._et=0;this._pt=0;this._count=0;this._task=task;this._config(cfg)}on(type,fn){this._bus.on(type,fn);return this}off(type,fn){this._bus.off(type,fn);return this}count(){return this._count}_config(cfg){this._cfg=util.Jsons.union({delay:0,loop:1,interval:0,intervalMode:"BF"},this._cfg,cfg);let c=this._cfg;if(c.interval!=void 0&&c.interval<0)c.interval=0;let l=c.loop;l=l==false||l<0?0:l===true?Infinity:l;c.loop=l;return this}pause(){let m=this;if(!m.isRunning())return m;m._bus.fire("pausing",[m._count+1]);m._state(TimerState.PAUSED);m._pt=System.highResTime();m._bus.fire("paused",[m._count+1]);return m}_cancelTimer(){if(this._timer)window.clearTimeout(this._timer);this._timer=null}_reset(){let m=this;m._cancelTimer();m._state(TimerState.STOPPED);m._count=0;m._ts0=0;m._ts=0;m._et=0;m._pt=0}stop(){this._finish();return this}_finish(){this._reset();this._bus.fire("finished")}getState(){return this._sta}isRunning(){return this.getState()==TimerState.RUNNING}_state(s){this._sta=s}fps(){return this._et==0?0:1e3/this._et}maxFPS(){let t=this._cfg.interval;return t==0?Infinity:1e3/t}looped(){return this._count+1}_loopTask(skip){if(!this.isRunning())return;let T=this,p=T._cfg.loop;if(T._count<p){let t=0,opts=T._cfg,t0=System.highResTime();T._et=t0-T._ts;if(!skip){T._bus.fire("looping",[T._count+1]);T._task.call(T,T._et);T._bus.fire("looped",[T._count+1]);let t1=System.highResTime();t=t1-t0;++T._count}T._ts=t0;let d=opts.interval-t,needSkip=opts.intervalMode=="OF"&&d<0;if(needSkip){T._loopTask(needSkip)}else{T._timer=setTimeout(()=>{T._loopTask(needSkip)},opts.intervalMode=="BF"?opts.interval:d)}}else{T._finish()}}_start(begin){this._loopTask(!begin)}start(){let T=this;if(this.isRunning())return;let first=false,wait=T._cfg.delay;if(T.getState()==TimerState.PAUSED){wait=0;let dt=System.highResTime()-T._pt;T.