Onlife/node_modules/goeasy/goeasy.esm.min.js

2 lines
174 KiB
JavaScript
Raw Normal View History

2025-04-19 15:38:48 +08:00
var e,t;!function(e){e.UNIAPP="uniapp",e.REACT_NATIVE="rn",e.COCOS="cocos",e.UNKNOWN="unknown"}(e||(e={}));class s{constructor(){this.framework=null,this.methods={[e.UNIAPP]:this.isUniApp,[e.REACT_NATIVE]:this.isReactNative,[e.COCOS]:this.isCocos};const t=this.methods,s=Object.keys(t);for(const e of s){if((0,t[e])()){this.framework=e;break}}this.framework=this.framework||e.UNKNOWN,this.framework}static currentFramework(){return this.instance||(this.instance=new s),this.instance.framework}isUniApp(){try{return"function"==typeof uni.getSystemInfoSync}catch(e){return!1}}isReactNative(){try{return"object"==typeof navigator&&"ReactNative"===navigator.product}catch(e){return!1}}isTaro(){try{return void 0!==process.env.TARO_ENV}catch(e){return!1}}isCocos(){try{return void 0!==cc.sys.localStorage}catch(e){return!1}}}class i{static init(t){s.currentFramework()===e.REACT_NATIVE&&(this.validate(t),this.platform=t.platform,this.asyncStorage=t.asyncStorage)}static validate(e){if(!e)throw new Error("'reactNativeOptions' is missing when calling GoEasy.getInstance()");if(!e.platform)throw new Error("'platform' is missing in GoEasy 'reactNativeOptions'");if(!e.asyncStorage)throw new Error("'asyncStorage' is missing in GoEasy 'reactNativeOptions'")}}!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.RECONNECTED="reconnected",e.EXPIRED_RECONNECTED="reconnected",e.CONNECT_FAILED="connect_failed"}(t||(t={}));const n="2.13.5";var o,r;!function(e){e.PRIVATE="private",e.GROUP="group",e.SYSTEM="system",e.CS="cs"}(o||(o={})),function(e){e.NEW="new",e.SENDING="sending",e.SUCCESS="success",e.FAIL="fail"}(r||(r={}));class a{}class c{constructor(e,t){this.id=e,this.data=t}}let u=new class{isDef(e){return!this.isUndef(e)}isUndef(e){return null==e}isPrimitive(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}isObject(e){return null!==e&&"object"==typeof e}isPlainObject(e){return"[object Object]"===Object.prototype.toString.call(e)}isRegExp(e){return"[object RegExp]"===Object.prototype.toString.call(e)}isValidArrayIndex(e){let t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}isString(e){return"string"==typeof e}isNumber(e){return"number"==typeof e}isStringOrNumber(e){return this.isString(e)||this.isNumber(e)}isArray(e){return"[object Array]"===Object.prototype.toString.call(e)}isEmpty(e){return this.isArray(e)?0===e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""===e.trim():!this.isDef(e))}isNative(e){return"function"==typeof e&&/native code/.test(e.toString())}isFunction(e){return"function"==typeof e}isBoolean(e){return"boolean"==typeof e}isTrue(e){return!0===e}isFalse(e){return!1===e}isNull(e){return null===e}};var l;!function(e){e.MP_WX="mp-wx",e.MP_WGAME="mp-wgame",e.MP_BYTE="mp-byte",e.MP_BAIDU="mp-baidu",e.MP_ALI="mp-ali",e.BROWSER="browser",e.NODE="node",e.UNI_IOS="uni-ios",e.UNI_ANDROID="uni-android",e.COCOS_IOS="cocos-ios",e.COCOS_ANDROID="cocos-android",e.RN_IOS="rn-ios",e.RN_ANDROID="rn-android",e.UNKNOWN="unknown"}(l||(l={}));class d{constructor(){this.platform=null,this.methods={[l.BROWSER]:this.isBrowser,[l.MP_WX]:this.isMPWX,[l.MP_WGAME]:this.isMPWeGame,[l.MP_BYTE]:this.isMPByte,[l.MP_BAIDU]:this.isMPBaidu,[l.MP_ALI]:this.isMPAli,[l.NODE]:this.isNode,[l.UNI_IOS]:this.isUniAppIOS,[l.UNI_ANDROID]:this.isUniAppAndroid,[l.COCOS_IOS]:this.isCocosIOS,[l.COCOS_ANDROID]:this.isCocosAndroid,[l.RN_IOS]:this.isRNiOS,[l.RN_ANDROID]:this.isRNAndroid};const e=this.methods,t=Object.keys(e);for(const s of t){if((0,e[s])()){this.platform=s;break}}this.platform=this.platform||l.UNKNOWN,this.platform}static currentPlatform(){return this.instance||(this.instance=new d),d.instance.platform}isBrowser(){return"undefined"!=typeof navigator&&"Taro"!==navigator.product&&"ReactNative"!==navigator.product&&"undefined"==typeof GameGlobal&&("undefined"==typeof cc||null!==cc.sys.browserType)&&"undefined"==typeof my&&"undefined"==typeof tt&&"undefined"==typeof swan}isMPWX(){ret