gahotx-cdn
Version:
2 lines • 418 kB
JavaScript
/*! For license information please see ispeak-bber.min.js.LICENSE.txt */
var e,t;e=self,t=function(){return function(){var e={9215:function(e){"use strict";e.exports=JSON.parse('{"_from":"@cloudbase/js-sdk@^1.4.1","_id":"@cloudbase/js-sdk@1.5.0","_inBundle":false,"_integrity":"sha512-Ka3v68XESji0RqGQFuvGa8ABPmm30GLVruBiJpI5UjVRYEgEmVOmzUG+dNf6j62Zkk7mKLWQ/XwZXF0V/3nfWQ==","_location":"/@cloudbase/js-sdk","_phantomChildren":{"bson":"4.2.3","lodash.clonedeep":"4.5.0","lodash.set":"4.3.2","lodash.unset":"4.5.2"},"_requested":{"type":"range","registry":true,"raw":"@cloudbase/js-sdk@^1.4.1","name":"@cloudbase/js-sdk","escapedName":"@cloudbase%2fjs-sdk","scope":"@cloudbase","rawSpec":"^1.4.1","saveSpec":null,"fetchSpec":"^1.4.1"},"_requiredBy":["/"],"_resolved":"https://registry.npmjs.org/@cloudbase/js-sdk/-/js-sdk-1.5.0.tgz","_shasum":"cb0f928c7fe1c01f3eeb97b8f08161dece15cb9d","_spec":"@cloudbase/js-sdk@^1.4.1","_where":"/builds/DreamyTZK/ispeak-bber","author":"","browserslist":["last 2 version","> 1%","not dead","chrome 53"],"bugs":{"url":"https://github.com/TencentCloudBase/cloudbase-js-sdk/issues"},"bundleDependencies":false,"components":["app","auth","database","functions","storage"],"dependencies":{"@cloudbase/analytics":"^1.1.0","@cloudbase/app":"^1.3.0","@cloudbase/auth":"^1.4.0","@cloudbase/database":"0.9.18-next","@cloudbase/functions":"^1.3.0","@cloudbase/realtime":"^1.1.3","@cloudbase/storage":"^1.3.0","@cloudbase/types":"^1.1.2","@cloudbase/utilities":"^1.3.0"},"deprecated":false,"description":"cloudbase javascript sdk","devDependencies":{"@babel/core":"^7.9.0","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-transform-runtime":"^7.9.0","@babel/preset-env":"^7.9.5","@babel/preset-typescript":"^7.9.0","@typescript-eslint/eslint-plugin":"^3.8.0","@typescript-eslint/parser":"^3.8.0","awesome-typescript-loader":"^5.2.1","babel-loader":"^8.1.0","eslint":"^7.6.0","eslint-config-alloy":"^3.7.4","gulp":"^4.0.2","gulp-clean":"^0.4.0","gulp-rename":"^2.0.0","gulp-sourcemaps":"^2.6.5","gulp-typescript":"^6.0.0-alpha.1","json-loader":"^0.5.7","merge-stream":"^2.0.0","package-json-cleanup-loader":"^1.0.3","typescript":"^3.8.3","webpack":"4.41.3","webpack-cli":"^3.3.11","webpack-node-externals":"^1.7.2","webpack-stream":"^5.2.1","webpack-visualizer-plugin":"^0.1.11"},"files":["miniprogram_dist","**/dist/","/index.d.ts","**/package.json"],"gitHead":"14722e0bc29786b12a567b9450c28753531d9c77","homepage":"https://github.com/TencentCloudBase/cloudbase-js-sdk#readme","keywords":["tcb","cloudbase","Cloudbase","serverless","Serverless","javascript","JavaScript"],"license":"ISC","main":"dist/index.cjs.js","miniprogram":"miniprogram_dist","module":"dist/index.esm.js","name":"@cloudbase/js-sdk","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/TencentCloudBase/cloudbase-js-sdk.git"},"scripts":{"build":"rm -rf dist/ && gulp build","build:cdn":"gulp cdn","build:e2e":"rm -rf dist/ && NODE_ENV=e2e gulp e2e","build:miniapp":"gulp miniapp","lint":"eslint --fix \\"./src/**/*.ts\\" \\"./database/**/*.ts\\""},"typings":"./index.d.ts","version":"1.5.0"}')},7402:function(e){"use strict";function t(e,t,n,r,o,i,s){try{var a=e[i](s),u=a.value}catch(c){return void n(c)}a.done?t(u):Promise.resolve(u).then(r,o)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(o,i){var s=e.apply(n,r);function a(e){t(s,o,i,a,u,"next",e)}function u(e){t(s,o,i,a,u,"throw",e)}a(undefined)}))}},e.exports["default"]=e.exports,e.exports.__esModule=!0},6247:function(e){"use strict";e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports["default"]=e.exports,e.exports.__esModule=!0},3483:function(e){"use strict";e.exports=function(e){return e&&e.__esModule?e:{"default":e}},e.exports["default"]=e.exports,e.exports.__esModule=!0},2370:function(e,t,n){"use strict";var r=n(3988)["default"];function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}e.exports=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{"default":e};var t=o();if(t&&t.has(e))return t.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(n,s,a):n[s]=e[s]}return n["default"]=e,t&&t.set(e,n),n},e.exports["default"]=e.exports,e.exports.__esModule=!0},3988:function(e){"use strict";function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports["default"]=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports["default"]=e.exports,e.exports.__esModule=!0),t(n)}e.exports=t,e.exports["default"]=e.exports,e.exports.__esModule=!0},6304:function(e,t,n){"use strict";e.exports=n(3355)},1588:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3125);Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===r[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}}))}));var o=n(9206);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}))},3125:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.AbstractStorage=t.AbstractSDKRequest=t.StorageType=void 0,t.StorageType=n,function(e){e.local="local",e.none="none",e.session="session"}(n||(t.StorageType=n={}));var r=function(){};t.AbstractSDKRequest=r;var o=function(){};t.AbstractStorage=o},9206:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formatUrl=function(e,t,n){void 0===n&&(n={});var r=/\?/.test(t),o="";for(var i in n)""===o?!r&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(n[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}},5086:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setSdkVersion=function(e){s=e},t.getSdkVersion=function(){return s},t.setSdkName=function(e){a=e,o(e)},t.getSdkName=function(){return a},t.setEndPoint=l,t.setRegionLevelEndpoint=function(e,t,n){l(t?"//"+e+"."+t+".tcb-api.tencentcloudapi.com/web":"//"+e+".ap-shanghai.tcb-api.tencentcloudapi.com/web",n)},t.getEndPoint=function(){return{BASE_URL:f,PROTOCOL:c}},t.LOGINTYPE=t.DATA_VERSION=void 0;var r=n(1895),o=r.constants.setSdkName,i=r.constants.setProtocol,s="",a="@cloudbase/js-sdk";t.DATA_VERSION="2020-01-10";var u,c="undefined"!=typeof location&&"http:"===location.protocol?"http:":"https:",f="//tcb-api.tencentcloudapi.com/web";function l(e,t){f=e,t&&(c=t,i(t))}t.LOGINTYPE=u,function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.CUSTOM="CUSTOM",e.NULL="NULL"}(u||(t.LOGINTYPE=u={}))},2701:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EVENTS=void 0,t.EVENTS={LOGIN_STATE_CHANGED:"loginStateChanged",LOGIN_STATE_EXPIRED:"loginStateExpire",LOGIN_TYPE_CHANGED:"loginTypeChanged",ANONYMOUS_CONVERTED:"anonymousConverted",ACCESS_TOKEN_REFRESHD:"refreshAccessToken"}},9304:function(e,t,n){"use strict";var r=n(3483);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=t.cloudbase=void 0;var o=r(n(3988)),i=n(1895),s=r(n(4934)),a=n(9487),u=n(1510),c=n(1888),f=n(3704),l=n(5086),p=function(){return(p=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}).apply(this,arguments)},d=function(e,t,n,r){var i,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":(0,o["default"])(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(i=e[u])&&(a=(s<3?i(a):s>3?i(t,n,a):i(t,n))||a);return s>3&&a&&Object.defineProperty(t,n,a),a},h=function(e,t){if("object"===("undefined"==typeof Reflect?"undefined":(0,o["default"])(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},y=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(t){i(t)}}function a(e){try{u(r["throw"](e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},g=function(e,t){var n,r,o,i,s={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(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},_=i.adapters.useAdapters,v=i.adapters.useDefaultAdapter,m=i.adapters.RUNTIME,b=i.constants.ERRORS,O=i.constants.COMMUNITY_SITE_URL,A=i.utils.printWarn,w=i.helpers.catchErrorsDecorator,S={timeout:15e3,persistence:"session"},E=6e5,N={},T=new(function(){function e(e){this._config=e||this._config,this.authInstance=null}return Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"platform",{get:function(){return u.Platform},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cache",{get:function(){return(0,c.getCacheByEnvId)(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localCache",{get:function(){return(0,c.getLocalCache)(this._config.env)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return(0,f.getRequestByEnvId)(this._config.env)},enumerable:!1,configurable:!0}),e.prototype.init=function(t){if(!t.env)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"env must not be specified"}));if(u.Platform.adapter||this._useDefaultAdapter(),this.requestClient=new u.Platform.adapter.reqClass({timeout:t.timeout||5e3,timeoutMsg:"["+(0,l.getSdkName)()+"][REQUEST TIMEOUT] request had been abort since didn't finished within"+t.timeout/1e3+"s"}),u.Platform.runtime!==m.WEB){if(!t.appSecret)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"invalid appSecret"}));var n=u.Platform.adapter.getAppSign?u.Platform.adapter.getAppSign():"";if(t.appSign&&n&&t.appSign!==n)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"invalid appSign"}));if(n&&(t.appSign=n),!t.appSign)throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"invalid appSign"}))}this._config=p(p({},S),t),this._config.timeout=this._formatTimeout(this._config.timeout);var r=this._config,o=r.env,i=r.persistence,s=r.debug,a=r.timeout,d=r.appSecret,h=r.appSign;(0,c.initCache)({env:o,persistence:i,debug:s,platformInfo:this.platform}),(0,f.initRequest)({env:o,region:t.region||"",timeout:a,appSecret:d,appSign:h}),t.region&&(0,l.setRegionLevelEndpoint)(o,t.region||"");var y=new e(this._config);return y.requestClient=this.requestClient,y},e.prototype.updateConfig=function(e){var t=e.persistence,n=e.debug;this._config.persistence=t,this._config.debug=n,(0,c.initCache)({env:this._config.env,persistence:t,debug:n,platformInfo:this.platform})},e.prototype.registerExtension=function(e){N[e.name]=e},e.prototype.invokeExtension=function(e,t){return y(this,void 0,void 0,(function(){var n;return g(this,(function(r){switch(r.label){case 0:if(!(n=N[e]))throw new Error(JSON.stringify({code:b.INVALID_PARAMS,msg:"extension:"+e+" must be registered before invoke"}));return[4,n.invoke(t,this)];case 1:return[2,r.sent()]}}))}))},e.prototype.useAdapters=function(e){var t=_(e)||{},n=t.adapter,r=t.runtime;n&&(u.Platform.adapter=n),r&&(u.Platform.runtime=r)},e.prototype.registerHook=function(t){(0,a.registerHook)(e,t)},e.prototype.registerComponent=function(t){(0,a.registerComponent)(e,t)},e.prototype.registerVersion=function(e){(0,l.setSdkVersion)(e)},e.prototype.registerSdkName=function(e){(0,l.setSdkName)(e)},e.prototype.registerEndPoint=function(e,t){(0,l.setEndPoint)(e,t)},e.prototype._useDefaultAdapter=function(){var e=v(),t=e.adapter,n=e.runtime;u.Platform.adapter=t,u.Platform.runtime=n},e.prototype._formatTimeout=function(e){switch(!0){case e>E:return A(b.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),E;case e<100:return A(b.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return e}},d([w({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv2/adapter.html#jie-ru-liu-cheng)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+O]}),h("design:type",Function),h("design:paramtypes",[Object]),h("design:returntype",e)],e.prototype,"init",null),d([w({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+O]}),h("design:type",Function),h("design:paramtypes",[String,Object]),h("design:returntype",Promise)],e.prototype,"invokeExtension",null),e}());t.cloudbase=T,T.useAdapters(s["default"]);var I=T;t["default"]=I},1510:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Platform=void 0,t.Platform={}},1888:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initCache=function(e){var t=e.env,n=e.persistence,r=e.platformInfo,u={accessTokenKey:"access_token_"+t,accessTokenExpireKey:"access_token_expire_"+t,refreshTokenKey:"refresh_token_"+t,anonymousUuidKey:"anonymous_uuid_"+t,loginTypeKey:"login_type_"+t,userInfoKey:"user_info_"+t};s[t]?s[t].updatePersistence(n):s[t]=new i(o(o({},e),{keys:u,platformInfo:r,alwaysLocalKeys:["anonymousUuidKey"]})),a[t]=a[t]||new i(o(o({},e),{keys:u,platformInfo:r,persistence:"local"}))},t.getCacheByEnvId=function(e){return s[e]},t.getLocalCache=function(e){return a[e]};var r=n(1895),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}).apply(this,arguments)},i=r.cache.CloudbaseCache,s={},a={}},9487:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerComponent=function(e,t){var n=t.name,r=t.namespace,u=t.entity,c=t.injectEvents,f=t.IIFE,l=void 0!==f&&f;if(s[n]||r&&e[r])throw new Error(JSON.stringify({code:i.INVALID_OPERATION,msg:"Duplicate component "+n}));if(l){if(!u||"function"!=typeof u)throw new Error(JSON.stringify({code:i.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));u.call(e)}if(s[n]=t,r?e.prototype[r]=u:a(e.prototype,u),c){var p=c.bus,d=c.events;if(!p||!d||0===d.length)return;var h=e.prototype.fire||function(){};e.prototype.events||(e.prototype.events={}),(e.prototype.events||{})[n]?e.prototype.events[n].events=o(e.prototype.events[n].events,d):e.prototype.events[n]={bus:p,events:d},e.prototype.fire=function(e,t){for(var n in h(e,t),this.events){var r=this.events[n],o=r.bus;if(r.events.includes(e)){o.fire(e,t);break}}}}},t.registerHook=function(e,t){var n=t.entity,r=t.target;if(!e.prototype.hasOwnProperty(r))throw new Error(JSON.stringify({code:i.INVALID_OPERATION,msg:"target:"+r+" is not exist"}));var s=e.prototype[r];if("function"!=typeof s)throw new Error(JSON.stringify({code:i.INVALID_OPERATION,msg:"target:"+r+" is not a function which is the only type supports hook"}));e.prototype[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.call.apply(n,o([this],e)),s.call.apply(s,o([this],e))}};var r=n(1895),o=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r},i=r.constants.ERRORS,s={};function a(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:e===undefined&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&(e[n]=a(e[n],t[n]));return e}},3704:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.initRequest=function(e){A[e.env]=new O(c(c({},e),{"throw":!0}))},t.getRequestByEnvId=function(e){return A[e]},t.CloudbaseRequest=void 0;var r=n(5086),o=n(1895),i=n(9304),s=n(1888),a=n(2701),u=n(1510),c=function(){return(c=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}).apply(this,arguments)},f=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(t){i(t)}}function a(e){try{u(r["throw"](e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},l=function(e,t){var n,r,o,i,s={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(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},p=o.constants.ERRORS,d=o.utils.genSeqId,h=o.utils.isFormData,y=o.utils.formatUrl,g=o.utils.createSign,_=o.adapters.RUNTIME,v=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function m(e,t,n){var r=e[t];e[t]=function(t){var o={},i={};n.forEach((function(n){var r=n.call(e,t),s=r.data,a=r.headers;Object.assign(o,s),Object.assign(i,a)}));var s=t.data;return s&&function(){if(h(s))for(var e in o)s.append(e,o[e]);else t.data=c(c({},s),o)}(),t.headers=c(c({},t.headers||{}),i),r.call(e,t)}}function b(){var e=d();return{data:{seqId:e},headers:{"X-SDK-Version":"@cloudbase/js-sdk/"+(0,r.getSdkVersion)(),"x-seqid":e}}}var O=function(){function e(e){this._throwWhenRequestFail=!1,this.config=e,this._reqClass=new u.Platform.adapter.reqClass({timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在"+this.config.timeout/1e3+"s内未完成,已中断",restrictedMethods:["post"]}),this._throwWhenRequestFail=e["throw"]||!1,this._cache=(0,s.getCacheByEnvId)(this.config.env),this._localCache=(0,s.getLocalCache)(this.config.env),m(this._reqClass,"post",[b]),m(this._reqClass,"upload",[b]),m(this._reqClass,"download",[b])}return e.prototype.post=function(e){return f(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.post(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.upload=function(e){return f(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.upload(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.download=function(e){return f(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return[4,this._reqClass.download(e)];case 1:return[2,t.sent()]}}))}))},e.prototype.refreshAccessToken=function(){return f(this,void 0,void 0,(function(){var e,t,n;return l(this,(function(r){switch(r.label){case 0:this._refreshAccessTokenPromise||(this._refreshAccessTokenPromise=this._refreshAccessToken()),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._refreshAccessTokenPromise];case 2:return e=r.sent(),[3,4];case 3:return n=r.sent(),t=n,[3,4];case 4:if(this._refreshAccessTokenPromise=null,this._shouldRefreshAccessTokenHook=null,t)throw t;return[2,e]}}))}))},e.prototype.getAccessToken=function(){return f(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,u;return l(this,(function(c){switch(c.label){case 0:return e=this._cache.keys,t=e.accessTokenKey,n=e.accessTokenExpireKey,r=e.refreshTokenKey,[4,this._cache.getStoreAsync(r)];case 1:if(!c.sent())throw new Error(JSON.stringify({code:p.OPERATION_FAIL,msg:"refresh token is not exist, your local data might be messed up, please retry after clear localStorage or sessionStorage"}));return[4,this._cache.getStoreAsync(t)];case 2:return o=c.sent(),s=Number,[4,this._cache.getStoreAsync(n)];case 3:return i=s.apply(void 0,[c.sent()]),a=!0,(u=this._shouldRefreshAccessTokenHook)?[4,this._shouldRefreshAccessTokenHook(o,i)]:[3,5];case 4:u=!c.sent(),c.label=5;case 5:return u&&(a=!1),o&&i&&!(i<Date.now())||!a?[3,7]:[4,this.refreshAccessToken()];case 6:return[2,c.sent()];case 7:return[2,{accessToken:o,accessTokenExpire:i}]}}))}))},e.prototype.request=function(e,t,n){return f(this,void 0,void 0,(function(){var o,i,s,a,f,p,d,h,m,b,O,A,w,S,E,N,T,I,B,P,L,D,R,M,C,x;return l(this,(function(l){switch(l.label){case 0:return o="x-tcb-trace_"+this.config.env,i="application/x-www-form-urlencoded",s=c({action:e,dataVersion:r.DATA_VERSION,env:this.config.env},t),-1!==v.indexOf(e)?[3,3]:(a=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(a)]);case 1:return l.sent()?(f=s,[4,this.getAccessToken()]):[3,3];case 2:f.access_token=l.sent().accessToken,l.label=3;case 3:if("storage.uploadFile"===e){for(d in p=new FormData)p.hasOwnProperty(d)&&p[d]!==undefined&&p.append(d,s[d]);i="multipart/form-data"}else for(d in i="application/json;charset=UTF-8",p={},s)s[d]!==undefined&&(p[d]=s[d]);return h={headers:{"content-type":i}},(null==n?void 0:n.onUploadProgress)&&(h.onUploadProgress=n.onUploadProgress),this.config.region&&(h.headers["X-TCB-Region"]=this.config.region),(m=this._localCache.getStore(o))&&(h.headers["X-TCB-Trace"]=m),u.Platform.runtime!==_.WEB&&(b=this.config,O=b.appSign,A=b.appSecret,w=Date.now(),S=A.appAccessKey,E=A.appAccessKeyId,N=g({data:p,timestamp:w,appAccessKeyId:E,appSign:O},S),h.headers["X-TCB-App-Source"]="timestamp="+w+";appAccessKeyId="+E+";appSign="+O+";sign="+N),T=t.parse,I=t.inQuery,B=t.search,P={env:this.config.env},T&&(P.parse=!0),I&&(P=c(c({},I),P)),L=(0,r.getEndPoint)(),D=L.BASE_URL,R=L.PROTOCOL,M=y(R,D,P),B&&(M+=B),[4,this.post(c({url:M,data:p},h))];case 4:if(C=l.sent(),(x=C.header&&C.header["x-tcb-trace"])&&this._localCache.setStore(o,x),200!==Number(C.status)&&200!==Number(C.statusCode)||!C.data)throw new Error("network request error");return[2,C]}}))}))},e.prototype.send=function(e,t){return void 0===t&&(t={}),f(this,void 0,void 0,(function(){var n;return l(this,(function(r){switch(r.label){case 0:return[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 1:return"ACCESS_TOKEN_EXPIRED"!==(n=r.sent()).data.code||-1!==v.indexOf(e)?[3,4]:[4,this.refreshAccessToken()];case 2:return r.sent(),[4,this.request(e,t,{onUploadProgress:t.onUploadProgress})];case 3:n=r.sent(),r.label=4;case 4:if(n.data.code&&this._throwWhenRequestFail)throw new Error(JSON.stringify({code:p.OPERATION_FAIL,msg:"["+n.data.code+"] "+n.data.message}));return[2,n.data]}}))}))},e.prototype._refreshAccessToken=function(e){return void 0===e&&(e=1),f(this,void 0,void 0,(function(){var t,n,o,s,u,c,f,d,h,y,g,_,v;return l(this,(function(l){switch(l.label){case 0:return t=this._cache.keys,n=t.accessTokenKey,o=t.accessTokenExpireKey,s=t.refreshTokenKey,u=t.loginTypeKey,c=t.anonymousUuidKey,[4,this._cache.removeStoreAsync(n)];case 1:return l.sent(),[4,this._cache.removeStoreAsync(o)];case 2:return l.sent(),[4,this._cache.getStoreAsync(s)];case 3:if(!(f=l.sent()))throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"not login"}));return d={refresh_token:f},[4,this.request("auth.fetchAccessTokenWithRefreshToken",d)];case 4:return(h=l.sent()).data.code?"SIGN_PARAM_INVALID"!==(y=h.data.code)&&"REFRESH_TOKEN_EXPIRED"!==y&&"INVALID_REFRESH_TOKEN"!==y?[3,11]:[4,this._cache.getStoreAsync(u)]:[3,12];case 5:return l.sent()===r.LOGINTYPE.ANONYMOUS&&"INVALID_REFRESH_TOKEN"===y?[4,this._cache.getStoreAsync(c)]:[3,9];case 6:return g=l.sent(),[4,this._cache.getStoreAsync(s)];case 7:return _=l.sent(),[4,this.send("auth.signInAnonymously",{anonymous_uuid:g,refresh_token:_})];case 8:if(v=l.sent(),this._setRefreshToken(v.refresh_token),e>=1)return[2,this._refreshAccessToken(--e)];throw new Error(JSON.stringify({code:p.OPERATION_FAIL,message:"重试获取 refresh token 失败"}));case 9:return i.cloudbase.fire(a.EVENTS.LOGIN_STATE_EXPIRED),[4,this._cache.removeStoreAsync(s)];case 10:l.sent(),l.label=11;case 11:throw new Error(JSON.stringify({code:p.NETWORK_ERROR,msg:"refresh access_token failed:"+h.data.code}));case 12:return h.data.access_token?(i.cloudbase.fire(a.EVENTS.ACCESS_TOKEN_REFRESHD),[4,this._cache.setStoreAsync(n,h.data.access_token)]):[3,15];case 13:return l.sent(),[4,this._cache.setStoreAsync(o,h.data.access_token_expire+Date.now())];case 14:return l.sent(),[2,{accessToken:h.data.access_token,accessTokenExpire:h.data.access_token_expire}];case 15:return h.data.refresh_token?[4,this._cache.removeStoreAsync(s)]:[3,19];case 16:return l.sent(),[4,this._cache.setStoreAsync(s,h.data.refresh_token)];case 17:return l.sent(),[4,this._refreshAccessToken()];case 18:l.sent(),l.label=19;case 19:return[2]}}))}))},e.prototype._setRefreshToken=function(e){return f(this,void 0,void 0,(function(){var t,n,r,o;return l(this,(function(i){switch(i.label){case 0:return t=this._cache.keys,n=t.accessTokenKey,r=t.accessTokenExpireKey,o=t.refreshTokenKey,[4,this._cache.removeStoreAsync(n)];case 1:return i.sent(),[4,this._cache.removeStoreAsync(r)];case 2:return i.sent(),[4,this._cache.setStoreAsync(o,e)];case 3:return i.sent(),[2]}}))}))},e}();t.CloudbaseRequest=O;var A={}},627:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.LOGINTYPE=void 0,t.LOGINTYPE=n,function(e){e.ANONYMOUS="ANONYMOUS",e.WECHAT="WECHAT",e.WECHAT_PUBLIC="WECHAT-PUBLIC",e.WECHAT_OPEN="WECHAT-OPEN",e.CUSTOM="CUSTOM",e.EMAIL="EMAIL",e.USERNAME="USERNAME",e.NULL="NULL",e.PHONE="PHONE"}(n||(t.LOGINTYPE=n={}))},2198:function(e,t,n){"use strict";var r=n(3483);Object.defineProperty(t,"__esModule",{value:!0}),t.registerAuth=function(e){try{e.registerComponent(D)}catch(t){console.warn(t)}},t.registerProvider=function(e,t){P.prototype[e]=function(n){var r="_"+e;return this[r]||(this[r]=new t(h(h({},n),this._config))),this[r]}},Object.defineProperty(t,"AuthProvider",{enumerable:!0,get:function(){return f.AuthProvider}}),t.eventBus=t.EVENTS=t.Auth=t.LoginState=void 0;var o=r(n(3988)),i=n(1895),s=n(9368),a=n(1424),u=n(8432),c=n(627),f=n(2251),l=n(2360),p=n(5518),d=n(4718),h=function(){return(h=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}).apply(this,arguments)},y=function(e,t,n,r){var i,s=arguments.length,a=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":(0,o["default"])(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var u=e.length-1;u>=0;u--)(i=e[u])&&(a=(s<3?i(a):s>3?i(t,n,a):i(t,n))||a);return s>3&&a&&Object.defineProperty(t,n,a),a},g=function(e,t){if("object"===("undefined"==typeof Reflect?"undefined":(0,o["default"])(Reflect))&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},_=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{u(r.next(e))}catch(t){i(t)}}function a(e){try{u(r["throw"](e))}catch(t){i(t)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},v=function(e,t){var n,r,o,i,s={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(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r["return"]:i[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(a){i=[6,a],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},m=i.events.CloudbaseEventEmitter,b=i.adapters.RUNTIME,O=i.utils.printWarn,A=i.utils.throwError,w=i.utils.transformPhone,S=i.constants.ERRORS,E=i.constants.COMMUNITY_SITE_URL,N=i.helpers.catchErrorsDecorator,T=new m;t.eventBus=T;var I=function(){function e(e){var t=e.cache,n=e.request;this._cache=t,this._request=n,this._setUserInfo()}return e.prototype.checkLocalInfo=function(){return _(this,void 0,void 0,(function(){return v(this,(function(e){return this.uid=this._getLocalUserInfo("uid"),this.loginType=this._getLocalUserInfo("loginType"),this.openid=this._getLocalUserInfo("wxOpenId"),this.wxOpenId=this._getLocalUserInfo("wxOpenId"),this.wxPublicId=this._getLocalUserInfo("wxPublicId"),this.unionId=this._getLocalUserInfo("wxUnionId"),this.qqMiniOpenId=this._getLocalUserInfo("qqMiniOpenId"),this.customUserId=this._getLocalUserInfo("customUserId"),this.nickName=this._getLocalUserInfo("nickName"),this.gender=this._getLocalUserInfo("gender"),this.avatarUrl=this._getLocalUserInfo("avatarUrl"),this.email=this._getLocalUserInfo("email"),this.hasPassword=Boolean(this._getLocalUserInfo("hasPassword")),this.phone=this._getLocalUserInfo("phone"),this.location={country:this._getLocalUserInfo("country"),province:this._getLocalUserInfo("province"),city:this._getLocalUserInfo("city")},[2]}))}))},e.prototype.checkLocalInfoAsync=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a,u,c,f,l,p,d,h,y,g;return v(this,(function(_){switch(_.label){case 0:return e=this,[4,this._getLocalUserInfoAsync("uid")];case 1:return e.uid=_.sent(),t=this,[4,this._getLocalUserInfoAsync("loginType")];case 2:return t.loginType=_.sent(),n=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 3:return n.openid=_.sent(),r=this,[4,this._getLocalUserInfoAsync("wxOpenId")];case 4:return r.wxOpenId=_.sent(),o=this,[4,this._getLocalUserInfoAsync("wxPublicId")];case 5:return o.wxPublicId=_.sent(),i=this,[4,this._getLocalUserInfoAsync("wxUnionId")];case 6:return i.unionId=_.sent(),s=this,[4,this._getLocalUserInfoAsync("qqMiniOpenId")];case 7:return s.qqMiniOpenId=_.sent(),a=this,[4,this._getLocalUserInfoAsync("customUserId")];case 8:return a.customUserId=_.sent(),u=this,[4,this._getLocalUserInfoAsync("nickName")];case 9:return u.nickName=_.sent(),c=this,[4,this._getLocalUserInfoAsync("gender")];case 10:return c.gender=_.sent(),f=this,[4,this._getLocalUserInfoAsync("avatarUrl")];case 11:return f.avatarUrl=_.sent(),l=this,[4,this._getLocalUserInfoAsync("email")];case 12:return l.email=_.sent(),p=this,d=Boolean,[4,this._getLocalUserInfoAsync("hasPassword")];case 13:return p.hasPassword=d.apply(void 0,[_.sent()]),h=this,[4,this._getLocalUserInfoAsync("phone")];case 14:return h.phone=_.sent(),y=this,g={},[4,this._getLocalUserInfoAsync("country")];case 15:return g.country=_.sent(),[4,this._getLocalUserInfoAsync("province")];case 16:return g.province=_.sent(),[4,this._getLocalUserInfoAsync("city")];case 17:return y.location=(g.city=_.sent(),g),[2]}}))}))},e.prototype.linkWithTicket=function(e){if("string"!=typeof e)throw new Error("ticket must be string");return this._request.send("auth.linkWithTicket",{ticket:e})},e.prototype.linkWithRedirect=function(e){e.signInWithRedirect()},e.prototype.getLinkedUidList=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,o,i;return v(this,(function(s){switch(s.label){case 0:return[4,this._request.send("auth.getLinkedUidList",{})];case 1:for(e=s.sent().data,t=!1,n=e.users,r=0,o=n;r<o.length;r++)if((i=o[r]).wxOpenId&&i.wxPublicId){t=!0;break}return[2,{users:n,hasPrimaryUid:t}]}}))}))},e.prototype.setPrimaryUid=function(e){return this._request.send("auth.setPrimaryUid",{uid:e})},e.prototype.unlink=function(e){return this._request.send("auth.unlink",{platform:e})},e.prototype.update=function(e){return _(this,void 0,void 0,(function(){var t,n,r,o,i,s,a;return v(this,(function(u){switch(u.label){case 0:return t=e.nickName,n=e.gender,r=e.avatarUrl,o=e.province,i=e.country,s=e.city,[4,this._request.send("auth.updateUserInfo",{nickName:t,gender:n,avatarUrl:r,province:o,country:i,city:s})];case 1:return a=u.sent().data,this._setLocalUserInfo(a),[2]}}))}))},e.prototype.updatePassword=function(e,t){return this._request.send("auth.updatePassword",{oldPassword:t,newPassword:e})},e.prototype.updateEmail=function(e){return this._request.send("auth.updateEmail",{newEmail:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&A(S.INVALID_PARAMS,"username must be a string"),this._request.send("auth.updateUsername",{username:e})},e.prototype.refresh=function(){return _(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.getUserInfo",{})];case 1:return e=t.sent().data,this._setLocalUserInfo(e),[2,e]}}))}))},e.prototype.linkWithPhoneNumber=function(e,t){return _(this,void 0,void 0,(function(){return v(this,(function(n){return[2,this._request.send("auth.linkOrUpdatePhoneNumber",{phoneNumber:w(e),phoneCode:t})]}))}))},e.prototype.updatePhoneNumber=function(e,t){return _(this,void 0,void 0,(function(){return v(this,(function(n){return[2,this._request.send("auth.linkOrUpdatePhoneNumber",{phoneNumber:w(e),phoneCode:t})]}))}))},e.prototype._getLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;return this._cache.getStore(t)[e]},e.prototype._getLocalUserInfoAsync=function(e){return _(this,void 0,void 0,(function(){var t;return v(this,(function(n){switch(n.label){case 0:return t=this._cache.keys.userInfoKey,[4,this._cache.getStoreAsync(t)];case 1:return[2,n.sent()[e]]}}))}))},e.prototype._setUserInfo=function(){var e=this,t=this._cache.keys.userInfoKey,n=this._cache.getStore(t);["uid","loginType","openid","wxOpenId","wxPublicId","unionId","qqMiniOpenId","email","hasPassword","customUserId","nickName","gender","avatarUrl","phone"].forEach((function(t){e[t]=n[t]})),this.location={country:n.country,province:n.province,city:n.city}},e.prototype._setLocalUserInfo=function(e){var t=this._cache.keys.userInfoKey;this._cache.setStore(t,e),this._setUserInfo()},y([N({title:"绑定自定义登录失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithTicket() 的语法或参数是否正确"," 2 - 此账户是否已经绑定自定义登录"," 3 - ticket 参数是否归属当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Promise)],e.prototype,"linkWithTicket",null),y([N({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 User.linkWithRedirect() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方"," 3 - 此第三方是否已经授权","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",void 0)],e.prototype,"linkWithRedirect",null),y([N({title:"获取账户列表失败",messages:["请确认以下各项:"," 1 - 调用 User.getLinkedUidList() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Promise)],e.prototype,"getLinkedUidList",null),y([N({title:"设置微信主账号失败",messages:["请确认以下各项:"," 1 - 调用 User.setPrimaryUid() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",void 0)],e.prototype,"setPrimaryUid",null),y([N({title:"接触绑定失败",messages:["请确认以下各项:"," 1 - 调用 User.unlink() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",void 0)],e.prototype,"unlink",null),y([N({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",Promise)],e.prototype,"update",null),y([N({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",void 0)],e.prototype,"updatePassword",null),y([N({title:"更新邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 User.updateEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",void 0)],e.prototype,"updateEmail",null),y([N({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",void 0)],e.prototype,"updateUsername",null),y([N({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Promise)],e.prototype,"refresh",null),y([N({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().linkWithPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Promise)],e.prototype,"linkWithPhoneNumber",null),y([N({title:"更新手机号失败",messages:["请确认以下各项:"," 1 - 调用语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+E]}),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Promise)],e.prototype,"updatePhoneNumber",null),e}(),B=function(){function e(e){var t=e.envId,n=e.cache,r=e.request;t||A(S.INVALID_PARAMS,"envId is not defined"),this._cache=n,this.user=new I({cache:n,request:r})}return e.prototype.checkLocalState=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return v(this,(function(a){return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,o=this._cache.getStore(t),i=this._cache.getStore(n),s=this._cache.getStore(r),this.credential={refreshToken:o,accessToken:i,accessTokenExpire:s},this._loginType=this._cache.getStore(this._cache.keys.loginTypeKey),this.user.checkLocalInfo(),[2]}))}))},e.prototype.checkLocalStateAsync=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,o,i,s,a;return v(this,(function(u){switch(u.label){case 0:return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,[4,this._cache.getStoreAsync(t)];case 1:return o=u.sent(),[4,this._cache.getStoreAsync(n)];case 2:return i=u.sent(),[4,this._cache.getStoreAsync(r)];case 3:return s=u.sent(),this.credential={refreshToken:o,accessToken:i,accessTokenExpire:s},a=this,[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 4:return a._loginType=u.sent(),[4,this.user.checkLocalInfoAsync()];case 5:return u.sent(),[2]}}))}))},Object.defineProperty(e.prototype,"isAnonymousAuth",{get:function(){return this.loginType===c.LOGINTYPE.ANONYMOUS},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCustomAuth",{get:function(){return this.loginType===c.LOGINTYPE.CUSTOM},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isWeixinAuth",{get:function(){return this.loginType===c.LOGINTYPE.WECHAT||this.loginType===c.LOGINTYPE.WECHAT_OPEN||this.loginType===c.LOGINTYPE.WECHAT_PUBLIC},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isUsernameAuth",{get:function(){return this.loginType===c.LOGINTYPE.USERNAME},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginType",{get:function(){return this._loginType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isPhoneAuth",{get:function(){return this.loginType===c.LOGINTYPE.PHONE},enumerable:!1,configurable:!0}),e}();t.LoginState=B;var P=function(){function e(e){this._config=e,this._cache=e.cache,this._request=e.request,this._runtime=e.runtime||b.WEB,T.on(L.LOGIN_TYPE_CHANGED,this._onLoginTypeChanged.bind(this))}return Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this._cache.mode){var e=this.hasLoginState();return e&&e.user||null}O(S.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrenUser insteed")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"loginType",{get:function(){return this._cache.getStore(this._cache.keys.loginTypeKey)},enumerable:!1,configurable:!0}),e.prototype.getCurrenUser=function(){return _(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return[4,this.getLoginState()];case 1:return(e=t.sent())?[4,e.user.checkLocalInfoAsync()]:[3,3];case 2:return t.sent(),[2,e.user||null];case 3:return[2,null]}}))}))},e.prototype.getLoginType=function(){return _(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return[4,this._cache.getStoreAsync(this._cache.keys.loginTypeKey)];case 1:return[2,e.sent()]}}))}))},e.prototype.getAccessToken=function(){return _(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return e={},[4,this._request.getAccessToken()];case 1:return[2,(e.accessToken=t.sent().accessToken,e.env=this._config.env,e)]}}))}))},e.prototype.weixinAuthProvider=function(e){var t=e.appid,n=e.scope,r=e.state;return this._weixinAuthProvider||(this._weixinAuthProvider=new s.WeixinAuthProvider(h(h({},this._config),{cache:this._cache,request:this._request,runtime:this._runtime}),t,n,r)),this._weixinAuthProvider},e.prototype.anonymousAuthProvider=function(){return this._anonymousAuthProvider||(this._anonymousAuthProvider=new a.AnonymousAuthProvider(h(h({},this._config),{cache:this._cache,request:this._request}))),this._anonymousAuthProvider},e.prototype.customAuthProvider=function(){return this._customAuthProvider||(this._customAuthProvider=new u.CustomAuthProvider(h(h({},this._config),{cache:this._cache,request:this._request}))),this._customAuthProvider},e.prototype.emailAuthProvider=function(){return this._emailAuthProvider||(this._emailAuthProvider=new l.EmailAuthProvider(h(h({},this._config),{cache:this._cache,request:this._request}))),this._emailAuthProvider},e.prototype.usernameAuthProvider=function(){return this._usernameAuthProvider||(this._usernameAuthProvider=new p.UsernameAuthProvider(h(h({},this._config),{cache:this._cache,request:this._request}))),this._usernameAuthProvider},e.prototype.phoneAuthProvider=function(){return this._phoneAuthProvider||(this._phoneAuthProvider=new d.PhoneAuthProvider(h(h({},this._config),{cache:this._cache,request:this._request}))),this._phoneAuthProvider},e.prototype.signInWithUsernameAndPassword=function(e,t){return _(this,void 0,void 0,(function(){return v(this,(function(n){return[2,this.usernameAuthProvider().signIn(e,t)]}))}))},e.prototype.isUsernameRegistered=function(e){return _(this,void 0,void 0,(function(){var t;return v(this,(function(n){switch(n.label){case 0:return"string"!=typeof e&&A(S.INVALID_PARAMS,"username must be a string"),[4,this._request.send("auth.isUsernameRegistered",{username:e})];case 1:return[2,null==(t=n.sent().data)?void 0:t.isRegistered]}}))}))},e.prototype.signInWithEmailAndPassword=function(e,t){return _(this,void 0,void 0,(function(){return v(this,(function(n){return[2,this.emailAuthProvider().signIn(e,t)]}))}))},e.prototype.signUpWithEmailAndPassword=function(e,t){return _(this,void 0,void 0,(function(){return v(this,(function(n){return[2,this.emailAuthProvider().signUp(e,t)]}))}))},e.prototype.sendPasswordResetEmail=function(e){return _(this,void 0,void 0,(function(){return v(this,(function(t){return[2,this.emailAuthProvider().resetPassword(e)]}))}))},e.prototype.signOut=function(){return _(this,void 0,void 0,(function(){var e,t,n,r,o,i,s;return v(this,(function(a){switch(a.label){case 0:return[4,this.getLoginType()];case 1:if(a.sent()===c.LOGINTYPE.ANONYMOUS)throw new Error(JSON.stringify({code:S.INVALID_OPERATION,msg:"anonymous user doesn't support signOut action"}));return e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=e.accessTokenExpireKey,o="auth.logout",[4,this._cache.getStoreAsync(t)];case 2:return(i=a.sent())?[4,this._request.send(o,{refresh_token:i})]:[2];case 3:return s=a.sent(),this._cache.removeStoreAsync(t),this._cache.removeStoreAsync(n),this._cache.removeStoreAsync(r),T.fire(L.LOGIN_STATE_CHANGED),T.fire(L.LOGIN_TYPE_CHANGED,{env:this._config.env,loginType:c.LOGINTYPE.NULL,persistence:this._config.persistence}),[2,s]}}))}))},e.prototype.onLoginStateChanged=function(e){return _(this,void 0,void 0,(function(){var t,n=this;return v(this,(function(r){switch(r.label){case 0:return T.on(L.LOGIN_STATE_CHANGED,(function(){return _(n,void 0,void 0,(function(){var t;return v(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))})),[4,this.getLoginState()];case 1:return t=r.sent(),e.call(this,t),[2]}}))}))},e.prototype.onLoginStateExpired=function(e){T.on(L.LOGIN_STATE_EXPIRED,e.bind(this))},e.prototype.onAccessTokenRefreshed=function(e){T.on(L.ACCESS_TOKEN_REFRESHD,e.bind(this))},e.prototype.onAnonymousConverted=function(e){T.on(L.ANONYMOUS_CONVERTED,e.bind(this))},e.prototype.onLoginTypeChanged=function(e){var t=this;T.on(L.LOGIN_TYPE_CHANGED,(function(){return _(t,void 0,void 0,(function(){var t;return v(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return t=n.sent(),e.call(this,t),[2]}}))}))}))},e.prototype.hasLoginState=function(){if("async"!==this._cache.mode){var e=this._cache.keys.refreshTokenKey;if(this._cache.getStore(e)){var t=new B({envId:this._config.env,cache:this._cache,request:this._request});return t.checkLocalState(),t}return null}O(S.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return _(this,void 0,void 0,(function(){var e,t;return v(this,(function(n){switch(n.label){case 0:return e=this._cache.keys.refreshTokenKey,[4,this._cache.getStoreAsync(e)];case 1:return n.sent()?[4,(t=new B({envId:this._config.env,cache:this._cache,request:this._request})).checkLocalStateAsync()]:[3,3];case 2:return n.sent(),[2,t];case 3:return[2,null]}}))}))},e.prototype.shouldRefreshAccessToken=function(e){this._request._shouldRefreshAccessTokenHook=e.bind(this)},e.prototype.getUserInfo=function(){return _(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.getUserInfo",{})];case 1:return(e=t.sent()).code?[2,e]:[2,h(h({},e.data),{requestId:e.seqId})]}}))}))},e.prototype.getAuthHeader=function(){var e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,r=this._cache.getStore(t);return{"x-cloudbase-credentials":this._cache.getStore(n)+"/@@/"+r}},e.prototype.getAuthHeaderAsync=function(){return _(this,void 0,void 0,(function(){var e,t,n,r;return v(this,(function(o){switch(o.label){case 0:return[4,this._request.refreshAccessToken()];case 1:return o.sent(),e=this._cache.keys,t=e.refreshTokenKey,n=e.accessTokenKey,[4,this._cache.getStoreAsync(t)];case 2:return r=o.sent(),[4,this._cache.getStoreAsync(n)];case 3:return[2,{"x-cloudbase-credentials":o.sent()+"/@@/"+r}]}}))}))},e.prototype.sendPhoneCode=function(e){return _(this,void 0,void 0,(function(){return v(this,(function(t){switch(t.label){case 0:return[4,this._request.send("auth.sendPhoneCode",{phoneNumber:w(e)})];case 1:return[2,"Ok"===t.sent().data.SendStatus]}}))}))},e.prototype.signUpWithPhoneCode=function(e,t,n){return _(this,void 0,void 0,(function(){return v(this,(function(r){return[2,this.phoneAuthProvider().signUp(e,t,n)]}))}))},e.prototype.signInWithPhoneCodeOrPassword=function(e){return _(this,void 0,void 0,(function(){return v(this,(function(t){return[2,this.phoneAuthProvider().signIn(e)]}))}))},e.prototype._onLoginTypeChanged=function(e){return _(this,void 0,void 0,(function(){var t,n,r;return v(this,(function(o){switch(o.label){case 0:return t=e.data,n=t.loginType,r=t.persistence,t.env!==this._config.env?[2]:[4,this._cache.updatePersistenceAsync(r)];case 1:return o.sent(),[4,this._cache.setStoreAsync(this._cache.keys.loginTypeKey,n)];case 2:return o.sent(),[2]}}))}))},y([N({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrenUser() 的语法或参