@cloudbase/js-sdk 2.5.15-beta.0 → 2.5.17-beta.0

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.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_oauth",[],t):"object"==typeof exports?exports.cloudbase_oauth=t():e.cloudbase_oauth=t()}("undefined"!=typeof window?window:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(2),t)},function(e,t,n){"use strict";var r,i;function o(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}n.r(t),n.d(t,"Syntax",(function(){return r})),n.d(t,"ErrorType",(function(){return i})),n.d(t,"defaultStorage",(function(){return _})),n.d(t,"defaultRequest",(function(){return h})),n.d(t,"toResponseError",(function(){return f})),n.d(t,"generateRequestId",(function(){return p})),n.d(t,"OAuth2Client",(function(){return I})),n.d(t,"AuthClient",(function(){return O})),n.d(t,"Auth",(function(){return w})),n.d(t,"authModels",(function(){return U})),n.d(t,"CloudbaseOAuth",(function(){return N})),function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(r||(r={})),function(e){e.UNREACHABLE="unreachable",e.LOCAL="local",e.CANCELLED="cancelled",e.UNKNOWN="unknown",e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.UNAUTHENTICATED="unauthenticated",e.RESOURCE_EXHAUSTED="resource_exhausted",e.FAILED_PRECONDITION="failed_precondition",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid",e.INVALID_PASSWORD="invalid_password",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked",e.INVALID_VERIFICATION_CODE="invalid_verification_code",e.TWO_FACTOR_REQUIRED="two_factor_required",e.INVALID_TWO_FACTOR="invalid_two_factor",e.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",e.UNDER_REVIEW="under_review",e.INVALID_REQUEST="invalid_request",e.UNAUTHORIZED_CLIENT="unauthorized_client",e.ACCESS_DENIED="access_denied",e.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",e.INVALID_SCOPE="invalid_scope",e.INVALID_GRANT="invalid_grant",e.SERVER_ERROR="server_error",e.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",e.INTERACTION_REQUIRED="interaction_required",e.LOGIN_REQUIRED="login_required",e.ACCOUNT_SELECTION_REQUIRED="account_selection_required",e.CONSENT_REQUIRED="consent_required",e.INVALID_REQUEST_URI="invalid_request_uri",e.INVALID_REQUEST_OBJECT="invalid_request_object",e.REQUEST_NOT_SUPPORTED="request_not_supported",e.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",e.REGISTRATION_NOT_SUPPORTED="registration_not_supported"}(i||(i={}));var s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},u=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},a=function(){function e(){this.fnPromiseMap=new Map}return e.prototype.run=function(e,t){return s(this,void 0,void 0,(function(){var n,r=this;return u(this,(function(i){switch(i.label){case 0:return[4,n=this.fnPromiseMap.get(e)];case 1:return i.sent()||(n=new Promise((function(n,i){s(r,void 0,void 0,(function(){var r,o,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return u.sent(),r=t(),o=n,[4,r];case 2:return o.apply(void 0,[u.sent()]),[3,5];case 3:return s=u.sent(),i(s),[3,5];case 4:return this.fnPromiseMap.delete(e),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(e,n)),[2,n]}}))}))},e.prototype.runIdlePromise=function(){return Promise.resolve()},e}(),c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},l=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},d=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},h=function(e,t){return l(this,void 0,void 0,(function(){var n,r,o,s,u;return d(this,(function(a){switch(a.label){case 0:n=null,r=null,a.label=1;case 1:return a.trys.push([1,4,,5]),(o=Object.assign({},t)).method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body)),[4,fetch(e,o)];case 2:return[4,a.sent().json()];case 3:return(null==(s=a.sent())?void 0:s.error)?(r=s).error_uri=new URL(e).pathname:n=s,[3,5];case 4:return u=a.sent(),r={error:i.UNREACHABLE,error_description:u.message,error_uri:new URL(e).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},f=function(e,t){var n,r=t||{};if(e instanceof Error)n={error:r.error||i.LOCAL,error_description:r.error_description||e.message,error_uri:r.error_uri,details:r.details||e.stack};else{var o=e||{};n={error:r.error||o.error||i.LOCAL,error_description:r.error_description||o.error_description,error_uri:r.error_uri||o.error_uri,details:r.details||o.details}}return n};function p(){return o()}var _=new(function(){function e(){}return e.prototype.getItem=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return[2,window.localStorage.getItem(e)]}))}))},e.prototype.removeItem=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return window.localStorage.removeItem(e),[2]}))}))},e.prototype.setItem=function(e,t){return l(this,void 0,void 0,(function(){return d(this,(function(n){return window.localStorage.setItem(e,t),[2]}))}))},e.prototype.getItemSync=function(e){return window.localStorage.getItem(e)},e.prototype.removeItemSync=function(e){window.localStorage.removeItem(e)},e.prototype.setItemSync=function(e,t){window.localStorage.setItem(e,t)},e}());function v(e){var t=!0;return(null==e?void 0:e.expires_at)&&(null==e?void 0:e.access_token)&&(t=e.expires_at<new Date),t}var y,E,g,R=function(){function e(e){this.credentials=null,this.singlePromise=new a,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage}return e.prototype.getStorageCredentialsSync=function(){var e=null,t=this.storage.getItemSync(this.tokenSectionName);if(null!=t)try{(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at))}catch(t){this.storage.removeItem(this.tokenSectionName),e=null}return e},e.prototype.setCredentials=function(e){return l(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return(null==e?void 0:e.expires_in)?(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30)),this.storage?(t=JSON.stringify(e),[4,this.storage.setItem(this.tokenSectionName,t)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=e,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:n.sent(),n.label=5;case 5:this.credentials=null,n.label=6;case 6:return[2]}}))}))},e.prototype.getCredentials=function(){return l(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return[2,this.singlePromise.run("getCredentials",(function(){return l(e,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return v(this.credentials)?(e=this,[4,this.getStorageCredentials()]):[3,2];case 1:e.credentials=t.sent(),t.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},e.prototype.getStorageCredentials=function(){return l(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return l(e,void 0,void 0,(function(){var e,t;return d(this,(function(n){switch(n.label){case 0:return e=null,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(null==(t=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),e=null,[3,5];case 5:return[2,e]}}))}))}))]}))}))},e}(),I=function(){function e(t){this.singlePromise=new a,this.apiOrigin=t.apiOrigin,this.clientId=t.clientId,this.retry=this.formatRetry(t.retry,e.defaultRetry),t.baseRequest?this.baseRequest=t.baseRequest:this.baseRequest=h,this.tokenInURL=t.tokenInURL,this.headers=t.headers,this.storage=t.storage||_,this.localCredentials=new R({tokenSectionName:"credentials_"+t.clientId,storage:this.storage}),this.clientSecret=t.clientSecret,this.refreshTokenFunc=t.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=t.anonymousSignInFunc}return e.prototype.setCredentials=function(e){return this.localCredentials.setCredentials(e)},e.prototype.getAccessToken=function(){return l(this,void 0,void 0,(function(){var e,t;return d(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(e=n.sent())?void 0:e.access_token)?[2,Promise.resolve(e.access_token)]:(t={error:i.UNAUTHENTICATED},[2,Promise.reject(t)])}}))}))},e.prototype.request=function(t,n){return l(this,void 0,void 0,(function(){var r,o,s,u,a,l,h;return d(this,(function(d){switch(d.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=c(c({},this.headers),n.headers)),n.headers["x-request-id"]||(n.headers["x-request-id"]=p()),n.headers["x-device-id"]?[3,2]:[4,this.getDeviceId()];case 1:o=d.sent(),n.headers["x-device-id"]=o,d.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(s=d.sent())&&(this.tokenInURL?(t.indexOf("?")<0&&(t+="?"),t+="access_token="+s.access_token):n.headers.Authorization=s.token_type+" "+s.access_token),[3,5];case 4:this.clientId&&t.indexOf("client_id")<0&&(t+=t.indexOf("?")<0?"?":"&",t+="client_id="+this.clientId),d.label=5;case 5:t.startsWith("/")&&(t=this.apiOrigin+t),u=null,a=r+1,l=0,d.label=6;case 6:if(!(l<a))return[3,15];d.label=7;case 7:return d.trys.push([7,9,,12]),[4,this.baseRequest(t,n)];case 8:return u=d.sent(),[3,15];case 9:return h=d.sent(),n.withCredentials&&h&&h.error===i.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return d.sent(),[2,Promise.reject(h)];case 11:return l!==r&&h&&"unreachable"===h.error?[3,12]:[2,Promise.reject(h)];case 12:return[4,this.sleep(e.retryInterval)];case 13:d.sent(),d.label=14;case 14:return l++,[3,6];case 15:return[2,u]}}))}))},e.prototype.getCredentials=function(){return l(this,void 0,void 0,(function(){var e,t,n;return d(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return v(e=r.sent())?e&&"anonymous"===e.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(e)]:[3,5]:[3,8]:[3,10];case 2:return t=r.sent(),(n=t)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return e=n,[3,7];case 5:return[4,this.anonymousSignIn(e)];case 6:e=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(e)];case 9:e=r.sent(),r.label=10;case 10:return[2,e]}}))}))},e.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},e.prototype.getCredentialsAsync=function(){return this.localCredentials.getCredentials()},e.prototype.getScope=function(){return l(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(e=t.sent())?[2,e.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},e.prototype.getGroups=function(){return l(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(e=t.sent())?[2,e.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},e.prototype.checkRetry=function(t){var n=null;if(("number"!=typeof t||t<e.minRetry||t>e.maxRetry)&&(n={error:i.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return t},e.prototype.formatRetry=function(e,t){return void 0===e?t:this.checkRetry(e)},e.prototype.sleep=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return[2,new Promise((function(t){setTimeout((function(){t()}),e)}))]}))}))},e.prototype.refreshToken=function(e){return l(this,void 0,void 0,(function(){var t=this;return d(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return l(t,void 0,void 0,(function(){var t,n;return d(this,(function(r){switch(r.label){case 0:if(!e||!e.refresh_token)return[2,this.unAuthenticatedError("no refresh token found in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.refreshTokenFunc(e.refresh_token)];case 2:return t=r.sent(),[4,this.localCredentials.setCredentials(t)];case 3:return r.sent(),[2,t];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},e.prototype.anonymousSignIn=function(e){return l(this,void 0,void 0,(function(){var t=this;return d(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return l(t,void 0,void 0,(function(){var t,n;return d(this,(function(r){switch(r.label){case 0:if(!e||"anonymous"!==e.scope)return[2,this.unAuthenticatedError("no anonymous in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret}})];case 2:return t=r.sent(),[4,this.localCredentials.setCredentials(t)];case 3:return r.sent(),[2,t];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},e.prototype.defaultRefreshTokenFunc=function(e){return void 0===e||""===e?this.unAuthenticatedError("refresh token not found"):this.request("/auth/v1/token",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:e}})},e.prototype.getDeviceId=function(){return l(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem("device_id")];case 1:return"string"==typeof(e=t.sent())&&e.length>=16&&e.length<=48?[3,3]:(e=o(),[4,this.storage.setItem("device_id",e)]);case 2:t.sent(),t.label=3;case 3:return this.deviceID=e,[2,e]}}))}))},e.prototype.unAuthenticatedError=function(e){var t={error:i.UNAUTHENTICATED,error_description:e};return Promise.reject(t)},e.defaultRetry=2,e.minRetry=0,e.maxRetry=5,e.retryInterval=1e3,e}();!function(e){e.AUTH_SIGN_IN_URL="/auth/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",e.AUTH_SIGN_UP_URL="/auth/v1/signup",e.AUTH_TOKEN_URL="/auth/v1/token",e.AUTH_REVOKE_URL="/auth/v1/revoke",e.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",e.PROVIDER_TOKEN_URL="/auth/v1/provider/token",e.PROVIDER_URI_URL="/auth/v1/provider/uri",e.USER_ME_URL="/auth/v1/user/me",e.USER_QUERY_URL="/auth/v1/user/query",e.USER_PRIFILE_URL="/auth/v1/user/profile",e.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",e.VERIFICATION_URL="/auth/v1/verification",e.VERIFY_URL="/auth/v1/verification/verify",e.PROVIDER_LIST="/auth/v1/user/provider",e.PROVIDER_UNBIND_URL="/auth/v1/user/provider",e.CHECK_PWD_URL="/auth/v1/user/sudo",e.SUDO_URL="/auth/v1/user/sudo",e.BIND_CONTACT_URL="/auth/v1/user/contact",e.AUTH_SET_PASSWORD="/auth/v1/user/password",e.AUTH_RESET_PASSWORD="/auth/v1/reset",e.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",e.CHECK_USERNAME="/auth/v1/checkUsername",e.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist"}(y||(y={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(E||(E={})),function(e){e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid",e.INVALID_PASSWORD="invalid_password",e.PASSWORD_NOT_SET="password_not_set",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked"}(g||(g={}));var S=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},T=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},b=function(){function e(e){e.openURIWithCallback||(e.openURIWithCallback=this.getDefaultOpenURIWithCallback()),e.storage||(e.storage=_),this.config=e,this.tokenSectionName="captcha_"+e.clientId}return e.prototype.request=function(e,t){return S(this,void 0,void 0,(function(){var n,r,i,o;return T(this,(function(s){switch(s.label){case 0:return t||(t={}),t.method||(t.method="GET"),n=t.method+":"+e,r=e,t.withCaptcha?[4,this.appendCaptchaTokenToURL(e,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,t)];case 3:return i=s.sent(),[3,7];case 4:return"captcha_required"!==(o=s.sent()).error&&"captcha_invalid"!==o.error?[3,6]:[4,this.appendCaptchaTokenToURL(e,n,"captcha_invalid"===o.error)];case 5:return e=s.sent(),[2,this.config.request(e,t)];case 6:return[2,Promise.reject(o)];case 7:return[2,i]}}))}))},e.prototype.getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var e=document.createElement("div");e.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",e.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(e)}),0)}return this.defaultOpenURIWithCallback},e.prototype.defaultOpenURIWithCallback=function(e){return S(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){return t=document.getElementById("captcha_panel_wrap"),n=document.createElement("iframe"),t.innerHTML="",n.setAttribute("src",e),n.setAttribute("id","review-panel-iframe"),n.style.cssText="min-width:355px;display:block;height:355px;margin:0 auto;background-color: rgb(255, 255, 255);border: none;",t.appendChild(n),t.style.display="block",[2,new Promise((function(e,r){n.onload=function(){try{var i=window.location,o=n.contentWindow.location;if(o.host+o.pathname===i.host+i.pathname){t.style.display="none";var s=new URLSearchParams(o.search),u=s.get("captcha_token");return u?e({captcha_token:u,expires_in:Number(s.get("expires_in"))}):r({error:s.get("error"),error_description:s.get("error_description")})}t.style.display="block"}catch(e){t.style.display="block"}}}))]}))}))},e.prototype.getCaptchaToken=function(e,t){return S(this,void 0,void 0,(function(){var n,r,i,o,s;return T(this,(function(u){switch(u.label){case 0:return e?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=u.sent())return[2,n];u.label=2;case 2:return r=window.location.origin+window.location.pathname+"?__captcha=on",[4,this.config.request("/auth/v1/captcha/init",{method:"POST",body:{client_id:this.config.clientId,redirect_uri:r,state:t},withCredentials:!1})];case 3:return(i=u.sent()).captcha_token?(o={captcha_token:i.captcha_token,expires_in:i.expires_in},this.saveCaptchaToken(o),[2,i.captcha_token]):[4,this.config.openURIWithCallback(i.url)];case 4:return s=u.sent(),this.saveCaptchaToken(s),[2,s.captcha_token]}}))}))},e.prototype.appendCaptchaTokenToURL=function(e,t,n){return S(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,t)];case 1:return r=i.sent(),e.indexOf("?")>0?e+="&captcha_token="+r:e+="?captcha_token="+r,[2,e]}}))}))},e.prototype.saveCaptchaToken=function(e){return S(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10)),t=JSON.stringify(e),[4,this.config.storage.setItem(this.tokenSectionName,t)];case 1:return n.sent(),[2]}}))}))},e.prototype.findCaptchaToken=function(){return S(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if(null==(e=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?[2,null]:[2,t.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}}))}))},e}(),m=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},C=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},w=function(){function e(e){var t=e.request,n=e.credentialsClient;if(!n){var r={apiOrigin:e.apiOrigin,clientId:e.clientId,storage:e.storage};n=new I(r)}if(!t){var i=n.request.bind(n),o=new b({clientId:e.clientId,request:i,storage:e.storage});t=o.request.bind(o)}this.config={apiOrigin:e.apiOrigin,clientId:e.clientId,request:t,credentialsClient:n,storage:e.storage||_}}return e.parseParamsToSearch=function(e){return Object.keys(e).forEach((function(t){e[t]||delete e[t]})),new URLSearchParams(e).toString()},e.prototype.signIn=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_IN_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signInAnonymously=function(e){return void 0===e&&(e={}),m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signUp=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_UP_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signOut=function(){return m(this,void 0,void 0,(function(){var e,t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return e=n.sent(),[4,this.config.request(y.AUTH_REVOKE_URL,{method:"POST",body:{token:e}})];case 2:return t=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.getVerification=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return t=!1,"CUR_USER"!==e.target?[3,1]:(t=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(t=!0),n.label=3;case 3:return[2,this.config.request(y.VERIFICATION_URL,{method:"POST",body:e,withCaptcha:!0,withCredentials:t})]}}))}))},e.prototype.verify=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.VERIFY_URL,{method:"POST",body:e})]}))}))},e.prototype.genProviderRedirectUri=function(e){return m(this,void 0,void 0,(function(){var t,n;return C(this,(function(r){return t=y.PROVIDER_URI_URL+"?client_id="+this.config.clientId+"&provider_id="+e.provider_id+"&redirect_uri="+encodeURIComponent(e.provider_redirect_uri)+"&state="+e.state,(n=e.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(t+="&other_params[sign_out_uri]="+n.sign_out_uri),[2,this.config.request(t,{method:"GET"})]}))}))},e.prototype.grantProviderToken=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.patchProviderToken=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})]}))}))},e.prototype.signInWithProvider=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_IN_WITH_PROVIDER_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.bindWithProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0})]}))}))},e.prototype.getUserProfile=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.getUserInfo()]}))}))},e.prototype.getUserInfo=function(){return m(this,void 0,void 0,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return[4,this.config.request(y.USER_ME_URL,{method:"GET",withCredentials:!0})];case 1:return(e=t.sent()).sub&&(e.uid=e.sub),[2,e]}}))}))},e.prototype.deleteMe=function(t){return m(this,void 0,void 0,(function(){var n;return C(this,(function(r){return n=y.USER_ME_URL+"?"+e.parseParamsToSearch(t),[2,this.config.request(n,{method:"DELETE",withCredentials:!0})]}))}))},e.prototype.hasLoginState=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},e.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},e.prototype.getLoginState=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},e.prototype.transByProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.grantToken=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.AUTH_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.getProviders=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.request(y.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},e.prototype.unbindProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_UNBIND_URL+"/"+e.provider_id,{method:"DELETE",withCredentials:!0})]}))}))},e.prototype.checkPassword=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.CHECK_PWD_URL,{method:"POST",withCredentials:!0,body:e})]}))}))},e.prototype.bindPhone=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.BIND_CONTACT_URL,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.bindEmail=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.BIND_CONTACT_URL,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.setPassword=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.AUTH_SET_PASSWORD,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.updatePasswordByOld=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:e.old_password})];case 1:return t=n.sent(),[2,this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})]}}))}))},e.prototype.sudo=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.SUDO_URL,{method:"POST",withCredentials:!0,body:e})]}))}))},e.prototype.getCurUserVerification=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return e.target="CUR_USER",[2,this.config.request(y.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})]}))}))},e.prototype.changeBindedProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_LIST+"/"+e.provider_id+"/trans",{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})]}))}))},e.prototype.setUserProfile=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.queryUserProfile=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){return t=new URLSearchParams(e),[2,this.config.request(y.USER_QUERY_URL+"?"+t.toString(),{method:"GET",withCredentials:!0})]}))}))},e.prototype.setCustomSignFunc=function(e){this.getCustomSignTicketFn=e},e.prototype.signInWithCustomTicket=function(){return m(this,void 0,void 0,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=t.sent(),[2,this.signInWithProvider({provider_id:"custom",provider_token:e})]}}))}))},e.prototype.resetPassword=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.AUTH_RESET_PASSWORD,{method:"POST",body:e})]}))}))},e.prototype.deviceAuthorize=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})]}))}))},e.prototype.checkUsername=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})]}))}))},e.prototype.checkIfUserExist=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){return t=new URLSearchParams(e),[2,this.config.request(y.CHECK_IF_USER_EXIST+"?"+t.toString(),{method:"GET"})]}))}))},e.prototype.loginScope=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.credentialsClient.getScope()]}))}))},e.prototype.loginGroups=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.credentialsClient.getGroups()]}))}))},e}(),U=n(0),O=function(){},A=function(){return(A=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},N=function(e){var t=e.apiOrigin,n=e.clientId,r=e.storage,i=e.request,o=e.anonymousSignInFunc;this.oauth2client=new I({apiOrigin:t,clientId:n,storage:r,baseRequest:i,anonymousSignInFunc:o}),this.authApi=new w(A(A({credentialsClient:this.oauth2client},e),{request:i?this.oauth2client.request.bind(this.oauth2client):void 0}))}}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_oauth",[],t):"object"==typeof exports?exports.cloudbase_oauth=t():e.cloudbase_oauth=t()}("undefined"!=typeof window?window:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){},function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||t.hasOwnProperty(n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(2),t)},function(e,t,n){"use strict";var r,i;function o(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}n.r(t),n.d(t,"Syntax",(function(){return r})),n.d(t,"ErrorType",(function(){return i})),n.d(t,"defaultStorage",(function(){return _})),n.d(t,"defaultRequest",(function(){return h})),n.d(t,"toResponseError",(function(){return f})),n.d(t,"generateRequestId",(function(){return p})),n.d(t,"OAuth2Client",(function(){return I})),n.d(t,"AuthClient",(function(){return O})),n.d(t,"Auth",(function(){return w})),n.d(t,"authModels",(function(){return U})),n.d(t,"CloudbaseOAuth",(function(){return N})),function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(r||(r={})),function(e){e.UNREACHABLE="unreachable",e.LOCAL="local",e.CANCELLED="cancelled",e.UNKNOWN="unknown",e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.UNAUTHENTICATED="unauthenticated",e.RESOURCE_EXHAUSTED="resource_exhausted",e.FAILED_PRECONDITION="failed_precondition",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid",e.INVALID_PASSWORD="invalid_password",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked",e.INVALID_VERIFICATION_CODE="invalid_verification_code",e.TWO_FACTOR_REQUIRED="two_factor_required",e.INVALID_TWO_FACTOR="invalid_two_factor",e.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",e.UNDER_REVIEW="under_review",e.INVALID_REQUEST="invalid_request",e.UNAUTHORIZED_CLIENT="unauthorized_client",e.ACCESS_DENIED="access_denied",e.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",e.INVALID_SCOPE="invalid_scope",e.INVALID_GRANT="invalid_grant",e.SERVER_ERROR="server_error",e.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",e.INTERACTION_REQUIRED="interaction_required",e.LOGIN_REQUIRED="login_required",e.ACCOUNT_SELECTION_REQUIRED="account_selection_required",e.CONSENT_REQUIRED="consent_required",e.INVALID_REQUEST_URI="invalid_request_uri",e.INVALID_REQUEST_OBJECT="invalid_request_object",e.REQUEST_NOT_SUPPORTED="request_not_supported",e.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",e.REGISTRATION_NOT_SUPPORTED="registration_not_supported"}(i||(i={}));var s=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},u=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},a=function(){function e(){this.fnPromiseMap=new Map}return e.prototype.run=function(e,t){return s(this,void 0,void 0,(function(){var n,r=this;return u(this,(function(i){switch(i.label){case 0:return[4,n=this.fnPromiseMap.get(e)];case 1:return i.sent()||(n=new Promise((function(n,i){s(r,void 0,void 0,(function(){var r,o,s;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return u.sent(),r=t(),o=n,[4,r];case 2:return o.apply(void 0,[u.sent()]),[3,5];case 3:return s=u.sent(),i(s),[3,5];case 4:return this.fnPromiseMap.delete(e),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(e,n)),[2,n]}}))}))},e.prototype.runIdlePromise=function(){return Promise.resolve()},e}(),c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},l=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},d=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},h=function(e,t){return l(this,void 0,void 0,(function(){var n,r,o,s,u;return d(this,(function(a){switch(a.label){case 0:n=null,r=null,a.label=1;case 1:return a.trys.push([1,4,,5]),(o=Object.assign({},t)).method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body)),[4,fetch(e,o)];case 2:return[4,a.sent().json()];case 3:return(null==(s=a.sent())?void 0:s.error)?(r=s).error_uri=new URL(e).pathname:n=s,[3,5];case 4:return u=a.sent(),r={error:i.UNREACHABLE,error_description:u.message,error_uri:new URL(e).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},f=function(e,t){var n,r=t||{};if(e instanceof Error)n={error:r.error||i.LOCAL,error_description:r.error_description||e.message,error_uri:r.error_uri,details:r.details||e.stack};else{var o=e||{};n={error:r.error||o.error||i.LOCAL,error_description:r.error_description||o.error_description,error_uri:r.error_uri||o.error_uri,details:r.details||o.details}}return n};function p(){return o()}var _=new(function(){function e(){}return e.prototype.getItem=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return[2,window.localStorage.getItem(e)]}))}))},e.prototype.removeItem=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return window.localStorage.removeItem(e),[2]}))}))},e.prototype.setItem=function(e,t){return l(this,void 0,void 0,(function(){return d(this,(function(n){return window.localStorage.setItem(e,t),[2]}))}))},e.prototype.getItemSync=function(e){return window.localStorage.getItem(e)},e.prototype.removeItemSync=function(e){window.localStorage.removeItem(e)},e.prototype.setItemSync=function(e,t){window.localStorage.setItem(e,t)},e}());function v(e){var t=!0;return(null==e?void 0:e.expires_at)&&(null==e?void 0:e.access_token)&&(t=e.expires_at<new Date),t}var y,E,g,R=function(){function e(e){this.credentials=null,this.singlePromise=new a,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage}return e.prototype.getStorageCredentialsSync=function(){var e=null,t=this.storage.getItemSync(this.tokenSectionName);if(null!=t)try{(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at))}catch(t){this.storage.removeItem(this.tokenSectionName),e=null}return e},e.prototype.setCredentials=function(e){return l(this,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return(null==e?void 0:e.expires_in)?(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30)),this.storage?(t=JSON.stringify(e),[4,this.storage.setItem(this.tokenSectionName,t)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=e,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:n.sent(),n.label=5;case 5:this.credentials=null,n.label=6;case 6:return[2]}}))}))},e.prototype.getCredentials=function(){return l(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return[2,this.singlePromise.run("getCredentials",(function(){return l(e,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return v(this.credentials)?(e=this,[4,this.getStorageCredentials()]):[3,2];case 1:e.credentials=t.sent(),t.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},e.prototype.getStorageCredentials=function(){return l(this,void 0,void 0,(function(){var e=this;return d(this,(function(t){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return l(e,void 0,void 0,(function(){var e,t;return d(this,(function(n){switch(n.label){case 0:return e=null,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(null==(t=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),e=null,[3,5];case 5:return[2,e]}}))}))}))]}))}))},e}(),I=function(){function e(t){this.singlePromise=new a,this.apiOrigin=t.apiOrigin,this.clientId=t.clientId,this.retry=this.formatRetry(t.retry,e.defaultRetry),t.baseRequest?this.baseRequest=t.baseRequest:this.baseRequest=h,this.tokenInURL=t.tokenInURL,this.headers=t.headers,this.storage=t.storage||_,this.localCredentials=new R({tokenSectionName:"credentials_"+t.clientId,storage:this.storage}),this.clientSecret=t.clientSecret,this.refreshTokenFunc=t.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=t.anonymousSignInFunc}return e.prototype.setCredentials=function(e){return this.localCredentials.setCredentials(e)},e.prototype.getAccessToken=function(){return l(this,void 0,void 0,(function(){var e,t;return d(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(e=n.sent())?void 0:e.access_token)?[2,Promise.resolve(e.access_token)]:(t={error:i.UNAUTHENTICATED},[2,Promise.reject(t)])}}))}))},e.prototype.request=function(t,n){return l(this,void 0,void 0,(function(){var r,o,s,u,a,l,h;return d(this,(function(d){switch(d.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=c(c({},this.headers),n.headers)),n.headers["x-request-id"]||(n.headers["x-request-id"]=p()),n.headers["x-device-id"]?[3,2]:[4,this.getDeviceId()];case 1:o=d.sent(),n.headers["x-device-id"]=o,d.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(s=d.sent())&&(this.tokenInURL?(t.indexOf("?")<0&&(t+="?"),t+="access_token="+s.access_token):n.headers.Authorization=s.token_type+" "+s.access_token),[3,5];case 4:this.clientId&&t.indexOf("client_id")<0&&(t+=t.indexOf("?")<0?"?":"&",t+="client_id="+this.clientId),d.label=5;case 5:t.startsWith("/")&&(t=this.apiOrigin+t),u=null,a=r+1,l=0,d.label=6;case 6:if(!(l<a))return[3,15];d.label=7;case 7:return d.trys.push([7,9,,12]),[4,this.baseRequest(t,n)];case 8:return u=d.sent(),[3,15];case 9:return h=d.sent(),n.withCredentials&&h&&h.error===i.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return d.sent(),[2,Promise.reject(h)];case 11:return l!==r&&h&&"unreachable"===h.error?[3,12]:[2,Promise.reject(h)];case 12:return[4,this.sleep(e.retryInterval)];case 13:d.sent(),d.label=14;case 14:return l++,[3,6];case 15:return[2,u]}}))}))},e.prototype.getCredentials=function(){return l(this,void 0,void 0,(function(){var e,t,n;return d(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return v(e=r.sent())?e&&"anonymous"===e.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(e)]:[3,5]:[3,8]:[3,10];case 2:return t=r.sent(),(n=t)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return e=n,[3,7];case 5:return[4,this.anonymousSignIn(e)];case 6:e=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(e)];case 9:e=r.sent(),r.label=10;case 10:return[2,e]}}))}))},e.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},e.prototype.getCredentialsAsync=function(){return this.getCredentials()},e.prototype.getScope=function(){return l(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(e=t.sent())?[2,e.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},e.prototype.getGroups=function(){return l(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(e=t.sent())?[2,e.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},e.prototype.checkRetry=function(t){var n=null;if(("number"!=typeof t||t<e.minRetry||t>e.maxRetry)&&(n={error:i.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return t},e.prototype.formatRetry=function(e,t){return void 0===e?t:this.checkRetry(e)},e.prototype.sleep=function(e){return l(this,void 0,void 0,(function(){return d(this,(function(t){return[2,new Promise((function(t){setTimeout((function(){t()}),e)}))]}))}))},e.prototype.refreshToken=function(e){return l(this,void 0,void 0,(function(){var t=this;return d(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return l(t,void 0,void 0,(function(){var t,n;return d(this,(function(r){switch(r.label){case 0:if(!e||!e.refresh_token)return[2,this.unAuthenticatedError("no refresh token found in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.refreshTokenFunc(e.refresh_token)];case 2:return t=r.sent(),[4,this.localCredentials.setCredentials(t)];case 3:return r.sent(),[2,t];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},e.prototype.anonymousSignIn=function(e){return l(this,void 0,void 0,(function(){var t=this;return d(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return l(t,void 0,void 0,(function(){var t,n;return d(this,(function(r){switch(r.label){case 0:if(!e||"anonymous"!==e.scope)return[2,this.unAuthenticatedError("no anonymous in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret}})];case 2:return t=r.sent(),[4,this.localCredentials.setCredentials(t)];case 3:return r.sent(),[2,t];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},e.prototype.defaultRefreshTokenFunc=function(e){return void 0===e||""===e?this.unAuthenticatedError("refresh token not found"):this.request("/auth/v1/token",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:e}})},e.prototype.getDeviceId=function(){return l(this,void 0,void 0,(function(){var e;return d(this,(function(t){switch(t.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem("device_id")];case 1:return"string"==typeof(e=t.sent())&&e.length>=16&&e.length<=48?[3,3]:(e=o(),[4,this.storage.setItem("device_id",e)]);case 2:t.sent(),t.label=3;case 3:return this.deviceID=e,[2,e]}}))}))},e.prototype.unAuthenticatedError=function(e){var t={error:i.UNAUTHENTICATED,error_description:e};return Promise.reject(t)},e.defaultRetry=2,e.minRetry=0,e.maxRetry=5,e.retryInterval=1e3,e}();!function(e){e.AUTH_SIGN_IN_URL="/auth/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",e.AUTH_SIGN_UP_URL="/auth/v1/signup",e.AUTH_TOKEN_URL="/auth/v1/token",e.AUTH_REVOKE_URL="/auth/v1/revoke",e.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",e.PROVIDER_TOKEN_URL="/auth/v1/provider/token",e.PROVIDER_URI_URL="/auth/v1/provider/uri",e.USER_ME_URL="/auth/v1/user/me",e.USER_QUERY_URL="/auth/v1/user/query",e.USER_PRIFILE_URL="/auth/v1/user/profile",e.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",e.VERIFICATION_URL="/auth/v1/verification",e.VERIFY_URL="/auth/v1/verification/verify",e.PROVIDER_LIST="/auth/v1/user/provider",e.PROVIDER_UNBIND_URL="/auth/v1/user/provider",e.CHECK_PWD_URL="/auth/v1/user/sudo",e.SUDO_URL="/auth/v1/user/sudo",e.BIND_CONTACT_URL="/auth/v1/user/contact",e.AUTH_SET_PASSWORD="/auth/v1/user/password",e.AUTH_RESET_PASSWORD="/auth/v1/reset",e.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",e.CHECK_USERNAME="/auth/v1/checkUsername",e.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist"}(y||(y={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(E||(E={})),function(e){e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid",e.INVALID_PASSWORD="invalid_password",e.PASSWORD_NOT_SET="password_not_set",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked"}(g||(g={}));var S=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},T=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},b=function(){function e(e){e.openURIWithCallback||(e.openURIWithCallback=this.getDefaultOpenURIWithCallback()),e.storage||(e.storage=_),this.config=e,this.tokenSectionName="captcha_"+e.clientId}return e.prototype.request=function(e,t){return S(this,void 0,void 0,(function(){var n,r,i,o;return T(this,(function(s){switch(s.label){case 0:return t||(t={}),t.method||(t.method="GET"),n=t.method+":"+e,r=e,t.withCaptcha?[4,this.appendCaptchaTokenToURL(e,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,t)];case 3:return i=s.sent(),[3,7];case 4:return"captcha_required"!==(o=s.sent()).error&&"captcha_invalid"!==o.error?[3,6]:[4,this.appendCaptchaTokenToURL(e,n,"captcha_invalid"===o.error)];case 5:return e=s.sent(),[2,this.config.request(e,t)];case 6:return[2,Promise.reject(o)];case 7:return[2,i]}}))}))},e.prototype.getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var e=document.createElement("div");e.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",e.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(e)}),0)}return this.defaultOpenURIWithCallback},e.prototype.defaultOpenURIWithCallback=function(e){return S(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){return t=document.getElementById("captcha_panel_wrap"),n=document.createElement("iframe"),t.innerHTML="",n.setAttribute("src",e),n.setAttribute("id","review-panel-iframe"),n.style.cssText="min-width:355px;display:block;height:355px;margin:0 auto;background-color: rgb(255, 255, 255);border: none;",t.appendChild(n),t.style.display="block",[2,new Promise((function(e,r){n.onload=function(){try{var i=window.location,o=n.contentWindow.location;if(o.host+o.pathname===i.host+i.pathname){t.style.display="none";var s=new URLSearchParams(o.search),u=s.get("captcha_token");return u?e({captcha_token:u,expires_in:Number(s.get("expires_in"))}):r({error:s.get("error"),error_description:s.get("error_description")})}t.style.display="block"}catch(e){t.style.display="block"}}}))]}))}))},e.prototype.getCaptchaToken=function(e,t){return S(this,void 0,void 0,(function(){var n,r,i,o,s;return T(this,(function(u){switch(u.label){case 0:return e?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=u.sent())return[2,n];u.label=2;case 2:return r=window.location.origin+window.location.pathname+"?__captcha=on",[4,this.config.request("/auth/v1/captcha/init",{method:"POST",body:{client_id:this.config.clientId,redirect_uri:r,state:t},withCredentials:!1})];case 3:return(i=u.sent()).captcha_token?(o={captcha_token:i.captcha_token,expires_in:i.expires_in},this.saveCaptchaToken(o),[2,i.captcha_token]):[4,this.config.openURIWithCallback(i.url)];case 4:return s=u.sent(),this.saveCaptchaToken(s),[2,s.captcha_token]}}))}))},e.prototype.appendCaptchaTokenToURL=function(e,t,n){return S(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,t)];case 1:return r=i.sent(),e.indexOf("?")>0?e+="&captcha_token="+r:e+="?captcha_token="+r,[2,e]}}))}))},e.prototype.saveCaptchaToken=function(e){return S(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10)),t=JSON.stringify(e),[4,this.config.storage.setItem(this.tokenSectionName,t)];case 1:return n.sent(),[2]}}))}))},e.prototype.findCaptchaToken=function(){return S(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if(null==(e=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),t.expires_at<new Date?[2,null]:[2,t.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}}))}))},e}(),m=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))},C=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(o){return function(u){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}},w=function(){function e(e){var t=e.request,n=e.credentialsClient;if(!n){var r={apiOrigin:e.apiOrigin,clientId:e.clientId,storage:e.storage};n=new I(r)}if(!t){var i=n.request.bind(n),o=new b({clientId:e.clientId,request:i,storage:e.storage});t=o.request.bind(o)}this.config={apiOrigin:e.apiOrigin,clientId:e.clientId,request:t,credentialsClient:n,storage:e.storage||_}}return e.parseParamsToSearch=function(e){return Object.keys(e).forEach((function(t){e[t]||delete e[t]})),new URLSearchParams(e).toString()},e.prototype.signIn=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_IN_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signInAnonymously=function(e){return void 0===e&&(e={}),m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signUp=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_UP_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.signOut=function(){return m(this,void 0,void 0,(function(){var e,t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return e=n.sent(),[4,this.config.request(y.AUTH_REVOKE_URL,{method:"POST",body:{token:e}})];case 2:return t=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.getVerification=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return t=!1,"CUR_USER"!==e.target?[3,1]:(t=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(t=!0),n.label=3;case 3:return[2,this.config.request(y.VERIFICATION_URL,{method:"POST",body:e,withCaptcha:!0,withCredentials:t})]}}))}))},e.prototype.verify=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.VERIFY_URL,{method:"POST",body:e})]}))}))},e.prototype.genProviderRedirectUri=function(e){return m(this,void 0,void 0,(function(){var t,n;return C(this,(function(r){return t=y.PROVIDER_URI_URL+"?client_id="+this.config.clientId+"&provider_id="+e.provider_id+"&redirect_uri="+encodeURIComponent(e.provider_redirect_uri)+"&state="+e.state,(n=e.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(t+="&other_params[sign_out_uri]="+n.sign_out_uri),[2,this.config.request(t,{method:"GET"})]}))}))},e.prototype.grantProviderToken=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.patchProviderToken=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})]}))}))},e.prototype.signInWithProvider=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.config.request(y.AUTH_SIGN_IN_WITH_PROVIDER_URL,{method:"POST",body:e})];case 1:return t=n.sent(),[4,this.config.credentialsClient.setCredentials(t)];case 2:return n.sent(),[2,Promise.resolve(t)]}}))}))},e.prototype.bindWithProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0})]}))}))},e.prototype.getUserProfile=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.getUserInfo()]}))}))},e.prototype.getUserInfo=function(){return m(this,void 0,void 0,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return[4,this.config.request(y.USER_ME_URL,{method:"GET",withCredentials:!0})];case 1:return(e=t.sent()).sub&&(e.uid=e.sub),[2,e]}}))}))},e.prototype.deleteMe=function(t){return m(this,void 0,void 0,(function(){var n;return C(this,(function(r){return n=y.USER_ME_URL+"?"+e.parseParamsToSearch(t),[2,this.config.request(n,{method:"DELETE",withCredentials:!0})]}))}))},e.prototype.hasLoginState=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}}))}))},e.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},e.prototype.getLoginState=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},e.prototype.transByProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.grantToken=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.AUTH_TOKEN_URL,{method:"POST",body:e})]}))}))},e.prototype.getProviders=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.request(y.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},e.prototype.unbindProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_UNBIND_URL+"/"+e.provider_id,{method:"DELETE",withCredentials:!0})]}))}))},e.prototype.checkPassword=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.CHECK_PWD_URL,{method:"POST",withCredentials:!0,body:e})]}))}))},e.prototype.bindPhone=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.BIND_CONTACT_URL,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.bindEmail=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.BIND_CONTACT_URL,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.setPassword=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.AUTH_SET_PASSWORD,{method:"PATCH",withCredentials:!0,body:e})]}))}))},e.prototype.updatePasswordByOld=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:e.old_password})];case 1:return t=n.sent(),[2,this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})]}}))}))},e.prototype.sudo=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(""+y.SUDO_URL,{method:"POST",withCredentials:!0,body:e})]}))}))},e.prototype.getCurUserVerification=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return e.target="CUR_USER",[2,this.config.request(y.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})]}))}))},e.prototype.changeBindedProvider=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.PROVIDER_LIST+"/"+e.provider_id+"/trans",{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})]}))}))},e.prototype.setUserProfile=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})]}))}))},e.prototype.queryUserProfile=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){return t=new URLSearchParams(e),[2,this.config.request(y.USER_QUERY_URL+"?"+t.toString(),{method:"GET",withCredentials:!0})]}))}))},e.prototype.setCustomSignFunc=function(e){this.getCustomSignTicketFn=e},e.prototype.signInWithCustomTicket=function(){return m(this,void 0,void 0,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=t.sent(),[2,this.signInWithProvider({provider_id:"custom",provider_token:e})]}}))}))},e.prototype.resetPassword=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.AUTH_RESET_PASSWORD,{method:"POST",body:e})]}))}))},e.prototype.deviceAuthorize=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})]}))}))},e.prototype.checkUsername=function(e){return m(this,void 0,void 0,(function(){return C(this,(function(t){return[2,this.config.request(y.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})]}))}))},e.prototype.checkIfUserExist=function(e){return m(this,void 0,void 0,(function(){var t;return C(this,(function(n){return t=new URLSearchParams(e),[2,this.config.request(y.CHECK_IF_USER_EXIST+"?"+t.toString(),{method:"GET"})]}))}))},e.prototype.loginScope=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.credentialsClient.getScope()]}))}))},e.prototype.loginGroups=function(){return m(this,void 0,void 0,(function(){return C(this,(function(e){return[2,this.config.credentialsClient.getGroups()]}))}))},e}(),U=n(0),O=function(){},A=function(){return(A=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},N=function(e){var t=e.apiOrigin,n=e.clientId,r=e.storage,i=e.request,o=e.anonymousSignInFunc;this.oauth2client=new I({apiOrigin:t,clientId:n,storage:r,baseRequest:i,anonymousSignInFunc:o}),this.authApi=new w(A(A({credentialsClient:this.oauth2client},e),{request:i?this.oauth2client.request.bind(this.oauth2client):void 0}))}}])}));
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_storage",[],t):"object"==typeof exports?exports.cloudbase_storage=t():e.cloudbase_storage=t()}("undefined"!=typeof window?window:this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=6)}([function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.jwt=t.helpers=t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var a=i(r(3));t.constants=a;var c=i(r(9));t.adapters=c;var u=i(r(16));t.cache=u;var l=i(r(18));t.events=l;var f=i(r(1));t.utils=f;var d=i(r(19));t.helpers=d;var p={decode:s(r(21)).default};t.jwt=p},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.createSign=t.formatUrl=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var o=n(r(11)),i=n(r(14)),s=n(r(15)),a=r(3);function c(e){var t=i.default.stringify(e);return t=(t=(t=t.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.formatUrl=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach((function(e){""===o?!n&&(t+="?"):o+="&",o+=e+"="+encodeURIComponent(r[e])})),/^http(s)?:\/\//.test(t+=o)?t:""+e+t},t.createSign=function(e,t){var r=c(s.default.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+c(s.default.parse(JSON.stringify(e)));return r+"."+c(o.default(r,t))},t.toQueryString=function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach((function(r){t.push(r+"="+encodeURIComponent(e[r]))})),t.join("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||window.location.search,n=new RegExp("(^|&)"+e+"=([^&]*)(&|$)"),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]"+e+"=([^&#]*)"));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],n=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===e&&n.splice(i,1);r=r+"?"+n.join("&")}return r},t.createPromiseCallback=function(){var e;if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,n){return e?r(e):t(n)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("["+a.getSdkName()+"]["+e+"]:"+t)},t.printError=function(e,t){console.error({code:e,msg:"["+a.getSdkName()+"]["+e+"]:"+t})},t.printInfo=function(e,t){console.log("["+a.getSdkName()+"]["+e+"]:"+t)},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"["+a.getSdkName()+"]["+e+"]:"+t}))},t.printGroupLog=function(e){var t=e.title,r=e.subtitle,n=void 0===r?"":r,o=e.content,i=void 0===o?[]:o,s=e.printTrace,a=void 0!==s&&s,c=e.collapsed;void 0!==c&&c?console.groupCollapsed(t,n):console.group(t,n);for(var u=0,l=i;u<l.length;u++){var f=l[u],d=f.type,p=f.body;switch(d){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}a&&console.trace("stack trace:"),console.groupEnd()},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86"+e}},function(e,t,r){var n;e.exports=(n=n||function(e,t){var r=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),n={},o=n.lib={},i=o.Base={extend:function(e){var t=r(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=o.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||c).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,o=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i<o;i++){var s=r[i>>>2]>>>24-i%4*8&255;t[n+i>>>2]|=s<<24-(n+i)%4*8}else for(i=0;i<o;i+=4)t[n+i>>>2]=r[i>>>2];return this.sigBytes+=o,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var r,n=[],o=function(t){t=t;var r=987654321,n=4294967295;return function(){var o=((r=36969*(65535&r)+(r>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return o/=4294967296,(o+=.5)*(e.random()>.5?1:-1)}},i=0;i<t;i+=4){var a=o(4294967296*(r||e.random()));r=987654071*a(),n.push(4294967296*a()|0)}return new s.init(n,t)}}),a=n.enc={},c=a.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new s.init(r,t/2)}},u=a.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],o=0;o<r;o++){var i=t[o>>>2]>>>24-o%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new s.init(r,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(u.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return u.parse(unescape(encodeURIComponent(e)))}},f=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r=this._data,n=r.words,o=r.sigBytes,i=this.blockSize,a=o/(4*i),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*i,u=e.min(4*c,o);if(c){for(var l=0;l<c;l+=i)this._doProcessBlock(n,l);var f=n.splice(0,c);r.sigBytes-=u}return new s.init(f,u)},clone:function(){var e=i.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),d=(o.Hasher=f.extend({cfg:i.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new d.HMAC.init(e,r).finalize(t)}}}),n.algo={});return n}(Math),n)},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(r(4),t),o(r(8),t),t.OATUH_LOGINTYPE="constants"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var n="@cloudbase/js-sdk";t.setSdkName=function(e){n=e},t.getSdkName=function(){return n};var o="https:";t.setProtocol=function(e){o=e},t.getProtocol=function(){return o},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},function(e,t,r){"use strict";var n;r.r(t),r.d(t,"StorageType",(function(){return n})),r.d(t,"AbstractSDKRequest",(function(){return o})),r.d(t,"AbstractStorage",(function(){return i})),r.d(t,"formatUrl",(function(){return s})),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.registerStorage=void 0;var n=r(7);t.registerStorage=n.registerStorage},function(e,t,r){"use strict";r.r(t),r.d(t,"registerStorage",(function(){return w}));var n,o=r(0),i=function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},a=function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},c=function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},u=function(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.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(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};!function(e){e.put="put",e.post="post"}(n||(n={}));var l=o.constants.getSdkName,f=o.constants.ERRORS,d=o.constants.COMMUNITY_SITE_URL,p=o.utils.isArray,h=o.utils.isString,v=o.utils.isPalinObject,g=o.utils.execCallback,y=o.helpers.catchErrorsDecorator,m=new(function(){function e(){}return e.prototype.uploadFile=function(e,t){return c(this,void 0,void 0,(function(){var r,o,s,a,c,d,p,v,y,m,b,w,_,O,S,I,A,R,E,P,j,N,x,T,L;return u(this,(function(u){switch(u.label){case 0:if(r=e.cloudPath,o=e.filePath,s=e.onUploadProgress,a=e.method,c=void 0===a?"put":a,d=e.headers,p=void 0===d?{}:d,!h(r)||!o)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.uploadFile] invalid params"}));return v={put:n.put,post:n.post}[c.toLocaleLowerCase()]||n.put,"storage.getUploadMetadata",y=this.request,m={path:r,method:v},v===n.put&&(m.headers=p),[4,y.send("storage.getUploadMetadata",m)];case 1:return b=u.sent(),w=b.data,_=w.url,O=w.authorization,S=w.token,I=w.fileId,A=w.cosFileId,R=w.download_url,E=b.requestId,j=i(i({},P={url:_,file:o,name:r,onUploadProgress:s}),{method:n.put,headers:i(i({},p),{authorization:O,"x-cos-meta-fileid":A,"x-cos-security-token":S})}),N=i(i({},P),{method:n.post,data:{key:r,signature:O,"x-cos-meta-fileid":A,success_action_status:"201","x-cos-security-token":S}}),(L={})[n.put]={params:j,isSuccess:function(e){return e>=200&&e<300}},L[n.post]={params:N,isSuccess:function(e){return 201===e}},x=L,[4,y.upload(x[v].params)];case 2:return T=u.sent(),x[v].isSuccess(T.statusCode)?[2,g(t,null,{fileID:I,download_url:R,requestId:E})]:[2,g(t,new Error("["+l()+"]["+f.OPERATION_FAIL+"][storage]:"+T.data))]}}))}))},e.prototype.getUploadMetadata=function(e,t){return c(this,void 0,void 0,(function(){var r,n,o,i,s;return u(this,(function(a){switch(a.label){case 0:if(r=e.cloudPath,!h(r))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.getUploadMetadata] invalid cloudPath"}));n=this.request,o="storage.getUploadMetadata",a.label=1;case 1:return a.trys.push([1,3,,4]),[4,n.send(o,{path:r})];case 2:return i=a.sent(),[2,g(t,null,i)];case 3:return s=a.sent(),[2,g(t,s)];case 4:return[2]}}))}))},e.prototype.deleteFile=function(e,t){return c(this,void 0,void 0,(function(){var r,n,o,i,s,a;return u(this,(function(c){switch(c.label){case 0:if(!(r=e.fileList)||!p(r)||0===r.length)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.deleteFile] fileList must not be empty"}));for(n=0,o=r;n<o.length;n++)if(!(i=o[n])||!h(i))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.deleteFile] fileID must be string"}));return"storage.batchDeleteFile",[4,this.request.send("storage.batchDeleteFile",{fileid_list:r})];case 1:return(s=c.sent()).code?[2,g(t,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,g(t,null,a)])}}))}))},e.prototype.getTempFileURL=function(e,t){return c(this,void 0,void 0,(function(){var r,n,o,i,s,a;return u(this,(function(c){switch(c.label){case 0:if(!(r=e.fileList)||!p(r)||0===r.length)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.getTempFileURL] fileList must not be empty"}));for(n=[],o=0,i=r;o<i.length;o++)if(s=i[o],v(s)){if(!Object.prototype.hasOwnProperty.call(s,"fileID")||!Object.prototype.hasOwnProperty.call(s,"maxAge"))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.getTempFileURL] file info must include fileID and maxAge"}));n.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!h(s))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.getTempFileURL] invalid fileList"}));n.push({fileid:s})}return"storage.batchGetDownloadUrl",[4,this.request.send("storage.batchGetDownloadUrl",{file_list:n})];case 1:return(a=c.sent()).code?[2,g(t,null,a)]:[2,g(t,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},e.prototype.downloadFile=function(e,t){return c(this,void 0,void 0,(function(){var r,n,o,i,s,a;return u(this,(function(c){switch(c.label){case 0:if(r=e.fileID,!h(r))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[storage.getTempFileURL] fileID must be string"}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:r,maxAge:600}]})];case 1:return n=c.sent(),"SUCCESS"!==(o=n.fileList[0]).code?[2,g(t,o)]:(i=this.request,s=encodeURI(o.download_url),[4,i.download({url:s})]);case 2:return a=c.sent(),[2,g(t,null,a)]}}))}))},s([y({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+d]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],e.prototype,"uploadFile",null),s([y({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+d]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],e.prototype,"getUploadMetadata",null),s([y({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+d]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],e.prototype,"deleteFile",null),s([y({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+d]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],e.prototype,"getTempFileURL",null),s([y({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+d]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],e.prototype,"downloadFile",null),e}()),b={name:"storage",entity:{uploadFile:m.uploadFile,deleteFile:m.deleteFile,getTempFileURL:m.getTempFileURL,downloadFile:m.downloadFile,getUploadMetadata:m.getUploadMetadata}};try{cloudbase.registerComponent(b)}catch(e){}function w(e){try{e.registerComponent(b)}catch(e){console.warn(e)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,a=i(r(10)),c=r(1);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e){for(var t=0,r=c.isArray(e)?e:[e];t<r.length;t++){var n=r[t],o=n.isMatch,i=n.genAdapter,s=n.runtime;if(o())return{adapter:i(),runtime:s}}},t.useDefaultAdapter=function(){return{adapter:a.genAdapter(),runtime:s.WEB}}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.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(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var c=r(5),u=r(1),l=r(4),f=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return o(t,e),t.prototype.get=function(e){return this.request(i(i({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(i(i({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,s=e.headers,a=void 0===s?{}:s,c={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===c?(Object.keys(t).forEach((function(e){u.append(e,t[e])})),u.append("key",n),u.append("file",r),this.request(i(i({},e),{data:u,method:c}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return s(this,void 0,void 0,(function(){var t,r,n,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=s.sent().data,r=window.URL.createObjectURL(new Blob([t])),n=decodeURIComponent(new URL(e.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 s.sent(),[3,3];case 3:return[2,new Promise((function(t){t({statusCode:200,tempFilePath:e.url})}))]}}))}))},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=e.url,c=e.headers,f=void 0===c?{}:c,d=e.data,p=e.responseType,h=e.withCredentials,v=e.body,g=e.onUploadProgress,y=u.formatUrl(l.getProtocol(),a,"get"===n?d:{}),m=new XMLHttpRequest;m.open(n,y),p&&(m.responseType=p),Object.keys(f).forEach((function(e){m.setRequestHeader(e,f[e])})),g&&m.upload.addEventListener("progress",g),m.onreadystatechange=function(){var e={};if(4===m.readyState){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach((function(e){var t=e.split(": "),n=t.shift().toLowerCase(),o=t.join(": ");r[n]=o})),e.header=r,e.statusCode=m.status;try{e.data="blob"===p?m.response:JSON.parse(m.responseText)}catch(t){e.data="blob"===p?m.response:m.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout((function(){console.warn(r.timeoutMsg),m.abort()}),r.timeout)),s=u.isFormData(d)?d:"application/x-www-form-urlencoded"===f["content-type"]?u.toQueryString(d):v||(d?JSON.stringify(d):void 0),h&&(m.withCredentials=!0),m.send(s)}))},t}(c.AbstractSDKRequest);t.WebRequest=f,t.genAdapter=function(){return{root:window,reqClass:f,wsClass:WebSocket,localStorage:localStorage}}},function(e,t,r){var n;e.exports=(n=r(2),r(12),r(13),n.HmacSHA256)},function(e,t,r){var n;e.exports=(n=r(2),function(e){var t=n,r=t.lib,o=r.WordArray,i=r.Hasher,s=t.algo,a=[],c=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,o=0;o<64;)t(n)&&(o<8&&(a[o]=r(e.pow(n,.5))),c[o]=r(e.pow(n,1/3)),o++),n++}();var u=[],l=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],o=r[1],i=r[2],s=r[3],a=r[4],l=r[5],f=r[6],d=r[7],p=0;p<64;p++){if(p<16)u[p]=0|e[t+p];else{var h=u[p-15],v=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=u[p-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;u[p]=v+u[p-7]+y+u[p-16]}var m=n&o^n&i^o&i,b=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),w=d+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+c[p]+u[p];d=f,f=l,l=a,a=s+w|0,s=i,i=o,o=n,n=w+(b+m)|0}r[0]=r[0]+n|0,r[1]=r[1]+o|0,r[2]=r[2]+i|0,r[3]=r[3]+s|0,r[4]=r[4]+a|0,r[5]=r[5]+l|0,r[6]=r[6]+f|0,r[7]=r[7]+d|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,o=8*t.sigBytes;return r[o>>>5]|=128<<24-o%32,r[14+(o+64>>>9<<4)]=e.floor(n/4294967296),r[15+(o+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=i._createHelper(l),t.HmacSHA256=i._createHmacHelper(l)}(Math),n.SHA256)},function(e,t,r){var n,o,i,s;e.exports=(n=r(2),i=(o=n).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),i=this._iKey=t.clone(),a=o.words,c=i.words,u=0;u<r;u++)a[u]^=1549556828,c[u]^=909522486;o.sigBytes=i.sigBytes=n,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,r=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(r))}})))},function(e,t,r){var n,o,i;e.exports=(i=r(2),o=(n=i).lib.WordArray,n.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var o=[],i=0;i<r;i+=3)for(var s=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<r;a++)o.push(n.charAt(s>>>6*(3-a)&63));var c=n.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var s=r.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,r){for(var n=[],i=0,s=0;s<t;s++)if(s%4){var a=r[e.charCodeAt(s-1)]<<s%4*2,c=r[e.charCodeAt(s)]>>>6-s%4*2;n[i>>>2]|=(a|c)<<24-i%4*8,i++}return o.create(n,i)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(e,t,r){var n;e.exports=(n=r(2),n.enc.Utf8)},function(e,t,r){"use strict";(function(e){var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.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(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var a=r(5),c=r(1),u=r(3),l=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return o(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(a.AbstractStorage);var f=function(){function t(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":return t.localStorage?t.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root));case"none":return new l(t.root);default:return t.localStorage?t.localStorage:(c.printWarn(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new l(t.root))}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}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(e,t,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(JSON.stringify({code:u.ERRORS.OPERATION_FAIL,msg:"["+u.getSdkName()+"]["+u.ERRORS.OPERATION_FAIL+"]setStore failed",info:e}))}}else c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(e,t,r){return i(this,void 0,void 0,(function(){var n;return s(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:t},[4,this.storage.setItem(e,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,r){var n;if("async"!==this.mode){try{if(void 0!==e&&(null===(n=e.env)||void 0===n?void 0:n.tcb_token))return e.env.tcb_token;if(!this.storage)return""}catch(e){return""}r=r||"localCachev1";var o=this.storage.getItem(t);return o&&o.indexOf(r)>=0?JSON.parse(o).content:""}c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,r){var n;return i(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:try{if(void 0!==e&&(null===(n=e.env)||void 0===n?void 0:n.tcb_token))return[2,e.env.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return r=r||"localCachev1",[4,this.storage.getItem(t)];case 1:return(o=i.sent())&&o.indexOf(r)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},t.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):c.printWarn(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},t}();t.CloudbaseCache=f}).call(this,r(17))},function(e,t){var r,n,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(e){r=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var c,u=[],l=!1,f=-1;function d(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&p())}function p(){if(!l){var e=a(d);l=!0;for(var t=u.length;t;){for(c=u,u=[];++f<t;)c&&c[f].run();f=-1,t=u.length}c=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function v(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new h(e,t)),1!==u.length||l||a(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,r){"use strict";var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var s=r(1);var a=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=a;var c=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return o(t,e),t}(a);t.IErrorEvent=c;var u=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(s.isInstanceOf(e,c))return console.error(e.error),this;var r=s.isString(e)?new a(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,u=this.listeners[n]?i(this.listeners[n]):[];o<u.length;o++){u[o].call(this,r)}}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=u;var l=new u;t.addEventListener=function(e,t){l.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),l.fire(e,t)},t.removeEventListener=function(e,t){l.off(e,t)}},function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(20),t)},function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}c((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var r,n,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(r)throw new TypeError("Generator is already executing.");for(;s;)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 s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.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(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=r(1),s=r(3),a=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(a=-1!==navigator.userAgent.indexOf("Firefox"));var c=a?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function l(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,s=t.stack.split("\n"),c=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]\\s*\\(.*\\)$"),l=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp(r+"\\.descriptor.value\\s*\\[as\\s"+n+"\\]"),f=s.findIndex((function(e){return c.test(e)}));if(-1!==f){var d=s.filter((function(e,t){return t>f}));d.unshift(s[f].replace(l,r+"."+n).replace(u,o)),(i=new Error).stack=(a?"@debugger":"Error")+"\n"+d.join("\n")}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,a=e.customInfo,f=void 0===a?{}:a,d=e.title,p=e.messages,h=void 0===p?[]:p;return function(e,t,a){if(s.IS_DEBUG_MODE){var p=f.className||e.constructor.name,v=f.methodName||t,g=a.value,y=function(e){var t="",r=e.stack.split("\n"),n=r.findIndex((function(e){return c.test(e)}));if(-1!==n){var o=u.exec(r[n+1]||"");t=o?o[0]:""}return t}(new Error);a.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=l({err:new Error,className:p,methodName:v,sourceLink:y});try{return g.apply(this,e)}catch(e){var n=e,o=e.message,s=e.error,a=e.error_description,c={title:d||p+"."+v+" failed",content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);c.subtitle=o,u.code&&(r?(r.code=u.code,r.msg=u.msg):(e.code=u.code,e.message=u.msg),n=r||e,c.content=h.map((function(e){return{type:"info",body:e}})))}throw s&&a&&(c.subtitle=a,r?(r.code=s,r.msg=a):(e.code=s,e.message=a),n=r||e,c.content=h.map((function(e){return{type:"info",body:e}}))),i.printGroupLog(c),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n,s,a,c,u,f;return o(this,(function(o){switch(o.label){case 0:t=l({err:new Error,className:p,methodName:v,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,g.apply(this,e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,s=r.message,a=r.error,c=r.error_description,u={title:d||p+"."+v+" failed",content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(f=JSON.parse(s),u.subtitle=f,f.code&&(t?(t.code=f.code,t.message=f.msg):(r.code=f.code,r.message=f.msg),n=t||r,u.content=h.map((function(e){return{type:"info",body:e}})))),a&&c&&(u.subtitle=c,t?(t.code=a,t.msg=c):(r.code=a,r.message=c),n=t||r,u.content=h.map((function(e){return{type:"info",body:e}}))),i.printGroupLog(u),n;case 4:return[2]}}))}))}}}}},function(e,t,r){"use strict";function n(e){this.message=e}r.r(t),r.d(t,"InvalidTokenError",(function(){return s})),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,s=0,a="";o=t.charAt(s++);~o&&(r=i%4?64*r+o:o,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return a};function i(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(o(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return o(t)}}function s(e){this.message=e}s.prototype=new Error,s.prototype.name="InvalidTokenError",t.default=function(e,t){if("string"!=typeof e)throw new s("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(i(e.split(".")[r]))}catch(e){throw new s("Invalid token specified: "+e.message)}}}])}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_storage",[],e):"object"==typeof exports?exports.cloudbase_storage=e():t.cloudbase_storage=e()}("undefined"!=typeof window?window:this,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=9)}([function(t,e,n){"use strict";n.r(e),n.d(e,"isArray",(function(){return l})),n.d(e,"isString",(function(){return f})),n.d(e,"isUndefined",(function(){return p})),n.d(e,"isPalinObject",(function(){return d})),n.d(e,"isNull",(function(){return h})),n.d(e,"isInstanceOf",(function(){return y})),n.d(e,"isFormData",(function(){return g})),n.d(e,"genSeqId",(function(){return m})),n.d(e,"formatUrl",(function(){return v})),n.d(e,"createSign",(function(){return w})),n.d(e,"toQueryString",(function(){return O})),n.d(e,"getQuery",(function(){return _})),n.d(e,"getHash",(function(){return S})),n.d(e,"removeParam",(function(){return I})),n.d(e,"createPromiseCallback",(function(){return A})),n.d(e,"execCallback",(function(){return R})),n.d(e,"printWarn",(function(){return j})),n.d(e,"printError",(function(){return N})),n.d(e,"printInfo",(function(){return E})),n.d(e,"throwError",(function(){return P})),n.d(e,"printGroupLog",(function(){return x})),n.d(e,"sleep",(function(){return L})),n.d(e,"transformPhone",(function(){return T}));var r=n(7),o=n.n(r),i=n(8),s=n.n(i),a=n(5),c=n.n(a),u=n(1);function l(t){return"[object Array]"===Object.prototype.toString.call(t)}function f(t){return"string"==typeof t}function p(t){return void 0===t}function d(t){return"[object Object]"===Object.prototype.toString.call(t)}function h(t){return"[object Null]"===Object.prototype.toString.call(t)}function y(t,e){return t instanceof e}function g(t){return"[object FormData]"===Object.prototype.toString.call(t)}function m(){return Math.random().toString(16).slice(2)}function v(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),o="";return Object.keys(n).forEach((function(t){""===o?!r&&(e+="?"):o+="&",o+=t+"="+encodeURIComponent(n[t])})),/^http(s)?:\/\//.test(e+=o)?e:""+t+e}function b(t){var e=s.a.stringify(t);return e=(e=(e=e.replace(/=+$/,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function w(t,e){var n=b(c.a.parse(JSON.stringify({alg:"HS256",typ:"JWT"})))+"."+b(c.a.parse(JSON.stringify(t)));return n+"."+b(o()(n,e))}function O(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push(n+"="+encodeURIComponent(t[n]))})),e.join("&")}function _(t,e){if("undefined"==typeof window)return!1;var n=e||window.location.search,r=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),o=n.substr(n.indexOf("?")+1).match(r);return null!=o?o[2]:""}var S=function(t){if("undefined"==typeof window)return"";var e=window.location.hash.match(new RegExp("[#?&/]"+t+"=([^&#]*)"));return e?e[1]:""};function I(t,e){var n=e.split("?")[0],r=[],o=-1!==e.indexOf("?")?e.split("?")[1]:"";if(""!==o){for(var i=(r=o.split("&")).length-1;i>=0;i-=1)r[i].split("=")[0]===t&&r.splice(i,1);n=n+"?"+r.join("&")}return n}function A(){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 n=new Promise((function(e,n){t=function(t,r){return t?n(t):e(r)}}));return t.promise=n,t}function R(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n}function j(t,e){console.warn("["+Object(u.getSdkName)()+"]["+t+"]:"+e)}function N(t,e){console.error({code:t,msg:"["+Object(u.getSdkName)()+"]["+t+"]:"+e})}function E(t,e){console.log("["+Object(u.getSdkName)()+"]["+t+"]:"+e)}function P(t,e){throw new Error(JSON.stringify({code:t,msg:"["+Object(u.getSdkName)()+"]["+t+"]:"+e}))}function x(t){var e=t.title,n=t.subtitle,r=void 0===n?"":n,o=t.content,i=void 0===o?[]:o,s=t.printTrace,a=void 0!==s&&s,c=t.collapsed;void 0!==c&&c?console.groupCollapsed(e,r):console.group(e,r);for(var u=0,l=i;u<l.length;u++){var f=l[u],p=f.type,d=f.body;switch(p){case"info":console.log(d);break;case"warn":console.warn(d);break;case"error":console.error(d)}}a&&console.trace("stack trace:"),console.groupEnd()}var L=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))};function T(t){return"+86"+t}},function(t,e,n){"use strict";n.r(e),n.d(e,"setSdkName",(function(){return r.f})),n.d(e,"getSdkName",(function(){return r.d})),n.d(e,"setProtocol",(function(){return r.e})),n.d(e,"getProtocol",(function(){return r.c})),n.d(e,"IS_DEBUG_MODE",(function(){return r.b})),n.d(e,"COMMUNITY_SITE_URL",(function(){return r.a})),n.d(e,"ERRORS",(function(){return o})),n.d(e,"OATUH_LOGINTYPE",(function(){return i}));var r=n(3),o={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},i="constants"},function(t,e,n){var r;t.exports=(r=r||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),r={},o=r.lib={},i=o.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=o.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var s=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=s<<24-(r+i)%4*8}else for(i=0;i<o;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){e=e;var n=987654321,r=4294967295;return function(){var o=((n=36969*(65535&n)+(n>>16)&r)<<16)+(e=18e3*(65535&e)+(e>>16)&r)&r;return o/=4294967296,(o+=.5)*(t.random()>.5?1:-1)}},i=0;i<e;i+=4){var a=o(4294967296*(n||t.random()));n=987654071*a(),r.push(4294967296*a()|0)}return new s.init(r,e)}}),a=r.enc={},c=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new s.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new s.init(n,e)}},l=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},f=o.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,i=this.blockSize,a=o/(4*i),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*i,u=t.min(4*c,o);if(c){for(var l=0;l<c;l+=i)this._doProcessBlock(r,l);var f=r.splice(0,c);n.sigBytes-=u}return new s.init(f,u)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(o.Hasher=f.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new p.HMAC.init(t,n).finalize(e)}}}),r.algo={});return r}(Math),r)},function(t,e,n){"use strict";n.d(e,"f",(function(){return o})),n.d(e,"d",(function(){return i})),n.d(e,"e",(function(){return a})),n.d(e,"c",(function(){return c})),n.d(e,"b",(function(){return u})),n.d(e,"a",(function(){return l}));var r="@cloudbase/js-sdk";function o(t){r=t}function i(){return r}var s="https:";function a(t){s=t}function c(){return s}var u=!1,l="https://support.qq.com/products/148793"},function(t,e,n){"use strict";var r;n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return i})),function(t){t.local="local",t.none="none",t.session="session"}(r||(r={}));var o=function(){},i=function(){}},function(t,e,n){var r;t.exports=(r=n(2),r.enc.Utf8)},function(t,e,n){"use strict";(function(t){var e,r=n(4),o=n(0),i=n(1),s=(e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),a=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},c=function(t,e){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=s.trys,(o=o.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=e.call(t,s)}catch(t){i=[6,t],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])}}},u=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return s(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}(r.b);!function(){function e(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,s=t.keys,a=void 0===s?{}:s;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":return e.localStorage?e.localStorage:(Object(o.printWarn)(i.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new u(e.root));case"none":return new u(e.root);default:return e.localStorage?e.localStorage:(Object(o.printWarn)(i.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new u(e.root))}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:i.ERRORS.OPERATION_FAIL,msg:"["+Object(i.getSdkName)()+"]["+i.ERRORS.OPERATION_FAIL+"]setStore failed",info:t}))}}else Object(o.printWarn)(i.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(t,e,n){return a(this,void 0,void 0,(function(){var r;return c(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]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}}))}))},e.prototype.getStore=function(e,n){var r;if("async"!==this.mode){try{if(void 0!==t&&(null===(r=t.env)||void 0===r?void 0:r.tcb_token))return t.env.tcb_token;if(!this.storage)return""}catch(t){return""}n=n||"localCachev1";var s=this.storage.getItem(e);return s&&s.indexOf(n)>=0?JSON.parse(s).content:""}Object(o.printWarn)(i.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,n){var r;return a(this,void 0,void 0,(function(){var o;return c(this,(function(i){switch(i.label){case 0:try{if(void 0!==t&&(null===(r=t.env)||void 0===r?void 0:r.tcb_token))return[2,t.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return n=n||"localCachev1",[4,this.storage.getItem(e)];case 1:return(o=i.sent())&&o.indexOf(n)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},e.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):Object(o.printWarn)(i.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(t){return a(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}()}).call(this,n(12))},function(t,e,n){var r;t.exports=(r=n(2),n(10),n(11),r.HmacSHA256)},function(t,e,n){var r,o,i;t.exports=(i=n(2),o=(r=i).lib.WordArray,r.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var o=[],i=0;i<n;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;a<4&&i+.75*a<n;a++)o.push(r.charAt(s>>>6*(3-a)&63));var c=r.charAt(64);if(c)for(;o.length%4;)o.push(c);return o.join("")},parse:function(t){var e=t.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var i=0;i<n.length;i++)r[n.charCodeAt(i)]=i}var s=n.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,n){for(var r=[],i=0,s=0;s<e;s++)if(s%4){var a=n[t.charCodeAt(s-1)]<<s%4*2,c=n[t.charCodeAt(s)]>>>6-s%4*2;r[i>>>2]|=(a|c)<<24-i%4*8,i++}return o.create(r,i)}(t,e,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.registerStorage=void 0;var r=n(13);e.registerStorage=r.registerStorage},function(t,e,n){var r;t.exports=(r=n(2),function(t){var e=r,n=e.lib,o=n.WordArray,i=n.Hasher,s=e.algo,a=[],c=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var r=2,o=0;o<64;)e(r)&&(o<8&&(a[o]=n(t.pow(r,.5))),c[o]=n(t.pow(r,1/3)),o++),r++}();var u=[],l=s.SHA256=i.extend({_doReset:function(){this._hash=new o.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],s=n[3],a=n[4],l=n[5],f=n[6],p=n[7],d=0;d<64;d++){if(d<16)u[d]=0|t[e+d];else{var h=u[d-15],y=(h<<25|h>>>7)^(h<<14|h>>>18)^h>>>3,g=u[d-2],m=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;u[d]=y+u[d-7]+m+u[d-16]}var v=r&o^r&i^o&i,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=p+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&f)+c[d]+u[d];p=f,f=l,l=a,a=s+w|0,s=i,i=o,o=r,r=w+(b+v)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+p|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),r.SHA256)},function(t,e,n){var r,o,i,s;t.exports=(r=n(2),i=(o=r).lib.Base,s=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),i=this._iKey=e.clone(),a=o.words,c=i.words,u=0;u<n;u++)a[u]^=1549556828,c[u]^=909522486;o.sigBytes=i.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var c,u=[],l=!1,f=-1;function p(){l&&c&&(l=!1,c.length?u=c.concat(u):f=-1,u.length&&d())}function d(){if(!l){var t=a(p);l=!0;for(var e=u.length;e;){for(c=u,u=[];++f<e;)c&&c[f].run();f=-1,e=u.length}c=null,l=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];u.push(new h(t,e)),1!==u.length||l||a(d)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";n.r(e),n.d(e,"registerStorage",(function(){return J}));var r={};n.r(r),n.d(r,"catchErrorsDecorator",(function(){return S}));var o,i,s=n(1),a=n(4),c=n(0),u=n(3),l=(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),f=function(){return(f=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},p=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},d=function(t,e){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=s.trys,(o=o.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=e.call(t,s)}catch(t){i=[6,t],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])}}};!function(t){function e(e){var n=t.call(this)||this,r=e.timeout,o=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=o||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}l(e,t),e.prototype.get=function(t){return this.request(f(f({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(f(f({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(f(f({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,o=t.method,i=t.headers,s=void 0===i?{}:i,a={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){c.append(t,e[t])})),c.append("key",r),c.append("file",n),this.request(f(f({},t),{data:c,method:a}),this.restrictedMethods.includes("upload"))):this.request(f(f({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return p(this,void 0,void 0,(function(){var e,n,r,o;return d(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(f(f({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=n,o.setAttribute("download",r),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(n),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(o){var i,s,a=t.url,l=t.headers,f=void 0===l?{}:l,p=t.data,d=t.responseType,h=t.withCredentials,y=t.body,g=t.onUploadProgress,m=Object(c.formatUrl)(Object(u.c)(),a,"get"===r?p:{}),v=new XMLHttpRequest;v.open(r,m),d&&(v.responseType=d),Object.keys(f).forEach((function(t){v.setRequestHeader(t,f[t])})),g&&v.upload.addEventListener("progress",g),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),o=e.join(": ");n[r]=o})),t.header=n,t.statusCode=v.status;try{t.data="blob"===d?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===d?v.response:v.responseText}clearTimeout(i),o(t)}},e&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),s=Object(c.isFormData)(p)?p:"application/x-www-form-urlencoded"===f["content-type"]?Object(c.toQueryString)(p):y||(p?JSON.stringify(p):void 0),h&&(v.withCredentials=!0),v.send(s)}))}}(a.a);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(i||(i={}));n(6);var h=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),y=function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};var g=function(t,e){this.data=e||null,this.name=t},m=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return h(e,t),e}(g);new(function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(Object(c.isInstanceOf)(t,m))return console.error(t.error),this;var n=Object(c.isString)(t)?new g(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var o=0,i=this.listeners[r]?y(this.listeners[r]):[];o<i.length;o++){i[o].call(this,n)}}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}());var v=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},b=function(t,e){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=s.trys,(o=o.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=e.call(t,s)}catch(t){i=[6,t],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])}}},w=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(w=-1!==navigator.userAgent.indexOf("Firefox"));var O=w?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,_=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function S(t){var e=t.mode,n=void 0===e?"async":e,r=t.customInfo,o=void 0===r?{}:r,i=t.title,a=t.messages,u=void 0===a?[]:a;return function(t,e,r){if(s.IS_DEBUG_MODE){var a=o.className||t.constructor.name,l=o.methodName||e,f=r.value,p=function(t){var e="",n=t.stack.split("\n"),r=n.findIndex((function(t){return O.test(t)}));if(-1!==r){var o=_.exec(n[r+1]||"");e=o?o[0]:""}return e}(new Error);r.value="sync"===n?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=I({err:new Error,className:a,methodName:l,sourceLink:p});try{return f.apply(this,t)}catch(t){var r=t,o=t.message,s=t.error,d=t.error_description,h={title:i||a+"."+l+" failed",content:[{type:"error",body:t}]};if(o&&/^\{.*\}$/.test(o)){var y=JSON.parse(o);h.subtitle=o,y.code&&(n?(n.code=y.code,n.msg=y.msg):(t.code=y.code,t.message=y.msg),r=n||t,h.content=u.map((function(t){return{type:"info",body:t}})))}throw s&&d&&(h.subtitle=d,n?(n.code=s,n.msg=d):(t.code=s,t.message=d),r=n||t,h.content=u.map((function(t){return{type:"info",body:t}}))),Object(c.printGroupLog)(h),r}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return v(this,void 0,void 0,(function(){var e,n,r,o,s,d,h,y;return b(this,(function(g){switch(g.label){case 0:e=I({err:new Error,className:a,methodName:l,sourceLink:p}),g.label=1;case 1:return g.trys.push([1,3,,4]),[4,f.apply(this,t)];case 2:return[2,g.sent()];case 3:throw n=g.sent(),r=n,o=n.message,s=n.error,d=n.error_description,h={title:i||a+"."+l+" failed",content:[{type:"error",body:n}]},o&&/^\{.*\}$/.test(o)&&(y=JSON.parse(o),h.subtitle=y,y.code&&(e?(e.code=y.code,e.message=y.msg):(n.code=y.code,n.message=y.msg),r=e||n,h.content=u.map((function(t){return{type:"info",body:t}})))),s&&d&&(h.subtitle=d,e?(e.code=s,e.msg=d):(n.code=s,n.message=d),r=e||n,h.content=u.map((function(t){return{type:"info",body:t}}))),Object(c.printGroupLog)(h),r;case 4:return[2]}}))}))}}}}function I(t){var e=t.err,n=t.className,r=t.methodName,o=t.sourceLink;if(!o)return null;var i,s=e.stack.split("\n"),a=w?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp(n+"\\.descriptor.value\\s*\\[as\\s"+r+"\\]\\s*\\(.*\\)$"),c=w?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp(n+"\\.descriptor.value\\s*\\[as\\s"+r+"\\]"),u=s.findIndex((function(t){return a.test(t)}));if(-1!==u){var l=s.filter((function(t,e){return e>u}));l.unshift(s[u].replace(c,n+"."+r).replace(_,o)),(i=new Error).stack=(w?"@debugger":"Error")+"\n"+l.join("\n")}return i}function A(t){this.message=t}A.prototype=new Error,A.prototype.name="InvalidCharacterError";"undefined"!=typeof window&&window.atob&&window.atob.bind(window);function R(t){this.message=t}R.prototype=new Error,R.prototype.name="InvalidTokenError";var j,N=function(){return(N=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},E=function(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s},P=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},x=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))},L=function(t,e){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=s.trys,(o=o.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=e.call(t,s)}catch(t){i=[6,t],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])}}};!function(t){t.put="put",t.post="post"}(j||(j={}));var T=s.getSdkName,k=s.ERRORS,F=s.COMMUNITY_SITE_URL,U=c.isArray,M=c.isString,C=c.isPalinObject,D=c.execCallback,B=r.catchErrorsDecorator,H=new(function(){function t(){}return t.prototype.uploadFile=function(t,e){return x(this,void 0,void 0,(function(){var n,r,o,i,s,a,c,u,l,f,p,d,h,y,g,m,v,b,w,O,_,S,I,A,R;return L(this,(function(E){switch(E.label){case 0:if(n=t.cloudPath,r=t.filePath,o=t.onUploadProgress,i=t.method,s=void 0===i?"put":i,a=t.headers,c=void 0===a?{}:a,!M(n)||!r)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.uploadFile] invalid params"}));return u={put:j.put,post:j.post}[s.toLocaleLowerCase()]||j.put,"storage.getUploadMetadata",l=this.request,f={path:n,method:u},u===j.put&&(f.headers=c),[4,l.send("storage.getUploadMetadata",f)];case 1:return p=E.sent(),d=p.data,h=d.url,y=d.authorization,g=d.token,m=d.fileId,v=d.cosFileId,b=d.download_url,w=p.requestId,_=N(N({},O={url:h,file:r,name:n,onUploadProgress:o}),{method:j.put,headers:N(N({},c),{authorization:y,"x-cos-meta-fileid":v,"x-cos-security-token":g})}),S=N(N({},O),{method:j.post,data:{key:n,signature:y,"x-cos-meta-fileid":v,success_action_status:"201","x-cos-security-token":g}}),(R={})[j.put]={params:_,isSuccess:function(t){return t>=200&&t<300}},R[j.post]={params:S,isSuccess:function(t){return 201===t}},I=R,[4,l.upload(I[u].params)];case 2:return A=E.sent(),I[u].isSuccess(A.statusCode)?[2,D(e,null,{fileID:m,download_url:b,requestId:w})]:[2,D(e,new Error("["+T()+"]["+k.OPERATION_FAIL+"][storage]:"+A.data))]}}))}))},t.prototype.getUploadMetadata=function(t,e){return x(this,void 0,void 0,(function(){var n,r,o,i,s;return L(this,(function(a){switch(a.label){case 0:if(n=t.cloudPath,!M(n))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.getUploadMetadata] invalid cloudPath"}));r=this.request,o="storage.getUploadMetadata",a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.send(o,{path:n})];case 2:return i=a.sent(),[2,D(e,null,i)];case 3:return s=a.sent(),[2,D(e,s)];case 4:return[2]}}))}))},t.prototype.deleteFile=function(t,e){return x(this,void 0,void 0,(function(){var n,r,o,i,s,a;return L(this,(function(c){switch(c.label){case 0:if(!(n=t.fileList)||!U(n)||0===n.length)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.deleteFile] fileList must not be empty"}));for(r=0,o=n;r<o.length;r++)if(!(i=o[r])||!M(i))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.deleteFile] fileID must be string"}));return"storage.batchDeleteFile",[4,this.request.send("storage.batchDeleteFile",{fileid_list:n})];case 1:return(s=c.sent()).code?[2,D(e,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,D(e,null,a)])}}))}))},t.prototype.getTempFileURL=function(t,e){return x(this,void 0,void 0,(function(){var n,r,o,i,s,a;return L(this,(function(c){switch(c.label){case 0:if(!(n=t.fileList)||!U(n)||0===n.length)throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.getTempFileURL] fileList must not be empty"}));for(r=[],o=0,i=n;o<i.length;o++)if(s=i[o],C(s)){if(!Object.prototype.hasOwnProperty.call(s,"fileID")||!Object.prototype.hasOwnProperty.call(s,"maxAge"))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.getTempFileURL] file info must include fileID and maxAge"}));r.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!M(s))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.getTempFileURL] invalid fileList"}));r.push({fileid:s})}return"storage.batchGetDownloadUrl",[4,this.request.send("storage.batchGetDownloadUrl",{file_list:r})];case 1:return(a=c.sent()).code?[2,D(e,null,a)]:[2,D(e,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},t.prototype.downloadFile=function(t,e){return x(this,void 0,void 0,(function(){var n,r,o,i,s,a;return L(this,(function(c){switch(c.label){case 0:if(n=t.fileID,!M(n))throw new Error(JSON.stringify({code:k.INVALID_PARAMS,msg:"[storage.getTempFileURL] fileID must be string"}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}]})];case 1:return r=c.sent(),"SUCCESS"!==(o=r.fileList[0]).code?[2,D(e,o)]:(i=this.request,s=encodeURI(o.download_url),[4,i.download({url:s})]);case 2:return a=c.sent(),[2,D(e,null,a)]}}))}))},E([B({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+F]}),P("design:type",Function),P("design:paramtypes",[Object,Function]),P("design:returntype",Promise)],t.prototype,"uploadFile",null),E([B({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+F]}),P("design:type",Function),P("design:paramtypes",[Object,Function]),P("design:returntype",Promise)],t.prototype,"getUploadMetadata",null),E([B({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+F]}),P("design:type",Function),P("design:paramtypes",[Object,Function]),P("design:returntype",Promise)],t.prototype,"deleteFile",null),E([B({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+F]}),P("design:type",Function),P("design:paramtypes",[Object,Function]),P("design:returntype",Promise)],t.prototype,"getTempFileURL",null),E([B({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:"+F]}),P("design:type",Function),P("design:paramtypes",[Object,Function]),P("design:returntype",Promise)],t.prototype,"downloadFile",null),t}()),q={name:"storage",entity:{uploadFile:H.uploadFile,deleteFile:H.deleteFile,getTempFileURL:H.getTempFileURL,downloadFile:H.downloadFile,getUploadMetadata:H.getUploadMetadata}};try{cloudbase.registerComponent(q)}catch(A){}function J(t){try{t.registerComponent(q)}catch(t){console.warn(t)}}}])}));
package/package.json CHANGED
@@ -1,98 +1,72 @@
1
1
  {
2
- "name": "@cloudbase/js-sdk",
3
- "version": "2.5.15-beta.0",
4
- "description": "cloudbase javascript sdk",
5
- "main": "dist/index.cjs.js",
6
- "module": "dist/index.esm.js",
7
- "miniprogram": "miniprogram_dist",
8
- "typings": "./index.d.ts",
9
- "scripts": {
10
- "lint": "eslint --fix \"./src/**/*.ts\" \"./database/**/*.ts\"",
11
- "build": "rm -rf dist/ && gulp build",
12
- "build:cdn": "gulp cdn",
13
- "build:miniapp": "gulp miniapp",
14
- "build:e2e": "rm -rf dist/ && NODE_ENV=e2e gulp e2e",
15
- "precommit": "lint-staged"
16
- },
17
- "publishConfig": {
18
- "access": "public"
19
- },
20
- "repository": {
21
- "type": "git",
22
- "url": "https://github.com/TencentCloudBase/cloudbase-js-sdk"
23
- },
24
- "keywords": [
25
- "tcb",
26
- "cloudbase",
27
- "Cloudbase",
28
- "serverless",
29
- "Serverless",
30
- "javascript",
31
- "JavaScript"
32
- ],
33
- "files": [
34
- "miniprogram_dist",
35
- "**/dist/",
36
- "/index.d.ts",
37
- "**/package.json"
38
- ],
39
- "components": [
40
- "app",
41
- "auth",
42
- "database",
43
- "functions",
44
- "storage"
45
- ],
46
- "author": "",
47
- "license": "Apache-2.0",
48
- "dependencies": {
49
- "@cloudbase/analytics": "^2.5.7-beta.0",
50
- "@cloudbase/app": "^2.5.7-beta.0",
51
- "@cloudbase/auth": "^2.5.7-beta.0",
52
- "@cloudbase/database": "0.9.19",
53
- "@cloudbase/functions": "^2.5.7-beta.0",
54
- "@cloudbase/realtime": "^2.5.7-beta.0",
55
- "@cloudbase/storage": "^2.5.7-beta.0",
56
- "@cloudbase/types": "^2.5.7-beta.0",
57
- "@cloudbase/utilities": "^2.5.7-beta.0"
58
- },
59
- "devDependencies": {
60
- "@babel/core": "^7.9.0",
61
- "@babel/plugin-proposal-class-properties": "^7.8.3",
62
- "@babel/plugin-transform-runtime": "^7.9.0",
63
- "@babel/preset-env": "^7.9.5",
64
- "@babel/preset-typescript": "^7.9.0",
65
- "@tencent/eslint-config-tencent": "^1.0.4",
66
- "@typescript-eslint/eslint-plugin": "^5.40.0",
67
- "@typescript-eslint/parser": "^5.40.0",
68
- "awesome-typescript-loader": "^5.2.1",
69
- "babel-loader": "^8.1.0",
70
- "eslint": "^6.8.0",
71
- "gulp": "^4.0.2",
72
- "gulp-clean": "^0.4.0",
73
- "gulp-rename": "^2.0.0",
74
- "gulp-sourcemaps": "^2.6.5",
75
- "gulp-typescript": "^6.0.0-alpha.1",
76
- "json-loader": "^0.5.7",
77
- "lint-staged": "^13.0.3",
78
- "merge-stream": "^2.0.0",
79
- "package-json-cleanup-loader": "^1.0.3",
80
- "webpack": "4.41.3",
81
- "webpack-cli": "^3.3.11",
82
- "webpack-node-externals": "^1.7.2",
83
- "webpack-stream": "^5.2.1",
84
- "webpack-visualizer-plugin": "^0.1.11"
85
- },
86
- "browserslist": [
87
- "last 2 version",
88
- "> 1%",
89
- "not dead",
90
- "chrome 53"
91
- ],
92
- "lint-staged": {
93
- "**/*.ts": [
94
- "eslint --fix"
95
- ]
96
- },
97
- "gitHead": "e6f99cb8f18a04cef0ef439d54818d3a15ecd76e"
2
+ "name": "@cloudbase/js-sdk",
3
+ "version": "2.5.17-beta.0",
4
+ "description": "cloudbase javascript sdk",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.esm.js",
7
+ "miniprogram": "miniprogram_dist",
8
+ "typings": "./index.d.ts",
9
+ "scripts": {
10
+ "lint": "eslint --fix \"./src/**/*.ts\" \"./database/**/*.ts\"",
11
+ "build": "rm -rf dist/ && gulp build",
12
+ "build:cdn": "gulp cdn",
13
+ "build:miniapp": "gulp miniapp",
14
+ "build:e2e": "rm -rf dist/ && NODE_ENV=e2e gulp e2e",
15
+ "precommit": "lint-staged"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/TencentCloudBase/cloudbase-js-sdk"
23
+ },
24
+ "keywords": [
25
+ "tcb",
26
+ "cloudbase",
27
+ "Cloudbase",
28
+ "serverless",
29
+ "Serverless",
30
+ "javascript",
31
+ "JavaScript"
32
+ ],
33
+ "files": [
34
+ "miniprogram_dist",
35
+ "**/dist/",
36
+ "/index.d.ts",
37
+ "**/package.json"
38
+ ],
39
+ "components": [
40
+ "app",
41
+ "auth",
42
+ "database",
43
+ "functions",
44
+ "storage"
45
+ ],
46
+ "author": "",
47
+ "license": "Apache-2.0",
48
+ "dependencies": {
49
+ "@cloudbase/adapter-interface": "^0.4.1",
50
+ "@cloudbase/analytics": "^2.5.16-beta.0",
51
+ "@cloudbase/app": "^2.5.16-beta.0",
52
+ "@cloudbase/auth": "^2.5.16-beta.0",
53
+ "@cloudbase/database": "0.9.19",
54
+ "@cloudbase/functions": "^2.5.16-beta.0",
55
+ "@cloudbase/realtime": "^2.5.16-beta.0",
56
+ "@cloudbase/storage": "^2.5.16-beta.0",
57
+ "@cloudbase/types": "^2.5.16-beta.0",
58
+ "@cloudbase/utilities": "^2.5.16-beta.0"
59
+ },
60
+ "browserslist": [
61
+ "last 2 version",
62
+ "> 1%",
63
+ "not dead",
64
+ "chrome 53"
65
+ ],
66
+ "lint-staged": {
67
+ "**/*.ts": [
68
+ "eslint --fix"
69
+ ]
70
+ },
71
+ "gitHead": "3299d6f65fff1240429f06a910cae16ef464dd83"
98
72
  }