@cloudbase/utilities 2.25.0 → 2.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,6 +19,6 @@ function getProtocol() {
|
|
|
19
19
|
return PROTOCOL;
|
|
20
20
|
}
|
|
21
21
|
exports.getProtocol = getProtocol;
|
|
22
|
-
exports.IS_DEBUG_MODE = process.env.NODE_ENV === 'development';
|
|
22
|
+
exports.IS_DEBUG_MODE = typeof process === 'undefined' || typeof process.env === 'undefined' ? false : process.env.NODE_ENV === 'development';
|
|
23
23
|
exports.COMMUNITY_SITE_URL = 'https://support.qq.com/products/148793';
|
|
24
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
24
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbnN0YW50cy9jb21tb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsSUFBSSxPQUFPLEdBQUcsbUJBQW1CLENBQUE7QUFDakMsU0FBZ0IsVUFBVSxDQUFDLElBQVk7SUFDckMsT0FBTyxHQUFHLElBQUksQ0FBQTtBQUNoQixDQUFDO0FBRkQsZ0NBRUM7QUFDRCxTQUFnQixVQUFVO0lBQ3hCLE9BQU8sT0FBTyxDQUFBO0FBQ2hCLENBQUM7QUFGRCxnQ0FFQztBQUVELElBQUksUUFBUSxHQUFHLFFBQVEsQ0FBQTtBQUV2QixTQUFnQixXQUFXLENBQUMsUUFBNEI7SUFDdEQsUUFBUSxHQUFHLFFBQVEsQ0FBQTtBQUNyQixDQUFDO0FBRkQsa0NBRUM7QUFFRCxTQUFnQixXQUFXO0lBQ3pCLE9BQU8sUUFBUSxDQUFBO0FBQ2pCLENBQUM7QUFGRCxrQ0FFQztBQUVZLFFBQUEsYUFBYSxHQUFHLE9BQU8sT0FBTyxLQUFLLFdBQVcsSUFBSSxPQUFPLE9BQU8sQ0FBQyxHQUFHLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsUUFBUSxLQUFLLGFBQWEsQ0FBQTtBQUVySSxRQUFBLGtCQUFrQixHQUFHLHdDQUF3QyxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsibGV0IHNka05hbWUgPSAnQGNsb3VkYmFzZS9qcy1zZGsnXG5leHBvcnQgZnVuY3Rpb24gc2V0U2RrTmFtZShuYW1lOiBzdHJpbmcpIHtcbiAgc2RrTmFtZSA9IG5hbWVcbn1cbmV4cG9ydCBmdW5jdGlvbiBnZXRTZGtOYW1lKCkge1xuICByZXR1cm4gc2RrTmFtZVxufVxuXG5sZXQgUFJPVE9DT0wgPSAnaHR0cHM6J1xuXG5leHBvcnQgZnVuY3Rpb24gc2V0UHJvdG9jb2wocHJvdG9jb2w6ICdodHRwOicgfCAnaHR0cHM6Jykge1xuICBQUk9UT0NPTCA9IHByb3RvY29sXG59XG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRQcm90b2NvbCgpIHtcbiAgcmV0dXJuIFBST1RPQ09MXG59XG4vLyDmmK/lkKbkuLrlvIDlj5HmqKHlvI9cbmV4cG9ydCBjb25zdCBJU19ERUJVR19NT0RFID0gdHlwZW9mIHByb2Nlc3MgPT09ICd1bmRlZmluZWQnIHx8IHR5cGVvZiBwcm9jZXNzLmVudiA9PT0gJ3VuZGVmaW5lZCcgPyBmYWxzZSA6IHByb2Nlc3MuZW52Lk5PREVfRU5WID09PSAnZGV2ZWxvcG1lbnQnXG4vLyDpl67nrZTnpL7ljLrpk77mjqVcbmV4cG9ydCBjb25zdCBDT01NVU5JVFlfU0lURV9VUkwgPSAnaHR0cHM6Ly9zdXBwb3J0LnFxLmNvbS9wcm9kdWN0cy8xNDg3OTMnXG4iXX0=
|
|
@@ -12,6 +12,6 @@ export function setProtocol(protocol) {
|
|
|
12
12
|
export function getProtocol() {
|
|
13
13
|
return PROTOCOL;
|
|
14
14
|
}
|
|
15
|
-
export var IS_DEBUG_MODE = process.env.NODE_ENV === 'development';
|
|
15
|
+
export var IS_DEBUG_MODE = typeof process === 'undefined' || typeof process.env === 'undefined' ? false : process.env.NODE_ENV === 'development';
|
|
16
16
|
export var COMMUNITY_SITE_URL = 'https://support.qq.com/products/148793';
|
|
17
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2NvbnN0YW50cy9jb21tb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxPQUFPLEdBQUcsbUJBQW1CLENBQUE7QUFDakMsTUFBTSxVQUFVLFVBQVUsQ0FBQyxJQUFZO0lBQ3JDLE9BQU8sR0FBRyxJQUFJLENBQUE7QUFDaEIsQ0FBQztBQUNELE1BQU0sVUFBVSxVQUFVO0lBQ3hCLE9BQU8sT0FBTyxDQUFBO0FBQ2hCLENBQUM7QUFFRCxJQUFJLFFBQVEsR0FBRyxRQUFRLENBQUE7QUFFdkIsTUFBTSxVQUFVLFdBQVcsQ0FBQyxRQUE0QjtJQUN0RCxRQUFRLEdBQUcsUUFBUSxDQUFBO0FBQ3JCLENBQUM7QUFFRCxNQUFNLFVBQVUsV0FBVztJQUN6QixPQUFPLFFBQVEsQ0FBQTtBQUNqQixDQUFDO0FBRUQsTUFBTSxDQUFDLElBQU0sYUFBYSxHQUFHLE9BQU8sT0FBTyxLQUFLLFdBQVcsSUFBSSxPQUFPLE9BQU8sQ0FBQyxHQUFHLEtBQUssV0FBVyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxHQUFHLENBQUMsUUFBUSxLQUFLLGFBQWEsQ0FBQTtBQUVsSixNQUFNLENBQUMsSUFBTSxrQkFBa0IsR0FBRyx3Q0FBd0MsQ0FBQSIsInNvdXJjZXNDb250ZW50IjpbImxldCBzZGtOYW1lID0gJ0BjbG91ZGJhc2UvanMtc2RrJ1xuZXhwb3J0IGZ1bmN0aW9uIHNldFNka05hbWUobmFtZTogc3RyaW5nKSB7XG4gIHNka05hbWUgPSBuYW1lXG59XG5leHBvcnQgZnVuY3Rpb24gZ2V0U2RrTmFtZSgpIHtcbiAgcmV0dXJuIHNka05hbWVcbn1cblxubGV0IFBST1RPQ09MID0gJ2h0dHBzOidcblxuZXhwb3J0IGZ1bmN0aW9uIHNldFByb3RvY29sKHByb3RvY29sOiAnaHR0cDonIHwgJ2h0dHBzOicpIHtcbiAgUFJPVE9DT0wgPSBwcm90b2NvbFxufVxuXG5leHBvcnQgZnVuY3Rpb24gZ2V0UHJvdG9jb2woKSB7XG4gIHJldHVybiBQUk9UT0NPTFxufVxuLy8g5piv5ZCm5Li65byA5Y+R5qih5byPXG5leHBvcnQgY29uc3QgSVNfREVCVUdfTU9ERSA9IHR5cGVvZiBwcm9jZXNzID09PSAndW5kZWZpbmVkJyB8fCB0eXBlb2YgcHJvY2Vzcy5lbnYgPT09ICd1bmRlZmluZWQnID8gZmFsc2UgOiBwcm9jZXNzLmVudi5OT0RFX0VOViA9PT0gJ2RldmVsb3BtZW50J1xuLy8g6Zeu562U56S+5Yy66ZO+5o6lXG5leHBvcnQgY29uc3QgQ09NTVVOSVRZX1NJVEVfVVJMID0gJ2h0dHBzOi8vc3VwcG9ydC5xcS5jb20vcHJvZHVjdHMvMTQ4NzkzJ1xuIl19
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("tcbauth",[],e):"object"==typeof exports?exports.tcbauth=e():t.tcbauth=e()}("undefined"!=typeof window?window:this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AbortController:()=>_t,adapters:()=>o,cache:()=>a,constants:()=>r,events:()=>i,helpers:()=>s,jwt:()=>Rt,langEvent:()=>c,utils:()=>n});var r={};t.r(r),t.d(r,{COMMUNITY_SITE_URL:()=>b,ERRORS:()=>m,IS_DEBUG_MODE:()=>v,OATUH_LOGINTYPE:()=>g,getProtocol:()=>h,getSdkName:()=>f,setProtocol:()=>d,setSdkName:()=>l});var n={};t.r(n),t.d(n,{createPromiseCallback:()=>M,execCallback:()=>D,formatUrl:()=>R,genSeqId:()=>N,generateRequestId:()=>P,getHash:()=>T,getQuery:()=>C,isArray:()=>E,isFormData:()=>A,isInstanceOf:()=>j,isNull:()=>_,isPalinObject:()=>I,isString:()=>x,isUndefined:()=>S,parseCaptcha:()=>H,parseQueryString:()=>G,printError:()=>q,printGroupLog:()=>$,printInfo:()=>V,printWarn:()=>U,removeParam:()=>L,sleep:()=>F,throwError:()=>J,toQueryString:()=>k,transformPhone:()=>W});var o={};t.r(o),t.d(o,{RUNTIME:()=>Z,useAdapters:()=>et,useDefaultAdapter:()=>rt});var a={};t.r(a),t.d(a,{CloudbaseCache:()=>ct});var i={};t.r(i),t.d(i,{CloudbaseEvent:()=>lt,CloudbaseEventEmitter:()=>pt,IErrorEvent:()=>ft,activateEvent:()=>yt,addEventListener:()=>ht,removeEventListener:()=>vt});var c={};t.r(c),t.d(c,{LANG_CHANGE_EVENT:()=>mt,bus:()=>bt});var s={};t.r(s),t.d(s,{catchErrorsDecorator:()=>St});var u="@cloudbase/js-sdk";function l(t){u=t}function f(){return u}var p="https:";function d(t){p=t}function h(){return p}var y,v=!1,b="https://support.qq.com/products/148793",m={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},g="constants";!function(t){t.local="local",t.none="none",t.session="session"}(y||(y={}));var w=function(){},O=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};function E(t){return"[object Array]"===Object.prototype.toString.call(t)}function x(t){return"string"==typeof t}function S(t){return void 0===t}function I(t){return"[object Object]"===Object.prototype.toString.call(t)}function _(t){return"[object Null]"===Object.prototype.toString.call(t)}function j(t,e){return t instanceof e}function A(t){return"[object FormData]"===Object.prototype.toString.call(t)}function N(){return Math.random().toString(16).slice(2)}function P(){var t=(new Date).getTime(),e=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),("x"===r?n:7&n|8).toString(16)}))}function R(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";return Object.keys(r).forEach((function(t){""===o?!n&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(r[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)}function k(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(r){e.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),e.join("&")}function C(t,e){if("undefined"==typeof window)return!1;var r=e||decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""}var T=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]".concat(t,"=([^&#]*)")));return e?e[1]:""};function L(t,e){var r=e.split("?")[0],n=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var a=(n=o.split("&")).length-1;a>=0;a-=1)n[a].split("=")[0]===t&&n.splice(a,1);r="".concat(r,"?").concat(n.join("&"))}return r}function M(){var t={};if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t}function D(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r}function U(t,e){console.warn("[".concat(f(),"][").concat(t,"]:").concat(e))}function q(t,e){console.error({code:t,msg:"[".concat(f(),"][").concat(t,"]:").concat(e)})}function V(t,e){console.log("[".concat(f(),"][").concat(t,"]:").concat(e))}function J(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(f(),"][").concat(t,"]:").concat(e)}))}function $(t){var e,r=t.title,n=t.subtitle,o=void 0===n?"":n,a=t.content,i=void 0===a?[]:a,c=t.printTrace,s=void 0!==c&&c,u=t.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(r,o):(console.group||console.error)(r,o);for(var l=0,f=i;l<f.length;l++){var p=f[l],d=p.type,h=p.body;switch(d){case"info":console.log(h);break;case"warn":console.warn(h);break;case"error":console.error(h)}}s&&(console.trace||console.log)("stack trace:"),null===(e=console.groupEnd)||void 0===e||e.call(console)}var F=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))};function W(t){return"+86".concat(t)}var G=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach((function(t){var r=t.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(e[n]?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o)})),e};function H(t){var e={},r=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){t=r[1];var n=r[2];n&&(e=G(n))}var o=e.token,a=O(e,["token"]);return/^data:/.test(t)&&!o?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:o?{state:a.state,token:o,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}var Y,B=(Y=function(t,e){return(Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Y(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),K=function(){return(K=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},X=function(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function c(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))},Q=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},z=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,a=e.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=a||["get","post","upload","download"],r}return B(e,t),e.prototype.get=function(t){return this.request(K(K({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(K(K({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(K(K({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,o=t.method,a=t.headers,i=void 0===a?{}:a,c={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",s=new FormData;return"post"===c?(Object.keys(e).forEach((function(t){s.append(t,e[t])})),s.append("key",n),s.append("file",r),this.request(K(K({},t),{data:s,method:c}),this.restrictedMethods.includes("upload"))):this.request(K(K({},t),{method:"put",headers:i,body:r}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return X(this,void 0,void 0,(function(){var e,r,n,o;return Q(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(K(K({},t),{headers:{},responseType:"blob"}))];case 1:return e=a.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return X(this,void 0,void 0,(function(){var r,n,o,a,i,c,s,u,l,f,p,d,h,y=this;return Q(this,(function(v){switch(v.label){case 0:return r=new AbortController,n=t.url,o=t.enableAbort,a=void 0!==o&&o,i=t.stream,c=void 0!==i&&i,s=t.signal,u=t.timeout,l=t.shouldThrowOnError,f=void 0===l||l,p=null!=u?u:this.timeout,s&&(s.aborted&&r.abort(),s.addEventListener("abort",(function(){return r.abort()}))),d=null,a&&p&&(d=setTimeout((function(){console.warn(y.timeoutMsg),r.abort(new Error(y.timeoutMsg))}),p)),[4,fetch(n,K(K({},t),{signal:r.signal})).then((function(t){return X(y,void 0,void 0,(function(){var e,r,n;return Q(this,(function(o){switch(o.label){case 0:return clearTimeout(d),f?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return n=(r=Promise).reject,[4,t.json()];case 2:e=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){if(clearTimeout(d),f)return Promise.reject(t)}))];case 1:return h=v.sent(),[2,{data:c?h.body:(null===(e=h.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?h.json():h.text(),statusCode:h.status,header:h.headers}]}}))}))},e.prototype.request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(o){var a,i,c=t.url,s=t.headers,u=void 0===s?{}:s,l=t.data,f=t.responseType,p=t.withCredentials,d=t.body,y=t.onUploadProgress,v=R(h(),c,"get"===n?l:{}),b=new XMLHttpRequest;b.open(n,v),f&&(b.responseType=f),Object.keys(u).forEach((function(t){b.setRequestHeader(t,u[t])})),y&&b.upload.addEventListener("progress",y),b.onreadystatechange=function(){var t={};if(4===b.readyState){var e=b.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),o=e.join(": ");r[n]=o})),t.header=r,t.statusCode=b.status;try{t.data="blob"===f?b.response:JSON.parse(b.responseText)}catch(e){t.data="blob"===f?b.response:b.responseText}clearTimeout(a),o(t)}},e&&r.timeout&&(a=setTimeout((function(){console.warn(r.timeoutMsg),b.abort()}),r.timeout)),i=A(l)?l:"application/x-www-form-urlencoded"===u["content-type"]?k(l):d||(l?JSON.stringify(l):void 0),p&&(b.withCredentials=!0),b.send(i)}))},e}((function(){}));var Z,tt=function(){return(tt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function et(t,e){for(var r=0,n=E(t)?t:[t];r<n.length;r++){var o=n[r],a=o.isMatch,i=o.genAdapter,c=o.runtime;if(a())return{adapter:tt({isMatch:a},i(e)),runtime:c}}}function rt(){return{adapter:tt({},{type:"default",root:window,reqClass:z,wsClass:WebSocket,localStorage:localStorage}),runtime:Z.WEB}}!function(t){t.WEB="web",t.WX_MP="wx_mp"}(Z||(Z={}));var nt=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ot=function(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function c(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))},at=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},it=function(t){function e(e){var r=t.call(this)||this;return r.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return nt(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(w);var ct=function(){function t(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,o=t.keys,a=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(U(m.INVALID_PARAMS,"localStorage is not supported on current platform"),new it(e.root));case"none":return new it(e.root);default:return e.localStorage?e.localStorage:(U(m.INVALID_PARAMS,"localStorage is not supported on current platform"),new it(e.root))}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(n))}catch(t){throw new Error(JSON.stringify({code:m.OPERATION_FAIL,msg:"[".concat(f(),"][").concat(m.OPERATION_FAIL,"]setStore failed"),info:t}))}}else U(m.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,r){return ot(this,void 0,void 0,(function(){var n;return at(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var n=this.storage.getItem(t);return n&&n.indexOf(e)>=0?JSON.parse(n).content:""}U(m.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var r;return ot(this,void 0,void 0,(function(){var n;return at(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(n=o.sent())&&n.indexOf(e)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):U(m.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return ot(this,void 0,void 0,(function(){return at(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}(),st=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ut=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,a=e.length;o<a;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};var lt=function(t,e){this.data=e||null,this.name=t},ft=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return st(e,t),e}(lt),pt=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(j(t,ft))return console.error(t.error),this;var r=x(t)?new lt(t,e||{}):t,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,a=this.listeners[n]?ut([],this.listeners[n],!0):[];o<a.length;o++){a[o].call(this,r)}}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}(),dt=new pt;function ht(t,e){dt.on(t,e)}function yt(t,e){void 0===e&&(e={}),dt.fire(t,e)}function vt(t,e){dt.off(t,e)}var bt=new pt,mt="lang_change",gt=function(t,e,r,n){return new(r||(r=Promise))((function(o,a){function i(t){try{s(n.next(t))}catch(t){a(t)}}function c(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,c)}s((n=n.apply(t,e||[])).next())}))},wt=function(t,e){var r,n,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(s){return function(c){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(r=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=e.call(t,i)}catch(t){c=[6,t],n=0}finally{r=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}},Ot=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(Ot=-1!==navigator.userAgent.indexOf("Firefox"));var Et=Ot?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,xt=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function St(t){var e=t.mode,r=void 0===e?"async":e,n=t.customInfo,o=void 0===n?{}:n,a=t.title,i=t.messages,c=void 0===i?[]:i;return function(t,e,n){if(v){var i=o.className||t.constructor.name,s=o.methodName||e,u=n.value,l=function(t){var e="",r=t.stack.split("\n"),n=r.findIndex((function(t){return Et.test(t)}));if(-1!==n){var o=xt.exec(r[n+1]||"");e=o?o[0]:""}return e}(new Error);n.value="sync"===r?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=It({err:new Error,className:i,methodName:s,sourceLink:l});try{return u.apply(this,t)}catch(t){var n=t,o=t.message,f=t.error,p=t.error_description,d={title:a||"".concat(i,".").concat(s," failed"),content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var h=JSON.parse(o);d.subtitle=o,h.code&&(r?(r.code=h.code,r.msg=h.msg):(t.code=h.code,t.message=h.msg),n=r||t,d.content=c.map((function(t){return{type:"info",body:t}})))}throw f&&p&&(d.subtitle=p,r?(r.code=f,r.msg=p):(t.code=f,t.message=p),n=r||t,d.content=c.map((function(t){return{type:"info",body:t}}))),$(d),n}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return gt(this,void 0,void 0,(function(){var e,r,n,o,f,p,d,h;return wt(this,(function(y){switch(y.label){case 0:e=It({err:new Error,className:i,methodName:s,sourceLink:l}),y.label=1;case 1:return y.trys.push([1,3,,4]),[4,u.apply(this,t)];case 2:return[2,y.sent()];case 3:throw r=y.sent(),n=r,o=r.message,f=r.error,p=r.error_description,d={title:a||"".concat(i,".").concat(s," failed"),content:[{type:"error",body:r}]},o&&/^\{.*\}$/.test(o)&&(h=JSON.parse(o),d.subtitle=h,h.code&&(e?(e.code=h.code,e.message=h.msg):(r.code=h.code,r.message=h.msg),n=e||r,d.content=c.map((function(t){return{type:"info",body:t}})))),f&&p&&(d.subtitle=p,e?(e.code=f,e.msg=p):(r.code=f,r.message=p),n=e||r,d.content=c.map((function(t){return{type:"info",body:t}}))),$(d),n;case 4:return[2]}}))}))}}}}function It(t){var e=t.err,r=t.className,n=t.methodName,o=t.sourceLink;if(!o)return null;var a,i=e.stack.split("\n"),c=Ot?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),s=Ot?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),u=i.findIndex((function(t){return c.test(t)}));if(-1!==u){var l=i.filter((function(t,e){return e>u}));l.unshift(i[u].replace(s,"".concat(r,".").concat(n)).replace(xt,o)),(a=new Error).stack="".concat(Ot?"@debugger":"Error","\n").concat(l.join("\n"))}return a}const _t=function(){function t(){var t=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(e,r){"abort"===e&&t.listeners.push(r)}}}return t.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(t){return t()})))},t}();function jt(t){this.message=t}jt.prototype=new Error,jt.prototype.name="InvalidCharacterError";var At="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new jt("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,o=0,a=0,i="";n=e.charAt(a++);~n&&(r=o%4?64*r+n:n,o++%4)?i+=String.fromCharCode(255&r>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return i};function Nt(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(At(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return At(e)}}function Pt(t){this.message=t}Pt.prototype=new Error,Pt.prototype.name="InvalidTokenError";var Rt={decode:function(t,e){if("string"!=typeof t)throw new Pt("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(Nt(t.split(".")[r]))}catch(t){throw new Pt("Invalid token specified: "+t.message)}}};return e})());
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("tcbauth",[],e):"object"==typeof exports?exports.tcbauth=e():t.tcbauth=e()}("undefined"!=typeof window?window:this,()=>(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AbortController:()=>_t,adapters:()=>o,cache:()=>a,constants:()=>r,events:()=>c,helpers:()=>s,jwt:()=>Rt,langEvent:()=>i,utils:()=>n});var r={};t.r(r),t.d(r,{COMMUNITY_SITE_URL:()=>b,ERRORS:()=>m,IS_DEBUG_MODE:()=>v,OATUH_LOGINTYPE:()=>g,getProtocol:()=>h,getSdkName:()=>f,setProtocol:()=>d,setSdkName:()=>l});var n={};t.r(n),t.d(n,{createPromiseCallback:()=>M,execCallback:()=>D,formatUrl:()=>R,genSeqId:()=>N,generateRequestId:()=>P,getHash:()=>T,getQuery:()=>C,isArray:()=>E,isFormData:()=>A,isInstanceOf:()=>j,isNull:()=>_,isPalinObject:()=>I,isString:()=>x,isUndefined:()=>S,parseCaptcha:()=>H,parseQueryString:()=>G,printError:()=>q,printGroupLog:()=>$,printInfo:()=>V,printWarn:()=>U,removeParam:()=>L,sleep:()=>F,throwError:()=>J,toQueryString:()=>k,transformPhone:()=>W});var o={};t.r(o),t.d(o,{RUNTIME:()=>Z,useAdapters:()=>et,useDefaultAdapter:()=>rt});var a={};t.r(a),t.d(a,{CloudbaseCache:()=>it});var c={};t.r(c),t.d(c,{CloudbaseEvent:()=>lt,CloudbaseEventEmitter:()=>pt,IErrorEvent:()=>ft,activateEvent:()=>yt,addEventListener:()=>ht,removeEventListener:()=>vt});var i={};t.r(i),t.d(i,{LANG_CHANGE_EVENT:()=>mt,bus:()=>bt});var s={};t.r(s),t.d(s,{catchErrorsDecorator:()=>St});var u="@cloudbase/js-sdk";function l(t){u=t}function f(){return u}var p="https:";function d(t){p=t}function h(){return p}var y,v=("undefined"==typeof process||process.env,!1),b="https://support.qq.com/products/148793",m={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},g="constants";!function(t){t.local="local",t.none="none",t.session="session"}(y||(y={}));var w=function(){},O=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};function E(t){return"[object Array]"===Object.prototype.toString.call(t)}function x(t){return"string"==typeof t}function S(t){return void 0===t}function I(t){return"[object Object]"===Object.prototype.toString.call(t)}function _(t){return"[object Null]"===Object.prototype.toString.call(t)}function j(t,e){return t instanceof e}function A(t){return"[object FormData]"===Object.prototype.toString.call(t)}function N(){return Math.random().toString(16).slice(2)}function P(){var t=(new Date).getTime(),e=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return t>0?(n=(t+n)%16|0,t=Math.floor(t/16)):(n=(e+n)%16|0,e=Math.floor(e/16)),("x"===r?n:7&n|8).toString(16)}))}function R(t,e,r){void 0===r&&(r={});var n=/\?/.test(e),o="";return Object.keys(r).forEach((function(t){""===o?!n&&(e+="?"):o+="&",o+="".concat(t,"=").concat(encodeURIComponent(r[t]))})),/^http(s)?:\/\//.test(e+=o)?e:"".concat(t).concat(e)}function k(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(r){e.push("".concat(r,"=").concat(encodeURIComponent(t[r])))})),e.join("&")}function C(t,e){if("undefined"==typeof window)return!1;var r=e||decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(t,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""}var T=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]".concat(t,"=([^&#]*)")));return e?e[1]:""};function L(t,e){var r=e.split("?")[0],n=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var a=(n=o.split("&")).length-1;a>=0;a-=1)n[a].split("=")[0]===t&&n.splice(a,1);r="".concat(r,"?").concat(n.join("&"))}return r}function M(){var t={};if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var r=new Promise((function(e,r){t=function(t,n){return t?r(t):e(n)}}));return t.promise=r,t}function D(t,e,r){if(void 0===r&&(r=null),t&&"function"==typeof t)return t(e,r);if(e)throw e;return r}function U(t,e){console.warn("[".concat(f(),"][").concat(t,"]:").concat(e))}function q(t,e){console.error({code:t,msg:"[".concat(f(),"][").concat(t,"]:").concat(e)})}function V(t,e){console.log("[".concat(f(),"][").concat(t,"]:").concat(e))}function J(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(f(),"][").concat(t,"]:").concat(e)}))}function $(t){var e,r=t.title,n=t.subtitle,o=void 0===n?"":n,a=t.content,c=void 0===a?[]:a,i=t.printTrace,s=void 0!==i&&i,u=t.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(r,o):(console.group||console.error)(r,o);for(var l=0,f=c;l<f.length;l++){var p=f[l],d=p.type,h=p.body;switch(d){case"info":console.log(h);break;case"warn":console.warn(h);break;case"error":console.error(h)}}s&&(console.trace||console.log)("stack trace:"),null===(e=console.groupEnd)||void 0===e||e.call(console)}var F=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))};function W(t){return"+86".concat(t)}var G=function(t){t=t.replace(/^\?/,"");var e={};return t.split("&").forEach((function(t){var r=t.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(e[n]?Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]:e[n]=o)})),e};function H(t){var e={},r=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){t=r[1];var n=r[2];n&&(e=G(n))}var o=e.token,a=O(e,["token"]);return/^data:/.test(t)&&!o?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(t)}:o?{state:a.state,token:o,captchaData:t}:{error:"unimplemented",error_description:"need to impl captcha data"}}var Y,B=(Y=function(t,e){return(Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}Y(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),K=function(){return(K=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},X=function(t,e,r,n){return new(r||(r=Promise))((function(o,a){function c(t){try{s(n.next(t))}catch(t){a(t)}}function i(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(c,i)}s((n=n.apply(t,e||[])).next())}))},Q=function(t,e){var r,n,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(c=0)),c;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=e.call(t,c)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},z=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,o=e.timeoutMsg,a=e.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=a||["get","post","upload","download"],r}return B(e,t),e.prototype.get=function(t){return this.request(K(K({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(K(K({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(K(K({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,o=t.method,a=t.headers,c=void 0===a?{}:a,i={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",s=new FormData;return"post"===i?(Object.keys(e).forEach((function(t){s.append(t,e[t])})),s.append("key",n),s.append("file",r),this.request(K(K({},t),{data:s,method:i}),this.restrictedMethods.includes("upload"))):this.request(K(K({},t),{method:"put",headers:c,body:r}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return X(this,void 0,void 0,(function(){var e,r,n,o;return Q(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(K(K({},t),{headers:{},responseType:"blob"}))];case 1:return e=a.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return a.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return X(this,void 0,void 0,(function(){var r,n,o,a,c,i,s,u,l,f,p,d,h,y=this;return Q(this,(function(v){switch(v.label){case 0:return r=new AbortController,n=t.url,o=t.enableAbort,a=void 0!==o&&o,c=t.stream,i=void 0!==c&&c,s=t.signal,u=t.timeout,l=t.shouldThrowOnError,f=void 0===l||l,p=null!=u?u:this.timeout,s&&(s.aborted&&r.abort(),s.addEventListener("abort",(function(){return r.abort()}))),d=null,a&&p&&(d=setTimeout((function(){console.warn(y.timeoutMsg),r.abort(new Error(y.timeoutMsg))}),p)),[4,fetch(n,K(K({},t),{signal:r.signal})).then((function(t){return X(y,void 0,void 0,(function(){var e,r,n;return Q(this,(function(o){switch(o.label){case 0:return clearTimeout(d),f?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return n=(r=Promise).reject,[4,t.json()];case 2:e=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){if(clearTimeout(d),f)return Promise.reject(t)}))];case 1:return h=v.sent(),[2,{data:i?h.body:(null===(e=h.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?h.json():h.text(),statusCode:h.status,header:h.headers}]}}))}))},e.prototype.request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise((function(o){var a,c,i=t.url,s=t.headers,u=void 0===s?{}:s,l=t.data,f=t.responseType,p=t.withCredentials,d=t.body,y=t.onUploadProgress,v=R(h(),i,"get"===n?l:{}),b=new XMLHttpRequest;b.open(n,v),f&&(b.responseType=f),Object.keys(u).forEach((function(t){b.setRequestHeader(t,u[t])})),y&&b.upload.addEventListener("progress",y),b.onreadystatechange=function(){var t={};if(4===b.readyState){var e=b.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach((function(t){var e=t.split(": "),n=e.shift().toLowerCase(),o=e.join(": ");r[n]=o})),t.header=r,t.statusCode=b.status;try{t.data="blob"===f?b.response:JSON.parse(b.responseText)}catch(e){t.data="blob"===f?b.response:b.responseText}clearTimeout(a),o(t)}},e&&r.timeout&&(a=setTimeout((function(){console.warn(r.timeoutMsg),b.abort()}),r.timeout)),c=A(l)?l:"application/x-www-form-urlencoded"===u["content-type"]?k(l):d||(l?JSON.stringify(l):void 0),p&&(b.withCredentials=!0),b.send(c)}))},e}((function(){}));var Z,tt=function(){return(tt=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function et(t,e){for(var r=0,n=E(t)?t:[t];r<n.length;r++){var o=n[r],a=o.isMatch,c=o.genAdapter,i=o.runtime;if(a())return{adapter:tt({isMatch:a},c(e)),runtime:i}}}function rt(){return{adapter:tt({},{type:"default",root:window,reqClass:z,wsClass:WebSocket,localStorage:localStorage}),runtime:Z.WEB}}!function(t){t.WEB="web",t.WX_MP="wx_mp"}(Z||(Z={}));var nt=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ot=function(t,e,r,n){return new(r||(r=Promise))((function(o,a){function c(t){try{s(n.next(t))}catch(t){a(t)}}function i(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(c,i)}s((n=n.apply(t,e||[])).next())}))},at=function(t,e){var r,n,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(c=0)),c;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=e.call(t,c)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},ct=function(t){function e(e){var r=t.call(this)||this;return r.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),r}return nt(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(w);var it=function(){function t(t){this.keys={};var e=t.persistence,r=t.platformInfo,n=void 0===r?{}:r,o=t.keys,a=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(U(m.INVALID_PARAMS,"localStorage is not supported on current platform"),new ct(e.root));case"none":return new ct(e.root);default:return e.localStorage?e.localStorage:(U(m.INVALID_PARAMS,"localStorage is not supported on current platform"),new ct(e.root))}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(n))}catch(t){throw new Error(JSON.stringify({code:m.OPERATION_FAIL,msg:"[".concat(f(),"][").concat(m.OPERATION_FAIL,"]setStore failed"),info:t}))}}else U(m.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,r){return ot(this,void 0,void 0,(function(){var n;return at(this,(function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var n=this.storage.getItem(t);return n&&n.indexOf(e)>=0?JSON.parse(n).content:""}U(m.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var r;return ot(this,void 0,void 0,(function(){var n;return at(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(n=o.sent())&&n.indexOf(e)>=0?[2,JSON.parse(n).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):U(m.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return ot(this,void 0,void 0,(function(){return at(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}(),st=function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),ut=function(t,e,r){if(r||2===arguments.length)for(var n,o=0,a=e.length;o<a;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))};var lt=function(t,e){this.data=e||null,this.name=t},ft=function(t){function e(e,r){var n=t.call(this,"error",{error:e,data:r})||this;return n.error=e,n}return st(e,t),e}(lt),pt=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,r){r[t]=r[t]||[],r[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,r){if(null==r?void 0:r[t]){var n=r[t].indexOf(e);-1!==n&&r[t].splice(n,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(j(t,ft))return console.error(t.error),this;var r=x(t)?new lt(t,e||{}):t,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,a=this.listeners[n]?ut([],this.listeners[n],!0):[];o<a.length;o++){a[o].call(this,r)}}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}(),dt=new pt;function ht(t,e){dt.on(t,e)}function yt(t,e){void 0===e&&(e={}),dt.fire(t,e)}function vt(t,e){dt.off(t,e)}var bt=new pt,mt="lang_change",gt=function(t,e,r,n){return new(r||(r=Promise))((function(o,a){function c(t){try{s(n.next(t))}catch(t){a(t)}}function i(t){try{s(n.throw(t))}catch(t){a(t)}}function s(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(c,i)}s((n=n.apply(t,e||[])).next())}))},wt=function(t,e){var r,n,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(c=0)),c;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return c.label++,{value:i[1],done:!1};case 5:c.label++,n=i[1],i=[0];continue;case 7:i=c.ops.pop(),c.trys.pop();continue;default:if(!(o=c.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){c=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){c.label=i[1];break}if(6===i[0]&&c.label<o[1]){c.label=o[1],o=i;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(i);break}o[2]&&c.ops.pop(),c.trys.pop();continue}i=e.call(t,c)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Ot=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(Ot=-1!==navigator.userAgent.indexOf("Firefox"));var Et=Ot?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,xt=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function St(t){var e=t.mode,r=void 0===e?"async":e,n=t.customInfo,o=void 0===n?{}:n,a=t.title,c=t.messages,i=void 0===c?[]:c;return function(t,e,n){if(v){var c=o.className||t.constructor.name,s=o.methodName||e,u=n.value,l=function(t){var e="",r=t.stack.split("\n"),n=r.findIndex((function(t){return Et.test(t)}));if(-1!==n){var o=xt.exec(r[n+1]||"");e=o?o[0]:""}return e}(new Error);n.value="sync"===r?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=It({err:new Error,className:c,methodName:s,sourceLink:l});try{return u.apply(this,t)}catch(t){var n=t,o=t.message,f=t.error,p=t.error_description,d={title:a||"".concat(c,".").concat(s," failed"),content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var h=JSON.parse(o);d.subtitle=o,h.code&&(r?(r.code=h.code,r.msg=h.msg):(t.code=h.code,t.message=h.msg),n=r||t,d.content=i.map((function(t){return{type:"info",body:t}})))}throw f&&p&&(d.subtitle=p,r?(r.code=f,r.msg=p):(t.code=f,t.message=p),n=r||t,d.content=i.map((function(t){return{type:"info",body:t}}))),$(d),n}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return gt(this,void 0,void 0,(function(){var e,r,n,o,f,p,d,h;return wt(this,(function(y){switch(y.label){case 0:e=It({err:new Error,className:c,methodName:s,sourceLink:l}),y.label=1;case 1:return y.trys.push([1,3,,4]),[4,u.apply(this,t)];case 2:return[2,y.sent()];case 3:throw r=y.sent(),n=r,o=r.message,f=r.error,p=r.error_description,d={title:a||"".concat(c,".").concat(s," failed"),content:[{type:"error",body:r}]},o&&/^\{.*\}$/.test(o)&&(h=JSON.parse(o),d.subtitle=h,h.code&&(e?(e.code=h.code,e.message=h.msg):(r.code=h.code,r.message=h.msg),n=e||r,d.content=i.map((function(t){return{type:"info",body:t}})))),f&&p&&(d.subtitle=p,e?(e.code=f,e.msg=p):(r.code=f,r.message=p),n=e||r,d.content=i.map((function(t){return{type:"info",body:t}}))),$(d),n;case 4:return[2]}}))}))}}}}function It(t){var e=t.err,r=t.className,n=t.methodName,o=t.sourceLink;if(!o)return null;var a,c=e.stack.split("\n"),i=Ot?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),s=Ot?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),u=c.findIndex((function(t){return i.test(t)}));if(-1!==u){var l=c.filter((function(t,e){return e>u}));l.unshift(c[u].replace(s,"".concat(r,".").concat(n)).replace(xt,o)),(a=new Error).stack="".concat(Ot?"@debugger":"Error","\n").concat(l.join("\n"))}return a}const _t=function(){function t(){var t=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(e,r){"abort"===e&&t.listeners.push(r)}}}return t.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(t){return t()})))},t}();function jt(t){this.message=t}jt.prototype=new Error,jt.prototype.name="InvalidCharacterError";var At="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new jt("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,o=0,a=0,c="";n=e.charAt(a++);~n&&(r=o%4?64*r+n:n,o++%4)?c+=String.fromCharCode(255&r>>(-2*o&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return c};function Nt(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(At(t).replace(/(.)/g,(function(t,e){var r=e.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(e)}catch(t){return At(e)}}function Pt(t){this.message=t}Pt.prototype=new Error,Pt.prototype.name="InvalidTokenError";var Rt={decode:function(t,e){if("string"!=typeof t)throw new Pt("Invalid token specified");var r=!0===(e=e||{}).header?0:1;try{return JSON.parse(Nt(t.split(".")[r]))}catch(t){throw new Pt("Invalid token specified: "+t.message)}}};return e})());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/utilities",
|
|
3
|
-
"version": "2.25.
|
|
3
|
+
"version": "2.25.2",
|
|
4
4
|
"description": "cloudbase javascript sdk utilities",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@cloudbase/adapter-interface": "^0.7.1",
|
|
29
|
-
"@cloudbase/types": "2.25.
|
|
29
|
+
"@cloudbase/types": "2.25.2",
|
|
30
30
|
"jwt-decode": "^3.1.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.5.4"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "a969396226f0243d84c914ebda039e58a1158674"
|
|
36
36
|
}
|
package/src/constants/common.ts
CHANGED
|
@@ -16,6 +16,6 @@ export function getProtocol() {
|
|
|
16
16
|
return PROTOCOL
|
|
17
17
|
}
|
|
18
18
|
// 是否为开发模式
|
|
19
|
-
export const IS_DEBUG_MODE = process.env.NODE_ENV === 'development'
|
|
19
|
+
export const IS_DEBUG_MODE = typeof process === 'undefined' || typeof process.env === 'undefined' ? false : process.env.NODE_ENV === 'development'
|
|
20
20
|
// 问答社区链接
|
|
21
21
|
export const COMMUNITY_SITE_URL = 'https://support.qq.com/products/148793'
|