@cloudbase/js-sdk 2.5.35-beta.0 → 2.5.37-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.
package/miniprogram_dist/auth.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_auth",[],e):"object"==typeof exports?exports.cloudbase_auth=e():t.cloudbase_auth=e()}("undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var t={860:(t,e,n)=>{n.r(e),n.d(e,{Auth:()=>ft,LoginState:()=>pt,registerAuth:()=>yt});var r="@cloudbase/js-sdk";function i(){return r}var o,s={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(t){t.local="local",t.none="none",t.session="session"}(o||(o={}));function a(t,e){console.warn("[".concat(i(),"][").concat(t,"]:").concat(e))}var u,c,h=(u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},u(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),l=function(){return l=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},l.apply(this,arguments)};!function(t){function e(e){var n=t.call(this)||this,r=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||"请求超时",n.restrictedMethods=o||["get","post","upload","download"],n}h(e,t),e.prototype.get=function(t){return this.request(l(l({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(l(l({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(l(l({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,i=t.method,o=t.headers,s=void 0===o?{}:o,a={post:"post",put:"put"}[null==i?void 0:i.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",r),u.append("file",n),this.request(l(l({},t),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(l(l({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return e=this,n=void 0,i=function(){var e,n,r,i;return function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.get(l(l({},t),{headers:{},responseType:"blob"}))];case 1:return e=o.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(i=document.createElement("a")).href=n,i.setAttribute("download",r),i.style.display="none",document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return o.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))},new((r=void 0)||(r=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((i=i.apply(e,n||[])).next())}));var e,n,r,i},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(i){var o,s,a,u=t.url,c=t.headers,h=void 0===c?{}:c,l=t.data,d=t.responseType,p=t.withCredentials,f=t.body,v=t.onUploadProgress,y=function(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),i="";return Object.keys(n).forEach((function(t){""===i?!r&&(e+="?"):i+="&",i+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=i)?e:"".concat(t).concat(e)}("https:",u,"get"===r?l:{}),g=new XMLHttpRequest;g.open(r,y),d&&(g.responseType=d),Object.keys(h).forEach((function(t){g.setRequestHeader(t,h[t])})),v&&g.upload.addEventListener("progress",v),g.onreadystatechange=function(){var t={};if(4===g.readyState){var e=g.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),i=e.join(": ");n[r]=i})),t.header=n,t.statusCode=g.status;try{t.data="blob"===d?g.response:JSON.parse(g.responseText)}catch(e){t.data="blob"===d?g.response:g.responseText}clearTimeout(o),i(t)}},e&&n.timeout&&(o=setTimeout((function(){console.warn(n.timeoutMsg),g.abort()}),n.timeout)),a=l,s="[object FormData]"===Object.prototype.toString.call(a)?l:"application/x-www-form-urlencoded"===h["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}(l):f||(l?JSON.stringify(l):void 0),p&&(g.withCredentials=!0),g.send(s)}))}}((function(){})),function(t){t.WEB="web",t.WX_MP="wx_mp"}(c||(c={}));var d=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},f=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},v=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return d(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}((function(){}));!function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,i=t.keys,o=void 0===i?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(a(s.INVALID_PARAMS,"localStorage is not supported on current platform"),new v(e.root));case"none":return new v(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,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:s.OPERATION_FAIL,msg:"[".concat(i(),"][").concat(s.OPERATION_FAIL,"]setStore failed"),info:t}))}}else a(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return p(this,void 0,void 0,(function(){var r;return f(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}a(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return p(this,void 0,void 0,(function(){var r;return f(this,(function(i){switch(i.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=i.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):a(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return p(this,void 0,void 0,(function(){return f(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var y=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),g=function(t,e){this.data=e||null,this.name=t},_=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return y(e,t),e}(g),I=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(t instanceof _)return console.error(t.error),this;var n="string"==typeof t?new g(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,o=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];i<o.length;i++)o[i].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new I;"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");var m,b,E,R,w,S,A;function O(t){this.message=t}function U(t){this.message=t}function T(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}O.prototype=new Error,O.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),U.prototype=new Error,U.prototype.name="InvalidTokenError",function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(m||(m={})),(A=b||(b={})).UNREACHABLE="unreachable",A.LOCAL="local",A.CANCELLED="cancelled",A.UNKNOWN="unknown",A.INVALID_ARGUMENT="invalid_argument",A.DEADLINE_EXCEEDED="deadline_exceeded",A.NOT_FOUND="not_found",A.ALREADY_EXISTS="already_exists",A.PERMISSION_DENIED="permission_denied",A.UNAUTHENTICATED="unauthenticated",A.RESOURCE_EXHAUSTED="resource_exhausted",A.FAILED_PRECONDITION="failed_precondition",A.ABORTED="aborted",A.OUT_OF_RANGE="out_of_range",A.UNIMPLEMENTED="unimplemented",A.INTERNAL="internal",A.UNAVAILABLE="unavailable",A.DATA_LOSS="data_loss",A.CAPTCHA_REQUIRED="captcha_required",A.CAPTCHA_INVALID="captcha_invalid",A.INVALID_PASSWORD="invalid_password",A.INVALID_STATUS="invalid_status",A.USER_PENDING="user_pending",A.USER_BLOCKED="user_blocked",A.INVALID_VERIFICATION_CODE="invalid_verification_code",A.TWO_FACTOR_REQUIRED="two_factor_required",A.INVALID_TWO_FACTOR="invalid_two_factor",A.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",A.UNDER_REVIEW="under_review",A.INVALID_REQUEST="invalid_request",A.UNAUTHORIZED_CLIENT="unauthorized_client",A.ACCESS_DENIED="access_denied",A.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",A.INVALID_SCOPE="invalid_scope",A.INVALID_GRANT="invalid_grant",A.SERVER_ERROR="server_error",A.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",A.INTERACTION_REQUIRED="interaction_required",A.LOGIN_REQUIRED="login_required",A.ACCOUNT_SELECTION_REQUIRED="account_selection_required",A.CONSENT_REQUIRED="consent_required",A.INVALID_REQUEST_URI="invalid_request_uri",A.INVALID_REQUEST_OBJECT="invalid_request_object",A.REQUEST_NOT_SUPPORTED="request_not_supported",A.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",A.REGISTRATION_NOT_SUPPORTED="registration_not_supported",function(t){t.AUTH_SIGN_IN_URL="/auth/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",t.AUTH_SIGN_UP_URL="/auth/v1/signup",t.AUTH_TOKEN_URL="/auth/v1/token",t.AUTH_REVOKE_URL="/auth/v1/revoke",t.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",t.PROVIDER_TOKEN_URL="/auth/v1/provider/token",t.PROVIDER_URI_URL="/auth/v1/provider/uri",t.USER_ME_URL="/auth/v1/user/me",t.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",t.USER_QUERY_URL="/auth/v1/user/query",t.USER_PRIFILE_URL="/auth/v1/user/profile",t.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",t.VERIFICATION_URL="/auth/v1/verification",t.VERIFY_URL="/auth/v1/verification/verify",t.PROVIDER_LIST="/auth/v1/user/provider",t.PROVIDER_UNBIND_URL="/auth/v1/user/provider",t.CHECK_PWD_URL="/auth/v1/user/sudo",t.SUDO_URL="/auth/v1/user/sudo",t.BIND_CONTACT_URL="/auth/v1/user/contact",t.AUTH_SET_PASSWORD="/auth/v1/user/password",t.AUTH_RESET_PASSWORD="/auth/v1/reset",t.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",t.CHECK_USERNAME="/auth/v1/checkUsername",t.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist"}(E||(E={})),function(t){t.AUTH_SIGN_IN_URL="/auth/v2/signin/username",t.AUTH_TOKEN_URL="/auth/v2/token",t.USER_ME_URL="/auth/v2/user/me",t.VERIFY_URL="/auth/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider"}(R||(R={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(w||(w={})),function(t){t.INVALID_ARGUMENT="invalid_argument",t.DEADLINE_EXCEEDED="deadline_exceeded",t.NOT_FOUND="not_found",t.ALREADY_EXISTS="already_exists",t.PERMISSION_DENIED="permission_denied",t.ABORTED="aborted",t.OUT_OF_RANGE="out_of_range",t.UNIMPLEMENTED="unimplemented",t.INTERNAL="internal",t.UNAVAILABLE="unavailable",t.DATA_LOSS="data_loss",t.CAPTCHA_REQUIRED="captcha_required",t.CAPTCHA_INVALID="captcha_invalid",t.INVALID_PASSWORD="invalid_password",t.PASSWORD_NOT_SET="password_not_set",t.INVALID_STATUS="invalid_status",t.USER_PENDING="user_pending",t.USER_BLOCKED="user_blocked"}(S||(S={}));var P=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},C=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},N=function(){function t(){this.fnPromiseMap=new Map}return t.prototype.run=function(t,e){return P(this,void 0,void 0,(function(){var n,r=this;return C(this,(function(i){switch(i.label){case 0:return[4,n=this.fnPromiseMap.get(t)];case 1:return i.sent()||(n=new Promise((function(n,i){P(r,void 0,void 0,(function(){var r,o,s;return C(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return a.sent(),r=e(),o=n,[4,r];case 2:return o.apply(void 0,[a.sent()]),[3,5];case 3:return s=a.sent(),i(s),[3,5];case 4:return this.fnPromiseMap.delete(t),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(t,n)),[2,n]}}))}))},t.prototype.runIdlePromise=function(){return Promise.resolve()},t}(),L=function(){return L=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},L.apply(this,arguments)},k=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},D=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},x="x-request-id",q="x-device-id",V="device_id",j=function(t,e){return k(this,void 0,void 0,(function(){var n,r,i,o,s;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]),(i=Object.assign({},e)).method||(i.method="GET"),i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),[4,fetch(t,i)];case 2:return[4,a.sent().json()];case 3:return(null==(o=a.sent())?void 0:o.error)?(r=o).error_uri=new URL(t).pathname:n=o,[3,5];case 4:return s=a.sent(),r={error:b.UNREACHABLE,error_description:s.message,error_uri:new URL(t).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},F=new(function(){function t(){}return t.prototype.getItem=function(t){return k(this,void 0,void 0,(function(){return D(this,(function(e){return[2,window.localStorage.getItem(t)]}))}))},t.prototype.removeItem=function(t){return k(this,void 0,void 0,(function(){return D(this,(function(e){return window.localStorage.removeItem(t),[2]}))}))},t.prototype.setItem=function(t,e){return k(this,void 0,void 0,(function(){return D(this,(function(n){return window.localStorage.setItem(t,e),[2]}))}))},t.prototype.getItemSync=function(t){return window.localStorage.getItem(t)},t.prototype.removeItemSync=function(t){window.localStorage.removeItem(t)},t.prototype.setItemSync=function(t,e){window.localStorage.setItem(t,e)},t}());function H(t){var e=!0;return(null==t?void 0:t.expires_at)&&(null==t?void 0:t.access_token)&&(e=t.expires_at<new Date),e}var W=function(){function t(t){this.credentials=null,this.singlePromise=new N,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage}return t.prototype.getStorageCredentialsSync=function(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t},t.prototype.setCredentials=function(t){return k(this,void 0,void 0,(function(){var e;return D(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.expires_in)?(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30)),this.storage?(e=JSON.stringify(t),[4,this.storage.setItem(this.tokenSectionName,e)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=t,[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]}}))}))},t.prototype.getCredentials=function(){return k(this,void 0,void 0,(function(){var t=this;return D(this,(function(e){return[2,this.singlePromise.run("getCredentials",(function(){return k(t,void 0,void 0,(function(){var t;return D(this,(function(e){switch(e.label){case 0:return H(this.credentials)?(t=this,[4,this.getStorageCredentials()]):[3,2];case 1:t.credentials=e.sent(),e.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},t.prototype.getStorageCredentials=function(){return k(this,void 0,void 0,(function(){var t=this;return D(this,(function(e){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return k(t,void 0,void 0,(function(){var t,e;return D(this,(function(n){switch(n.label){case 0:return t=null,[4,this.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)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),t=null,[3,5];case 5:return[2,t]}}))}))}))]}))}))},t}(),G=function(){function t(e){this.singlePromise=new N,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,t.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=j,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||F,this.localCredentials=new W({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage}),this.clientSecret=e.clientSecret,this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}return t.prototype.setCredentials=function(t){return this.localCredentials.setCredentials(t)},t.prototype.getAccessToken=function(){return k(this,void 0,void 0,(function(){var t,e;return D(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(t=n.sent())?void 0:t.access_token)?[2,Promise.resolve(t.access_token)]:(e={error:b.UNAUTHENTICATED},[2,Promise.reject(e)])}}))}))},t.prototype.request=function(e,n){return k(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return D(this,(function(h){switch(h.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=L(L({},this.headers),n.headers)),n.headers[x]||(n.headers[x]=T()),n.headers[q]?[3,2]:[4,this.getDeviceId()];case 1:i=h.sent(),n.headers[q]=i,h.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(o=h.sent())&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(o.access_token)):n.headers.Authorization="".concat(o.token_type," ").concat(o.access_token)),[3,5];case 4:this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId)),h.label=5;case 5:e.startsWith("/")&&(e=this.apiOrigin+e),s=null,a=r+1,u=0,h.label=6;case 6:if(!(u<a))return[3,15];h.label=7;case 7:return h.trys.push([7,9,,12]),[4,this.baseRequest(e,n)];case 8:return s=h.sent(),[3,15];case 9:return c=h.sent(),n.withCredentials&&c&&c.error===b.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return h.sent(),[2,Promise.reject(c)];case 11:return u!==r&&c&&"unreachable"===c.error?[3,12]:[2,Promise.reject(c)];case 12:return[4,this.sleep(t.retryInterval)];case 13:h.sent(),h.label=14;case 14:return u++,[3,6];case 15:return[2,s]}}))}))},t.prototype.getCredentials=function(){return k(this,void 0,void 0,(function(){var t,e,n;return D(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return H(t=r.sent())?t&&"anonymous"===t.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(t)]:[3,5]:[3,8]:[3,10];case 2:return e=r.sent(),(n=e)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return t=n,[3,7];case 5:return[4,this.anonymousSignIn(t)];case 6:t=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(t)];case 9:t=r.sent(),r.label=10;case 10:return[2,t]}}))}))},t.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},t.prototype.getCredentialsAsync=function(){return this.getCredentials()},t.prototype.getScope=function(){return k(this,void 0,void 0,(function(){var t;return D(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.getGroups=function(){return k(this,void 0,void 0,(function(){var t;return D(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.refreshToken=function(t){return k(this,void 0,void 0,(function(){var e=this;return D(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return k(e,void 0,void 0,(function(){var e,n;return D(this,(function(r){switch(r.label){case 0:if(!t||!t.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(t.refresh_token,t)];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==b.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]}}))}))}))]}))}))},t.prototype.checkRetry=function(e){var n=null;if(("number"!=typeof e||e<t.minRetry||e>t.maxRetry)&&(n={error:b.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return e},t.prototype.formatRetry=function(t,e){return void 0===t?e:this.checkRetry(t)},t.prototype.sleep=function(t){return k(this,void 0,void 0,(function(){return D(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.prototype.anonymousSignIn=function(t){return k(this,void 0,void 0,(function(){var e=this;return D(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return k(e,void 0,void 0,(function(){var e,n;return D(this,(function(r){switch(r.label){case 0:if(!t||"anonymous"!==t.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 e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==b.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]}}))}))}))]}))}))},t.prototype.defaultRefreshTokenFunc=function(t,e){return k(this,void 0,void 0,(function(){var n,r;return D(this,(function(i){switch(i.label){case 0:return void 0===t||""===t?[2,this.unAuthenticatedError("refresh token not found")]:(n=E.AUTH_TOKEN_URL,"v2"===(null==e?void 0:e.version)&&(n=R.AUTH_TOKEN_URL),[4,this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:t}})]);case 1:return r=i.sent(),[2,L(L({},r),{version:(null==e?void 0:e.version)||"v1"})]}}))}))},t.prototype.getDeviceId=function(){return k(this,void 0,void 0,(function(){var t;return D(this,(function(e){switch(e.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(V)];case 1:return"string"==typeof(t=e.sent())&&t.length>=16&&t.length<=48?[3,3]:(t=T(),[4,this.storage.setItem(V,t)]);case 2:e.sent(),e.label=3;case 3:return this.deviceID=t,[2,t]}}))}))},t.prototype.unAuthenticatedError=function(t){var e={error:b.UNAUTHENTICATED,error_description:t};return Promise.reject(e)},t.defaultRetry=2,t.minRetry=0,t.maxRetry=5,t.retryInterval=1e3,t}(),M=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},B=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},K=function(){function t(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=F),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}return t.prototype.request=function(t,e){return M(this,void 0,void 0,(function(){var n,r,i,o;return B(this,(function(s){switch(s.label){case 0:return e||(e={}),e.method||(e.method="GET"),n="".concat(e.method,":").concat(t),r=t,e.withCaptcha?[4,this.appendCaptchaTokenToURL(t,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,e)];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(t,n,"captcha_invalid"===o.error)];case 5:return t=s.sent(),[2,this.config.request(t,e)];case 6:return[2,Promise.reject(o)];case 7:return[2,i]}}))}))},t.prototype.getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var t=document.createElement("div");t.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;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback},t.prototype.defaultOpenURIWithCallback=function(t){return M(this,void 0,void 0,(function(){var e,n;return B(this,(function(r){return e=document.getElementById("captcha_panel_wrap"),n=document.createElement("iframe"),e.innerHTML="",n.setAttribute("src",t),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;",e.appendChild(n),e.style.display="block",[2,new Promise((function(t,r){n.onload=function(){try{var i=window.location,o=n.contentWindow.location;if(o.host+o.pathname===i.host+i.pathname){e.style.display="none";var s=new URLSearchParams(o.search),a=s.get("captcha_token");return a?t({captcha_token:a,expires_in:Number(s.get("expires_in"))}):r({error:s.get("error"),error_description:s.get("error_description")})}e.style.display="block"}catch(t){e.style.display="block"}}}))]}))}))},t.prototype.getCaptchaToken=function(t,e){return M(this,void 0,void 0,(function(){var n,r,i,o,s;return B(this,(function(a){switch(a.label){case 0:return t?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=a.sent())return[2,n];a.label=2;case 2:return r="".concat(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:e},withCredentials:!1})];case 3:return(i=a.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=a.sent(),this.saveCaptchaToken(s),[2,s.captcha_token]}}))}))},t.prototype.appendCaptchaTokenToURL=function(t,e,n){return M(this,void 0,void 0,(function(){var r;return B(this,(function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,e)];case 1:return r=i.sent(),t.indexOf("?")>0?t+="&captcha_token=".concat(r):t+="?captcha_token=".concat(r),[2,t]}}))}))},t.prototype.saveCaptchaToken=function(t){return M(this,void 0,void 0,(function(){var e;return B(this,(function(n){switch(n.label){case 0:return t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10)),e=JSON.stringify(t),[4,this.config.storage.setItem(this.tokenSectionName,e)];case 1:return n.sent(),[2]}}))}))},t.prototype.findCaptchaToken=function(){return M(this,void 0,void 0,(function(){var t,e;return B(this,(function(n){switch(n.label){case 0:return[4,this.config.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)),e.expires_at<new Date?[2,null]:[2,e.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]}}))}))},t}(),Y=function(t){var e=function(e){for(var n in t)t.hasOwnProperty(n)&&(e[n]=Y(t[n]));return e},n=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(n))return t.slice();switch(n){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},J=function(){return J=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},J.apply(this,arguments)},Q=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},X=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},z=function(){function t(t){var e=t.request,n=t.credentialsClient;if(!n){var r={apiOrigin:t.apiOrigin,clientId:t.clientId,storage:t.storage};n=new G(r)}if(!e){var i=n.request.bind(n),o=new K({clientId:t.clientId,request:i,storage:t.storage});e=o.request.bind(o)}this.config={apiOrigin:t.apiOrigin,clientId:t.clientId,request:e,credentialsClient:n,storage:t.storage||F}}return t.parseParamsToSearch=function(t){return Object.keys(t).forEach((function(e){t[e]||delete t[e]})),new URLSearchParams(t).toString()},t.prototype.getParamsByVersion=function(t,e){var n,r=Y(t),i=(null===(n={v2:R}[null==r?void 0:r.version])||void 0===n?void 0:n[e])||E[e];return r&&delete r.version,{params:r,url:i}},t.prototype.signIn=function(t){return Q(this,void 0,void 0,(function(){var e,n,r;return X(this,(function(i){switch(i.label){case 0:return e=t.version||"v1",(n=this.getParamsByVersion(t,"AUTH_SIGN_IN_URL")).params.query&&delete n.params.query,[4,this.config.request(n.url,{method:"POST",body:n.params})];case 1:return r=i.sent(),[4,this.config.credentialsClient.setCredentials(J(J({},r),{version:e}))];case 2:return i.sent(),[2,Promise.resolve(r)]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){switch(n.label){case 0:return[4,this.config.request(E.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signUp=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){switch(n.label){case 0:return[4,this.config.request(E.AUTH_SIGN_UP_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signOut=function(){return Q(this,void 0,void 0,(function(){var t,e;return X(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return t=n.sent(),[4,this.config.request(E.AUTH_REVOKE_URL,{method:"POST",body:{token:t}})];case 2:return e=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.getVerification=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){switch(n.label){case 0:return e=!1,"CUR_USER"!==t.target?[3,1]:(e=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(e=!0),n.label=3;case 3:return[2,this.config.request(E.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:!0,withCredentials:e})]}}))}))},t.prototype.verify=function(t){return Q(this,void 0,void 0,(function(){var e,n;return X(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"VERIFY_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),"v2"!==(null==t?void 0:t.version)?[3,3]:[4,this.config.credentialsClient.setCredentials(J(J({},n),{version:"v2"}))];case 2:r.sent(),r.label=3;case 3:return[2,n]}}))}))},t.prototype.genProviderRedirectUri=function(t){return Q(this,void 0,void 0,(function(){var e,n;return X(this,(function(r){return e="".concat(E.PROVIDER_URI_URL,"?client_id=").concat(this.config.clientId,"&provider_id=").concat(t.provider_id,"&redirect_uri=").concat(encodeURIComponent(t.provider_redirect_uri),"&state=").concat(t.state),(n=t.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(e+="&other_params[sign_out_uri]=".concat(n.sign_out_uri)),[2,this.config.request(e,{method:"GET"})]}))}))},t.prototype.grantProviderToken=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.PROVIDER_TOKEN_URL,{method:"POST",body:t})]}))}))},t.prototype.patchProviderToken=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})]}))}))},t.prototype.signInWithProvider=function(t){return Q(this,void 0,void 0,(function(){var e,n;return X(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(J(J({},n),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return r.sent(),[2,Promise.resolve(n)]}}))}))},t.prototype.bindWithProvider=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.getUserProfile=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.getUserInfo(t)]}))}))},t.prototype.getUserInfo=function(t){var e;return void 0===t&&(t={}),Q(this,void 0,void 0,(function(){var n,r,i;return X(this,(function(o){switch(o.label){case 0:return n=this.getParamsByVersion(t,"USER_ME_URL"),(null===(e=n.params)||void 0===e?void 0:e.query)&&(r=new URLSearchParams(n.params.query),n.url+="?".concat(r.toString())),[4,this.config.request(n.url,{method:"GET",withCredentials:!0})];case 1:return(i=o.sent()).sub&&(i.uid=i.sub),[2,i]}}))}))},t.prototype.getWedaUserInfo=function(){return Q(this,void 0,void 0,(function(){return X(this,(function(t){switch(t.label){case 0:return[4,this.config.request(E.WEDA_USER_URL,{method:"GET",withCredentials:!0})];case 1:return[2,t.sent()]}}))}))},t.prototype.deleteMe=function(e){return Q(this,void 0,void 0,(function(){var n,r;return X(this,(function(i){return n=this.getParamsByVersion(e,"USER_ME_URL"),r="".concat(n.url,"?").concat(t.parseParamsToSearch(n.params)),[2,this.config.request(r,{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.hasLoginState=function(){return Q(this,void 0,void 0,(function(){return X(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},t.prototype.getLoginState=function(){return Q(this,void 0,void 0,(function(){return X(this,(function(t){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},t.prototype.transByProvider=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.grantToken=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){return e=this.getParamsByVersion(t,"AUTH_TOKEN_URL"),[2,this.config.request(e.url,{method:"POST",body:e.params})]}))}))},t.prototype.getProviders=function(){return Q(this,void 0,void 0,(function(){return X(this,(function(t){return[2,this.config.request(E.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},t.prototype.unbindProvider=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request("".concat(E.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.checkPassword=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request("".concat(E.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.bindPhone=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request("".concat(E.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.bindEmail=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request("".concat(E.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.setPassword=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request("".concat(E.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.updatePasswordByOld=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:t.old_password})];case 1:return e=n.sent(),[2,this.setPassword({sudo_token:e.sudo_token,new_password:t.new_password})]}}))}))},t.prototype.sudo=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request("".concat(E.SUDO_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.getCurUserVerification=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return t.target="CUR_USER",[2,this.config.request(E.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})]}))}))},t.prototype.changeBindedProvider=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request("".concat(E.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})]}))}))},t.prototype.setUserProfile=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.queryUserProfile=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(E.USER_QUERY_URL,"?").concat(e.toString()),{method:"GET",withCredentials:!0})]}))}))},t.prototype.setCustomSignFunc=function(t){this.getCustomSignTicketFn=t},t.prototype.signInWithCustomTicket=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){switch(n.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=n.sent(),[2,this.signInWithProvider(J(J({},t),{provider_id:"custom",provider_token:e}))]}}))}))},t.prototype.resetPassword=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.AUTH_RESET_PASSWORD,{method:"POST",body:t})]}))}))},t.prototype.deviceAuthorize=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.checkUsername=function(t){return Q(this,void 0,void 0,(function(){return X(this,(function(e){return[2,this.config.request(E.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})]}))}))},t.prototype.checkIfUserExist=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(E.CHECK_IF_USER_EXIST,"?").concat(e.toString()),{method:"GET"})]}))}))},t.prototype.loginScope=function(){return Q(this,void 0,void 0,(function(){return X(this,(function(t){return[2,this.config.credentialsClient.getScope()]}))}))},t.prototype.loginGroups=function(){return Q(this,void 0,void 0,(function(){return X(this,(function(t){return[2,this.config.credentialsClient.getGroups()]}))}))},t.prototype.refreshTokenForce=function(t){return Q(this,void 0,void 0,(function(){var e;return X(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return e=n.sent(),[4,this.config.credentialsClient.refreshToken(J(J({},e),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return[2,n.sent()]}}))}))},t.prototype.getCredentials=function(){return Q(this,void 0,void 0,(function(){return X(this,(function(t){return[2,this.config.credentialsClient.getCredentials()]}))}))},t}(),Z=function(){return Z=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Z.apply(this,arguments)},$=function(t){var e=t.apiOrigin,n=t.clientId,r=t.storage,i=t.request,o=t.anonymousSignInFunc;this.oauth2client=new G({apiOrigin:e,clientId:n,storage:r,baseRequest:i,anonymousSignInFunc:o}),this.authApi=new z(Z(Z({credentialsClient:this.oauth2client},t),{request:i?this.oauth2client.request.bind(this.oauth2client):void 0}))},tt=function(){return tt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},tt.apply(this,arguments)},et=function(t,e,n,r){var i,o=arguments.length,s=o<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--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},nt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},rt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},it=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},ot=a,st=function(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(i(),"][").concat(t,"]:").concat(e)}))},at=s,ut="https://support.qq.com/products/148793",ct=function(t){t.mode,t.customInfo,t.title,t.messages;return function(t,e,n){}},ht="loginStateChanged",lt=new I,dt=function(){function t(t){var e=t.cache,n=t.oauthInstance;this.cache=e,this.oauthInstance=n,this.setUserInfo()}return t.prototype.checkLocalInfo=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},t.prototype.checkLocalInfoAsync=function(){return rt(this,void 0,void 0,(function(){var t,e,n,r;return it(this,(function(i){switch(i.label){case 0:return t=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return t.uid=i.sent(),e=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return e.gender=i.sent(),this.picture=this.getLocalUserInfo("picture"),n=this,[4,this.getLocalUserInfoAsync("email")];case 3:return n.email=i.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),r=this,[4,this.getLocalUserInfoAsync("username")];case 4:return r.username=i.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},t.prototype.update=function(t){return rt(this,void 0,void 0,(function(){var e;return it(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(tt({},t))];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2]}}))}))},t.prototype.updatePassword=function(t,e){return this.oauthInstance.authApi.updatePasswordByOld({old_password:e,new_password:t})},t.prototype.updateUsername=function(t){return"string"!=typeof t&&st(at.INVALID_PARAMS,"username must be a string"),this.update({username:t})},t.prototype.refresh=function(t){return rt(this,void 0,void 0,(function(){var e;return it(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(t)];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2,e]}}))}))},t.prototype.getLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;return this.cache.getStore(e)[t]},t.prototype.getLocalUserInfoAsync=function(t){return rt(this,void 0,void 0,(function(){var e;return it(this,(function(n){switch(n.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(e)];case 1:return[2,n.sent()[t]]}}))}))},t.prototype.setUserInfo=function(){var t=this,e=this.cache.keys.userInfoKey,n=this.cache.getStore(e);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(e){t[e]=n[e]}))},t.prototype.setLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;this.cache.setStore(e,t),this.setUserInfo()},et([ct({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"update",null),et([ct({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[String,String]),nt("design:returntype",void 0)],t.prototype,"updatePassword",null),et([ct({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[String]),nt("design:returntype",void 0)],t.prototype,"updateUsername",null),et([ct({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"refresh",null),t}(),pt=function(){function t(t){var e=t.envId,n=t.cache,r=t.oauthInstance;e||st(at.INVALID_PARAMS,"envId is not defined"),this.cache=n,this.oauthInstance=r,this.user=new dt({cache:this.cache,oauthInstance:r})}return t.prototype.checkLocalState=function(){var t;this.oauthLoginState=null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},t.prototype.checkLocalStateAsync=function(){var t;return rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}}))}))},t}(),ft=function(){function t(t){this.config=t,this.cache=t.cache,this.oauthInstance=t.oauthInstance}return t.prototype.bindPhoneNumber=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.bindPhone(t)]}))}))},t.prototype.unbindProvider=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.unbindProvider(t)]}))}))},t.prototype.bindEmail=function(t){return this.oauthInstance.authApi.bindEmail(t)},t.prototype.verify=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.verify(t)]}))}))},t.prototype.getVerification=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.getVerification(t)]}))}))},Object.defineProperty(t.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var t=this.hasLoginState();return t&&t.user||null}ot(at.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),t.prototype.getCurrentUser=function(){return rt(this,void 0,void 0,(function(){var t;return it(this,(function(e){switch(e.label){case 0:return[4,this.getLoginState()];case 1:return(t=e.sent())?[4,t.user.checkLocalInfoAsync()]:[3,3];case 2:return e.sent(),[2,t.user||null];case 3:return[2,null]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setCustomSignFunc=function(t){this.oauthInstance.authApi.setCustomSignFunc(t)},t.prototype.signInWithCustomTicket=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signIn=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signIn(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signUp=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signUp(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setPassword=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.setPassword(t)]}))}))},t.prototype.isUsernameRegistered=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return"string"!=typeof t&&st(at.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:t})];case 1:return[2,e.sent().exist]}}))}))},t.prototype.signOut=function(){return rt(this,void 0,void 0,(function(){var t;return it(this,(function(e){switch(e.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut()];case 1:return e.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return e.sent(),lt.fire(ht),[2]}}))}))},t.prototype.hasLoginState=function(){var t;if("async"!==this.cache.mode)return(null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync())?new pt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;ot(at.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},t.prototype.getLoginState=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return t.sent()?[2,new pt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},t.prototype.getUserInfo=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.getUserInfo(t)]}))}))},t.prototype.getWedaUserInfo=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},t.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},t.prototype.bindWithProvider=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.bindWithProvider(t)]}))}))},t.prototype.queryUser=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.queryUserProfile(t)]}))}))},t.prototype.getAccessToken=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:t.sent(),env:this.config.env}]}}))}))},t.prototype.grantProviderToken=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.grantProviderToken(t)]}))}))},t.prototype.patchProviderToken=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.patchProviderToken(t)]}))}))},t.prototype.signInWithProvider=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.grantToken=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.grantToken(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.genProviderRedirectUri=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.genProviderRedirectUri(t)]}))}))},t.prototype.resetPassword=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.resetPassword(t)]}))}))},t.prototype.deviceAuthorize=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.deviceAuthorize(t)]}))}))},t.prototype.sudo=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.sudo(t)]}))}))},t.prototype.deleteMe=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.deleteMe(t)]}))}))},t.prototype.getProviders=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){return[2,this.oauthInstance.authApi.getProviders()]}))}))},t.prototype.loginScope=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){return[2,this.oauthInstance.authApi.loginScope()]}))}))},t.prototype.loginGroups=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},t.prototype.onLoginStateChanged=function(t){return rt(this,void 0,void 0,(function(){var e,n=this;return it(this,(function(r){switch(r.label){case 0:return lt.on(ht,(function(){return rt(n,void 0,void 0,(function(){var e;return it(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return e=n.sent(),t.call(this,e),[2]}}))}))})),[4,this.getLoginState()];case 1:return e=r.sent(),t.call(this,e),[2]}}))}))},t.prototype.refreshTokenForce=function(t){return rt(this,void 0,void 0,(function(){return it(this,(function(e){return[2,this.oauthInstance.authApi.refreshTokenForce(t)]}))}))},t.prototype.getCredentials=function(){return rt(this,void 0,void 0,(function(){return it(this,(function(t){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},t.prototype.createLoginState=function(t){return rt(this,void 0,void 0,(function(){var e;return it(this,(function(n){switch(n.label){case 0:return[4,(e=new pt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return n.sent(),[4,e.user.refresh(t)];case 2:return n.sent(),lt.fire(ht),[2,e]}}))}))},et([ct({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"bindPhoneNumber",null),et([ct({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"unbindProvider",null),et([ct({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",void 0)],t.prototype,"bindEmail",null),et([ct({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"verify",null),et([ct({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"getVerification",null),et([ct({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[]),nt("design:returntype",Promise)],t.prototype,"getCurrentUser",null),et([ct({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"signInAnonymously",null),et([ct({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"signInWithCustomTicket",null),et([ct({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"signUp",null),et([ct({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[String]),nt("design:returntype",Promise)],t.prototype,"isUsernameRegistered",null),et([ct({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[]),nt("design:returntype",Promise)],t.prototype,"signOut",null),et([ct({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[]),nt("design:returntype",Promise)],t.prototype,"getLoginState",null),et([ct({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"getUserInfo",null),et([ct({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[]),nt("design:returntype",Promise)],t.prototype,"getWedaUserInfo",null),et([ct({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ut)]}),nt("design:type",Function),nt("design:paramtypes",[Object]),nt("design:returntype",Promise)],t.prototype,"bindWithProvider",null),t}(),vt={name:"auth",namespace:"auth",entity:function(t){if(void 0===t&&(t={region:"",persistence:"local"}),this.authInstance)return ot(at.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var e=this.platform,n=e.adapter,r=e.runtime,i=t.persistence||n.primaryStorage;i&&i!==this.config.persistence&&this.updateConfig({persistence:i});var o=this.config,s=o.env,a=o.persistence,u=o.debug,c=o.clientId,h=o.storage,l=new $({clientId:c,apiOrigin:this.request.getBaseEndPoint(),storage:(null==t?void 0:t.storage)||h,request:null==t?void 0:t.request,anonymousSignInFunc:null==t?void 0:t.anonymousSignInFunc});return this.oauthInstance=l,this.authInstance=new ft({env:s,region:t.region,persistence:a,debug:u,cache:this.cache,runtime:r,_fromApp:this,oauthInstance:l}),this.authInstance}};try{cloudbase.registerComponent(vt)}catch(O){}function yt(t){try{t.registerComponent(vt)}catch(t){console.warn(t)}}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r](o,o.exports,n),o.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{var t=r;Object.defineProperty(t,"__esModule",{value:!0}),t.registerAuth=void 0;var e=n(860);t.registerAuth=e.registerAuth})(),r})()));
|
|
1
|
+
/*! For license information please see auth.js.LICENSE.txt */
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_auth",[],e):"object"==typeof exports?exports.cloudbase_auth=e():t.cloudbase_auth=e()}("undefined"!=typeof window?window:this,(()=>(()=>{var t={298:function(t,e,n){var r;t.exports=(r=r||function(t,e){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==n.g&&n.g.crypto&&(r=n.g.crypto),!r)try{r=n(633)}catch(t){}var i=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),s={},a=s.lib={},u=a.Base={extend:function(t){var e=o(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)}},c=a.WordArray=u.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;o<i;o++){var s=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=s<<24-(r+o)%4*8}else for(var a=0;a<i;a+=4)e[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,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=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(i());return new c.init(e,t)}}),h=s.enc={},l=h.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).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 c.init(n,e/2)}},f=h.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}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 c.init(n,e)}},p=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},d=a.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=p.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,i=r.words,o=r.sigBytes,s=this.blockSize,a=o/(4*s),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,h=t.min(4*u,o);if(u){for(var l=0;l<u;l+=s)this._doProcessBlock(i,l);n=i.splice(0,u),r.sigBytes-=h}return new c.init(n,h)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),g=(a.Hasher=d.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){d.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 g.HMAC.init(t,n).finalize(e)}}}),s.algo={});return s}(Math),r)},171:function(t,e,n){var r;t.exports=(r=n(298),n(624),n(775),r.HmacSHA256)},775:function(t,e,n){var r,i,o;t.exports=(i=(r=n(298)).lib.Base,o=r.enc.Utf8,void(r.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=o.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),s=this._iKey=e.clone(),a=i.words,u=s.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;i.sigBytes=s.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))}})))},991:function(t,e,n){var r;t.exports=(r=n(298),function(){if("function"==typeof ArrayBuffer){var t=r.lib.WordArray,e=t.init,n=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var n=t.byteLength,r=[],i=0;i<n;i++)r[i>>>2]|=t[i]<<24-i%4*8;e.call(this,r,n)}else e.apply(this,arguments)};n.prototype=t}}(),r.lib.WordArray)},624:function(t,e,n){var r;t.exports=(r=n(298),function(t){var e=r,n=e.lib,i=n.WordArray,o=n.Hasher,s=e.algo,a=[],u=[];!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,i=0;i<64;)e(r)&&(i<8&&(a[i]=n(t.pow(r,.5))),u[i]=n(t.pow(r,1/3)),i++),r++}();var c=[],h=s.SHA256=o.extend({_doReset:function(){this._hash=new i.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],s=n[3],a=n[4],h=n[5],l=n[6],f=n[7],p=0;p<64;p++){if(p<16)c[p]=0|t[e+p];else{var d=c[p-15],g=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=c[p-2],v=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[p]=g+c[p-7]+v+c[p-16]}var m=r&i^r&o^i&o,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),S=f+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&h^~a&l)+u[p]+c[p];f=l,l=h,h=a,a=s+S|0,s=o,o=i,i=r,r=S+(b+m)|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+h|0,n[6]=n[6]+l|0,n[7]=n[7]+f|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=o._createHelper(h),e.HmacSHA256=o._createHmacHelper(h)}(Math),r.SHA256)},550:function(t,e){!function(t){"use strict";var e="0123456789abcdefghijklmnopqrstuvwxyz";function n(t){return e.charAt(t)}function r(t,e){return t&e}function i(t,e){return t|e}function o(t,e){return t^e}function s(t,e){return t&~e}function a(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function u(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="=";function l(t){var e,n,r="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),r+=c.charAt(n>>6)+c.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),r+=c.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),r+=c.charAt(n>>2)+c.charAt((3&n)<<4));(3&r.length)>0;)r+=h;return r}function f(t){var e,r="",i=0,o=0;for(e=0;e<t.length&&t.charAt(e)!=h;++e){var s=c.indexOf(t.charAt(e));s<0||(0==i?(r+=n(s>>2),o=3&s,i=1):1==i?(r+=n(o<<2|s>>4),o=15&s,i=2):2==i?(r+=n(o),r+=n(s>>2),o=3&s,i=3):(r+=n(o<<2|s>>4),r+=n(15&s),i=0))}return 1==i&&(r+=n(o<<2)),r}var p,d=function(t,e){return d=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])},d(t,e)};var g,y=function(t){var e;if(void 0===p){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(p={},e=0;e<16;++e)p[n.charAt(e)]=e;for(n=n.toLowerCase(),e=10;e<16;++e)p[n.charAt(e)]=e;for(e=0;e<r.length;++e)p[r.charAt(e)]=-1}var i=[],o=0,s=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=p[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);o|=a,++s>=2?(i[i.length]=o,o=0,s=0):o<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return i},v={decode:function(t){var e;if(void 0===g){var n="= \f\n\r\t \u2028\u2029";for(g=Object.create(null),e=0;e<64;++e)g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<n.length;++e)g[n.charAt(e)]=-1}var r=[],i=0,o=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=g[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++o>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=v.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return v.decode(t)}},m=1e13,b=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var n,r,i=this.buf,o=i.length;for(n=0;n<o;++n)(r=i[n]*t+e)<m?e=0:r-=(e=0|r/m)*m,i[n]=r;e>0&&(i[n]=e)},t.prototype.sub=function(t){var e,n,r=this.buf,i=r.length;for(e=0;e<i;++e)(n=r[e]-t)<0?(n+=m,t=1):t=0,r[e]=n;for(;0===r[r.length-1];)r.pop()},t.prototype.toString=function(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,n=e[e.length-1].toString(),r=e.length-2;r>=0;--r)n+=(m+e[r]).toString().substring(1);return n},t.prototype.valueOf=function(){for(var t=this.buf,e=0,n=t.length-1;n>=0;--n)e=e*m+t[n];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),S="…",E=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,w=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function I(t,e){return t.length>e&&(t=t.substring(0,e)+S),t}var T,_=function(){function t(e,n){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,n){for(var r="",i=t;i<e;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},t.prototype.isASCII=function(t,e){for(var n=t;n<e;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var n="",r=t;r<e;++r)n+=String.fromCharCode(this.get(r));return n},t.prototype.parseStringUTF=function(t,e){for(var n="",r=t;r<e;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},t.prototype.parseStringBMP=function(t,e){for(var n,r,i="",o=t;o<e;)n=this.get(o++),r=this.get(o++),i+=String.fromCharCode(n<<8|r);return i},t.prototype.parseTime=function(t,e,n){var r=this.parseStringISO(t,e),i=(n?E:w).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(r+=":"+i[5],i[6]&&(r+=":"+i[6],i[7]&&(r+="."+i[7]))),i[8]&&(r+=" UTC","Z"!=i[8]&&(r+=i[8],i[9]&&(r+=":"+i[9]))),r):"Unrecognized time: "+r},t.prototype.parseInteger=function(t,e){for(var n,r=this.get(t),i=r>127,o=i?255:0,s="";r==o&&++t<e;)r=this.get(t);if(0==(n=e-t))return i?-1:0;if(n>4){for(s=r,n<<=3;0==(128&(+s^o));)s=+s<<1,--n;s="("+n+" bit)\n"}i&&(r-=256);for(var a=new b(r),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()},t.prototype.parseBitString=function(t,e,n){for(var r=this.get(t),i="("+((e-t-1<<3)-r)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?r:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>n)return i+I(o,n)}return i+o},t.prototype.parseOctetString=function(t,e,n){if(this.isASCII(t,e))return I(this.parseStringISO(t,e),n);var r=e-t,i="("+r+" byte)\n";r>(n/=2)&&(e=t+n);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return r>n&&(i+=S),i},t.prototype.parseOID=function(t,e,n){for(var r="",i=new b,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===r)if((i=i.simplify())instanceof b)i.sub(80),r="2."+i.toString();else{var u=i<80?i<40?0:1:2;r=u+"."+(i-40*u)}else r+="."+i.toString();if(r.length>n)return I(r,n);i=new b,o=0}}return o>0&&(r+=".incomplete"),r},t}(),R=function(){function t(t,e,n,r,i){if(!(r instanceof A))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=n,this.tag=r,this.sub=i}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+n,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);case 6:return this.stream.parseOID(e,e+n,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return I(this.stream.parseStringUTF(e,e+n),t);case 18:case 19:case 20:case 21:case 22:case 26:return I(this.stream.parseStringISO(e,e+n),t);case 30:return I(this.stream.parseStringBMP(e,e+n),t);case 23:case 24:return this.stream.parseTime(e,e+n,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var n=0,r=this.sub.length;n<r;++n)e+=this.sub[n].toPrettyString(t)}return e},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(t){var e=t.get(),n=127&e;if(n==e)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===n)return null;e=0;for(var r=0;r<n;++r)e=256*e+t.get();return e},t.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,n=2*this.length;return t.substr(e,n)},t.decode=function(e){var n;n=e instanceof _?e:new _(e,0);var r=new _(n),i=new A(n),o=t.decodeLength(n),s=n.pos,a=s-r.pos,u=null,c=function(){var e=[];if(null!==o){for(var r=s+o;n.pos<r;)e[e.length]=t.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=t.decode(n);if(i.tag.isEOC())break;e[e.length]=i}o=s-n.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return e};if(i.tagConstructed)u=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");u=c();for(var h=0;h<u.length;++h)if(u[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){u=null}if(null===u){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);n.pos=s+Math.abs(o)}return new t(r,a,o,i,u)},t}(),A=function(){function t(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){var n=new b;do{e=t.get(),n.mulAdd(128,127&e)}while(128&e);this.tagNumber=n.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),O=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],D=(1<<26)/O[O.length-1],P=function(){function t(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return t.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,i=(1<<e)-1,o=!1,s="",a=this.t,u=this.DB-a*this.DB%e;if(a-- >0)for(u<this.DB&&(r=this[a]>>u)>0&&(o=!0,s=n(r));a>=0;)u<e?(r=(this[a]&(1<<u)-1)<<e-u,r|=this[--a]>>(u+=this.DB-e)):(r=this[a]>>(u-=e)&i,u<=0&&(u+=this.DB,--a)),r>0&&(o=!0),o&&(s+=n(r));return o?s:"0"},t.prototype.negate=function(){var e=L();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+M(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var n=L();return this.abs().divRemTo(e,null,n),this.s<0&&n.compareTo(t.ZERO)>0&&e.subTo(n,n),n},t.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new N(e):new x(e),this.exp(t,n)},t.prototype.clone=function(){var t=L();return this.copyTo(t),t},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},t.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var n,r=this.DB-t*this.DB%8,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e},t.prototype.equals=function(t){return 0==this.compareTo(t)},t.prototype.min=function(t){return this.compareTo(t)<0?this:t},t.prototype.max=function(t){return this.compareTo(t)>0?this:t},t.prototype.and=function(t){var e=L();return this.bitwiseTo(t,r,e),e},t.prototype.or=function(t){var e=L();return this.bitwiseTo(t,i,e),e},t.prototype.xor=function(t){var e=L();return this.bitwiseTo(t,o,e),e},t.prototype.andNot=function(t){var e=L();return this.bitwiseTo(t,s,e),e},t.prototype.not=function(){for(var t=L(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},t.prototype.shiftLeft=function(t){var e=L();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},t.prototype.shiftRight=function(t){var e=L();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},t.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+a(this[t]);return this.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=u(this[n]^e);return t},t.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},t.prototype.setBit=function(t){return this.changeBit(t,i)},t.prototype.clearBit=function(t){return this.changeBit(t,s)},t.prototype.flipBit=function(t){return this.changeBit(t,o)},t.prototype.add=function(t){var e=L();return this.addTo(t,e),e},t.prototype.subtract=function(t){var e=L();return this.subTo(t,e),e},t.prototype.multiply=function(t){var e=L();return this.multiplyTo(t,e),e},t.prototype.divide=function(t){var e=L();return this.divRemTo(t,e,null),e},t.prototype.remainder=function(t){var e=L();return this.divRemTo(t,null,e),e},t.prototype.divideAndRemainder=function(t){var e=L(),n=L();return this.divRemTo(t,e,n),[e,n]},t.prototype.modPow=function(t,e){var n,r,i=t.bitLength(),o=H(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new N(e):e.isEven()?new C(e):new x(e);var s=[],a=3,u=n-1,c=(1<<n)-1;if(s[1]=r.convert(this),n>1){var h=L();for(r.sqrTo(s[1],h);a<=c;)s[a]=L(),r.mulTo(h,s[a-2],s[a]),a+=2}var l,f,p=t.t-1,d=!0,g=L();for(i=M(t[p])-1;p>=0;){for(i>=u?l=t[p]>>i-u&c:(l=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(l|=t[p-1]>>this.DB+i-u)),a=n;0==(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--p),d)s[l].copyTo(o),d=!1;else{for(;a>1;)r.sqrTo(o,g),r.sqrTo(g,o),a-=2;a>0?r.sqrTo(o,g):(f=o,o=g,g=f),r.mulTo(g,s[l],o)}for(;p>=0&&0==(t[p]&1<<i);)r.sqrTo(o,g),f=o,o=g,g=f,--i<0&&(i=this.DB-1,--p)}return r.revert(o)},t.prototype.modInverse=function(e){var n=e.isEven();if(this.isEven()&&n||0==e.signum())return t.ZERO;for(var r=e.clone(),i=this.clone(),o=H(1),s=H(0),a=H(0),u=H(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),n?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(r,i),n&&a.subTo(o,a),u.subTo(s,u))}return 0!=i.compareTo(t.ONE)?t.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u},t.prototype.pow=function(t){return this.exp(t,new U)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var i=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},t.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=O[O.length-1]){for(e=0;e<O.length;++e)if(n[0]==O[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<O.length;){for(var r=O[e],i=e+1;i<O.length&&r<D;)r*=O[i++];for(r=n.modInt(r);e<i;)if(r%O[e++]==0)return!1}return n.millerRabin(t)},t.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(e,n);r=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var a=8==r?255&+e[i]:j(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&+e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},t.prototype.lShiftTo=function(t,e){for(var n=t%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(t/this.DB),s=this.s<<n&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>r|s,s=(this[a]&i)<<n;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,i=this.DB-r,o=(1<<r)-1;e[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<i,e[s-n]=this[s]>>r;r>0&&(e[this.t-n-1]|=(this.s&o)<<i),e.t=this.t-n,e.clamp()}},t.prototype.subTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},t.prototype.multiplyTo=function(e,n){var r=this.abs(),i=e.abs(),o=r.t;for(n.t=o+i.t;--o>=0;)n[o]=0;for(o=0;o<i.t;++o)n[o+r.t]=r.am(0,i[o],n,o,0,r.t);n.s=0,n.clamp(),this.s!=e.s&&t.ZERO.subTo(n,n)},t.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,n,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=L());var s=L(),a=this.s,u=e.s,c=this.DB-M(i[i.t-1]);c>0?(i.lShiftTo(c,s),o.lShiftTo(c,r)):(i.copyTo(s),o.copyTo(r));var h=s.t,l=s[h-1];if(0!=l){var f=l*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),p=this.FV/f,d=(1<<this.F1)/f,g=1<<this.F2,y=r.t,v=y-h,m=null==n?L():n;for(s.dlShiftTo(v,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),t.ONE.dlShiftTo(h,m),m.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--v>=0;){var b=r[--y]==l?this.DM:Math.floor(r[y]*p+(r[y-1]+g)*d);if((r[y]+=s.am(0,b,r,v,0,h))<b)for(s.dlShiftTo(v,m),r.subTo(m,r);r[y]<--b;)r.subTo(m,r)}null!=n&&(r.drShiftTo(h,n),a!=u&&t.ZERO.subTo(n,n)),r.t=h,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&t.ZERO.subTo(r,r)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,n){if(e>4294967295||e<1)return t.ONE;var r=L(),i=L(),o=n.convert(this),s=M(e)-1;for(o.copyTo(r);--s>=0;)if(n.sqrTo(r,i),(e&1<<s)>0)n.mulTo(i,o,r);else{var a=r;r=i,i=a}return n.revert(r)},t.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=H(n),i=L(),o=L(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(t).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(t)+s},t.prototype.fromRadix=function(e,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),o=!1,s=0,a=0,u=0;u<e.length;++u){var c=j(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(o=!0):(a=n*a+c,++s>=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(n,s)),this.dAddOffset(a,0)),o&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,n,r){if("number"==typeof n)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),i,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var o=[],s=7&e;o.length=1+(e>>3),n.nextBytes(o),s>0?o[0]&=(1<<s)-1:o[0]=0,this.fromString(o,256)}},t.prototype.bitwiseTo=function(t,e,n){var r,i,o=Math.min(t.t,this.t);for(r=0;r<o;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(i=t.s&this.DM,r=o;r<this.t;++r)n[r]=e(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<t.t;++r)n[r]=e(i,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},t.prototype.changeBit=function(e,n){var r=t.ONE.shiftLeft(e);return this.bitwiseTo(r,n,r),r},t.prototype.addTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,n){var r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,t[r],n,r,0,this.t);for(i=Math.min(t.t,e);r<i;++r)this.am(0,t[r],n,r,0,e-r);n.clamp()},t.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},t.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},t.prototype.millerRabin=function(e){var n=this.subtract(t.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);(e=e+1>>1)>O.length&&(e=O.length);for(var o=L(),s=0;s<e;++s){o.fromInt(O[Math.floor(Math.random()*O.length)]);var a=o.modPow(i,this);if(0!=a.compareTo(t.ONE)&&0!=a.compareTo(n)){for(var u=1;u++<r&&0!=a.compareTo(n);)if(0==(a=a.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},t.prototype.square=function(){var t=L();return this.squareTo(t),t},t.prototype.gcda=function(t,e){var n=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var o=n.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)e(n);else{o<s&&(s=o),s>0&&(n.rShiftTo(s,n),r.rShiftTo(s,r));var a=function(){(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(a,0):(s>0&&r.lShiftTo(s,r),setTimeout((function(){e(r)}),0))};setTimeout(a,10)}},t.prototype.fromNumberAsync=function(e,n,r,o){if("number"==typeof n)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),i,this),this.isEven()&&this.dAddOffset(1,0);var s=this,a=function(){s.dAddOffset(2,0),s.bitLength()>e&&s.subTo(t.ONE.shiftLeft(e-1),s),s.isProbablePrime(n)?setTimeout((function(){o()}),0):setTimeout(a,0)};setTimeout(a,0)}else{var u=[],c=7&e;u.length=1+(e>>3),n.nextBytes(u),c>0?u[0]&=(1<<c)-1:u[0]=0,this.fromString(u,256)}},t}(),U=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),N=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),x=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=L();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(P.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=L();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),C=function(){function t(t){this.m=t,this.r2=L(),this.q3=L(),P.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=L();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function L(){return new P(null)}function B(t,e){return new P(t,e)}"Microsoft Internet Explorer"==navigator.appName?(P.prototype.am=function(t,e,n,r,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+n[r]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),n[r++]=1073741823&u}return i},T=30):"Netscape"!=navigator.appName?(P.prototype.am=function(t,e,n,r,i,o){for(;--o>=0;){var s=e*this[t++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},T=26):(P.prototype.am=function(t,e,n,r,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+n[r]+i)>>28)+(h>>14)+a*c,n[r++]=268435455&u}return i},T=28),P.prototype.DB=T,P.prototype.DM=(1<<T)-1,P.prototype.DV=1<<T;P.prototype.FV=Math.pow(2,52),P.prototype.F1=52-T,P.prototype.F2=2*T-52;var k,V,q=[];for(k="0".charCodeAt(0),V=0;V<=9;++V)q[k++]=V;for(k="a".charCodeAt(0),V=10;V<36;++V)q[k++]=V;for(k="A".charCodeAt(0),V=10;V<36;++V)q[k++]=V;function j(t,e){var n=q[t.charCodeAt(e)];return null==n?-1:n}function H(t){var e=L();return e.fromInt(t),e}function M(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}P.ZERO=H(0),P.ONE=H(1);var F=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}();var K,G,W=256,z=null;if(null==z){z=[],G=0;var Y=void 0;if(window.crypto&&window.crypto.getRandomValues){var J=new Uint32Array(256);for(window.crypto.getRandomValues(J),Y=0;Y<J.length;++Y)z[G++]=255&J[Y]}var Z=function(t){if(this.count=this.count||0,this.count>=256||G>=W)window.removeEventListener?window.removeEventListener("mousemove",Z,!1):window.detachEvent&&window.detachEvent("onmousemove",Z);else try{var e=t.x+t.y;z[G++]=255&e,this.count+=1}catch(t){}};window.addEventListener?window.addEventListener("mousemove",Z,!1):window.attachEvent&&window.attachEvent("onmousemove",Z)}function Q(){if(null==K){for(K=new F;G<W;){var t=Math.floor(65536*Math.random());z[G++]=255&t}for(K.init(z),G=0;G<z.length;++G)z[G]=0;G=0}return K.next()}var X=function(){function t(){}return t.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=Q()},t}();var $=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),n=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(n)<0;)e=e.add(this.p);return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},t.prototype.setPublic=function(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=B(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var n=[],r=t.length-1;r>=0&&e>0;){var i=t.charCodeAt(r--);i<128?n[--e]=i:i>127&&i<2048?(n[--e]=63&i|128,n[--e]=i>>6|192):(n[--e]=63&i|128,n[--e]=i>>6&63|128,n[--e]=i>>12|224)}n[--e]=0;for(var o=new X,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);n[--e]=s[0]}return n[--e]=2,n[--e]=0,new P(n)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var r=n.toString(16);return 0==(1&r.length)?r:"0"+r},t.prototype.encryptLong=function(t){var e=this,n=(this.n.bitLength()+7>>3)-11;try{var r="";return t.length>n?(t.match(/.{1,117}/g).forEach((function(t){var n=e.encrypt(t);r+=n})),l(r)):l(this.encrypt(t))}catch(t){return!1}},t.prototype.decryptLong=function(t){var e=this,n=this.n.bitLength()+7>>3;t=f(t);try{if(t.length>n){var r="";return t.match(/.{1,256}/g).forEach((function(t){var n=e.decrypt(t);r+=n})),r}return this.decrypt(t)}catch(t){return!1}},t.prototype.setPrivate=function(t,e,n){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=B(t,16),this.e=parseInt(e,16),this.d=B(n,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,n,r,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=B(t,16),this.e=parseInt(e,16),this.d=B(n,16),this.p=B(r,16),this.q=B(i,16),this.dmp1=B(o,16),this.dmq1=B(s,16),this.coeff=B(a,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var n=new X,r=t>>1;this.e=parseInt(e,16);for(var i=new P(e,16);;){for(;this.p=new P(t-r,1,n),0!=this.p.subtract(P.ONE).gcd(i).compareTo(P.ONE)||!this.p.isProbablePrime(10););for(;this.q=new P(r,1,n),0!=this.q.subtract(P.ONE).gcd(i).compareTo(P.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(P.ONE),a=this.q.subtract(P.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(P.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=B(t,16),n=this.doPrivate(e);return null==n?null:function(t,e){for(var n=t.toByteArray(),r=0;r<n.length&&0==n[r];)++r;if(n.length-r!=e-1||2!=n[r])return null;for(++r;0!=n[r];)if(++r>=n.length)return null;for(var i="";++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,n){var r=new X,i=t>>1;this.e=parseInt(e,16);var o=new P(e,16),s=this,a=function(){var e=function(){if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(P.ONE),r=s.q.subtract(P.ONE),i=e.multiply(r);0==i.gcd(o).compareTo(P.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(r),s.coeff=s.q.modInverse(s.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},u=function(){s.q=L(),s.q.fromNumberAsync(i,1,r,(function(){s.q.subtract(P.ONE).gcda(o,(function(t){0==t.compareTo(P.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},c=function(){s.p=L(),s.p.fromNumberAsync(t-i,1,r,(function(){s.p.subtract(P.ONE).gcda(o,(function(t){0==t.compareTo(P.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},t.prototype.sign=function(t,e,n){var r=function(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var n=e-t.length-6,r="",i=0;i<n;i+=2)r+="ff";return B("0001"+r+"00"+t,16)}((tt[n]||"")+e(t).toString(),this.n.bitLength()/4);if(null==r)return null;var i=this.doPrivate(r);if(null==i)return null;var o=i.toString(16);return 0==(1&o.length)?o:"0"+o},t.prototype.verify=function(t,e,n){var r=B(e,16),i=this.doPublic(r);return null==i?null:function(t){for(var e in tt)if(tt.hasOwnProperty(e)){var n=tt[e],r=n.length;if(t.substr(0,r)==n)return t.substr(r)}return t}(i.toString(16).replace(/^1f+00/,""))==n(t).toString()},t}();var tt={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};var et={};et.lang={extend:function(t,e,n){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var r=function(){};if(r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),n){var i;for(i in n)t.prototype[i]=n[i];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(o=function(t,e){for(i=0;i<s.length;i+=1){var n=s[i],r=e[n];"function"==typeof r&&r!=Object.prototype[n]&&(t[n]=r)}})}catch(t){}o(t.prototype,n)}}};var nt={};void 0!==nt.asn1&&nt.asn1||(nt.asn1={}),nt.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var n=e.substr(1).length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";e=new P(r,16).xor(t).add(P.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=nt.asn1,n=e.DERBoolean,r=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,s=e.DERNull,a=e.DERObjectIdentifier,u=e.DEREnumerated,c=e.DERUTF8String,h=e.DERNumericString,l=e.DERPrintableString,f=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,g=e.DERGeneralizedTime,y=e.DERSequence,v=e.DERSet,m=e.DERTaggedObject,b=e.ASN1Util.newObject,S=Object.keys(t);if(1!=S.length)throw"key of param shall be only one.";var E=S[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+E+":"))throw"undefined key: "+E;if("bool"==E)return new n(t[E]);if("int"==E)return new r(t[E]);if("bitstr"==E)return new i(t[E]);if("octstr"==E)return new o(t[E]);if("null"==E)return new s(t[E]);if("oid"==E)return new a(t[E]);if("enum"==E)return new u(t[E]);if("utf8str"==E)return new c(t[E]);if("numstr"==E)return new h(t[E]);if("prnstr"==E)return new l(t[E]);if("telstr"==E)return new f(t[E]);if("ia5str"==E)return new p(t[E]);if("utctime"==E)return new d(t[E]);if("gentime"==E)return new g(t[E]);if("seq"==E){for(var w=t[E],I=[],T=0;T<w.length;T++){var _=b(w[T]);I.push(_)}return new y({array:I})}if("set"==E){for(w=t[E],I=[],T=0;T<w.length;T++)_=b(w[T]),I.push(_);return new v({array:I})}if("tag"==E){var R=t[E];if("[object Array]"===Object.prototype.toString.call(R)&&3==R.length){var A=b(R[2]);return new m({tag:R[0],explicit:R[1],obj:A})}var O={};if(void 0!==R.explicit&&(O.explicit=R.explicit),void 0!==R.tag&&(O.tag=R.tag),void 0===R.obj)throw"obj shall be specified for 'tag'.";return O.obj=b(R.obj),new m(O)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},nt.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",n=parseInt(t.substr(0,2),16),r=(e=Math.floor(n/40)+"."+n%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);r+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new P(r,2).toString(10),r="")}return e},nt.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new P(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},nt.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+n).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},nt.asn1.DERAbstractString=function(t){nt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},et.lang.extend(nt.asn1.DERAbstractString,nt.asn1.ASN1Object),nt.asn1.DERAbstractTime=function(t){nt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,n){var r=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var a=i.getMilliseconds();if(0!=a){var u=r(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,n,r,i,o){var s=new Date(Date.UTC(t,e-1,n,r,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},et.lang.extend(nt.asn1.DERAbstractTime,nt.asn1.ASN1Object),nt.asn1.DERAbstractStructured=function(t){nt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},et.lang.extend(nt.asn1.DERAbstractStructured,nt.asn1.ASN1Object),nt.asn1.DERBoolean=function(){nt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},et.lang.extend(nt.asn1.DERBoolean,nt.asn1.ASN1Object),nt.asn1.DERInteger=function(t){nt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=nt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new P(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},et.lang.extend(nt.asn1.DERInteger,nt.asn1.ASN1Object),nt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=nt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}nt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var n="0"+t;this.hTLV=null,this.isModified=!0,this.hV=n+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var n=0;n<=e;n++)t+="0";var r="";for(n=0;n<t.length-1;n+=8){var i=t.substr(n,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),r+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",n=0;n<t.length;n++)1==t[n]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},et.lang.extend(nt.asn1.DERBitString,nt.asn1.ASN1Object),nt.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=nt.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}nt.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},et.lang.extend(nt.asn1.DEROctetString,nt.asn1.DERAbstractString),nt.asn1.DERNull=function(){nt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},et.lang.extend(nt.asn1.DERNull,nt.asn1.ASN1Object),nt.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new P(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};nt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var e=nt.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},et.lang.extend(nt.asn1.DERObjectIdentifier,nt.asn1.ASN1Object),nt.asn1.DEREnumerated=function(t){nt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=nt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new P(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},et.lang.extend(nt.asn1.DEREnumerated,nt.asn1.ASN1Object),nt.asn1.DERUTF8String=function(t){nt.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},et.lang.extend(nt.asn1.DERUTF8String,nt.asn1.DERAbstractString),nt.asn1.DERNumericString=function(t){nt.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},et.lang.extend(nt.asn1.DERNumericString,nt.asn1.DERAbstractString),nt.asn1.DERPrintableString=function(t){nt.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},et.lang.extend(nt.asn1.DERPrintableString,nt.asn1.DERAbstractString),nt.asn1.DERTeletexString=function(t){nt.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},et.lang.extend(nt.asn1.DERTeletexString,nt.asn1.DERAbstractString),nt.asn1.DERIA5String=function(t){nt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},et.lang.extend(nt.asn1.DERIA5String,nt.asn1.DERAbstractString),nt.asn1.DERUTCTime=function(t){nt.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},et.lang.extend(nt.asn1.DERUTCTime,nt.asn1.DERAbstractTime),nt.asn1.DERGeneralizedTime=function(t){nt.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},et.lang.extend(nt.asn1.DERGeneralizedTime,nt.asn1.DERAbstractTime),nt.asn1.DERSequence=function(t){nt.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},et.lang.extend(nt.asn1.DERSequence,nt.asn1.DERAbstractStructured),nt.asn1.DERSet=function(t){nt.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t.push(n.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},et.lang.extend(nt.asn1.DERSet,nt.asn1.DERAbstractStructured),nt.asn1.DERTaggedObject=function(t){nt.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},et.lang.extend(nt.asn1.DERTaggedObject,nt.asn1.ASN1Object);var rt=function(t){function e(n){var r=t.call(this)||this;return n&&("string"==typeof n?r.parseKey(n):(e.hasPrivateKeyProperty(n)||e.hasPublicKeyProperty(n))&&r.parsePropertiesFrom(n)),r}return function(t,e){function n(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.parseKey=function(t){try{var e=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?y(t):v.unarmor(t),i=R.decode(r);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=B(e,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var o=i.sub[3].getHexStringValue();this.d=B(o,16);var s=i.sub[4].getHexStringValue();this.p=B(s,16);var a=i.sub[5].getHexStringValue();this.q=B(a,16);var u=i.sub[6].getHexStringValue();this.dmp1=B(u,16);var c=i.sub[7].getHexStringValue();this.dmq1=B(c,16);var h=i.sub[8].getHexStringValue();this.coeff=B(h,16)}else{if(2!==i.sub.length)return!1;var l=i.sub[1].sub[0];e=l.sub[0].getHexStringValue(),this.n=B(e,16),n=l.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new nt.asn1.DERInteger({int:0}),new nt.asn1.DERInteger({bigint:this.n}),new nt.asn1.DERInteger({int:this.e}),new nt.asn1.DERInteger({bigint:this.d}),new nt.asn1.DERInteger({bigint:this.p}),new nt.asn1.DERInteger({bigint:this.q}),new nt.asn1.DERInteger({bigint:this.dmp1}),new nt.asn1.DERInteger({bigint:this.dmq1}),new nt.asn1.DERInteger({bigint:this.coeff})]};return new nt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return l(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new nt.asn1.DERSequence({array:[new nt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new nt.asn1.DERNull]}),e=new nt.asn1.DERSequence({array:[new nt.asn1.DERInteger({bigint:this.n}),new nt.asn1.DERInteger({int:this.e})]}),n=new nt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new nt.asn1.DERSequence({array:[t,n]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return l(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(!t)return t;var n="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(n,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}($),it=function(){function t(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new rt(t)},t.prototype.setPrivateKey=function(t){this.setKey(t)},t.prototype.setPublicKey=function(t){this.setKey(t)},t.prototype.decrypt=function(t){try{return this.getKey().decrypt(f(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return l(this.getKey().encrypt(t))}catch(t){return!1}},t.prototype.encryptLong=function(t){try{for(var e=this.getKey().encryptLong(t)||"",n=this.getKey().decryptLong(e)||"",r=0,i=/null$/g;i.test(n)&&(r++,e=this.getKey().encryptLong(t)||"",n=this.getKey().decryptLong(e)||"",!(r>10)););return e}catch(t){return!1}},t.prototype.decryptLong=function(t){try{return this.getKey().decryptLong(t)}catch(t){return!1}},t.prototype.sign=function(t,e,n){try{return l(this.getKey().sign(t,e,n))}catch(t){return!1}},t.prototype.verify=function(t,e,n){try{return this.getKey().verify(t,f(e),n)}catch(t){return!1}},t.prototype.getKey=function(t){if(!this.key){if(this.key=new rt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},t.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},t.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},t.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},t.version="3.1.4",t}();window.JSEncrypt=it,t.JSEncrypt=it,t.default=it,Object.defineProperty(t,"__esModule",{value:!0})}(e)},640:(t,e,n)=>{"use strict";n.r(e),n.d(e,{Auth:()=>Et,LoginState:()=>St,registerAuth:()=>It});var r="@cloudbase/js-sdk";function i(){return r}var o,s={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(t){t.local="local",t.none="none",t.session="session"}(o||(o={}));function a(t,e){console.warn("[".concat(i(),"][").concat(t,"]:").concat(e))}var u,c,h=(u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},u(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),l=function(){return l=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},l.apply(this,arguments)};!function(t){function e(e){var n=t.call(this)||this,r=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||"请求超时",n.restrictedMethods=o||["get","post","upload","download"],n}h(e,t),e.prototype.get=function(t){return this.request(l(l({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(l(l({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(l(l({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,i=t.method,o=t.headers,s=void 0===o?{}:o,a={post:"post",put:"put"}[null==i?void 0:i.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",r),u.append("file",n),this.request(l(l({},t),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(l(l({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return e=this,n=void 0,i=function(){var e,n,r,i;return function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.get(l(l({},t),{headers:{},responseType:"blob"}))];case 1:return e=o.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(i=document.createElement("a")).href=n,i.setAttribute("download",r),i.style.display="none",document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return o.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))},new((r=void 0)||(r=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((i=i.apply(e,n||[])).next())}));var e,n,r,i},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(i){var o,s,a,u=t.url,c=t.headers,h=void 0===c?{}:c,l=t.data,f=t.responseType,p=t.withCredentials,d=t.body,g=t.onUploadProgress,y=function(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),i="";return Object.keys(n).forEach((function(t){""===i?!r&&(e+="?"):i+="&",i+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=i)?e:"".concat(t).concat(e)}("https:",u,"get"===r?l:{}),v=new XMLHttpRequest;v.open(r,y),f&&(v.responseType=f),Object.keys(h).forEach((function(t){v.setRequestHeader(t,h[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(),i=e.join(": ");n[r]=i})),t.header=n,t.statusCode=v.status;try{t.data="blob"===f?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===f?v.response:v.responseText}clearTimeout(o),i(t)}},e&&n.timeout&&(o=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),a=l,s="[object FormData]"===Object.prototype.toString.call(a)?l:"application/x-www-form-urlencoded"===h["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}(l):d||(l?JSON.stringify(l):void 0),p&&(v.withCredentials=!0),v.send(s)}))}}((function(){})),function(t){t.WEB="web",t.WX_MP="wx_mp"}(c||(c={}));var f=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},d=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},g=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return f(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}((function(){}));!function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,i=t.keys,o=void 0===i?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(a(s.INVALID_PARAMS,"localStorage is not supported on current platform"),new g(e.root));case"none":return new g(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,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:s.OPERATION_FAIL,msg:"[".concat(i(),"][").concat(s.OPERATION_FAIL,"]setStore failed"),info:t}))}}else a(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return p(this,void 0,void 0,(function(){var r;return d(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}a(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return p(this,void 0,void 0,(function(){var r;return d(this,(function(i){switch(i.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=i.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):a(s.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return p(this,void 0,void 0,(function(){return d(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var y=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)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),v=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 y(e,t),e}(v),b=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(t instanceof m)return console.error(t.error),this;var n="string"==typeof t?new v(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,o=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];i<o.length;i++)o[i].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new b;"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox");var S,E,w,I,T,_,R;function A(t){this.message=t}function O(t){this.message=t}function D(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}A.prototype=new Error,A.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),O.prototype=new Error,O.prototype.name="InvalidTokenError",function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(S||(S={})),(R=E||(E={})).UNREACHABLE="unreachable",R.LOCAL="local",R.CANCELLED="cancelled",R.UNKNOWN="unknown",R.INVALID_ARGUMENT="invalid_argument",R.DEADLINE_EXCEEDED="deadline_exceeded",R.NOT_FOUND="not_found",R.ALREADY_EXISTS="already_exists",R.PERMISSION_DENIED="permission_denied",R.UNAUTHENTICATED="unauthenticated",R.RESOURCE_EXHAUSTED="resource_exhausted",R.FAILED_PRECONDITION="failed_precondition",R.ABORTED="aborted",R.OUT_OF_RANGE="out_of_range",R.UNIMPLEMENTED="unimplemented",R.INTERNAL="internal",R.UNAVAILABLE="unavailable",R.DATA_LOSS="data_loss",R.CAPTCHA_REQUIRED="captcha_required",R.CAPTCHA_INVALID="captcha_invalid",R.INVALID_PASSWORD="invalid_password",R.INVALID_STATUS="invalid_status",R.USER_PENDING="user_pending",R.USER_BLOCKED="user_blocked",R.INVALID_VERIFICATION_CODE="invalid_verification_code",R.TWO_FACTOR_REQUIRED="two_factor_required",R.INVALID_TWO_FACTOR="invalid_two_factor",R.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",R.UNDER_REVIEW="under_review",R.INVALID_REQUEST="invalid_request",R.UNAUTHORIZED_CLIENT="unauthorized_client",R.ACCESS_DENIED="access_denied",R.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",R.INVALID_SCOPE="invalid_scope",R.INVALID_GRANT="invalid_grant",R.SERVER_ERROR="server_error",R.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",R.INTERACTION_REQUIRED="interaction_required",R.LOGIN_REQUIRED="login_required",R.ACCOUNT_SELECTION_REQUIRED="account_selection_required",R.CONSENT_REQUIRED="consent_required",R.INVALID_REQUEST_URI="invalid_request_uri",R.INVALID_REQUEST_OBJECT="invalid_request_object",R.REQUEST_NOT_SUPPORTED="request_not_supported",R.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",R.REGISTRATION_NOT_SUPPORTED="registration_not_supported",function(t){t.AUTH_SIGN_IN_URL="/auth/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",t.AUTH_SIGN_UP_URL="/auth/v1/signup",t.AUTH_TOKEN_URL="/auth/v1/token",t.AUTH_REVOKE_URL="/auth/v1/revoke",t.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",t.PROVIDER_TOKEN_URL="/auth/v1/provider/token",t.PROVIDER_URI_URL="/auth/v1/provider/uri",t.USER_ME_URL="/auth/v1/user/me",t.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",t.USER_QUERY_URL="/auth/v1/user/query",t.USER_PRIFILE_URL="/auth/v1/user/profile",t.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",t.VERIFICATION_URL="/auth/v1/verification",t.VERIFY_URL="/auth/v1/verification/verify",t.PROVIDER_LIST="/auth/v1/user/provider",t.PROVIDER_UNBIND_URL="/auth/v1/user/provider",t.CHECK_PWD_URL="/auth/v1/user/sudo",t.SUDO_URL="/auth/v1/user/sudo",t.BIND_CONTACT_URL="/auth/v1/user/contact",t.AUTH_SET_PASSWORD="/auth/v1/user/password",t.AUTH_RESET_PASSWORD="/auth/v1/reset",t.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",t.CHECK_USERNAME="/auth/v1/checkUsername",t.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist"}(w||(w={})),function(t){t.AUTH_SIGN_IN_URL="/auth/v2/signin/username",t.AUTH_TOKEN_URL="/auth/v2/token",t.USER_ME_URL="/auth/v2/user/me",t.VERIFY_URL="/auth/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider",t.AUTH_PUBLIC_KEY="/auth/v2/signin/publichkey"}(I||(I={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(T||(T={})),function(t){t.INVALID_ARGUMENT="invalid_argument",t.DEADLINE_EXCEEDED="deadline_exceeded",t.NOT_FOUND="not_found",t.ALREADY_EXISTS="already_exists",t.PERMISSION_DENIED="permission_denied",t.ABORTED="aborted",t.OUT_OF_RANGE="out_of_range",t.UNIMPLEMENTED="unimplemented",t.INTERNAL="internal",t.UNAVAILABLE="unavailable",t.DATA_LOSS="data_loss",t.CAPTCHA_REQUIRED="captcha_required",t.CAPTCHA_INVALID="captcha_invalid",t.INVALID_PASSWORD="invalid_password",t.PASSWORD_NOT_SET="password_not_set",t.INVALID_STATUS="invalid_status",t.USER_PENDING="user_pending",t.USER_BLOCKED="user_blocked"}(_||(_={}));var P=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},U=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},N=function(){function t(){this.fnPromiseMap=new Map}return t.prototype.run=function(t,e){return P(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(t)];case 1:return i.sent()||(n=new Promise((function(n,i){P(r,void 0,void 0,(function(){var r,o,s;return U(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return a.sent(),r=e(),o=n,[4,r];case 2:return o.apply(void 0,[a.sent()]),[3,5];case 3:return s=a.sent(),i(s),[3,5];case 4:return this.fnPromiseMap.delete(t),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(t,n)),[2,n]}}))}))},t.prototype.runIdlePromise=function(){return Promise.resolve()},t}(),x=function(){return x=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},x.apply(this,arguments)},C=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},L=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},B="x-request-id",k="x-device-id",V="device_id",q=function(t,e){return C(this,void 0,void 0,(function(){var n,r,i,o,s;return L(this,(function(a){switch(a.label){case 0:n=null,r=null,a.label=1;case 1:return a.trys.push([1,4,,5]),(i=Object.assign({},e)).method||(i.method="GET"),i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),[4,fetch(t,i)];case 2:return[4,a.sent().json()];case 3:return(null==(o=a.sent())?void 0:o.error)?(r=o).error_uri=new URL(t).pathname:n=o,[3,5];case 4:return s=a.sent(),r={error:E.UNREACHABLE,error_description:s.message,error_uri:new URL(t).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},j=new(function(){function t(){}return t.prototype.getItem=function(t){return C(this,void 0,void 0,(function(){return L(this,(function(e){return[2,window.localStorage.getItem(t)]}))}))},t.prototype.removeItem=function(t){return C(this,void 0,void 0,(function(){return L(this,(function(e){return window.localStorage.removeItem(t),[2]}))}))},t.prototype.setItem=function(t,e){return C(this,void 0,void 0,(function(){return L(this,(function(n){return window.localStorage.setItem(t,e),[2]}))}))},t.prototype.getItemSync=function(t){return window.localStorage.getItem(t)},t.prototype.removeItemSync=function(t){window.localStorage.removeItem(t)},t.prototype.setItemSync=function(t,e){window.localStorage.setItem(t,e)},t}());function H(t){var e=!0;return(null==t?void 0:t.expires_at)&&(null==t?void 0:t.access_token)&&(e=t.expires_at<new Date),e}var M=function(){function t(t){this.credentials=null,this.singlePromise=new N,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage}return t.prototype.getStorageCredentialsSync=function(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t},t.prototype.setCredentials=function(t){return C(this,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.expires_in)?(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30)),this.storage?(e=JSON.stringify(t),[4,this.storage.setItem(this.tokenSectionName,e)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=t,[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]}}))}))},t.prototype.getCredentials=function(){return C(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){return[2,this.singlePromise.run("getCredentials",(function(){return C(t,void 0,void 0,(function(){var t;return L(this,(function(e){switch(e.label){case 0:return H(this.credentials)?(t=this,[4,this.getStorageCredentials()]):[3,2];case 1:t.credentials=e.sent(),e.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},t.prototype.getStorageCredentials=function(){return C(this,void 0,void 0,(function(){var t=this;return L(this,(function(e){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return C(t,void 0,void 0,(function(){var t,e;return L(this,(function(n){switch(n.label){case 0:return t=null,[4,this.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)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),t=null,[3,5];case 5:return[2,t]}}))}))}))]}))}))},t}(),F=function(){function t(e){this.singlePromise=new N,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,t.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=q,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||j,this.localCredentials=new M({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage}),this.clientSecret=e.clientSecret,this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}return t.prototype.setCredentials=function(t){return this.localCredentials.setCredentials(t)},t.prototype.getAccessToken=function(){return C(this,void 0,void 0,(function(){var t,e;return L(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(t=n.sent())?void 0:t.access_token)?[2,Promise.resolve(t.access_token)]:(e={error:E.UNAUTHENTICATED},[2,Promise.reject(e)])}}))}))},t.prototype.request=function(e,n){return C(this,void 0,void 0,(function(){var r,i,o,s,a,u,c;return L(this,(function(h){switch(h.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=x(x({},this.headers),n.headers)),n.headers[B]||(n.headers[B]=D()),n.headers[k]?[3,2]:[4,this.getDeviceId()];case 1:i=h.sent(),n.headers[k]=i,h.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(o=h.sent())&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(o.access_token)):n.headers.Authorization="".concat(o.token_type," ").concat(o.access_token)),[3,5];case 4:this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId)),h.label=5;case 5:e.startsWith("/")&&(e=this.apiOrigin+e),s=null,a=r+1,u=0,h.label=6;case 6:if(!(u<a))return[3,15];h.label=7;case 7:return h.trys.push([7,9,,12]),[4,this.baseRequest(e,n)];case 8:return s=h.sent(),[3,15];case 9:return c=h.sent(),n.withCredentials&&c&&c.error===E.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return h.sent(),[2,Promise.reject(c)];case 11:return u!==r&&c&&"unreachable"===c.error?[3,12]:[2,Promise.reject(c)];case 12:return[4,this.sleep(t.retryInterval)];case 13:h.sent(),h.label=14;case 14:return u++,[3,6];case 15:return[2,s]}}))}))},t.prototype.getCredentials=function(){return C(this,void 0,void 0,(function(){var t,e,n;return L(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return H(t=r.sent())?t&&"anonymous"===t.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(t)]:[3,5]:[3,8]:[3,10];case 2:return e=r.sent(),(n=e)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return t=n,[3,7];case 5:return[4,this.anonymousSignIn(t)];case 6:t=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(t)];case 9:t=r.sent(),r.label=10;case 10:return[2,t]}}))}))},t.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},t.prototype.getCredentialsAsync=function(){return this.getCredentials()},t.prototype.getScope=function(){return C(this,void 0,void 0,(function(){var t;return L(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.getGroups=function(){return C(this,void 0,void 0,(function(){var t;return L(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.refreshToken=function(t){return C(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return C(e,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(!t||!t.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(t.refresh_token,t)];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==E.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]}}))}))}))]}))}))},t.prototype.checkRetry=function(e){var n=null;if(("number"!=typeof e||e<t.minRetry||e>t.maxRetry)&&(n={error:E.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return e},t.prototype.formatRetry=function(t,e){return void 0===t?e:this.checkRetry(t)},t.prototype.sleep=function(t){return C(this,void 0,void 0,(function(){return L(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.prototype.anonymousSignIn=function(t){return C(this,void 0,void 0,(function(){var e=this;return L(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return C(e,void 0,void 0,(function(){var e,n;return L(this,(function(r){switch(r.label){case 0:if(!t||"anonymous"!==t.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 e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==E.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]}}))}))}))]}))}))},t.prototype.defaultRefreshTokenFunc=function(t,e){return C(this,void 0,void 0,(function(){var n,r;return L(this,(function(i){switch(i.label){case 0:return void 0===t||""===t?[2,this.unAuthenticatedError("refresh token not found")]:(n=w.AUTH_TOKEN_URL,"v2"===(null==e?void 0:e.version)&&(n=I.AUTH_TOKEN_URL),[4,this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:t}})]);case 1:return r=i.sent(),[2,x(x({},r),{version:(null==e?void 0:e.version)||"v1"})]}}))}))},t.prototype.getDeviceId=function(){return C(this,void 0,void 0,(function(){var t;return L(this,(function(e){switch(e.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(V)];case 1:return"string"==typeof(t=e.sent())&&t.length>=16&&t.length<=48?[3,3]:(t=D(),[4,this.storage.setItem(V,t)]);case 2:e.sent(),e.label=3;case 3:return this.deviceID=t,[2,t]}}))}))},t.prototype.unAuthenticatedError=function(t){var e={error:E.UNAUTHENTICATED,error_description:t};return Promise.reject(e)},t.defaultRetry=2,t.minRetry=0,t.maxRetry=5,t.retryInterval=1e3,t}(),K=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},G=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},W=function(){function t(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=j),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}return t.prototype.request=function(t,e){return K(this,void 0,void 0,(function(){var n,r,i,o;return G(this,(function(s){switch(s.label){case 0:return e||(e={}),e.method||(e.method="GET"),n="".concat(e.method,":").concat(t),r=t,e.withCaptcha?[4,this.appendCaptchaTokenToURL(t,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,e)];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(t,n,"captcha_invalid"===o.error)];case 5:return t=s.sent(),[2,this.config.request(t,e)];case 6:return[2,Promise.reject(o)];case 7:return[2,i]}}))}))},t.prototype.getDefaultOpenURIWithCallback=function(){if(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap")){var t=document.createElement("div");t.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;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback},t.prototype.defaultOpenURIWithCallback=function(t){return K(this,void 0,void 0,(function(){var e,n;return G(this,(function(r){return e=document.getElementById("captcha_panel_wrap"),n=document.createElement("iframe"),e.innerHTML="",n.setAttribute("src",t),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;",e.appendChild(n),e.style.display="block",[2,new Promise((function(t,r){n.onload=function(){try{var i=window.location,o=n.contentWindow.location;if(o.host+o.pathname===i.host+i.pathname){e.style.display="none";var s=new URLSearchParams(o.search),a=s.get("captcha_token");return a?t({captcha_token:a,expires_in:Number(s.get("expires_in"))}):r({error:s.get("error"),error_description:s.get("error_description")})}e.style.display="block"}catch(t){e.style.display="block"}}}))]}))}))},t.prototype.getCaptchaToken=function(t,e){return K(this,void 0,void 0,(function(){var n,r,i,o,s;return G(this,(function(a){switch(a.label){case 0:return t?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=a.sent())return[2,n];a.label=2;case 2:return r="".concat(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:e},withCredentials:!1})];case 3:return(i=a.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=a.sent(),this.saveCaptchaToken(s),[2,s.captcha_token]}}))}))},t.prototype.appendCaptchaTokenToURL=function(t,e,n){return K(this,void 0,void 0,(function(){var r;return G(this,(function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,e)];case 1:return r=i.sent(),t.indexOf("?")>0?t+="&captcha_token=".concat(r):t+="?captcha_token=".concat(r),[2,t]}}))}))},t.prototype.saveCaptchaToken=function(t){return K(this,void 0,void 0,(function(){var e;return G(this,(function(n){switch(n.label){case 0:return t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10)),e=JSON.stringify(t),[4,this.config.storage.setItem(this.tokenSectionName,e)];case 1:return n.sent(),[2]}}))}))},t.prototype.findCaptchaToken=function(){return K(this,void 0,void 0,(function(){var t,e;return G(this,(function(n){switch(n.label){case 0:return[4,this.config.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)),e.expires_at<new Date?[2,null]:[2,e.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]}}))}))},t}(),z=function(t){var e=function(e){for(var n in t)t.hasOwnProperty(n)&&(e[n]=z(t[n]));return e},n=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(n))return t.slice();switch(n){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},Y=n(550),J=n.n(Y),Z=n(171),Q=n.n(Z),X=n(991),$=n.n(X),tt=function(t){var e=void 0===t?{}:t,n=e.publicKey,r=void 0===n?"":n,i=e.payload,o=void 0===i?{}:i;if(!r)return"";try{var s=z(o),a=new(J());a.setPublicKey(r),s.timestamp=+new Date;var u=$().random(16).toString(),c=Q()(JSON.stringify(s),u).toString();return s.signature=c,s.nonce=u,s.signMethod="HmacSHA256",a.encryptLong(JSON.stringify(s))}catch(t){}return""},et=function(){return et=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},et.apply(this,arguments)},nt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},rt=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},it=function(){function t(t){var e=t.request,n=t.credentialsClient;if(!n){var r={apiOrigin:t.apiOrigin,clientId:t.clientId,storage:t.storage};n=new F(r)}if(!e){var i=n.request.bind(n),o=new W({clientId:t.clientId,request:i,storage:t.storage});e=o.request.bind(o)}this.config={apiOrigin:t.apiOrigin,clientId:t.clientId,request:e,credentialsClient:n,storage:t.storage||j}}return t.parseParamsToSearch=function(t){return Object.keys(t).forEach((function(e){t[e]||delete t[e]})),new URLSearchParams(t).toString()},t.prototype.getParamsByVersion=function(t,e){var n,r=z(t),i=(null===(n={v2:I}[null==r?void 0:r.version])||void 0===n?void 0:n[e])||w[e];return r&&delete r.version,{params:r,url:i}},t.prototype.signIn=function(t){return nt(this,void 0,void 0,(function(){var e,n,r,i;return rt(this,(function(o){switch(o.label){case 0:return e=t.version||"v1",(n=this.getParamsByVersion(t,"AUTH_SIGN_IN_URL")).params.query&&delete n.params.query,[4,this.getEncryptParams(n.params)];case 1:return r=o.sent(),[4,this.config.request(n.url,{method:"POST",body:r})];case 2:return i=o.sent(),[4,this.config.credentialsClient.setCredentials(et(et({},i),{version:e}))];case 3:return o.sent(),[2,Promise.resolve(i)]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){switch(n.label){case 0:return[4,this.config.request(w.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signUp=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){switch(n.label){case 0:return[4,this.config.request(w.AUTH_SIGN_UP_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signOut=function(){return nt(this,void 0,void 0,(function(){var t,e;return rt(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return t=n.sent(),[4,this.config.request(w.AUTH_REVOKE_URL,{method:"POST",body:{token:t}})];case 2:return e=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.getVerification=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){switch(n.label){case 0:return e=!1,"CUR_USER"!==t.target?[3,1]:(e=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(e=!0),n.label=3;case 3:return[2,this.config.request(w.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:!0,withCredentials:e})]}}))}))},t.prototype.verify=function(t){return nt(this,void 0,void 0,(function(){var e,n;return rt(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"VERIFY_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),"v2"!==(null==t?void 0:t.version)?[3,3]:[4,this.config.credentialsClient.setCredentials(et(et({},n),{version:"v2"}))];case 2:r.sent(),r.label=3;case 3:return[2,n]}}))}))},t.prototype.genProviderRedirectUri=function(t){return nt(this,void 0,void 0,(function(){var e,n;return rt(this,(function(r){return e="".concat(w.PROVIDER_URI_URL,"?client_id=").concat(this.config.clientId,"&provider_id=").concat(t.provider_id,"&redirect_uri=").concat(encodeURIComponent(t.provider_redirect_uri),"&state=").concat(t.state),(n=t.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(e+="&other_params[sign_out_uri]=".concat(n.sign_out_uri)),[2,this.config.request(e,{method:"GET"})]}))}))},t.prototype.grantProviderToken=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.PROVIDER_TOKEN_URL,{method:"POST",body:t})]}))}))},t.prototype.patchProviderToken=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})]}))}))},t.prototype.signInWithProvider=function(t){return nt(this,void 0,void 0,(function(){var e,n;return rt(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(et(et({},n),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return r.sent(),[2,Promise.resolve(n)]}}))}))},t.prototype.bindWithProvider=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.getUserProfile=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.getUserInfo(t)]}))}))},t.prototype.getUserInfo=function(t){var e;return void 0===t&&(t={}),nt(this,void 0,void 0,(function(){var n,r,i;return rt(this,(function(o){switch(o.label){case 0:return n=this.getParamsByVersion(t,"USER_ME_URL"),(null===(e=n.params)||void 0===e?void 0:e.query)&&(r=new URLSearchParams(n.params.query),n.url+="?".concat(r.toString())),[4,this.config.request(n.url,{method:"GET",withCredentials:!0})];case 1:return(i=o.sent()).sub&&(i.uid=i.sub),[2,i]}}))}))},t.prototype.getWedaUserInfo=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){switch(t.label){case 0:return[4,this.config.request(w.WEDA_USER_URL,{method:"GET",withCredentials:!0})];case 1:return[2,t.sent()]}}))}))},t.prototype.deleteMe=function(e){return nt(this,void 0,void 0,(function(){var n,r;return rt(this,(function(i){return n=this.getParamsByVersion(e,"USER_ME_URL"),r="".concat(n.url,"?").concat(t.parseParamsToSearch(n.params)),[2,this.config.request(r,{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.hasLoginState=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},t.prototype.getLoginState=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},t.prototype.transByProvider=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.grantToken=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){return e=this.getParamsByVersion(t,"AUTH_TOKEN_URL"),[2,this.config.request(e.url,{method:"POST",body:e.params})]}))}))},t.prototype.getProviders=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){return[2,this.config.request(w.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},t.prototype.unbindProvider=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request("".concat(w.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.checkPassword=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request("".concat(w.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.bindPhone=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request("".concat(w.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.bindEmail=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request("".concat(w.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.setPassword=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request("".concat(w.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.updatePasswordByOld=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:t.old_password})];case 1:return e=n.sent(),[2,this.setPassword({sudo_token:e.sudo_token,new_password:t.new_password})]}}))}))},t.prototype.sudo=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request("".concat(w.SUDO_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.getCurUserVerification=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return t.target="CUR_USER",[2,this.config.request(w.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})]}))}))},t.prototype.changeBindedProvider=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request("".concat(w.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})]}))}))},t.prototype.setUserProfile=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.queryUserProfile=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(w.USER_QUERY_URL,"?").concat(e.toString()),{method:"GET",withCredentials:!0})]}))}))},t.prototype.setCustomSignFunc=function(t){this.getCustomSignTicketFn=t},t.prototype.signInWithCustomTicket=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){switch(n.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=n.sent(),[2,this.signInWithProvider(et(et({},t),{provider_id:"custom",provider_token:e}))]}}))}))},t.prototype.resetPassword=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.AUTH_RESET_PASSWORD,{method:"POST",body:t})]}))}))},t.prototype.deviceAuthorize=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.checkUsername=function(t){return nt(this,void 0,void 0,(function(){return rt(this,(function(e){return[2,this.config.request(w.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})]}))}))},t.prototype.checkIfUserExist=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(w.CHECK_IF_USER_EXIST,"?").concat(e.toString()),{method:"GET"})]}))}))},t.prototype.loginScope=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){return[2,this.config.credentialsClient.getScope()]}))}))},t.prototype.loginGroups=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){return[2,this.config.credentialsClient.getGroups()]}))}))},t.prototype.refreshTokenForce=function(t){return nt(this,void 0,void 0,(function(){var e;return rt(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return e=n.sent(),[4,this.config.credentialsClient.refreshToken(et(et({},e),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return[2,n.sent()]}}))}))},t.prototype.getCredentials=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){return[2,this.config.credentialsClient.getCredentials()]}))}))},t.prototype.getPublicKey=function(){return nt(this,void 0,void 0,(function(){return rt(this,(function(t){return[2,this.config.request(I.AUTH_PUBLIC_KEY,{method:"POST",body:{}})]}))}))},t.prototype.getEncryptParams=function(t){return nt(this,void 0,void 0,(function(){var e,n,r,i;return rt(this,(function(o){switch(o.label){case 0:if(!(e=z(t)).isEncrypt)return[2,t];n="",r="",o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.getPublicKey()];case 2:return i=o.sent(),n=i.public_key,r=i.public_key_thumbprint,[3,4];case 3:return o.sent(),[3,4];case 4:if(!n||!r)throw new Error("public_key or public_key_thumbprint is empty");return delete e.isEncrypt,[2,{params:tt({publicKey:n,payload:e}),public_key_thumbprint:r}]}}))}))},t}(),ot=function(){return ot=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},ot.apply(this,arguments)},st=function(t){var e=t.apiOrigin,n=t.clientId,r=t.storage,i=t.request,o=t.anonymousSignInFunc;this.oauth2client=new F({apiOrigin:e,clientId:n,storage:r,baseRequest:i,anonymousSignInFunc:o}),this.authApi=new it(ot(ot({credentialsClient:this.oauth2client},t),{request:i?this.oauth2client.request.bind(this.oauth2client):void 0}))},at=function(){return at=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},at.apply(this,arguments)},ut=function(t,e,n,r){var i,o=arguments.length,s=o<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--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},ct=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ht=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},lt=function(t,e){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:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},ft=a,pt=function(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(i(),"][").concat(t,"]:").concat(e)}))},dt=s,gt="https://support.qq.com/products/148793",yt=function(t){t.mode,t.customInfo,t.title,t.messages;return function(t,e,n){}},vt="loginStateChanged",mt=new b,bt=function(){function t(t){var e=t.cache,n=t.oauthInstance;this.cache=e,this.oauthInstance=n,this.setUserInfo()}return t.prototype.checkLocalInfo=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},t.prototype.checkLocalInfoAsync=function(){return ht(this,void 0,void 0,(function(){var t,e,n,r;return lt(this,(function(i){switch(i.label){case 0:return t=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return t.uid=i.sent(),e=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return e.gender=i.sent(),this.picture=this.getLocalUserInfo("picture"),n=this,[4,this.getLocalUserInfoAsync("email")];case 3:return n.email=i.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),r=this,[4,this.getLocalUserInfoAsync("username")];case 4:return r.username=i.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},t.prototype.update=function(t){return ht(this,void 0,void 0,(function(){var e;return lt(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(at({},t))];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2]}}))}))},t.prototype.updatePassword=function(t,e){return this.oauthInstance.authApi.updatePasswordByOld({old_password:e,new_password:t})},t.prototype.updateUsername=function(t){return"string"!=typeof t&&pt(dt.INVALID_PARAMS,"username must be a string"),this.update({username:t})},t.prototype.refresh=function(t){return ht(this,void 0,void 0,(function(){var e;return lt(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(t)];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2,e]}}))}))},t.prototype.getLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;return this.cache.getStore(e)[t]},t.prototype.getLocalUserInfoAsync=function(t){return ht(this,void 0,void 0,(function(){var e;return lt(this,(function(n){switch(n.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(e)];case 1:return[2,n.sent()[t]]}}))}))},t.prototype.setUserInfo=function(){var t=this,e=this.cache.keys.userInfoKey,n=this.cache.getStore(e);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(e){t[e]=n[e]}))},t.prototype.setLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;this.cache.setStore(e,t),this.setUserInfo()},ut([yt({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"update",null),ut([yt({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[String,String]),ct("design:returntype",void 0)],t.prototype,"updatePassword",null),ut([yt({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[String]),ct("design:returntype",void 0)],t.prototype,"updateUsername",null),ut([yt({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"refresh",null),t}(),St=function(){function t(t){var e=t.envId,n=t.cache,r=t.oauthInstance;e||pt(dt.INVALID_PARAMS,"envId is not defined"),this.cache=n,this.oauthInstance=r,this.user=new bt({cache:this.cache,oauthInstance:r})}return t.prototype.checkLocalState=function(){var t;this.oauthLoginState=null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},t.prototype.checkLocalStateAsync=function(){var t;return ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}}))}))},t}(),Et=function(){function t(t){this.config=t,this.cache=t.cache,this.oauthInstance=t.oauthInstance}return t.prototype.bindPhoneNumber=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.bindPhone(t)]}))}))},t.prototype.unbindProvider=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.unbindProvider(t)]}))}))},t.prototype.bindEmail=function(t){return this.oauthInstance.authApi.bindEmail(t)},t.prototype.verify=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.verify(t)]}))}))},t.prototype.getVerification=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.getVerification(t)]}))}))},Object.defineProperty(t.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var t=this.hasLoginState();return t&&t.user||null}ft(dt.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),t.prototype.getCurrentUser=function(){return ht(this,void 0,void 0,(function(){var t;return lt(this,(function(e){switch(e.label){case 0:return[4,this.getLoginState()];case 1:return(t=e.sent())?[4,t.user.checkLocalInfoAsync()]:[3,3];case 2:return e.sent(),[2,t.user||null];case 3:return[2,null]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setCustomSignFunc=function(t){this.oauthInstance.authApi.setCustomSignFunc(t)},t.prototype.signInWithCustomTicket=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signIn=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signIn(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signUp=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signUp(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setPassword=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.setPassword(t)]}))}))},t.prototype.isUsernameRegistered=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return"string"!=typeof t&&pt(dt.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:t})];case 1:return[2,e.sent().exist]}}))}))},t.prototype.signOut=function(){return ht(this,void 0,void 0,(function(){var t;return lt(this,(function(e){switch(e.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut()];case 1:return e.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return e.sent(),mt.fire(vt),[2]}}))}))},t.prototype.hasLoginState=function(){var t;if("async"!==this.cache.mode)return(null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync())?new St({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;ft(dt.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},t.prototype.getLoginState=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return t.sent()?[2,new St({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},t.prototype.getUserInfo=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.getUserInfo(t)]}))}))},t.prototype.getWedaUserInfo=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},t.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},t.prototype.bindWithProvider=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.bindWithProvider(t)]}))}))},t.prototype.queryUser=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.queryUserProfile(t)]}))}))},t.prototype.getAccessToken=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:t.sent(),env:this.config.env}]}}))}))},t.prototype.grantProviderToken=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.grantProviderToken(t)]}))}))},t.prototype.patchProviderToken=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.patchProviderToken(t)]}))}))},t.prototype.signInWithProvider=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.grantToken=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.grantToken(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.genProviderRedirectUri=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.genProviderRedirectUri(t)]}))}))},t.prototype.resetPassword=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.resetPassword(t)]}))}))},t.prototype.deviceAuthorize=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.deviceAuthorize(t)]}))}))},t.prototype.sudo=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.sudo(t)]}))}))},t.prototype.deleteMe=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.deleteMe(t)]}))}))},t.prototype.getProviders=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){return[2,this.oauthInstance.authApi.getProviders()]}))}))},t.prototype.loginScope=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){return[2,this.oauthInstance.authApi.loginScope()]}))}))},t.prototype.loginGroups=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},t.prototype.onLoginStateChanged=function(t){return ht(this,void 0,void 0,(function(){var e,n=this;return lt(this,(function(r){switch(r.label){case 0:return mt.on(vt,(function(){return ht(n,void 0,void 0,(function(){var e;return lt(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return e=n.sent(),t.call(this,e),[2]}}))}))})),[4,this.getLoginState()];case 1:return e=r.sent(),t.call(this,e),[2]}}))}))},t.prototype.refreshTokenForce=function(t){return ht(this,void 0,void 0,(function(){return lt(this,(function(e){return[2,this.oauthInstance.authApi.refreshTokenForce(t)]}))}))},t.prototype.getCredentials=function(){return ht(this,void 0,void 0,(function(){return lt(this,(function(t){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},t.prototype.createLoginState=function(t){return ht(this,void 0,void 0,(function(){var e;return lt(this,(function(n){switch(n.label){case 0:return[4,(e=new St({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return n.sent(),[4,e.user.refresh(t)];case 2:return n.sent(),mt.fire(vt),[2,e]}}))}))},ut([yt({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"bindPhoneNumber",null),ut([yt({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"unbindProvider",null),ut([yt({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",void 0)],t.prototype,"bindEmail",null),ut([yt({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"verify",null),ut([yt({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"getVerification",null),ut([yt({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[]),ct("design:returntype",Promise)],t.prototype,"getCurrentUser",null),ut([yt({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"signInAnonymously",null),ut([yt({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"signInWithCustomTicket",null),ut([yt({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"signUp",null),ut([yt({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[String]),ct("design:returntype",Promise)],t.prototype,"isUsernameRegistered",null),ut([yt({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[]),ct("design:returntype",Promise)],t.prototype,"signOut",null),ut([yt({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[]),ct("design:returntype",Promise)],t.prototype,"getLoginState",null),ut([yt({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"getUserInfo",null),ut([yt({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[]),ct("design:returntype",Promise)],t.prototype,"getWedaUserInfo",null),ut([yt({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(gt)]}),ct("design:type",Function),ct("design:paramtypes",[Object]),ct("design:returntype",Promise)],t.prototype,"bindWithProvider",null),t}(),wt={name:"auth",namespace:"auth",entity:function(t){if(void 0===t&&(t={region:"",persistence:"local"}),this.authInstance)return ft(dt.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var e=this.platform,n=e.adapter,r=e.runtime,i=t.persistence||n.primaryStorage;i&&i!==this.config.persistence&&this.updateConfig({persistence:i});var o=this.config,s=o.env,a=o.persistence,u=o.debug,c=o.clientId,h=o.storage,l=new st({clientId:c,apiOrigin:this.request.getBaseEndPoint(),storage:(null==t?void 0:t.storage)||h,request:null==t?void 0:t.request,anonymousSignInFunc:null==t?void 0:t.anonymousSignInFunc});return this.oauthInstance=l,this.authInstance=new Et({env:s,region:t.region,persistence:a,debug:u,cache:this.cache,runtime:r,_fromApp:this,oauthInstance:l}),this.authInstance}};try{cloudbase.registerComponent(wt)}catch(A){}function It(t){try{t.registerComponent(wt)}catch(t){console.warn(t)}}},633:()=>{}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={exports:{}};return t[r].call(o.exports,o,o.exports,n),o.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};return(()=>{"use strict";var t=r;Object.defineProperty(t,"__esModule",{value:!0}),t.registerAuth=void 0;var e=n(640);t.registerAuth=e.registerAuth})(),r})()));
|