twikoo 2.0.2 → 2.0.3
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/dist/twikoo.all.min.js +2 -2
- package/dist/twikoo.all.nocss.js +2 -2
- package/dist/twikoo.min.js +2 -2
- package/dist/twikoo.nocss.js +2 -2
- package/package.json +2 -2
package/dist/twikoo.nocss.js
CHANGED
|
@@ -166,11 +166,11 @@ ${[`verifyOtp`,`signInWithOtp`,`signUp`].includes(n)?`
|
|
|
166
166
|
✓ 控制台已开启「短信验证码登录」或「邮箱验证码登录」`,signInWithOAuth:`当前使用「第三方 OAuth 登录」,需确保:
|
|
167
167
|
✓ 控制台已配置并开启对应的第三方身份源`}[e]||``}var I=function(e){function t(t,n){var r=this,o=function(e){return typeof e==`object`&&!!e&&`__isAuthError`in e}(t);return(r=e.call(this,o?t.message:t.error_description||t.message)||this).__isAuthError=!0,r.name=`AuthError`,o?(r.status=t.status,r.code=t.code,r.errorCode=t.errorCode,r.requestId=t.requestId,r.category=t.category,r.retryAfter=t.retryAfter,r.helpMessage=$e(r.category,{method:n?.method,errorCode:r.errorCode,code:r.code}),r.loginMethodHint=et(n?.method),r):(r.status=t.error,r.code=String(t.error||t.error_code||`unknown`).toLowerCase(),r.errorCode=typeof t.error_code==`number`?t.error_code:typeof t.error_code==`string`&&parseInt(t.error_code,10)||void 0,r.requestId=t.requestId,r.category=function(e,t,n){if(!e&&!t&&!n)return F.UNKNOWN;try{var r=(e||``).toLowerCase(),o=typeof n==`string`?parseInt(n,10):n;return o===a.MISSING_REQUIRED_PARAM||t===i.MISSING_REQUIRED_PARAM?F.INVALID_PARAMS:o===a.CAPTCHA_REQUIRED||t===i.CAPTCHA_REQUIRED?F.CAPTCHA_REQUIRED:o===a.CAPTCHA_INVALID||t===i.CAPTCHA_INVALID?F.CAPTCHA_INVALID:o===a.MFA_PHONE_REQUIRED||t===i.MFA_PHONE_REQUIRED?F.MFA_REQUIRED:o===a.LOGIN_TYPE_DISABLED||t===i.LOGIN_TYPE_DISABLED?F.PROVIDER_NOT_ENABLED:o===a.RESOURCE_EXHAUSTED||t===i.RESOURCE_EXHAUSTED?F.RATE_LIMITED:o===a.INTERNAL||o===a.UNAVAILABLE||o===a.UNIMPLEMENTED||o===a.ABORTED?F.SERVICE_ERROR:o===a.NOT_FOUND?F.USER_NOT_FOUND:o===a.UNAUTHENTICATED?F.INVALID_CREDENTIALS:o===a.INVALID_ARGUMENT&&(r.includes(`验证码`)||r.includes(`verification`)||r.includes(`verification_code`)||r.includes(`verification_id`)||r.includes(`does not match`)||r.includes(`token expired`)||r.includes(`token error`)||r.includes(`过期`))?F.VERIFICATION_FAILED:t===i.PROVIDER_NOT_ENABLED||t===i.LOGIN_METHOD_DISABLED||r.includes(`身份源`)||r.includes(`开启`)||r.includes(`identity provider`)||r.includes(`provider not enabled`)||r.includes(`login method`)||r.includes(`登录方式`)||r.includes(`not enabled`)||r.includes(`未开启`)||r.includes(`未启用`)||r.includes(`请联系开发者`)||r.includes(`anonymous login is not enabled`)||r.includes(`匿名登录未开启`)?F.PROVIDER_NOT_ENABLED:t===i.FAILED_PRECONDITION||o===a.FAILED_PRECONDITION&&!r.includes(`请联系开发者`)?r.includes(`不存在`)||r.includes(`not found`)||r.includes(`未注册`)?F.USER_NOT_FOUND:F.PRECONDITION_FAILED:t===i.INVALID_PASSWORD||t===i.INVALID_GRANT||t===i.INVALID_VERIFICATION_CODE||t===i.INVALID_USERNAME_OR_PASSWORD||t===i.INVALID_CREDENTIALS||t===i.WRONG_PASSWORD||t===i.UNAUTHENTICATED||t===i.INVALID_TWO_FACTOR||t===i.INVALID_TWO_FACTOR_RECOVERY||t===i.PASSWORD_NOT_SET||r.includes(`密码不正确`)||r.includes(`password`)||r.includes(`invalid_password`)||r.includes(`凭据`)||r.includes(`credentials`)||r.includes(`验证码`)||r.includes(`verification`)||r.includes(`invalid_verification_code`)||r.includes(`invalid_username_or_password`)||r.includes(`username or password`)||r.includes(`用户名或密码`)||r.includes(`wrong password`)||r.includes(`incorrect password`)?F.INVALID_CREDENTIALS:t===i.NOT_FOUND||t===i.USER_NOT_FOUND||r.includes(`用户不存在`)||r.includes(`not found`)||r.includes(`user not found`)||r.includes(`no such user`)||r.includes(`user does not exist`)?F.USER_NOT_FOUND:t===i.USER_BLOCKED||t===i.USER_PENDING||t===i.UNDER_REVIEW||t===i.INVALID_STATUS||r.includes(`被封禁`)||r.includes(`blocked`)||r.includes(`pending`)||r.includes(`审核`)||r.includes(`review`)||r.includes(`locked`)||r.includes(`已锁定`)?F.USER_STATUS_ABNORMAL:t===i.SERVER_ERROR||t===i.UNAVAILABLE||t===i.TEMPORARILY_UNAVAILABLE||t===i.INTERNAL||t===i.UNREACHABLE||t===i.DEADLINE_EXCEEDED||t===i.DATA_LOSS||t===i.ABORTED||r.includes(`network`)||r.includes(`timeout`)||r.includes(`timed out`)||r.includes(`超时`)||r.includes(`smtp is not set`)||r.includes(`sms sender does not config`)?F.SERVICE_ERROR:t===i.INVALID_ARGUMENT||t===i.INVALID_REQUEST||t===i.INVALID_SCOPE||t===i.INVALID_REQUEST_URI||t===i.INVALID_REQUEST_OBJECT||o===a.INVALID_ARGUMENT?F.INVALID_PARAMS:t===i.PERMISSION_DENIED||t===i.ACCESS_DENIED||t===i.UNAUTHORIZED_CLIENT?F.PROVIDER_NOT_ENABLED:F.UNKNOWN}catch{return t}}(r.message,r.status,r.errorCode),r.helpMessage=$e(r.category,{method:n?.method,errorCode:r.errorCode,code:r.code}),r.loginMethodHint=et(n?.method),r.category===F.RATE_LIMITED&&(r.retryAfter=t.retry_after||t.retryAfter||void 0),r)}return Xe(t,e),t.prototype.toJSON=function(){return{name:this.name,message:this.message,code:this.code,errorCode:this.errorCode,status:this.status,requestId:this.requestId,category:this.category,retryAfter:this.retryAfter}},t}(Error),tt=function(){return tt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},tt.apply(this,arguments)},L=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},R=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function nt(e,t){return L(this,void 0,void 0,function(){var n,r=this;return R(this,function(i){n=function(){return L(r,void 0,void 0,function(){return R(this,function(e){switch(e.label){case 0:return e.trys.push([0,1,,6]),[2,io(171)];case 1:e.sent(),e.label=2;case 2:return e.trys.push([2,4,,5]),[4,Promise.resolve().then(io.bind(io,171))];case 3:return[2,e.sent()];case 4:return e.sent(),[2];case 5:return[3,6];case 6:return[2]}})})};try{if((t?.root?.globalThis||globalThis).IS_MP_BUILD)return[2];if(e)return[2,n()]}catch{if(e)return[2,n()]}return[2]})})}var rt=function(){function e(e){var t=e.request,n=e.credentialsClient;if(n||=new Pe({apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,storage:e.storage,env:e.env,baseRequest:e.baseRequest,anonymousSignInFunc:e.anonymousSignInFunc,wxCloud:e.wxCloud,onCredentialsError:e.onCredentialsError,headers:e.headers||{},i18n:e.i18n,debug:e.debug}),!t){var r=n.request.bind(n),i=new Je(tt({env:e.env,clientId:e.clientId,request:r,storage:e.storage,adapter:e.adapter,oauthInstance:this},e.captchaOptions));t=i.request.bind(i)}this.config={env:e.env,apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,request:t,credentialsClient:n,storage:e.storage||Me,adapter:e.adapter}}return e.parseParamsToSearch=function(e){return Object.keys(e).forEach(function(t){e[t]||delete e[t]}),new Ye(e).toString()},e.prototype.getParamsByVersion=function(e,r){var i=(0,w.I)(e),a={v2:n}[i?.version]?.[r]||t[r];return i&&delete i.version,{params:i,url:a}},e.prototype.signIn=function(e){return L(this,void 0,Promise,function(){var t,n,r,i;return R(this,function(a){switch(a.label){case 0:return t=e.version||`v1`,(n=this.getParamsByVersion(e,`AUTH_SIGN_IN_URL`)).params.query&&delete n.params.query,[4,this.getEncryptParams(n.params)];case 1:return r=a.sent(),[4,this.config.request(n.url,{method:`POST`,body:r})];case 2:return i=a.sent(),[4,this.config.credentialsClient.setCredentials(tt(tt({},i),{version:t}))];case 3:return a.sent(),[2,Promise.resolve(i)]}})})},e.prototype.signInAnonymously=function(e,n){return e===void 0&&(e={}),n===void 0&&(n=!1),L(this,void 0,Promise,function(){var r;return R(this,function(i){switch(i.label){case 0:return[4,this.config.request(t.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:`POST`,body:e,useWxCloud:n})];case 1:return r=i.sent(),[4,this.config.credentialsClient.setCredentials(r)];case 2:return i.sent(),[2,Promise.resolve(r)]}})})},e.prototype.signUp=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){switch(r.label){case 0:return[4,this.config.request(t.AUTH_SIGN_UP_URL,{method:`POST`,body:e})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(n)];case 2:return r.sent(),[2,Promise.resolve(n)]}})})},e.prototype.signOut=function(e){return L(this,void 0,Promise,function(){var n,r,a,o;return R(this,function(s){switch(s.label){case 0:if(n={},!e)return[3,6];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.config.request(t.AUTH_SIGNOUT_URL,{method:`POST`,withCredentials:!0,body:e})];case 2:return n=s.sent(),[3,4];case 3:return(r=s.sent()).error!==i.UNAUTHENTICATED&&console.log(`sign_out_error`,r),[3,4];case 4:return[4,this.config.credentialsClient.setCredentials()];case 5:return s.sent(),[2,n];case 6:return[4,this.config.credentialsClient.getAccessToken()];case 7:return a=s.sent(),[4,this.config.request(t.AUTH_REVOKE_URL,{method:`POST`,body:{token:a}})];case 8:return o=s.sent(),[4,this.config.credentialsClient.setCredentials()];case 9:return s.sent(),[2,Promise.resolve(o)]}})})},e.prototype.revokeAllDevices=function(){return L(this,void 0,Promise,function(){return R(this,function(e){switch(e.label){case 0:return[4,this.config.request(t.AUTH_REVOKE_ALL_URL,{method:`DELETE`,withCredentials:!0})];case 1:return e.sent(),[2]}})})},e.prototype.revokeDevice=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){switch(n.label){case 0:return[4,this.config.request(t.AUTHORIZED_DEVICES_DELETE_URL+e.device_id,{method:`DELETE`,withCredentials:!0})];case 1:return n.sent(),[2]}})})},e.prototype.getVerification=function(e,n){return L(this,void 0,Promise,function(){var r,i;return R(this,function(a){switch(a.label){case 0:return r=!1,e.target===`CUR_USER`?(r=!0,[3,3]):[3,1];case 1:return[4,this.hasLoginState()];case 2:a.sent()&&(r=!0),a.label=3;case 3:return(i=(0,w.I)(e)).phone_number&&!/^\+\d{1,3}\s+\d+/.test(i.phone_number)&&(i.phone_number=`+86 ${i.phone_number}`),[2,this.config.request(t.VERIFICATION_URL,{method:`POST`,body:i,withCaptcha:n?.withCaptcha||!1,withCredentials:r})]}})})},e.prototype.verify=function(e){return L(this,void 0,Promise,function(){var t,n;return R(this,function(r){switch(r.label){case 0:return t=this.getParamsByVersion(e,`VERIFY_URL`),[4,this.config.request(t.url,{method:`POST`,body:t.params})];case 1:return n=r.sent(),e?.version===`v2`?[4,this.config.credentialsClient.setCredentials(tt(tt({},n),{version:`v2`}))]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2,n]}})})},e.prototype.genProviderRedirectUri=function(n){return L(this,void 0,Promise,function(){var r,i,a,o,s;return R(this,function(c){return r=n.provider_redirect_uri,i=n.other_params,a=i===void 0?{}:i,o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(n,[`provider_redirect_uri`,`other_params`]),r&&!o.redirect_uri&&(o.redirect_uri=r),s=`${t.PROVIDER_URI_URL}?${e.parseParamsToSearch(o)}`,Object.keys(a).forEach(function(e){var t=a[e];(e!==`sign_out_uri`||t?.length>0)&&(s+=`&other_params[${e}]=${encodeURIComponent(t)}`)}),[2,this.config.request(s,{method:`GET`})]})})},e.prototype.grantProviderToken=function(e,n){return n===void 0&&(n=!1),L(this,void 0,Promise,function(){return R(this,function(r){return[2,this.config.request(t.PROVIDER_TOKEN_URL,{method:`POST`,body:e,useWxCloud:n})]})})},e.prototype.patchProviderToken=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.PROVIDER_TOKEN_URL,{method:`PATCH`,body:e})]})})},e.prototype.signInWithProvider=function(e,t){return t===void 0&&(t=!1),L(this,void 0,Promise,function(){var n,r;return R(this,function(i){switch(i.label){case 0:return n=this.getParamsByVersion(e,`AUTH_SIGN_IN_WITH_PROVIDER_URL`),[4,this.config.request(n.url,{method:`POST`,body:n.params,useWxCloud:t})];case 1:return r=i.sent(),[4,this.config.credentialsClient.setCredentials(tt(tt({},r),{version:e?.version||`v1`}))];case 2:return i.sent(),[2,Promise.resolve(r)]}})})},e.prototype.toBindIdentity=function(e){var t,n;return L(this,void 0,void 0,function(){var r,i,a,o;return R(this,function(s){switch(s.label){case 0:return(i=e.credentials)?[3,2]:[4,this.config.credentialsClient.localCredentials.getCredentials()];case 1:i=s.sent(),s.label=2;case 2:r=i,s.label=3;case 3:return s.trys.push([3,5,,6]),[4,this.bindWithProvider({provider_token:e.provider_token},r)];case 4:return s.sent(),a={data:{type:x,provider:e.provider},error:null},[3,6];case 5:return o=s.sent(),a={data:{type:x},error:new I(o)},[3,6];case 6:return e.fireEvent&&((n=(t=this.config.eventBus)?.fire)==null||n.call(t,v,{event:g,info:a})),[2,a]}})})},e.prototype.getInitialSession=function(){return L(this,void 0,Promise,function(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m;return R(this,function(h){switch(h.label){case 0:e={},h.label=1;case 1:if(h.trys.push([1,12,,13]),typeof window>`u`||typeof document>`u`||(t=new URLSearchParams(location==null?void 0:location.search),n=t.get(`code`),r=t.get(`state`),!n||!r))return[2,{data:null,error:null}];i=null;try{i=JSON.parse(sessionStorage.getItem(r)||`null`)}catch{}return e={type:i?.type},a=t.get(`error`),o=t.get(`error_description`),a||o?[2,{data:e,error:new I({message:o||a||`Unknown error from OAuth provider`})}]:(s=i?.provider||t.get(`provider`))?(c=location.origin+location.pathname,[4,this.grantProviderToken({provider_id:s,provider_redirect_uri:c,provider_code:n})]):[2,{data:e,error:new I({message:`Provider is required for OAuth verification`})}];case 2:return l=h.sent().provider_token,u=void 0,d=null,f=void 0,i.type===x?[4,this.config.credentialsClient.localCredentials.getCredentials()]:[3,5];case 3:return u=h.sent(),[4,this.toBindIdentity({provider:s,provider_token:l,credentials:u})];case 4:return f=h.sent(),[3,11];case 5:return i.type===y?(f=this.getParamsByVersion({provider:s},`AUTH_SIGN_IN_WITH_PROVIDER_URL`),[4,this.config.request(f.url,{method:`POST`,body:{provider_token:l}})]):[3,11];case 6:u=h.sent(),h.label=7;case 7:return h.trys.push([7,9,,10]),[4,this.getUserInfo({credentials:u})];case 8:return d=h.sent(),[3,10];case 9:return p=h.sent(),console.error(`get user info error`,p),[3,10];case 10:f={data:tt(tt({},e),{session:u,user:d}),error:null},h.label=11;case 11:t.delete(`code`),t.delete(`state`),t.delete(`provider`),this.restoreUrlState(i?.search===void 0?`?${t.toString()}`:i.search,i?.hash||location.hash);try{sessionStorage.removeItem(r)}catch{}return[2,f];case 12:return m=h.sent(),[2,{data:e,error:new I(m)}];case 13:return[2]}})})},e.prototype.signInCustom=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){switch(r.label){case 0:return[4,this.config.request(t.AUTH_SIGN_IN_CUSTOM,{method:`POST`,body:e})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(n)];case 2:return r.sent(),[2,Promise.resolve(n)]}})})},e.prototype.signInWithWechat=function(e){return e===void 0&&(e={}),L(this,void 0,Promise,function(){var n;return R(this,function(r){switch(r.label){case 0:return[4,this.config.request(t.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:`POST`,body:e})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(n)];case 2:return r.sent(),[2,Promise.resolve(n)]}})})},e.prototype.bindWithProvider=function(e,n){return L(this,void 0,Promise,function(){return R(this,function(r){return[2,this.config.request(t.PROVIDER_BIND_URL,{method:`POST`,body:e,withCredentials:!0,getCredentials:n?function(){return n}:void 0})]})})},e.prototype.getUserProfile=function(e){return L(this,void 0,Promise,function(){return R(this,function(t){return[2,this.getUserInfo(e)]})})},e.prototype.getUserInfo=function(e){var t;return e===void 0&&(e={}),L(this,void 0,Promise,function(){var n,r,i,a,o;return R(this,function(s){switch(s.label){case 0:return n=this.getParamsByVersion(e,`USER_ME_URL`),(t=n.params)!=null&&t.query&&(r=new Ye(n.params.query),n.url+=`?${r.toString()}`),[4,this.config.request(n.url,{method:`GET`,withCredentials:!0,getCredentials:e.credentials?function(){return e.credentials}:void 0})];case 1:if((i=s.sent()).sub&&(i.uid=i.sub),i.providers?.length)try{typeof wx<`u`&&wx.getAccountInfoSync&&(a=wx.getAccountInfoSync().miniProgram?.appId,(o=i.providers.find(function(e){return e.id===a}))!=null&&o.provider_user_id&&(i.open_id=o.provider_user_id))}catch{}return[2,i]}})})},e.prototype.getWedaUserInfo=function(){return L(this,void 0,Promise,function(){return R(this,function(e){switch(e.label){case 0:return[4,this.config.request(t.WEDA_USER_URL,{method:`GET`,withCredentials:!0})];case 1:return[2,e.sent()]}})})},e.prototype.deleteMe=function(t){return L(this,void 0,Promise,function(){var n,r;return R(this,function(i){return n=this.getParamsByVersion(t,`USER_ME_URL`),r=`${n.url}?${e.parseParamsToSearch(n.params)}`,[2,this.config.request(r,{method:`DELETE`,withCredentials:!0})]})})},e.prototype.hasLoginState=function(){return L(this,void 0,Promise,function(){return R(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return e.sent(),[2,!0];case 2:return e.sent(),[2,!1];case 3:return[2]}})})},e.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},e.prototype.getLoginState=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.credentialsClient.getCredentialsAsync()]})})},e.prototype.transByProvider=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.USER_TRANS_BY_PROVIDER_URL,{method:`PATCH`,body:e,withCredentials:!0})]})})},e.prototype.grantToken=function(e){return L(this,void 0,Promise,function(){var t;return R(this,function(n){return t=this.getParamsByVersion(e,`AUTH_TOKEN_URL`),[2,this.config.request(t.url,{method:`POST`,body:t.params})]})})},e.prototype.getProviders=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.request(t.PROVIDER_LIST,{method:`GET`,withCredentials:!0})]})})},e.prototype.unbindProvider=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.PROVIDER_UNBIND_URL}/${e.provider_id}`,{method:`DELETE`,withCredentials:!0})]})})},e.prototype.checkPassword=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.CHECK_PWD_URL}`,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.editContact=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.BIND_CONTACT_URL}`,{method:`PATCH`,withCredentials:!0,body:e})]})})},e.prototype.setPassword=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.AUTH_SET_PASSWORD}`,{method:`PATCH`,withCredentials:!0,body:e})]})})},e.prototype.updatePasswordByOld=function(e){return L(this,void 0,Promise,function(){var t;return R(this,function(n){switch(n.label){case 0:return[4,this.sudo({password:e.old_password})];case 1:return t=n.sent(),[2,this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})]}})})},e.prototype.sudo=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.SUDO_URL}`,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.sendVerificationCodeToCurrentUser=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return e.target=`CUR_USER`,[2,this.config.request(t.VERIFICATION_URL,{method:`POST`,body:e,withCredentials:!0,withCaptcha:!0})]})})},e.prototype.changeBoundProvider=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(`${t.PROVIDER_LIST}/${e.provider_id}/trans`,{method:`POST`,body:{provider_trans_token:e.trans_token},withCredentials:!0})]})})},e.prototype.setUserProfile=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.USER_PRIFILE_URL,{method:`PATCH`,body:e,withCredentials:!0})]})})},e.prototype.updateUserBasicInfo=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.USER_BASIC_EDIT_URL,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.queryUserProfile=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){return n=new Ye(e),[2,this.config.request(`${t.USER_QUERY_URL}?${n.toString()}`,{method:`GET`,withCredentials:!0})]})})},e.prototype.setCustomSignFunc=function(e){this.getCustomSignTicketFn=e},e.prototype.signInWithCustomTicket=function(){return L(this,void 0,Promise,function(){var e,t;return R(this,function(n){switch(n.label){case 0:return(e=this.getCustomSignTicketFn)?[4,e()]:[2,Promise.reject({error:`failed_precondition`,error_description:`please use setCustomSignFunc to set custom sign function`})];case 1:return t=n.sent(),[2,this.signInCustom({provider_id:`custom`,ticket:t})]}})})},e.prototype.resetPassword=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTH_RESET_PASSWORD,{method:`POST`,body:e})]})})},e.prototype.authorize=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTHORIZE_URL,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.authorizeDevice=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTHORIZE_DEVICE_URL,{method:`POST`,withCredentials:!0,body:e})]})})},e.prototype.deviceAuthorize=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.AUTH_GET_DEVICE_CODE,{method:`POST`,body:e})]})})},e.prototype.authorizeInfo=function(n){return L(this,void 0,Promise,function(){var r,i,a;return R(this,function(o){switch(o.label){case 0:return r=`${t.AUTHORIZE_INFO_URL}?${e.parseParamsToSearch(n)}`,i=!0,a=!1,[4,this.hasLoginState()];case 1:return o.sent()&&(a=!0,i=!1),[2,this.config.request(r,{method:`GET`,withBasicAuth:i,withCredentials:a})]}})})},e.prototype.checkUsername=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.CHECK_USERNAME,{method:`GET`,body:e,withCredentials:!0})]})})},e.prototype.checkIfUserExist=function(e){return L(this,void 0,Promise,function(){var n;return R(this,function(r){return n=new Ye(e),[2,this.config.request(`${t.CHECK_IF_USER_EXIST}?${n.toString()}`,{method:`GET`})]})})},e.prototype.loginScope=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.credentialsClient.getScope()]})})},e.prototype.loginGroups=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.credentialsClient.getGroups()]})})},e.prototype.refreshTokenForce=function(e){return L(this,void 0,void 0,function(){var t;return R(this,function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return t=n.sent(),[4,this.config.credentialsClient.refreshToken(tt(tt({},t),{version:e?.version||`v1`}))];case 2:return[2,n.sent()]}})})},e.prototype.getCredentials=function(){return L(this,void 0,void 0,function(){return R(this,function(e){return[2,this.config.credentialsClient.getCredentials()]})})},e.prototype.getPublicKey=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.request(n.AUTH_PUBLIC_KEY,{method:`POST`,body:{}})]})})},e.prototype.getEncryptParams=function(e){return L(this,void 0,Promise,function(){var t,n,r,i,a,o;return R(this,function(s){switch(s.label){case 0:return t=e.isEncrypt,delete e.isEncrypt,n=(0,w.I)(e),[4,nt(t,this.config.adapter)];case 1:if(!(r=s.sent()))return[2,e];i=``,a=``,s.label=2;case 2:return s.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(o=s.sent(),i=o.public_key,a=o.public_key_thumbprint,!i||!a)throw o;return[3,5];case 4:throw s.sent();case 5:return[2,{params:r.getEncryptInfo({publicKey:i,payload:n}),public_key_thumbprint:a}]}})})},e.prototype.getProviderSubType=function(){return L(this,void 0,Promise,function(){return R(this,function(e){return[2,this.config.request(t.GET_PROVIDER_TYPE,{method:`POST`,body:{provider_id:`weda`}})]})})},e.prototype.verifyCaptchaData=function(e){var n=e.token,r=e.key;return L(this,void 0,void 0,function(){return R(this,function(e){return[2,this.config.request(t.VERIFY_CAPTCHA_DATA_URL,{method:`POST`,body:{token:n,key:r},withCredentials:!1})]})})},e.prototype.createCaptchaData=function(e){var n=e.state,r=e.redirect_uri,i=r===void 0?void 0:r;return L(this,void 0,void 0,function(){return R(this,function(e){return[2,this.config.request(t.CAPTCHA_DATA_URL,{method:`POST`,body:{state:n,redirect_uri:i},withCredentials:!1})]})})},e.prototype.getMiniProgramCode=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.GET_MINIPROGRAM_QRCODE,{method:`POST`,body:e})]})})},e.prototype.getMiniProgramQrCodeStatus=function(e){return L(this,void 0,Promise,function(){return R(this,function(n){return[2,this.config.request(t.GET_MINIPROGRAM_QRCODE_STATUS,{method:`POST`,body:e})]})})},e.prototype.getUserBehaviorLog=function(e){return L(this,void 0,Promise,function(){var n,r;return R(this,function(i){return n={LOGIN:`query[action]=USER_LOGIN`,MODIFY:`ne_query[action]=USER_LOGIN`},r=`${t.GET_USER_BEHAVIOR_LOG}?${n[e.type]}&limit=${e.limit}${e.page_token?`&page_token=${e.page_token}`:``}`,[2,this.config.request(r,{method:`GET`,withCredentials:!0})]})})},e.prototype.modifyPassword=function(e){return L(this,void 0,Promise,function(){var n,r,i,a,o,s;return R(this,function(c){switch(c.label){case 0:return n=``,r=``,[4,nt(!0,this.config.adapter)];case 1:if(!(i=c.sent()))throw Error(`do not support encrypt, a encrypt util required.`);c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(a=c.sent(),n=a.public_key,r=a.public_key_thumbprint,!n||!r)throw a;return[3,5];case 4:throw c.sent();case 5:return o=e.password?i.getEncryptInfo({publicKey:n,payload:e.password}):``,s=i.getEncryptInfo({publicKey:n,payload:e.new_password}),[2,this.config.request(t.USER_BASIC_EDIT_URL,{method:`POST`,withCredentials:!0,body:{user_id:e.user_id,encrypt_password:o,encrypt_new_password:s,public_key_thumbprint:r}})]}})})},e.prototype.modifyPasswordWithoutLogin=function(e){return L(this,void 0,Promise,function(){var t,r,i,a,o,s;return R(this,function(c){switch(c.label){case 0:return t=``,r=``,[4,nt(!0,this.config.adapter)];case 1:if(!(i=c.sent()))throw Error(`do not support encrypt, a encrypt util required.`);c.label=2;case 2:return c.trys.push([2,4,,5]),[4,this.getPublicKey()];case 3:if(a=c.sent(),t=a.public_key,r=a.public_key_thumbprint,!t||!r)throw a;return[3,5];case 4:throw c.sent();case 5:return o=e.password?i.getEncryptInfo({publicKey:t,payload:e.password}):``,s=i.getEncryptInfo({publicKey:t,payload:e.new_password}),[2,this.config.request(n.AUTH_RESET_PASSWORD,{method:`POST`,body:{username:e.username,password:o,new_password:s,public_key_thumbprint:r}})]}})})},e.prototype.restoreUrlState=function(e,t){if(e!==void 0)try{var n=new URL(window.location.href);n.search=e,n.hash=t||``,window.history.replaceState(null,``,n.toString()),window.location.replace(n.toString())}catch{}},e}(),it=function(){return it=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},it.apply(this,arguments)},at=function(){function e(e){var t=e.apiOrigin,n=e.getApiOrigin,r=e.apiPath,i=r===void 0?s:r,a=e.clientId,o=e.env,c=e.storage,l=e.request,u=e.baseRequest,d=e.anonymousSignInFunc,f=e.wxCloud,p=e.adapter,m=e.onCredentialsError,h=e.headers,g=e.i18n,_=e.useWxCloud,v=e.eventBus,y=e.detectSessionInUrl,b=e.debug;if(this.detectSessionInUrl=y!=null&&y,this.oauth2client=new Pe({apiOrigin:t,getApiOrigin:n,apiPath:i,clientId:a,env:o,storage:c,baseRequest:u||l,anonymousSignInFunc:d,wxCloud:f,onCredentialsError:m,headers:h||{},i18n:g,useWxCloud:_,eventBus:v,debug:b}),this.authApi=new rt(it(it({credentialsClient:this.oauth2client},e),{request:l?this.oauth2client.request.bind(this.oauth2client):void 0,adapter:p})),y)this.oauth2client.setGetInitialSession(this.authApi.getInitialSession.bind(this.authApi));else try{var x=new URL(window.location.href),S=x.searchParams.get(`code`),C=x.searchParams.get(`state`),w=JSON.parse(sessionStorage.getItem(C)||`null`);S&&C&&w!=null&&w.hash&&(x.hash=w.hash,window.history.replaceState(null,``,x.toString()),window.location.replace(x.toString()))}catch{}}return e.prototype.initializeSession=function(e){this.detectSessionInUrl?(this.oauth2client.setOnInitialSessionObtained(e),this.oauth2client.initialize()):this.oauth2client.initialize(Promise.resolve({error:null}))},e}(),z=io(794),ot=io(141),st=io(197);let ct=(e=>{var t={};return io.d(t,e),t})({default:()=>gi});var lt=io(182),ut=function(){return ut=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ut.apply(this,arguments)},dt=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ft=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},pt=function(){function e(e){try{this.localStorage=e?.localStorage||(e?.adapter?.root?.globalThis||globalThis).localStorage}catch{this.localStorage=e?.localStorage||{}}}return e.prototype.getItem=function(e){return dt(this,void 0,Promise,function(){return ft(this,function(t){return[2,this.localStorage.getItem(e)]})})},e.prototype.removeItem=function(e){return dt(this,void 0,void 0,function(){return ft(this,function(t){return this.localStorage.removeItem(e),[2]})})},e.prototype.setItem=function(e,t){return dt(this,void 0,Promise,function(){return ft(this,function(n){return this.localStorage.setItem(e,t),[2]})})},e.prototype.getItemSync=function(e){return this.localStorage.getItem(e)},e.prototype.setItemSync=function(e,t){this.localStorage.setItem(e,t)},e.prototype.removeItemSync=function(e){this.localStorage.removeItem(e)},e}(),mt=/^[^:]+:\/\/[^/]+(\/[^?#]+)/,ht=function(e,t){var n,r,i=t?.headers?.[`x-request-id`];return e||={},(e!=null&&e.code||(n=e?.data)!=null&&n.error_code)&&(e={error:e.code||e.data.error,error_description:e.data.error_description||e.message||e.code||e.data.error_code,request_id:e.requestId,error_code:e.data?.error_code}),e!=null&&e.request_id||(e.request_id=e.request_id||i),e?.error?(e.error_uri=(r=t?.url,mt.test(r)?RegExp.$1:r),e):e?.data||{}},gt=function(e){return e.adapter&&e.adapter.type!=="default"?function(e,t){var n=ut({},e);try{if(!(e!=null&&e.storage)&&t!=null&&t.localStorage&&(n.storage=new pt({localStorage:t.localStorage,adapter:t})),!e.captchaOptions&&t!=null&&t.captchaOptions&&(n.captchaOptions=t.captchaOptions),!e.baseRequest&&!e.request&&t?.reqClass){var r={timeout:1e4,restrictedMethods:[`get`,`post`,`upload`,`download`,`request`],auth:e.auth},i=new t.reqClass(r);n.baseRequest=function(e,t){var n,r,a;return dt(this,void 0,void 0,function(){var o,s,c,l;return ft(this,function(u){switch(u.label){case 0:if(o={},s=t.method?.toLocaleLowerCase()||`post`,typeof(c=((n=i?.[s])?.bind)?.call(n,i))!=`function`)throw Error(`invalid 【${s}】 request method`);u.label=1;case 1:return u.trys.push([1,3,,4]),(r=t.headers)!=null&&r[`content-type`]&&!((a=t.headers)!=null&&a[`content-type`].includes(`application/json`))||[`string`,`undefined`].includes(typeof t.body)||(t.data=t.data||t.body,t.body=JSON.stringify(t.body)),[4,c(ut({url:e},t))];case 2:return o=u.sent(),o=ht(o,ut(ut({},t),{url:e})),[3,4];case 3:throw l=u.sent(),o=ut(ut({},l?.data),l);case 4:if(o?.error)throw o;return[2,o]}})})}}}catch(e){console.error(`user adapter generate fail:`,e)}return n}(e,e.adapter):function(e,t){var n=ut({},e),r={};if(t!=null&&t.captchaOptions&&(n.captchaOptions=t.captchaOptions),!ct.default.isMatch()||e.storage&&e.baseRequest)return n;try{var i=ct.default.genAdapter({}),a=i.localStorage,o=i.reqClass;return a&&(r.storage=new pt({localStorage:a,adapter:t})),o&&(r.request=function(e){return function(t,n){return dt(this,void 0,void 0,function(){return ft(this,function(r){return[2,new Promise(function(r,i){var a=Object.assign({},n);a.body&&typeof a.body!=`string`&&(a.body=JSON.stringify(a.body));var o=wx.request({url:t,data:a.body,timeout:e._timeout,method:a.method||`GET`,header:a.headers,success:function(e){(e=ht(e,ut(ut({},n),{url:t}))).error&&i(e),r(e)},fail:function(e){i({error:`unreachable`,error_description:e.message})},complete:function(t){if(t&&t.errMsg&&e._timeout&&e._restrictedMethods.indexOf(`request`)!==-1&&t.errMsg===`request:fail timeout`){console.warn(e._timeoutMsg);try{o.abort()}catch{}}}})})]})})}}(new o({timeout:1e4,restrictedMethods:[`get`,`post`,`upload`,`download`,`request`]}))),n.captchaOptions&&(r.baseRequest=r.request,r.request=void 0),ut(ut({},n),r)}catch(e){console.error(`adapter generate fail:`,e)}return n}(e,e.adapter)},_t=function(){return _t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_t.apply(this,arguments)},vt=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},yt=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},bt=function(){function e(e){}return e.prototype.signInWithRedirect=function(){throw Error(`[v1 兼容] WeixinAuthProvider.signInWithRedirect() 在当前版本中无法实现。 建议使用 auth.signInWithOAuth({ provider: 'providerId' }) 替代。`)},e.prototype.getRedirectResult=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] WeixinAuthProvider.getRedirectResult() 在当前版本中无法实现。 建议使用 auth.verifyOAuth({ code, state, provider }) 替代。`)})})},e.prototype.getLinkRedirectResult=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] WeixinAuthProvider.getLinkRedirectResult() 在当前版本中无法实现。 建议使用 auth.linkIdentity({ provider: 'providerId' }) 替代。`)})})},e}(),xt=function(){function e(e){this.authInstance=e.authInstance}return e.prototype.signIn=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(t){switch(t.label){case 0:return[4,this.authInstance.signInWithCustomTicket(function(){return Promise.resolve(e)})];case 1:return t.sent(),[2]}})})},e}(),St=function(){function e(e){this.authInstance=e.authInstance}return e.prototype.signIn=function(){return vt(this,void 0,Promise,function(){return yt(this,function(e){switch(e.label){case 0:return[4,this.authInstance.signInAnonymously({})];case 1:return e.sent(),[2]}})})},e}(),Ct=function(){function e(){}return e.prototype.weixinAuthProvider=function(e){return new bt({authInstance:this,appid:e.appid,scope:e.scope})},e.prototype.customAuthProvider=function(){return new xt({authInstance:this})},e.prototype.anonymousAuthProvider=function(){return new St({authInstance:this})},e.prototype.signUpWithEmailAndPassword=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`email must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),[4,this.signUp({email:e,password:t})];case 1:return[2,n.sent()]}})})},e.prototype.signInWithEmailAndPassword=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`email must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),[4,this.signIn({username:e,password:t})];case 1:return n.sent(),[2,this.createLoginState()]}})})},e.prototype.sendPasswordResetEmail=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`email must be a string`),[4,this.getVerification({email:e})];case 1:return t.sent(),[2]}})})},e.prototype.signInWithUsernameAndPassword=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),[4,this.signIn({username:e,password:t})];case 1:return n.sent(),[2,this.createLoginState()]}})})},e.prototype.sendPhoneCode=function(e){return vt(this,void 0,Promise,function(){var t;return yt(this,function(n){switch(n.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),t=this.formatPhone(e),[4,this.getVerification({phone_number:t})];case 1:return n.sent(),[2,!0]}})})},e.prototype.signUpWithPhoneCode=function(e,t,n){return vt(this,void 0,Promise,function(){var r;return yt(this,function(i){switch(i.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneCode must be a string`),r=this.formatPhone(e),[4,this.signUp(_t({phone_number:r,verification_code:t},n?{password:n}:{}))];case 1:return i.sent(),[2,this.createLoginState()]}})})},e.prototype.signInWithPhoneCodeOrPassword=function(e){return vt(this,void 0,Promise,function(){var t,n,r,i;return yt(this,function(a){switch(a.label){case 0:return t=e.phoneNumber,n=e.phoneCode,r=e.password,typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),i=this.formatPhone(t),r?[4,this.signIn({username:i,password:r})]:[3,2];case 1:return a.sent(),[3,5];case 2:return n?[4,this.signIn({username:i,verification_token:n})]:[3,4];case 3:return a.sent(),[3,5];case 4:(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneCode or password must be provided`),a.label=5;case 5:return[2,this.createLoginState()]}})})},e.prototype.forceResetPwdByPhoneCode=function(e){return vt(this,void 0,Promise,function(){var t,n,r,i;return yt(this,function(a){switch(a.label){case 0:return t=e.phoneNumber,n=e.phoneCode,r=e.password,typeof t!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneNumber must be a string`),typeof n!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`phoneCode must be a string`),typeof r!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`password must be a string`),i=this.formatPhone(t),[4,this.resetPassword({phone_number:i,new_password:r,verification_token:n})];case 1:return a.sent(),[4,this.signIn({username:i,password:r})];case 2:return a.sent(),[2,this.createLoginState()]}})})},e.prototype.shouldRefreshAccessToken=function(e){throw Error(`[v1 兼容] shouldRefreshAccessToken() 在当前版本中无法实现。 建议使用 auth.onAuthStateChange(callback) 来监听 TOKEN_REFRESHED 事件替代。`)},e.prototype.onLoginStateExpired=function(e){var t=this;this.onLoginStateChanged(function(n){n?.eventType===u&&e.call(t)})},e.prototype.onAccessTokenRefreshed=function(e){var t=this;this.onAuthStateChange(function(n){n===m&&e.call(t)})},e.prototype.onAnonymousConverted=function(e){var t=this;this.onAuthStateChange(function(n){n===f&&e.call(t)})},e.prototype.onLoginTypeChanged=function(e){var t=this;this.onAuthStateChange(function(n){n!==f&&n!==d||e.call(t)})},e}(),wt=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),B=function(){return B=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},B.apply(this,arguments)},Tt=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},V=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},H=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},U=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Et=function(){return typeof window<`u`&&typeof document<`u`},Dt=function(e){return function(t){e.fire(_,B(B({},t),{eventType:u}))}},Ot=[`avatar_url`,`avatarUrl`];function kt(e){return typeof TextEncoder<`u`?new TextEncoder().encode(e).length:e.length}function At(e,t){if(e)for(var n=0,r=Ot;n<r.length;n++){var i=r[n],o=e[i];if(o!=null&&o!==``){var s=kt(String(o));if(s>204800)throw new I({error:`invalid_argument`,error_code:a.INVALID_ARGUMENT,error_description:`auth.${t}(params): "${i}" 超过 200KB 限制(当前 ${s} 字节),请传入图片 URL 而非文件内容`},{method:t})}}}var jt,Mt=function(){function t(e){var t=e.cache,n=e.oauthInstance;this.cache=t,this.oauthInstance=n,this.setUserInfo()}var n,r,i;return t.prototype.checkLocalInfo=function(){return H(this,void 0,void 0,function(){return U(this,function(e){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 H(this,void 0,void 0,function(){var e,t,n,r;return U(this,function(i){switch(i.label){case 0:return e=this,[4,this.getLocalUserInfoAsync(`uid`)];case 1:return e.uid=i.sent(),t=this,[4,this.getLocalUserInfoAsync(`gender`)];case 2:return t.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(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return At(e,`update`),[4,this.oauthInstance.authApi.setUserProfile(B({},e))];case 1:return t=n.sent(),this.setLocalUserInfo(t),[2]}})})},t.prototype.updateUserBasicInfo=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return At(e,`updateUserBasicInfo`),[4,this.oauthInstance.authApi.updateUserBasicInfo(B({},e))];case 1:return t.sent(),[4,this.refresh()];case 2:return t.sent(),[2]}})})},t.prototype.updatePassword=function(e,t){return this.oauthInstance.authApi.updatePasswordByOld({old_password:t,new_password:e})},t.prototype.updateUsername=function(e){return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),this.update({username:e})},t.prototype.refresh=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(e)];case 1:if((t=n.sent()).code===`INVALID_ACCESS_TOKEN`)throw this.setLocalUserInfo({}),t;return this.setLocalUserInfo(t),[2,t]}})})},t.prototype.getLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey,n=this.cache.getStore(t);return e?n[e]:n||{}},t.prototype.setLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;this.cache.setStore(t,e),this.setUserInfo()},t.prototype.getLocalUserInfoAsync=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(t)];case 1:return[2,n.sent()[e]]}})})},t.prototype.setUserInfo=function(){var e=this,t=this.cache.keys.userInfoKey,n=this.cache.getStore(t);[`uid`,`email`,`name`,`gender`,`picture`,`email_verified`,`phone_number`,`birthdate`,`zoneinfo`,`locale`,`sub`,`created_from`,`providers`,`username`,`created_at`,`open_id`].forEach(function(t){e[t]=n[t]})},Tt([(0,ot.catchErrorsDecorator)({title:`更新用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.update() 的语法或参数是否正确`,` 2 - 用户信息中是否包含非法值`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(n=e.UserProfile)==`function`?n:Object]),V(`design:returntype`,typeof(r=typeof Promise<`u`&&Promise)==`function`?r:Object)],t.prototype,`update`,null),Tt([(0,ot.catchErrorsDecorator)({title:`更新密码失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.updatePassword() 的语法或参数是否正确`,` 3 - 新密码中是否包含非法字符`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String,String]),V(`design:returntype`,void 0)],t.prototype,`updatePassword`,null),Tt([(0,ot.catchErrorsDecorator)({title:`更新用户名失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.updateUsername() 的语法或参数是否正确`,` 2 - 当前环境是否开通了用户名密码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String]),V(`design:returntype`,void 0)],t.prototype,`updateUsername`,null),Tt([(0,ot.catchErrorsDecorator)({title:`刷新本地用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 User.refresh() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(i=typeof Promise<`u`&&Promise)==`function`?i:Object)],t.prototype,`refresh`,null),t}();(jt=Mt).prototype.linkWithTicket=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.linkWithTicket() 在当前版本中无法实现。 建议使用 auth.signInWithCustomTicket(() => Promise.resolve(ticket)) 替代。`)})})},jt.prototype.linkWithRedirect=function(e){throw Error(`[v1 兼容] User.linkWithRedirect() 在当前版本中无法实现。 建议使用 auth.linkIdentity({ provider: 'providerId' }) 替代。`)},jt.prototype.updateEmail=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`newEmail must be a string`),[4,this.updateUserBasicInfo({email:e})];case 1:return t.sent(),[2]}})})},jt.prototype.linkWithPhoneNumber=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.linkWithPhoneNumber() 在当前版本中无法实现。 建议使用 auth.bindPhoneNumber({ phone_number, verification_token, sudo_token }) 替代。`)})})},jt.prototype.updatePhoneNumber=function(e,t){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.updatePhoneNumber() 在当前版本中无法实现。 建议使用 auth.updateUser({ phone: newPhoneNumber }) 替代。`)})})},jt.prototype.unlink=function(e){return vt(this,void 0,Promise,function(){return yt(this,function(e){throw Error(`[v1 兼容] User.unlink() 在当前版本中无法实现。 建议使用 auth.unlinkIdentity({ provider: loginType }) 替代。`)})})};var Nt=function(){function e(e){var t=e.envId,n=e.cache,r=e.oauthInstance;t||(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`envId is not defined`),this.cache=n,this.oauthInstance=r,this.user=new Mt({cache:this.cache,oauthInstance:r})}return e.prototype.checkLocalState=function(){this.oauthLoginState=this.oauthInstance?.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},e.prototype.checkLocalStateAsync=function(){return H(this,void 0,void 0,function(){return U(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance?.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}})})},e}(),Pt=function(t){function n(e){var n=t.call(this)||this;return n.listeners=new Map,n.hasListenerSetUp=!1,n.config=e,n.oauthInstance=e.oauthInstance,n.cache=e.cache,n.init(),n.setAccessKey(),n}var r,i,a,o,s,l,d,m,g,b,C,w,T,E,D,ee,te,O,A,ne,re;return wt(n,t),n.prototype.signInAnonymously=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),[4,this.oauthInstance.authApi.signInAnonymously(e)];case 1:return o.sent(),[4,this.createLoginState()];case 2:return t=o.sent(),[4,this.getSession()];case 3:return n=o.sent().data,r=(n===void 0?{}:n).session,[2,B(B({},t),{data:{user:r.user,session:r},error:null})];case 4:return i=o.sent(),(a=new I(i,{method:`signInAnonymously`})).category===F.PROVIDER_NOT_ENABLED?(console.error(a.helpMessage),console.error(`[CloudBase Auth] 提示:匿名登录需要在控制台开启「匿名登录」。
|
|
168
168
|
如果您需要使用用户名密码登录,请改用 auth.signInWithPassword({ username, password })。
|
|
169
|
-
不要在匿名登录失败后自动回退到密码登录,这两种方式的使用场景不同。`)):(console.warn(`[CloudBase Auth] signInAnonymously 失败 [${a.category}]: ${a.message}`),a.loginMethodHint&&console.warn(a.loginMethodHint)),[2,{data:{user:null,session:null},error:a}];case 5:return[2]}})})},n.prototype.signUp=function(e){return H(this,void 0,Promise,function(){var t,n,r=this;return U(this,function(i){switch(i.label){case 0:return e.phone_number||e.verification_code||e.verification_token||e.provider_token?(e.phone_number&&=this.formatPhone(e.phone_number),[4,this.oauthInstance.authApi.signUp(e)]):[3,2];case 1:return i.sent(),[2,this.createLoginState()];case 2:return i.trys.push([2,4,,5]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signUp`),[4,this.getVerification(e.email?{email:e.email,usage:c.EMAIL}:{phone_number:this.formatPhone(e.phone)})];case 3:return t=i.sent(),[2,{data:{verifyOtp:function(n){var i=n.token,a=n.messageId,o=a===void 0?t.verification_id:a;return H(r,void 0,Promise,function(){var n,r,a,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,8,,9]),[4,this.verify({verification_id:o||t.verification_id,verification_code:String(i)})];case 1:return n=l.sent(),t.is_user?[4,this.signIn({username:e.email||this.formatPhone(e.phone),verification_token:n.verification_token})]:[3,3];case 2:return l.sent(),[3,6];case 3:return delete(r=JSON.parse(JSON.stringify(e))).email,delete r.phone,[4,this.oauthInstance.authApi.signUp(B(B(B({},r),e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)}),{verification_token:n.verification_token,verification_code:i}))];case 4:return l.sent(),[4,this.createLoginState()];case 5:l.sent(),l.label=6;case 6:return[4,this.getSession()];case 7:return a=l.sent().data,[2,{data:{user:(s=(a===void 0?{}:a).session).user,session:s},error:null}];case 8:return c=l.sent(),[2,{data:{user:null,session:null},error:new I(c,{method:`signUp`})}];case 9:return[2]}})})}},error:null}];case 4:return n=i.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`signUp`})}];case 5:return[2]}})})},n.prototype.signOut=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return n=i.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return i.sent(),this.setAccessKey(),[2,B(B({},n),{data:{},error:null})];case 3:return r=i.sent(),[2,{data:{},error:new I(r,{method:`signOut`})}];case 4:return[2]}})})},n.prototype.onAuthStateChange=function(e){var t=this;this.hasListenerSetUp||=(this.setupListeners(),!0);var n=Math.random().toString(36);return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),{data:{subscription:{id:n,callback:e,unsubscribe:function(){var r=t.listeners.get(n);r&&(r.delete(e),r.size===0&&t.listeners.delete(n))}}}}},n.prototype.signInWithPassword=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),this.validateAtLeastOne(e,[[`username`],[`email`],[`phone`]],`signInWithPassword`),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`signInWithPassword`),t=`username`in e?e.username:void 0,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,i=e.options?.is_encrypt??e.is_encrypt,[4,this.signIn(B({username:t||n||this.formatPhone(r),password:e.password},i?{isEncrypt:!0,version:`v2`}:{}))];case 1:return l.sent(),[4,this.getSession()];case 2:return a=l.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 3:return s=l.sent(),(c=new I(s,{method:`signInWithPassword`})).category===F.PROVIDER_NOT_ENABLED?console.error(c.helpMessage):c.category===F.INVALID_CREDENTIALS||c.category===F.USER_NOT_FOUND?console.warn(c.helpMessage):console.warn(`[CloudBase Auth] signInWithPassword 失败 [${c.category}]: ${c.message}`),c.loginMethodHint&&console.info(c.loginMethodHint),[2,{data:{user:null,session:null},error:c}];case 4:return[2]}})})},n.prototype.signInWithIdToken=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{token:{required:!0,message:`Token is required`}},`signInWithIdToken`),[4,this.signInWithProvider({provider_id:e.provider,provider_id_token:e.token})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`signInWithIdToken`})}];case 4:return[2]}})})},n.prototype.signInWithOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o=this;return U(this,function(s){switch(s.label){case 0:if(t=e.options,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,!t?.emailRedirectTo&&(t?.shouldCreateUser===void 0||t?.shouldCreateUser))return[2,this.signUp(n?{email:n}:{phone:r})];s.label=1;case 1:return s.trys.push([1,3,,4]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signInWithOtp`),[4,this.getVerification(B(B({email_redirect_to:t?.emailRedirectTo},n?{email:n,usage:c.EMAIL}:{phone_number:this.formatPhone(r)}),{target:t?.emailRedirectTo&&t?.shouldCreateUser?`ANY`:`USER`}))];case 2:return i=s.sent(),[2,{data:{user:null,session:null,verifyOtp:function(e){var t=e.token,a=e.messageId,s=a===void 0?i.verification_id:a;return H(o,void 0,Promise,function(){return U(this,function(e){return[2,this.verifyOtp(n?{email:n,token:String(t),messageId:s||``}:{phone:r,token:String(t),messageId:s||``})]})})}},error:null}];case 3:return a=s.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`signInWithOtp`})}];case 4:return[2]}})})},n.prototype.verifyOAuth=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l;return U(this,function(u){switch(u.label){case 0:t={},u.label=1;case 1:return u.trys.push([1,7,,8]),n=e?.code||ue(`code`),r=e?.state||ue(`state`),n?r?(i=function(e){try{return JSON.parse(sessionStorage.getItem(e))}catch(e){return console.error(`Failed to get browser session:`,e),null}}(r),t.type=i?.type,(a=e?.provider||i?.provider||ue(`provider`))?[4,this.grantProviderToken({provider_id:a,provider_redirect_uri:location.origin+location.pathname,provider_code:n})]:[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:this.missingRequiredParam(`verifyOAuth`,`provider`)}]):[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`state`)}]:[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`code`)}];case 2:return o=u.sent().provider_token,s=void 0,i.type===x?[4,this.oauthInstance.authApi.toBindIdentity({provider_token:o,provider:a,fireEvent:!0})]:[3,4];case 3:return s=u.sent(),[3,6];case 4:return[4,this.signInWithIdToken({token:o})];case 5:(s=u.sent()).data=B(B({},t),s.data),u.label=6;case 6:return(c=new URLSearchParams(location==null?void 0:location.search)).delete(`code`),c.delete(`state`),s.data.redirectUrl=function(e,t){if(e!==void 0){var n=new URL(window.location.href);return n.search=e,n.hash=t||n.hash,window.history.replaceState({},``,n.href),n.href}}(i?.search===void 0?`?${c.toString()}`:i?.search,i?.hash||location.hash),function(e){try{return sessionStorage.removeItem(e),!0}catch(e){return console.error(`Failed to remove browser session:`,e),null}}(r),[2,s];case 7:return l=u.sent(),[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:new I(l,{method:`verifyOAuth`})}];case 8:return[2]}})})},n.prototype.signInWithOAuth=function(e){var t,n;return H(this,void 0,Promise,function(){var r,i,a,o,s,c,l,u,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`signInWithOAuth`),r=e.options?.redirectTo||location.href,i=new URL(r),a=i.origin+i.pathname,o=e.options?.state||`prd-${e.provider}-${Math.random().toString(36).slice(2)}`,[4,this.genProviderRedirectUri({provider_id:e.provider,provider_redirect_uri:a,state:o})];case 1:return s=f.sent().uri,c=decodeURIComponent(s),l=c,(t=e.options)!=null&&t.queryParams&&(u=new URL(c),Object.entries(e.options.queryParams).forEach(function(e){var t=e[0],n=e[1];u.searchParams.set(t,n)}),l=u.toString()),function(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(`Failed to save to browser session:`,e)}}(o,{provider:e.provider,search:i.search,hash:i.hash,type:e.options?.type||y}),Et()&&!((n=e.options)!=null&&n.skipBrowserRedirect)&&window.location.assign(l),[2,{data:{url:l,provider:e.provider},error:null}];case 2:return d=f.sent(),[2,{data:{url:null,provider:null},error:new I(d,{method:`signInWithOAuth`})}];case 3:return[2]}})})},n.prototype.getClaims=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.getAccessToken()];case 1:return[2,{data:function(e){if(typeof e!=`string`)throw Error(`Invalid token specified`);try{var t=e.split(`.`).map(function(e,t){return t===2?e:JSON.parse(function(e){var t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw Error(`Illegal base64url string!`)}try{return function(e){return decodeURIComponent(k(e).replace(/(.)/g,function(e){var t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=`0${t}`),`%${t}`}))}(t)}catch{return k(t)}}(e))});return{claims:t[1],header:t[0],signature:t[2]}}catch(e){throw Error(`Invalid token specified: ${e}`?e.message:0)}}(t.sent().accessToken),error:null}];case 2:return e=t.sent(),[2,{data:{claims:null,header:null,signature:null},error:new I(e,{method:`getClaims`})}];case 3:return[2]}})})},n.prototype.resetPasswordForEmail=function(e,t){return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l=this;return U(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),this.validateParams({emailOrPhone:e},{emailOrPhone:{required:!0,message:`Email or phone is required`}},`resetPasswordForEmail`),n=(t||{}).redirectTo,r=e.includes(`@`),i=void 0,r?i={email:e,usage:c.RECOVERY}:(a=this.formatPhone(e),i={phone_number:a}),[4,this.getVerification(B(B({},i),{target:`USER`}))];case 1:return o=u.sent(),[2,{data:{updateUser:function(t){return H(l,void 0,Promise,function(){var i,a,s,c;return U(this,function(l){switch(l.label){case 0:this.validateParams(t,{nonce:{required:!0,message:`Nonce is required`},password:{required:!0,message:`Password is required`}},`resetPasswordForEmail`),l.label=1;case 1:return l.trys.push([1,5,,6]),[4,this.verify({verification_id:o.verification_id,verification_code:t.nonce})];case 2:return i=l.sent(),[4,this.oauthInstance.authApi.resetPassword({email:r?e:void 0,phone_number:r?void 0:e,new_password:t.password,verification_token:i.verification_token})];case 3:return l.sent(),(c=this.config.eventBus)==null||c.fire(v,{event:`PASSWORD_RECOVERY`}),[4,this.signInWithPassword({email:r?e:void 0,phone:r?void 0:e,password:t.password})];case 4:return a=l.sent(),n&&Et()&&window.location.assign(n),[2,a];case 5:return s=l.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 6:return[2]}})})}},error:null}];case 2:return s=u.sent(),[2,{data:{updateUser:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 3:return[2]}})})},n.prototype.resetPasswordForOld=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.authApi.updatePasswordByOld({old_password:e.old_password,new_password:e.new_password})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`resetPasswordForOld`})}];case 4:return[2]}})})},n.prototype.verifyOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),t=e.type,n=String(e.token),r=`email`in e?e.email:void 0,i=`phone`in e?e.phone:void 0,this.validateParams(e,{token:{required:!0,message:`Token is required`},messageId:{required:!0,message:`messageId is required`}},`verifyOtp`),[`phone_change`,`email_change`].includes(t)?[4,this.verify({verification_id:e.messageId,verification_code:n})]:[3,2];case 1:return c.sent(),[3,4];case 2:return[4,this.signInWithUsername({verificationInfo:{verification_id:e.messageId,is_user:!0},verificationCode:n,username:r||this.formatPhone(i)||``,loginType:r?`email`:`phone`})];case 3:c.sent(),c.label=4;case 4:return[4,this.getSession()];case 5:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 6:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`verifyOtp`})}];case 7:return[2]}})})},n.prototype.getSession=function(){return H(this,void 0,Promise,function(){var e,t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(e=i.sent())&&e.scope!==`accessKey`?[4,this.getUser(!1)]:[2,{data:{session:null,user:null},error:null}];case 2:return t=i.sent().data,n=(t===void 0?{}:t).user,[2,{data:{session:B(B({},e),{user:n}),user:n},error:null}];case 3:return r=i.sent(),[2,{data:{session:null,user:null},error:new I(r,{method:`getSession`})}];case 4:return[2]}})})},n.prototype.refreshSession=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return(t=o.sent()).refresh_token=e||t.refresh_token,[4,this.oauthInstance.oauth2client.refreshToken(t)];case 2:return n=o.sent(),[4,this.getUser(!1)];case 3:return r=o.sent().data,[2,{data:{user:i=(r===void 0?{}:r).user,session:B(B({},n),{user:i})},error:null}];case 4:return a=o.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`refreshSession`})}];case 5:return[2]}})})},n.prototype.getUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(t=i.sent())&&t.scope!==`accessKey`?(n=this.convertToUser,[4,this.getCurrentUser(e)]):[2,{data:{user:null},error:null}];case 2:return[2,{data:{user:n.apply(this,[i.sent()])},error:null}];case 3:return r=i.sent(),[2,{data:{user:null},error:new I(r,{method:`getUser`})}];case 4:return[2]}})})},n.prototype.refreshUser=function(){return H(this,void 0,Promise,function(){var e,t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.currentUser.refresh()];case 1:return r.sent(),[4,this.getSession()];case 2:return e=r.sent().data,[2,{data:{user:(t=(e===void 0?{}:e).session).user,session:t},error:null}];case 3:return n=r.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`refreshUser`})}];case 4:return[2]}})})},n.prototype.updateUser=function(e){var t;return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l,u,d,f,p,m,g,_=this;return U(this,function(y){switch(y.label){case 0:if(y.trys.push([0,8,,9]),At(e,`updateUser`),n=[`password`,`new_password`].find(function(t){var n=e[t];return n!=null&&n!==``}))throw new I({message:`updateUser 不支持更新密码,检测到传入了 "${n}" 参数。如需修改密码请使用 resetPasswordForOld(旧密码修改)、resetPasswordForEmail(验证码重置)或 reauthenticate(重新认证后改密)`});if(!Object.keys(e).some(function(t){return e[t]!==void 0&&e[t]!==null&&e[t]!==``}))throw this.missingRequiredParam(`updateUser`,`(at least one field)`);return r=e.email,i=e.phone,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,[`email`,`phone`]),s=i!==void 0,l={},(o=r!==void 0)||s?(u=void 0,o?(u={email:e.email,usage:c.REAUTHENTICATION},d=`email_change`):(f=this.formatPhone(e.phone),u={phone_number:f},d=`phone_change`),[4,this.getVerification(B({},u))]):[3,4];case 1:return p=y.sent(),Object.keys(a).length>0?[4,this.updateUserBasicInfo(a)]:[3,3];case 2:y.sent(),y.label=3;case 3:return l={messageId:p.verification_id,verifyOtp:function(t){return H(_,void 0,Promise,function(){var n,r,i,a;return U(this,function(s){switch(s.label){case 0:return s.trys.push([0,11,,12]),t.email&&e.email===t.email?[4,this.verifyOtp({type:`email_change`,email:e.email,token:t.token,messageId:p.verification_id||``})]:[3,3];case 1:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({email:e.email})];case 2:return s.sent(),[3,9];case 3:return t.phone&&e.phone===t.phone?[4,this.verifyOtp({type:`phone_change`,phone:e.phone,token:t.token,messageId:p.verification_id||``})]:[3,6];case 4:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({phone:this.formatPhone(e.phone)})];case 5:return s.sent(),[3,9];case 6:return[4,this.verifyOtp(o?{type:d,email:e.email,token:t.token,messageId:p.verification_id||``}:{type:d,phone:e.phone,token:t.token,messageId:p.verification_id||``})];case 7:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo(e)];case 8:s.sent(),s.label=9;case 9:return[4,this.getUser(!1)];case 10:return r=s.sent().data.user,(a=this.config.eventBus)==null||a.fire(v,{event:h}),[2,{data:{user:r},error:null}];case 11:return i=s.sent(),[2,{data:{user:null},error:new I(i,{method:`updateUser`})}];case 12:return[2]}})})}},[3,6];case 4:return[4,this.updateUserBasicInfo(e)];case 5:y.sent(),y.label=6;case 6:return[4,this.getUser(!1)];case 7:return m=y.sent().data.user,Object.keys(a).length>0&&((t=this.config.eventBus)==null||t.fire(v,{event:h})),[2,{data:B({user:m},l),error:null}];case 8:return g=y.sent(),[2,{data:{user:null},error:new I(g,{method:`updateUser`})}];case 9:return[2]}})})},n.prototype.getUserIdentities=function(){return H(this,void 0,Promise,function(){var e,t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.oauthInstance.authApi.getProviders()];case 1:return e=n.sent(),[2,{data:{identities:(e?.data)?.filter(function(e){return!!e.bind})},error:null}];case 2:return t=n.sent(),[2,{data:{identities:null},error:new I(t,{method:`getUserIdentities`})}];case 3:return[2]}})})},n.prototype.linkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`linkIdentity`),[4,this.signInWithOAuth({provider:e.provider,options:{type:x}})];case 1:return n.sent(),[2,{data:{provider:e.provider},error:null}];case 2:return t=n.sent(),[2,{data:{provider:null},error:new I(t,{method:`linkIdentity`})}];case 3:return[2]}})})},n.prototype.unlinkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`unlinkIdentity`),[4,this.oauthInstance.authApi.unbindProvider({provider_id:e.provider})];case 1:return n.sent(),[2,{data:{},error:null}];case 2:return t=n.sent(),[2,{data:{},error:new I(t,{method:`unlinkIdentity`})}];case 3:return[2]}})})},n.prototype.reauthenticate=function(){return H(this,void 0,Promise,function(){var e,t,n,r,i=this;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getUser(!1)];case 1:return e=a.sent().data.user,this.validateAtLeastOne(e,[[`email`,`phone`]],`reauthenticate`),t=e.email?{email:e.email,usage:c.REAUTHENTICATION}:{phone_number:this.formatPhone(e.phone)},[4,this.getVerification(t)];case 2:return n=a.sent(),[2,{data:{updateUser:function(e){return H(i,void 0,Promise,function(){var r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:this.validateParams(e,{nonce:{required:!0,message:`Nonce is required`}},`reauthenticate`),c.label=1;case 1:return c.trys.push([1,9,,10]),e.password?[4,this.verify({verification_id:n.verification_id,verification_code:e.nonce})]:[3,5];case 2:return r=c.sent(),[4,this.oauthInstance.authApi.sudo({verification_token:r.verification_token})];case 3:return i=c.sent(),[4,this.oauthInstance.authApi.setPassword({new_password:e.password,sudo_token:i.sudo_token})];case 4:return c.sent(),[3,7];case 5:return[4,this.signInWithUsername(B(B({verificationInfo:n,verificationCode:e.nonce},t),{loginType:t.email?`email`:`phone`}))];case 6:c.sent(),c.label=7;case 7:return[4,this.getSession()];case 8:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 9:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`reauthenticate`})}];case 10:return[2]}})})}},error:null}];case 3:return r=a.sent(),[2,{data:{updateUser:null},error:new I(r,{method:`reauthenticate`})}];case 4:return[2]}})})},n.prototype.resend=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`resend`),t=e.type===`signup`?`ANY`:`USER`,n={target:t},`email`in e&&(n.email=e.email,n.usage=c.EMAIL),`phone`in e&&(n.phone_number=this.formatPhone(e.phone)),[4,this.oauthInstance.authApi.getVerification(n)];case 1:return[2,{data:{messageId:i.sent().verification_id},error:null}];case 2:return r=i.sent(),[2,{data:{messageId:null},error:new I(r,{method:`resend`})}];case 3:return[2]}})})},n.prototype.setSession=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{access_token:{required:!0,message:`Access token is required`},refresh_token:{required:!0,message:`Refresh token is required`}},`setSession`),[4,this.oauthInstance.oauth2client.refreshToken(e,{throwError:!0})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`setSession`})}];case 4:return[2]}})})},n.prototype.exchangeCodeForSession=function(){return H(this,void 0,void 0,function(){return U(this,function(e){return[2]})})},n.prototype.deleteUser=function(e){return H(this,void 0,Promise,function(){var t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`deleteUser`),[4,this.oauthInstance.authApi.sudo(e)];case 1:return t=r.sent().sudo_token,[4,this.oauthInstance.authApi.deleteMe({sudo_token:t})];case 2:return r.sent(),[2,{data:{},error:null}];case 3:return n=r.sent(),[2,{data:{},error:new I(n,{method:`deleteUser`})}];case 4:return[2]}})})},n.prototype.toDefaultLoginPage=function(e){return e===void 0&&(e={}),H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){try{return t=e.config_version||`env`,n=Object.keys(e.query||{}).map(function(t){return`${t}=${e.query[t]}`}).join(`&`),ct.default.isMatch()?wx.navigateTo({url:`/packages/\$wd_system/pages/login/index${n?`?${n}`:``}`}):(r=e.redirect_uri||window.location.href,i=new URL(r),a=`${i.origin}/__auth/?app_id=${e.app_id||``}&env_id=${this.config.env}&client_id=${this.config.clientId||this.config.env}&config_version=${t}&redirect_uri=${encodeURIComponent(r)}${n?`&${n}`:``}`,window.location.href=a),[2,{data:{},error:null}]}catch(e){return[2,{data:{},error:new I(e,{method:`toDefaultLoginPage`})}]}})})},n.prototype.signInWithCustomTicket=function(e){return H(this,void 0,Promise,function(){var t,n,r,i;return U(this,function(a){switch(a.label){case 0:e&&this.setCustomSignFunc(e),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,this.oauthInstance.authApi.signInWithCustomTicket()];case 2:return a.sent(),[4,this.createLoginState()];case 3:return t=a.sent(),[4,this.getSession()];case 4:return n=a.sent().data,r=(n===void 0?{}:n).session,[2,B(B({},t),{data:{user:r.user,session:r},error:null})];case 5:return i=a.sent(),[2,{data:{user:null,session:null},error:new I(i,{method:`signInWithCustomTicket`})}];case 6:return[2]}})})},n.prototype.signInWithOpenId=function(e){var t=(e===void 0?{}:e).useWxCloud,n=t===void 0||t;return H(this,void 0,Promise,function(){var e,t,r,i,a,o,s=this;return U(this,function(c){switch(c.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(s,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},n)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:r.provider_token},n)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(i)];case 6:return a.sent(),[2]}})})},c.label=1;case 1:return c.trys.push([1,5,,6]),[4,new Promise(function(e,n){wx.login({success:function(r){return H(s,void 0,void 0,function(){var i;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(r.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return i=a.sent(),n(i),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return c.sent(),[4,this.createLoginState()];case 3:return r=c.sent(),[4,this.getSession()];case 4:return i=c.sent().data,a=(i===void 0?{}:i).session,[2,B(B({},r),{data:{user:a.user,session:a},error:null})];case 5:return o=c.sent(),[2,{data:{user:null,session:null},error:new I(o,{method:`signInWithOpenId`})}];case 6:return[2]}})})},n.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,n=t===void 0?``:t,r=e.useWxCloud,i=r!==void 0&&r;return H(this,void 0,Promise,function(){var e,t,r,a,o,s,c,l,u;return U(this,function(d){switch(d.label){case 0:return ct.default.isMatch()?(e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:`phone`,code:n,appid:e.appId},provider_id:e.appId},[4,wx.login()]):[2,{data:{user:null,session:null},error:new I({message:`wx api undefined`})}];case 1:r=d.sent().code,t.provider_code=r,d.label=2;case 2:return d.trys.push([2,5,,6]),[4,this.oauthInstance.authApi.grantProviderToken(t,i)];case 3:if((a=d.sent()).error_code)throw a;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:a.provider_token},i)];case 4:if((o=d.sent())?.error_code)throw o;return[3,6];case 5:return s=d.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`signInWithPhoneAuth`})}];case 6:return[4,this.createLoginState()];case 7:return c=d.sent(),[4,this.getSession()];case 8:return l=d.sent().data,u=(l===void 0?{}:l).session,[2,B(B({},c),{data:{user:u.user,session:u},error:null})]}})})},n.prototype.bindPhoneNumber=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.editContact(e)]})})},n.prototype.unbindProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]})})},n.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},n.prototype.verify=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verify(e)]})})},n.prototype.getVerification=function(e,t){return H(this,void 0,Promise,function(){return U(this,function(n){return e.phone_number&&=this.formatPhone(e.phone_number),[2,this.oauthInstance.authApi.getVerification(e,t)]})})},Object.defineProperty(n.prototype,"currentUser",{get:function(){if(this.cache.mode!==`async`){var e=this.hasLoginState();return e&&e.user||null}(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getCurrentUser instead`)},enumerable:!1,configurable:!0}),n.prototype.getCurrentUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e?[4,this.getLoginState()]:[3,3];case 1:return(t=i.sent())?[4,t.user.refresh()]:[3,3];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:return i.sent(),[3,5];case 5:return[4,this.getLoginState()];case 6:return(n=i.sent())?(r=n.user.getLocalUserInfo(),[4,n.user.checkLocalInfoAsync()]):[3,8];case 7:return i.sent(),[2,B(B({},n.user),r)];case 8:return[2,null]}})})},n.prototype.signInAnonymouslyInWx=function(e){var t=(e===void 0?{}:e).useWxCloud;return H(this,void 0,Promise,function(){var e,n,r=this;return U(this,function(i){switch(i.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,n=function(n){return H(r,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:n,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},t)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInAnonymously({provider_token:r.provider_token},t)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[2]}})})},[4,new Promise(function(e,t){wx.login({success:function(i){return H(r,void 0,void 0,function(){var r;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,n(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return r=a.sent(),t(r),[3,3];case 3:return[2]}})})},fail:function(e){var n=Error(e?.errMsg);n.code=e?.errno,t(n)}})})];case 1:return i.sent(),[2,this.createLoginState(void 0,{asyncRefreshUser:!0})]}})})},n.prototype.bindOpenId=function(){return H(this,void 0,Promise,function(){var e,t,n=this;return U(this,function(r){switch(r.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(n,void 0,void 0,function(){var n;return U(this,function(r){switch(r.label){case 0:n=void 0,r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}})];case 2:if((n=r.sent())?.error_code||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.bindWithProvider({provider_token:n.provider_token})];case 3:return r.sent(),[3,5];case 4:throw r.sent();case 5:return[2]}})})},[4,new Promise(function(e,r){wx.login({success:function(i){return H(n,void 0,void 0,function(){var n;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return n=a.sent(),r(n),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,r(t)}})})];case 1:return r.sent(),[2]}})})},n.prototype.signInWithUnionId=function(){return H(this,void 0,Promise,function(){var e=this;return U(this,function(t){switch(t.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise(function(t,n){var r=wx.getAccountInfoSync().miniProgram;wx.login({success:function(i){return H(e,void 0,void 0,function(){var e,a,o,s,c;return U(this,function(l){switch(l.label){case 0:e=r?.appId,l.label=1;case 1:return l.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:i.code,provider_id:e,provider_params:{provider_code_type:`union_id`,appid:r?.appId}})];case 2:return a=l.sent(),(o=a.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:o})]:(n(a),[2]);case 3:return(s=l.sent())?.error_code?(n(s),[2]):(t(!0),[3,5]);case 4:return c=l.sent(),n(c),[3,5];case 5:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}})})},n.prototype.signInWithSms=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.phoneNum,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:c,username:o,loginType:`sms`})]}catch(e){throw e}})})},n.prototype.signInWithEmail=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.bindInfo,o=a===void 0?void 0:a,s=e.email,c=s===void 0?``:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:o,username:c,loginType:`email`})]}catch(e){throw e}})})},n.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},n.prototype.signIn=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.setPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.setPassword(e)]})})},n.prototype.isUsernameRegistered=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}})})},n.prototype.hasLoginState=function(){if(this.cache.mode!==`async`)return this.oauthInstance?.authApi.hasLoginStateSync()?new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getLoginState instead`)},n.prototype.getLoginState=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:e=null,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.oauthInstance.authApi.getLoginState()];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,null];case 4:return e?[2,new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}})})},n.prototype.getUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.getCurrentUser()]})})},n.prototype.getWedaUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]})})},n.prototype.updateUserBasicInfo=function(e){return H(this,void 0,void 0,function(){var t;return U(this,function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return(t=n.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},n.prototype.getAuthHeader=function(){return console.error(`Auth.getAuthHeader API 已废弃`),{}},n.prototype.bindWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]})})},n.prototype.queryUser=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]})})},n.prototype.getAccessToken=function(){return H(this,void 0,Promise,function(){return U(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}})})},n.prototype.grantProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]})})},n.prototype.patchProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]})})},n.prototype.signInWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.signInWithWechat=function(e){return e===void 0&&(e={}),H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.grantToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}})})},n.prototype.genProviderRedirectUri=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]})})},n.prototype.resetPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]})})},n.prototype.deviceAuthorize=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]})})},n.prototype.sudo=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.sudo(e)]})})},n.prototype.deleteMe=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]})})},n.prototype.getProviders=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviders()]})})},n.prototype.loginScope=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginScope()]})})},n.prototype.loginGroups=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginGroups()]})})},n.prototype.onLoginStateChanged=function(e){var t;return H(this,void 0,void 0,function(){var n,r=this;return U(this,function(i){switch(i.label){case 0:return(t=this.config.eventBus)==null||t.on(_,function(t){return H(r,void 0,void 0,function(){var n,r;return U(this,function(i){switch(i.label){case 0:return t?.data?.eventType===u?[3,2]:[4,this.getLoginState()];case 1:return r=i.sent(),[3,3];case 2:r={},i.label=3;case 3:return n=r,e.call(this,B(B({},t),n)),[2]}})})}),[4,this.getLoginState()];case 1:return n=i.sent(),e.call(this,n),[2]}})})},n.prototype.refreshTokenForce=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]})})},n.prototype.getCredentials=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getCredentials()]})})},n.prototype.setCredentials=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}})})},n.prototype.getProviderSubType=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]})})},n.prototype.createCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]})})},n.prototype.verifyCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]})})},n.prototype.getMiniProgramQrCode=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]})})},n.prototype.getMiniProgramQrCodeStatus=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]})})},n.prototype.modifyPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]})})},n.prototype.modifyPasswordWithoutLogin=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPasswordWithoutLogin(e)]})})},n.prototype.getUserBehaviorLog=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]})})},n.prototype.signInWithUsername=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.username,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s,l=e.loginType,u=l===void 0?``:l;return H(this,void 0,Promise,function(){var e,t,r,a,s,l,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:n.verification_id,verification_code:i})];case 1:if((e=f.sent())?.error_code)throw e;return t=e.verification_token,r=this.formatPhone(o),a={phone_number:r},u===`email`&&(a={email:r=o}),n.is_user?[4,this.oauthInstance.authApi.signIn({username:r,verification_token:t})]:[3,5];case 2:if((s=f.sent())?.error_code)throw s;return c?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:c?.providerToken})]:[3,4];case 3:if((l=f.sent())?.error_code)throw l;f.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp(B(B({},a),{verification_token:t,provider_token:c?.providerId}))];case 6:if((d=f.sent())?.error_code)throw d;f.label=7;case 7:return[2,this.createLoginState()];case 8:throw f.sent();case 9:return[2]}})})},n.prototype.createLoginState=function(e,t){return H(this,void 0,Promise,function(){var n;return U(this,function(r){switch(r.label){case 0:return[4,(n=new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return r.sent(),t?.userInfo?(n.user.setLocalUserInfo(t.userInfo),[3,5]):[3,2];case 2:return t?.asyncRefreshUser?(n.user.refresh(e),[3,5]):[3,3];case 3:return[4,n.user.refresh(e)];case 4:r.sent(),r.label=5;case 5:return[2,n]}})})},n.prototype.setAccessKey=function(){var e,t;return H(this,void 0,void 0,function(){var n,r;return U(this,function(i){if(n=``,r=``,this.config.accessKey?(n=this.config.accessKey,r=`accessKey`):(e=this.config.auth)!=null&&e.secretId&&(t=this.config.auth)!=null&&t.secretKey&&(n=``,r=S),!r)return[2];try{this.oauthInstance.oauth2client.setAccessKeyCredentials({access_token:n,token_type:`Bearer`,scope:r,expires_at:new Date(+new Date+ +new Date),expires_in:+new Date+ +new Date})}catch(e){console.warn(`accessKey error: `,e)}return[2]})})},n.prototype.formatPhone=function(e){return!/\s+/.test(e)&&/^\+\d{1,3}\d+/.test(e)?e.replace(/^(\+\d{1,2})(\d+)$/,`$1 $2`):/^\+\d{1,3}\s+/.test(e)?e:`+86 ${e}`},n.prototype.notifyListeners=function(e,t,n){this.listeners.forEach(function(r){r.forEach(function(r){try{r(e,t,n)}catch(e){console.error(`Error in auth state change callback:`,e)}})})},n.prototype.setupListeners=function(){var e,t=this;(e=this.config.eventBus)==null||e.on(v,function(e){return H(t,void 0,void 0,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return t=e?.data?.event,n=e?.data?.info,t!==f||n?[3,2]:[4,this.getUser(!0)];case 1:r=o.sent().data,(i=(r===void 0?{}:r).user)&&(n={user:i}),o.label=2;case 2:return[4,this.getSession()];case 3:return a=o.sent().data.session,this.notifyListeners(t,a,n),[2]}})})})},n.prototype.convertToUser=function(e){var t;if(!e)return null;var n=e?.email||``,r=e?.phone_number||``,i=e?.sub||e?.uid||``;return{id:i,aud:`authenticated`,role:((t=e.groups)?.map)?.call(t,function(e){return typeof e==`string`?e:e.id}),email:n||``,email_confirmed_at:(e?.email_verified,e.created_at),phone:r,phone_confirmed_at:r?e.created_at:void 0,confirmed_at:e.created_at,last_sign_in_at:e.last_sign_in_at,app_metadata:{provider:e.loginType?.toLowerCase()||`cloudbase`,providers:[e.loginType?.toLowerCase()||`cloudbase`]},user_metadata:{name:e?.name,picture:e?.picture,username:e?.username,gender:e?.gender,locale:e?.locale,uid:e.uid,nickName:e.nickName||e?.name,avatarUrl:e.avatarUrl||e.picture,location:e.location,hasPassword:e.hasPassword??e.password===`SET`,open_id:e?.open_id},identities:(e?.providers)?.map(function(t){return{id:t.id||``,identity_id:t.id||``,user_id:i,identity_data:{provider_id:t.id,provider_user_id:t.provider_user_id,name:t.name},provider:t.id||`cloudbase`,created_at:e.created_at,updated_at:e.updated_at,last_sign_in_at:e.last_sign_in_at}})||[],created_at:e.created_at,updated_at:e.updated_at,is_anonymous:e.name===`anonymous`}},n.prototype.missingRequiredParam=function(e,t){return new I({error:`missing_required_param`,error_code:4e3,error_description:`auth.${e}(params): missing required param '${t}'`},{method:e})},n.prototype.validateParams=function(e,t,n){for(var r=0,i=Object.entries(t);r<i.length;r++){var a=i[r],o=a[0];if(a[1].required&&(e?.[o]===void 0||e?.[o]===null||e?.[o]===``))throw this.missingRequiredParam(n,o)}},n.prototype.validateAtLeastOne=function(e,t,n){if(!t.some(function(t){return t.some(function(t){return e?.[t]!==void 0&&e?.[t]!==null&&e?.[t]!==``})}))throw this.missingRequiredParam(n,t.map(function(e){return e.join(`|`)}).join(`|`))},n.prototype.init=function(){var e;return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return t.sent()&&!this.oauthInstance.oauth2client.initSessionEmitted&&((e=this.config.eventBus)==null||e.fire(v,{event:p})),[3,3];case 2:return t.sent(),[3,3];case 3:return[2,{error:null}]}})})},Tt([(0,ot.catchErrorsDecorator)({title:`绑定手机号失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确`,` 2 - 当前环境是否开通了短信验证码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(r=e.BindPhoneRequest)==`function`?r:Object]),V(`design:returntype`,Promise)],n.prototype,`bindPhoneNumber`,null),Tt([(0,ot.catchErrorsDecorator)({title:`解除三方绑定失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().unbindProvider() 的语法或参数是否正确`,` 2 - 当前账户是否已经与此登录方式解绑`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(i=e.UnbindProviderRequest)==`function`?i:Object]),V(`design:returntype`,typeof(a=typeof Promise<`u`&&Promise)==`function`?a:Object)],n.prototype,`unbindProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定邮箱地址失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindEmail() 的语法或参数是否正确`,` 2 - 当前环境是否开通了邮箱密码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(o=e.BindEmailRequest)==`function`?o:Object]),V(`design:returntype`,void 0)],n.prototype,`bindEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`验证码验证失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().verify() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(s=e.VerifyRequest)==`function`?s:Object]),V(`design:returntype`,typeof(l=typeof Promise<`u`&&Promise)==`function`?l:Object)],n.prototype,`verify`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取验证码失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getVerification() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(d=e.GetVerificationRequest)==`function`?d:Object,Object]),V(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],n.prototype,`getVerification`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(g=typeof Promise<`u`&&Promise)==`function`?g:Object)],n.prototype,`getCurrentUser`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序匿名登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了匿名登录`,` 2 - 调用 auth().signInAnonymouslyInWx() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(b=typeof Promise<`u`&&Promise)==`function`?b:Object)],n.prototype,`signInAnonymouslyInWx`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序绑定OpenID失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序openId静默登录`,` 2 - 调用 auth().bindOpenId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(C=typeof Promise<`u`&&Promise)==`function`?C:Object)],n.prototype,`bindOpenId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序unionId静默登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序unionId静默登录`,` 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(w=typeof Promise<`u`&&Promise)==`function`?w:Object)],n.prototype,`signInWithUnionId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`短信验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序短信验证码登陆`,` 2 - 调用 auth().signInWithSms() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(T=typeof Promise<`u`&&Promise)==`function`?T:Object)],n.prototype,`signInWithSms`,null),Tt([(0,ot.catchErrorsDecorator)({title:`邮箱验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了邮箱登陆`,` 2 - 调用 auth().signInWithEmail() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(E=typeof Promise<`u`&&Promise)==`function`?E:Object)],n.prototype,`signInWithEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户是否被占用失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String]),V(`design:returntype`,typeof(D=typeof Promise<`u`&&Promise)==`function`?D:Object)],n.prototype,`isUsernameRegistered`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取本地登录态失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getLoginState() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(ee=typeof Promise<`u`&&Promise)==`function`?ee:Object)],n.prototype,`getLoginState`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(te=typeof Promise<`u`&&Promise)==`function`?te:Object)],n.prototype,`getUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取微搭插件用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(O=typeof Promise<`u`&&Promise)==`function`?O:Object)],n.prototype,`getWedaUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定第三方登录方式失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确`,` 2 - 此账户是否已经绑定此第三方`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(A=e.BindWithProviderRequest)==`function`?A:Object]),V(`design:returntype`,typeof(ne=typeof Promise<`u`&&Promise)==`function`?ne:Object)],n.prototype,`bindWithProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取身份源类型`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(re=typeof Promise<`u`&&Promise)==`function`?re:Object)],n.prototype,`getProviderSubType`,null),n}(Ct),Ft=`auth`;function It(e,t){for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var i=0;i<=t.length;i++)n[0][i]=i;for(r=1;r<=e.length;r++)for(i=1;i<=t.length;i++){var a=e[r-1].toLowerCase()===t[i-1].toLowerCase()?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+a)}return n[e.length][t.length]}var Lt={name:`auth`,namespace:Ft,entity:function(e){var t=function(e){var t=this;if(this.authInstance&&!e)return this.authInstance;e||={region:``,persistence:`local`,apiPath:s};var n=this.platform.adapter,r=e.persistence||n.primaryStorage;r&&r!==this.config.persistence&&this.updateConfig({persistence:r});var i=function(e,t){var n=this,r=e.region,i=r===void 0?`ap-shanghai`:r,a=e.i18n,o=e.accessKey,c=e.useWxCloud,l=t?.platform||lt.useDefaultAdapter.bind(t)(),u=l.runtime,d=l.adapter,p=t||{},m=p.env,h=p.clientId,_=p.debug,b=p.cache,S=p.app,C=p.getApiOrigin,w=(t||{}).apiOrigin;w||=`https://${m}.${i}.tcb-api.tencentcloudapi.com`;var T={env:m,clientId:h,i18n:a,accessKey:o,useWxCloud:c,eventBus:new Fe.CloudbaseEventEmitter},E=new at(gt(B(B({},T),{apiOrigin:w,getApiOrigin:C,apiPath:e?.apiPath||s,storage:e?.storage,baseRequest:e?.baseRequest,request:e?.request,anonymousSignInFunc:e?.anonymousSignInFunc,captchaOptions:e?.captchaOptions,wxCloud:e?.wxCloud,adapter:d,onCredentialsError:Dt(T.eventBus),headers:B({"X-SDK-Version":`@cloudbase/js-sdk/${e.sdkVersion}`},e.headers||{}),detectSessionInUrl:e.detectSessionInUrl,debug:_,auth:t.app?.config?.auth}))),D=new Pt(B(B({},T),{region:i,persistence:e.persistence,debug:_,cache:b||new st.CloudbaseCache({persistence:e.persistence,keys:{userInfoKey:`user_info_${m}`},platformInfo:l}),runtime:u||`web`,_fromApp:S,oauthInstance:E,auth:t.app?.config?.auth}));return E.initializeSession(function(e,t){return H(n,void 0,void 0,function(){return U(this,function(n){return e&&(e.type===y?t?T.eventBus.fire(v,{event:f,info:B(B({},e),{error:t})}):e.user&&D.createLoginState({},{userInfo:e.user}):e.type===x&&T.eventBus.fire(v,{event:g,info:B(B({},e),{error:t})})),[2]})})}),{authInstance:D,oauthInstance:E}}(B(B({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence,i18n:this.config.i18n,accessKey:this.config.accessKey,useWxCloud:this.config.useWxCloud,sdkVersion:this.version,detectSessionInUrl:this.config.auth?.detectSessionInUrl}),{env:this.config.env,clientId:this.config.clientId,getApiOrigin:function(){return t.request.getBaseEndPoint(t.config.endPointMode||`CLOUD_API`)},platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),a=i.authInstance,o=i.oauthInstance;return this.oauthInstance=o,this.authInstance=a,this.authInstance},n=t.call(this,e);Object.assign(t,n),Object.setPrototypeOf(t,Object.getPrototypeOf(n));var r=typeof Proxy<`u`?new Proxy(t,{get:function(e,t,n){var r=Reflect.get(e,t,n);if(r!==void 0||typeof t!=`string`)return r;var i=function(e,t){for(var n=null,r=1/0,i=0,a=t;i<a.length;i++){var o=a[i];if(!o.startsWith(`_`)&&o!==`constructor`){var s=It(e,o);s<r&&(r=s,n=o)}}return n}(t,Object.getOwnPropertyNames(Object.getPrototypeOf(e)).concat(Object.keys(e)).filter(function(t){return typeof e[t]==`function`}));return i&&console.warn(`[CloudBase Auth] auth.${t} is not a function. Did you mean: auth.${i}() ?`),r}}):t;return this[Ft]=r,r}};try{cloudbase.registerComponent(Lt)}catch{}var Rt=function(e){try{e.registerComponent(Lt)}catch(e){console.warn(e)}};try{window.registerAuth=Rt}catch{}})(),ao.W;var oo={388:e=>{e.exports={}}},so={};function co(e){var t=so[e];if(t!==void 0)return t.exports;var n=so[e]={exports:{}};return oo[e](n,n.exports,co),n.exports}co.d=(e,t)=>{for(var n in t)co.o(t,n)&&!co.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},co.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var lo={};(()=>{co.d(lo,{r:()=>ge});var e=co(388);function t(){return`@cloudbase/js-sdk`}var n={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let r=(i={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},a={},co.d(a,i),a);var i,a,o,s=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}o(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function l(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var u=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return s(t,e),t}(Error),d=function(e){return new u(e)};function m(e,t){return(t||d)(e)}function h(e){return!e||typeof e.throw!=`boolean`||e.throw}var g,_=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},v.apply(this,arguments)},y=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},x=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}_(t,e),t.prototype.get=function(e){return this.request(v(v({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(v(v({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(v(v({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(v(v({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(v(v({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return y(this,void 0,Promise,function(){var t,n,r,i;return x(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(v(v({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.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 a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return y(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return x(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,v(v({},e),{signal:t.signal})).then(function(e){return y(m,void 0,void 0,function(){var t,n,r;return x(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(r.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(g||={});var S=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},w=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},T=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return S(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(r.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,i=r===void 0?{}:r,a=e.keys,o=a===void 0?{}:a;this.platformInfo=i,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(l(n.INVALID_PARAMS,`localStorage is not supported on current platform`),new T(t.root));case`none`:return new T(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if(this.mode!==`async`){if(this.storage)try{var i={version:r||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(i))}catch(e){throw Error(JSON.stringify({code:n.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${n.OPERATION_FAIL}]setStore failed`,info:e}))}}else l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return C(this,void 0,void 0,function(){var r;return w(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:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var r=this.storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:``}l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return C(this,void 0,void 0,function(){var n;return w(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return C(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var E=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),D=function(e,t){this.data=t||null,this.name=e},ee=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return E(t,e),t}(D),te=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof ee)return console.error(e.error),this;var n=typeof e==`string`?new D(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new te,new te,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return co.d(t,e),t})({default:()=>b}).default;var O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},O.apply(this,arguments)},k=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},A=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ne=n,re=`cloudrun`;function ie(e,t){return k(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return A(this,function(_){switch(_.label){case 0:if(n=e.name,r=e.data,i=e.path,a=i===void 0?``:i,o=e.method,s=e.header,c=s===void 0?{}:s,l=this.getEndPointWithKey(`GATEWAY`),u=l.BASE_URL,d=l.PROTOCOL,f=`${d}${u}/cloudrun/${n}`,p=a.startsWith(`/`)?a:`/${a}`,m=[`GET`,`HEAD`].includes((o?.toUpperCase)?.call(o)))try{h={};try{h=JSON.parse(r)}catch{h=r||{}}p=`${p}${p.includes(`?`)?`&`:`?`}${Object.keys(h).map(function(e){return`${e}=${h[e]}`}).join(`&`)}`}catch{}return[4,this.request.fetch(O(O({method:o||`POST`,headers:Object.assign({},{"Content-Type":`application/json; charset=utf-8`},c)},m?{}:{body:r}),{url:`${f}${p}`,customReqOpts:t}))];case 1:return g=_.sent(),t?.from===`node-sdk`?[2,g]:[4,g.data];case 2:return[2,_.sent()]}})})}var ae={name:re,entity:{callContainer:new(function(){function e(){}return e.prototype.callContainer=function(e,t){return k(this,void 0,void 0,function(){var n,r,i;return A(this,function(a){switch(a.label){case 0:if(n=e.name,r=e.data,!n)throw Error(JSON.stringify({code:ne.INVALID_PARAMS,msg:`[${re}.callContainer] invalid name`}));try{i=r?JSON.stringify(r):``}catch{throw Error(JSON.stringify({code:ne.INVALID_PARAMS,msg:`[${re}.callContainer] invalid data`}))}return[4,ie.call(this,O(O({},e),{data:i}),t)];case 1:return[2,a.sent()]}})})},e}())().callContainer}};try{cloudbase.registerComponent(ae)}catch{}try{window.registerCloudrun=function(e){try{e.registerComponent(ae)}catch(e){console.warn(e)}}}catch{}var oe=function(){return oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},oe.apply(this,arguments)},se=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},ce=t,le=n,ue=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},de=m,fe=h,pe=function(e,t){if(h(e))throw m(t,e?.errorFactory);return c({code:t.code,message:t.msg},t.requestId?{requestId:t.requestId}:{})},me=`functions`,he={name:me,entity:{callFunction:new(function(){function t(){}var n,r,i,a;return t.prototype.callFunction=function(e,t,n){var r=this,i=void 0,a,o=function(){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(D){switch(D.label){case 0:if(r=e.name,i=e.data,a=e.query,o=e.parse,s=e.search,c=e.type,l=e.path,u=l===void 0?``:l,d=e.method,f=e.header,p=f===void 0?{}:f,h=(m=this).request,g=m.config,!r)return[2,pe(g,{code:le.INVALID_PARAMS,msg:`[${me}.callFunction] invalid function name`})];try{_=i?JSON.stringify(i):``}catch{return[2,pe(g,{code:le.INVALID_PARAMS,msg:`[${me}.callFunction] invalid data`})]}return c===`cloudrun`?(te=new Date().getTime(),O=(Date==null?void 0:Date.now)&&1e3*Date.now()||0,v=`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random();return te>0?(t=(te+t)%16|0,te=Math.floor(te/16)):(t=(O+t)%16|0,O=Math.floor(O/16)),(e===`x`?t:7&t|8).toString(16)}),[4,ie.call(this,{name:r,data:_,path:u,method:d,header:oe(oe({},p),{"X-Request-Id":v})})]):[3,2];case 1:return[2,{result:T=D.sent(),requestId:v}];case 2:y=`functions.invokeFunction`,b={inQuery:a,parse:o,search:s,function_name:r,request_data:_},x={},S=!(g.endPointMode!==`GATEWAY`||(ee=r,ee===`lcap-common-service`||ee===`lcap-datasource-test`||ee.startsWith(`lcap-data`)||ee.startsWith(`lowcode-datasource`)||ee===`cloudbase_module`)||function(e){return e===`lowcode-wx-datasource`}(r)),D.label=3;case 3:return D.trys.push([3,8,,9]),S?[4,h.gateWay(oe(oe({},e),{path:`functions`}),n)]:[3,5];case 4:return C=D.sent(),x=oe({requestId:C.requestId},C.data?.code?C.data:{data:{response_data:C.data}}),[3,7];case 5:return[4,h.send(y,b,{endPointMode:`CLOUD_API`,defaultQuery:i?.params?.action?{action:i?.params?.action}:{}},n)];case 6:x=D.sent(),D.label=7;case 7:if(x.code){if(w=x.message||x.msg||``,function(e){return fe(e)}(g))throw de({code:x.code,msg:w,requestId:x.requestId},g?.errorFactory);return[2,ue(t,null,{code:x.code,message:w,requestId:x.requestId})]}if(T=x.data.response_data,o||S)return[2,ue(t,null,{result:T,requestId:x.requestId})];try{return T=JSON.parse(x.data.response_data),[2,ue(t,null,{result:T,requestId:x.requestId})]}catch{ue(t,Error(`[${ce()}][${le.INVALID_PARAMS}][${me}.callFunction] response data must be json`))}return[3,9];case 8:return E=D.sent(),ue(t,E),[3,9];case 9:return[2]}var ee,te,O})};return new((a=void 0)||(a=Promise))(function(e,t){function n(e){try{c(o.next(e))}catch(e){t(e)}}function s(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(n,s)}c((o=o.apply(r,i||[])).next())})},function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);a>3&&o&&Object.defineProperty(t,n,o)}([(a={customInfo:{className:`Cloudbase`,methodName:`callFunction`},title:`函数调用失败`,messages:[`请确认以下各项:`,` 1 - 调用 callFunction() 的语法或参数是否正确`,` 2 - 当前环境下是否存在此函数`,` 3 - 函数安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:https://support.qq.com/products/148793`]},a.mode,a.customInfo,a.title,a.messages,function(e,t,n){}),se(`design:type`,Function),se(`design:paramtypes`,[typeof(n=e.ICallFunctionOptions!==void 0&&e.ICallFunctionOptions)==`function`?n:Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object,typeof(i=e.ICustomReqOpts!==void 0&&e.ICustomReqOpts)==`function`?i:Object]),se(`design:returntype`,Promise)],t.prototype,`callFunction`,null),t}())().callFunction}};try{cloudbase.registerComponent(he)}catch{}var ge=function(e){try{e.registerComponent(he)}catch(e){console.warn(e)}};try{window.registerFunctions=ge}catch{}})(),lo.r;var uo={388:e=>{e.exports={}}},fo={};function po(e){var t=fo[e];if(t!==void 0)return t.exports;var n=fo[e]={exports:{}};return uo[e](n,n.exports,po),n.exports}po.d=(e,t)=>{for(var n in t)po.o(t,n)&&!po.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},po.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var mo={};(()=>{po.d(mo,{v:()=>ot});var e,t=(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}),n=function(e){function n(t){var n=e.call(this,t)||this;return n.__isStorageError=!0,n.name=`StorageError`,n}return t(n,e),n}(Error);function r(e){return typeof e==`object`&&!!e&&`__isStorageError`in e}var i,a=function(e){function n(t,n,r){var i=e.call(this,t)||this;return i.name=`StorageApiError`,i.status=n,i.statusCode=r,i}return t(n,e),n.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},n}(n);function o(){return globalThis.Buffer}function s(e){var t=o();return t?t.from(e).toString(`base64`):btoa(e)}function c(e){return e.split(`/`).map(function(e){return encodeURIComponent(e)}).join(`/`)}t(function(e,t){var n=i.call(this,e)||this;return n.name=`StorageUnknownError`,n.originalError=t,n},i=n);var l=function(){return l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)},u=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},d=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},m=`/v1/storages`;function h(e,t){return u(this,void 0,Promise,function(){var i;return d(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e()];case 1:return[2,{data:a.sent(),error:null}];case 2:if(i=a.sent(),t)throw i;return r(i)?[2,{data:null,error:i}]:[2,{data:null,error:new n(i?.message||String(i))}];case 3:return[2]}})})}var g=function(){function e(e){this.ctx=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.ctx.request},enumerable:!1,configurable:!0}),e.prototype.gatewayOrigin=function(){return this.request.getBaseEndPoint(`GATEWAY`)},e.prototype.buildUrl=function(e,t){var n=`${this.gatewayOrigin()}${m}${e}`,r=function(e){if(!e)return``;var t=[];return Object.keys(e).forEach(function(n){var r=e[n];r!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`)}),t.join(`&`)}(t);return r&&(n+=(n.includes(`?`)?`&`:`?`)+r),n},e.prototype.toFullUrl=function(e){return e&&(/^https?:\/\//.test(e)||e.startsWith(`//`)?e:`${this.gatewayOrigin()}${m}${e.startsWith(`/`)?``:`/`}${e}`)},e.prototype.send=function(e){return u(this,void 0,Promise,function(){var t,n,r,i,a,o;return d(this,function(s){switch(s.label){case 0:return t=this.buildUrl(e.path,e.query),n=e.method.toUpperCase(),r=[`GET`,`HEAD`].includes(n),i=l({},e.headers||{}),r||(e.rawBody===void 0?e.json!==void 0&&(i[`Content-Type`]=i[`Content-Type`]||`application/json`,a=JSON.stringify(e.json)):a=e.rawBody),[4,this.request.fetch(l(l(l(l({url:t,method:n,headers:i},a===void 0?{}:{body:a}),{withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1}),e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:return o=s.sent(),[2,this.unwrap(o,t)]}})})},e.prototype.download=function(e){return u(this,void 0,Promise,function(){var t,n,r,i;return d(this,function(o){switch(o.label){case 0:return t=this.buildUrl(e.path,e.query),[4,this.request.fetch(l(l({url:t,method:`GET`,headers:l({},e.headers||{}),stream:!0,withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1},e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:if(n=o.sent(),e.signal?.aborted)throw new a(`The download was aborted`,0,`STORAGE_PG_ABORTED`);if((r=Number(n?.statusCode??200))===304)throw new a(`Not Modified`,r,`STORAGE_PG_NOT_MODIFIED`);if(r>=400)throw new a(`Download failed with status ${r}`,r,`STORAGE_PG_REQUEST_FAIL`);if(!(i=n?.response))throw new a(`Underlying adapter did not expose the raw Response`,r,`STORAGE_PG_NO_RESPONSE`);return[2,{response:i,status:r,header:n?.header}]}})})},e.prototype.unwrap=function(e,t){return u(this,void 0,Promise,function(){var n,r,i,o;return d(this,function(s){switch(s.label){case 0:n=Number(e?.statusCode??e?.status??200),r=e?.data,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r];case 2:return r=s.sent(),[3,4];case 3:return s.sent(),r=void 0,[3,4];case 4:if(n>=200&&n<300)return[2,r];throw i=r?.code||r?.error||`STORAGE_PG_REQUEST_FAIL`,o=r?.message||`Storage request failed with status ${n}: ${t}`,new a(o,n,i)}})})},e}(),_=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_.apply(this,arguments)},v=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},y=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function x(e){return r(e)?e:new n(e?.message||String(e))}function S(e){var t={};return e?.download!==void 0&&(t.download=!0===e.download?``:e.download),e?.cacheNonce!==void 0&&(t.cacheNonce=String(e.cacheNonce)),{headers:{},query:t}}var C=function(){function e(e){this.ctx=e}return e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:if(!(r=o.sent().response).body)throw new a(`Response body is empty`,r.status,`STORAGE_PG_EMPTY_BODY`);return[2,{data:r.body,error:null}];case 2:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 3:return[2]}})})},e}(),w=function(){function e(e){this.ctx=e}return e.prototype.asStream=function(){return new C(this.ctx)},e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i,a;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:return r=o.sent().response,a={},[4,r.blob()];case 2:return[2,(a.data=o.sent(),a.error=null,a)];case 3:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 4:return[2]}})})},e}(),T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},T.apply(this,arguments)},E=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},D=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ee=`3600`,te=function(){function e(e,t,n){n===void 0&&(n=!1),this.headers={},this.http=e,this.bucketId=t,this.shouldThrowOnError=n}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.setHeader=function(e,t){var r;if(typeof e!=`string`||e.trim()===``)throw new n(`setHeader requires a non-empty header name`);if(/[\r\n]/.test(e)||typeof t==`string`&&/[\r\n]/.test(t))throw new n(`setHeader does not allow CR/LF characters in header name or value`);return this.headers=T(T({},this.headers),((r={})[e]=String(t),r)),this},e.prototype.upload=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`POST`,e,t,n)]})})},e.prototype.update=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`PUT`,e,t,n)]})})},e.prototype.download=function(e,t,n){return new w({http:this.http,bucketId:this.bucketId,cleanName:this.cleanPath(e),options:t,parameters:n,headers:this.headers,shouldThrowOnError:this.shouldThrowOnError})},e.prototype.list=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){return r={prefix:e||``},t?.limit!==void 0&&(r.limit=t.limit),t?.cursor!==void 0&&(r.cursor=t.cursor),t?.withDelimiter!==void 0&&(r.with_delimiter=t.withDelimiter),t?.sortBy!==void 0&&(r.sortBy=t.sortBy),[2,this.send({method:`POST`,path:`/object/list/${this.bucketId}`,json:r,signal:n?.signal,cache:n?.cache})]})})},this.shouldThrowOnError)]})})},e.prototype.remove=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n,r,i,a,o=this;return D(this,function(s){switch(s.label){case 0:t=e.map(function(e){return o.cleanPath(e)}),n=[],r=0,s.label=1;case 1:return r<t.length?(i=t.slice(r,r+100),[4,this.send({method:`DELETE`,path:`/object/${this.bucketId}`,json:{prefixes:i}})]):[3,4];case 2:a=s.sent(),Array.isArray(a)&&n.push.apply(n,a),s.label=3;case 3:return r+=100,[3,1];case 4:return[2,n]}})})},this.shouldThrowOnError)]})})},e.prototype.copy=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){switch(i.label){case 0:return r=this.buildCopyMoveHeaders(n),[4,this.send({method:`POST`,path:`/object/copy`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket,copyMetadata:n?.copyMetadata,metadata:n?.metadata},headers:r})];case 1:return[2,{path:i.sent().Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.move=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){return D(this,function(r){switch(r.label){case 0:return[4,this.send({method:`POST`,path:`/object/move`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket}})];case 1:return[2,{message:r.sent().message||`Successfully moved`}]}})})},this.shouldThrowOnError)]})})},e.prototype.info=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n;return D(this,function(r){switch(r.label){case 0:return t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return[2,{id:(n=r.sent()).id,name:n.name,version:n.version,bucketId:n.bucket_id,size:n.size,contentType:n.content_type,cacheControl:n.cache_control,etag:n.etag,metadata:n.metadata,lastModified:n.last_modified,createdAt:n.created_at}]}})})},this.shouldThrowOnError)]})})},e.prototype.exists=function(e){return E(this,void 0,Promise,function(){var t,r,i;return D(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return a.sent(),[2,{data:!0,error:null}];case 2:if(r=a.sent(),(i=r?.status)!==void 0&&[400,404].includes(Number(i)))return[2,{data:!1,error:null}];if(this.shouldThrowOnError)throw r;return[2,{data:null,error:r instanceof n?r:new n(r?.message||String(r))}];case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a;return D(this,function(o){switch(o.label){case 0:return r=this.cleanPath(e),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}/${this.encodePath(r)}`,json:{expiresIn:t}})];case 1:return i=o.sent(),a=i.fullSignedURL||this.http.toFullUrl(i.signedURL||``),[2,{fullSignedURL:this.appendUrlOptions(a,n)}]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUrls=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a,o,s=this;return D(this,function(c){switch(c.label){case 0:r=e.map(function(e){return s.cleanPath(e)}),i=[],a=0,c.label=1;case 1:return a<r.length?(o=r.slice(a,a+500),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}`,json:{expiresIn:t,paths:o}})]):[3,4];case 2:c.sent().forEach(function(e){var t=e.fullSignedURL||(e.signedURL?s.http.toFullUrl(e.signedURL):null);i.push({path:e.path,fullSignedURL:t?s.appendUrlOptions(t,n):null,error:e.error??null})}),c.label=3;case 3:return a+=500,[3,1];case 4:return[2,i]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUploadUrl=function(e,t){return E(this,void 0,Promise,function(){var n=this;return D(this,function(r){return[2,h(function(){return E(n,void 0,void 0,function(){var n,r,i;return D(this,function(a){switch(a.label){case 0:return n=this.cleanPath(e),r={},t!=null&&t.upsert&&(r[`x-upsert`]=`true`),[4,this.send({method:`POST`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(n)}`,headers:r})];case 1:return[2,{fullSignedURL:(i=a.sent()).fullURL||this.http.toFullUrl(i.url||``),path:n,token:i.token}]}})})},this.shouldThrowOnError)]})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(e),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,[4,this.send({method:`PUT`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(i)}`,query:{token:t},rawBody:o,headers:s,withCredentials:!1})];case 1:return c=l.sent(),[2,{path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.getPublicUrl=function(e,t){var n=this.cleanPath(e),r=this.http.buildUrl(`/object/public/${this.bucketId}/${this.encodePath(n)}`);return{data:{publicUrl:this.appendUrlOptions(r,t)}}},e.prototype.send=function(e){return this.http.send(T(T({},e),{headers:T(T({},this.headers),e.headers||{})}))},e.prototype.uploadOrUpdate=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(t),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,e===`POST`&&(s[`x-upsert`]=String(!!r?.upsert)),[4,this.send({method:e,path:`/object/${this.bucketId}/${this.encodePath(i)}`,rawBody:o,headers:s})];case 1:return[2,{id:(c=l.sent()).Id,path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.cleanPath=function(e){var t=e.replace(/^\/+|\/+$/g,``).replace(/\/+/g,`/`);if(t.split(`/`).some(function(e){return e===`..`}))throw new n(`invalid path: ".." segment is not allowed`);return t},e.prototype.encodePath=function(e){return c(e)},e.prototype.buildUploadBody=function(e,t){var n=T({},t?.headers||{}),r=e,i=typeof FormData<`u`&&e instanceof FormData;if(typeof Blob<`u`&&e instanceof Blob||i){var a=void 0,o={};if(i){var s=this.extractFromFormData(e);a=s.file,o=s.fields}else a=e;var c=t?.cacheControl??o.cacheControl??ee,l=t?.contentType??o.contentType,u=t?.metadata===void 0?o.metadata:JSON.stringify(t.metadata),d=new FormData;c!==void 0&&d.append(`cacheControl`,String(c)),l!==void 0&&d.append(`contentType`,l),u!==void 0&&d.append(`metadata`,u),d.append(``,a),r=d}else r=e,c=t?.cacheControl??ee,l=t?.contentType??`text/plain;charset=UTF-8`,n[`cache-control`]=`max-age=${c}`,l&&(n[`content-type`]=l),t!=null&&t.metadata&&(n[`x-metadata`]=this.toBase64(JSON.stringify(t.metadata)));return{body:r,headers:n}},e.prototype.extractFromFormData=function(e){var t,r={},i=0,a=[];if(e.forEach(function(e,n){if(typeof Blob<`u`&&e instanceof Blob)return t=e,void(i+=1);n!==`cacheControl`&&n!==`contentType`&&n!==`metadata`?a.push(n):r[n]=String(e)}),a.length>0&&console.warn(`Ignored unsupported FormData field(s): [${a.join(`, `)}]. Only file, cacheControl, contentType and metadata are supported`),i===0||!t)throw new n(`FormData must contain a file`);if(i>1)throw new n(`FormData must contain exactly one file`);return{file:t,fields:r}},e.prototype.buildCopyMoveHeaders=function(e){var t={};return e!=null&&e.upsert&&(t[`x-upsert`]=`true`),!1===e?.copyMetadata&&e!=null&&e.metadata&&(t[`x-metadata`]=this.toBase64(JSON.stringify(e.metadata))),t},e.prototype.appendUrlOptions=function(e,t){var n=[];if(t?.download!==void 0){var r=!0===t.download?``:String(t.download);n.push(`download=${encodeURIComponent(r)}`)}return t?.cacheNonce!==void 0&&n.push(`cacheNonce=${encodeURIComponent(String(t.cacheNonce))}`),n.length===0?e:`${e}${e.includes(`?`)?`&`:`?`}${n.join(`&`)}`},e.prototype.toBase64=function(e){return s(e)},e}(),O=/[\x00-\x20\x7f/\\?#%]/;function k(e,t){if(typeof e!=`string`||e.length===0)throw new n(`[storage.${t}] bucketId is required`);if(e.length>256)throw new n(`[storage.${t}] invalid bucketId: length must be 1-256`);var r=O.exec(e);if(r)throw new n(`[storage.${t}] invalid bucketId "${e}": contains forbidden character ${JSON.stringify(r[0])}; must not contain whitespace, control chars, "/", "\\", "?", "#" or "%"`)}var A=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ne=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},re=function(){function e(e,t){t===void 0&&(t=!1),this.http=new g(e),this.shouldThrowOnError=t}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.listBuckets=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){var n={};return e?.limit!==void 0&&(n.limit=e.limit),e?.offset!==void 0&&(n.offset=e.offset),e!=null&&e.sortColumn&&(n.sortColumn=e.sortColumn),e!=null&&e.sortOrder&&(n.sortOrder=e.sortOrder),e!=null&&e.search&&(n.search=e.search),t.http.send({method:`GET`,path:`/bucket/`,query:n})},this.shouldThrowOnError)]})})},e.prototype.getBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`getBucket`),t.http.send({method:`GET`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e.prototype.createBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){var r;return k(e,`createBucket`),n.http.send({method:`POST`,path:`/bucket/`,json:{id:e,name:e,public:(r=t?.public)!=null&&r,type:t?.type,file_size_limit:t?.fileSizeLimit,allowed_mime_types:t?.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.updateBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){return k(e,`updateBucket`),n.http.send({method:`PUT`,path:`/bucket/${e}`,json:{public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.deleteBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`deleteBucket`),t.http.send({method:`DELETE`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e}();function ie(){return`@cloudbase/js-sdk`}var ae={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let oe=(se={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},ce={},po.d(ce,se),ce);var se,ce,le=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ue=function(){return ue=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ue.apply(this,arguments)};function de(e){return typeof e==`string`}function fe(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var pe=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return le(t,e),t}(Error),me=function(e){return new pe(e)};function he(e,t){return(t||me)(e)}function ge(e){if(e&&typeof e==`object`&&e.data&&typeof e.data==`object`){var t=e.data,n=t.code,r=t.message;if(!e.code&&n||!e.message&&r)return ue(ue(ue({},e),!e.code&&n?{code:n}:{}),!e.message&&r?{message:r}:{})}return e}var _e,ve=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),j=function(){return j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},j.apply(this,arguments)},ye=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},be=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}ve(t,e),t.prototype.get=function(e){return this.request(j(j({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(j(j({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(j(j({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(j(j({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(j(j({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i;return be(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(j(j({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.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 a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return be(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,j(j({},e),{signal:t.signal})).then(function(e){return ye(m,void 0,void 0,function(){var t,n,r;return be(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(oe.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(_e||={});var xe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Se=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ce=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},we=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return xe(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(oe.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(fe(ae.INVALID_PARAMS,`localStorage is not supported on current platform`),new we(t.root));case`none`:return new we(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:ae.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${ae.OPERATION_FAIL}]setStore failed`,info:e}))}}else fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return Se(this,void 0,void 0,function(){var r;return Ce(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:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return Se(this,void 0,void 0,function(){var n;return Ce(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return Se(this,void 0,void 0,function(){return Ce(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var Te=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),M=function(e,t){this.data=t||null,this.name=e},Ee=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return Te(t,e),t}(M),N=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof Ee)return console.error(e.error),this;var n=de(e)?new M(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new N,new N,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return po.d(t,e),t})({default:()=>b}).default;var P,De=po(388),Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Oe.apply(this,arguments)},ke=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Ae=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},je=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Me=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){e.put=`put`,e.post=`post`})(P||={});var Ne=ie,Pe=ae,Fe=`https://support.qq.com/products/148793`,Ie=function(e){return Object.prototype.toString.call(e)===`[object Array]`},Le=de,Re=function(e){return Object.prototype.toString.call(e)===`[object Object]`},ze=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},Be=function(e,t){if(function(e){return!e||typeof e.throw!=`boolean`||e.throw}(e))throw he(t,e?.errorFactory);return ue({code:t.code,message:t.msg},t.requestId?{requestId:t.requestId}:{})},Ve=fe,He=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,n){}},Ue=`storage`;function We(e,t){return t&&typeof t!=`function`?[Oe(Oe({},e),{customReqOpts:t}),void 0]:[e,t]}var Ge=function(e,t,n){return je(void 0,void 0,void 0,function(){var r,i;return Me(this,function(a){switch(a.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-upload-info`,data:[Oe({objectId:t.path},t.signedHeader?{signedHeader:t.signedHeader}:{})]},n)];case 1:return r=ge(r=a.sent()),i=r.data?.[0]||{},[2,Oe(Oe({},r),{data:Oe(Oe({},i.code?Oe({},i):{}),{authorization:i.authorization,token:i.token,url:i.uploadUrl,fileId:i.cloudObjectId,cosFileId:i.cloudObjectMeta,download_url:i.downloadUrl})})]}})})},Ke=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-download-info`,data:t.convertedFileList.map(function(e){return{cloudObjectId:e.fileid}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{download_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,message:e.message,fileid:e.cloudObjectId,download_url:e.downloadUrl,fileID:e.cloudObjectId,tempFileURL:e.downloadUrl,mime_type:e.contentType||F(null,e.cloudObjectId||``)}}):[]}})]}})})},qe=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`delete-objects`,data:t.fileList.map(function(e){return{cloudObjectId:e}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{delete_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,message:e.message}}):[]}})]}})})},Je=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`copy-objects`,data:t.convertedFileList.map(function(e){return{srcPath:e.src_path,dstPath:e.dst_path,overwrite:e.overwrite,removeOriginal:e.remove_original}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{copy_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,fileId:e.cloudObjectId,message:e.message}}):[]}})]}})})},Ye={txt:`text/plain`,json:`application/json`,html:`text/html`,htm:`text/html`,css:`text/css`,js:`application/javascript`,csv:`text/csv`,xml:`application/xml`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,ico:`image/x-icon`,pdf:`application/pdf`,zip:`application/zip`,gz:`application/gzip`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`};function F(e,t){if(typeof Blob<`u`&&e instanceof Blob&&e.type)return e.type;var n=/\.([a-zA-Z0-9]+)$/.exec(t||``);return Ye[n?n[1].toLowerCase():``]||`application/octet-stream`}function Xe(e,t){var n=t.toLowerCase();return Object.keys(e).some(function(e){return e.toLowerCase()===n})}function Ze(e){return Object.keys(e).reduce(function(t,n){var r;return Oe(Oe({},t),((r={})[n]=[e[n]],r))},{})}var Qe=function(){function e(e){this.context=e}var t,n,r,i,a,s,c,l,u,d,f,p,m,h,g,_;return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.isGateWay=function(){return(this.config.endPointMode||`CLOUD_API`)===`GATEWAY`},e.prototype.uploadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,te,O,k,A,ne,re;return Me(this,function(ie){switch(ie.label){case 0:return k=We(e,t),e=k[0],t=k[1],n=e.cloudPath,r=e.filePath,i=e.onUploadProgress,A=e.method,a=A===void 0?`put`:A,ne=e.headers,s=ne===void 0?{}:ne,c=e.fileContent,Le(n)&&(r||c)?(l={put:P.put,post:P.post}[a.toLocaleLowerCase()]||P.put,u=this.isGateWay(),d=Oe({},s),f=Object.keys(s).reduce(function(e,t){return t.toLowerCase()!==`content-length`&&(e[t]=s[t]),e},{}),l===P.put&&u&&(Xe(d,`content-length`)||typeof(p=function(e,t){var n=e??t;if(n!==null){if(typeof Blob<`u`&&n instanceof Blob)return n.size;if(typeof ArrayBuffer<`u`&&(n instanceof ArrayBuffer||typeof ArrayBuffer.isView==`function`&&ArrayBuffer.isView(n)))return n.byteLength;if(typeof n==`string`){if(typeof Blob<`u`)return new Blob([n]).size;var r=(i=n,(a=o())?.byteLength(i));return typeof r==`number`?r:n.length}var i,a;return typeof n==`object`&&typeof n.size==`number`?n.size:void 0}}(r,c))==`number`&&(d[`content-length`]=String(p)),Xe(d,`content-type`)||(d[`content-type`]=F(r,n)),Xe(f,`content-type`)||(f[`content-type`]=F(r,n))),[4,this.getUploadMetadata({cloudPath:n,method:l,headers:l!==P.put||u?void 0:f,signedHeader:l===P.put&&u?Ze(d):void 0,customReqOpts:e.customReqOpts})]):[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.uploadFile] invalid params`})];case 1:return m=ie.sent(),h=m.data,g=m.requestId,(_=h)?.code||!_?.url?(v=_?.code||Pe.OPERATION_FAIL,y=_?.message||`get upload info failed`,[2,ze(t,Error(`[${Ne()}][${v}][${Ue}]:${y}`))]):(b=h.url,x=h.authorization,S=h.token,C=h.fileId,w=h.cosFileId,T=h.download_url,D=Oe(Oe({},E={url:b,file:r,name:n,onUploadProgress:i,fileContent:c,fileId:C,requestId:g}),{method:P.put,headers:Oe(Oe({},f),{authorization:x,"x-cos-meta-fileid":w,"x-cos-security-token":S})}),ee=Oe(Oe({},E),{method:P.post,data:{key:n,signature:x,"x-cos-meta-fileid":w,success_action_status:`201`,"x-cos-security-token":S}}),(re={})[P.put]={params:D,isSuccess:function(e){return e>=200&&e<300}},re[P.post]={params:ee,isSuccess:function(e){return e===201}},te=re,[4,this.request.upload(te[l].params)]);case 2:return O=ie.sent(),te[l].isSuccess(O.statusCode)?[2,ze(t,null,{fileID:C,download_url:T,requestId:g})]:[2,ze(t,Error(`[${Ne()}][${Pe.OPERATION_FAIL}][${Ue}]:${O.data}`))]}})})},e.prototype.getUploadMetadata=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(n=e.cloudPath,r=e.method,i=e.headers,a=e.signedHeader,!Le(n))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getUploadMetadata] invalid cloudPath`})];o=this.request,s=`storage.getUploadMetadata`,f.label=1;case 1:return f.trys.push([1,6,,7]),c=void 0,l={path:n},u=this.isGateWay(),r&&(l.method=r),r===P.put&&(u&&a?l.signedHeader=a:!u&&i&&(l.headers=i)),r!==P.post&&u?[3,3]:[4,o.send(s,l,{endPointMode:`CLOUD_API`},e.customReqOpts)];case 2:return c=f.sent(),[3,5];case 3:return[4,Ge(o,l,e.customReqOpts)];case 4:c=f.sent(),f.label=5;case 5:return[2,ze(t,null,c)];case 6:return d=f.sent(),[2,ze(t,d)];case 7:return[2]}})})},e.prototype.deleteFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u;return Me(this,function(d){switch(d.label){case 0:if(u=We(e,t),e=u[0],t=u[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.deleteFile] fileList must not be empty`})];for(r=0,i=n;r<i.length;r++)if(!(a=i[r])||!Le(a))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.deleteFile] fileID must be string`})];return o=`storage.batchDeleteFile`,s=this.request,c={},this.isGateWay()?[4,qe(s,{fileList:n},e.customReqOpts)]:[3,2];case 1:return c=d.sent(),[3,4];case 2:return[4,s.send(o,{fileid_list:n},e.customReqOpts)];case 3:c=d.sent(),d.label=4;case 4:return c.code?[2,ze(t,null,c)]:(l={fileList:c.data.delete_list,requestId:c.requestId},[2,ze(t,null,l)])}})})},e.prototype.getTempFileURL=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] fileList must not be empty`})];for(r=[],i=!1,a=0,o=n;a<o.length;a++)if(s=o[a],Re(s)){if(!Object.prototype.hasOwnProperty.call(s,`fileID`))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] file info must include fileID`})];!i&&Object.prototype.hasOwnProperty.call(s,`maxAge`)&&(Ve(Pe.INVALID_PARAMS,`[${Ue}.getTempFileURL] maxAge 仅为兼容字段,传统模式不会用它生成下载链接,TTL 传入无效。需要可控过期请改用 app.storage.from(bucketId).createSignedUrl(path, expiresIn)(PG 模式下可用)。`),i=!0),r.push({fileid:s.fileID,max_age:s.maxAge||7200})}else{if(!Le(s))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] invalid fileList`})];r.push({fileid:s})}return c=`storage.batchGetDownloadUrl`,l=this.request,u={},this.isGateWay()?[4,Ke(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(c,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:Array.isArray(u.data?.download_list)?u.data.download_list:[],requestId:u.requestId})]}})})},e.prototype.downloadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c;return Me(this,function(l){switch(l.label){case 0:return c=We(e,t),e=c[0],t=c[1],n=e.fileID,Le(n)?[4,this.getTempFileURL.call(this,{fileList:[n],customReqOpts:e.customReqOpts})]:[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] fileID must be string`})];case 1:return r=l.sent(),(i=r.fileList[0]).code===`SUCCESS`?(a=this.request,o=encodeURI(i.download_url),[4,a.download({url:o,tempFilePath:e.tempFilePath})]):[2,ze(t,i)];case 2:return s=l.sent(),[2,ze(t,null,s)]}})})},e.prototype.copyFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] fileList must not be empty`})];for(r=[],i=0,a=n;i<a.length;i++){if(o=a[i],s=o.srcPath,c=o.dstPath,!s||!c||typeof s!=`string`||typeof c!=`string`)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] srcPath and dstPath may not be empty`})];if(s===c)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] srcPath and dstPath can not be the same`})];r.push({src_path:s,dst_path:c,overwrite:o.overwrite,remove_original:o.removeOriginal})}return l=this.request,u={},this.isGateWay()?[4,Je(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(`storage.batchCopyFile`,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:u.data.copy_list,requestId:u.requestId})]}})})},e.prototype.getFileInfo=function(e){return je(this,void 0,Promise,function(){var t,n=this;return Me(this,function(r){switch(r.label){case 0:return[4,this.getTempFileURL(e)];case 1:return(t=r.sent())?.fileList&&t?.fileList?.length>0?[4,Promise.all(t.fileList.map(function(e){return je(n,void 0,void 0,function(){var t,n,r,i,a,o,s;return Me(this,function(c){switch(c.label){case 0:if(e.code!==`SUCCESS`)return[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,message:e.message}];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request.fetch({url:e.tempFileURL,method:`HEAD`})];case 2:return t=c.sent(),n=t.header,typeof Headers<`u`&&n instanceof Headers&&(r={},n.forEach(function(e,t){r[t]=e}),n=r),i=parseInt(n[`content-length`])||0,a=n[`content-type`]||``,[400,404].includes(Number(t.statusCode))?[2,{code:`FILE_NOT_FOUND`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:`file not found`}]:[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,cloudId:e.fileID,fileName:e.fileID.split(`/`).pop(),contentType:a,mime:a.split(`;`)[0].trim(),size:i,etag:n.etag||``,lastModified:n[`last-modified`]||``,cacheControl:n[`cache-control`]||``}];case 3:return o=c.sent(),s=typeof o==`object`&&o&&`message`in o?String(o.message):void 0,[2,{code:`FETCH_FILE_INFO_ERROR`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:s}];case 4:return[2]}})})}))]:[3,3];case 2:return[2,{fileList:r.sent(),requestId:t.requestId}];case 3:return[2,{fileList:[],requestId:t.requestId}]}})})},ke([He({customInfo:{className:`Cloudbase`,methodName:`uploadFile`},title:`上传文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 uploadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(t=typeof Function<`u`&&Function)==`function`?t:Object]),Ae(`design:returntype`,typeof(n=typeof Promise<`u`&&Promise)==`function`?n:Object)],e.prototype,`uploadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getUploadMetadata`},title:`获取上传元信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 getUploadMetadata() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object]),Ae(`design:returntype`,typeof(i=typeof Promise<`u`&&Promise)==`function`?i:Object)],e.prototype,`getUploadMetadata`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`deleteFile`},title:`删除文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 deleteFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(a=De.ICloudbaseDeleteFileParams!==void 0&&De.ICloudbaseDeleteFileParams)==`function`?a:Object,typeof(s=typeof Function<`u`&&Function)==`function`?s:Object]),Ae(`design:returntype`,typeof(c=typeof Promise<`u`&&Promise)==`function`?c:Object)],e.prototype,`deleteFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getTempFileURL`},title:`获取文件下载链接`,messages:[`请确认以下各项:`,` 1 - 调用 getTempFileURL() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(l=De.ICloudbaseGetTempFileURLParams!==void 0&&De.ICloudbaseGetTempFileURLParams)==`function`?l:Object,typeof(u=typeof Function<`u`&&Function)==`function`?u:Object]),Ae(`design:returntype`,typeof(d=typeof Promise<`u`&&Promise)==`function`?d:Object)],e.prototype,`getTempFileURL`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`downloadFile`},title:`下载文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 downloadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(f=De.ICloudbaseDownloadFileParams!==void 0&&De.ICloudbaseDownloadFileParams)==`function`?f:Object,typeof(p=typeof Function<`u`&&Function)==`function`?p:Object]),Ae(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],e.prototype,`downloadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`copyFile`},title:`批量复制文件`,messages:[`请确认以下各项:`,` 1 - 调用 copyFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(h=De.ICloudbaseCopyFileParams!==void 0&&De.ICloudbaseCopyFileParams)==`function`?h:Object,typeof(g=typeof Function<`u`&&Function)==`function`?g:Object]),Ae(`design:returntype`,typeof(_=typeof Promise<`u`&&Promise)==`function`?_:Object)],e.prototype,`copyFile`,null),e}(),$e=function(){return $e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$e.apply(this,arguments)},et=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},I=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},tt=ae,L=function(){function e(e,t){t===void 0&&(t=!1),this.shouldThrowOnError=!1,this.bucketId=``,this.context=e,this.shouldThrowOnError=t,this.storage=new Qe(e)}return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.upload=function(e,t,n){return et(this,void 0,Promise,function(){var i,a,o,s,c,l,u,d,f;return I(this,function(p){switch(p.label){case 0:i=$e({upsert:!0},n),a=i.cacheControl,o=i.contentType,s=i.metadata,p.label=1;case 1:return p.trys.push([1,3,,4]),c=this.getCloudPath(e),l={cloudPath:c,filePath:t},(a||o||s)&&(u={},a&&(u[`cache-control`]=a),o&&(u[`content-type`]=o),s&&(u[`x-cos-metadata-metadata`]=this.toBase64(JSON.stringify(s))),l.headers=u),[4,this.storage.uploadFile(l)];case 2:if(!(d=p.sent()).fileID)throw Error(JSON.stringify({code:tt.OPERATION_FAIL,msg:`[${Ue}.update] no fileID returned`}));return[2,{data:{id:d.fileID,path:e,fullPath:e},error:null}];case 3:if(f=p.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return et(this,void 0,Promise,function(){return I(this,function(t){return[2,this.upload(e,n,r)]})})},e.prototype.createSignedUploadUrl=function(e){return et(this,void 0,Promise,function(){var t,r,i;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.getCloudPath(e),[4,this.storage.getUploadMetadata({cloudPath:t})];case 1:return[2,{data:{signedUrl:(r=a.sent().data).url,token:r.token,path:e,authorization:r.authorization,id:r.fileId,cosFileId:r.cosFileId,downloadUrl:r.download_url},error:null}];case 2:if(i=a.sent(),this.shouldThrowOnError)throw i;return[2,{data:null,error:i instanceof n?i:new n(i.message)}];case 3:return[2]}})})},e.prototype.update=function(e,t,n){return et(this,void 0,Promise,function(){return I(this,function(r){return[2,this.upload(e,t,$e($e({},n),{upsert:!0}))]})})},e.prototype.move=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!0}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Move failed`);return[2,{data:{message:`File moved from ${e} to ${t}`},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.copy=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!1}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Copy failed`);return[2,{data:{path:this.getCloudPath(t)},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,i){return et(this,void 0,Promise,function(){var t,a,o,s,c,l,u;return I(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),t=this.normalizeCloudId(e),[4,this.storage.getTempFileURL({fileList:[t]})];case 1:if((a=d.sent()).fileList[0].code!==`SUCCESS`)throw new n(`Failed to create signed URL: [${a.fileList[0].code}] ${a.fileList[0].fileID}`);return o=a.fileList[0].download_url,s=[],i?.download!==void 0&&(typeof i.download==`string`?s.push(`download=${encodeURIComponent(i.download)}`):!0===i.download&&s.push(`download=true`)),i!=null&&i.transform&&(c=this.transformOptsToQueryString(i.transform))&&s.push(c),s.length>0&&(l=o.includes(`?`)?`&`:`?`,o=`${o}${l}${s.join(`&`)}`),[2,{data:{signedUrl:o},error:null}];case 2:if(u=d.sent(),this.shouldThrowOnError)throw u;if(r(u))return[2,{data:null,error:u}];throw u;case 3:return[2]}})})},e.prototype.createSignedUrls=function(e,t){return et(this,void 0,Promise,function(){var t,n,i=this;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=e.map(function(e){return i.normalizeCloudId(e)}),[4,this.storage.getTempFileURL({fileList:t})];case 1:return[2,{data:a.sent().fileList.map(function(t,n){return{path:e[n],signedUrl:t.tempFileURL||``,error:t.code===`SUCCESS`?null:t.message}}),error:null}];case 2:if(n=a.sent(),this.shouldThrowOnError)throw n;if(r(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}})})},e.prototype.download=function(e,t){return et(this,void 0,Promise,function(){var i,a,o=this;return I(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),a={},[4,et(o,void 0,void 0,function(){var r,i,a;return I(this,function(o){switch(o.label){case 0:return[4,this.createSignedUrl(e,600,{transform:t})];case 1:if((r=o.sent()).error)throw r.error;return i=encodeURI(r.data?.signedUrl),[4,this.request.reqClass.get({url:i,headers:{},responseType:`blob`})];case 2:if(!(a=o.sent().data))throw new n(`Download failed: no file content`);return[2,new Blob([a])]}})})];case 1:return[2,(a.data=s.sent(),a.error=null,a)];case 2:if(i=s.sent(),this.shouldThrowOnError)throw i;if(r(i))return[2,{data:null,error:i}];throw i;case 3:return[2]}})})},e.prototype.info=function(e){return et(this,void 0,Promise,function(){var t,r,i,a,o,s,c,l;return I(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=e.startsWith(`cloud://`),r=t?this.extractPathFromFileId(e):e,i=t?this.extractBucketFromFileId(e):this.bucketId,[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(a=u.sent(),(o=a.fileList[0]).code!==`SUCCESS`)throw new n(o.message);return s=new Date().toISOString(),c=(o.lastModified?new Date(o.lastModified):new Date).toISOString(),[2,{data:{id:o.fileID,version:`1`,name:r,bucketId:i,updatedAt:c,createdAt:c,lastAccessedAt:s,size:o.size,cacheControl:o.cacheControl,contentType:o.contentType,etag:o.etag,lastModified:c,metadata:{}},error:null}];case 2:if(l=u.sent(),this.shouldThrowOnError)throw l;return[2,{data:null,error:l instanceof n?l:new n(l.message)}];case 3:return[2]}})})},e.prototype.exists=function(e){return et(this,void 0,Promise,function(){var t,i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(t=o.sent(),(i=t.fileList[0]).code===`FILE_NOT_FOUND`)return[2,{data:!1,error:null}];if(i.code!==`SUCCESS`)throw new n(i.message);return[2,{data:!0,error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.getPublicUrl=function(e,t){return et(this,void 0,Promise,function(){var n;return I(this,function(r){switch(r.label){case 0:return[4,this.createSignedUrl(e,600,t)];case 1:return(n=r.sent()).data?[2,{data:{publicUrl:n.data.signedUrl}}]:[2,{data:null,error:n.error}]}})})},e.prototype.remove=function(e){return et(this,void 0,Promise,function(){var t,i,a,o,s,c,l,u,d,f,p=this;return I(this,function(m){switch(m.label){case 0:for(m.trys.push([0,3,,4]),t=10,i=[],a=0;a<e.length;a+=t)i.push(e.slice(a,a+t));return[4,Promise.all(i.map(function(e){return Promise.all(e.map(function(e){return p.info(e)}))}))];case 1:return o=m.sent(),s=new Map,o.forEach(function(n,r){n.forEach(function(n,i){n.data&&s.set(e[r*t+i],n.data)})}),c=e.map(function(e){return p.normalizeCloudId(e)}),[4,this.storage.deleteFile({fileList:c})];case 2:if(l=m.sent(),(u=l.fileList.filter(function(e){return e.code!==`SUCCESS`})).length>0)throw new n(`Delete failed for ${u.length} file(s)`);return d=new Date().toISOString(),[2,{data:e.map(function(e){var t=s.get(e);return{name:t?.name,id:t?.id,bucket_id:t?.bucketId,owner:void 0,updated_at:t?.updatedAt||d,created_at:t?.createdAt,last_accessed_at:t?.lastAccessedAt||d,metadata:t?.metadata||{},buckets:{id:t?.bucketId,name:t?.bucketId,owner:void 0,public:!1,created_at:``,updated_at:d}}}),error:null}];case 3:if(f=m.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.list=function(){return et(this,void 0,void 0,function(){return I(this,function(e){throw new n(`Not implemented`)})})},e.prototype.getCloudPath=function(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)},e.prototype.normalizeCloudId=function(e){if(/^cloud:\/\//.test(e))return e;var t=this.getCloudPath(e);if(!this.bucketId)throw new n(`bucketId is not set`);var r=this.config?.env||``;return r?`cloud://${r}.${this.bucketId}/${t}`:void 0},e.prototype.toBase64=function(e){return s(e)},e.prototype.transformOptsToQueryString=function(e){var t=[`imageMogr2`];if(e.width||e.height){var n=e.width||``,r=e.height||``;e.resize===`fill`?t.push(`thumbnail/${n}x${r}!`):e.resize===`contain`?t.push(`thumbnail/${n}x${r}`):t.push(`thumbnail/${n}x${r}^`)}if(e.format&&e.format!==`origin`&&t.push(`format/${e.format}`),e.quality!==void 0){var i=Math.max(1,Math.min(100,e.quality));t.push(`quality/${i}`)}return t.join(`/`)},e.prototype.extractPathFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);return t.length<2?e:t.slice(1).join(`/`)},e.prototype.extractBucketFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);if(t.length<1)return``;var n=t[0],r=n.indexOf(`.`);return r===-1?n:n.substring(r+1)},e}(),R=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),nt=new Qe,rt={name:Ue,entity:{uploadFile:nt.uploadFile,deleteFile:nt.deleteFile,getTempFileURL:nt.getTempFileURL,downloadFile:nt.downloadFile,getUploadMetadata:nt.getUploadMetadata,copyFile:nt.copyFile,getFileInfo:nt.getFileInfo,isGateWay:nt.isGateWay}},it=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return R(t,e),t.prototype.from=function(e){return e?(k(e,`from`),new te(this.http,e,this.shouldThrowOnError)):new L(this.http.ctx,this.shouldThrowOnError)},t}(re),at={name:`${Ue}/supabase`,IIFE:!0,entity:function(){var e=new WeakMap;Object.defineProperty(this.prototype,"storage",{get:function(){if(e.has(this))return e.get(this);var t=this,n=new it(new Proxy({},{get:function(e,n){return n===`config`?t.config:n===`request`?t.request:void 0}}));return e.set(this,n),n},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(rt),cloudbase.registerComponent(at)}catch{}function z(e){try{e.registerComponent(rt),e.registerComponent(at)}catch(e){console.warn(e)}}try{window.registerStorage=z}catch{}var ot=z})(),mo.v;var ho=`2.0.2`,go=[`webhook`,`qmsg`,`serverchan`,`pushplus`,`pushplushxtrip`,`dingtalk`,`wecom`,`bark`,`gocqhttp`,`onebot`,`atri`,`pushdeer`,`igot`,`telegram`,`feishu`,`ifttt`,`wecombot`,`discord`,`wxpusher`,`join`],_o=class extends Error{kind;httpStatus;rawMessage;requestId;constructor(e,t,n={}){super(t),this.name=`TwikooError`,this.kind=e,this.httpStatus=n.httpStatus,this.rawMessage=n.rawMessage??t,this.requestId=n.requestId}},vo={tcb:null,options:{}};function yo(e,t){vo.tcb=e,vo.options=t}function bo(){return vo}function xo(e){return typeof e==`string`&&/^http(s)?:\/\//.test(e)}function So(e,t){return new Promise((n,r)=>{let i=localStorage.getItem(`twikoo-access-token`),a=new XMLHttpRequest,o=Date.now();a.onreadystatechange=()=>{if(a.readyState!==4)return;let e=Date.now()-o;if(a.status===200)try{let e=JSON.parse(a.responseText);e.accessToken&&localStorage.setItem(`twikoo-access-token`,typeof e.accessToken==`string`?e.accessToken:``),n(e)}catch{r(new _o(`UNKNOWN`,`后端返回格式异常`,{rawMessage:a.responseText.slice(0,200)}))}else a.status===0?r(new _o(e>3e4?`TIMEOUT`:`CORS`,`请求被跨域策略拦截或网络不可达`,{rawMessage:a.statusText||`status 0`})):a.status===404?r(new _o(`NOT_FOUND`,`接口地址不存在`,{httpStatus:404,rawMessage:a.responseText.slice(0,200)})):a.status===401||a.status===403?r(new _o(`CLIENT_ERROR`,`认证失败,请重新登录`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):a.status===429?r(new _o(`REJECTED`,`请求过于频繁`,{httpStatus:429,rawMessage:a.responseText.slice(0,200)})):a.status>=500?r(new _o(`SERVER_ERROR`,`后端异常`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):r(new _o(`CLIENT_ERROR`,`请求失败(${a.status})`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)}))};try{a.open(`POST`,e),a.setRequestHeader(`Content-Type`,`application/json`),a.send(JSON.stringify({accessToken:i,...t,envId:e}))}catch(e){r(new _o(`NETWORK`,`无法连接到后端`,{rawMessage:String(e)}))}})}async function Co(e,t,n={}){let r=e??vo.tcb,i=typeof n.envId==`string`?n.envId:typeof vo.options.envId==`string`?vo.options.envId:void 0,a=typeof n.funcName==`string`?n.funcName:typeof vo.options.funcName==`string`?vo.options.funcName:`twikoo`;if(r)return await r.app.callFunction({name:a,data:{event:t,...n}});if(typeof i==`string`&&xo(i))return await So(i,{event:t,...n});throw Error(`缺少 envId 配置 - https://twikoo.js.org`)}var wo={verbose:1,info:2,warn:3,error:4}[(typeof process<`u`&&process.env,`info`).toLowerCase()]||2,To={verbose:(...e)=>{wo<=1&&console.log(...e)},info:(...e)=>{wo<=2&&console.info(...e)},warn:(...e)=>{wo<=3&&console.warn(...e)},error:(...e)=>{wo<=4&&console.error(...e)}},Eo={ADMIN_CLIENT_VERSION:`前端版本:`,ADMIN_SERVER_VERSION:`云函数版本:`,ADMIN_COMMENT:`评论管理`,ADMIN_COMMENT_DELETE:`删除`,ADMIN_COMMENT_DELETE_CONFIRM:`确认删除?`,ADMIN_COMMENT_FILTER_ALL:`全部`,ADMIN_COMMENT_FILTER_VISIBLE:`只看可见`,ADMIN_COMMENT_FILTER_HIDDEN:`只看隐藏`,ADMIN_COMMENT_HIDE:`隐藏`,ADMIN_COMMENT_IS_SPAM_SUFFIX:` (已隐藏)`,ADMIN_COMMENT_SEARCH:`搜索`,ADMIN_COMMENT_SEARCH_PLACEHOLDER:`搜索昵称、邮箱、网址、IP、评论正文、文章地址`,ADMIN_COMMENT_SHOW:`显示`,ADMIN_COMMENT_TOP:`置顶`,ADMIN_COMMENT_UNTOP:`取消置顶`,ADMIN_COMMENT_VIEW:`查看`,ADMIN_COMMENT_SECURITY_ALERT:`评论链接与本站不同!出于安全考虑,请手动复制以下网址访问:`,ADMIN_COMMENT_PARSE_ERROR:`无法解析评论链接,请仔细检查链接后手动复制以下网址访问:`,ADMIN_CONFIG:`配置管理`,ADMIN_CONFIG_CATEGORY_COMMON:`通用`,ADMIN_CONFIG_CATEGORY_IM:`即时通知`,ADMIN_CONFIG_CATEGORY_MAIL:`邮件通知`,ADMIN_CONFIG_CATEGORY_PLUGIN:`插件`,ADMIN_CONFIG_CATEGORY_PRIVACY:`隐私`,ADMIN_CONFIG_CATEGORY_SPAM:`反垃圾`,ADMIN_CONFIG_CATEGORY_CAPTCHA:`人机验证`,ADMIN_CONFIG_IMAGE_CDN_NONE:`无(不启用图片上传)`,ADMIN_CONFIG_CAPTCHA_NONE:`无`,ADMIN_CONFIG_CAPTCHA_TURNSTILE:`Cloudflare Turnstile`,ADMIN_CONFIG_CAPTCHA_GEETEST:`极验 Geetest`,ADMIN_CONFIG_CAPTCHA_CAP:`Cap`,ADMIN_CONFIG_EMAIL_TEST:`邮件通知测试`,ADMIN_CONFIG_EMAIL_TEST_BTN:`发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_HELP:`输入一个邮箱地址,发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_RESULT:`测试结果:`,ADMIN_CONFIG_EXAMPLE:`示例:`,ADMIN_CONFIG_ITEM_AKISMET_KEY:`Akismet 反垃圾评论,用于垃圾评论检测,设为 "MANUAL_REVIEW" 开启人工审核,留空不使用反垃圾。注册:https://akismet.com`,ADMIN_CONFIG_ITEM_BLOGGER_NICK:`博主的昵称。`,ADMIN_CONFIG_ITEM_BLOGGER_EMAIL:`博主的邮箱地址,用于邮件通知、博主标识。`,ADMIN_CONFIG_ITEM_COMMENT_BG_IMG:`评论框自定义背景图片 URL 地址。`,ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE:`评论列表分页大小,默认为 8。`,ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER:`评论框提示信息,可用<br>换行,默认为空`,ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN:`CORS 安全域名,注意:如果您不了解什么是 CORS,此项请留空,错误设置会导致无法加载,默认为空,格式为 https://blog.example.com;如需添加多域名请使用,分隔`,ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR:`默认的头像显示。默认值(留空)为 "initials",可选:"404"、"mp"、"identicon"、"monsterid"、"wavatar"、"retro"、"robohash"、"blank"`,ADMIN_CONFIG_ITEM_EMOTION_CDN:`表情 CDN,英文逗号分隔。默认为:https://owo.imaegoo.com/owo.json`,ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS:`违禁词配置,包含违禁词的内容会直接标记为垃圾评论。英文逗号分隔。`,ADMIN_CONFIG_ITEM_BLOCKED_WORDS:`屏蔽词配置,包含屏蔽词的内容会直接评论失败。英文逗号分隔。`,ADMIN_CONFIG_ITEM_GRAVATAR_CDN:`自定义头像 CDN 地址。如:cn.gravatar.com, weavatar.com, cravatar.cn, sdn.geekzu.org, gravatar.loli.net,默认:weavatar.com`,ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT:`隐藏管理面板入口。可设置一个“暗号”,只有在“昵称”一栏输入相同的“暗号”时,管理面板入口才会显示,留空则不隐藏管理入口`,ADMIN_CONFIG_ITEM_QQ_API_KEY:`QQ昵称API密钥,用于获取QQ昵称。前往 https://api.tqq.me/dashboard/api-keys 获取`,ADMIN_CONFIG_ITEM_HIGHLIGHT:`启用代码高亮功能。如果您的主题和代码高亮有冲突,请设为 false。默认:true`,ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME:`代码高亮主题,可选:"default"、"coy"、"dark"、"funky"、"okaidia"、"solarizedlight"、"tomorrow"、"twilight",访问 https://prismjs.com 可预览主题效果。如果您的主题和代码高亮有冲突,请设为 none。默认:none`,ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN:`代码高亮插件,可选:"showLanguage"、"copyButton",分别表示:展示代码语言、展示代码拷贝按钮。可以同时设置多个选项,如果想要不添加任何代码高亮插件,请设为 none。默认:none。`,ADMIN_CONFIG_ITEM_IMAGE_CDN:`插入图片所使用的图床,目前支持:"qcloud"、"7bu (https://7bu.top)"、"see (https://s.ee)"、"lskypro"、"piclist"、"easyimage"、"chevereto"、"S3 / R2 / MinIO"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_URL:`图床的 URL,仅当 IMAGE_CDN 为 "lskypro" / "piclist" / "easyimage" / "s3" 时需要填写`,ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN:`图床 token。qcloud 图床无需设置`,ADMIN_CONFIG_ITEM_NSFW_API_URL:`NSFW 图片检测 API 地址。免费服务:nsfw.qixz.cn,项目:github.com/HG-ha/nsfwpy`,ADMIN_CONFIG_ITEM_NSFW_THRESHOLD:`NSFW 检测阈值(0-1),当检测分数高于此值时拒绝上传。默认:0.5`,ADMIN_CONFIG_ITEM_S3_REGION:`S3 存储区域,例如 us-east-1。使用兼容 S3 的服务(如 Cloudflare R2、MinIO)时可填任意值`,ADMIN_CONFIG_ITEM_S3_BUCKET:`S3 存储桶名称`,ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID:`S3 Access Key ID`,ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY:`S3 Secret Access Key`,ADMIN_CONFIG_ITEM_S3_ENDPOINT:`S3 自定义 Endpoint,使用 Cloudflare R2、MinIO 等兼容 S3 的服务时填写`,ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE:`设置 S3_ENDPOINT 时,是否将 S3_BUCKET 拼入上传地址路径。默认为 true,适用于 Cloudflare R2、MinIO 等 path-style S3 兼容端点;使用已绑定存储桶的自定义域名时设为 false,例如腾讯云 COS 自定义域名`,ADMIN_CONFIG_ITEM_S3_CDN_URL:`S3 图片访问域名(CDN 域名),留空则使用默认 S3/Endpoint URL`,ADMIN_CONFIG_ITEM_S3_PATH_PREFIX:`S3 图片存储路径前缀,例如 images/twikoo,留空则存储在根目录`,ADMIN_CONFIG_ITEM_LIGHTBOX:`使用简易图片点击放大效果。默认:false`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE:`单个 IP 发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL:`全站发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_LENGTH:`评论长度限制,0 为无限制,默认:500`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT:`自定义通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN:`自定义博主通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_TEMPLATE:"自定义通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${PARENT_NICK}, ${PARENT_COMMENT}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IMG}, ${PARENT_IMG}",ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN:"自定义博主通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IP}, ${MAIL}, ${IMG}",ADMIN_CONFIG_ITEM_MASTER_TAG:`博主标识自定义文字,默认为 “博主”。`,ADMIN_CONFIG_ITEM_NOTIFY_SPAM:`垃圾评论是否发送通知,默认:true`,ADMIN_CONFIG_ITEM_HIDE_SPAM:`前台评论区对所有人隐藏垃圾评论,包括管理员和评论作者。评论管理后台仍可审核和恢复。设为 true 开启,默认:false。`,ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER:`人机验证码提供商`,ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY:`Turnstile 验证码的站点密钥。申请地址: https://dash.cloudflare.com/?to=/:account/turnstile`,ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY:`Turnstile 验证码的密钥`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID:`极验验证码的 Captcha ID。申请地址: https://console.geetest.com/sensbot/management`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY:`极验验证码的 Captcha Key`,ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT:`Cap 验证码 API 端点。留空则使用内嵌 Cap(无需额外部署);外部 Standalone 格式:https://<实例地址>/<site_key>/`,ADMIN_CONFIG_ITEM_CAP_SECRET_KEY:`Cap Secret Key(仅外部 Standalone 需要;内嵌模式可留空)`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID:`腾讯云 secret id,用于垃圾评论检测。同时设置腾讯云和 Akismet 时,只有腾讯云会生效。注册:https://twikoo.js.org/cms.html`,ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE:`腾讯云内容安全 Biztype 名称,用于垃圾评论策略。可以自定义垃圾拦截规则`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY:`腾讯云 secret key`,ADMIN_CONFIG_ITEM_LLM_API_KEY:`LLM API Key,用于 AI 垃圾评论检测。仅在未配置腾讯云和 Akismet 时生效。`,ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT:`LLM API 接口地址,默认:https://api.deepseek.com/v1`,ADMIN_CONFIG_ITEM_LLM_MODEL:`LLM 模型名称,默认:deepseek-v4-pro`,ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT:`LLM 垃圾检测提示词(可选,留空则使用默认提示词)`,ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES:`LLM 检测最大重试次数(默认 3 次)`,ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL:`即时消息推送平台名称,支持:"qmsg"、"serverchan"、"pushplus"、"pushplushxtrip"、"dingtalk"、"wecom"、"bark"、"gocqhttp"、"atri"、"pushdeer"、"igot"、"telegram"、"feishu" 等`,ADMIN_CONFIG_ITEM_PUSHOO_TOKEN:`即时消息推送 token。请参考 https://pushoo.js.org 里的详细说明配置`,ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS:`界面上展示的输入框,默认:nick,mail,link`,ADMIN_CONFIG_ITEM_REQUIRED_FIELDS:`评论必填信息,设为 nick,mail,link 代表全必填,设为 none 代表全选填,默认:nick,mail`,ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY:`是否同时通过 IM 和邮件 2 种方式通知博主,默认只通过 IM 通知博主,默认:false`,ADMIN_CONFIG_ITEM_SENDER_EMAIL:`邮件通知邮箱地址。对于大多数邮箱服务商,SENDER_EMAIL 必须和 SMTP_USER 保持一致,否则无法发送邮件。`,ADMIN_CONFIG_ITEM_SENDER_NAME:`邮件通知标题。`,ADMIN_CONFIG_ITEM_SHOW_EMOTION:`启用插入表情功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_IMAGE:`启用插入图片功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_ORDER:`评论排序下拉框,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_DISLIKE:`评论点踩按钮,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_UA:`是否显示用户系统和浏览器,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_REGION:`是否显示用户 IP 属地到省,可能不准确,不支持 IPv6,默认为:false`,ADMIN_CONFIG_ITEM_SITE_NAME:`网站名称`,ADMIN_CONFIG_ITEM_SITE_URL:`网站地址`,ADMIN_CONFIG_ITEM_SMTP_HOST:`自定义 SMTP 服务器地址。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_PASS:`邮件通知邮箱密码,QQ、163邮箱请填写授权码。`,ADMIN_CONFIG_ITEM_SMTP_PORT:`自定义 SMTP 端口。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SECURE:`自定义 SMTP 是否使用TLS,请填写 true 或 false。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SERVICE:`邮件通知邮箱服务商。支持:"126"、"163"、"1und1"、"AOL"、"DebugMail"、"DynectEmail"、"FastMail"、"GandiMail"、"Gmail"、"Godaddy"、"GodaddyAsia"、"GodaddyEurope"、"Hotmail"、"Mail.ru"、"Maildev"、"Mailgun"、"Mailjet"、"Mailosaur"、"Mandrill"、"Naver"、"OpenMailBox"、"Outlook365"、"Postmark"、"QQ"、"QQex"、"SES"、"SES-EU-WEST-1"、"SES-US-EAST-1"、"SES-US-WEST-2"、"SendCloud"、"SendGrid"、"SendPulse"、"SendinBlue"、"Sparkpost"、"Yahoo"、"Yandex"、"Zoho"、"hot.ee"、"iCloud"、"mail.ee"、"qiye.aliyun"`,ADMIN_CONFIG_ITEM_SMTP_USER:`邮件通知邮箱用户名。`,ADMIN_CONFIG_RESET:`重置`,ADMIN_CONFIG_SAVE:`保存`,ADMIN_CREDENTIALS:`私钥文件`,ADMIN_CREDENTIALS_FAQ:`如何获得私钥`,ADMIN_CREDENTIALS_PLACEHOLDER:`请粘贴私钥文件内容`,ADMIN_FORGOT:`忘记密码`,ADMIN_EXPORT:`导出`,ADMIN_EXPORT_WARN:`将全部数据导出为 JSON 文件。如果遇到评论较多、导出失败或缺失数据,请连接数据库手动导出`,ADMIN_EXPORT_COMMENT:`导出评论`,ADMIN_EXPORT_COUNTER:`导出访问量`,ADMIN_IMPORT:`导入`,ADMIN_IMPORT_FILE_REQUIRED:`未选择文件`,ADMIN_IMPORT_IMPORTED:`完成导入 `,ADMIN_IMPORT_IMPORTING:`开始导入 `,ADMIN_IMPORT_LOG:`日志`,ADMIN_IMPORT_SELECT:`请选择`,ADMIN_IMPORT_SELECT_FILE:`选择文件`,ADMIN_IMPORT_SELECT_SOURCE:`选择源系统`,ADMIN_IMPORT_SOURCE_REQUIRED:`未选择源系统`,ADMIN_IMPORT_START:`开始导入`,ADMIN_IMPORT_STARTING:`开始导入`,ADMIN_IMPORT_TIP_ARTALK:`请上传 JSON 格式的 Artalk 导出文件,文件名通常为 comments.data.json`,ADMIN_IMPORT_TIP_DISQUS:`请上传 XML 格式的 Disqus 导出文件,文件名通常为 [网站名称]-[导出时间]-all.xml`,ADMIN_IMPORT_TIP_VALINE:`请上传 JSON 格式的 Valine 导出文件,文件名通常为 Comment.json`,ADMIN_IMPORT_UPLOADED:`上传完成 `,ADMIN_IMPORT_UPLOADING:`已上传 `,ADMIN_IMPORT_WARN:`支持从其他评论系统的备份文件导入评论。
|
|
169
|
+
不要在匿名登录失败后自动回退到密码登录,这两种方式的使用场景不同。`)):(console.warn(`[CloudBase Auth] signInAnonymously 失败 [${a.category}]: ${a.message}`),a.loginMethodHint&&console.warn(a.loginMethodHint)),[2,{data:{user:null,session:null},error:a}];case 5:return[2]}})})},n.prototype.signUp=function(e){return H(this,void 0,Promise,function(){var t,n,r=this;return U(this,function(i){switch(i.label){case 0:return e.phone_number||e.verification_code||e.verification_token||e.provider_token?(e.phone_number&&=this.formatPhone(e.phone_number),[4,this.oauthInstance.authApi.signUp(e)]):[3,2];case 1:return i.sent(),[2,this.createLoginState()];case 2:return i.trys.push([2,4,,5]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signUp`),[4,this.getVerification(e.email?{email:e.email,usage:c.EMAIL}:{phone_number:this.formatPhone(e.phone)})];case 3:return t=i.sent(),[2,{data:{verifyOtp:function(n){var i=n.token,a=n.messageId,o=a===void 0?t.verification_id:a;return H(r,void 0,Promise,function(){var n,r,a,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,8,,9]),[4,this.verify({verification_id:o||t.verification_id,verification_code:String(i)})];case 1:return n=l.sent(),t.is_user?[4,this.signIn({username:e.email||this.formatPhone(e.phone),verification_token:n.verification_token})]:[3,3];case 2:return l.sent(),[3,6];case 3:return delete(r=JSON.parse(JSON.stringify(e))).email,delete r.phone,[4,this.oauthInstance.authApi.signUp(B(B(B({},r),e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)}),{verification_token:n.verification_token,verification_code:i}))];case 4:return l.sent(),[4,this.createLoginState()];case 5:l.sent(),l.label=6;case 6:return[4,this.getSession()];case 7:return a=l.sent().data,[2,{data:{user:(s=(a===void 0?{}:a).session).user,session:s},error:null}];case 8:return c=l.sent(),[2,{data:{user:null,session:null},error:new I(c,{method:`signUp`})}];case 9:return[2]}})})}},error:null}];case 4:return n=i.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`signUp`})}];case 5:return[2]}})})},n.prototype.signOut=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return n=i.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return i.sent(),this.setAccessKey(),[2,B(B({},n),{data:{},error:null})];case 3:return r=i.sent(),[2,{data:{},error:new I(r,{method:`signOut`})}];case 4:return[2]}})})},n.prototype.onAuthStateChange=function(e){var t=this;this.hasListenerSetUp||=(this.setupListeners(),!0);var n=Math.random().toString(36);return this.listeners.has(n)||this.listeners.set(n,new Set),this.listeners.get(n).add(e),{data:{subscription:{id:n,callback:e,unsubscribe:function(){var r=t.listeners.get(n);r&&(r.delete(e),r.size===0&&t.listeners.delete(n))}}}}},n.prototype.signInWithPassword=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c;return U(this,function(l){switch(l.label){case 0:return l.trys.push([0,3,,4]),this.validateAtLeastOne(e,[[`username`],[`email`],[`phone`]],`signInWithPassword`),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`signInWithPassword`),t=`username`in e?e.username:void 0,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,i=e.options?.is_encrypt??e.is_encrypt,[4,this.signIn(B({username:t||n||this.formatPhone(r),password:e.password},i?{isEncrypt:!0,version:`v2`}:{}))];case 1:return l.sent(),[4,this.getSession()];case 2:return a=l.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 3:return s=l.sent(),(c=new I(s,{method:`signInWithPassword`})).category===F.PROVIDER_NOT_ENABLED?console.error(c.helpMessage):c.category===F.INVALID_CREDENTIALS||c.category===F.USER_NOT_FOUND?console.warn(c.helpMessage):console.warn(`[CloudBase Auth] signInWithPassword 失败 [${c.category}]: ${c.message}`),c.loginMethodHint&&console.info(c.loginMethodHint),[2,{data:{user:null,session:null},error:c}];case 4:return[2]}})})},n.prototype.signInWithIdToken=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{token:{required:!0,message:`Token is required`}},`signInWithIdToken`),[4,this.signInWithProvider({provider_id:e.provider,provider_id_token:e.token})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`signInWithIdToken`})}];case 4:return[2]}})})},n.prototype.signInWithOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o=this;return U(this,function(s){switch(s.label){case 0:if(t=e.options,n=`email`in e?e.email:void 0,r=`phone`in e?e.phone:void 0,!t?.emailRedirectTo&&(t?.shouldCreateUser===void 0||t?.shouldCreateUser))return[2,this.signUp(n?{email:n}:{phone:r})];s.label=1;case 1:return s.trys.push([1,3,,4]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`signInWithOtp`),[4,this.getVerification(B(B({email_redirect_to:t?.emailRedirectTo},n?{email:n,usage:c.EMAIL}:{phone_number:this.formatPhone(r)}),{target:t?.emailRedirectTo&&t?.shouldCreateUser?`ANY`:`USER`}))];case 2:return i=s.sent(),[2,{data:{user:null,session:null,verifyOtp:function(e){var t=e.token,a=e.messageId,s=a===void 0?i.verification_id:a;return H(o,void 0,Promise,function(){return U(this,function(e){return[2,this.verifyOtp(n?{email:n,token:String(t),messageId:s||``}:{phone:r,token:String(t),messageId:s||``})]})})}},error:null}];case 3:return a=s.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`signInWithOtp`})}];case 4:return[2]}})})},n.prototype.verifyOAuth=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l;return U(this,function(u){switch(u.label){case 0:t={},u.label=1;case 1:return u.trys.push([1,7,,8]),n=e?.code||ue(`code`),r=e?.state||ue(`state`),n?r?(i=function(e){try{return JSON.parse(sessionStorage.getItem(e))}catch(e){return console.error(`Failed to get browser session:`,e),null}}(r),t.type=i?.type,(a=e?.provider||i?.provider||ue(`provider`))?[4,this.grantProviderToken({provider_id:a,provider_redirect_uri:location.origin+location.pathname,provider_code:n})]:[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:this.missingRequiredParam(`verifyOAuth`,`provider`)}]):[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`state`)}]:[2,{data:{user:null,session:null,redirectUrl:null},error:this.missingRequiredParam(`verifyOAuth`,`code`)}];case 2:return o=u.sent().provider_token,s=void 0,i.type===x?[4,this.oauthInstance.authApi.toBindIdentity({provider_token:o,provider:a,fireEvent:!0})]:[3,4];case 3:return s=u.sent(),[3,6];case 4:return[4,this.signInWithIdToken({token:o})];case 5:(s=u.sent()).data=B(B({},t),s.data),u.label=6;case 6:return(c=new URLSearchParams(location==null?void 0:location.search)).delete(`code`),c.delete(`state`),s.data.redirectUrl=function(e,t){if(e!==void 0){var n=new URL(window.location.href);return n.search=e,n.hash=t||n.hash,window.history.replaceState({},``,n.href),n.href}}(i?.search===void 0?`?${c.toString()}`:i?.search,i?.hash||location.hash),function(e){try{return sessionStorage.removeItem(e),!0}catch(e){return console.error(`Failed to remove browser session:`,e),null}}(r),[2,s];case 7:return l=u.sent(),[2,{data:B(B({},t),{user:null,session:null,redirectUrl:null}),error:new I(l,{method:`verifyOAuth`})}];case 8:return[2]}})})},n.prototype.signInWithOAuth=function(e){var t,n;return H(this,void 0,Promise,function(){var r,i,a,o,s,c,l,u,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`signInWithOAuth`),r=e.options?.redirectTo||location.href,i=new URL(r),a=i.origin+i.pathname,o=e.options?.state||`prd-${e.provider}-${Math.random().toString(36).slice(2)}`,[4,this.genProviderRedirectUri({provider_id:e.provider,provider_redirect_uri:a,state:o})];case 1:return s=f.sent().uri,c=decodeURIComponent(s),l=c,(t=e.options)!=null&&t.queryParams&&(u=new URL(c),Object.entries(e.options.queryParams).forEach(function(e){var t=e[0],n=e[1];u.searchParams.set(t,n)}),l=u.toString()),function(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){console.error(`Failed to save to browser session:`,e)}}(o,{provider:e.provider,search:i.search,hash:i.hash,type:e.options?.type||y}),Et()&&!((n=e.options)!=null&&n.skipBrowserRedirect)&&window.location.assign(l),[2,{data:{url:l,provider:e.provider},error:null}];case 2:return d=f.sent(),[2,{data:{url:null,provider:null},error:new I(d,{method:`signInWithOAuth`})}];case 3:return[2]}})})},n.prototype.getClaims=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.getAccessToken()];case 1:return[2,{data:function(e){if(typeof e!=`string`)throw Error(`Invalid token specified`);try{var t=e.split(`.`).map(function(e,t){return t===2?e:JSON.parse(function(e){var t=e.replace(/-/g,`+`).replace(/_/g,`/`);switch(t.length%4){case 0:break;case 2:t+=`==`;break;case 3:t+=`=`;break;default:throw Error(`Illegal base64url string!`)}try{return function(e){return decodeURIComponent(k(e).replace(/(.)/g,function(e){var t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t=`0${t}`),`%${t}`}))}(t)}catch{return k(t)}}(e))});return{claims:t[1],header:t[0],signature:t[2]}}catch(e){throw Error(`Invalid token specified: ${e}`?e.message:0)}}(t.sent().accessToken),error:null}];case 2:return e=t.sent(),[2,{data:{claims:null,header:null,signature:null},error:new I(e,{method:`getClaims`})}];case 3:return[2]}})})},n.prototype.resetPasswordForEmail=function(e,t){return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l=this;return U(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),this.validateParams({emailOrPhone:e},{emailOrPhone:{required:!0,message:`Email or phone is required`}},`resetPasswordForEmail`),n=(t||{}).redirectTo,r=e.includes(`@`),i=void 0,r?i={email:e,usage:c.RECOVERY}:(a=this.formatPhone(e),i={phone_number:a}),[4,this.getVerification(B(B({},i),{target:`USER`}))];case 1:return o=u.sent(),[2,{data:{updateUser:function(t){return H(l,void 0,Promise,function(){var i,a,s,c;return U(this,function(l){switch(l.label){case 0:this.validateParams(t,{nonce:{required:!0,message:`Nonce is required`},password:{required:!0,message:`Password is required`}},`resetPasswordForEmail`),l.label=1;case 1:return l.trys.push([1,5,,6]),[4,this.verify({verification_id:o.verification_id,verification_code:t.nonce})];case 2:return i=l.sent(),[4,this.oauthInstance.authApi.resetPassword({email:r?e:void 0,phone_number:r?void 0:e,new_password:t.password,verification_token:i.verification_token})];case 3:return l.sent(),(c=this.config.eventBus)==null||c.fire(v,{event:`PASSWORD_RECOVERY`}),[4,this.signInWithPassword({email:r?e:void 0,phone:r?void 0:e,password:t.password})];case 4:return a=l.sent(),n&&Et()&&window.location.assign(n),[2,a];case 5:return s=l.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 6:return[2]}})})}},error:null}];case 2:return s=u.sent(),[2,{data:{updateUser:null},error:new I(s,{method:`resetPasswordForEmail`})}];case 3:return[2]}})})},n.prototype.resetPasswordForOld=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.authApi.updatePasswordByOld({old_password:e.old_password,new_password:e.new_password})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`resetPasswordForOld`})}];case 4:return[2]}})})},n.prototype.verifyOtp=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:return c.trys.push([0,6,,7]),t=e.type,n=String(e.token),r=`email`in e?e.email:void 0,i=`phone`in e?e.phone:void 0,this.validateParams(e,{token:{required:!0,message:`Token is required`},messageId:{required:!0,message:`messageId is required`}},`verifyOtp`),[`phone_change`,`email_change`].includes(t)?[4,this.verify({verification_id:e.messageId,verification_code:n})]:[3,2];case 1:return c.sent(),[3,4];case 2:return[4,this.signInWithUsername({verificationInfo:{verification_id:e.messageId,is_user:!0},verificationCode:n,username:r||this.formatPhone(i)||``,loginType:r?`email`:`phone`})];case 3:c.sent(),c.label=4;case 4:return[4,this.getSession()];case 5:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 6:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`verifyOtp`})}];case 7:return[2]}})})},n.prototype.getSession=function(){return H(this,void 0,Promise,function(){var e,t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(e=i.sent())&&e.scope!==`accessKey`?[4,this.getUser(!1)]:[2,{data:{session:null,user:null},error:null}];case 2:return t=i.sent().data,n=(t===void 0?{}:t).user,[2,{data:{session:B(B({},e),{user:n}),user:n},error:null}];case 3:return r=i.sent(),[2,{data:{session:null,user:null},error:new I(r,{method:`getSession`})}];case 4:return[2]}})})},n.prototype.refreshSession=function(e){return H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return(t=o.sent()).refresh_token=e||t.refresh_token,[4,this.oauthInstance.oauth2client.refreshToken(t)];case 2:return n=o.sent(),[4,this.getUser(!1)];case 3:return r=o.sent().data,[2,{data:{user:i=(r===void 0?{}:r).user,session:B(B({},n),{user:i})},error:null}];case 4:return a=o.sent(),[2,{data:{user:null,session:null},error:new I(a,{method:`refreshSession`})}];case 5:return[2]}})})},n.prototype.getUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(t=i.sent())&&t.scope!==`accessKey`?(n=this.convertToUser,[4,this.getCurrentUser(e)]):[2,{data:{user:null},error:null}];case 2:return[2,{data:{user:n.apply(this,[i.sent()])},error:null}];case 3:return r=i.sent(),[2,{data:{user:null},error:new I(r,{method:`getUser`})}];case 4:return[2]}})})},n.prototype.refreshUser=function(){return H(this,void 0,Promise,function(){var e,t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),[4,this.currentUser.refresh()];case 1:return r.sent(),[4,this.getSession()];case 2:return e=r.sent().data,[2,{data:{user:(t=(e===void 0?{}:e).session).user,session:t},error:null}];case 3:return n=r.sent(),[2,{data:{user:null,session:null},error:new I(n,{method:`refreshUser`})}];case 4:return[2]}})})},n.prototype.updateUser=function(e){var t;return H(this,void 0,Promise,function(){var n,r,i,a,o,s,l,u,d,f,p,m,g,_=this;return U(this,function(y){switch(y.label){case 0:if(y.trys.push([0,8,,9]),At(e,`updateUser`),n=[`password`,`new_password`].find(function(t){var n=e[t];return n!=null&&n!==``}))throw new I({message:`updateUser 不支持更新密码,检测到传入了 "${n}" 参数。如需修改密码请使用 resetPasswordForOld(旧密码修改)、resetPasswordForEmail(验证码重置)或 reauthenticate(重新认证后改密)`});if(!Object.keys(e).some(function(t){return e[t]!==void 0&&e[t]!==null&&e[t]!==``}))throw this.missingRequiredParam(`updateUser`,`(at least one field)`);return r=e.email,i=e.phone,a=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,[`email`,`phone`]),s=i!==void 0,l={},(o=r!==void 0)||s?(u=void 0,o?(u={email:e.email,usage:c.REAUTHENTICATION},d=`email_change`):(f=this.formatPhone(e.phone),u={phone_number:f},d=`phone_change`),[4,this.getVerification(B({},u))]):[3,4];case 1:return p=y.sent(),Object.keys(a).length>0?[4,this.updateUserBasicInfo(a)]:[3,3];case 2:y.sent(),y.label=3;case 3:return l={messageId:p.verification_id,verifyOtp:function(t){return H(_,void 0,Promise,function(){var n,r,i,a;return U(this,function(s){switch(s.label){case 0:return s.trys.push([0,11,,12]),t.email&&e.email===t.email?[4,this.verifyOtp({type:`email_change`,email:e.email,token:t.token,messageId:p.verification_id||``})]:[3,3];case 1:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({email:e.email})];case 2:return s.sent(),[3,9];case 3:return t.phone&&e.phone===t.phone?[4,this.verifyOtp({type:`phone_change`,phone:e.phone,token:t.token,messageId:p.verification_id||``})]:[3,6];case 4:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo({phone:this.formatPhone(e.phone)})];case 5:return s.sent(),[3,9];case 6:return[4,this.verifyOtp(o?{type:d,email:e.email,token:t.token,messageId:p.verification_id||``}:{type:d,phone:e.phone,token:t.token,messageId:p.verification_id||``})];case 7:return(n=s.sent()).error?[2,n]:[4,this.updateUserBasicInfo(e)];case 8:s.sent(),s.label=9;case 9:return[4,this.getUser(!1)];case 10:return r=s.sent().data.user,(a=this.config.eventBus)==null||a.fire(v,{event:h}),[2,{data:{user:r},error:null}];case 11:return i=s.sent(),[2,{data:{user:null},error:new I(i,{method:`updateUser`})}];case 12:return[2]}})})}},[3,6];case 4:return[4,this.updateUserBasicInfo(e)];case 5:y.sent(),y.label=6;case 6:return[4,this.getUser(!1)];case 7:return m=y.sent().data.user,Object.keys(a).length>0&&((t=this.config.eventBus)==null||t.fire(v,{event:h})),[2,{data:B({user:m},l),error:null}];case 8:return g=y.sent(),[2,{data:{user:null},error:new I(g,{method:`updateUser`})}];case 9:return[2]}})})},n.prototype.getUserIdentities=function(){return H(this,void 0,Promise,function(){var e,t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.oauthInstance.authApi.getProviders()];case 1:return e=n.sent(),[2,{data:{identities:(e?.data)?.filter(function(e){return!!e.bind})},error:null}];case 2:return t=n.sent(),[2,{data:{identities:null},error:new I(t,{method:`getUserIdentities`})}];case 3:return[2]}})})},n.prototype.linkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`linkIdentity`),[4,this.signInWithOAuth({provider:e.provider,options:{type:x}})];case 1:return n.sent(),[2,{data:{provider:e.provider},error:null}];case 2:return t=n.sent(),[2,{data:{provider:null},error:new I(t,{method:`linkIdentity`})}];case 3:return[2]}})})},n.prototype.unlinkIdentity=function(e){return H(this,void 0,Promise,function(){var t;return U(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:`Provider is required`}},`unlinkIdentity`),[4,this.oauthInstance.authApi.unbindProvider({provider_id:e.provider})];case 1:return n.sent(),[2,{data:{},error:null}];case 2:return t=n.sent(),[2,{data:{},error:new I(t,{method:`unlinkIdentity`})}];case 3:return[2]}})})},n.prototype.reauthenticate=function(){return H(this,void 0,Promise,function(){var e,t,n,r,i=this;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getUser(!1)];case 1:return e=a.sent().data.user,this.validateAtLeastOne(e,[[`email`,`phone`]],`reauthenticate`),t=e.email?{email:e.email,usage:c.REAUTHENTICATION}:{phone_number:this.formatPhone(e.phone)},[4,this.getVerification(t)];case 2:return n=a.sent(),[2,{data:{updateUser:function(e){return H(i,void 0,Promise,function(){var r,i,a,o,s;return U(this,function(c){switch(c.label){case 0:this.validateParams(e,{nonce:{required:!0,message:`Nonce is required`}},`reauthenticate`),c.label=1;case 1:return c.trys.push([1,9,,10]),e.password?[4,this.verify({verification_id:n.verification_id,verification_code:e.nonce})]:[3,5];case 2:return r=c.sent(),[4,this.oauthInstance.authApi.sudo({verification_token:r.verification_token})];case 3:return i=c.sent(),[4,this.oauthInstance.authApi.setPassword({new_password:e.password,sudo_token:i.sudo_token})];case 4:return c.sent(),[3,7];case 5:return[4,this.signInWithUsername(B(B({verificationInfo:n,verificationCode:e.nonce},t),{loginType:t.email?`email`:`phone`}))];case 6:c.sent(),c.label=7;case 7:return[4,this.getSession()];case 8:return a=c.sent().data,[2,{data:{user:(o=(a===void 0?{}:a).session).user,session:o},error:null}];case 9:return s=c.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`reauthenticate`})}];case 10:return[2]}})})}},error:null}];case 3:return r=a.sent(),[2,{data:{updateUser:null},error:new I(r,{method:`reauthenticate`})}];case 4:return[2]}})})},n.prototype.resend=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.validateAtLeastOne(e,[[`email`],[`phone`]],`resend`),t=e.type===`signup`?`ANY`:`USER`,n={target:t},`email`in e&&(n.email=e.email,n.usage=c.EMAIL),`phone`in e&&(n.phone_number=this.formatPhone(e.phone)),[4,this.oauthInstance.authApi.getVerification(n)];case 1:return[2,{data:{messageId:i.sent().verification_id},error:null}];case 2:return r=i.sent(),[2,{data:{messageId:null},error:new I(r,{method:`resend`})}];case 3:return[2]}})})},n.prototype.setSession=function(e){return H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{access_token:{required:!0,message:`Access token is required`},refresh_token:{required:!0,message:`Refresh token is required`}},`setSession`),[4,this.oauthInstance.oauth2client.refreshToken(e,{throwError:!0})];case 1:return i.sent(),[4,this.getSession()];case 2:return t=i.sent().data,[2,{data:{user:(n=(t===void 0?{}:t).session).user,session:n},error:null}];case 3:return r=i.sent(),[2,{data:{user:null,session:null},error:new I(r,{method:`setSession`})}];case 4:return[2]}})})},n.prototype.exchangeCodeForSession=function(){return H(this,void 0,void 0,function(){return U(this,function(e){return[2]})})},n.prototype.deleteUser=function(e){return H(this,void 0,Promise,function(){var t,n;return U(this,function(r){switch(r.label){case 0:return r.trys.push([0,3,,4]),this.validateParams(e,{password:{required:!0,message:`Password is required`}},`deleteUser`),[4,this.oauthInstance.authApi.sudo(e)];case 1:return t=r.sent().sudo_token,[4,this.oauthInstance.authApi.deleteMe({sudo_token:t})];case 2:return r.sent(),[2,{data:{},error:null}];case 3:return n=r.sent(),[2,{data:{},error:new I(n,{method:`deleteUser`})}];case 4:return[2]}})})},n.prototype.toDefaultLoginPage=function(e){return e===void 0&&(e={}),H(this,void 0,Promise,function(){var t,n,r,i,a;return U(this,function(o){try{return t=e.config_version||`env`,n=Object.keys(e.query||{}).map(function(t){return`${t}=${e.query[t]}`}).join(`&`),ct.default.isMatch()?wx.navigateTo({url:`/packages/\$wd_system/pages/login/index${n?`?${n}`:``}`}):(r=e.redirect_uri||window.location.href,i=new URL(r),a=`${i.origin}/__auth/?app_id=${e.app_id||``}&env_id=${this.config.env}&client_id=${this.config.clientId||this.config.env}&config_version=${t}&redirect_uri=${encodeURIComponent(r)}${n?`&${n}`:``}`,window.location.href=a),[2,{data:{},error:null}]}catch(e){return[2,{data:{},error:new I(e,{method:`toDefaultLoginPage`})}]}})})},n.prototype.signInWithCustomTicket=function(e){return H(this,void 0,Promise,function(){var t,n,r,i;return U(this,function(a){switch(a.label){case 0:e&&this.setCustomSignFunc(e),a.label=1;case 1:return a.trys.push([1,5,,6]),[4,this.oauthInstance.authApi.signInWithCustomTicket()];case 2:return a.sent(),[4,this.createLoginState()];case 3:return t=a.sent(),[4,this.getSession()];case 4:return n=a.sent().data,r=(n===void 0?{}:n).session,[2,B(B({},t),{data:{user:r.user,session:r},error:null})];case 5:return i=a.sent(),[2,{data:{user:null,session:null},error:new I(i,{method:`signInWithCustomTicket`})}];case 6:return[2]}})})},n.prototype.signInWithOpenId=function(e){var t=(e===void 0?{}:e).useWxCloud,n=t===void 0||t;return H(this,void 0,Promise,function(){var e,t,r,i,a,o,s=this;return U(this,function(c){switch(c.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(s,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},n)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:r.provider_token},n)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(i)];case 6:return a.sent(),[2]}})})},c.label=1;case 1:return c.trys.push([1,5,,6]),[4,new Promise(function(e,n){wx.login({success:function(r){return H(s,void 0,void 0,function(){var i;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(r.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return i=a.sent(),n(i),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return c.sent(),[4,this.createLoginState()];case 3:return r=c.sent(),[4,this.getSession()];case 4:return i=c.sent().data,a=(i===void 0?{}:i).session,[2,B(B({},r),{data:{user:a.user,session:a},error:null})];case 5:return o=c.sent(),[2,{data:{user:null,session:null},error:new I(o,{method:`signInWithOpenId`})}];case 6:return[2]}})})},n.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,n=t===void 0?``:t,r=e.useWxCloud,i=r!==void 0&&r;return H(this,void 0,Promise,function(){var e,t,r,a,o,s,c,l,u;return U(this,function(d){switch(d.label){case 0:return ct.default.isMatch()?(e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:`phone`,code:n,appid:e.appId},provider_id:e.appId},[4,wx.login()]):[2,{data:{user:null,session:null},error:new I({message:`wx api undefined`})}];case 1:r=d.sent().code,t.provider_code=r,d.label=2;case 2:return d.trys.push([2,5,,6]),[4,this.oauthInstance.authApi.grantProviderToken(t,i)];case 3:if((a=d.sent()).error_code)throw a;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:a.provider_token},i)];case 4:if((o=d.sent())?.error_code)throw o;return[3,6];case 5:return s=d.sent(),[2,{data:{user:null,session:null},error:new I(s,{method:`signInWithPhoneAuth`})}];case 6:return[4,this.createLoginState()];case 7:return c=d.sent(),[4,this.getSession()];case 8:return l=d.sent().data,u=(l===void 0?{}:l).session,[2,B(B({},c),{data:{user:u.user,session:u},error:null})]}})})},n.prototype.bindPhoneNumber=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.editContact(e)]})})},n.prototype.unbindProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]})})},n.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},n.prototype.verify=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verify(e)]})})},n.prototype.getVerification=function(e,t){return H(this,void 0,Promise,function(){return U(this,function(n){return e.phone_number&&=this.formatPhone(e.phone_number),[2,this.oauthInstance.authApi.getVerification(e,t)]})})},Object.defineProperty(n.prototype,"currentUser",{get:function(){if(this.cache.mode!==`async`){var e=this.hasLoginState();return e&&e.user||null}(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getCurrentUser instead`)},enumerable:!1,configurable:!0}),n.prototype.getCurrentUser=function(e){return e===void 0&&(e=!0),H(this,void 0,Promise,function(){var t,n,r;return U(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e?[4,this.getLoginState()]:[3,3];case 1:return(t=i.sent())?[4,t.user.refresh()]:[3,3];case 2:i.sent(),i.label=3;case 3:return[3,5];case 4:return i.sent(),[3,5];case 5:return[4,this.getLoginState()];case 6:return(n=i.sent())?(r=n.user.getLocalUserInfo(),[4,n.user.checkLocalInfoAsync()]):[3,8];case 7:return i.sent(),[2,B(B({},n.user),r)];case 8:return[2,null]}})})},n.prototype.signInAnonymouslyInWx=function(e){var t=(e===void 0?{}:e).useWxCloud;return H(this,void 0,Promise,function(){var e,n,r=this;return U(this,function(i){switch(i.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,n=function(n){return H(r,void 0,void 0,function(){var r,i;return U(this,function(a){switch(a.label){case 0:r=void 0,i=void 0,a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:n,provider_params:{provider_code_type:`open_id`,appid:e?.appId}},t)];case 2:if((r=a.sent())?.error_code||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.signInAnonymously({provider_token:r.provider_token},t)];case 3:if((i=a.sent())?.error_code)throw i;return[3,5];case 4:throw a.sent();case 5:return[2]}})})},[4,new Promise(function(e,t){wx.login({success:function(i){return H(r,void 0,void 0,function(){var r;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,n(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return r=a.sent(),t(r),[3,3];case 3:return[2]}})})},fail:function(e){var n=Error(e?.errMsg);n.code=e?.errno,t(n)}})})];case 1:return i.sent(),[2,this.createLoginState(void 0,{asyncRefreshUser:!0})]}})})},n.prototype.bindOpenId=function(){return H(this,void 0,Promise,function(){var e,t,n=this;return U(this,function(r){switch(r.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);return e=wx.getAccountInfoSync().miniProgram,t=function(t){return H(n,void 0,void 0,function(){var n;return U(this,function(r){switch(r.label){case 0:n=void 0,r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:e?.appId,provider_code:t,provider_params:{provider_code_type:`open_id`,appid:e?.appId}})];case 2:if((n=r.sent())?.error_code||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.bindWithProvider({provider_token:n.provider_token})];case 3:return r.sent(),[3,5];case 4:throw r.sent();case 5:return[2]}})})},[4,new Promise(function(e,r){wx.login({success:function(i){return H(n,void 0,void 0,function(){var n;return U(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,t(i.code)];case 1:return a.sent(),e(!0),[3,3];case 2:return n=a.sent(),r(n),[3,3];case 3:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,r(t)}})})];case 1:return r.sent(),[2]}})})},n.prototype.signInWithUnionId=function(){return H(this,void 0,Promise,function(){var e=this;return U(this,function(t){switch(t.label){case 0:if(!ct.default.isMatch())throw Error(`wx api undefined`);t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise(function(t,n){var r=wx.getAccountInfoSync().miniProgram;wx.login({success:function(i){return H(e,void 0,void 0,function(){var e,a,o,s,c;return U(this,function(l){switch(l.label){case 0:e=r?.appId,l.label=1;case 1:return l.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:i.code,provider_id:e,provider_params:{provider_code_type:`union_id`,appid:r?.appId}})];case 2:return a=l.sent(),(o=a.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:o})]:(n(a),[2]);case 3:return(s=l.sent())?.error_code?(n(s),[2]):(t(!0),[3,5]);case 4:return c=l.sent(),n(c),[3,5];case 5:return[2]}})})},fail:function(e){var t=Error(e?.errMsg);t.code=e?.errno,n(t)}})})];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}})})},n.prototype.signInWithSms=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.phoneNum,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:c,username:o,loginType:`sms`})]}catch(e){throw e}})})},n.prototype.signInWithEmail=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.bindInfo,o=a===void 0?void 0:a,s=e.email,c=s===void 0?``:s;return H(this,void 0,Promise,function(){return U(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:n,verificationCode:i,bindInfo:o,username:c,loginType:`email`})]}catch(e){throw e}})})},n.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},n.prototype.signIn=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.setPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.setPassword(e)]})})},n.prototype.isUsernameRegistered=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return typeof e!=`string`&&(0,Ie.throwError)(z.ERRORS.INVALID_PARAMS,`username must be a string`),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}})})},n.prototype.hasLoginState=function(){if(this.cache.mode!==`async`)return this.oauthInstance?.authApi.hasLoginStateSync()?new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;(0,Ie.printWarn)(z.ERRORS.INVALID_OPERATION,`current platform's storage is asynchronous, please use getLoginState instead`)},n.prototype.getLoginState=function(){return H(this,void 0,Promise,function(){var e;return U(this,function(t){switch(t.label){case 0:e=null,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.oauthInstance.authApi.getLoginState()];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,null];case 4:return e?[2,new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}})})},n.prototype.getUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.getCurrentUser()]})})},n.prototype.getWedaUserInfo=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]})})},n.prototype.updateUserBasicInfo=function(e){return H(this,void 0,void 0,function(){var t;return U(this,function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return(t=n.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},n.prototype.getAuthHeader=function(){return console.error(`Auth.getAuthHeader API 已废弃`),{}},n.prototype.bindWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]})})},n.prototype.queryUser=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]})})},n.prototype.getAccessToken=function(){return H(this,void 0,Promise,function(){return U(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}})})},n.prototype.grantProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]})})},n.prototype.patchProviderToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]})})},n.prototype.signInWithProvider=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.signInWithWechat=function(e){return e===void 0&&(e={}),H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},n.prototype.grantToken=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}})})},n.prototype.genProviderRedirectUri=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]})})},n.prototype.resetPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]})})},n.prototype.deviceAuthorize=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]})})},n.prototype.sudo=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.sudo(e)]})})},n.prototype.deleteMe=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]})})},n.prototype.getProviders=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviders()]})})},n.prototype.loginScope=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginScope()]})})},n.prototype.loginGroups=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.loginGroups()]})})},n.prototype.onLoginStateChanged=function(e){var t;return H(this,void 0,void 0,function(){var n,r=this;return U(this,function(i){switch(i.label){case 0:return(t=this.config.eventBus)==null||t.on(_,function(t){return H(r,void 0,void 0,function(){var n,r;return U(this,function(i){switch(i.label){case 0:return t?.data?.eventType===u?[3,2]:[4,this.getLoginState()];case 1:return r=i.sent(),[3,3];case 2:r={},i.label=3;case 3:return n=r,e.call(this,B(B({},t),n)),[2]}})})}),[4,this.getLoginState()];case 1:return n=i.sent(),e.call(this,n),[2]}})})},n.prototype.refreshTokenForce=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]})})},n.prototype.getCredentials=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getCredentials()]})})},n.prototype.setCredentials=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}})})},n.prototype.getProviderSubType=function(){return H(this,void 0,Promise,function(){return U(this,function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]})})},n.prototype.createCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]})})},n.prototype.verifyCaptchaData=function(e){return H(this,void 0,void 0,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]})})},n.prototype.getMiniProgramQrCode=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]})})},n.prototype.getMiniProgramQrCodeStatus=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]})})},n.prototype.modifyPassword=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]})})},n.prototype.modifyPasswordWithoutLogin=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.modifyPasswordWithoutLogin(e)]})})},n.prototype.getUserBehaviorLog=function(e){return H(this,void 0,Promise,function(){return U(this,function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]})})},n.prototype.signInWithUsername=function(e){var t=e.verificationInfo,n=t===void 0?{verification_id:``,is_user:!1}:t,r=e.verificationCode,i=r===void 0?``:r,a=e.username,o=a===void 0?``:a,s=e.bindInfo,c=s===void 0?void 0:s,l=e.loginType,u=l===void 0?``:l;return H(this,void 0,Promise,function(){var e,t,r,a,s,l,d;return U(this,function(f){switch(f.label){case 0:return f.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:n.verification_id,verification_code:i})];case 1:if((e=f.sent())?.error_code)throw e;return t=e.verification_token,r=this.formatPhone(o),a={phone_number:r},u===`email`&&(a={email:r=o}),n.is_user?[4,this.oauthInstance.authApi.signIn({username:r,verification_token:t})]:[3,5];case 2:if((s=f.sent())?.error_code)throw s;return c?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:c?.providerToken})]:[3,4];case 3:if((l=f.sent())?.error_code)throw l;f.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp(B(B({},a),{verification_token:t,provider_token:c?.providerId}))];case 6:if((d=f.sent())?.error_code)throw d;f.label=7;case 7:return[2,this.createLoginState()];case 8:throw f.sent();case 9:return[2]}})})},n.prototype.createLoginState=function(e,t){return H(this,void 0,Promise,function(){var n;return U(this,function(r){switch(r.label){case 0:return[4,(n=new Nt({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return r.sent(),t?.userInfo?(n.user.setLocalUserInfo(t.userInfo),[3,5]):[3,2];case 2:return t?.asyncRefreshUser?(n.user.refresh(e),[3,5]):[3,3];case 3:return[4,n.user.refresh(e)];case 4:r.sent(),r.label=5;case 5:return[2,n]}})})},n.prototype.setAccessKey=function(){var e,t;return H(this,void 0,void 0,function(){var n,r;return U(this,function(i){if(n=``,r=``,this.config.accessKey?(n=this.config.accessKey,r=`accessKey`):(e=this.config.auth)!=null&&e.secretId&&(t=this.config.auth)!=null&&t.secretKey&&(n=``,r=S),!r)return[2];try{this.oauthInstance.oauth2client.setAccessKeyCredentials({access_token:n,token_type:`Bearer`,scope:r,expires_at:new Date(+new Date+ +new Date),expires_in:+new Date+ +new Date})}catch(e){console.warn(`accessKey error: `,e)}return[2]})})},n.prototype.formatPhone=function(e){return!/\s+/.test(e)&&/^\+\d{1,3}\d+/.test(e)?e.replace(/^(\+\d{1,2})(\d+)$/,`$1 $2`):/^\+\d{1,3}\s+/.test(e)?e:`+86 ${e}`},n.prototype.notifyListeners=function(e,t,n){this.listeners.forEach(function(r){r.forEach(function(r){try{r(e,t,n)}catch(e){console.error(`Error in auth state change callback:`,e)}})})},n.prototype.setupListeners=function(){var e,t=this;(e=this.config.eventBus)==null||e.on(v,function(e){return H(t,void 0,void 0,function(){var t,n,r,i,a;return U(this,function(o){switch(o.label){case 0:return t=e?.data?.event,n=e?.data?.info,t!==f||n?[3,2]:[4,this.getUser(!0)];case 1:r=o.sent().data,(i=(r===void 0?{}:r).user)&&(n={user:i}),o.label=2;case 2:return[4,this.getSession()];case 3:return a=o.sent().data.session,this.notifyListeners(t,a,n),[2]}})})})},n.prototype.convertToUser=function(e){var t;if(!e)return null;var n=e?.email||``,r=e?.phone_number||``,i=e?.sub||e?.uid||``;return{id:i,aud:`authenticated`,role:((t=e.groups)?.map)?.call(t,function(e){return typeof e==`string`?e:e.id}),email:n||``,email_confirmed_at:(e?.email_verified,e.created_at),phone:r,phone_confirmed_at:r?e.created_at:void 0,confirmed_at:e.created_at,last_sign_in_at:e.last_sign_in_at,app_metadata:{provider:e.loginType?.toLowerCase()||`cloudbase`,providers:[e.loginType?.toLowerCase()||`cloudbase`]},user_metadata:{name:e?.name,picture:e?.picture,username:e?.username,gender:e?.gender,locale:e?.locale,uid:e.uid,nickName:e.nickName||e?.name,avatarUrl:e.avatarUrl||e.picture,location:e.location,hasPassword:e.hasPassword??e.password===`SET`,open_id:e?.open_id},identities:(e?.providers)?.map(function(t){return{id:t.id||``,identity_id:t.id||``,user_id:i,identity_data:{provider_id:t.id,provider_user_id:t.provider_user_id,name:t.name},provider:t.id||`cloudbase`,created_at:e.created_at,updated_at:e.updated_at,last_sign_in_at:e.last_sign_in_at}})||[],created_at:e.created_at,updated_at:e.updated_at,is_anonymous:e.name===`anonymous`}},n.prototype.missingRequiredParam=function(e,t){return new I({error:`missing_required_param`,error_code:4e3,error_description:`auth.${e}(params): missing required param '${t}'`},{method:e})},n.prototype.validateParams=function(e,t,n){for(var r=0,i=Object.entries(t);r<i.length;r++){var a=i[r],o=a[0];if(a[1].required&&(e?.[o]===void 0||e?.[o]===null||e?.[o]===``))throw this.missingRequiredParam(n,o)}},n.prototype.validateAtLeastOne=function(e,t,n){if(!t.some(function(t){return t.some(function(t){return e?.[t]!==void 0&&e?.[t]!==null&&e?.[t]!==``})}))throw this.missingRequiredParam(n,t.map(function(e){return e.join(`|`)}).join(`|`))},n.prototype.init=function(){var e;return H(this,void 0,Promise,function(){return U(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return t.sent()&&!this.oauthInstance.oauth2client.initSessionEmitted&&((e=this.config.eventBus)==null||e.fire(v,{event:p})),[3,3];case 2:return t.sent(),[3,3];case 3:return[2,{error:null}]}})})},Tt([(0,ot.catchErrorsDecorator)({title:`绑定手机号失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确`,` 2 - 当前环境是否开通了短信验证码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(r=e.BindPhoneRequest)==`function`?r:Object]),V(`design:returntype`,Promise)],n.prototype,`bindPhoneNumber`,null),Tt([(0,ot.catchErrorsDecorator)({title:`解除三方绑定失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().unbindProvider() 的语法或参数是否正确`,` 2 - 当前账户是否已经与此登录方式解绑`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(i=e.UnbindProviderRequest)==`function`?i:Object]),V(`design:returntype`,typeof(a=typeof Promise<`u`&&Promise)==`function`?a:Object)],n.prototype,`unbindProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定邮箱地址失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindEmail() 的语法或参数是否正确`,` 2 - 当前环境是否开通了邮箱密码登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(o=e.BindEmailRequest)==`function`?o:Object]),V(`design:returntype`,void 0)],n.prototype,`bindEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`验证码验证失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().verify() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(s=e.VerifyRequest)==`function`?s:Object]),V(`design:returntype`,typeof(l=typeof Promise<`u`&&Promise)==`function`?l:Object)],n.prototype,`verify`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取验证码失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getVerification() 的语法或参数是否正确`,` 2 - 当前环境是否开通了手机验证码/邮箱登录`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(d=e.GetVerificationRequest)==`function`?d:Object,Object]),V(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],n.prototype,`getVerification`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(g=typeof Promise<`u`&&Promise)==`function`?g:Object)],n.prototype,`getCurrentUser`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序匿名登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了匿名登录`,` 2 - 调用 auth().signInAnonymouslyInWx() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(b=typeof Promise<`u`&&Promise)==`function`?b:Object)],n.prototype,`signInAnonymouslyInWx`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序绑定OpenID失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序openId静默登录`,` 2 - 调用 auth().bindOpenId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(C=typeof Promise<`u`&&Promise)==`function`?C:Object)],n.prototype,`bindOpenId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`小程序unionId静默登录失败`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序unionId静默登录`,` 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(w=typeof Promise<`u`&&Promise)==`function`?w:Object)],n.prototype,`signInWithUnionId`,null),Tt([(0,ot.catchErrorsDecorator)({title:`短信验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了小程序短信验证码登陆`,` 2 - 调用 auth().signInWithSms() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(T=typeof Promise<`u`&&Promise)==`function`?T:Object)],n.prototype,`signInWithSms`,null),Tt([(0,ot.catchErrorsDecorator)({title:`邮箱验证码登陆`,messages:[`请确认以下各项:`,` 1 - 当前环境是否开启了邮箱登陆`,` 2 - 调用 auth().signInWithEmail() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[Object]),V(`design:returntype`,typeof(E=typeof Promise<`u`&&Promise)==`function`?E:Object)],n.prototype,`signInWithEmail`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户是否被占用失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[String]),V(`design:returntype`,typeof(D=typeof Promise<`u`&&Promise)==`function`?D:Object)],n.prototype,`isUsernameRegistered`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取本地登录态失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getLoginState() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(ee=typeof Promise<`u`&&Promise)==`function`?ee:Object)],n.prototype,`getLoginState`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(te=typeof Promise<`u`&&Promise)==`function`?te:Object)],n.prototype,`getUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取微搭插件用户信息失败`,messages:[`请确认以下各项:`,` 1 - 是否已登录`,` 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(O=typeof Promise<`u`&&Promise)==`function`?O:Object)],n.prototype,`getWedaUserInfo`,null),Tt([(0,ot.catchErrorsDecorator)({title:`绑定第三方登录方式失败`,messages:[`请确认以下各项:`,` 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确`,` 2 - 此账户是否已经绑定此第三方`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[typeof(A=e.BindWithProviderRequest)==`function`?A:Object]),V(`design:returntype`,typeof(ne=typeof Promise<`u`&&Promise)==`function`?ne:Object)],n.prototype,`bindWithProvider`,null),Tt([(0,ot.catchErrorsDecorator)({title:`获取身份源类型`,messages:[`请确认以下各项:`,` 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${z.COMMUNITY_SITE_URL}`]}),V(`design:type`,Function),V(`design:paramtypes`,[]),V(`design:returntype`,typeof(re=typeof Promise<`u`&&Promise)==`function`?re:Object)],n.prototype,`getProviderSubType`,null),n}(Ct),Ft=`auth`;function It(e,t){for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var i=0;i<=t.length;i++)n[0][i]=i;for(r=1;r<=e.length;r++)for(i=1;i<=t.length;i++){var a=e[r-1].toLowerCase()===t[i-1].toLowerCase()?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+a)}return n[e.length][t.length]}var Lt={name:`auth`,namespace:Ft,entity:function(e){var t=function(e){var t=this;if(this.authInstance&&!e)return this.authInstance;e||={region:``,persistence:`local`,apiPath:s};var n=this.platform.adapter,r=e.persistence||n.primaryStorage;r&&r!==this.config.persistence&&this.updateConfig({persistence:r});var i=function(e,t){var n=this,r=e.region,i=r===void 0?`ap-shanghai`:r,a=e.i18n,o=e.accessKey,c=e.useWxCloud,l=t?.platform||lt.useDefaultAdapter.bind(t)(),u=l.runtime,d=l.adapter,p=t||{},m=p.env,h=p.clientId,_=p.debug,b=p.cache,S=p.app,C=p.getApiOrigin,w=(t||{}).apiOrigin;w||=`https://${m}.${i}.tcb-api.tencentcloudapi.com`;var T={env:m,clientId:h,i18n:a,accessKey:o,useWxCloud:c,eventBus:new Fe.CloudbaseEventEmitter},E=new at(gt(B(B({},T),{apiOrigin:w,getApiOrigin:C,apiPath:e?.apiPath||s,storage:e?.storage,baseRequest:e?.baseRequest,request:e?.request,anonymousSignInFunc:e?.anonymousSignInFunc,captchaOptions:e?.captchaOptions,wxCloud:e?.wxCloud,adapter:d,onCredentialsError:Dt(T.eventBus),headers:B({"X-SDK-Version":`@cloudbase/js-sdk/${e.sdkVersion}`},e.headers||{}),detectSessionInUrl:e.detectSessionInUrl,debug:_,auth:t.app?.config?.auth}))),D=new Pt(B(B({},T),{region:i,persistence:e.persistence,debug:_,cache:b||new st.CloudbaseCache({persistence:e.persistence,keys:{userInfoKey:`user_info_${m}`},platformInfo:l}),runtime:u||`web`,_fromApp:S,oauthInstance:E,auth:t.app?.config?.auth}));return E.initializeSession(function(e,t){return H(n,void 0,void 0,function(){return U(this,function(n){return e&&(e.type===y?t?T.eventBus.fire(v,{event:f,info:B(B({},e),{error:t})}):e.user&&D.createLoginState({},{userInfo:e.user}):e.type===x&&T.eventBus.fire(v,{event:g,info:B(B({},e),{error:t})})),[2]})})}),{authInstance:D,oauthInstance:E}}(B(B({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence,i18n:this.config.i18n,accessKey:this.config.accessKey,useWxCloud:this.config.useWxCloud,sdkVersion:this.version,detectSessionInUrl:this.config.auth?.detectSessionInUrl}),{env:this.config.env,clientId:this.config.clientId,getApiOrigin:function(){return t.request.getBaseEndPoint(t.config.endPointMode||`CLOUD_API`)},platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),a=i.authInstance,o=i.oauthInstance;return this.oauthInstance=o,this.authInstance=a,this.authInstance},n=t.call(this,e);Object.assign(t,n),Object.setPrototypeOf(t,Object.getPrototypeOf(n));var r=typeof Proxy<`u`?new Proxy(t,{get:function(e,t,n){var r=Reflect.get(e,t,n);if(r!==void 0||typeof t!=`string`)return r;var i=function(e,t){for(var n=null,r=1/0,i=0,a=t;i<a.length;i++){var o=a[i];if(!o.startsWith(`_`)&&o!==`constructor`){var s=It(e,o);s<r&&(r=s,n=o)}}return n}(t,Object.getOwnPropertyNames(Object.getPrototypeOf(e)).concat(Object.keys(e)).filter(function(t){return typeof e[t]==`function`}));return i&&console.warn(`[CloudBase Auth] auth.${t} is not a function. Did you mean: auth.${i}() ?`),r}}):t;return this[Ft]=r,r}};try{cloudbase.registerComponent(Lt)}catch{}var Rt=function(e){try{e.registerComponent(Lt)}catch(e){console.warn(e)}};try{window.registerAuth=Rt}catch{}})(),ao.W;var oo={388:e=>{e.exports={}}},so={};function co(e){var t=so[e];if(t!==void 0)return t.exports;var n=so[e]={exports:{}};return oo[e](n,n.exports,co),n.exports}co.d=(e,t)=>{for(var n in t)co.o(t,n)&&!co.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},co.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var lo={};(()=>{co.d(lo,{r:()=>ge});var e=co(388);function t(){return`@cloudbase/js-sdk`}var n={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let r=(i={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},a={},co.d(a,i),a);var i,a,o,s=(o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},o(e,t)},function(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);function n(){this.constructor=e}o(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}),c=function(){return c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},c.apply(this,arguments)};function l(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var u=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return s(t,e),t}(Error),d=function(e){return new u(e)};function m(e,t){return(t||d)(e)}function h(e){return!e||typeof e.throw!=`boolean`||e.throw}var g,_=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},v.apply(this,arguments)},y=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},x=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}_(t,e),t.prototype.get=function(e){return this.request(v(v({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(v(v({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(v(v({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(v(v({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(v(v({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return y(this,void 0,Promise,function(){var t,n,r,i;return x(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(v(v({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.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 a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return y(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return x(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,v(v({},e),{signal:t.signal})).then(function(e){return y(m,void 0,void 0,function(){var t,n,r;return x(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(r.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(g||={});var S=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),C=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},w=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},T=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return S(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(r.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,i=r===void 0?{}:r,a=e.keys,o=a===void 0?{}:a;this.platformInfo=i,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(l(n.INVALID_PARAMS,`localStorage is not supported on current platform`),new T(t.root));case`none`:return new T(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if(this.mode!==`async`){if(this.storage)try{var i={version:r||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(i))}catch(e){throw Error(JSON.stringify({code:n.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${n.OPERATION_FAIL}]setStore failed`,info:e}))}}else l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return C(this,void 0,void 0,function(){var r;return w(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:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var r=this.storage.getItem(e);return r&&r.indexOf(t)>=0?JSON.parse(r).content:``}l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return C(this,void 0,void 0,function(){var n;return w(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?l(n.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return C(this,void 0,void 0,function(){return w(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var E=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),D=function(e,t){this.data=t||null,this.name=e},ee=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return E(t,e),t}(D),te=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof ee)return console.error(e.error),this;var n=typeof e==`string`?new D(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new te,new te,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return co.d(t,e),t})({default:()=>b}).default;var O=function(){return O=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},O.apply(this,arguments)},k=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},A=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ne=n,re=`cloudrun`;function ie(e,t){return k(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g;return A(this,function(_){switch(_.label){case 0:if(n=e.name,r=e.data,i=e.path,a=i===void 0?``:i,o=e.method,s=e.header,c=s===void 0?{}:s,l=this.getEndPointWithKey(`GATEWAY`),u=l.BASE_URL,d=l.PROTOCOL,f=`${d}${u}/cloudrun/${n}`,p=a.startsWith(`/`)?a:`/${a}`,m=[`GET`,`HEAD`].includes((o?.toUpperCase)?.call(o)))try{h={};try{h=JSON.parse(r)}catch{h=r||{}}p=`${p}${p.includes(`?`)?`&`:`?`}${Object.keys(h).map(function(e){return`${e}=${h[e]}`}).join(`&`)}`}catch{}return[4,this.request.fetch(O(O({method:o||`POST`,headers:Object.assign({},{"Content-Type":`application/json; charset=utf-8`},c)},m?{}:{body:r}),{url:`${f}${p}`,customReqOpts:t}))];case 1:return g=_.sent(),t?.from===`node-sdk`?[2,g]:[4,g.data];case 2:return[2,_.sent()]}})})}var ae={name:re,entity:{callContainer:new(function(){function e(){}return e.prototype.callContainer=function(e,t){return k(this,void 0,void 0,function(){var n,r,i;return A(this,function(a){switch(a.label){case 0:if(n=e.name,r=e.data,!n)throw Error(JSON.stringify({code:ne.INVALID_PARAMS,msg:`[${re}.callContainer] invalid name`}));try{i=r?JSON.stringify(r):``}catch{throw Error(JSON.stringify({code:ne.INVALID_PARAMS,msg:`[${re}.callContainer] invalid data`}))}return[4,ie.call(this,O(O({},e),{data:i}),t)];case 1:return[2,a.sent()]}})})},e}())().callContainer}};try{cloudbase.registerComponent(ae)}catch{}try{window.registerCloudrun=function(e){try{e.registerComponent(ae)}catch(e){console.warn(e)}}}catch{}var oe=function(){return oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},oe.apply(this,arguments)},se=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},ce=t,le=n,ue=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},de=m,fe=h,pe=function(e,t){if(h(e))throw m(t,e?.errorFactory);return c({code:t.code,message:t.msg},t.requestId?{requestId:t.requestId}:{})},me=`functions`,he={name:me,entity:{callFunction:new(function(){function t(){}var n,r,i,a;return t.prototype.callFunction=function(e,t,n){var r=this,i=void 0,a,o=function(){var r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E;return function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,function(D){switch(D.label){case 0:if(r=e.name,i=e.data,a=e.query,o=e.parse,s=e.search,c=e.type,l=e.path,u=l===void 0?``:l,d=e.method,f=e.header,p=f===void 0?{}:f,h=(m=this).request,g=m.config,!r)return[2,pe(g,{code:le.INVALID_PARAMS,msg:`[${me}.callFunction] invalid function name`})];try{_=i?JSON.stringify(i):``}catch{return[2,pe(g,{code:le.INVALID_PARAMS,msg:`[${me}.callFunction] invalid data`})]}return c===`cloudrun`?(te=new Date().getTime(),O=(Date==null?void 0:Date.now)&&1e3*Date.now()||0,v=`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,function(e){var t=16*Math.random();return te>0?(t=(te+t)%16|0,te=Math.floor(te/16)):(t=(O+t)%16|0,O=Math.floor(O/16)),(e===`x`?t:7&t|8).toString(16)}),[4,ie.call(this,{name:r,data:_,path:u,method:d,header:oe(oe({},p),{"X-Request-Id":v})})]):[3,2];case 1:return[2,{result:T=D.sent(),requestId:v}];case 2:y=`functions.invokeFunction`,b={inQuery:a,parse:o,search:s,function_name:r,request_data:_},x={},S=!(g.endPointMode!==`GATEWAY`||(ee=r,ee===`lcap-common-service`||ee===`lcap-datasource-test`||ee.startsWith(`lcap-data`)||ee.startsWith(`lowcode-datasource`)||ee===`cloudbase_module`)||function(e){return e===`lowcode-wx-datasource`}(r)),D.label=3;case 3:return D.trys.push([3,8,,9]),S?[4,h.gateWay(oe(oe({},e),{path:`functions`}),n)]:[3,5];case 4:return C=D.sent(),x=oe({requestId:C.requestId},C.data?.code?C.data:{data:{response_data:C.data}}),[3,7];case 5:return[4,h.send(y,b,{endPointMode:`CLOUD_API`,defaultQuery:i?.params?.action?{action:i?.params?.action}:{}},n)];case 6:x=D.sent(),D.label=7;case 7:if(x.code){if(w=x.message||x.msg||``,function(e){return fe(e)}(g))throw de({code:x.code,msg:w,requestId:x.requestId},g?.errorFactory);return[2,ue(t,null,{code:x.code,message:w,requestId:x.requestId})]}if(T=x.data.response_data,o||S)return[2,ue(t,null,{result:T,requestId:x.requestId})];try{return T=JSON.parse(x.data.response_data),[2,ue(t,null,{result:T,requestId:x.requestId})]}catch{ue(t,Error(`[${ce()}][${le.INVALID_PARAMS}][${me}.callFunction] response data must be json`))}return[3,9];case 8:return E=D.sent(),ue(t,E),[3,9];case 9:return[2]}var ee,te,O})};return new((a=void 0)||(a=Promise))(function(e,t){function n(e){try{c(o.next(e))}catch(e){t(e)}}function s(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof a?r:new a(function(e){e(r)})).then(n,s)}c((o=o.apply(r,i||[])).next())})},function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);a>3&&o&&Object.defineProperty(t,n,o)}([(a={customInfo:{className:`Cloudbase`,methodName:`callFunction`},title:`函数调用失败`,messages:[`请确认以下各项:`,` 1 - 调用 callFunction() 的语法或参数是否正确`,` 2 - 当前环境下是否存在此函数`,` 3 - 函数安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:https://support.qq.com/products/148793`]},a.mode,a.customInfo,a.title,a.messages,function(e,t,n){}),se(`design:type`,Function),se(`design:paramtypes`,[typeof(n=e.ICallFunctionOptions!==void 0&&e.ICallFunctionOptions)==`function`?n:Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object,typeof(i=e.ICustomReqOpts!==void 0&&e.ICustomReqOpts)==`function`?i:Object]),se(`design:returntype`,Promise)],t.prototype,`callFunction`,null),t}())().callFunction}};try{cloudbase.registerComponent(he)}catch{}var ge=function(e){try{e.registerComponent(he)}catch(e){console.warn(e)}};try{window.registerFunctions=ge}catch{}})(),lo.r;var uo={388:e=>{e.exports={}}},fo={};function po(e){var t=fo[e];if(t!==void 0)return t.exports;var n=fo[e]={exports:{}};return uo[e](n,n.exports,po),n.exports}po.d=(e,t)=>{for(var n in t)po.o(t,n)&&!po.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},po.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var mo={};(()=>{po.d(mo,{v:()=>ot});var e,t=(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}),n=function(e){function n(t){var n=e.call(this,t)||this;return n.__isStorageError=!0,n.name=`StorageError`,n}return t(n,e),n}(Error);function r(e){return typeof e==`object`&&!!e&&`__isStorageError`in e}var i,a=function(e){function n(t,n,r){var i=e.call(this,t)||this;return i.name=`StorageApiError`,i.status=n,i.statusCode=r,i}return t(n,e),n.prototype.toJSON=function(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}},n}(n);function o(){return globalThis.Buffer}function s(e){var t=o();return t?t.from(e).toString(`base64`):btoa(e)}function c(e){return e.split(`/`).map(function(e){return encodeURIComponent(e)}).join(`/`)}t(function(e,t){var n=i.call(this,e)||this;return n.name=`StorageUnknownError`,n.originalError=t,n},i=n);var l=function(){return l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},l.apply(this,arguments)},u=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},d=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},m=`/v1/storages`;function h(e,t){return u(this,void 0,Promise,function(){var i;return d(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e()];case 1:return[2,{data:a.sent(),error:null}];case 2:if(i=a.sent(),t)throw i;return r(i)?[2,{data:null,error:i}]:[2,{data:null,error:new n(i?.message||String(i))}];case 3:return[2]}})})}var g=function(){function e(e){this.ctx=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.ctx.request},enumerable:!1,configurable:!0}),e.prototype.gatewayOrigin=function(){return this.request.getBaseEndPoint(`GATEWAY`)},e.prototype.buildUrl=function(e,t){var n=`${this.gatewayOrigin()}${m}${e}`,r=function(e){if(!e)return``;var t=[];return Object.keys(e).forEach(function(n){var r=e[n];r!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`)}),t.join(`&`)}(t);return r&&(n+=(n.includes(`?`)?`&`:`?`)+r),n},e.prototype.toFullUrl=function(e){return e&&(/^https?:\/\//.test(e)||e.startsWith(`//`)?e:`${this.gatewayOrigin()}${m}${e.startsWith(`/`)?``:`/`}${e}`)},e.prototype.send=function(e){return u(this,void 0,Promise,function(){var t,n,r,i,a,o;return d(this,function(s){switch(s.label){case 0:return t=this.buildUrl(e.path,e.query),n=e.method.toUpperCase(),r=[`GET`,`HEAD`].includes(n),i=l({},e.headers||{}),r||(e.rawBody===void 0?e.json!==void 0&&(i[`Content-Type`]=i[`Content-Type`]||`application/json`,a=JSON.stringify(e.json)):a=e.rawBody),[4,this.request.fetch(l(l(l(l({url:t,method:n,headers:i},a===void 0?{}:{body:a}),{withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1}),e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:return o=s.sent(),[2,this.unwrap(o,t)]}})})},e.prototype.download=function(e){return u(this,void 0,Promise,function(){var t,n,r,i;return d(this,function(o){switch(o.label){case 0:return t=this.buildUrl(e.path,e.query),[4,this.request.fetch(l(l({url:t,method:`GET`,headers:l({},e.headers||{}),stream:!0,withCredentials:!1!==e.withCredentials,shouldThrowOnError:!1},e.signal?{signal:e.signal}:{}),e.cache?{cache:e.cache}:{}))];case 1:if(n=o.sent(),e.signal?.aborted)throw new a(`The download was aborted`,0,`STORAGE_PG_ABORTED`);if((r=Number(n?.statusCode??200))===304)throw new a(`Not Modified`,r,`STORAGE_PG_NOT_MODIFIED`);if(r>=400)throw new a(`Download failed with status ${r}`,r,`STORAGE_PG_REQUEST_FAIL`);if(!(i=n?.response))throw new a(`Underlying adapter did not expose the raw Response`,r,`STORAGE_PG_NO_RESPONSE`);return[2,{response:i,status:r,header:n?.header}]}})})},e.prototype.unwrap=function(e,t){return u(this,void 0,Promise,function(){var n,r,i,o;return d(this,function(s){switch(s.label){case 0:n=Number(e?.statusCode??e?.status??200),r=e?.data,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r];case 2:return r=s.sent(),[3,4];case 3:return s.sent(),r=void 0,[3,4];case 4:if(n>=200&&n<300)return[2,r];throw i=r?.code||r?.error||`STORAGE_PG_REQUEST_FAIL`,o=r?.message||`Storage request failed with status ${n}: ${t}`,new a(o,n,i)}})})},e}(),_=function(){return _=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},_.apply(this,arguments)},v=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},y=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function x(e){return r(e)?e:new n(e?.message||String(e))}function S(e){var t={};return e?.download!==void 0&&(t.download=!0===e.download?``:e.download),e?.cacheNonce!==void 0&&(t.cacheNonce=String(e.cacheNonce)),{headers:{},query:t}}var C=function(){function e(e){this.ctx=e}return e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:if(!(r=o.sent().response).body)throw new a(`Response body is empty`,r.status,`STORAGE_PG_EMPTY_BODY`);return[2,{data:r.body,error:null}];case 2:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 3:return[2]}})})},e}(),w=function(){function e(e){this.ctx=e}return e.prototype.asStream=function(){return new C(this.ctx)},e.prototype.then=function(e,t){return this.execute().then(e,t)},e.prototype.execute=function(){return v(this,void 0,Promise,function(){var e,t,n,r,i,a;return y(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),e=S(this.ctx.options),t=e.headers,n=e.query,[4,this.ctx.http.download({path:`/object/${this.ctx.bucketId}/${c(this.ctx.cleanName)}`,headers:_(_({},this.ctx.headers),t),query:n,signal:this.ctx.parameters?.signal,cache:this.ctx.parameters?.cache})];case 1:return r=o.sent().response,a={},[4,r.blob()];case 2:return[2,(a.data=o.sent(),a.error=null,a)];case 3:if(i=o.sent(),this.ctx.shouldThrowOnError)throw i;return[2,{data:null,error:x(i)}];case 4:return[2]}})})},e}(),T=function(){return T=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},T.apply(this,arguments)},E=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},D=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},ee=`3600`,te=function(){function e(e,t,n){n===void 0&&(n=!1),this.headers={},this.http=e,this.bucketId=t,this.shouldThrowOnError=n}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.setHeader=function(e,t){var r;if(typeof e!=`string`||e.trim()===``)throw new n(`setHeader requires a non-empty header name`);if(/[\r\n]/.test(e)||typeof t==`string`&&/[\r\n]/.test(t))throw new n(`setHeader does not allow CR/LF characters in header name or value`);return this.headers=T(T({},this.headers),((r={})[e]=String(t),r)),this},e.prototype.upload=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`POST`,e,t,n)]})})},e.prototype.update=function(e,t,n){return E(this,void 0,Promise,function(){return D(this,function(r){return[2,this.uploadOrUpdate(`PUT`,e,t,n)]})})},e.prototype.download=function(e,t,n){return new w({http:this.http,bucketId:this.bucketId,cleanName:this.cleanPath(e),options:t,parameters:n,headers:this.headers,shouldThrowOnError:this.shouldThrowOnError})},e.prototype.list=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){return r={prefix:e||``},t?.limit!==void 0&&(r.limit=t.limit),t?.cursor!==void 0&&(r.cursor=t.cursor),t?.withDelimiter!==void 0&&(r.with_delimiter=t.withDelimiter),t?.sortBy!==void 0&&(r.sortBy=t.sortBy),[2,this.send({method:`POST`,path:`/object/list/${this.bucketId}`,json:r,signal:n?.signal,cache:n?.cache})]})})},this.shouldThrowOnError)]})})},e.prototype.remove=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n,r,i,a,o=this;return D(this,function(s){switch(s.label){case 0:t=e.map(function(e){return o.cleanPath(e)}),n=[],r=0,s.label=1;case 1:return r<t.length?(i=t.slice(r,r+100),[4,this.send({method:`DELETE`,path:`/object/${this.bucketId}`,json:{prefixes:i}})]):[3,4];case 2:a=s.sent(),Array.isArray(a)&&n.push.apply(n,a),s.label=3;case 3:return r+=100,[3,1];case 4:return[2,n]}})})},this.shouldThrowOnError)]})})},e.prototype.copy=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r;return D(this,function(i){switch(i.label){case 0:return r=this.buildCopyMoveHeaders(n),[4,this.send({method:`POST`,path:`/object/copy`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket,copyMetadata:n?.copyMetadata,metadata:n?.metadata},headers:r})];case 1:return[2,{path:i.sent().Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.move=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){return D(this,function(r){switch(r.label){case 0:return[4,this.send({method:`POST`,path:`/object/move`,json:{bucketId:this.bucketId,sourceKey:this.cleanPath(e),destinationKey:this.cleanPath(t),destinationBucket:n?.destinationBucket}})];case 1:return[2,{message:r.sent().message||`Successfully moved`}]}})})},this.shouldThrowOnError)]})})},e.prototype.info=function(e){return E(this,void 0,Promise,function(){var t=this;return D(this,function(n){return[2,h(function(){return E(t,void 0,void 0,function(){var t,n;return D(this,function(r){switch(r.label){case 0:return t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return[2,{id:(n=r.sent()).id,name:n.name,version:n.version,bucketId:n.bucket_id,size:n.size,contentType:n.content_type,cacheControl:n.cache_control,etag:n.etag,metadata:n.metadata,lastModified:n.last_modified,createdAt:n.created_at}]}})})},this.shouldThrowOnError)]})})},e.prototype.exists=function(e){return E(this,void 0,Promise,function(){var t,r,i;return D(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.cleanPath(e),[4,this.send({method:`GET`,path:`/object/info/${this.bucketId}/${this.encodePath(t)}`})];case 1:return a.sent(),[2,{data:!0,error:null}];case 2:if(r=a.sent(),(i=r?.status)!==void 0&&[400,404].includes(Number(i)))return[2,{data:!1,error:null}];if(this.shouldThrowOnError)throw r;return[2,{data:null,error:r instanceof n?r:new n(r?.message||String(r))}];case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a;return D(this,function(o){switch(o.label){case 0:return r=this.cleanPath(e),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}/${this.encodePath(r)}`,json:{expiresIn:t}})];case 1:return i=o.sent(),a=i.fullSignedURL||this.http.toFullUrl(i.signedURL||``),[2,{fullSignedURL:this.appendUrlOptions(a,n)}]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUrls=function(e,t,n){return E(this,void 0,Promise,function(){var r=this;return D(this,function(i){return[2,h(function(){return E(r,void 0,void 0,function(){var r,i,a,o,s=this;return D(this,function(c){switch(c.label){case 0:r=e.map(function(e){return s.cleanPath(e)}),i=[],a=0,c.label=1;case 1:return a<r.length?(o=r.slice(a,a+500),[4,this.send({method:`POST`,path:`/object/sign/${this.bucketId}`,json:{expiresIn:t,paths:o}})]):[3,4];case 2:c.sent().forEach(function(e){var t=e.fullSignedURL||(e.signedURL?s.http.toFullUrl(e.signedURL):null);i.push({path:e.path,fullSignedURL:t?s.appendUrlOptions(t,n):null,error:e.error??null})}),c.label=3;case 3:return a+=500,[3,1];case 4:return[2,i]}})})},this.shouldThrowOnError)]})})},e.prototype.createSignedUploadUrl=function(e,t){return E(this,void 0,Promise,function(){var n=this;return D(this,function(r){return[2,h(function(){return E(n,void 0,void 0,function(){var n,r,i;return D(this,function(a){switch(a.label){case 0:return n=this.cleanPath(e),r={},t!=null&&t.upsert&&(r[`x-upsert`]=`true`),[4,this.send({method:`POST`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(n)}`,headers:r})];case 1:return[2,{fullSignedURL:(i=a.sent()).fullURL||this.http.toFullUrl(i.url||``),path:n,token:i.token}]}})})},this.shouldThrowOnError)]})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(e),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,[4,this.send({method:`PUT`,path:`/object/upload/sign/${this.bucketId}/${this.encodePath(i)}`,query:{token:t},rawBody:o,headers:s,withCredentials:!1})];case 1:return c=l.sent(),[2,{path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.getPublicUrl=function(e,t){var n=this.cleanPath(e),r=this.http.buildUrl(`/object/public/${this.bucketId}/${this.encodePath(n)}`);return{data:{publicUrl:this.appendUrlOptions(r,t)}}},e.prototype.send=function(e){return this.http.send(T(T({},e),{headers:T(T({},this.headers),e.headers||{})}))},e.prototype.uploadOrUpdate=function(e,t,n,r){return E(this,void 0,Promise,function(){var i=this;return D(this,function(a){return[2,h(function(){return E(i,void 0,void 0,function(){var i,a,o,s,c;return D(this,function(l){switch(l.label){case 0:return i=this.cleanPath(t),a=this.buildUploadBody(n,r),o=a.body,s=a.headers,e===`POST`&&(s[`x-upsert`]=String(!!r?.upsert)),[4,this.send({method:e,path:`/object/${this.bucketId}/${this.encodePath(i)}`,rawBody:o,headers:s})];case 1:return[2,{id:(c=l.sent()).Id,path:i,fullPath:c.Key}]}})})},this.shouldThrowOnError)]})})},e.prototype.cleanPath=function(e){var t=e.replace(/^\/+|\/+$/g,``).replace(/\/+/g,`/`);if(t.split(`/`).some(function(e){return e===`..`}))throw new n(`invalid path: ".." segment is not allowed`);return t},e.prototype.encodePath=function(e){return c(e)},e.prototype.buildUploadBody=function(e,t){var n=T({},t?.headers||{}),r=e,i=typeof FormData<`u`&&e instanceof FormData;if(typeof Blob<`u`&&e instanceof Blob||i){var a=void 0,o={};if(i){var s=this.extractFromFormData(e);a=s.file,o=s.fields}else a=e;var c=t?.cacheControl??o.cacheControl??ee,l=t?.contentType??o.contentType,u=t?.metadata===void 0?o.metadata:JSON.stringify(t.metadata),d=new FormData;c!==void 0&&d.append(`cacheControl`,String(c)),l!==void 0&&d.append(`contentType`,l),u!==void 0&&d.append(`metadata`,u),d.append(``,a),r=d}else r=e,c=t?.cacheControl??ee,l=t?.contentType??`text/plain;charset=UTF-8`,n[`cache-control`]=`max-age=${c}`,l&&(n[`content-type`]=l),t!=null&&t.metadata&&(n[`x-metadata`]=this.toBase64(JSON.stringify(t.metadata)));return{body:r,headers:n}},e.prototype.extractFromFormData=function(e){var t,r={},i=0,a=[];if(e.forEach(function(e,n){if(typeof Blob<`u`&&e instanceof Blob)return t=e,void(i+=1);n!==`cacheControl`&&n!==`contentType`&&n!==`metadata`?a.push(n):r[n]=String(e)}),a.length>0&&console.warn(`Ignored unsupported FormData field(s): [${a.join(`, `)}]. Only file, cacheControl, contentType and metadata are supported`),i===0||!t)throw new n(`FormData must contain a file`);if(i>1)throw new n(`FormData must contain exactly one file`);return{file:t,fields:r}},e.prototype.buildCopyMoveHeaders=function(e){var t={};return e!=null&&e.upsert&&(t[`x-upsert`]=`true`),!1===e?.copyMetadata&&e!=null&&e.metadata&&(t[`x-metadata`]=this.toBase64(JSON.stringify(e.metadata))),t},e.prototype.appendUrlOptions=function(e,t){var n=[];if(t?.download!==void 0){var r=!0===t.download?``:String(t.download);n.push(`download=${encodeURIComponent(r)}`)}return t?.cacheNonce!==void 0&&n.push(`cacheNonce=${encodeURIComponent(String(t.cacheNonce))}`),n.length===0?e:`${e}${e.includes(`?`)?`&`:`?`}${n.join(`&`)}`},e.prototype.toBase64=function(e){return s(e)},e}(),O=/[\x00-\x20\x7f/\\?#%]/;function k(e,t){if(typeof e!=`string`||e.length===0)throw new n(`[storage.${t}] bucketId is required`);if(e.length>256)throw new n(`[storage.${t}] invalid bucketId: length must be 1-256`);var r=O.exec(e);if(r)throw new n(`[storage.${t}] invalid bucketId "${e}": contains forbidden character ${JSON.stringify(r[0])}; must not contain whitespace, control chars, "/", "\\", "?", "#" or "%"`)}var A=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},ne=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},re=function(){function e(e,t){t===void 0&&(t=!1),this.http=new g(e),this.shouldThrowOnError=t}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.listBuckets=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){var n={};return e?.limit!==void 0&&(n.limit=e.limit),e?.offset!==void 0&&(n.offset=e.offset),e!=null&&e.sortColumn&&(n.sortColumn=e.sortColumn),e!=null&&e.sortOrder&&(n.sortOrder=e.sortOrder),e!=null&&e.search&&(n.search=e.search),t.http.send({method:`GET`,path:`/bucket/`,query:n})},this.shouldThrowOnError)]})})},e.prototype.getBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`getBucket`),t.http.send({method:`GET`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e.prototype.createBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){var r;return k(e,`createBucket`),n.http.send({method:`POST`,path:`/bucket/`,json:{id:e,name:e,public:(r=t?.public)!=null&&r,type:t?.type,file_size_limit:t?.fileSizeLimit,allowed_mime_types:t?.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.updateBucket=function(e,t){return A(this,void 0,Promise,function(){var n=this;return ne(this,function(r){return[2,h(function(){return k(e,`updateBucket`),n.http.send({method:`PUT`,path:`/bucket/${e}`,json:{public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes}})},this.shouldThrowOnError)]})})},e.prototype.deleteBucket=function(e){return A(this,void 0,Promise,function(){var t=this;return ne(this,function(n){return[2,h(function(){return k(e,`deleteBucket`),t.http.send({method:`DELETE`,path:`/bucket/${e}`})},this.shouldThrowOnError)]})})},e}();function ie(){return`@cloudbase/js-sdk`}var ae={INVALID_PARAMS:`INVALID_PARAMS`,INVALID_SYNTAX:`INVALID_SYNTAX`,INVALID_OPERATION:`INVALID_OPERATION`,OPERATION_FAIL:`OPERATION_FAIL`,NETWORK_ERROR:`NETWORK_ERROR`,UNKOWN_ERROR:`UNKOWN_ERROR`};let oe=(se={AbstractSDKRequest:()=>f,AbstractStorage:()=>p},ce={},po.d(ce,se),ce);var se,ce,le=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ue=function(){return ue=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ue.apply(this,arguments)};function de(e){return typeof e==`string`}function fe(e,t){console.warn(`[@cloudbase/js-sdk][${e}]:${t}`)}var pe=function(e){function t(t){var n=e.call(this,t.msg||t.message||``)||this;return n.code=t.code||``,n.requestId=t.requestId||``,Object.defineProperty(n,"message",{value:t.msg||t.message||``,enumerable:!0,writable:!0,configurable:!0}),n}return le(t,e),t}(Error),me=function(e){return new pe(e)};function he(e,t){return(t||me)(e)}function ge(e){if(e&&typeof e==`object`&&e.data&&typeof e.data==`object`){var t=e.data,n=t.code,r=t.message;if(!e.code&&n||!e.message&&r)return ue(ue(ue({},e),!e.code&&n?{code:n}:{}),!e.message&&r?{message:r}:{})}return e}var _e,ve=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),j=function(){return j=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},j.apply(this,arguments)},ye=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},be=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){function t(t){var n=e.call(this)||this,r=t.timeout,i=t.timeoutMsg,a=t.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||`请求超时`,n.restrictedMethods=a||[`get`,`post`,`upload`,`download`],n}ve(t,e),t.prototype.get=function(e){return this.request(j(j({},e),{method:`get`}),this.restrictedMethods.includes(`get`))},t.prototype.post=function(e){return this.request(j(j({},e),{method:`post`}),this.restrictedMethods.includes(`post`))},t.prototype.put=function(e){return this.request(j(j({},e),{method:`put`}))},t.prototype.upload=function(e){var t=e.data,n=e.file,r=e.name,i=e.method,a=e.headers,o=a===void 0?{}:a,s={post:`post`,put:`put`}[i?.toLowerCase()]||`put`,c=new FormData;return s===`post`?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append(`key`,r),c.append(`file`,n),this.request(j(j({},e),{data:c,method:s}),this.restrictedMethods.includes(`upload`))):this.request(j(j({},e),{method:`put`,headers:o,body:n}),this.restrictedMethods.includes(`upload`))},t.prototype.download=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i;return be(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(j(j({},e),{headers:{},responseType:`blob`}))];case 1:return t=a.sent().data,n=window.URL.createObjectURL(new Blob([t])),r=decodeURIComponent(new URL(e.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 a.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){return ye(this,void 0,Promise,function(){var t,n,r,i,a,o,s,c,l,u,d,f,p,m=this;return be(this,function(h){switch(h.label){case 0:return t=new AbortController,n=e.url,r=e.enableAbort,i=r!==void 0&&r,a=e.stream,o=a!==void 0&&a,s=e.signal,c=e.timeout,l=e.shouldThrowOnError,u=l===void 0||l,d=c??this.timeout,s&&(s.aborted&&t.abort(),s.addEventListener(`abort`,function(){return t.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(m.timeoutMsg),t.abort(Error(m.timeoutMsg))},d)),[4,fetch(n,j(j({},e),{signal:t.signal})).then(function(e){return ye(m,void 0,void 0,function(){var t,n,r;return be(this,function(i){switch(i.label){case 0:return clearTimeout(f),u?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return r=(n=Promise).reject,[4,e.json()];case 2:t=r.apply(n,[i.sent()]),i.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){return clearTimeout(f),Promise.reject(e)})];case 1:return p=h.sent(),[2,{data:o?p.body:p.headers.get(`content-type`)?.includes(`application/json`)?p.json():p.text(),statusCode:p.status,header:p.headers,response:p}]}})})},t.prototype.request=function(e,t){var n=this;t===void 0&&(t=!1);var r=String(e.method).toLowerCase()||`get`;return new Promise(function(i){var a=e.url,o=e.headers,s=o===void 0?{}:o,c=e.data,l=e.responseType,u=e.withCredentials,d=e.body,f=e.onUploadProgress,p=function(e,t,n){n===void 0&&(n={});var r=/\?/.test(t),i=``;return Object.keys(n).forEach(function(e){i===``?!r&&(t+=`?`):i+=`&`,i+=`${e}=${encodeURIComponent(n[e])}`}),/^http(s)?:\/\//.test(t+=i)?t:`${e}${t}`}(`https:`,a,r===`get`?c:{}),m=new XMLHttpRequest;m.open(r,p),l&&(m.responseType=l);var h,g,_,v=e.signal;v&&(v.aborted?m.abort():v.addEventListener(`abort`,function(){return m.abort()},{once:!0})),Object.keys(s).forEach(function(e){m.setRequestHeader(e,s[e])}),f&&m.upload.addEventListener(`progress`,f),m.onreadystatechange=function(){var e={};if(m.readyState===4){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};t.forEach(function(e){var t=e.split(`: `),r=t.shift().toLowerCase();n[r]=t.join(`: `)}),e.header=n,e.statusCode=m.status;try{e.data=l===`blob`?m.response:JSON.parse(m.responseText)}catch{e.data=l===`blob`?m.response:m.responseText}clearTimeout(h),i(e)}},t&&n.timeout&&(h=setTimeout(function(){console.warn(n.timeoutMsg),m.abort()},n.timeout)),_=c,g=Object.prototype.toString.call(_)===`[object FormData]`?c:s[`content-type`]===`application/x-www-form-urlencoded`?function(e){e===void 0&&(e={});var t=[];return Object.keys(e).forEach(function(n){t.push(`${n}=${encodeURIComponent(e[n])}`)}),t.join(`&`)}(c):d||(c?JSON.stringify(c):void 0),u&&(m.withCredentials=!0),m.send(g)})}})(oe.AbstractSDKRequest),function(e){e.WEB=`web`,e.WX_MP=`wx_mp`}(_e||={});var xe=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Se=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ce=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},we=function(e){function t(t){var n=e.call(this)||this;return n.root=t,t.tcbCacheObject||={},n}return xe(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(oe.AbstractStorage);(function(){function e(e){this.keys={};var t=e.persistence,n=e.platformInfo,r=n===void 0?{}:n,i=e.keys,a=i===void 0?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case`local`:default:return t.localStorage?t.localStorage:(fe(ae.INVALID_PARAMS,`localStorage is not supported on current platform`),new we(t.root));case`none`:return new we(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=a)}Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||`sync`},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,n){if(this.mode!==`async`){if(this.storage)try{var r={version:n||`localCachev1`,content:t};this.storage.setItem(e,JSON.stringify(r))}catch(e){throw Error(JSON.stringify({code:ae.OPERATION_FAIL,msg:`[@cloudbase/js-sdk][${ae.OPERATION_FAIL}]setStore failed`,info:e}))}}else fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use setStoreAsync insteed`)},e.prototype.setStoreAsync=function(e,t,n){return Se(this,void 0,void 0,function(){var r;return Ce(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:t},[4,this.storage.setItem(e,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){if(this.mode!==`async`){try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return``}catch{return``}t||=`localCachev1`;var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:``}fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use getStoreAsync insteed`)},e.prototype.getStoreAsync=function(e,t){return Se(this,void 0,void 0,function(){var n;return Ce(this,function(r){switch(r.label){case 0:try{if(typeof process<`u`&&{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token)return[2,{IS_MP_BUILD:!1,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,``]}catch{return[2,``]}return t||=`localCachev1`,[4,this.storage.getItem(e)];case 1:return(n=r.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,``]}})})},e.prototype.removeStore=function(e){this.mode===`async`?fe(ae.INVALID_OPERATION,`current platform's storage is asynchronous, please use removeStoreAsync insteed`):this.storage.removeItem(e)},e.prototype.removeStoreAsync=function(e){return Se(this,void 0,void 0,function(){return Ce(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})}})();var Te=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),M=function(e,t){this.data=t||null,this.name=e},Ee=function(e){function t(t,n){var r=e.call(this,`error`,{error:t,data:n})||this;return r.error=t,r}return Te(t,e),t}(M),N=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,n){n[e]=n[e]||[],n[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,n){if(n?.[e]){var r=n[e].indexOf(t);r!==-1&&n[e].splice(r,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(e instanceof Ee)return console.error(e.error),this;var n=de(e)?new M(e,t||{}):e,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,a=this.listeners[r]?function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}([],this.listeners[r],!0):[];i<a.length;i++)a[i].call(this,n)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();new N,new N,typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.indexOf(`Firefox`),(e=>{var t={};return po.d(t,e),t})({default:()=>b}).default;var P,De=po(388),Oe=function(){return Oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Oe.apply(this,arguments)},ke=function(e,t,n,r){var i,a=arguments.length,o=a<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o},Ae=function(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)},je=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},Me=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};(function(e){e.put=`put`,e.post=`post`})(P||={});var Ne=ie,Pe=ae,Fe=`https://support.qq.com/products/148793`,Ie=function(e){return Object.prototype.toString.call(e)===`[object Array]`},Le=de,Re=function(e){return Object.prototype.toString.call(e)===`[object Object]`},ze=function(e,t,n){if(n===void 0&&(n=null),e&&typeof e==`function`)return e(t,n);if(t)throw t;return n},Be=function(e,t){if(function(e){return!e||typeof e.throw!=`boolean`||e.throw}(e))throw he(t,e?.errorFactory);return ue({code:t.code,message:t.msg},t.requestId?{requestId:t.requestId}:{})},Ve=fe,He=function(e){return e.mode,e.customInfo,e.title,e.messages,function(e,t,n){}},Ue=`storage`;function We(e,t){return t&&typeof t!=`function`?[Oe(Oe({},e),{customReqOpts:t}),void 0]:[e,t]}var Ge=function(e,t,n){return je(void 0,void 0,void 0,function(){var r,i;return Me(this,function(a){switch(a.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-upload-info`,data:[Oe({objectId:t.path},t.signedHeader?{signedHeader:t.signedHeader}:{})]},n)];case 1:return r=ge(r=a.sent()),i=r.data?.[0]||{},[2,Oe(Oe({},r),{data:Oe(Oe({},i.code?Oe({},i):{}),{authorization:i.authorization,token:i.token,url:i.uploadUrl,fileId:i.cloudObjectId,cosFileId:i.cloudObjectMeta,download_url:i.downloadUrl})})]}})})},Ke=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`get-objects-download-info`,data:t.convertedFileList.map(function(e){return{cloudObjectId:e.fileid}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{download_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,message:e.message,fileid:e.cloudObjectId,download_url:e.downloadUrl,fileID:e.cloudObjectId,tempFileURL:e.downloadUrl,mime_type:e.contentType||F(null,e.cloudObjectId||``)}}):[]}})]}})})},qe=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`delete-objects`,data:t.fileList.map(function(e){return{cloudObjectId:e}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{delete_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,message:e.message}}):[]}})]}})})},Je=function(e,t,n){return je(void 0,void 0,void 0,function(){var r;return Me(this,function(i){switch(i.label){case 0:return[4,e.gateWay({path:`storages`,name:`copy-objects`,data:t.convertedFileList.map(function(e){return{srcPath:e.src_path,dstPath:e.dst_path,overwrite:e.overwrite,removeOriginal:e.remove_original}})},n)];case 1:return r=ge(r=i.sent()),[2,Oe(Oe({},r),{data:{copy_list:Array.isArray(r.data)?r.data.map(function(e){return{code:e.code||`SUCCESS`,fileID:e.cloudObjectId,fileId:e.cloudObjectId,message:e.message}}):[]}})]}})})},Ye={txt:`text/plain`,json:`application/json`,html:`text/html`,htm:`text/html`,css:`text/css`,js:`application/javascript`,csv:`text/csv`,xml:`application/xml`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,ico:`image/x-icon`,pdf:`application/pdf`,zip:`application/zip`,gz:`application/gzip`,mp4:`video/mp4`,webm:`video/webm`,mp3:`audio/mpeg`,wav:`audio/wav`};function F(e,t){if(typeof Blob<`u`&&e instanceof Blob&&e.type)return e.type;var n=/\.([a-zA-Z0-9]+)$/.exec(t||``);return Ye[n?n[1].toLowerCase():``]||`application/octet-stream`}function Xe(e,t){var n=t.toLowerCase();return Object.keys(e).some(function(e){return e.toLowerCase()===n})}function Ze(e){return Object.keys(e).reduce(function(t,n){var r;return Oe(Oe({},t),((r={})[n]=[e[n]],r))},{})}var Qe=function(){function e(e){this.context=e}var t,n,r,i,a,s,c,l,u,d,f,p,m,h,g,_;return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.isGateWay=function(){return(this.config.endPointMode||`CLOUD_API`)===`GATEWAY`},e.prototype.uploadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,ee,te,O,k,A,ne,re;return Me(this,function(ie){switch(ie.label){case 0:return k=We(e,t),e=k[0],t=k[1],n=e.cloudPath,r=e.filePath,i=e.onUploadProgress,A=e.method,a=A===void 0?`put`:A,ne=e.headers,s=ne===void 0?{}:ne,c=e.fileContent,Le(n)&&(r||c)?(l={put:P.put,post:P.post}[a.toLocaleLowerCase()]||P.put,u=this.isGateWay(),d=Oe({},s),f=Object.keys(s).reduce(function(e,t){return t.toLowerCase()!==`content-length`&&(e[t]=s[t]),e},{}),l===P.put&&u&&(Xe(d,`content-length`)||typeof(p=function(e,t){var n=e??t;if(n!==null){if(typeof Blob<`u`&&n instanceof Blob)return n.size;if(typeof ArrayBuffer<`u`&&(n instanceof ArrayBuffer||typeof ArrayBuffer.isView==`function`&&ArrayBuffer.isView(n)))return n.byteLength;if(typeof n==`string`){if(typeof Blob<`u`)return new Blob([n]).size;var r=(i=n,(a=o())?.byteLength(i));return typeof r==`number`?r:n.length}var i,a;return typeof n==`object`&&typeof n.size==`number`?n.size:void 0}}(r,c))==`number`&&(d[`content-length`]=String(p)),Xe(d,`content-type`)||(d[`content-type`]=F(r,n)),Xe(f,`content-type`)||(f[`content-type`]=F(r,n))),[4,this.getUploadMetadata({cloudPath:n,method:l,headers:l!==P.put||u?void 0:f,signedHeader:l===P.put&&u?Ze(d):void 0,customReqOpts:e.customReqOpts})]):[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.uploadFile] invalid params`})];case 1:return m=ie.sent(),h=m.data,g=m.requestId,(_=h)?.code||!_?.url?(v=_?.code||Pe.OPERATION_FAIL,y=_?.message||`get upload info failed`,[2,ze(t,Error(`[${Ne()}][${v}][${Ue}]:${y}`))]):(b=h.url,x=h.authorization,S=h.token,C=h.fileId,w=h.cosFileId,T=h.download_url,D=Oe(Oe({},E={url:b,file:r,name:n,onUploadProgress:i,fileContent:c,fileId:C,requestId:g}),{method:P.put,headers:Oe(Oe({},f),{authorization:x,"x-cos-meta-fileid":w,"x-cos-security-token":S})}),ee=Oe(Oe({},E),{method:P.post,data:{key:n,signature:x,"x-cos-meta-fileid":w,success_action_status:`201`,"x-cos-security-token":S}}),(re={})[P.put]={params:D,isSuccess:function(e){return e>=200&&e<300}},re[P.post]={params:ee,isSuccess:function(e){return e===201}},te=re,[4,this.request.upload(te[l].params)]);case 2:return O=ie.sent(),te[l].isSuccess(O.statusCode)?[2,ze(t,null,{fileID:C,download_url:T,requestId:g})]:[2,ze(t,Error(`[${Ne()}][${Pe.OPERATION_FAIL}][${Ue}]:${O.data}`))]}})})},e.prototype.getUploadMetadata=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(n=e.cloudPath,r=e.method,i=e.headers,a=e.signedHeader,!Le(n))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getUploadMetadata] invalid cloudPath`})];o=this.request,s=`storage.getUploadMetadata`,f.label=1;case 1:return f.trys.push([1,6,,7]),c=void 0,l={path:n},u=this.isGateWay(),r&&(l.method=r),r===P.put&&(u&&a?l.signedHeader=a:!u&&i&&(l.headers=i)),r!==P.post&&u?[3,3]:[4,o.send(s,l,{endPointMode:`CLOUD_API`},e.customReqOpts)];case 2:return c=f.sent(),[3,5];case 3:return[4,Ge(o,l,e.customReqOpts)];case 4:c=f.sent(),f.label=5;case 5:return[2,ze(t,null,c)];case 6:return d=f.sent(),[2,ze(t,d)];case 7:return[2]}})})},e.prototype.deleteFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u;return Me(this,function(d){switch(d.label){case 0:if(u=We(e,t),e=u[0],t=u[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.deleteFile] fileList must not be empty`})];for(r=0,i=n;r<i.length;r++)if(!(a=i[r])||!Le(a))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.deleteFile] fileID must be string`})];return o=`storage.batchDeleteFile`,s=this.request,c={},this.isGateWay()?[4,qe(s,{fileList:n},e.customReqOpts)]:[3,2];case 1:return c=d.sent(),[3,4];case 2:return[4,s.send(o,{fileid_list:n},e.customReqOpts)];case 3:c=d.sent(),d.label=4;case 4:return c.code?[2,ze(t,null,c)]:(l={fileList:c.data.delete_list,requestId:c.requestId},[2,ze(t,null,l)])}})})},e.prototype.getTempFileURL=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] fileList must not be empty`})];for(r=[],i=!1,a=0,o=n;a<o.length;a++)if(s=o[a],Re(s)){if(!Object.prototype.hasOwnProperty.call(s,`fileID`))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] file info must include fileID`})];!i&&Object.prototype.hasOwnProperty.call(s,`maxAge`)&&(Ve(Pe.INVALID_PARAMS,`[${Ue}.getTempFileURL] maxAge 仅为兼容字段,传统模式不会用它生成下载链接,TTL 传入无效。需要可控过期请改用 app.storage.from(bucketId).createSignedUrl(path, expiresIn)(PG 模式下可用)。`),i=!0),r.push({fileid:s.fileID,max_age:s.maxAge||7200})}else{if(!Le(s))return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] invalid fileList`})];r.push({fileid:s})}return c=`storage.batchGetDownloadUrl`,l=this.request,u={},this.isGateWay()?[4,Ke(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(c,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:Array.isArray(u.data?.download_list)?u.data.download_list:[],requestId:u.requestId})]}})})},e.prototype.downloadFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c;return Me(this,function(l){switch(l.label){case 0:return c=We(e,t),e=c[0],t=c[1],n=e.fileID,Le(n)?[4,this.getTempFileURL.call(this,{fileList:[n],customReqOpts:e.customReqOpts})]:[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.getTempFileURL] fileID must be string`})];case 1:return r=l.sent(),(i=r.fileList[0]).code===`SUCCESS`?(a=this.request,o=encodeURI(i.download_url),[4,a.download({url:o,tempFilePath:e.tempFilePath})]):[2,ze(t,i)];case 2:return s=l.sent(),[2,ze(t,null,s)]}})})},e.prototype.copyFile=function(e,t){return je(this,void 0,Promise,function(){var n,r,i,a,o,s,c,l,u,d;return Me(this,function(f){switch(f.label){case 0:if(d=We(e,t),e=d[0],t=d[1],!(n=e.fileList)||!Ie(n)||n.length===0)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] fileList must not be empty`})];for(r=[],i=0,a=n;i<a.length;i++){if(o=a[i],s=o.srcPath,c=o.dstPath,!s||!c||typeof s!=`string`||typeof c!=`string`)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] srcPath and dstPath may not be empty`})];if(s===c)return[2,Be(this.config,{code:Pe.INVALID_PARAMS,msg:`[${Ue}.copyFile] srcPath and dstPath can not be the same`})];r.push({src_path:s,dst_path:c,overwrite:o.overwrite,remove_original:o.removeOriginal})}return l=this.request,u={},this.isGateWay()?[4,Je(l,{convertedFileList:r},e.customReqOpts)]:[3,2];case 1:return u=f.sent(),[3,4];case 2:return[4,l.send(`storage.batchCopyFile`,{file_list:r},e.customReqOpts)];case 3:u=f.sent(),f.label=4;case 4:return u.code?[2,ze(t,null,u)]:[2,ze(t,null,{fileList:u.data.copy_list,requestId:u.requestId})]}})})},e.prototype.getFileInfo=function(e){return je(this,void 0,Promise,function(){var t,n=this;return Me(this,function(r){switch(r.label){case 0:return[4,this.getTempFileURL(e)];case 1:return(t=r.sent())?.fileList&&t?.fileList?.length>0?[4,Promise.all(t.fileList.map(function(e){return je(n,void 0,void 0,function(){var t,n,r,i,a,o,s;return Me(this,function(c){switch(c.label){case 0:if(e.code!==`SUCCESS`)return[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,message:e.message}];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.request.fetch({url:e.tempFileURL,method:`HEAD`})];case 2:return t=c.sent(),n=t.header,typeof Headers<`u`&&n instanceof Headers&&(r={},n.forEach(function(e,t){r[t]=e}),n=r),i=parseInt(n[`content-length`])||0,a=n[`content-type`]||``,[400,404].includes(Number(t.statusCode))?[2,{code:`FILE_NOT_FOUND`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:`file not found`}]:[2,{code:e.code,fileID:e.fileID,tempFileURL:e.tempFileURL,cloudId:e.fileID,fileName:e.fileID.split(`/`).pop(),contentType:a,mime:a.split(`;`)[0].trim(),size:i,etag:n.etag||``,lastModified:n[`last-modified`]||``,cacheControl:n[`cache-control`]||``}];case 3:return o=c.sent(),s=typeof o==`object`&&o&&`message`in o?String(o.message):void 0,[2,{code:`FETCH_FILE_INFO_ERROR`,fileID:e.fileID,tempFileURL:e.tempFileURL,message:s}];case 4:return[2]}})})}))]:[3,3];case 2:return[2,{fileList:r.sent(),requestId:t.requestId}];case 3:return[2,{fileList:[],requestId:t.requestId}]}})})},ke([He({customInfo:{className:`Cloudbase`,methodName:`uploadFile`},title:`上传文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 uploadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(t=typeof Function<`u`&&Function)==`function`?t:Object]),Ae(`design:returntype`,typeof(n=typeof Promise<`u`&&Promise)==`function`?n:Object)],e.prototype,`uploadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getUploadMetadata`},title:`获取上传元信息失败`,messages:[`请确认以下各项:`,` 1 - 调用 getUploadMetadata() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[Object,typeof(r=typeof Function<`u`&&Function)==`function`?r:Object]),Ae(`design:returntype`,typeof(i=typeof Promise<`u`&&Promise)==`function`?i:Object)],e.prototype,`getUploadMetadata`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`deleteFile`},title:`删除文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 deleteFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(a=De.ICloudbaseDeleteFileParams!==void 0&&De.ICloudbaseDeleteFileParams)==`function`?a:Object,typeof(s=typeof Function<`u`&&Function)==`function`?s:Object]),Ae(`design:returntype`,typeof(c=typeof Promise<`u`&&Promise)==`function`?c:Object)],e.prototype,`deleteFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`getTempFileURL`},title:`获取文件下载链接`,messages:[`请确认以下各项:`,` 1 - 调用 getTempFileURL() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(l=De.ICloudbaseGetTempFileURLParams!==void 0&&De.ICloudbaseGetTempFileURLParams)==`function`?l:Object,typeof(u=typeof Function<`u`&&Function)==`function`?u:Object]),Ae(`design:returntype`,typeof(d=typeof Promise<`u`&&Promise)==`function`?d:Object)],e.prototype,`getTempFileURL`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`downloadFile`},title:`下载文件失败`,messages:[`请确认以下各项:`,` 1 - 调用 downloadFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(f=De.ICloudbaseDownloadFileParams!==void 0&&De.ICloudbaseDownloadFileParams)==`function`?f:Object,typeof(p=typeof Function<`u`&&Function)==`function`?p:Object]),Ae(`design:returntype`,typeof(m=typeof Promise<`u`&&Promise)==`function`?m:Object)],e.prototype,`downloadFile`,null),ke([He({customInfo:{className:`Cloudbase`,methodName:`copyFile`},title:`批量复制文件`,messages:[`请确认以下各项:`,` 1 - 调用 copyFile() 的语法或参数是否正确`,` 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety`,` 3 - 云存储安全规则是否限制了当前登录状态访问`,`如果问题依然存在,建议到官方问答社区提问或寻找帮助:${Fe}`]}),Ae(`design:type`,Function),Ae(`design:paramtypes`,[typeof(h=De.ICloudbaseCopyFileParams!==void 0&&De.ICloudbaseCopyFileParams)==`function`?h:Object,typeof(g=typeof Function<`u`&&Function)==`function`?g:Object]),Ae(`design:returntype`,typeof(_=typeof Promise<`u`&&Promise)==`function`?_:Object)],e.prototype,`copyFile`,null),e}(),$e=function(){return $e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$e.apply(this,arguments)},et=function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},I=function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw TypeError(`Generator is already executing.`);for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||s[0]!==6&&s[0]!==2)){o=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(s[0]===6&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},tt=ae,L=function(){function e(e,t){t===void 0&&(t=!1),this.shouldThrowOnError=!1,this.bucketId=``,this.context=e,this.shouldThrowOnError=t,this.storage=new Qe(e)}return Object.defineProperty(e.prototype,"config",{get:function(){return this.context?.config},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.context?.request},enumerable:!1,configurable:!0}),e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.upload=function(e,t,n){return et(this,void 0,Promise,function(){var i,a,o,s,c,l,u,d,f;return I(this,function(p){switch(p.label){case 0:i=$e({upsert:!0},n),a=i.cacheControl,o=i.contentType,s=i.metadata,p.label=1;case 1:return p.trys.push([1,3,,4]),c=this.getCloudPath(e),l={cloudPath:c,filePath:t},(a||o||s)&&(u={},a&&(u[`cache-control`]=a),o&&(u[`content-type`]=o),s&&(u[`x-cos-metadata-metadata`]=this.toBase64(JSON.stringify(s))),l.headers=u),[4,this.storage.uploadFile(l)];case 2:if(!(d=p.sent()).fileID)throw Error(JSON.stringify({code:tt.OPERATION_FAIL,msg:`[${Ue}.update] no fileID returned`}));return[2,{data:{id:d.fileID,path:e,fullPath:e},error:null}];case 3:if(f=p.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.uploadToSignedUrl=function(e,t,n,r){return et(this,void 0,Promise,function(){return I(this,function(t){return[2,this.upload(e,n,r)]})})},e.prototype.createSignedUploadUrl=function(e){return et(this,void 0,Promise,function(){var t,r,i;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=this.getCloudPath(e),[4,this.storage.getUploadMetadata({cloudPath:t})];case 1:return[2,{data:{signedUrl:(r=a.sent().data).url,token:r.token,path:e,authorization:r.authorization,id:r.fileId,cosFileId:r.cosFileId,downloadUrl:r.download_url},error:null}];case 2:if(i=a.sent(),this.shouldThrowOnError)throw i;return[2,{data:null,error:i instanceof n?i:new n(i.message)}];case 3:return[2]}})})},e.prototype.update=function(e,t,n){return et(this,void 0,Promise,function(){return I(this,function(r){return[2,this.upload(e,t,$e($e({},n),{upsert:!0}))]})})},e.prototype.move=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!0}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Move failed`);return[2,{data:{message:`File moved from ${e} to ${t}`},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.copy=function(e,t){return et(this,void 0,Promise,function(){var i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.copyFile({fileList:[{srcPath:this.getCloudPath(e),dstPath:this.getCloudPath(t),overwrite:!0,removeOriginal:!1}]})];case 1:if((i=o.sent()).fileList[0].code&&i.fileList[0].code!==`SUCCESS`)throw new n(i.fileList[0].message||`Copy failed`);return[2,{data:{path:this.getCloudPath(t)},error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.createSignedUrl=function(e,t,i){return et(this,void 0,Promise,function(){var t,a,o,s,c,l,u;return I(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),t=this.normalizeCloudId(e),[4,this.storage.getTempFileURL({fileList:[t]})];case 1:if((a=d.sent()).fileList[0].code!==`SUCCESS`)throw new n(`Failed to create signed URL: [${a.fileList[0].code}] ${a.fileList[0].fileID}`);return o=a.fileList[0].download_url,s=[],i?.download!==void 0&&(typeof i.download==`string`?s.push(`download=${encodeURIComponent(i.download)}`):!0===i.download&&s.push(`download=true`)),i!=null&&i.transform&&(c=this.transformOptsToQueryString(i.transform))&&s.push(c),s.length>0&&(l=o.includes(`?`)?`&`:`?`,o=`${o}${l}${s.join(`&`)}`),[2,{data:{signedUrl:o},error:null}];case 2:if(u=d.sent(),this.shouldThrowOnError)throw u;if(r(u))return[2,{data:null,error:u}];throw u;case 3:return[2]}})})},e.prototype.createSignedUrls=function(e,t){return et(this,void 0,Promise,function(){var t,n,i=this;return I(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),t=e.map(function(e){return i.normalizeCloudId(e)}),[4,this.storage.getTempFileURL({fileList:t})];case 1:return[2,{data:a.sent().fileList.map(function(t,n){return{path:e[n],signedUrl:t.tempFileURL||``,error:t.code===`SUCCESS`?null:t.message}}),error:null}];case 2:if(n=a.sent(),this.shouldThrowOnError)throw n;if(r(n))return[2,{data:null,error:n}];throw n;case 3:return[2]}})})},e.prototype.download=function(e,t){return et(this,void 0,Promise,function(){var i,a,o=this;return I(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),a={},[4,et(o,void 0,void 0,function(){var r,i,a;return I(this,function(o){switch(o.label){case 0:return[4,this.createSignedUrl(e,600,{transform:t})];case 1:if((r=o.sent()).error)throw r.error;return i=encodeURI(r.data?.signedUrl),[4,this.request.reqClass.get({url:i,headers:{},responseType:`blob`})];case 2:if(!(a=o.sent().data))throw new n(`Download failed: no file content`);return[2,new Blob([a])]}})})];case 1:return[2,(a.data=s.sent(),a.error=null,a)];case 2:if(i=s.sent(),this.shouldThrowOnError)throw i;if(r(i))return[2,{data:null,error:i}];throw i;case 3:return[2]}})})},e.prototype.info=function(e){return et(this,void 0,Promise,function(){var t,r,i,a,o,s,c,l;return I(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),t=e.startsWith(`cloud://`),r=t?this.extractPathFromFileId(e):e,i=t?this.extractBucketFromFileId(e):this.bucketId,[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(a=u.sent(),(o=a.fileList[0]).code!==`SUCCESS`)throw new n(o.message);return s=new Date().toISOString(),c=(o.lastModified?new Date(o.lastModified):new Date).toISOString(),[2,{data:{id:o.fileID,version:`1`,name:r,bucketId:i,updatedAt:c,createdAt:c,lastAccessedAt:s,size:o.size,cacheControl:o.cacheControl,contentType:o.contentType,etag:o.etag,lastModified:c,metadata:{}},error:null}];case 2:if(l=u.sent(),this.shouldThrowOnError)throw l;return[2,{data:null,error:l instanceof n?l:new n(l.message)}];case 3:return[2]}})})},e.prototype.exists=function(e){return et(this,void 0,Promise,function(){var t,i,a;return I(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.storage.getFileInfo({fileList:[this.normalizeCloudId(e)]})];case 1:if(t=o.sent(),(i=t.fileList[0]).code===`FILE_NOT_FOUND`)return[2,{data:!1,error:null}];if(i.code!==`SUCCESS`)throw new n(i.message);return[2,{data:!0,error:null}];case 2:if(a=o.sent(),this.shouldThrowOnError)throw a;if(r(a))return[2,{data:null,error:a}];throw a;case 3:return[2]}})})},e.prototype.getPublicUrl=function(e,t){return et(this,void 0,Promise,function(){var n;return I(this,function(r){switch(r.label){case 0:return[4,this.createSignedUrl(e,600,t)];case 1:return(n=r.sent()).data?[2,{data:{publicUrl:n.data.signedUrl}}]:[2,{data:null,error:n.error}]}})})},e.prototype.remove=function(e){return et(this,void 0,Promise,function(){var t,i,a,o,s,c,l,u,d,f,p=this;return I(this,function(m){switch(m.label){case 0:for(m.trys.push([0,3,,4]),t=10,i=[],a=0;a<e.length;a+=t)i.push(e.slice(a,a+t));return[4,Promise.all(i.map(function(e){return Promise.all(e.map(function(e){return p.info(e)}))}))];case 1:return o=m.sent(),s=new Map,o.forEach(function(n,r){n.forEach(function(n,i){n.data&&s.set(e[r*t+i],n.data)})}),c=e.map(function(e){return p.normalizeCloudId(e)}),[4,this.storage.deleteFile({fileList:c})];case 2:if(l=m.sent(),(u=l.fileList.filter(function(e){return e.code!==`SUCCESS`})).length>0)throw new n(`Delete failed for ${u.length} file(s)`);return d=new Date().toISOString(),[2,{data:e.map(function(e){var t=s.get(e);return{name:t?.name,id:t?.id,bucket_id:t?.bucketId,owner:void 0,updated_at:t?.updatedAt||d,created_at:t?.createdAt,last_accessed_at:t?.lastAccessedAt||d,metadata:t?.metadata||{},buckets:{id:t?.bucketId,name:t?.bucketId,owner:void 0,public:!1,created_at:``,updated_at:d}}}),error:null}];case 3:if(f=m.sent(),this.shouldThrowOnError)throw f;if(r(f))return[2,{data:null,error:f}];throw f;case 4:return[2]}})})},e.prototype.list=function(){return et(this,void 0,void 0,function(){return I(this,function(e){throw new n(`Not implemented`)})})},e.prototype.getCloudPath=function(e){return e.replace(/^\/|\/$/g,``).replace(/\/+/g,`/`)},e.prototype.normalizeCloudId=function(e){if(/^cloud:\/\//.test(e))return e;var t=this.getCloudPath(e);if(!this.bucketId)throw new n(`bucketId is not set`);var r=this.config?.env||``;return r?`cloud://${r}.${this.bucketId}/${t}`:void 0},e.prototype.toBase64=function(e){return s(e)},e.prototype.transformOptsToQueryString=function(e){var t=[`imageMogr2`];if(e.width||e.height){var n=e.width||``,r=e.height||``;e.resize===`fill`?t.push(`thumbnail/${n}x${r}!`):e.resize===`contain`?t.push(`thumbnail/${n}x${r}`):t.push(`thumbnail/${n}x${r}^`)}if(e.format&&e.format!==`origin`&&t.push(`format/${e.format}`),e.quality!==void 0){var i=Math.max(1,Math.min(100,e.quality));t.push(`quality/${i}`)}return t.join(`/`)},e.prototype.extractPathFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);return t.length<2?e:t.slice(1).join(`/`)},e.prototype.extractBucketFromFileId=function(e){var t=e.replace(/^cloud:\/\//,``).split(`/`);if(t.length<1)return``;var n=t[0],r=n.indexOf(`.`);return r===-1?n:n.substring(r+1)},e}(),R=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=t}e(t,n),t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),nt=new Qe,rt={name:Ue,entity:{uploadFile:nt.uploadFile,deleteFile:nt.deleteFile,getTempFileURL:nt.getTempFileURL,downloadFile:nt.downloadFile,getUploadMetadata:nt.getUploadMetadata,copyFile:nt.copyFile,getFileInfo:nt.getFileInfo,isGateWay:nt.isGateWay}},it=function(e){function t(){return e!==null&&e.apply(this,arguments)||this}return R(t,e),t.prototype.from=function(e){return e?(k(e,`from`),new te(this.http,e,this.shouldThrowOnError)):new L(this.http.ctx,this.shouldThrowOnError)},t}(re),at={name:`${Ue}/supabase`,IIFE:!0,entity:function(){var e=new WeakMap;Object.defineProperty(this.prototype,"storage",{get:function(){if(e.has(this))return e.get(this);var t=this,n=new it(new Proxy({},{get:function(e,n){return n===`config`?t.config:n===`request`?t.request:void 0}}));return e.set(this,n),n},configurable:!0,enumerable:!0})}};try{cloudbase.registerComponent(rt),cloudbase.registerComponent(at)}catch{}function z(e){try{e.registerComponent(rt),e.registerComponent(at)}catch(e){console.warn(e)}}try{window.registerStorage=z}catch{}var ot=z})(),mo.v;var ho=`2.0.3`,go=[`webhook`,`qmsg`,`serverchan`,`pushplus`,`pushplushxtrip`,`dingtalk`,`wecom`,`bark`,`gocqhttp`,`onebot`,`atri`,`pushdeer`,`igot`,`telegram`,`feishu`,`ifttt`,`wecombot`,`discord`,`wxpusher`,`join`],_o=class extends Error{kind;httpStatus;rawMessage;requestId;constructor(e,t,n={}){super(t),this.name=`TwikooError`,this.kind=e,this.httpStatus=n.httpStatus,this.rawMessage=n.rawMessage??t,this.requestId=n.requestId}},vo={tcb:null,options:{}};function yo(e,t){vo.tcb=e,vo.options=t}function bo(){return vo}function xo(e){return typeof e==`string`&&/^http(s)?:\/\//.test(e)}function So(e,t){return new Promise((n,r)=>{let i=localStorage.getItem(`twikoo-access-token`),a=new XMLHttpRequest,o=Date.now();a.onreadystatechange=()=>{if(a.readyState!==4)return;let e=Date.now()-o;if(a.status===200)try{let e=JSON.parse(a.responseText);e.accessToken&&localStorage.setItem(`twikoo-access-token`,typeof e.accessToken==`string`?e.accessToken:``),n(e)}catch{r(new _o(`UNKNOWN`,`后端返回格式异常`,{rawMessage:a.responseText.slice(0,200)}))}else a.status===0?r(new _o(e>3e4?`TIMEOUT`:`CORS`,`请求被跨域策略拦截或网络不可达`,{rawMessage:a.statusText||`status 0`})):a.status===404?r(new _o(`NOT_FOUND`,`接口地址不存在`,{httpStatus:404,rawMessage:a.responseText.slice(0,200)})):a.status===401||a.status===403?r(new _o(`CLIENT_ERROR`,`认证失败,请重新登录`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):a.status===429?r(new _o(`REJECTED`,`请求过于频繁`,{httpStatus:429,rawMessage:a.responseText.slice(0,200)})):a.status>=500?r(new _o(`SERVER_ERROR`,`后端异常`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)})):r(new _o(`CLIENT_ERROR`,`请求失败(${a.status})`,{httpStatus:a.status,rawMessage:a.responseText.slice(0,200)}))};try{a.open(`POST`,e),a.setRequestHeader(`Content-Type`,`application/json`),a.send(JSON.stringify({accessToken:i,...t,envId:e}))}catch(e){r(new _o(`NETWORK`,`无法连接到后端`,{rawMessage:String(e)}))}})}async function Co(e,t,n={}){let r=e??vo.tcb,i=typeof n.envId==`string`?n.envId:typeof vo.options.envId==`string`?vo.options.envId:void 0,a=typeof n.funcName==`string`?n.funcName:typeof vo.options.funcName==`string`?vo.options.funcName:`twikoo`;if(r)return await r.app.callFunction({name:a,data:{event:t,...n}});if(typeof i==`string`&&xo(i))return await So(i,{event:t,...n});throw Error(`缺少 envId 配置 - https://twikoo.js.org`)}var wo={verbose:1,info:2,warn:3,error:4}[(typeof process<`u`&&process.env,`info`).toLowerCase()]||2,To={verbose:(...e)=>{wo<=1&&console.log(...e)},info:(...e)=>{wo<=2&&console.info(...e)},warn:(...e)=>{wo<=3&&console.warn(...e)},error:(...e)=>{wo<=4&&console.error(...e)}},Eo={ADMIN_CLIENT_VERSION:`前端版本:`,ADMIN_SERVER_VERSION:`云函数版本:`,ADMIN_COMMENT:`评论管理`,ADMIN_COMMENT_DELETE:`删除`,ADMIN_COMMENT_DELETE_CONFIRM:`确认删除?`,ADMIN_COMMENT_FILTER_ALL:`全部`,ADMIN_COMMENT_FILTER_VISIBLE:`只看可见`,ADMIN_COMMENT_FILTER_HIDDEN:`只看隐藏`,ADMIN_COMMENT_HIDE:`隐藏`,ADMIN_COMMENT_IS_SPAM_SUFFIX:` (已隐藏)`,ADMIN_COMMENT_SEARCH:`搜索`,ADMIN_COMMENT_SEARCH_PLACEHOLDER:`搜索昵称、邮箱、网址、IP、评论正文、文章地址`,ADMIN_COMMENT_SHOW:`显示`,ADMIN_COMMENT_TOP:`置顶`,ADMIN_COMMENT_UNTOP:`取消置顶`,ADMIN_COMMENT_VIEW:`查看`,ADMIN_COMMENT_SECURITY_ALERT:`评论链接与本站不同!出于安全考虑,请手动复制以下网址访问:`,ADMIN_COMMENT_PARSE_ERROR:`无法解析评论链接,请仔细检查链接后手动复制以下网址访问:`,ADMIN_CONFIG:`配置管理`,ADMIN_CONFIG_CATEGORY_COMMON:`通用`,ADMIN_CONFIG_CATEGORY_IM:`即时通知`,ADMIN_CONFIG_CATEGORY_MAIL:`邮件通知`,ADMIN_CONFIG_CATEGORY_PLUGIN:`插件`,ADMIN_CONFIG_CATEGORY_PRIVACY:`隐私`,ADMIN_CONFIG_CATEGORY_SPAM:`反垃圾`,ADMIN_CONFIG_CATEGORY_CAPTCHA:`人机验证`,ADMIN_CONFIG_IMAGE_CDN_NONE:`无(不启用图片上传)`,ADMIN_CONFIG_CAPTCHA_NONE:`无`,ADMIN_CONFIG_CAPTCHA_TURNSTILE:`Cloudflare Turnstile`,ADMIN_CONFIG_CAPTCHA_GEETEST:`极验 Geetest`,ADMIN_CONFIG_CAPTCHA_CAP:`Cap`,ADMIN_CONFIG_EMAIL_TEST:`邮件通知测试`,ADMIN_CONFIG_EMAIL_TEST_BTN:`发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_HELP:`输入一个邮箱地址,发送测试邮件`,ADMIN_CONFIG_EMAIL_TEST_RESULT:`测试结果:`,ADMIN_CONFIG_EXAMPLE:`示例:`,ADMIN_CONFIG_ITEM_AKISMET_KEY:`Akismet 反垃圾评论,用于垃圾评论检测,设为 "MANUAL_REVIEW" 开启人工审核,留空不使用反垃圾。注册:https://akismet.com`,ADMIN_CONFIG_ITEM_BLOGGER_NICK:`博主的昵称。`,ADMIN_CONFIG_ITEM_BLOGGER_EMAIL:`博主的邮箱地址,用于邮件通知、博主标识。`,ADMIN_CONFIG_ITEM_COMMENT_BG_IMG:`评论框自定义背景图片 URL 地址。`,ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE:`评论列表分页大小,默认为 8。`,ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER:`评论框提示信息,可用<br>换行,默认为空`,ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN:`CORS 安全域名,注意:如果您不了解什么是 CORS,此项请留空,错误设置会导致无法加载,默认为空,格式为 https://blog.example.com;如需添加多域名请使用,分隔`,ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR:`默认的头像显示。默认值(留空)为 "initials",可选:"404"、"mp"、"identicon"、"monsterid"、"wavatar"、"retro"、"robohash"、"blank"`,ADMIN_CONFIG_ITEM_EMOTION_CDN:`表情 CDN,英文逗号分隔。默认为:https://owo.imaegoo.com/owo.json`,ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS:`违禁词配置,包含违禁词的内容会直接标记为垃圾评论。英文逗号分隔。`,ADMIN_CONFIG_ITEM_BLOCKED_WORDS:`屏蔽词配置,包含屏蔽词的内容会直接评论失败。英文逗号分隔。`,ADMIN_CONFIG_ITEM_GRAVATAR_CDN:`自定义头像 CDN 地址。如:cn.gravatar.com, weavatar.com, cravatar.cn, sdn.geekzu.org, gravatar.loli.net,默认:weavatar.com`,ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT:`隐藏管理面板入口。可设置一个“暗号”,只有在“昵称”一栏输入相同的“暗号”时,管理面板入口才会显示,留空则不隐藏管理入口`,ADMIN_CONFIG_ITEM_QQ_API_KEY:`QQ昵称API密钥,用于获取QQ昵称。前往 https://api.tqq.me/dashboard/api-keys 获取`,ADMIN_CONFIG_ITEM_HIGHLIGHT:`启用代码高亮功能。如果您的主题和代码高亮有冲突,请设为 false。默认:true`,ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME:`代码高亮主题,可选:"default"、"coy"、"dark"、"funky"、"okaidia"、"solarizedlight"、"tomorrow"、"twilight",访问 https://prismjs.com 可预览主题效果。如果您的主题和代码高亮有冲突,请设为 none。默认:none`,ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN:`代码高亮插件,可选:"showLanguage"、"copyButton",分别表示:展示代码语言、展示代码拷贝按钮。可以同时设置多个选项,如果想要不添加任何代码高亮插件,请设为 none。默认:none。`,ADMIN_CONFIG_ITEM_IMAGE_CDN:`插入图片所使用的图床,目前支持:"qcloud"、"7bu (https://7bu.top)"、"see (https://s.ee)"、"lskypro"、"piclist"、"easyimage"、"chevereto"、"S3 / R2 / MinIO"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_URL:`图床的 URL,仅当 IMAGE_CDN 为 "lskypro" / "piclist" / "easyimage" / "s3" 时需要填写`,ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN:`图床 token。qcloud 图床无需设置`,ADMIN_CONFIG_ITEM_NSFW_API_URL:`NSFW 图片检测 API 地址。免费服务:nsfw.qixz.cn,项目:github.com/HG-ha/nsfwpy`,ADMIN_CONFIG_ITEM_NSFW_THRESHOLD:`NSFW 检测阈值(0-1),当检测分数高于此值时拒绝上传。默认:0.5`,ADMIN_CONFIG_ITEM_S3_REGION:`S3 存储区域,例如 us-east-1。使用兼容 S3 的服务(如 Cloudflare R2、MinIO)时可填任意值`,ADMIN_CONFIG_ITEM_S3_BUCKET:`S3 存储桶名称`,ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID:`S3 Access Key ID`,ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY:`S3 Secret Access Key`,ADMIN_CONFIG_ITEM_S3_ENDPOINT:`S3 自定义 Endpoint,使用 Cloudflare R2、MinIO 等兼容 S3 的服务时填写`,ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE:`设置 S3_ENDPOINT 时,是否将 S3_BUCKET 拼入上传地址路径。默认为 true,适用于 Cloudflare R2、MinIO 等 path-style S3 兼容端点;使用已绑定存储桶的自定义域名时设为 false,例如腾讯云 COS 自定义域名`,ADMIN_CONFIG_ITEM_S3_CDN_URL:`S3 图片访问域名(CDN 域名),留空则使用默认 S3/Endpoint URL`,ADMIN_CONFIG_ITEM_S3_PATH_PREFIX:`S3 图片存储路径前缀,例如 images/twikoo,留空则存储在根目录`,ADMIN_CONFIG_ITEM_LIGHTBOX:`使用简易图片点击放大效果。默认:false`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE:`单个 IP 发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL:`全站发言频率限制(条/10分钟),0 为无限制,默认:10`,ADMIN_CONFIG_ITEM_LIMIT_LENGTH:`评论长度限制,0 为无限制,默认:500`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT:`自定义通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN:`自定义博主通知邮件主题,留空则使用默认主题。`,ADMIN_CONFIG_ITEM_MAIL_TEMPLATE:"自定义通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${PARENT_NICK}, ${PARENT_COMMENT}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IMG}, ${PARENT_IMG}",ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN:"自定义博主通知邮件模板,留空则使用默认模板。可包含的字段:${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IP}, ${MAIL}, ${IMG}",ADMIN_CONFIG_ITEM_MASTER_TAG:`博主标识自定义文字,默认为 “博主”。`,ADMIN_CONFIG_ITEM_NOTIFY_SPAM:`垃圾评论是否发送通知,默认:true`,ADMIN_CONFIG_ITEM_HIDE_SPAM:`前台评论区对所有人隐藏垃圾评论,包括管理员和评论作者。评论管理后台仍可审核和恢复。设为 true 开启,默认:false。`,ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER:`人机验证码提供商`,ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY:`Turnstile 验证码的站点密钥。申请地址: https://dash.cloudflare.com/?to=/:account/turnstile`,ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY:`Turnstile 验证码的密钥`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID:`极验验证码的 Captcha ID。申请地址: https://console.geetest.com/sensbot/management`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY:`极验验证码的 Captcha Key`,ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT:`Cap 验证码 API 端点。留空则使用内嵌 Cap(无需额外部署);外部 Standalone 格式:https://<实例地址>/<site_key>/`,ADMIN_CONFIG_ITEM_CAP_SECRET_KEY:`Cap Secret Key(仅外部 Standalone 需要;内嵌模式可留空)`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID:`腾讯云 secret id,用于垃圾评论检测。同时设置腾讯云和 Akismet 时,只有腾讯云会生效。注册:https://twikoo.js.org/cms.html`,ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE:`腾讯云内容安全 Biztype 名称,用于垃圾评论策略。可以自定义垃圾拦截规则`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY:`腾讯云 secret key`,ADMIN_CONFIG_ITEM_LLM_API_KEY:`LLM API Key,用于 AI 垃圾评论检测。仅在未配置腾讯云和 Akismet 时生效。`,ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT:`LLM API 接口地址,默认:https://api.deepseek.com/v1`,ADMIN_CONFIG_ITEM_LLM_MODEL:`LLM 模型名称,默认:deepseek-v4-pro`,ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT:`LLM 垃圾检测提示词(可选,留空则使用默认提示词)`,ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES:`LLM 检测最大重试次数(默认 3 次)`,ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL:`即时消息推送平台名称,支持:"qmsg"、"serverchan"、"pushplus"、"pushplushxtrip"、"dingtalk"、"wecom"、"bark"、"gocqhttp"、"atri"、"pushdeer"、"igot"、"telegram"、"feishu" 等`,ADMIN_CONFIG_ITEM_PUSHOO_TOKEN:`即时消息推送 token。请参考 https://pushoo.js.org 里的详细说明配置`,ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS:`界面上展示的输入框,默认:nick,mail,link`,ADMIN_CONFIG_ITEM_REQUIRED_FIELDS:`评论必填信息,设为 nick,mail,link 代表全必填,设为 none 代表全选填,默认:nick,mail`,ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY:`是否同时通过 IM 和邮件 2 种方式通知博主,默认只通过 IM 通知博主,默认:false`,ADMIN_CONFIG_ITEM_SENDER_EMAIL:`邮件通知邮箱地址。对于大多数邮箱服务商,SENDER_EMAIL 必须和 SMTP_USER 保持一致,否则无法发送邮件。`,ADMIN_CONFIG_ITEM_SENDER_NAME:`邮件通知标题。`,ADMIN_CONFIG_ITEM_SHOW_EMOTION:`启用插入表情功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_IMAGE:`启用插入图片功能,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_ORDER:`评论排序下拉框,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_DISLIKE:`评论点踩按钮,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_UA:`是否显示用户系统和浏览器,默认为:true`,ADMIN_CONFIG_ITEM_SHOW_REGION:`是否显示用户 IP 属地到省,可能不准确,不支持 IPv6,默认为:false`,ADMIN_CONFIG_ITEM_SITE_NAME:`网站名称`,ADMIN_CONFIG_ITEM_SITE_URL:`网站地址`,ADMIN_CONFIG_ITEM_SMTP_HOST:`自定义 SMTP 服务器地址。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_PASS:`邮件通知邮箱密码,QQ、163邮箱请填写授权码。`,ADMIN_CONFIG_ITEM_SMTP_PORT:`自定义 SMTP 端口。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SECURE:`自定义 SMTP 是否使用TLS,请填写 true 或 false。如您已配置 SMTP_SERVICE,此项请留空。`,ADMIN_CONFIG_ITEM_SMTP_SERVICE:`邮件通知邮箱服务商。支持:"126"、"163"、"1und1"、"AOL"、"DebugMail"、"DynectEmail"、"FastMail"、"GandiMail"、"Gmail"、"Godaddy"、"GodaddyAsia"、"GodaddyEurope"、"Hotmail"、"Mail.ru"、"Maildev"、"Mailgun"、"Mailjet"、"Mailosaur"、"Mandrill"、"Naver"、"OpenMailBox"、"Outlook365"、"Postmark"、"QQ"、"QQex"、"SES"、"SES-EU-WEST-1"、"SES-US-EAST-1"、"SES-US-WEST-2"、"SendCloud"、"SendGrid"、"SendPulse"、"SendinBlue"、"Sparkpost"、"Yahoo"、"Yandex"、"Zoho"、"hot.ee"、"iCloud"、"mail.ee"、"qiye.aliyun"`,ADMIN_CONFIG_ITEM_SMTP_USER:`邮件通知邮箱用户名。`,ADMIN_CONFIG_RESET:`重置`,ADMIN_CONFIG_SAVE:`保存`,ADMIN_CREDENTIALS:`私钥文件`,ADMIN_CREDENTIALS_FAQ:`如何获得私钥`,ADMIN_CREDENTIALS_PLACEHOLDER:`请粘贴私钥文件内容`,ADMIN_FORGOT:`忘记密码`,ADMIN_EXPORT:`导出`,ADMIN_EXPORT_WARN:`将全部数据导出为 JSON 文件。如果遇到评论较多、导出失败或缺失数据,请连接数据库手动导出`,ADMIN_EXPORT_COMMENT:`导出评论`,ADMIN_EXPORT_COUNTER:`导出访问量`,ADMIN_IMPORT:`导入`,ADMIN_IMPORT_FILE_REQUIRED:`未选择文件`,ADMIN_IMPORT_IMPORTED:`完成导入 `,ADMIN_IMPORT_IMPORTING:`开始导入 `,ADMIN_IMPORT_LOG:`日志`,ADMIN_IMPORT_SELECT:`请选择`,ADMIN_IMPORT_SELECT_FILE:`选择文件`,ADMIN_IMPORT_SELECT_SOURCE:`选择源系统`,ADMIN_IMPORT_SOURCE_REQUIRED:`未选择源系统`,ADMIN_IMPORT_START:`开始导入`,ADMIN_IMPORT_STARTING:`开始导入`,ADMIN_IMPORT_TIP_ARTALK:`请上传 JSON 格式的 Artalk 导出文件,文件名通常为 comments.data.json`,ADMIN_IMPORT_TIP_DISQUS:`请上传 XML 格式的 Disqus 导出文件,文件名通常为 [网站名称]-[导出时间]-all.xml`,ADMIN_IMPORT_TIP_VALINE:`请上传 JSON 格式的 Valine 导出文件,文件名通常为 Comment.json`,ADMIN_IMPORT_UPLOADED:`上传完成 `,ADMIN_IMPORT_UPLOADING:`已上传 `,ADMIN_IMPORT_WARN:`支持从其他评论系统的备份文件导入评论。
|
|
170
170
|
数据是安全的,导入功能完全在您的云环境进行。
|
|
171
171
|
建议在导入前备份 comment 数据库。`,ADMIN_LOGIN:`登录`,ADMIN_LOGIN_TITLE:`Twikoo 评论管理`,ADMIN_LOGOUT:`退出登录`,ADMIN_NEED_UPDATE:`若要使用评论管理,请更新 Twikoo 云函数`,ADMIN_PASSWORD:`密码`,ADMIN_PASSWORD_PLACEHOLDER:`请输入`,ADMIN_PASSWORD_REQUIRED:`请输入密码`,ADMIN_REGIST:`注册`,ADMIN_REGIST_FAILED:`注册失败`,ADMIN_SET_PASSWORD:`设置密码`,ADMIN_SET_PASSWORD_CONFIRM:`确认密码`,ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER:`确认密码`,ADMIN_SET_PASSWORD_PLACEHOLDER:`密码`,ADMIN_TITLE:`Twikoo 管理面板`,COMMENTS_SEARCH:`搜索`,COMMENTS_SEARCH_PLACEHOLDER:`搜索评论`,COMMENTS_SEARCH_NO_RESULT:`没有找到评论`,COMMENTS_SEARCH_COUNT_PREFIX:`找到 `,COMMENTS_COUNT_SUFFIX:` 条评论`,COMMENTS_SORT_NEWEST:`最新`,COMMENTS_SORT_OLDEST:`最早`,COMMENTS_SORT_POPULAR:`热门`,COMMENTS_EXPAND:`查看更多`,COMMENTS_NO_COMMENTS:`没有评论`,COMMENT_EXPAND:`展开`,COMMENT_COLLAPSE:`收起`,COMMENT_MASTER_TAG:`博主`,COMMENT_REPLIED:`回复`,COMMENT_DELETE_CONFIRM:`确认删除你的评论?`,COMMENT_REVIEWING_TAG:`审核中`,COMMENT_TOP_TAG:`置顶`,COMMENT_FAILED:`评论失败`,META_INPUT_LINK:`网址`,META_INPUT_MAIL:`邮箱`,META_INPUT_NICK:`昵称`,META_INPUT_NOT_REQUIRED:`选填`,META_INPUT_REQUIRED:`必填`,PAGINATION_COUNT_PREFIX:`共 `,PAGINATION_COUNT_SUFFIX:` 条`,PAGINATION_GOTO_PREFIX:`前往`,PAGINATION_GOTO_SUFFIX:`页`,PAGINATION_PAGESIZE:`条/页`,SUBMIT_CANCEL:`取消`,SUBMIT_PREVIEW:`预览`,SUBMIT_SEND:`发送`,IMAGE_UPLOAD_PLACEHOLDER:`图片上传中`,IMAGE_UPLOAD_FAILED:`图片上传失败`,IMAGE_UPLOAD_NSFW:`图片包含不当内容,禁止上传`,IMAGE_UPLOAD_FAILED_NO_CONF:`博主未配置图床服务`,IMAGE_UPLOAD_PLEASE_WAIT:`图片上传中,请稍候再发送`,SUBMIT_SENDING:`发送中`,TIMEAGO_DAYS:`天前`,TIMEAGO_HOURS:`小时前`,TIMEAGO_MINUTES:`分钟前`,TIMEAGO_NOW:`刚刚`,TIMEAGO_SECONDS:`秒前`},Do={ADMIN_CLIENT_VERSION:`Client version: `,ADMIN_SERVER_VERSION:`Server version: `,ADMIN_COMMENT:`Comment`,ADMIN_COMMENT_DELETE:`Delete`,ADMIN_COMMENT_DELETE_CONFIRM:`Confirm deletion?`,ADMIN_COMMENT_FILTER_ALL:`All`,ADMIN_COMMENT_FILTER_VISIBLE:`Visible`,ADMIN_COMMENT_FILTER_HIDDEN:`Hidden`,ADMIN_COMMENT_HIDE:`Hide`,ADMIN_COMMENT_IS_SPAM_SUFFIX:` (Hidden)`,ADMIN_COMMENT_SEARCH:`Search`,ADMIN_COMMENT_SEARCH_PLACEHOLDER:`Search by nick, mail, website, IP, comment, or article path`,ADMIN_COMMENT_SHOW:`Show`,ADMIN_COMMENT_TOP:`Pin`,ADMIN_COMMENT_UNTOP:`Unpin`,ADMIN_COMMENT_VIEW:`View`,ADMIN_COMMENT_SECURITY_ALERT:`The comment link is different from this site! For security reasons, please manually copy the following URL to visit:`,ADMIN_COMMENT_PARSE_ERROR:`Unable to parse comment link. Please check and manually copy the following URL:`,ADMIN_CONFIG:`Configuration`,ADMIN_CONFIG_CATEGORY_COMMON:`General`,ADMIN_CONFIG_CATEGORY_IM:`Instant notification`,ADMIN_CONFIG_CATEGORY_MAIL:`Email notification`,ADMIN_CONFIG_CATEGORY_PLUGIN:`Plugin`,ADMIN_CONFIG_CATEGORY_PRIVACY:`Privacy`,ADMIN_CONFIG_CATEGORY_SPAM:`Spam`,ADMIN_CONFIG_CATEGORY_CAPTCHA:`CAPTCHA`,ADMIN_CONFIG_IMAGE_CDN_NONE:`None (disable image upload)`,ADMIN_CONFIG_CAPTCHA_NONE:`None`,ADMIN_CONFIG_CAPTCHA_TURNSTILE:`Cloudflare Turnstile`,ADMIN_CONFIG_CAPTCHA_GEETEST:`GeeTest`,ADMIN_CONFIG_CAPTCHA_CAP:`Cap`,ADMIN_CONFIG_EMAIL_TEST:`Email notification test`,ADMIN_CONFIG_EMAIL_TEST_BTN:`Send test mail`,ADMIN_CONFIG_EMAIL_TEST_HELP:`Input an email address & send test mail`,ADMIN_CONFIG_EMAIL_TEST_RESULT:`Test result: `,ADMIN_CONFIG_EXAMPLE:`Example: `,ADMIN_CONFIG_ITEM_AKISMET_KEY:`Akismet spam protection. Set to "MANUAL_REVIEW" to enable manual review. Leave it blank to not use anti-spam. Register Akismet: https://akismet.com`,ADMIN_CONFIG_ITEM_BLOGGER_NICK:`Admin nick name.`,ADMIN_CONFIG_ITEM_BLOGGER_EMAIL:`Admin Email address. Used for Email notification and admin identification.`,ADMIN_CONFIG_ITEM_COMMENT_BG_IMG:`URL for custom background image.`,ADMIN_CONFIG_ITEM_COMMENT_PAGE_SIZE:`Comment page size. Default: 8.`,ADMIN_CONFIG_ITEM_COMMENT_PLACEHOLDER:`Comment placeholder. Use <br> to start a newline. Default: empty.`,ADMIN_CONFIG_ITEM_CORS_ALLOW_ORIGIN:`CORS allow origin, note: incorrect settings can cause loading failure. Default: blank, format: https://blog.example.com; If you need to add multiple domain names, please use, separate`,ADMIN_CONFIG_ITEM_DEFAULT_GRAVATAR:`Avatar placeholder. Default (when empty): "initials". Choose from: "404", "mp", "identicon", "monsterid", "wavatar", "retro", "robohash", "blank"`,ADMIN_CONFIG_ITEM_EMOTION_CDN:`Emoji CDN. Separate by comma. Default: https://owo.imaegoo.com/owo.json`,ADMIN_CONFIG_ITEM_FORBIDDEN_WORDS:`Configure prohibited words. Comments containing prohibited words will be auto spammed. Separate by comma.`,ADMIN_CONFIG_ITEM_BLOCKED_WORDS:`Configure blocked words. Comments containing blocked words will fail to send. Separate by comma.`,ADMIN_CONFIG_ITEM_GRAVATAR_CDN:`Custom avator CDN. (Examples: gravatar.com) Default: weavatar.com.`,ADMIN_CONFIG_ITEM_HIDE_ADMIN_CRYPT:`Set a cipher to hide the management panel entrance, only when the same cipher is entered in the nickname field the management panel entry will be displayed. Leave it blank to not hide the management entrance.`,ADMIN_CONFIG_ITEM_QQ_API_KEY:`QQ nickname API key for fetching QQ nickname. Get it from https://api.nsuuu.com/admin/key`,ADMIN_CONFIG_ITEM_HIGHLIGHT:`Enable code highlighting. If your theme conflicts with code highlighting, please set it to false. Default: true.`,ADMIN_CONFIG_ITEM_HIGHLIGHT_THEME:`Code highlighting theme. Select from: "default", "coy", "dark", "funky", "okaidia", "solarizedlight", "tomorrow", "twilight". Visit https://prismjs.com for preview. If your theme conflicts with code highlighting, please set it to none. Default: none.`,ADMIN_CONFIG_ITEM_HIGHLIGHT_PLUGIN:`Code highlight plug-in, optional: "showLanguage", "copyButton", respectively: show code language, show code copy button. Multiple options can be set at the same time, if you want to add no code highlighting plug-ins, please set it to none. Default: none. `,ADMIN_CONFIG_ITEM_IMAGE_CDN:`The image bed for image uploading. Select from: "qcloud", "7bu (https://7bu.top)", "see (https://s.ee)", "lskypro", "piclist", "easyimage", "chevereto", "S3 / R2 / MinIO"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_URL:`The URL for the image bed. Required if your IMAGE_CDN is one of these: "lskypro", "piclist", "easyimage", "s3"`,ADMIN_CONFIG_ITEM_IMAGE_CDN_TOKEN:`The image bed token. Unnessessary for qcloud`,ADMIN_CONFIG_ITEM_NSFW_API_URL:`NSFW image detection API URL. Free services: nsfw.qixz.cn, project: github.com/HG-ha/nsfwpy`,ADMIN_CONFIG_ITEM_NSFW_THRESHOLD:`NSFW detection threshold (0-1). Upload will be rejected if score exceeds this value. Default: 0.5`,ADMIN_CONFIG_ITEM_S3_REGION:`S3 region, e.g. us-east-1. Can be any value when using S3-compatible services (e.g. Cloudflare R2, MinIO)`,ADMIN_CONFIG_ITEM_S3_BUCKET:`S3 bucket name`,ADMIN_CONFIG_ITEM_S3_ACCESS_KEY_ID:`S3 Access Key ID`,ADMIN_CONFIG_ITEM_S3_SECRET_ACCESS_KEY:`S3 Secret Access Key`,ADMIN_CONFIG_ITEM_S3_ENDPOINT:`S3 custom endpoint. Required when using S3-compatible services like Cloudflare R2 or MinIO`,ADMIN_CONFIG_ITEM_S3_FORCE_PATH_STYLE:`When S3_ENDPOINT is set, whether to append S3_BUCKET to the upload URL path. Default: true. Use true for Cloudflare R2, MinIO, and other path-style S3-compatible endpoints; set false for bucket-bound custom domains, such as Tencent Cloud COS custom domains.`,ADMIN_CONFIG_ITEM_S3_CDN_URL:`S3 image access domain (CDN domain). Leave empty to use default S3/Endpoint URL`,ADMIN_CONFIG_ITEM_S3_PATH_PREFIX:`S3 image storage path prefix, e.g. images/twikoo. Leave empty to store in root`,ADMIN_CONFIG_ITEM_LIGHTBOX:`Use simple Lightbox effect. Default: false`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE:`How many comments can be posted by each IP every 10 minutes, 0 is unlimited, default: 10.`,ADMIN_CONFIG_ITEM_LIMIT_PER_MINUTE_ALL:`How many comments can be posted by all IPs every 10 minutes, 0 is unlimited, default: 10.`,ADMIN_CONFIG_ITEM_LIMIT_LENGTH:`Comment length limitation, 0 is unlimited, default: 500.`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT:`Custom Email notification subject. Leave it blank to use the default subject.`,ADMIN_CONFIG_ITEM_MAIL_SUBJECT_ADMIN:`Custom admin Email notification subject. Leave it blank to use the default subject.`,ADMIN_CONFIG_ITEM_MAIL_TEMPLATE:"Custom Email notification template. Leave it blank to use the default template. Fields that can be included: ${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IMG}, ${PARENT_IMG}",ADMIN_CONFIG_ITEM_MAIL_TEMPLATE_ADMIN:"Custom admin Email notification template. Leave it blank to use the default template. Fields that can be included: ${SITE_URL}, ${SITE_NAME}, ${NICK}, ${COMMENT}, ${POST_URL}, ${IP}, ${MAIL}, ${IMG}",ADMIN_CONFIG_ITEM_MASTER_TAG:`Custom admin identifier.`,ADMIN_CONFIG_ITEM_NOTIFY_SPAM:`Notifications for spam comments. Default: true.`,ADMIN_CONFIG_ITEM_HIDE_SPAM:`Hide spam comments from everyone in the public comment section, including admins and comment authors. Comments can still be reviewed and restored in the admin panel. Set to true to enable. Default: false.`,ADMIN_CONFIG_ITEM_CAPTCHA_PROVIDER:`CAPTCHA Provider`,ADMIN_CONFIG_ITEM_TURNSTILE_SITE_KEY:`Turnstile CAPTCHA Site Key. Get from: https://dash.cloudflare.com/?to=/:account/turnstile`,ADMIN_CONFIG_ITEM_TURNSTILE_SECRET_KEY:`Turnstile CAPTCHA Secret Key`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_ID:`GeeTest CAPTCHA ID. Get from: https://console.geetest.com/sensbot/management`,ADMIN_CONFIG_ITEM_GEETEST_CAPTCHA_KEY:`GeeTest CAPTCHA Key`,ADMIN_CONFIG_ITEM_CAP_API_ENDPOINT:`Cap CAPTCHA API endpoint. Leave empty for built-in Cap (no extra server). External Standalone format: https://<instance_url>/<site_key>/`,ADMIN_CONFIG_ITEM_CAP_SECRET_KEY:`Cap Secret Key (external Standalone only; leave empty for built-in)`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_ID:`Tencent Cloud secret id for spam detection. When Tencent Cloud and Akismet are set at the same time, only Tencent Cloud will take effect. Register: https://twikoo.js.org/cms.html`,ADMIN_CONFIG_ITEM_QCLOUD_CMS_BIZTYPE:`Tencent Cloud Content Security Biztype name for spam comment policy. Spam blocking rules can be customized`,ADMIN_CONFIG_ITEM_QCLOUD_SECRET_KEY:`Tencent Cloud secret key.`,ADMIN_CONFIG_ITEM_LLM_API_KEY:`LLM API Key, used for AI spam comment detection. Only takes effect when Tencent Cloud and Akismet are not configured.`,ADMIN_CONFIG_ITEM_LLM_API_ENDPOINT:`LLM API endpoint URL, defaults to https://api.deepseek.com/v1`,ADMIN_CONFIG_ITEM_LLM_MODEL:`LLM model name, default: deepseek-v4-pro`,ADMIN_CONFIG_ITEM_LLM_SPAM_PROMPT:`LLM spam detection prompt (optional, uses default if left empty)`,ADMIN_CONFIG_ITEM_LLM_MAX_RETRIES:`LLM detection maximum retries (default 3)`,ADMIN_CONFIG_ITEM_PUSHOO_CHANNEL:`IM notification push channel. Support: "qmsg", "serverchan", "pushplus", "pushplushxtrip", "dingtalk", "wecom", "bark", "gocqhttp", "atri", "pushdeer", "igot", "telegram", "feishu"`,ADMIN_CONFIG_ITEM_PUSHOO_TOKEN:`IM notification push token. See https://pushoo.js.org for details`,ADMIN_CONFIG_ITEM_DISPLAYED_FIELDS:`Input boxes displayed on the interface. Default: nick,mail,link`,ADMIN_CONFIG_ITEM_REQUIRED_FIELDS:`Required fields for comments. Set to "nick,mail,link" means all fields are required. Set to "none" means all fields are optional. Default: nick,mail.`,ADMIN_CONFIG_ITEM_SC_MAIL_NOTIFY:`Whether to notify admin via IM and email at the same time, the default is to notify admin only via IM. Default: false.`,ADMIN_CONFIG_ITEM_SENDER_EMAIL:`Email address for Email notification. For most email service providers, SENDER_EMAIL must be consistent with SMTP_USER, otherwise emails cannot be sent.`,ADMIN_CONFIG_ITEM_SENDER_NAME:`The title for Email notification.`,ADMIN_CONFIG_ITEM_SHOW_EMOTION:`Enable emojis. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_IMAGE:`Enable picture uploading. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_ORDER:`Show sort dropdown. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_DISLIKE:`Show dislike button. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_UA:`Show users' OS and browser. Default: true.`,ADMIN_CONFIG_ITEM_SHOW_REGION:`Show users' IP region (province). Default: false.`,ADMIN_CONFIG_ITEM_SITE_NAME:`Website name.`,ADMIN_CONFIG_ITEM_SITE_URL:`Website URL.`,ADMIN_CONFIG_ITEM_SMTP_HOST:`Custom SMTP server address. If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_PASS:`Email notification mailbox password. Enter authorization code for QQ/163 mail.`,ADMIN_CONFIG_ITEM_SMTP_PORT:`Custom SMTP port. If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_SECURE:`Custom TLS for SMTP. Enter "true" or "false". If you have configured SMTP_SERVICE, please leave it empty.`,ADMIN_CONFIG_ITEM_SMTP_SERVICE:`Email service provider for Email notification. Support: "126", "163", "1und1", "AOL", "DebugMail", "DynectEmail", "FastMail", "GandiMail", "Gmail", "Godaddy", "GodaddyAsia", "GodaddyEurope", "Hotmail", "Mail.ru", "Maildev", "Mailgun", "Mailjet", "Mailosaur", "Mandrill", "Naver", "OpenMailBox", "Outlook365", "Postmark", "QQ", "QQex", "SES", "SES-EU-WEST-1", "SES-US-EAST-1", "SES-US-WEST-2", "SendCloud", "SendGrid", "SendPulse", "SendinBlue", "Sparkpost", "Yahoo", "Yandex", "Zoho", "hot.ee", "iCloud", "mail.ee", "qiye.aliyun"`,ADMIN_CONFIG_ITEM_SMTP_USER:`Email notification mailbox username.`,ADMIN_CONFIG_RESET:`Reset`,ADMIN_CONFIG_SAVE:`Save`,ADMIN_CREDENTIALS:`Private key file`,ADMIN_CREDENTIALS_FAQ:`How to get the private key`,ADMIN_CREDENTIALS_PLACEHOLDER:`Please paste the contents of the private key file`,ADMIN_FORGOT:`Forget your password`,ADMIN_EXPORT:`Export`,ADMIN_EXPORT_WARN:`Export all data as a JSON file. If you encounter export failures or missing data, connect to the database to export manually`,ADMIN_EXPORT_COMMENT:`Export comment`,ADMIN_EXPORT_COUNTER:`Export counter`,ADMIN_IMPORT:`Import`,ADMIN_IMPORT_FILE_REQUIRED:`No file selected`,ADMIN_IMPORT_IMPORTED:`Imported `,ADMIN_IMPORT_IMPORTING:`Importing `,ADMIN_IMPORT_LOG:`Log`,ADMIN_IMPORT_SELECT:`Select`,ADMIN_IMPORT_SELECT_FILE:`Select file`,ADMIN_IMPORT_SELECT_SOURCE:`Select source`,ADMIN_IMPORT_SOURCE_REQUIRED:`No source selected.`,ADMIN_IMPORT_START:`Start import`,ADMIN_IMPORT_STARTING:`Importing`,ADMIN_IMPORT_TIP_ARTALK:`Please upload the Artalk export file in JSON format.The file name is usually comments.data.json`,ADMIN_IMPORT_TIP_DISQUS:`Please upload the Disqus export file in XML format. The file name is usually [website name]-[export time]-all.xml`,ADMIN_IMPORT_TIP_VALINE:`Please upload the Valine export file in JSON format. The file name is usually Comment.json`,ADMIN_IMPORT_UPLOADED:`Uploaded `,ADMIN_IMPORT_UPLOADING:`Uploading `,ADMIN_IMPORT_WARN:`Import comments from other comment systems.
|
|
172
172
|
The data is safe, and the import function is performed entirely in your cloud environment.
|
|
173
|
-
Please backup your comment database before importing.`,ADMIN_LOGIN:`Sign in`,ADMIN_LOGIN_TITLE:`Twikoo Management Panel`,ADMIN_LOGOUT:`Sign out`,ADMIN_NEED_UPDATE:`A new version of Twikoo is required for comment management.`,ADMIN_PASSWORD:`Password`,ADMIN_PASSWORD_PLACEHOLDER:`Enter your password...`,ADMIN_PASSWORD_REQUIRED:`Please enter your password`,ADMIN_REGIST:`Register`,ADMIN_REGIST_FAILED:`Register failed`,ADMIN_SET_PASSWORD:`Set password`,ADMIN_SET_PASSWORD_CONFIRM:`Confirm password`,ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER:`Confirm password...`,ADMIN_SET_PASSWORD_PLACEHOLDER:`Password`,ADMIN_TITLE:`Twikoo Management Panel`,COMMENTS_SEARCH:`Search`,COMMENTS_SEARCH_PLACEHOLDER:`Search comments`,COMMENTS_SEARCH_NO_RESULT:`No comments found`,COMMENTS_SEARCH_COUNT_PREFIX:`Found `,COMMENTS_COUNT_SUFFIX:` comments`,COMMENTS_SORT_NEWEST:`Newest`,COMMENTS_SORT_OLDEST:`Oldest`,COMMENTS_SORT_POPULAR:`Popular`,COMMENTS_EXPAND:`Load more`,COMMENTS_NO_COMMENTS:`No comment`,COMMENT_EXPAND:`Read more`,COMMENT_COLLAPSE:`Collapse`,COMMENT_MASTER_TAG:`Admin`,COMMENT_REPLIED:`Reply`,COMMENT_DELETE_CONFIRM:`Delete your comment?`,COMMENT_REVIEWING_TAG:`Pending`,COMMENT_TOP_TAG:`Pinned`,COMMENT_FAILED:`Comment failed`,META_INPUT_LINK:`Website`,META_INPUT_MAIL:`Email`,META_INPUT_NICK:`Nickname`,META_INPUT_NOT_REQUIRED:`Optional`,META_INPUT_REQUIRED:`Required`,PAGINATION_COUNT_PREFIX:``,PAGINATION_COUNT_SUFFIX:` entries`,PAGINATION_GOTO_PREFIX:`Goto page`,PAGINATION_GOTO_SUFFIX:``,PAGINATION_PAGESIZE:`entries/page`,SUBMIT_CANCEL:`Cancel`,SUBMIT_PREVIEW:`Preview`,SUBMIT_SEND:`Send`,IMAGE_UPLOAD_PLACEHOLDER:`Uploading image`,IMAGE_UPLOAD_FAILED:`IMAGE UPLOAD FAILED`,IMAGE_UPLOAD_NSFW:`Image contains inappropriate content, upload rejected`,IMAGE_UPLOAD_FAILED_NO_CONF:`The blogger didn't configured any image bed service`,IMAGE_UPLOAD_PLEASE_WAIT:`Uploading image, please try again later`,SUBMIT_SENDING:`Sending`,TIMEAGO_DAYS:`days ago`,TIMEAGO_HOURS:`hours ago`,TIMEAGO_MINUTES:`minutes ago`,TIMEAGO_NOW:`Just now`,TIMEAGO_SECONDS:`seconds ago`},Oo=`en`,ko={"zh-CN":Eo,en:Do},Ao={},jo={zh:`zh-CN`,"zh-cn":`zh-CN`,"zh-hk":`zh-HK`,"zh-tw":`zh-TW`,en:`en`,"en-us":`en`,"en-gb":`en`,uz:`uz-UZ`,"uz-uz":`uz-UZ`,ja:`ja-JP`,"ja-jp":`ja-JP`,ko:`ko-KR`,"ko-kr":`ko-KR`,vi:`vi-VN`,"vi-vn":`vi-VN`,id:`id-ID`,"id-id":`id-ID`},Mo=Oo,No=``;function Po(){if(typeof document>`u`)return``;let e=document.currentScript?.src??``;if(!e){let t=document.querySelectorAll(`script[src]`);for(let n=t.length-1;n>=0;--n){let r=t[n].src;if(/twikoo/i.test(r)){e=r;break}}}return e?e.slice(0,e.lastIndexOf(`/`)):``}function Fo(e={}){let t=e.lang?.toLowerCase(),n=typeof navigator>`u`?void 0:navigator.language?.toLowerCase();return t&&jo[t]||n&&jo[n]||Oo}async function Io(e={}){let t=Fo(e);if(Mo=t,ko[t]||Ao[t])return;let n=(e.localeBaseUrl
|
|
173
|
+
Please backup your comment database before importing.`,ADMIN_LOGIN:`Sign in`,ADMIN_LOGIN_TITLE:`Twikoo Management Panel`,ADMIN_LOGOUT:`Sign out`,ADMIN_NEED_UPDATE:`A new version of Twikoo is required for comment management.`,ADMIN_PASSWORD:`Password`,ADMIN_PASSWORD_PLACEHOLDER:`Enter your password...`,ADMIN_PASSWORD_REQUIRED:`Please enter your password`,ADMIN_REGIST:`Register`,ADMIN_REGIST_FAILED:`Register failed`,ADMIN_SET_PASSWORD:`Set password`,ADMIN_SET_PASSWORD_CONFIRM:`Confirm password`,ADMIN_SET_PASSWORD_CONFIRM_PLACEHOLDER:`Confirm password...`,ADMIN_SET_PASSWORD_PLACEHOLDER:`Password`,ADMIN_TITLE:`Twikoo Management Panel`,COMMENTS_SEARCH:`Search`,COMMENTS_SEARCH_PLACEHOLDER:`Search comments`,COMMENTS_SEARCH_NO_RESULT:`No comments found`,COMMENTS_SEARCH_COUNT_PREFIX:`Found `,COMMENTS_COUNT_SUFFIX:` comments`,COMMENTS_SORT_NEWEST:`Newest`,COMMENTS_SORT_OLDEST:`Oldest`,COMMENTS_SORT_POPULAR:`Popular`,COMMENTS_EXPAND:`Load more`,COMMENTS_NO_COMMENTS:`No comment`,COMMENT_EXPAND:`Read more`,COMMENT_COLLAPSE:`Collapse`,COMMENT_MASTER_TAG:`Admin`,COMMENT_REPLIED:`Reply`,COMMENT_DELETE_CONFIRM:`Delete your comment?`,COMMENT_REVIEWING_TAG:`Pending`,COMMENT_TOP_TAG:`Pinned`,COMMENT_FAILED:`Comment failed`,META_INPUT_LINK:`Website`,META_INPUT_MAIL:`Email`,META_INPUT_NICK:`Nickname`,META_INPUT_NOT_REQUIRED:`Optional`,META_INPUT_REQUIRED:`Required`,PAGINATION_COUNT_PREFIX:``,PAGINATION_COUNT_SUFFIX:` entries`,PAGINATION_GOTO_PREFIX:`Goto page`,PAGINATION_GOTO_SUFFIX:``,PAGINATION_PAGESIZE:`entries/page`,SUBMIT_CANCEL:`Cancel`,SUBMIT_PREVIEW:`Preview`,SUBMIT_SEND:`Send`,IMAGE_UPLOAD_PLACEHOLDER:`Uploading image`,IMAGE_UPLOAD_FAILED:`IMAGE UPLOAD FAILED`,IMAGE_UPLOAD_NSFW:`Image contains inappropriate content, upload rejected`,IMAGE_UPLOAD_FAILED_NO_CONF:`The blogger didn't configured any image bed service`,IMAGE_UPLOAD_PLEASE_WAIT:`Uploading image, please try again later`,SUBMIT_SENDING:`Sending`,TIMEAGO_DAYS:`days ago`,TIMEAGO_HOURS:`hours ago`,TIMEAGO_MINUTES:`minutes ago`,TIMEAGO_NOW:`Just now`,TIMEAGO_SECONDS:`seconds ago`},Oo=`en`,ko={"zh-CN":Eo,en:Do},Ao={},jo={zh:`zh-CN`,"zh-cn":`zh-CN`,"zh-hk":`zh-HK`,"zh-tw":`zh-TW`,en:`en`,"en-us":`en`,"en-gb":`en`,uz:`uz-UZ`,"uz-uz":`uz-UZ`,ja:`ja-JP`,"ja-jp":`ja-JP`,ko:`ko-KR`,"ko-kr":`ko-KR`,vi:`vi-VN`,"vi-vn":`vi-VN`,id:`id-ID`,"id-id":`id-ID`},Mo=Oo,No=``;function Po(){if(typeof document>`u`)return``;let e=document.currentScript?.src??``;if(!e){let t=document.querySelectorAll(`script[src]`);for(let n=t.length-1;n>=0;--n){let r=t[n].src;if(/twikoo/i.test(r)){e=r;break}}}return e?e.slice(0,e.lastIndexOf(`/`)):``}function Fo(e={}){let t=e.lang?.toLowerCase(),n=typeof navigator>`u`?void 0:navigator.language?.toLowerCase();return t&&jo[t]||n&&jo[n]||Oo}async function Io(e={}){let t=Fo(e);if(Mo=t,ko[t]||Ao[t])return;let n=(e.localeBaseUrl||No||Po()).replace(/\/+$/,``);if(!n){console.warn(`[twikoo] 无法推导语言分片基址,${t} 回退英文`);return}let r=`${n}/locales/${t}.js`;try{let e=await import(r),n=e.default??e;n&&typeof n==`object`?Ao[t]=n:console.warn(`[twikoo] 语言分片 ${t} 形态异常,回退英文`)}catch(e){console.warn(`[twikoo] 语言分片 ${r} 加载失败,回退英文:`,e instanceof Error?e.message:String(e))}}function W(e,t){let n=t&&jo[t.toLowerCase()]||Mo;return(Ao[n]??ko[n])?.[e]??ko[Oo]?.[e]??``}function Lo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ro(e){if(Array.isArray(e))return e}function zo(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Bo(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
174
174
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vo(e,t){return Ro(e)||zo(e,t)||Ho(e,t)||Bo()}function Ho(e,t){if(e){if(typeof e==`string`)return Lo(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Lo(e,t):void 0}}var Uo=Object.entries,Wo=Object.setPrototypeOf,Go=Object.isFrozen,Ko=Object.getPrototypeOf,qo=Object.getOwnPropertyDescriptor,Jo=Object.freeze,Yo=Object.seal,Xo=Object.create,Zo=typeof Reflect<`u`&&Reflect,Qo=Zo.apply,$o=Zo.construct;Jo||=function(e){return e},Yo||=function(e){return e},Qo||=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)},$o||=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)};var es=bs(Array.prototype.forEach),ts=bs(Array.prototype.lastIndexOf),ns=bs(Array.prototype.pop),rs=bs(Array.prototype.push),is=bs(Array.prototype.splice),as=Array.isArray,os=bs(String.prototype.toLowerCase),ss=bs(String.prototype.toString),cs=bs(String.prototype.match),ls=bs(String.prototype.replace),us=bs(String.prototype.indexOf),ds=bs(String.prototype.trim),fs=bs(Number.prototype.toString),ps=bs(Boolean.prototype.toString),ms=typeof BigInt>`u`?null:bs(BigInt.prototype.toString),hs=typeof Symbol>`u`?null:bs(Symbol.prototype.toString),gs=bs(Object.prototype.hasOwnProperty),_s=bs(Object.prototype.toString),vs=bs(RegExp.prototype.test),ys=xs(TypeError);function bs(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Qo(e,t,r)}}function xs(e){return function(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return $o(e,n)}}function Ss(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:os;if(Wo&&Wo(e,null),!as(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Go(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Cs(e){for(let t=0;t<e.length;t++)gs(e,t)||(e[t]=null);return e}function ws(e){let t=Xo(null);for(let r of Uo(e)){var n=Vo(r,2);let i=n[0],a=n[1];gs(e,i)&&(t[i]=as(a)?Cs(a):a&&typeof a==`object`&&a.constructor===Object?ws(a):a)}return t}function Ts(e){switch(typeof e){case`string`:return e;case`number`:return fs(e);case`boolean`:return ps(e);case`bigint`:return ms?ms(e):`0`;case`symbol`:return hs?hs(e):`Symbol()`;case`undefined`:return _s(e);case`function`:case`object`:{if(e===null)return _s(e);let t=e,n=Es(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:_s(e)}return _s(e)}default:return _s(e)}}function Es(e,t){for(;e!==null;){let n=qo(e,t);if(n){if(n.get)return bs(n.get);if(typeof n.value==`function`)return bs(n.value)}e=Ko(e)}function n(){return null}return n}function Ds(e){try{return vs(e,``),!0}catch{return!1}}var Os=Jo(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),ks=Jo(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),As=Jo([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),js=Jo([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),Ms=Jo(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Ns=Jo([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ps=Jo([`#text`]),Fs=Jo(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Is=Jo(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Ls=Jo(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Rs=Jo([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),zs=Yo(/{{[\w\W]*|^[\w\W]*}}/g),Bs=Yo(/<%[\w\W]*|^[\w\W]*%>/g),Vs=Yo(/\${[\w\W]*/g),Hs=Yo(/^data-[\-\w.\u00B7-\uFFFF]+$/),Us=Yo(/^aria-[\-\w]+$/),Ws=Yo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Gs=Yo(/^(?:\w+script|data):/i),Ks=Yo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qs=Yo(/^html$/i),Js=Yo(/^[a-z][.\w]*(-[.\w]+)+$/i),Ys=Yo(/<[/\w!]/g),Xs=Yo(/<[/\w]/g),Zs=Yo(/<\/no(script|embed|frames)/i),Qs=Yo(/\/>/i),$s={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ec=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],tc=Jo(Ss({},ec)),nc=function(){let e={};return es(ec,t=>{e[t]=Yo(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Jo(e)}(),rc=function(){return typeof window>`u`?null:window},ic=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},ac=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},oc=function(e,t,n,r){return gs(e,t)&&as(e[t])?Ss(r.base?ws(r.base):{},e[t],r.transform):n},sc=function(e,t,n){let r=gs(e,t)?e[t]:void 0;return r&&typeof r==`object`?ws(r):n()};function cc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:rc(),t=e=>cc(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==$s.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=Es(d,`cloneNode`),p=Es(d,`remove`),m=Es(d,`removeAttributeNode`),h=Es(d,`nextSibling`),g=Es(d,`childNodes`),_=Es(d,`parentNode`),v=Es(d,`shadowRoot`),y=Es(d,`attributes`),b=o&&o.prototype?Es(o.prototype,`nodeType`):null,x=o&&o.prototype?Es(o.prototype,`nodeName`):null,S=o&&o.prototype?Es(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let T,E=``,D,ee=!1,te=0,O=function(){if(te>0)throw ys(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},k=function(e){O(),te++;try{return T.createHTML(e)}finally{te--}},A=function(e){O(),te++;try{return T.createScriptURL(e)}finally{te--}},ne=function(){return ee||=(D=ic(u,i),!0),D},re=n,ie=re.implementation,ae=re.createNodeIterator,oe=re.createDocumentFragment,se=re.getElementsByTagName,ce=r.importNode,le=ac();t.isSupported=typeof Uo==`function`&&typeof _==`function`&&ie&&ie.createHTMLDocument!==void 0;let ue=zs,de=Bs,fe=Vs,pe=Hs,me=Us,he=Gs,ge=Ks,_e=Js,ve=Ws,j=null,ye=Ss({},[...Os,...ks,...As,...Ms,...Ps]),be=null,xe=Ss({},[...Fs,...Is,...Ls,...Rs]),Se=Object.seal(Xo(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ce=null,we=null,Te=Object.seal(Xo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),M=!0,Ee=!0,N=!1,P=!0,De=!1,Oe=!0,ke=!1,Ae=!1,je=null,Me=null,Ne=!1,Pe=!1,Fe=!1,Ie=!1,Le=!0,Re=!1,ze=`user-content-`,Be=!0,Ve=!1,He={},Ue=null,We=Ss({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ge=null,Ke=Ss({},[`audio`,`video`,`img`,`source`,`image`,`track`]),qe=null,Je=Ss({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ye=`http://www.w3.org/1998/Math/MathML`,F=`http://www.w3.org/2000/svg`,Xe=`http://www.w3.org/1999/xhtml`,Ze=Xe,Qe=!1,$e=null,et=Ss({},[Ye,F,Xe],ss),I=Jo([`mi`,`mo`,`mn`,`ms`,`mtext`]),tt=Ss({},I),L=Jo([`annotation-xml`]),R=Ss({},L),nt=Ss({},[`title`,`style`,`font`,`a`,`script`]),rt=null,it=[`application/xhtml+xml`,`text/html`],at=null,z=null,ot=n.createElement(`form`),st=function(e){return e instanceof RegExp||e instanceof Function},ct=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(z&&z===e)return;(!e||typeof e!=`object`)&&(e={}),e=ws(e),rt=it.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,at=rt===`application/xhtml+xml`?ss:os,j=oc(e,`ALLOWED_TAGS`,ye,{transform:at}),be=oc(e,`ALLOWED_ATTR`,xe,{transform:at}),$e=oc(e,`ALLOWED_NAMESPACES`,et,{transform:ss}),qe=oc(e,`ADD_URI_SAFE_ATTR`,Je,{transform:at,base:Je}),Ge=oc(e,`ADD_DATA_URI_TAGS`,Ke,{transform:at,base:Ke}),Ue=oc(e,`FORBID_CONTENTS`,We,{transform:at}),Ce=oc(e,`FORBID_TAGS`,ws({}),{transform:at}),we=oc(e,`FORBID_ATTR`,ws({}),{transform:at}),He=gs(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ws(e.USE_PROFILES):e.USE_PROFILES:!1,M=e.ALLOW_ARIA_ATTR!==!1,Ee=e.ALLOW_DATA_ATTR!==!1,N=e.ALLOW_UNKNOWN_PROTOCOLS||!1,P=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=e.SAFE_FOR_TEMPLATES||!1,Oe=e.SAFE_FOR_XML!==!1,ke=e.WHOLE_DOCUMENT||!1,Pe=e.RETURN_DOM||!1,Fe=e.RETURN_DOM_FRAGMENT||!1,Ie=e.RETURN_TRUSTED_TYPE||!1,Ne=e.FORCE_BODY||!1,Le=e.SANITIZE_DOM!==!1,Re=e.SANITIZE_NAMED_PROPS||!1,Be=e.KEEP_CONTENT!==!1,Ve=e.IN_PLACE||!1,ve=Ds(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ws,Ze=typeof e.NAMESPACE==`string`?e.NAMESPACE:Xe,tt=sc(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Ss({},I)),R=sc(e,`HTML_INTEGRATION_POINTS`,()=>Ss({},L));let t=sc(e,`CUSTOM_ELEMENT_HANDLING`,()=>Xo(null));if(Se=Xo(null),gs(t,`tagNameCheck`)&&st(t.tagNameCheck)&&(Se.tagNameCheck=t.tagNameCheck),gs(t,`attributeNameCheck`)&&st(t.attributeNameCheck)&&(Se.attributeNameCheck=t.attributeNameCheck),gs(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Se.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Yo(Se),De&&(Ee=!1),Fe&&(Pe=!0),He&&(j=Ss({},Ps),be=Xo(null),He.html===!0&&(Ss(j,Os),Ss(be,Fs)),He.svg===!0&&(Ss(j,ks),Ss(be,Is),Ss(be,Rs)),He.svgFilters===!0&&(Ss(j,As),Ss(be,Is),Ss(be,Rs)),He.mathMl===!0&&(Ss(j,Ms),Ss(be,Ls),Ss(be,Rs))),Te.tagCheck=null,Te.attributeCheck=null,gs(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Te.tagCheck=e.ADD_TAGS:as(e.ADD_TAGS)&&(j===ye&&(j=ws(j)),Ss(j,e.ADD_TAGS,at))),gs(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Te.attributeCheck=e.ADD_ATTR:as(e.ADD_ATTR)&&(be===xe&&(be=ws(be)),Ss(be,e.ADD_ATTR,at))),gs(e,`ADD_FORBID_CONTENTS`)&&as(e.ADD_FORBID_CONTENTS)&&(Ue===We&&(Ue=ws(Ue)),Ss(Ue,e.ADD_FORBID_CONTENTS,at)),Be&&(j[`#text`]=!0),ke&&Ss(j,[`html`,`head`,`body`]),j.table&&(Ss(j,[`tbody`]),delete Ce.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw ys(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw ys(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=T;T=e.TRUSTED_TYPES_POLICY;try{E=k(``)}catch(e){throw T=t,e}}else e.TRUSTED_TYPES_POLICY===null?(T=void 0,E=``):(T===void 0&&(T=ne()),T&&typeof E==`string`&&(E=k(``)));Jo&&Jo(e),z=e},lt=Ss({},[...ks,...As,...js]),ut=Ss({},[...Ms,...Ns]),dt=function(e,t,n){return t.namespaceURI===Xe?e===`svg`:t.namespaceURI===Ye?e===`svg`&&(n===`annotation-xml`||tt[n]):!!lt[e]},ft=function(e,t,n){return t.namespaceURI===Xe?e===`math`:t.namespaceURI===F?e===`math`&&R[n]:!!ut[e]},pt=function(e,t,n){return t.namespaceURI===F&&!R[n]||t.namespaceURI===Ye&&!tt[n]?!1:!ut[e]&&(nt[e]||!lt[e])},mt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:Ze,tagName:`template`});let n=os(e.tagName),r=os(t.tagName);return $e[e.namespaceURI]?e.namespaceURI===F?dt(n,t,r):e.namespaceURI===Ye?ft(n,t,r):e.namespaceURI===Xe?pt(n,t,r):!!(rt===`application/xhtml+xml`&&$e[e.namespaceURI]):!1},ht=function(e){rs(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw ys(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},gt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},_t=function(e){bt(e);let t=g(e);if(t){let e=[];es(t,t=>{rs(e,t)}),es(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&>(e,r,i)}},vt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}rs(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Pe||Fe)try{ht(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},yt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||be[at(i)]||gt(e,r,i)}},bt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===$s.element&&yt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},xt=function(e,t){return Oe?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},St=function(e){if(!Oe)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===$s.processingInstruction||n===$s.comment&&vs(Xs,e.data)){try{p(e)}catch{}continue}if(n===$s.element){let t=e,n=at(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&xt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},Ct=function(e){let t=null,r=null;if(Ne)e=`<remove></remove>`+e;else{let t=cs(e,/^[\r\n\t ]+/);r=t&&t[0]}rt===`application/xhtml+xml`&&Ze===Xe&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=T?k(e):e;if(Ze===Xe)try{t=new l().parseFromString(i,rt)}catch{}if(!t||!t.documentElement){t=ie.createDocument(Ze,`template`,null);try{t.documentElement.innerHTML=Qe?E:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ze===Xe?se.call(t,ke?`html`:`body`)[0]:ke?t.documentElement:a},wt=function(e){let t=S?S(e):e.ownerDocument;return ae.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},B=function(e){return e=ls(e,ue,` `),e=ls(e,de,` `),e=ls(e,fe,` `),e},Tt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ae.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=B(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&es(i,e=>{H(e.content)&&Tt(e.content)})},V=function(e){let t=x?x(e):null;return typeof t!=`string`||at(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},H=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===$s.documentFragment}catch{return!1}},U=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Et(e,n,r){e.length!==0&&es(e,e=>{e.call(t,n,r,z)})}let Dt=function(e,t){return!!(Oe&&e.hasChildNodes()&&!U(e.firstElementChild)&&vs(Ys,e.textContent)&&vs(Ys,e.innerHTML)||Oe&&e.namespaceURI===Xe&&tc[t]&&(U(e.firstElementChild)||typeof e.textContent==`string`&&vs(nc[t],e.textContent))||e.nodeType===$s.processingInstruction||Oe&&e.nodeType===$s.comment&&vs(Xs,e.data))},Ot=function(e,t){if(e instanceof RegExp)return vs(e,t);if(e instanceof Function){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return!!e(t,...r)}return!1},kt=function(e,t,n){if(!Ce[t]&&Ft(t)&&Ot(Se.tagNameCheck,t))return!1;if(Be&&!Ue[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return ht(e),!0},At=function(e,t,n,r){return e.length===0?t:t===n||t===r?ws(t):t},jt=function(e,t){return e===t||_(e)!==null?!1:(Ve&&bt(e),!0)},Mt=function(e,n){if(Et(le.beforeSanitizeElements,e,null),jt(e,n))return!0;if(V(e))return ht(e),!0;let r=at(w(e));if(j=At(le.uponSanitizeElement,j,ye,je),Et(le.uponSanitizeElement,e,{tagName:r,allowedTags:j}),jt(e,n))return!0;if(Dt(e,r))return ht(e),!0;if(Ce[r]||!(Te.tagCheck instanceof Function&&Te.tagCheck(r))&&!j[r]){let t=kt(e,r,n);return t===!1&&Et(le.afterSanitizeElements,e,null),t}if(C(e)===$s.element&&!mt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&vs(Zs,e.innerHTML))return ht(e),!0;if(De&&e.nodeType===$s.text){let n=B(e.textContent);e.textContent!==n&&(rs(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Et(le.afterSanitizeElements,e,null),!1},Nt=function(e,t,r){if(we[t]||xt(t,e)||Le&&(t===`id`||t===`name`)&&(r in n||r in ot))return!1;let i=be[t]||Te.attributeCheck instanceof Function&&Te.attributeCheck(t,e);return Ee&&vs(pe,t)||M&&vs(me,t)?!0:i?qe[t]||vs(ve,ls(r,ge,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&us(r,`data:`)===0&&Ge[e]||N&&!vs(he,ls(r,ge,``))?!0:!r:Ft(e)&&Ot(Se.tagNameCheck,e)&&Ot(Se.attributeNameCheck,t,e)||t===`is`&&Se.allowCustomizedBuiltInElements&&Ot(Se.tagNameCheck,r)},Pt=Ss({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Ft=function(e){return!Pt[os(e)]&&vs(_e,e)},It=function(e,t,n,r){if(T&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return k(r);case`TrustedScriptURL`:return A(r)}return r},Lt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!V(e)||(ht(e),!1)}catch{return vt(t,e),!1}},Rt=function(e){Et(le.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||V(e))return;be=At(le.uponSanitizeAttribute,be,xe,Me);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:be,forceKeepAttr:void 0},i=n.length,a=at(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=at(s),d=l,f=s===`value`?d:ds(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,Et(le.uponSanitizeAttribute,e,r),f=r.attrValue,Re&&(u===`id`||u===`name`)&&us(f,ze)!==0&&(vt(s,e,o),f=ze+f,p=!0),Oe&&vs(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){vt(s,e,o);continue}if(u===`attributename`&&cs(f,`href`)){vt(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){vt(s,e,o);continue}if(!P&&vs(Qs,f)){vt(s,e,o);continue}if(De&&(f=B(f)),!Nt(a,u,f)){vt(s,e,o);continue}f=It(a,u,c,f),f!==d&&Lt(e,s,c,f)&&p&&ns(t.removed)}}Et(le.afterSanitizeAttributes,e,null)},zt=function(e){let t=null,n=wt(e);for(Et(le.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Et(le.uponSanitizeShadowNode,t,null),Mt(t,e),Rt(t),H(t.content)&&zt(t.content),C(t)===$s.element){let e=v(t);H(e)&&(Bt(e),zt(e))}Et(le.afterSanitizeShadowDOM,e,null)},Bt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){zt(e.shadow);continue}let n=e.node,r=C(n)===$s.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&at(e)===`template`){let e=n.content;H(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);H(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Qe=!e,Qe&&(e=`<!-->`),typeof e!=`string`&&!U(e)&&(e=Ts(e),typeof e!=`string`))throw ys(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ae?(j=je,be=Me):ct(n),(le.uponSanitizeElement.length>0||le.uponSanitizeAttribute.length>0)&&(j=ws(j)),le.uponSanitizeAttribute.length>0&&(be=ws(be)),t.removed=[];let c=Ve&&typeof e!=`string`&&U(e);if(c){St(e);let t=w(e);if(typeof t==`string`){let n=at(t);if(!j[n]||Ce[n])throw _t(e),ys(`root node is forbidden and cannot be sanitized in-place`)}if(V(e))throw _t(e),ys(`root node is clobbered and cannot be sanitized in-place`);try{Bt(e)}catch(t){throw _t(e),t}}else if(U(e))i=Ct(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===$s.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Bt(i);else{if(!Pe&&!De&&!ke&&e.indexOf(`<`)===-1)return T&&Ie?k(e):e;if(i=Ct(e),!i)return Pe?null:Ie?E:``}i&&Ne&&ht(i.firstChild);let l=c?e:i;try{let e=wt(l);for(;o=e.nextNode();)Mt(o,l),Rt(o),H(o.content)&&zt(o.content)}catch(n){throw c&&(_t(e),es(t.removed,e=>{e.element&&bt(e.element)})),n}if(c)return es(t.removed,e=>{e.element&&bt(e.element)}),De&&Tt(e),e;if(Pe){if(De&&Tt(i),Fe)for(s=oe.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(be.shadowroot||be.shadowrootmode)&&(s=ce.call(r,s,!0)),s}let u=ke?i.outerHTML:i.innerHTML;return ke&&j[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&vs(qs,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
175
175
|
`+u),De&&(u=B(u)),T&&Ie?k(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ct(e),Ae=!0,je=j,Me=be},t.clearConfig=function(){z=null,Ae=!1,je=null,Me=null,T=D,E=``},t.isValidAttribute=function(e,t,n){z||ct({});let r=at(e),i=at(t);return Nt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&gs(le,e)&&rs(le[e],t)},t.removeHook=function(e,t){if(gs(le,e)){if(t!==void 0){let n=ts(le[e],t);return n===-1?void 0:is(le[e],n,1)[0]}return ns(le[e])}},t.removeHooks=function(e){gs(le,e)&&(le[e]=[])},t.removeAllHooks=function(){le=ac()},t}var lc=cc();function uc(e){return lc.sanitize(typeof e==`string`?e:``,{FORBID_TAGS:[`style`],FORBID_ATTR:[`style`]})}var dc=s(((e,t)=>{var n=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&`).replace(/</g,`<`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){n||={};var r,a;switch(i.util.type(t)){case`Object`:if(a=i.util.objId(t),n[a])return n[a];for(var o in r={},n[a]=r,t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case`Array`:return a=i.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(t,i){r[i]=e(t,n)}),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return`none`},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,`gi`),``),e.classList.add(`language-`+n)},currentScript:function(){if(typeof document>`u`)return null;if(document.currentScript&&document.currentScript.tagName===`SCRIPT`)return document.currentScript;try{throw Error()}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName(`script`);for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=i.languages;var a=r[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=r[e];return r[e]=o,i.languages.DFS(i.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,r,a){a||={};var o=i.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var c=t[s],l=i.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:`code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code`};i.hooks.run(`before-highlightall`,r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),i.hooks.run(`before-all-elements-highlight`,r);for(var a=0,o;o=r.elements[a++];)i.highlightElement(o,t===!0,r.callback)},highlightElement:function(t,n,r){var a=i.util.getLanguage(t),o=i.languages[a];i.util.setLanguage(t,a);var s=t.parentElement;s&&s.nodeName.toLowerCase()===`pre`&&i.util.setLanguage(s,a);var c={element:t,language:a,grammar:o,code:t.textContent};function l(e){c.highlightedCode=e,i.hooks.run(`before-insert`,c),c.element.innerHTML=c.highlightedCode,i.hooks.run(`after-highlight`,c),i.hooks.run(`complete`,c),r&&r.call(c.element)}if(i.hooks.run(`before-sanity-check`,c),s=c.element.parentElement,s&&s.nodeName.toLowerCase()===`pre`&&!s.hasAttribute(`tabindex`)&&s.setAttribute(`tabindex`,`0`),!c.code){i.hooks.run(`complete`,c),r&&r.call(c.element);return}if(i.hooks.run(`before-highlight`,c),!c.grammar){l(i.util.encode(c.code));return}if(n&&e.Worker){var u=new Worker(i.filename);u.onmessage=function(e){l(e.data)},u.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else l(i.highlight(c.code,c.grammar,c.language))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(i.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=i.tokenize(r.code,r.grammar),i.hooks.run(`after-tokenize`,r),a.stringify(i.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new c;return l(i,i.head,e),s(e,i,t,i.head,0),d(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(n&&n.length)for(var r=0,a;a=n[r++];)a(t)}},Token:a};e.Prism=i;function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}a.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var r=``;return t.forEach(function(t){r+=e(t,n)}),r}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),i.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`"`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function o(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function s(e,t,n,r,c,d){for(var f in n)if(n.hasOwnProperty(f)&&n[f]){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var x=h.pattern||h,S=r.next,C=c;S!==t.tail&&!(d&&C>=d.reach);C+=S.value.length,S=S.next){var w=S.value;if(t.length>e.length)return;if(!(w instanceof a)){var T=1,E;if(v){if(E=o(x,C,e,_),!E||E.index>=e.length)break;var D=E.index,ee=E.index+E[0].length,te=C;for(te+=S.value.length;D>=te;)S=S.next,te+=S.value.length;if(te-=S.value.length,C=te,S.value instanceof a)continue;for(var O=S;O!==t.tail&&(te<ee||typeof O.value==`string`);O=O.next)T++,te+=O.value.length;T--,w=e.slice(C,te),E.index-=C}else if(E=o(x,0,w,_),!E)continue;var D=E.index,k=E[0],A=w.slice(0,D),ne=w.slice(D+k.length),re=C+w.length;d&&re>d.reach&&(d.reach=re);var ie=S.prev;A&&(ie=l(t,ie,A),C+=A.length),u(t,ie,T);var ae=new a(f,g?i.tokenize(k,g):k,y,k);if(S=l(t,ie,ae),ne&&l(t,S,ne),T>1){var oe={cause:f+`,`+m,reach:re};s(e,t,n,S.prev,C,oe),d&&oe.reach>d.reach&&(d.reach=oe.reach)}}}}}}function c(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function u(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function d(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}if(!e.document)return e.addEventListener&&(i.disableWorkerMessageHandler||e.addEventListener(`message`,function(t){var n=JSON.parse(t.data),r=n.language,a=n.code,o=n.immediateClose;e.postMessage(i.highlight(a,i.languages[r],r)),o&&e.close()},!1)),i;var f=i.util.currentScript();f&&(i.filename=f.src,f.hasAttribute(`data-manual`)&&(i.manual=!0));function p(){i.manual||i.highlightAll()}if(!i.manual){var m=document.readyState;m===`loading`||m===`interactive`&&f&&f.defer?document.addEventListener(`DOMContentLoaded`,p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return i}(typeof window<`u`?window:typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope?self:{});t!==void 0&&t.exports&&(t.exports=n),typeof global<`u`&&(global.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside[`attr-value`].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside[`internal-subset`].inside=n.languages.markup,n.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&/,`&`))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var a={};a[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:i},n.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(e,t){n.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:n.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend(`markup`,{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined(`style`,`css`),n.tag.addAttribute(`style`,`css`))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend(`clike`,{"class-name":[n.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),n.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),n.languages.markup&&(n.languages.markup.tag.addInlined(`script`,`javascript`),n.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),n.languages.js=n.languages.javascript,(function(){if(n===void 0||typeof document>`u`)return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e=`Loading…`,t=function(e,t){return`✖ Error `+e+` while fetching file: `+t},r=`✖ Error: File does not exist or is empty`,i={js:`javascript`,py:`python`,rb:`ruby`,ps1:`powershell`,psm1:`powershell`,sh:`bash`,bat:`batch`,h:`c`,tex:`latex`},a=`data-src-status`,o=`loading`,s=`loaded`,c=`failed`,l=`pre[data-src]:not([`+a+`="`+s+`"]):not([`+a+`="`+o+`"])`;function u(e,n,i){var a=new XMLHttpRequest;a.open(`GET`,e,!0),a.onreadystatechange=function(){a.readyState==4&&(a.status<400&&a.responseText?n(a.responseText):a.status>=400?i(t(a.status,a.statusText)):i(r))},a.send(null)}function d(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||``);if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}n.hooks.add(`before-highlightall`,function(e){e.selector+=`, `+l}),n.hooks.add(`before-sanity-check`,function(t){var r=t.element;if(r.matches(l)){t.code=``,r.setAttribute(a,o);var f=r.appendChild(document.createElement(`CODE`));f.textContent=e;var p=r.getAttribute(`data-src`),m=t.language;if(m===`none`){var h=(/\.(\w+)$/.exec(p)||[,`none`])[1];m=i[h]||h}n.util.setLanguage(f,m),n.util.setLanguage(r,m);var g=n.plugins.autoloader;g&&g.loadLanguages(m),u(p,function(e){r.setAttribute(a,s);var t=d(r.getAttribute(`data-range`));if(t){var i=e.split(/\r\n?|\n/g),o=t[0],c=t[1]==null?i.length:t[1];o<0&&(o+=i.length),o=Math.max(0,Math.min(o-1,i.length)),c<0&&(c+=i.length),c=Math.max(0,Math.min(c,i.length)),e=i.slice(o,c).join(`
|
|
176
176
|
`),r.hasAttribute(`data-start`)||r.setAttribute(`data-start`,String(o+1))}f.textContent=e,n.highlightElement(f)},function(e){r.setAttribute(a,c),f.textContent=e})}}),n.plugins.fileHighlight={highlight:function(e){for(var t=(e||document).querySelectorAll(l),r=0,i;i=t[r++];)n.highlightElement(i)}};var f=!1;n.fileHighlight=function(){f||=(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()})),fc=s((()=>{(function(){if(typeof Prism>`u`||typeof document>`u`)return;var e={javascript:`clike`,actionscript:`javascript`,apex:[`clike`,`sql`],arduino:`cpp`,aspnet:[`markup`,`csharp`],birb:`clike`,bison:`c`,c:`clike`,csharp:`clike`,cpp:`c`,cfscript:`clike`,chaiscript:[`clike`,`cpp`],cilkc:`c`,cilkcpp:`cpp`,coffeescript:`javascript`,crystal:`ruby`,"css-extras":`css`,d:`clike`,dart:`clike`,django:`markup-templating`,ejs:[`javascript`,`markup-templating`],etlua:[`lua`,`markup-templating`],erb:[`ruby`,`markup-templating`],fsharp:`clike`,"firestore-security-rules":`clike`,flow:`javascript`,ftl:`markup-templating`,gml:`clike`,glsl:`c`,go:`clike`,gradle:`clike`,groovy:`clike`,haml:`ruby`,handlebars:`markup-templating`,haxe:`clike`,hlsl:`c`,idris:`haskell`,java:`clike`,javadoc:[`markup`,`java`,`javadoclike`],jolie:`clike`,jsdoc:[`javascript`,`javadoclike`,`typescript`],"js-extras":`javascript`,json5:`json`,jsonp:`json`,"js-templates":`javascript`,kotlin:`clike`,latte:[`clike`,`markup-templating`,`php`],less:`css`,lilypond:`scheme`,liquid:`markup-templating`,markdown:`markup`,"markup-templating":`markup`,mongodb:`javascript`,n4js:`javascript`,objectivec:`c`,opencl:`c`,parser:`markup`,php:`markup-templating`,phpdoc:[`php`,`javadoclike`],"php-extras":`php`,plsql:`sql`,processing:`clike`,protobuf:`clike`,pug:[`markup`,`javascript`],purebasic:`clike`,purescript:`haskell`,qsharp:`clike`,qml:`javascript`,qore:`clike`,racket:`scheme`,cshtml:[`markup`,`csharp`],jsx:[`markup`,`javascript`],tsx:[`jsx`,`typescript`],reason:`clike`,ruby:`clike`,sass:`css`,scss:`css`,scala:`java`,"shell-session":`bash`,smarty:`markup-templating`,solidity:`clike`,soy:`markup-templating`,sparql:`turtle`,sqf:`clike`,squirrel:`clike`,stata:[`mata`,`java`,`python`],"t4-cs":[`t4-templating`,`csharp`],"t4-vb":[`t4-templating`,`vbnet`],tap:`yaml`,tt2:[`clike`,`markup-templating`],textile:`markup`,twig:`markup-templating`,typescript:`javascript`,v:`clike`,vala:`clike`,vbnet:`basic`,velocity:`markup`,wiki:`markup`,xeora:`markup`,"xml-doc":`markup`,xquery:`markup`},t={html:`markup`,xml:`markup`,svg:`markup`,mathml:`markup`,ssml:`markup`,atom:`markup`,rss:`markup`,js:`javascript`,g4:`antlr4`,ino:`arduino`,"arm-asm":`armasm`,art:`arturo`,adoc:`asciidoc`,avs:`avisynth`,avdl:`avro-idl`,gawk:`awk`,sh:`bash`,shell:`bash`,shortcode:`bbcode`,rbnf:`bnf`,oscript:`bsl`,cs:`csharp`,dotnet:`csharp`,cfc:`cfscript`,"cilk-c":`cilkc`,"cilk-cpp":`cilkcpp`,cilk:`cilkcpp`,coffee:`coffeescript`,conc:`concurnas`,jinja2:`django`,"dns-zone":`dns-zone-file`,dockerfile:`docker`,gv:`dot`,eta:`ejs`,xlsx:`excel-formula`,xls:`excel-formula`,gamemakerlanguage:`gml`,po:`gettext`,gni:`gn`,ld:`linker-script`,"go-mod":`go-module`,hbs:`handlebars`,mustache:`handlebars`,hs:`haskell`,idr:`idris`,gitignore:`ignore`,hgignore:`ignore`,npmignore:`ignore`,webmanifest:`json`,kt:`kotlin`,kts:`kotlin`,kum:`kumir`,tex:`latex`,context:`latex`,ly:`lilypond`,emacs:`lisp`,elisp:`lisp`,"emacs-lisp":`lisp`,md:`markdown`,moon:`moonscript`,n4jsd:`n4js`,nani:`naniscript`,objc:`objectivec`,qasm:`openqasm`,objectpascal:`pascal`,px:`pcaxis`,pcode:`peoplecode`,plantuml:`plant-uml`,pq:`powerquery`,mscript:`powerquery`,pbfasm:`purebasic`,purs:`purescript`,py:`python`,qs:`qsharp`,rkt:`racket`,razor:`cshtml`,rpy:`renpy`,res:`rescript`,robot:`robotframework`,rb:`ruby`,"sh-session":`shell-session`,shellsession:`shell-session`,smlnj:`sml`,sol:`solidity`,sln:`solution-file`,rq:`sparql`,sclang:`supercollider`,t4:`t4-cs`,trickle:`tremor`,troy:`tremor`,trig:`turtle`,ts:`typescript`,tsconfig:`typoscript`,uscript:`unrealscript`,uc:`unrealscript`,url:`uri`,vb:`visual-basic`,vba:`visual-basic`,webidl:`web-idl`,mathematica:`wolfram`,nb:`wolfram`,wl:`wolfram`,xeoracube:`xeora`,yml:`yaml`},n={},r=`none`,i=`components/`,a=Prism.util.currentScript();if(a){var o=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,s=/(^|\/)[\w-]+\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,c=a.getAttribute(`data-autoloader-path`);if(c!=null)i=c.trim().replace(/\/?$/,`/`);else{var l=a.src;o.test(l)?i=l.replace(o,`components/`):s.test(l)&&(i=l.replace(s,`$1components/`))}}var u=Prism.plugins.autoloader={languages_path:i,use_minified:!0,loadLanguages:h};function d(e,t,n){var r=document.createElement(`script`);r.src=e,r.async=!0,r.onload=function(){document.body.removeChild(r),t&&t()},r.onerror=function(){document.body.removeChild(r),n&&n()},document.body.appendChild(r)}function f(e){var t=(e.getAttribute(`data-dependencies`)||``).trim();if(!t){var n=e.parentElement;n&&n.tagName.toLowerCase()===`pre`&&(t=(n.getAttribute(`data-dependencies`)||``).trim())}return t?t.split(/\s*,\s*/g):[]}function p(e){if(e.indexOf(`!`)>=0)return!1;if(e=t[e]||e,e in Prism.languages)return!0;var r=n[e];return r&&!r.error&&r.loading===!1}function m(e){return u.languages_path+`prism-`+e+(u.use_minified?`.min`:``)+`.js`}function h(e,t,n){typeof e==`string`&&(e=[e]);var r=e.length,i=0,a=!1;if(r===0){t&&setTimeout(t,0);return}function o(){a||(i++,i===r&&t&&t(e))}e.forEach(function(e){g(e,o,function(){a||(a=!0,n&&n(e))})})}function g(r,i,a){var o=r.indexOf(`!`)>=0;r=r.replace(`!`,``),r=t[r]||r;function s(){var e=n[r];e||=n[r]={callbacks:[]},e.callbacks.push({success:i,error:a}),!o&&p(r)?_(r,`success`):!o&&e.error?_(r,`error`):(o||!e.loading)&&(e.loading=!0,e.error=!1,d(m(r),function(){e.loading=!1,_(r,`success`)},function(){e.loading=!1,e.error=!0,_(r,`error`)}))}var c=e[r];c&&c.length?h(c,s,a):s()}function _(e,t){if(n[e]){for(var r=n[e].callbacks,i=0,a=r.length;i<a;i++){var o=r[i][t];o&&setTimeout(o,0)}r.length=0}}Prism.hooks.add(`complete`,function(e){var t=e.element,n=e.language;if(t&&n&&n!==r){var i=f(t);/^diff-./i.test(n)?(i.push(`diff`),i.push(n.substr(5))):i.push(n),i.every(p)||h(i,function(){Prism.highlightElement(t)})}})})()})),pc=s((()=>{(function(){if(typeof Prism>`u`||typeof document>`u`)return;var e=[],t={},n=function(){};Prism.plugins.toolbar={};var r=Prism.plugins.toolbar.registerButton=function(n,r){var i=typeof r==`function`?r:function(e){var t;return typeof r.onClick==`function`?(t=document.createElement(`button`),t.type=`button`,t.addEventListener(`click`,function(){r.onClick.call(this,e)})):typeof r.url==`string`?(t=document.createElement(`a`),t.href=r.url):t=document.createElement(`span`),r.className&&t.classList.add(r.className),t.textContent=r.text,t};if(n in t){console.warn(`There is a button with the key "`+n+`" registered already.`);return}e.push(t[n]=i)};function i(e){for(;e;){var t=e.getAttribute(`data-toolbar-order`);if(t!=null)return t=t.trim(),t.length?t.split(/\s*,\s*/g):[];e=e.parentElement}}var a=Prism.plugins.toolbar.hook=function(r){var a=r.element.parentNode;if(a&&/pre/i.test(a.nodeName)&&!a.parentNode.classList.contains(`code-toolbar`)){var o=document.createElement(`div`);o.classList.add(`code-toolbar`),a.parentNode.insertBefore(o,a),o.appendChild(a);var s=document.createElement(`div`);s.classList.add(`toolbar`);var c=e,l=i(r.element);l&&(c=l.map(function(e){return t[e]||n})),c.forEach(function(e){var t=e(r);if(t){var n=document.createElement(`div`);n.classList.add(`toolbar-item`),n.appendChild(t),s.appendChild(n)}}),o.appendChild(s)}};r(`label`,function(e){var t=e.element.parentNode;if(t&&/pre/i.test(t.nodeName)&&t.hasAttribute(`data-label`)){var n,r,i=t.getAttribute(`data-label`);try{r=document.querySelector(`template#`+i)}catch{}return r?n=r.content:(t.hasAttribute(`data-url`)?(n=document.createElement(`a`),n.href=t.getAttribute(`data-url`)):n=document.createElement(`span`),n.textContent=i),n}}),Prism.hooks.add(`complete`,a)})()})),mc=s((()=>{(function(){if(typeof Prism<`u`&&typeof document<`u`){if(!Prism.plugins.toolbar){console.warn(`Show Languages plugin loaded before Toolbar plugin.`);return}var e={none:`Plain text`,plain:`Plain text`,plaintext:`Plain text`,text:`Plain text`,txt:`Plain text`,html:`HTML`,xml:`XML`,svg:`SVG`,mathml:`MathML`,ssml:`SSML`,rss:`RSS`,css:`CSS`,clike:`C-like`,js:`JavaScript`,abap:`ABAP`,abnf:`ABNF`,al:`AL`,antlr4:`ANTLR4`,g4:`ANTLR4`,apacheconf:`Apache Configuration`,apl:`APL`,aql:`AQL`,ino:`Arduino`,arff:`ARFF`,armasm:`ARM Assembly`,"arm-asm":`ARM Assembly`,art:`Arturo`,asciidoc:`AsciiDoc`,adoc:`AsciiDoc`,aspnet:`ASP.NET (C#)`,asm6502:`6502 Assembly`,asmatmel:`Atmel AVR Assembly`,autohotkey:`AutoHotkey`,autoit:`AutoIt`,avisynth:`AviSynth`,avs:`AviSynth`,"avro-idl":`Avro IDL`,avdl:`Avro IDL`,awk:`AWK`,gawk:`GAWK`,sh:`Shell`,basic:`BASIC`,bbcode:`BBcode`,bbj:`BBj`,bnf:`BNF`,rbnf:`RBNF`,bqn:`BQN`,bsl:`BSL (1C:Enterprise)`,oscript:`OneScript`,csharp:`C#`,cs:`C#`,dotnet:`C#`,cpp:`C++`,cfscript:`CFScript`,cfc:`CFScript`,cil:`CIL`,cilkc:`Cilk/C`,"cilk-c":`Cilk/C`,cilkcpp:`Cilk/C++`,"cilk-cpp":`Cilk/C++`,cilk:`Cilk/C++`,cmake:`CMake`,cobol:`COBOL`,coffee:`CoffeeScript`,conc:`Concurnas`,csp:`Content-Security-Policy`,"css-extras":`CSS Extras`,csv:`CSV`,cue:`CUE`,dataweave:`DataWeave`,dax:`DAX`,django:`Django/Jinja2`,jinja2:`Django/Jinja2`,"dns-zone-file":`DNS zone file`,"dns-zone":`DNS zone file`,dockerfile:`Docker`,dot:`DOT (Graphviz)`,gv:`DOT (Graphviz)`,ebnf:`EBNF`,editorconfig:`EditorConfig`,ejs:`EJS`,etlua:`Embedded Lua templating`,erb:`ERB`,"excel-formula":`Excel Formula`,xlsx:`Excel Formula`,xls:`Excel Formula`,fsharp:`F#`,"firestore-security-rules":`Firestore security rules`,ftl:`FreeMarker Template Language`,gml:`GameMaker Language`,gamemakerlanguage:`GameMaker Language`,gap:`GAP (CAS)`,gcode:`G-code`,gdscript:`GDScript`,gedcom:`GEDCOM`,gettext:`gettext`,po:`gettext`,glsl:`GLSL`,gn:`GN`,gni:`GN`,"linker-script":`GNU Linker Script`,ld:`GNU Linker Script`,"go-module":`Go module`,"go-mod":`Go module`,graphql:`GraphQL`,hbs:`Handlebars`,hs:`Haskell`,hcl:`HCL`,hlsl:`HLSL`,http:`HTTP`,hpkp:`HTTP Public-Key-Pins`,hsts:`HTTP Strict-Transport-Security`,ichigojam:`IchigoJam`,"icu-message-format":`ICU Message Format`,idr:`Idris`,ignore:`.ignore`,gitignore:`.gitignore`,hgignore:`.hgignore`,npmignore:`.npmignore`,inform7:`Inform 7`,javadoc:`JavaDoc`,javadoclike:`JavaDoc-like`,javastacktrace:`Java stack trace`,jq:`JQ`,jsdoc:`JSDoc`,"js-extras":`JS Extras`,json:`JSON`,webmanifest:`Web App Manifest`,json5:`JSON5`,jsonp:`JSONP`,jsstacktrace:`JS stack trace`,"js-templates":`JS Templates`,keepalived:`Keepalived Configure`,kts:`Kotlin Script`,kt:`Kotlin`,kumir:`KuMir (КуМир)`,kum:`KuMir (КуМир)`,latex:`LaTeX`,tex:`TeX`,context:`ConTeXt`,lilypond:`LilyPond`,ly:`LilyPond`,emacs:`Lisp`,elisp:`Lisp`,"emacs-lisp":`Lisp`,llvm:`LLVM IR`,log:`Log file`,lolcode:`LOLCODE`,magma:`Magma (CAS)`,md:`Markdown`,"markup-templating":`Markup templating`,matlab:`MATLAB`,maxscript:`MAXScript`,mel:`MEL`,metafont:`METAFONT`,mongodb:`MongoDB`,moon:`MoonScript`,n1ql:`N1QL`,n4js:`N4JS`,n4jsd:`N4JS`,"nand2tetris-hdl":`Nand To Tetris HDL`,naniscript:`Naninovel Script`,nani:`Naninovel Script`,nasm:`NASM`,neon:`NEON`,nginx:`nginx`,nsis:`NSIS`,objectivec:`Objective-C`,objc:`Objective-C`,ocaml:`OCaml`,opencl:`OpenCL`,openqasm:`OpenQasm`,qasm:`OpenQasm`,parigp:`PARI/GP`,objectpascal:`Object Pascal`,psl:`PATROL Scripting Language`,pcaxis:`PC-Axis`,px:`PC-Axis`,peoplecode:`PeopleCode`,pcode:`PeopleCode`,php:`PHP`,phpdoc:`PHPDoc`,"php-extras":`PHP Extras`,"plant-uml":`PlantUML`,plantuml:`PlantUML`,plsql:`PL/SQL`,powerquery:`PowerQuery`,pq:`PowerQuery`,mscript:`PowerQuery`,powershell:`PowerShell`,promql:`PromQL`,properties:`.properties`,protobuf:`Protocol Buffers`,purebasic:`PureBasic`,pbfasm:`PureBasic`,purs:`PureScript`,py:`Python`,qsharp:`Q#`,qs:`Q#`,q:`Q (kdb+ database)`,qml:`QML`,rkt:`Racket`,cshtml:`Razor C#`,razor:`Razor C#`,jsx:`React JSX`,tsx:`React TSX`,renpy:`Ren'py`,rpy:`Ren'py`,res:`ReScript`,rest:`reST (reStructuredText)`,robotframework:`Robot Framework`,robot:`Robot Framework`,rb:`Ruby`,sas:`SAS`,sass:`Sass (Sass)`,scss:`Sass (SCSS)`,"shell-session":`Shell session`,"sh-session":`Shell session`,shellsession:`Shell session`,sml:`SML`,smlnj:`SML/NJ`,solidity:`Solidity (Ethereum)`,sol:`Solidity (Ethereum)`,"solution-file":`Solution file`,sln:`Solution file`,soy:`Soy (Closure Template)`,sparql:`SPARQL`,rq:`SPARQL`,"splunk-spl":`Splunk SPL`,sqf:`SQF: Status Quo Function (Arma 3)`,sql:`SQL`,stata:`Stata Ado`,iecst:`Structured Text (IEC 61131-3)`,supercollider:`SuperCollider`,sclang:`SuperCollider`,systemd:`Systemd configuration file`,"t4-templating":`T4 templating`,"t4-cs":`T4 Text Templates (C#)`,t4:`T4 Text Templates (C#)`,"t4-vb":`T4 Text Templates (VB)`,tap:`TAP`,tt2:`Template Toolkit 2`,toml:`TOML`,trickle:`trickle`,troy:`troy`,trig:`TriG`,ts:`TypeScript`,tsconfig:`TSConfig`,uscript:`UnrealScript`,uc:`UnrealScript`,uorazor:`UO Razor Script`,uri:`URI`,url:`URL`,vbnet:`VB.Net`,vhdl:`VHDL`,vim:`vim`,"visual-basic":`Visual Basic`,vba:`VBA`,vb:`Visual Basic`,wasm:`WebAssembly`,"web-idl":`Web IDL`,webidl:`Web IDL`,wgsl:`WGSL`,wiki:`Wiki markup`,wolfram:`Wolfram language`,nb:`Mathematica Notebook`,wl:`Wolfram language`,xeoracube:`XeoraCube`,"xml-doc":`XML doc (.net)`,xojo:`Xojo (REALbasic)`,xquery:`XQuery`,yaml:`YAML`,yml:`YAML`,yang:`YANG`};Prism.plugins.toolbar.registerButton(`show-language`,function(t){var n=t.element.parentNode;if(!n||!/pre/i.test(n.nodeName))return;function r(e){return e&&(e.substring(0,1).toUpperCase()+e.substring(1)).replace(/s(?=cript)/,`S`)}var i=n.getAttribute(`data-language`)||e[t.language]||r(t.language);if(i){var a=document.createElement(`span`);return a.textContent=i,a}})}})()})),hc=s((()=>{(function(){if(typeof Prism>`u`||typeof document>`u`)return;if(!Prism.plugins.toolbar){console.warn(`Copy to Clipboard plugin loaded before Toolbar plugin.`);return}function e(e,t){e.addEventListener(`click`,function(){n(t)})}function t(e){var t=document.createElement(`textarea`);t.value=e.getText(),t.style.top=`0`,t.style.left=`0`,t.style.position=`fixed`,document.body.appendChild(t),t.focus(),t.select();try{var n=document.execCommand(`copy`);setTimeout(function(){n?e.success():e.error()},1)}catch(t){setTimeout(function(){e.error(t)},1)}document.body.removeChild(t)}function n(e){navigator.clipboard?navigator.clipboard.writeText(e.getText()).then(e.success,function(){t(e)}):t(e)}function r(e){window.getSelection().selectAllChildren(e)}function i(e){var t={copy:`Copy`,"copy-error":`Press Ctrl+C to copy`,"copy-success":`Copied!`,"copy-timeout":5e3},n=`data-prismjs-`;for(var r in t){for(var i=n+r,a=e;a&&!a.hasAttribute(i);)a=a.parentElement;a&&(t[r]=a.getAttribute(i))}return t}Prism.plugins.toolbar.registerButton(`copy-to-clipboard`,function(t){var n=t.element,a=i(n),o=document.createElement(`button`);o.className=`copy-to-clipboard-button`,o.setAttribute(`type`,`button`);var s=document.createElement(`span`);return o.appendChild(s),l(`copy`),e(o,{getText:function(){return n.textContent},success:function(){l(`copy-success`),c()},error:function(){l(`copy-error`),setTimeout(function(){r(n)},1),c()}}),o;function c(){setTimeout(function(){l(`copy`)},a[`copy-timeout`])}function l(e){s.textContent=a[e],o.setAttribute(`data-copy-state`,e)}})})()})),gc=`https://cdn.jsdelivr.net/npm/prismjs@1.28.0`,_c=null,vc=new Set,yc=null;function bc(){let e=bo().options.prismCdn;return typeof e==`string`&&e?e:gc}function xc(){return document.getElementById(`twikoo`)??document.querySelector(`.twikoo`)??document.body}async function Sc(){let e=window;e.Prism=e.Prism??{},e.Prism.manual=!0;let t=await Promise.resolve().then(()=>u(dc())),n=t.default??t;e.Prism=n,await Promise.resolve().then(()=>u(fc()));let r=n.plugins.autoloader;return r&&(r.languages_path=`${bc()}/components/`),vc.add(`autoloader`),n}async function Cc(e){if(!e||e===`none`)return;let t=e.split(`,`).map(e=>e.trim()).filter(e=>e===`showLanguage`||e===`copyButton`);if(!(t.length===0||t.every(e=>vc.has(e)))){await Promise.resolve().then(()=>u(pc()));for(let e of t)e===`showLanguage`?await Promise.resolve().then(()=>u(mc())):await Promise.resolve().then(()=>u(hc())),vc.add(e)}}function wc(e,t){if(!e||e===`none`)return;let n=xc();if(yc&&n.contains(yc))return;let r=document.createElement(`link`);r.href=e==="default"?`${t}/themes/prism.min.css`:`${t}/themes/prism-${e}.min.css`,r.rel=`stylesheet`,r.type=`text/css`,n.appendChild(r),yc=r}function Tc(e,t,n){e&&(_c??=Sc().catch(e=>(To.warn(`Prism 代码高亮加载失败`,e),null)),_c.then(async r=>{r&&(await Cc(n??``),wc(t??``,bc()),r.highlightAllUnder(e))}).catch(e=>To.warn(`代码高亮执行失败`,e)))}var Ec=u(s(((e,t)=>{(function(e){"use strict";function n(e,t){var n=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(n>>16)<<16|n&65535}function r(e,t){return e<<t|e>>>32-t}function i(e,t,i,a,o,s){return n(r(n(n(t,e),n(a,s)),o),i)}function a(e,t,n,r,a,o,s){return i(t&n|~t&r,e,t,a,o,s)}function o(e,t,n,r,a,o,s){return i(t&r|n&~r,e,t,a,o,s)}function s(e,t,n,r,a,o,s){return i(t^n^r,e,t,a,o,s)}function c(e,t,n,r,a,o,s){return i(n^(t|~r),e,t,a,o,s)}function l(e,t){e[t>>5]|=128<<t%32,e[(t+64>>>9<<4)+14]=t;var r,i,l,u,d,f=1732584193,p=-271733879,m=-1732584194,h=271733878;for(r=0;r<e.length;r+=16)i=f,l=p,u=m,d=h,f=a(f,p,m,h,e[r],7,-680876936),h=a(h,f,p,m,e[r+1],12,-389564586),m=a(m,h,f,p,e[r+2],17,606105819),p=a(p,m,h,f,e[r+3],22,-1044525330),f=a(f,p,m,h,e[r+4],7,-176418897),h=a(h,f,p,m,e[r+5],12,1200080426),m=a(m,h,f,p,e[r+6],17,-1473231341),p=a(p,m,h,f,e[r+7],22,-45705983),f=a(f,p,m,h,e[r+8],7,1770035416),h=a(h,f,p,m,e[r+9],12,-1958414417),m=a(m,h,f,p,e[r+10],17,-42063),p=a(p,m,h,f,e[r+11],22,-1990404162),f=a(f,p,m,h,e[r+12],7,1804603682),h=a(h,f,p,m,e[r+13],12,-40341101),m=a(m,h,f,p,e[r+14],17,-1502002290),p=a(p,m,h,f,e[r+15],22,1236535329),f=o(f,p,m,h,e[r+1],5,-165796510),h=o(h,f,p,m,e[r+6],9,-1069501632),m=o(m,h,f,p,e[r+11],14,643717713),p=o(p,m,h,f,e[r],20,-373897302),f=o(f,p,m,h,e[r+5],5,-701558691),h=o(h,f,p,m,e[r+10],9,38016083),m=o(m,h,f,p,e[r+15],14,-660478335),p=o(p,m,h,f,e[r+4],20,-405537848),f=o(f,p,m,h,e[r+9],5,568446438),h=o(h,f,p,m,e[r+14],9,-1019803690),m=o(m,h,f,p,e[r+3],14,-187363961),p=o(p,m,h,f,e[r+8],20,1163531501),f=o(f,p,m,h,e[r+13],5,-1444681467),h=o(h,f,p,m,e[r+2],9,-51403784),m=o(m,h,f,p,e[r+7],14,1735328473),p=o(p,m,h,f,e[r+12],20,-1926607734),f=s(f,p,m,h,e[r+5],4,-378558),h=s(h,f,p,m,e[r+8],11,-2022574463),m=s(m,h,f,p,e[r+11],16,1839030562),p=s(p,m,h,f,e[r+14],23,-35309556),f=s(f,p,m,h,e[r+1],4,-1530992060),h=s(h,f,p,m,e[r+4],11,1272893353),m=s(m,h,f,p,e[r+7],16,-155497632),p=s(p,m,h,f,e[r+10],23,-1094730640),f=s(f,p,m,h,e[r+13],4,681279174),h=s(h,f,p,m,e[r],11,-358537222),m=s(m,h,f,p,e[r+3],16,-722521979),p=s(p,m,h,f,e[r+6],23,76029189),f=s(f,p,m,h,e[r+9],4,-640364487),h=s(h,f,p,m,e[r+12],11,-421815835),m=s(m,h,f,p,e[r+15],16,530742520),p=s(p,m,h,f,e[r+2],23,-995338651),f=c(f,p,m,h,e[r],6,-198630844),h=c(h,f,p,m,e[r+7],10,1126891415),m=c(m,h,f,p,e[r+14],15,-1416354905),p=c(p,m,h,f,e[r+5],21,-57434055),f=c(f,p,m,h,e[r+12],6,1700485571),h=c(h,f,p,m,e[r+3],10,-1894986606),m=c(m,h,f,p,e[r+10],15,-1051523),p=c(p,m,h,f,e[r+1],21,-2054922799),f=c(f,p,m,h,e[r+8],6,1873313359),h=c(h,f,p,m,e[r+15],10,-30611744),m=c(m,h,f,p,e[r+6],15,-1560198380),p=c(p,m,h,f,e[r+13],21,1309151649),f=c(f,p,m,h,e[r+4],6,-145523070),h=c(h,f,p,m,e[r+11],10,-1120210379),m=c(m,h,f,p,e[r+2],15,718787259),p=c(p,m,h,f,e[r+9],21,-343485551),f=n(f,i),p=n(p,l),m=n(m,u),h=n(h,d);return[f,p,m,h]}function u(e){var t,n=``,r=e.length*32;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function d(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=e.length*8;for(t=0;t<r;t+=8)n[t>>5]|=(e.charCodeAt(t/8)&255)<<t%32;return n}function f(e){return u(l(d(e),e.length*8))}function p(e,t){var n,r=d(e),i=[],a=[],o;for(i[15]=a[15]=void 0,r.length>16&&(r=l(r,e.length*8)),n=0;n<16;n+=1)i[n]=r[n]^909522486,a[n]=r[n]^1549556828;return o=l(i.concat(d(t)),512+t.length*8),u(l(a.concat(o),640))}function m(e){for(var t=`0123456789abcdef`,n=``,r,i=0;i<e.length;i+=1)r=e.charCodeAt(i),n+=t.charAt(r>>>4&15)+t.charAt(r&15);return n}function h(e){return unescape(encodeURIComponent(e))}function g(e){return f(h(e))}function _(e){return m(g(e))}function v(e,t){return p(h(e),h(t))}function y(e,t){return m(v(e,t))}function b(e,t,n){return t?n?v(t,e):y(t,e):n?g(e):_(e)}typeof define==`function`&&define.amd?define(function(){return b}):typeof t==`object`&&t.exports?t.exports=b:e.md5=b})(e)}))()),Dc=`input is invalid type`,Oc=`finalize already called`,kc=typeof ArrayBuffer<`u`,Ac=function(e){if(typeof e==`string`)return[e,!0];if(Array.isArray(e))return[e,!1];if(kc&&e){if(e.constructor===ArrayBuffer)return[new Uint8Array(e),!1];if(ArrayBuffer.isView(e))return[e,!1]}throw Error(Dc)},G=`0123456789abcdef`.split(``),jc=[-2147483648,8388608,32768,128],Mc=[24,16,8,0],Nc=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Pc=[`hex`,`array`,`digest`,`arrayBuffer`],Fc=[],Ic=function(e,t){return function(n){return new Bc(t,!0).update(n)[e]()}},Lc=function(e){var t=Ic(`hex`,e);t.create=function(){return new Bc(e)},t.update=function(e){return t.create().update(e)};for(var n=0;n<Pc.length;++n){var r=Pc[n];t[r]=Ic(r,e)}return t},Rc=function(e,t){return function(n,r){return new Vc(n,t,!0).update(r)[e]()}},zc=function(e){var t=Rc(`hex`,e);t.create=function(t){return new Vc(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<Pc.length;++n){var r=Pc[n];t[r]=Rc(r,e)}return t};function Bc(e,t){t?(Fc[0]=Fc[16]=Fc[1]=Fc[2]=Fc[3]=Fc[4]=Fc[5]=Fc[6]=Fc[7]=Fc[8]=Fc[9]=Fc[10]=Fc[11]=Fc[12]=Fc[13]=Fc[14]=Fc[15]=0,this.blocks=Fc):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}Bc.prototype.update=function(e){if(this.finalized)throw Error(Oc);var t=Ac(e);e=t[0];for(var n=t[1],r,i=0,a,o=e.length,s=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),n)for(a=this.start;i<o&&a<64;++i)r=e.charCodeAt(i),r<128?s[a>>>2]|=r<<Mc[a++&3]:r<2048?(s[a>>>2]|=(192|r>>>6)<<Mc[a++&3],s[a>>>2]|=(128|r&63)<<Mc[a++&3]):r<55296||r>=57344?(s[a>>>2]|=(224|r>>>12)<<Mc[a++&3],s[a>>>2]|=(128|r>>>6&63)<<Mc[a++&3],s[a>>>2]|=(128|r&63)<<Mc[a++&3]):(r=65536+((r&1023)<<10|e.charCodeAt(++i)&1023),s[a>>>2]|=(240|r>>>18)<<Mc[a++&3],s[a>>>2]|=(128|r>>>12&63)<<Mc[a++&3],s[a>>>2]|=(128|r>>>6&63)<<Mc[a++&3],s[a>>>2]|=(128|r&63)<<Mc[a++&3]);else for(a=this.start;i<o&&a<64;++i)s[a>>>2]|=e[i]<<Mc[a++&3];this.lastByteIndex=a,this.bytes+=a-this.start,a>=64?(this.block=s[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes%=4294967296),this},Bc.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=jc[t&3],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},Bc.prototype.hash=function(){for(var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=this.blocks,l=16,u,d,f,p,m,h,g,_,v,y;l<64;++l)p=c[l-15],u=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,p=c[l-2],d=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,c[l]=c[l-16]+u+c[l-7]+d<<0;for(y=t&n,l=0;l<64;l+=4)this.first?(this.is224?(g=300032,p=c[0]-1413257819,s=p-150054599<<0,r=p+24177077<<0):(g=704751109,p=c[0]-210244248,s=p-1521486534<<0,r=p+143694565<<0),this.first=!1):(u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),d=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),g=e&t,f=g^e&n^y,h=i&a^~i&o,p=s+d+h+Nc[l]+c[l],m=u+f,s=r+p<<0,r=p+m<<0),u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),d=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),_=r&e,f=_^r&t^g,h=s&i^~s&a,p=o+d+h+Nc[l+1]+c[l+1],m=u+f,o=n+p<<0,n=p+m<<0,u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),d=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),v=n&r,f=v^n&e^_,h=o&s^~o&i,p=a+d+h+Nc[l+2]+c[l+2],m=u+f,a=t+p<<0,t=p+m<<0,u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),d=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),y=t&n,f=y^t&r^v,h=a&o^~a&s,p=i+d+h+Nc[l+3]+c[l+3],m=u+f,i=e+p<<0,e=p+m<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+o<<0,this.h7=this.h7+s<<0},Bc.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=G[e>>>28&15]+G[e>>>24&15]+G[e>>>20&15]+G[e>>>16&15]+G[e>>>12&15]+G[e>>>8&15]+G[e>>>4&15]+G[e&15]+G[t>>>28&15]+G[t>>>24&15]+G[t>>>20&15]+G[t>>>16&15]+G[t>>>12&15]+G[t>>>8&15]+G[t>>>4&15]+G[t&15]+G[n>>>28&15]+G[n>>>24&15]+G[n>>>20&15]+G[n>>>16&15]+G[n>>>12&15]+G[n>>>8&15]+G[n>>>4&15]+G[n&15]+G[r>>>28&15]+G[r>>>24&15]+G[r>>>20&15]+G[r>>>16&15]+G[r>>>12&15]+G[r>>>8&15]+G[r>>>4&15]+G[r&15]+G[i>>>28&15]+G[i>>>24&15]+G[i>>>20&15]+G[i>>>16&15]+G[i>>>12&15]+G[i>>>8&15]+G[i>>>4&15]+G[i&15]+G[a>>>28&15]+G[a>>>24&15]+G[a>>>20&15]+G[a>>>16&15]+G[a>>>12&15]+G[a>>>8&15]+G[a>>>4&15]+G[a&15]+G[o>>>28&15]+G[o>>>24&15]+G[o>>>20&15]+G[o>>>16&15]+G[o>>>12&15]+G[o>>>8&15]+G[o>>>4&15]+G[o&15];return this.is224||(c+=G[s>>>28&15]+G[s>>>24&15]+G[s>>>20&15]+G[s>>>16&15]+G[s>>>12&15]+G[s>>>8&15]+G[s>>>4&15]+G[s&15]),c},Bc.prototype.toString=Bc.prototype.hex,Bc.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=[e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,r>>>24&255,r>>>16&255,r>>>8&255,r&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,a>>>24&255,a>>>16&255,a>>>8&255,a&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255];return this.is224||c.push(s>>>24&255,s>>>16&255,s>>>8&255,s&255),c},Bc.prototype.array=Bc.prototype.digest,Bc.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};function Vc(e,t,n){var r,i=Ac(e);if(e=i[0],i[1]){var a=[],o=e.length,s=0,c;for(r=0;r<o;++r)c=e.charCodeAt(r),c<128?a[s++]=c:c<2048?(a[s++]=192|c>>>6,a[s++]=128|c&63):c<55296||c>=57344?(a[s++]=224|c>>>12,a[s++]=128|c>>>6&63,a[s++]=128|c&63):(c=65536+((c&1023)<<10|e.charCodeAt(++r)&1023),a[s++]=240|c>>>18,a[s++]=128|c>>>12&63,a[s++]=128|c>>>6&63,a[s++]=128|c&63);e=a}e.length>64&&(e=new Bc(t,!0).update(e).array());var l=[],u=[];for(r=0;r<64;++r){var d=e[r]||0;l[r]=92^d,u[r]=54^d}Bc.call(this,t,n),this.update(u),this.oKeyPad=l,this.inner=!0,this.sharedMemory=n}Vc.prototype=new Bc,Vc.prototype.finalize=function(){if(Bc.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();Bc.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),Bc.prototype.finalize.call(this)}};var Hc=Lc(),Uc=Lc(!0);Hc.sha256=Hc,Hc.sha224=Uc,Hc.hmac=zc(),Uc.hmac=zc(!0),[...go];var Wc=[`lskypro`,`piclist`,`easyimage`,`s3`];function Gc(e){return`https://thirdqq.qlogo.cn/g?b=sdk&nk=${e.replace(/@qq\.com/gi,``)}&s=140`}function Kc(e,t={}){if(e.avatar)return e.avatar;let n=t.GRAVATAR_CDN||`weavatar.com`,r=t.DEFAULT_GRAVATAR||`initials&name=${e.nick??``}`;return e.mailMd5?`https://${n}/avatar/${e.mailMd5}?d=${r}`:e.mail&&cd(e.mail)?Gc(e.mail):e.mail?`https://${n}/avatar/${(n===`cravatar.cn`?Ec.default:Hc)(sd(e.mail))}?d=${r}`:``}function qc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Jc=qc();function Yc(e){Jc=e}var Xc={exec:()=>null};function Zc(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Qc(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(el.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var $c=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),el={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Zc(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Zc(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Zc(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Zc(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Zc(e=>RegExp(`^ {0,${e}}(?:</?(?:${hl})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Zc(e=>RegExp(`^ {0,${e}}>`))},tl=/^(?:[ \t]*(?:\n|$))+/,nl=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rl=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,il=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,al=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ol=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,sl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cl=Qc(sl).replace(/bull/g,ol).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),ll=Qc(sl).replace(/bull/g,ol).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ul=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,dl=/^[^\n]+/,fl=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,pl=Qc(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,fl).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ml=Qc(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ol).getRegex(),hl=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,gl=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_l=Qc(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,gl).replace(`tag`,hl).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vl=e=>Qc(ul).replace(`hr`,il).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,hl).getRegex(),yl=vl(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),bl=vl(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),xl={blockquote:Qc(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,bl).getRegex(),code:nl,def:pl,fences:rl,heading:al,hr:il,html:_l,lheading:cl,list:ml,newline:tl,paragraph:yl,table:Xc,text:dl},Sl=Qc(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,il).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,hl).getRegex(),Cl={...xl,lheading:ll,table:Sl,paragraph:Qc(ul).replace(`hr`,il).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Sl).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,hl).getRegex()},wl={...xl,html:Qc(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,gl).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Xc,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Qc(ul).replace(`hr`,il).replace(`heading`,` *#{1,6} *[^
|