twikoo 2.0.0-beta.4 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -166,7 +166,7 @@ ${[`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.0-beta.4`,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;logText;requestId;constructor(e,t,n={}){super(t),this.name=`TwikooError`,this.kind=e,this.httpStatus=n.httpStatus,this.rawMessage=n.rawMessage??t,this.logText=n.logText,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.0`,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.
@@ -238,7 +238,7 @@ ${e}</tr>
238
238
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
239
239
  `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${_u(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?_u(n,!0):this.parser.parseInline(r),o=vu(e);if(o===null)return a;e=_u(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+_u(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=vu(e);if(i===null)return _u(n);e=i;let a=`<img src="${_u(e)}" alt="${_u(n)}"`;return t&&(a+=` title="${_u(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:_u(e.text)}},ju=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Mu=class e{options;renderer;textRenderer;constructor(e){this.options=e||Jc,this.options.renderer=this.options.renderer||new Au,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ju}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},Nu=class{options;block;constructor(e){this.options=e||Jc}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ku.lex:ku.lexInline}provideParser(e=this.block){return e?Mu.parse:Mu.parseInline}},Pu=class{defaults=qc();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Mu;Renderer=Au;TextRenderer=ju;Lexer=ku;Tokenizer=Ou;Hooks=Nu;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new Au(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new Ou(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new Nu;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=Nu.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Nu.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ku.lex(e,t??this.defaults)}parser(e,t){return Mu.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?ku.lex:ku.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Mu.parse:Mu.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?ku.lex:ku.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Mu.parse:Mu.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
240
240
  Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+_u(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}},Fu=new Pu;function Iu(e,t){return Fu.parse(e,t)}Iu.options=Iu.setOptions=function(e){return Fu.setOptions(e),Iu.defaults=Fu.defaults,Yc(Iu.defaults),Iu},Iu.getDefaults=qc,Iu.defaults=Jc;function Lu(...e){return Fu.use(...e),Iu.defaults=Fu.defaults,Yc(Iu.defaults),Iu}Iu.use=Lu,Iu.walkTokens=function(e,t){return Fu.walkTokens(e,t)},Iu.parseInline=Fu.parseInline,Iu.Parser=Mu,Iu.parser=Mu.parse,Iu.Renderer=Au,Iu.TextRenderer=ju,Iu.Lexer=ku,Iu.lexer=ku.lex,Iu.Tokenizer=Ou,Iu.Hooks=Nu,Iu.parse=Iu,Iu.options,Iu.setOptions,Iu.walkTokens,Iu.parseInline,Mu.parse,ku.lex;var Ru={};function zu(e){Ru=e??{}}var Bu=new Pu({gfm:!0,breaks:!0});Bu.use({tokenizer:{code(){}}});var Vu=/^(\$\$[\s\S]*?\$\$|\\\[([\s\S]*?)\\\]|\\\(([\s\S]*?)\\\)|\$[^$\n]+?\$)/;Bu.use({extensions:[{name:`twikoo-math`,level:`inline`,start(e){return e.search(Vu)},tokenizer(e){let t=Vu.exec(e);if(t)return{type:`twikoo-math`,raw:t[0],text:t[0]}},renderer(e){return e.text}}]}),Bu.use({extensions:[{name:`owo`,level:`inline`,start(e){return e.indexOf(`:`)},tokenizer(e){let t=/^:([a-zA-Z0-9_+-]+):/.exec(e);if(!t)return;let n=Ru[t[1]];if(n)return{type:`owo`,raw:t[0],html:`<img class="tk-owo-emotion" loading="lazy" src="${n}">`}},renderer(e){return e.html}}]});function Hu(e){return Bu.parse(e)}var Uu=document.createElement(`template`);function Wu(e){try{return Uu.innerHTML=e,Uu.content.childNodes[0]?.src??``}catch(e){return To.warn(`OwO 表情解析失败`,e),``}}function Gu(e){return e.split(`#`).shift()?.split(`?`)?.shift()?.split(`/`).pop()??``}function Ku(e){try{for(let t of Object.values(e))if(t.type===`image`)for(let e of t.container)e.text||=Gu(Wu(e.icon));return e}catch(e){To.warn(`OwO 数据格式异常`,e);return}}function qu(e){return new Promise(t=>{let n=new XMLHttpRequest;n.onreadystatechange=()=>{if(n.readyState===4){if(n.status>=200&&n.status<300||n.status===304)try{t(Ku(JSON.parse(n.responseText))??{})}catch(e){To.warn(`OwO 数据解析失败`,e),t({})}else To.warn(`OwO 数据请求失败:${n.status}`),t({})}};try{n.open(`get`,e,!0),n.send(null)}catch(e){To.warn(`OwO 数据请求异常`,e),t({})}})}async function Ju(e){let t={},n=await Promise.all(e.split(`,`).map(e=>qu(e.trim())));return Object.assign(t,...n),t}function Yu(e){let t={};for(let n of Object.values(e??{}))for(let e of n.container??[]){let n=Wu(e.icon);n&&e.text&&(t[e.text]=n)}return zu(t),t}var Xu=`data-tk-loading`;function Zu(e){for(let t of Array.from(e.children))if(t.hasAttribute(Xu))return t;return null}function Qu(e){if(Zu(e))return;let t=document.createElement(`div`);t.setAttribute(Xu,`1`),t.className=`tk-loading-mask`;let n=document.createElement(`div`);n.className=`tk-loading-spinner`,n.innerHTML=`<svg class="circular" viewBox="25 25 50 50"><circle class="path" cx="50" cy="50" r="20" fill="none"></circle></svg>`,t.appendChild(n),e.appendChild(t)}function $u(e){Zu(e)?.remove(),e.classList.remove(`tk-loading-parent--relative`)}function ed(e,t){if(t.value){let t=getComputedStyle(e).position;(!t||t===`static`)&&e.classList.add(`tk-loading-parent--relative`),Qu(e)}else $u(e)}var td={mounted:ed,updated:ed,unmounted:$u};function nd(e,t){rd(e);let n=n=>{let r=n.target;r&&e!==r&&!e.contains(r)&&t.value?.()};e.__tkClickoutside=n,document.addEventListener(`click`,n,!0)}function rd(e){let t=e;t.__tkClickoutside&&(document.removeEventListener(`click`,t.__tkClickoutside,!0),delete t.__tkClickoutside)}var id={mounted:nd,updated:nd,unmounted:rd},ad=e=>typeof e==`string`&&/^http(s)?:\/\//.test(e),od=e=>e==null||e===``;function sd(e){return String(e).trim().toLowerCase()}function cd(e){return/^[1-9][0-9]{4,10}$/.test(e)||/^[1-9][0-9]{4,10}@qq.com$/i.test(e)}function ld(e){return e?e.substring(0,4)===`http`?e:`http://${e}`:``}function ud(e){let t=typeof e==`number`?new Date(e):e;if(!t)return``;try{let e=Date.now()-t.getTime(),n=Math.floor(e/864e5);if(n===0){let t=e%864e5,n=Math.floor(t/36e5);if(n===0){let e=t%36e5,n=Math.floor(e/6e4);return n===0?`${Math.round(e%6e4/1e3)} ${W(`TIMEAGO_SECONDS`)}`:`${n} ${W(`TIMEAGO_MINUTES`)}`}return`${n} ${W(`TIMEAGO_HOURS`)}`}return n<0?W(`TIMEAGO_NOW`):n<8?`${n} ${W(`TIMEAGO_DAYS`)}`:dd(t)}catch(e){return To.warn(`timeago 计算失败`,e),``}}function dd(e){return[fd(e.getFullYear(),2),fd(e.getMonth()+1,2),fd(e.getDate(),2)].join(`-`)}function fd(e,t){let n=e.toString();for(;n.length<t;)n=`0${n}`;return n}function pd(e){let t=e;return t&&typeof t==`object`&&t.result&&typeof t.result==`object`?t.result:e??{}}function md(e){let t=window.TWIKOO_MAGIC_PATH;if(t)return t;if(e&&typeof e==`string`)switch(e){case`location.pathname`:case`window.location.pathname`:return window.location.pathname;case`location.href`:case`window.location.href`:return window.location.href;default:return e}return window.location.pathname}function hd(e){return window.TWIKOO_MAGIC_HREF??(typeof e==`string`?e:window.location.href)}var gd=new Set([`localhost`,`127.0.0.1`,`0.0.0.0`,`::1`]);function _d(){return gd.has(window.location.hostname)}async function vd(e,t={}){let n=t.urls;if(!Array.isArray(n))throw Error(`urls 参数有误`);return n.length===0?[]:pd(await Co(e,`GET_COMMENTS_COUNT`,{envId:t.envId,funcName:t.funcName,urls:n,includeReply:t.includeReply})).data}async function yd(e,t={}){let n=pd(await Co(e,`GET_RECENT_COMMENTS`,{envId:t.envId,funcName:t.funcName,pageSize:t.pageSize,includeReply:t.includeReply})).data;if(Array.isArray(n))for(let e of n)e.relativeTime=ud(e.created);return n}async function bd(e,t={}){return pd(await Co(e,`COUNTER_GET`,{envId:t.envId,funcName:t.funcName,url:md(t.path),href:hd(t.href),title:t.title??document.title}))}async function xd(e,t={}){let n=document.getElementById(`twikoo_visitors`);if(!n||_d())return null;try{let r=await bd(e,t);return r.time!==void 0&&(n.innerHTML=String(r.time)),r}catch(e){return To.warn(`Failed to update visitors count`,e),null}}function Sd(e){return new Promise((t,n)=>{let r=new FileReader;r.readAsText(e),r.onloadend=()=>{r.error?n(r.error):t(r.result)}})}function Cd(e){return new Promise(t=>{let n=new FileReader;n.onload=e=>{let n=e.target?.result;t(typeof n==`string`?n:``)},n.readAsDataURL(e)})}async function wd(){let e=window.navigator.userAgent;try{let t=navigator.userAgentData;if(t?.platform===`Windows`||t?.platform===`macOS`){let{platformVersion:n}=await t.getHighEntropyValues([`platformVersion`]),r=parseInt(String(n).split(`.`)[0],10);t.platform===`Windows`&&r>=13?e=e.replace(/Windows NT 10\.0/i,`Windows NT 11.0`):t.platform===`macOS`&&r>=11&&(e=e.replace(/Mac OS X 10_[0-9]+_[0-9]+/i,`Mac OS X ${String(n).replace(/\./g,`_`)}`))}}catch{}return e}function Td(e){if(!e)return;let t=Array.isArray(e)?e:[e],n=[];for(let e of t)e&&n.push(...Array.from(e.getElementsByTagName(`a`)));for(let e of n)e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer nofollow ugc`)}function Ed(e,t){if(!e)return;let n=window.renderMathInElement;typeof n==`function`&&n(e,t??{delimiters:[{left:`$$`,right:`$$`,display:!0},{left:`$`,right:`$`,display:!1},{left:`\\(`,right:`\\)`,display:!1},{left:`\\[`,right:`\\]`,display:!0}],throwOnError:!1})}var Dd=[{key:`envId`,required:!0}];function Od(e){let t=Dd.filter(t=>t.required&&od(e[t.key])).map(e=>e.key);if(t.length!==0){for(let e of t)To.warn(`${e} is required`);throw Error(`Twikoo: failed to init`)}}async function kd(e,t){let n=e;Od(t);let r=n.init({env:t.envId??``,region:t.region}),i=r.auth({persistence:`local`});return i.hasLoginState?.()||await i.anonymousAuthProvider().signIn(),{app:r,auth:i}}function Ad(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var jd={},Md=[],Nd=()=>{},Pd=()=>!1,Fd=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Id=e=>e.startsWith(`onUpdate:`),Ld=Object.assign,Rd=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},zd=Object.prototype.hasOwnProperty,Bd=(e,t)=>zd.call(e,t),Vd=Array.isArray,Hd=e=>Zd(e)===`[object Map]`,Ud=e=>Zd(e)===`[object Set]`,Wd=e=>Zd(e)===`[object Date]`,Gd=e=>typeof e==`function`,Kd=e=>typeof e==`string`,qd=e=>typeof e==`symbol`,Jd=e=>typeof e==`object`&&!!e,Yd=e=>(Jd(e)||Gd(e))&&Gd(e.then)&&Gd(e.catch),Xd=Object.prototype.toString,Zd=e=>Xd.call(e),Qd=e=>Zd(e).slice(8,-1),$d=e=>Zd(e)===`[object Object]`,ef=e=>Kd(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,tf=Ad(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),nf=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},rf=/-\w/g,af=nf(e=>e.replace(rf,e=>e.slice(1).toUpperCase())),of=/\B([A-Z])/g,sf=nf(e=>e.replace(of,`-$1`).toLowerCase()),cf=nf(e=>e.charAt(0).toUpperCase()+e.slice(1)),lf=nf(e=>e?`on${cf(e)}`:``),uf=(e,t)=>!Object.is(e,t),df=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ff=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},pf=e=>{let t=parseFloat(e);return isNaN(t)?e:t},mf,hf=()=>mf||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function gf(e){if(Vd(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=Kd(r)?bf(r):gf(r);if(i)for(let e in i)t[e]=i[e]}return t}if(Kd(e)||Jd(e))return e}var _f=/;(?![^(]*\))/g,vf=/:([^]+)/,yf=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function bf(e){let t={};return e.replace(yf,e=>e.startsWith(`/*`)?``:e).split(_f).forEach(e=>{if(e){let n=e.split(vf);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function xf(e){let t=``;if(Kd(e))t=e;else if(Vd(e))for(let n=0;n<e.length;n++){let r=xf(e[n]);r&&(t+=r+` `)}else if(Jd(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var Sf=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Cf=Ad(Sf);Sf+``;function wf(e){return!!e||e===``}function Tf(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=kf(e[i],t[i],n);return r}function Ef(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&kf(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function Df(e,t,n){let r=Hd(e),i=Hd(t);if(r||i||(r=Ud(e),i=Ud(t),r||i))return r&&i?Ef(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!kf(e[r],t[r],n))return!1}return String(e)===String(t)}function Of(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function kf(e,t,n){if(e===t)return!0;let r=Wd(e),i=Wd(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=qd(e),i=qd(t),r||i?e===t:(r=Vd(e),i=Vd(t),r||i?r&&i?Of(e,t,n,Tf):!1:(r=Jd(e),i=Jd(t),r||i?!r||!i?!1:Of(e,t,n,Df):String(e)===String(t))))}function Af(e,t){return e.findIndex(e=>kf(e,t))}var jf=e=>!!(e&&e.__v_isRef===!0),K=e=>Kd(e)?e:e==null?``:Vd(e)||Jd(e)&&(e.toString===Xd||!Gd(e.toString))?jf(e)?K(e.value):JSON.stringify(e,Mf,2):String(e),Mf=(e,t)=>jf(t)?Mf(e,t.value):Hd(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Nf(t,r)+` =>`]=n,e),{})}:Ud(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Nf(e))}:qd(t)?Nf(t):Jd(t)&&!Vd(t)&&!$d(t)?String(t):t,Nf=(e,t=``)=>qd(e)?`Symbol(${e.description??t})`:e,Pf,Ff=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Pf&&(Pf.active?(this.parent=Pf,this.index=(Pf.scopes||(Pf.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Pf;try{return Pf=this,e()}finally{Pf=t}}}on(){++this._on===1&&(this.prevScope=Pf,Pf=this)}off(){if(this._on>0&&--this._on===0){if(Pf===this)Pf=this.prevScope;else{let e=Pf;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function If(){return Pf}var Lf,Rf=new WeakSet,zf=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Pf&&(Pf.active?Pf.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Rf.has(this)&&(Rf.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Uf(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,np(this),Kf(this);let e=Lf,t=Qf;Lf=this,Qf=!0;try{return this.fn()}finally{qf(this),Lf=e,Qf=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Xf(e);this.deps=this.depsTail=void 0,np(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Rf.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Jf(this)&&this.run()}get dirty(){return Jf(this)}},Bf=0,Vf,Hf;function Uf(e,t=!1){if(e.flags|=8,t){e.next=Hf,Hf=e;return}e.next=Vf,Vf=e}function Wf(){Bf++}function Gf(){if(--Bf>0)return;if(Hf){let e=Hf;for(Hf=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Vf;){let t=Vf;for(Vf=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function Kf(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function qf(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Xf(r),Zf(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Jf(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Yf(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Yf(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===rp)||(e.globalVersion=rp,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Jf(e))))return;e.flags|=2;let t=e.dep,n=Lf,r=Qf;Lf=e,Qf=!0;try{Kf(e);let n=e.fn(e._value);(t.version===0||uf(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Lf=n,Qf=r,qf(e),e.flags&=-3}}function Xf(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Xf(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Zf(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Qf=!0,$f=[];function ep(){$f.push(Qf),Qf=!1}function tp(){let e=$f.pop();Qf=e===void 0||e}function np(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Lf;Lf=void 0;try{t()}finally{Lf=e}}}var rp=0,ip=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},ap=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Lf||!Qf||Lf===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Lf)t=this.activeLink=new ip(Lf,this),Lf.deps?(t.prevDep=Lf.depsTail,Lf.depsTail.nextDep=t,Lf.depsTail=t):Lf.deps=Lf.depsTail=t,op(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Lf.depsTail,t.nextDep=void 0,Lf.depsTail.nextDep=t,Lf.depsTail=t,Lf.deps===t&&(Lf.deps=e)}return t}trigger(e){this.version++,rp++,this.notify(e)}notify(e){Wf();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Gf()}}};function op(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)op(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var sp=new WeakMap,cp=Symbol(``),lp=Symbol(``),up=Symbol(``);function dp(e,t,n){if(Qf&&Lf){let t=sp.get(e);t||sp.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new ap),r.map=t,r.key=n),r.track()}}function fp(e,t,n,r,i,a){let o=sp.get(e);if(!o){rp++;return}let s=e=>{e&&e.trigger()};if(Wf(),t===`clear`)o.forEach(s);else{let i=Vd(e),a=i&&ef(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===up||!qd(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(up)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(cp)),Hd(e)&&s(o.get(lp)));break;case`delete`:i||(s(o.get(cp)),Hd(e)&&s(o.get(lp)));break;case`set`:Hd(e)&&s(o.get(cp))}}Gf()}function pp(e){let t=em(e);return t===e||(dp(t,`iterate`,up),Qp(e))?t:Zp(e)?Xp(e)?t.map(e=>rm(nm(e))):t.map(rm):t.map(nm)}function mp(e){return dp(e=em(e),`iterate`,up),e}function hp(e,t){return Zp(e)?rm(Xp(e)?nm(t):t):nm(t)}var gp={__proto__:null,[Symbol.iterator](){return _p(this,Symbol.iterator,e=>hp(this,e))},concat(...e){return pp(this).concat(...e.map(e=>Vd(e)?pp(e):e))},entries(){return _p(this,`entries`,e=>(e[1]=hp(this,e[1]),e))},every(e,t){return yp(this,`every`,e,t,void 0,arguments)},filter(e,t){return yp(this,`filter`,e,t,e=>e.map(e=>hp(this,e)),arguments)},find(e,t){return yp(this,`find`,e,t,e=>hp(this,e),arguments)},findIndex(e,t){return yp(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return yp(this,`findLast`,e,t,e=>hp(this,e),arguments)},findLastIndex(e,t){return yp(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return yp(this,`forEach`,e,t,void 0,arguments)},includes(...e){return xp(this,`includes`,e)},indexOf(...e){return xp(this,`indexOf`,e)},join(e){return pp(this).join(e)},lastIndexOf(...e){return xp(this,`lastIndexOf`,e)},map(e,t){return yp(this,`map`,e,t,void 0,arguments)},pop(){return Sp(this,`pop`)},push(...e){return Sp(this,`push`,e)},reduce(e,...t){return bp(this,`reduce`,e,t)},reduceRight(e,...t){return bp(this,`reduceRight`,e,t)},shift(){return Sp(this,`shift`)},some(e,t){return yp(this,`some`,e,t,void 0,arguments)},splice(...e){return Sp(this,`splice`,e)},toReversed(){return pp(this).toReversed()},toSorted(e){return pp(this).toSorted(e)},toSpliced(...e){return pp(this).toSpliced(...e)},unshift(...e){return Sp(this,`unshift`,e)},values(){return _p(this,`values`,e=>hp(this,e))}};function _p(e,t,n){let r=mp(e),i=r[t]();return r!==e&&!Qp(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var vp=Array.prototype;function yp(e,t,n,r,i,a){let o=mp(e),s=o!==e&&!Qp(e),c=o[t];if(c!==vp[t]){let t=c.apply(e,a);return s?nm(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,hp(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function bp(e,t,n,r){let i=mp(e),a=i!==e&&!Qp(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=hp(e,t)),n.call(this,t,hp(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?hp(e,c):c}function xp(e,t,n){let r=em(e);dp(r,`iterate`,up);let i=r[t](...n);return(i===-1||i===!1)&&$p(n[0])?(n[0]=em(n[0]),r[t](...n)):i}function Sp(e,t,n=[]){ep(),Wf();let r=em(e)[t].apply(e,n);return Gf(),tp(),r}var Cp=Ad(`__proto__,__v_isRef,__isVue`),wp=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(qd));function Tp(e){qd(e)||(e=String(e));let t=em(this);return dp(t,`has`,e),t.hasOwnProperty(e)}var Ep=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Wp:Up:i?Hp:Vp).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=Vd(e);if(!r){let e;if(a&&(e=gp[t]))return e;if(t===`hasOwnProperty`)return Tp}let o=Reflect.get(e,t,im(e)?e:n);if((qd(t)?wp.has(t):Cp(t))||(r||dp(e,`get`,t),i))return o;if(im(o)){let e=a&&ef(t)?o:o.value;return r&&Jd(e)?Jp(e):e}return Jd(o)?r?Jp(o):Kp(o):o}},Dp=class extends Ep{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=Vd(e)&&ef(t);if(!this._isShallow){let e=Zp(i);if(!Qp(n)&&!Zp(n)&&(i=em(i),n=em(n)),!a&&im(i)&&!im(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:Bd(e,t),s=Reflect.set(e,t,n,im(e)?e:r);return e===em(r)&&s&&(o?uf(n,i)&&fp(e,`set`,t,n,i):fp(e,`add`,t,n)),s}deleteProperty(e,t){let n=Bd(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&fp(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!qd(t)||!wp.has(t))&&dp(e,`has`,t),n}ownKeys(e){return dp(e,`iterate`,Vd(e)?`length`:cp),Reflect.ownKeys(e)}},Op=class extends Ep{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},kp=new Dp,Ap=new Op,jp=new Dp(!0),Mp=e=>e,Np=e=>Reflect.getPrototypeOf(e);function Pp(e,t,n){return function(...r){let i=this.__v_raw,a=em(i),o=Hd(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Mp:t?rm:nm;return!t&&dp(a,`iterate`,c?lp:cp),Ld(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Fp(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ip(e,t){let n={get(n){let r=this.__v_raw,i=em(r),a=em(n);e||(uf(n,a)&&dp(i,`get`,n),dp(i,`get`,a));let{has:o}=Np(i),s=t?Mp:e?rm:nm;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&dp(em(t),`iterate`,cp),t.size},has(t){let n=this.__v_raw,r=em(n),i=em(t);return e||(uf(t,i)&&dp(r,`has`,t),dp(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=em(a),s=t?Mp:e?rm:nm;return!e&&dp(o,`iterate`,cp),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return Ld(n,e?{add:Fp(`add`),set:Fp(`set`),delete:Fp(`delete`),clear:Fp(`clear`)}:{add(e){let n=em(this),r=Np(n),i=em(e),a=!t&&!Qp(e)&&!Zp(e)?i:e;return r.has.call(n,a)||uf(e,a)&&r.has.call(n,e)||uf(i,a)&&r.has.call(n,i)||(n.add(a),fp(n,`add`,a,a)),this},set(e,n){!t&&!Qp(n)&&!Zp(n)&&(n=em(n));let r=em(this),{has:i,get:a}=Np(r),o=i.call(r,e);o||=(e=em(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?uf(n,s)&&fp(r,`set`,e,n,s):fp(r,`add`,e,n),this},delete(e){let t=em(this),{has:n,get:r}=Np(t),i=n.call(t,e);i||=(e=em(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&fp(t,`delete`,e,void 0,a),o},clear(){let e=em(this),t=e.size!==0,n=e.clear();return t&&fp(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Pp(r,e,t)}),n}function Lp(e,t){let n=Ip(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(Bd(n,r)&&r in t?n:t,r,i)}var Rp={get:Lp(!1,!1)},zp={get:Lp(!1,!0)},Bp={get:Lp(!0,!1)},Vp=new WeakMap,Hp=new WeakMap,Up=new WeakMap,Wp=new WeakMap;function Gp(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Kp(e){return Zp(e)?e:Yp(e,!1,kp,Rp,Vp)}function qp(e){return Yp(e,!1,jp,zp,Hp)}function Jp(e){return Yp(e,!0,Ap,Bp,Up)}function Yp(e,t,n,r,i){if(!Jd(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=Gp(Qd(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Xp(e){return Zp(e)?Xp(e.__v_raw):!!(e&&e.__v_isReactive)}function Zp(e){return!!(e&&e.__v_isReadonly)}function Qp(e){return!!(e&&e.__v_isShallow)}function $p(e){return e?!!e.__v_raw:!1}function em(e){let t=e&&e.__v_raw;return t?em(t):e}function tm(e){return!Bd(e,`__v_skip`)&&Object.isExtensible(e)&&ff(e,`__v_skip`,!0),e}var nm=e=>Jd(e)?Kp(e):e,rm=e=>Jd(e)?Jp(e):e;function im(e){return e?e.__v_isRef===!0:!1}function q(e){return am(e,!1)}function am(e,t){return im(e)?e:new om(e,t)}var om=class{constructor(e,t){this.dep=new ap,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:em(e),this._value=t?e:nm(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Qp(e)||Zp(e);e=n?e:em(e),uf(e,t)&&(this._rawValue=e,this._value=n?e:nm(e),this.dep.trigger())}};function J(e){return im(e)?e.value:e}var sm={get:(e,t,n)=>t===`__v_raw`?e:J(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return im(i)&&!im(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function cm(e){return Xp(e)?e:new Proxy(e,sm)}var lm=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ap(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=rp-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Lf!==this)return Uf(this,!0),!0}get value(){let e=this.dep.track();return Yf(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function um(e,t,n=!1){let r,i;return Gd(e)?r=e:(r=e.get,i=e.set),new lm(r,i,n)}var dm={},fm=new WeakMap,pm=void 0;function mm(e,t=!1,n=pm){if(n){let t=fm.get(n);t||fm.set(n,t=[]),t.push(e)}}function hm(e,t,n=jd){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:Qp(e)||i===!1||i===0?gm(e,1):gm(e),u,d,f,p,m=!1,h=!1;if(im(e)?(d=()=>e.value,m=Qp(e)):Xp(e)?(d=()=>l(e),m=!0):Vd(e)?(h=!0,m=e.some(e=>Xp(e)||Qp(e)),d=()=>e.map(e=>{if(im(e))return e.value;if(Xp(e))return l(e);if(Gd(e))return c?c(e,2):e()})):d=Gd(e)?t?c?()=>c(e,2):e:()=>{if(f){ep();try{f()}finally{tp()}}let t=pm;pm=u;try{return c?c(e,3,[p]):e(p)}finally{pm=t}}:Nd,t&&i){let e=d,t=i===!0?1/0:i;d=()=>gm(e(),t)}let g=If(),_=()=>{u.stop(),g&&g.active&&Rd(g.effects,u)};if(a&&t){let e=t;t=(...t)=>{let n=e(...t);return _(),n}}let v=h?Array(e.length).fill(dm):dm,y=e=>{if(u.flags&1&&(u.dirty||e)){if(t){let n=u.run();if(e||i||m||(h?n.some((e,t)=>uf(e,v[t])):uf(n,v))){f&&f();let e=pm;pm=u;try{let e=[n,v===dm?void 0:h&&v[0]===dm?[]:v,p];v=n,c?c(t,3,e):t(...e)}finally{pm=e}}}else u.run()}};return s&&s(y),u=new zf(d),u.scheduler=o?()=>o(y,!1):y,p=e=>mm(e,!1,u),f=u.onStop=()=>{let e=fm.get(u);if(e){if(c)c(e,4);else for(let t of e)t();fm.delete(u)}},t?r?y(!0):v=u.run():o?o(y.bind(null,!0),!0):u.run(),_.pause=u.pause.bind(u),_.resume=u.resume.bind(u),_.stop=_,_}function gm(e,t=1/0,n){if(t<=0||!Jd(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,im(e))gm(e.value,t,n);else if(Vd(e))for(let r=0;r<e.length;r++)gm(e[r],t,n);else if(Ud(e)||Hd(e))e.forEach(e=>{gm(e,t,n)});else if($d(e)){for(let r in e)gm(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&gm(e[r],t,n)}return e}function _m(e,t,n,r){try{return r?e(...r):e()}catch(e){ym(e,t,n)}}function vm(e,t,n,r){if(Gd(e)){let i=_m(e,t,n,r);return i&&Yd(i)&&i.catch(e=>{ym(e,t,n)}),i}if(Vd(e)){let i=[];for(let a=0;a<e.length;a++)i.push(vm(e[a],t,n,r));return i}}function ym(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||jd;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){ep(),_m(a,null,10,[e,i,o]),tp();return}}bm(e,n,i,r,o)}function bm(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var xm=[],Sm=-1,Cm=[],wm=null,Tm=0,Em=Promise.resolve(),Dm=null;function Om(e){let t=Dm||Em;return e?t.then(this?e.bind(this):e):t}function km(e){let t=Sm+1,n=xm.length;for(;t<n;){let r=t+n>>>1,i=xm[r],a=Fm(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Am(e){if(!(e.flags&1)){let t=Fm(e),n=xm[xm.length-1];!n||!(e.flags&2)&&t>=Fm(n)?xm.push(e):xm.splice(km(t),0,e),e.flags|=1,jm()}}function jm(){Dm||=Em.then(Im)}function Mm(e){if(!Vd(e))wm&&e.id===-1?wm.splice(Tm+1,0,e):e.flags&1||(Cm.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Cm.push(e[t]);jm()}function Nm(e,t,n=Sm+1){for(;n<xm.length;n++){let t=xm[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;xm.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function Pm(e){if(Cm.length){let e=[...new Set(Cm)].sort((e,t)=>Fm(e)-Fm(t));if(Cm.length=0,wm){for(let t=0;t<e.length;t++)wm.push(e[t]);return}for(wm=e,Tm=0;Tm<wm.length;Tm++){let e=wm[Tm];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}wm=null,Tm=0}}var Fm=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Im(e){try{for(Sm=0;Sm<xm.length;Sm++){let e=xm[Sm];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),_m(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Sm<xm.length;Sm++){let e=xm[Sm];e&&(e.flags&=-2)}Sm=-1,xm.length=0,Pm(e),Dm=null,(xm.length||Cm.length)&&Im(e)}}var Lm=null,Rm=null;function zm(e){let t=Lm;return Lm=e,Rm=e&&e.type.__scopeId||null,t}function Bm(e,t=Lm,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&i_(-1);let i=zm(t),a=e_.length,o;try{o=e(...n)}finally{for(let e=e_.length;e>a;e--)n_();zm(i),r._d&&i_(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Vm(e,t){if(Lm===null)return e;let n=B_(Lm),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=jd]=t[e];i&&(Gd(i)&&(i={mounted:i,updated:i}),i.deep&&gm(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function Hm(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(ep(),vm(c,n,8,[e.el,s,e,t]),tp())}}function Um(e,t){if(w_){let n=w_.provides,r=w_.parent&&w_.parent.provides;r===n&&(n=w_.provides=Object.create(r)),n[e]=t}}function Wm(e,t,n=!1){let r=T_();if(r||og){let i=og?og._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&Gd(t)?t.call(r&&r.proxy):t}}var Gm=Symbol.for(`v-scx`),Km=()=>Wm(Gm);function qm(e,t,n){return Jm(e,t,n)}function Jm(e,t,n=jd){let{immediate:r,deep:i,flush:a,once:o}=n,s=Ld({},n),c=t&&r||!t&&a!==`post`,l;if(j_){if(a===`sync`){let e=Km();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=Nd,e.resume=Nd,e.pause=Nd,e}}let u=w_;s.call=(e,t,n)=>vm(e,u,t,n);let d=!1;a===`post`?s.scheduler=e=>{Lg(e,u&&u.suspense)}:a!==`sync`&&(d=!0,s.scheduler=(e,t)=>{t?e():Am(e)}),s.augmentJob=e=>{t&&(e.flags|=4),d&&(e.flags|=2,u&&(e.id=u.uid,e.i=u))};let f=hm(e,t,s);return j_&&(l?l.push(f):c&&f()),f}function Ym(e,t,n){let r=this.proxy,i=Kd(e)?e.includes(`.`)?Xm(r,e):()=>r[e]:e.bind(r,r),a;Gd(t)?a=t:(a=t.handler,n=t);let o=O_(this),s=Jm(i,a.bind(r),n);return o(),s}function Xm(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var Zm=Symbol(`_vte`),Qm=e=>e.__isTeleport,$m=Symbol(`_leaveCb`);function eh(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Qg){t=n;break}}return t}function th(e){if(!uh(e))return Qm(e.type)&&e.children?eh(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Gd(n.default))return n.default()}}function nh(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;nh(Qm(n.type)&&th(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function rh(e,t){return Gd(e)?Ld({name:e.name},t,{setup:e}):e}function ih(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function ah(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var oh=new WeakMap;function sh(e,t,n,r,i=!1){if(Vd(e)){e.forEach((e,a)=>sh(e,t&&(Vd(t)?t[a]:t),n,r,i));return}if(lh(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&sh(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?B_(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,u=s.refs===jd?s.refs={}:s.refs,d=s.setupState,f=em(d),p=d===jd?Pd:e=>!ah(u,e)&&Bd(f,e),m=(e,t)=>!(t&&ah(u,t));if(l!=null&&l!==c){if(ch(t),Kd(l))u[l]=null,p(l)&&(d[l]=null);else if(im(l)){let e=t;m(l,e.k)&&(l.value=null),e.k&&(u[e.k]=null)}}if(Gd(c))_m(c,s,12,[o,u]);else{let t=Kd(c),r=im(c);if(t||r){let s=()=>{if(e.f){let n=t?p(c)?d[c]:u[c]:m(c)||!e.k?c.value:u[e.k];if(i)Vd(n)&&Rd(n,a);else if(Vd(n))n.includes(a)||n.push(a);else if(t)u[c]=[a],p(c)&&(d[c]=u[c]);else{let t=[a];m(c,e.k)&&(c.value=t),e.k&&(u[e.k]=t)}}else t?(u[c]=o,p(c)&&(d[c]=o)):r&&(m(c,e.k)&&(c.value=o),e.k&&(u[e.k]=o))};if(o){let t=()=>{s(),oh.delete(e)};t.id=-1,oh.set(e,t),Lg(t,n)}else ch(e),s()}}}function ch(e){let t=oh.get(e);t&&(t.flags|=8,oh.delete(e))}hf().requestIdleCallback,hf().cancelIdleCallback;var lh=e=>!!e.type.__asyncLoader,uh=e=>e.type.__isKeepAlive;function dh(e,t){ph(e,`a`,t)}function fh(e,t){ph(e,`da`,t)}function ph(e,t,n=w_){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(hh(t,r,n),n){let e=n.parent;for(;e&&e.parent;)uh(e.parent.vnode)&&mh(r,t,n,e),e=e.parent}}function mh(e,t,n,r){let i=hh(t,e,r,!0);Sh(()=>{Rd(r[t],i)},n)}function hh(e,t,n=w_,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{ep();let i=O_(n),a=vm(t,n,e,r);return i(),tp(),a};return r?i.unshift(a):i.push(a),a}}var gh=e=>(t,n=w_)=>{(!j_||e===`sp`)&&hh(e,(...e)=>t(...e),n)},_h=gh(`bm`),vh=gh(`m`),yh=gh(`bu`),bh=gh(`u`),xh=gh(`bum`),Sh=gh(`um`),Ch=gh(`sp`),wh=gh(`rtg`),Th=gh(`rtc`);function Eh(e,t=w_){hh(`ec`,e,t)}var Dh=`components`;function Oh(e,t){return Ah(Dh,e,!0,t)||e}var kh=Symbol.for(`v-ndc`);function Ah(e,t,n=!0,r=!1){let i=Lm||w_;if(i){let n=i.type;if(e===Dh){let e=V_(n,!1);if(e&&(e===t||e===af(t)||e===cf(af(t))))return n}let a=jh(i[e]||n[e],t)||jh(i.appContext[e],t);return!a&&r?n:a}}function jh(e,t){return e&&(e[t]||e[af(t)]||e[cf(af(t))])}function Mh(e,t,n,r){let i,a=n&&n[r],o=Vd(e);if(o||Kd(e)){let n=o&&Xp(e),r=!1,s=!1;n&&(r=!Qp(e),s=Zp(e),e=mp(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?rm(nm(e[n])):nm(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(Jd(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}function Nh(e,t,n,r,i,a){if(n??={},Lm.ce||Lm.parent&&lh(Lm.parent)&&Lm.parent.ce){let e=a!=null&&n.key==null?Ld({},n,{key:a}):n,i=Object.keys(e).length>0;return t!=="default"&&(e.name=t),Y(),o_(Xg,null,[Q(`slot`,e,r&&r())],i?-2:64)}let o=e[t];o&&o._c&&(o._d=!1);let s=e_.length;Y();let c;try{let i=o&&Ph(o(n)),s=n.key||a||i&&i.key;c=o_(Xg,{key:(s&&!qd(s)?s:`_${t}`)+(!i&&r?`_fb`:``)},i||(r?r():[]),i&&e._===1?64:-2)}catch(e){for(let e=e_.length;e>s;e--)n_();throw e}finally{o&&o._c&&(o._d=!0)}return!i&&c.scopeId&&(c.slotScopeIds=[c.scopeId+`-s`]),c}function Ph(e){return e.some(e=>!s_(e)||!(e.type===Qg||e.type===Xg&&!Ph(e.children)))?e:null}var Fh=e=>e?A_(e)?B_(e):Fh(e.parent):null,Ih=Ld(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Fh(e.parent),$root:e=>Fh(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>qh(e),$forceUpdate:e=>e.f||=()=>{Am(e.update)},$nextTick:e=>e.n||=Om.bind(e.proxy),$watch:e=>Ym.bind(e)}),Lh=(e,t)=>e!==jd&&!e.__isScriptSetup&&Bd(e,t),Rh={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Lh(r,t))return o[t]=1,r[t];else if(i!==jd&&Bd(i,t))return o[t]=2,i[t];else if(Bd(a,t))return o[t]=3,a[t];else if(n!==jd&&Bd(n,t))return o[t]=4,n[t];else Hh&&(o[t]=0)}let l=Ih[t],u,d;if(l)return t===`$attrs`&&dp(e.attrs,`get`,``),l(e);if((u=s.__cssModules)&&(u=u[t]))return u;if(n!==jd&&Bd(n,t))return o[t]=4,n[t];if(d=c.config.globalProperties,Bd(d,t))return d[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Lh(i,t)?(i[t]=n,!0):r!==jd&&Bd(r,t)?(r[t]=n,!0):Bd(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==jd&&s[0]!==`$`&&Bd(e,s)||Lh(t,s)||Bd(a,s)||Bd(r,s)||Bd(Ih,s)||Bd(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?Bd(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function zh(){return Bh(`useSlots`).slots}function Bh(e){let t=T_();return t.setupContext||=z_(t)}function Vh(e){return Vd(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var Hh=!0;function Uh(e){let t=qh(e),n=e.proxy,r=e.ctx;Hh=!1,t.beforeCreate&&Gh(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:f,beforeUpdate:p,updated:m,activated:h,deactivated:g,beforeDestroy:_,beforeUnmount:v,destroyed:y,unmounted:b,render:x,renderTracked:S,renderTriggered:C,errorCaptured:w,serverPrefetch:T,expose:E,inheritAttrs:D,components:ee,directives:te,filters:O}=t;if(l&&Wh(l,r,null),o)for(let e in o){let t=o[e];Gd(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);Jd(t)&&(e.data=Kp(t))}if(Hh=!0,a)for(let e in a){let t=a[e],i=U_({get:Gd(t)?t.bind(n,n):Gd(t.get)?t.get.bind(n,n):Nd,set:!Gd(t)&&Gd(t.set)?t.set.bind(n):Nd});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)Kh(s[e],r,n,e);if(c){let e=Gd(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Um(t,e[t])})}u&&Gh(u,e,`c`);function k(e,t){Vd(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(k(_h,d),k(vh,f),k(yh,p),k(bh,m),k(dh,h),k(fh,g),k(Eh,w),k(Th,S),k(wh,C),k(xh,v),k(Sh,b),k(Ch,T),Vd(E)){if(E.length){let t=e.exposed||={};E.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}x&&e.render===Nd&&(e.render=x),D!=null&&(e.inheritAttrs=D),ee&&(e.components=ee),te&&(e.directives=te),T&&ih(e)}function Wh(e,t,n=Nd){Vd(e)&&(e=Qh(e));for(let n in e){let r=e[n],i;i=Jd(r)?`default`in r?Wm(r.from||n,r.default,!0):Wm(r.from||n):Wm(r),im(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Gh(e,t,n){vm(Vd(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Kh(e,t,n,r){let i=r.includes(`.`)?Xm(n,r):()=>n[r];if(Kd(e)){let n=t[e];Gd(n)&&qm(i,n)}else if(Gd(e))qm(i,e.bind(n));else if(Jd(e)){if(Vd(e))e.forEach(e=>Kh(e,t,n,r));else{let r=Gd(e.handler)?e.handler.bind(n):t[e.handler];Gd(r)&&qm(i,r,e)}}}function qh(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>Jh(c,e,o,!0)),Jh(c,t,o)),Jd(t)&&a.set(t,c),c}function Jh(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&Jh(e,a,n,!0),i&&i.forEach(t=>Jh(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Yh[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Yh={data:Xh,props:tg,emits:tg,methods:eg,computed:eg,beforeCreate:$h,created:$h,beforeMount:$h,mounted:$h,beforeUpdate:$h,updated:$h,beforeDestroy:$h,beforeUnmount:$h,destroyed:$h,unmounted:$h,activated:$h,deactivated:$h,errorCaptured:$h,serverPrefetch:$h,components:eg,directives:eg,watch:ng,provide:Xh,inject:Zh};function Xh(e,t){return t?e?function(){return Ld(Gd(e)?e.call(this,this):e,Gd(t)?t.call(this,this):t)}:t:e}function Zh(e,t){return eg(Qh(e),Qh(t))}function Qh(e){if(Vd(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function $h(e,t){return e?[...new Set([].concat(e,t))]:t}function eg(e,t){return e?Ld(Object.create(null),e,t):t}function tg(e,t){return e?Vd(e)&&Vd(t)?[...new Set([...e,...t])]:Ld(Object.create(null),Vh(e),Vh(t??{})):t}function ng(e,t){if(!e)return t;if(!t)return e;let n=Ld(Object.create(null),e);for(let r in t)n[r]=$h(e[r],t[r]);return n}function rg(){return{app:null,config:{isNativeTag:Pd,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var ig=0;function ag(e,t){return function(n,r=null){Gd(n)||(n=Ld({},n)),r!=null&&!Jd(r)&&(r=null);let i=rg(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:ig++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:W_,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&Gd(e.install)?(a.add(e),e.install(c,...t)):Gd(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||Q(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,B_(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(vm(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=og;og=c;try{return e()}finally{og=t}}};return c}}var og=null,sg=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${af(t)}Modifiers`]||e[`${sf(t)}Modifiers`];function cg(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||jd,i=n,a=t.startsWith(`update:`),o=a&&sg(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>Kd(e)?e.trim():e)),o.number&&(i=i.map(pf)));let s,c=r[s=lf(t)]||r[s=lf(af(t))];!c&&a&&(c=r[s=lf(sf(t))]),c&&vm(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,vm(l,e,6,i)}}var lg=new WeakMap;function ug(e,t,n=!1){let r=n?lg:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!Gd(e)){let r=e=>{let n=ug(e,t,!0);n&&(s=!0,Ld(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(Jd(e)&&r.set(e,null),null):(Vd(a)?a.forEach(e=>o[e]=null):Ld(o,a),Jd(e)&&r.set(e,o),o)}function dg(e,t){return!e||!Fd(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),Bd(e,t[0].toLowerCase()+t.slice(1))||Bd(e,sf(t))||Bd(e,t))}function fg(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:h}=e,g=zm(e),_,v;try{if(n.shapeFlag&4){let e=i||r,t=e;_=g_(l.call(t,e,u,d,p,f,m)),v=s}else{let e=t;_=g_(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),v=t.props?s:pg(s)}}catch(t){e_.length=0,ym(t,e,1),_=Q(Qg)}let y=_;if(v&&h!==!1){let e=Object.keys(v),{shapeFlag:t}=y;e.length&&t&7&&(a&&e.some(Id)&&(v=mg(v,a)),y=p_(y,v,!1,!0))}return n.dirs&&(y=p_(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&nh(Qm(y.type)&&th(y)||y,n.transition),_=y,zm(g),_}var pg=e=>{let t;for(let n in e)(n===`class`||n===`style`||Fd(n))&&((t||={})[n]=e[n]);return t},mg=(e,t)=>{let n={};for(let r in e)(!Id(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function hg(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?gg(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(_g(o,r,n)&&!dg(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||gg(r,o,l):!!o;return!1}function gg(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(_g(t,e,a)&&!dg(n,a))return!0}return!1}function _g(e,t,n){let r=e[n],i=t[n];return n===`style`&&Jd(r)&&Jd(i)?!kf(r,i):r!==i}function vg({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var yg={},bg=()=>Object.create(yg),xg=e=>Object.getPrototypeOf(e)===yg;function Sg(e,t,n,r=!1){let i={},a=bg();e.propsDefaults=Object.create(null),wg(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:qp(i):e.type.props?i:a,e.attrs=a}function Cg(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=em(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(dg(e.emitsOptions,o))continue;let u=t[o];if(c){if(Bd(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=af(o);i[t]=Tg(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{wg(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!Bd(t,a)&&((r=sf(a))===a||!Bd(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Tg(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!Bd(t,e))&&(delete a[e],l=!0)}l&&fp(e.attrs,`set`,``)}function wg(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(tf(c))continue;let l=t[c],u;i&&Bd(i,u=af(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:dg(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=em(n),r=s||jd;for(let o=0;o<a.length;o++){let s=a[o];n[s]=Tg(i,t,s,r[s],e,!Bd(r,s))}}return o}function Tg(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=Bd(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&Gd(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=O_(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===sf(n))&&(r=!0))}return r}var Eg=new WeakMap;function Dg(e,t,n=!1){let r=n?Eg:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!Gd(e)){let r=e=>{c=!0;let[n,r]=Dg(e,t,!0);Ld(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return Jd(e)&&r.set(e,Md),Md;if(Vd(a))for(let e=0;e<a.length;e++){let t=af(a[e]);Og(t)&&(o[t]=jd)}else if(a)for(let e in a){let t=af(e);if(Og(t)){let n=a[e],r=o[t]=Vd(n)||Gd(n)?{type:n}:Ld({},n),i=r.type,c=!1,l=!0;if(Vd(i))for(let e=0;e<i.length;++e){let t=i[e],n=Gd(t)&&t.name;if(n===`Boolean`){c=!0;break}n===`String`&&(l=!1)}else c=Gd(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||Bd(r,`default`))&&s.push(t)}}let l=[o,s];return Jd(e)&&r.set(e,l),l}function Og(e){return e[0]!==`$`&&!tf(e)}var kg=e=>e===`_`||e===`_ctx`||e===`$stable`,Ag=e=>Vd(e)?e.map(g_):[g_(e)],jg=(e,t,n)=>{if(t._n)return t;let r=Bm((...e)=>Ag(t(...e)),n);return r._c=!1,r},Mg=(e,t,n)=>{let r=e._ctx;for(let n in e){if(kg(n))continue;let i=e[n];if(Gd(i))t[n]=jg(n,i,r);else if(i!=null){let e=Ag(i);t[n]=()=>e}}},Ng=(e,t)=>{let n=Ag(t);e.slots.default=()=>n},Pg=(e,t,n)=>{for(let r in t)(n||!kg(r))&&(e[r]=t[r])},Fg=(e,t,n)=>{let r=e.slots=bg();if(e.vnode.shapeFlag&32){let e=t._;e?(Pg(r,t,n),n&&ff(r,`_`,e,!0)):Mg(t,r)}else t&&Ng(e,t)},Ig=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=jd;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:Pg(i,t,n):(a=!t.$stable,Mg(t,i)),o=t}else t&&(Ng(e,t),o={default:1});if(a)for(let e in i)!kg(e)&&o[e]==null&&delete i[e]},Lg=Yg;function Rg(e){return zg(e)}function zg(e,t){let n=hf();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:u,parentNode:d,nextSibling:f,setScopeId:p=Nd,insertStaticContent:m}=e,h=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!c_(e,t)&&(r=fe(e),se(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===Md&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:l,ref:u,shapeFlag:d}=t;switch(l){case Zg:g(e,t,n,r);break;case Qg:_(e,t,n,r);break;case $g:e??v(t,n,r,o);break;case Xg:ee(e,t,n,r,i,a,o,s,c);break;default:d&1?x(e,t,n,r,i,a,o,s,c):d&6?te(e,t,n,r,i,a,o,s,c):(d&64||d&128)&&l.process(e,t,n,r,i,a,o,s,c,he)}u!=null&&i?sh(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&sh(e.ref,null,a,e,!0)},g=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},_=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},v=(e,t,n,r)=>{[e.el,e.anchor]=m(e.children,t,n,r,e.el,e.anchor)},y=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=f(e),r(e,n,i),e=a;r(t,n,i)},b=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=f(e),i(e),e=n;i(t)},x=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)S(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),T(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},S=(e,t,n,i,s,c,l,d)=>{let f,p,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(f=e.el=o(e.type,c,m&&m.is,m),h&8?u(f,e.children):h&16&&w(e.children,f,null,i,s,Bg(e,c),l,d),_&&Hm(e,null,i,`created`),C(f,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!tf(e)&&a(f,e,null,m[e],c,i);`value`in m&&a(f,`value`,null,m.value,c),(p=m.onVnodeBeforeMount)&&b_(p,i,e)}_&&Hm(e,null,i,`beforeMount`);let v=Hg(s,g);v&&g.beforeEnter(f),r(f,t,n),((p=m&&m.onVnodeMounted)||v||_)&&Lg(()=>{try{p&&b_(p,i,e),v&&g.enter(f),_&&Hm(e,null,i,`mounted`)}finally{}},s)},C=(e,t,n,r,i)=>{if(n&&p(e,n),r)for(let t=0;t<r.length;t++)p(e,r[t]);if(i){let n=i.subTree;if(t===n||Jg(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;C(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},w=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?__(e[l]):g_(e[l]);h(null,c,t,n,r,i,a,o,s)}},T=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let p=e.props||jd,m=t.props||jd,h;if(n&&Vg(n,!1),(h=m.onVnodeBeforeUpdate)&&b_(h,n,t,e),f&&Hm(t,e,n,`beforeUpdate`),n&&Vg(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(l=0,s=!1,d=null),(p.innerHTML&&m.innerHTML==null||p.textContent&&m.textContent==null)&&u(c,``),d?E(e.dynamicChildren,d,c,n,r,Bg(t,i),o):s||re(e,t,c,null,n,r,Bg(t,i),o,!1),l>0){if(l&16)D(c,p,m,n,i);else if(l&2&&p.class!==m.class&&a(c,`class`,null,m.class,i),l&4&&a(c,`style`,p.style,m.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=p[r],s=m[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&u(c,t.children)}else!s&&d==null&&D(c,p,m,n,i);((h=m.onVnodeUpdated)||f)&&Lg(()=>{h&&b_(h,n,t,e),f&&Hm(t,e,n,`updated`)},r)},E=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el&&(c.type===Xg||!c_(c,l)||c.shapeFlag&198)?d(c.el):n;h(c,l,u,null,r,i,a,o,!0)}},D=(e,t,n,r,i)=>{if(t!==n){if(t!==jd)for(let o in t)!tf(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(tf(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},ee=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),w(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(E(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Ug(e,t,!0)):re(e,t,n,f,a,o,c,l,u)},te=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):O(t,n,r,i,a,o,c):k(e,t,c)},O=(e,t,n,r,i,a,o)=>{let s=e.component=C_(e,r,i);if(uh(e)&&(s.ctx.renderer=he),M_(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,A,o),!e.el){let r=s.subTree=Q(Qg);_(null,r,t,n),e.placeholder=r.el}}else A(s,e,t,n,i,a,o)},k=(e,t,n)=>{let r=t.component=e.component;if(hg(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,ne(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},A=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Gg(e);if(n){t&&(t.el=c.el,ne(e,t,o)),n.asyncDep.then(()=>{Lg(()=>{e.isUnmounted||l()},i)});return}}let u=t,f;Vg(e,!1),t?(t.el=c.el,ne(e,t,o)):t=c,n&&df(n),(f=t.props&&t.props.onVnodeBeforeUpdate)&&b_(f,s,t,c),Vg(e,!0);let p=fg(e),m=e.subTree;e.subTree=p,h(m,p,d(m.el),fe(m),e,i,a),t.el=p.el,u===null&&vg(e,p.el),r&&Lg(r,i),(f=t.props&&t.props.onVnodeUpdated)&&Lg(()=>b_(f,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=lh(t);if(Vg(e,!1),l&&df(l),!m&&(o=c&&c.onVnodeBeforeMount)&&b_(o,d,t),Vg(e,!0),s&&_e){let t=()=>{e.subTree=fg(e),_e(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=fg(e);h(null,o,n,r,e,i,a),t.el=o.el}if(u&&Lg(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Lg(()=>b_(o,d,e),i)}(t.shapeFlag&256||d&&lh(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Lg(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new zf(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Am(u),Vg(e,!0),l()},ne=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Cg(e,t.props,r,n),Ig(e,t.children,n),ep(),Nm(e),tp()},re=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,d=e?e.shapeFlag:0,f=t.children,{patchFlag:p,shapeFlag:m}=t;if(p>0){if(p&128){ae(l,f,n,r,i,a,o,s,c);return}if(p&256){ie(l,f,n,r,i,a,o,s,c);return}}m&8?(d&16&&de(l,i,a),f!==l&&u(n,f)):d&16?m&16?ae(l,f,n,r,i,a,o,s,c):de(l,i,a,!0):(d&8&&u(n,``),m&16&&w(f,n,r,i,a,o,s,c))},ie=(e,t,n,r,i,a,o,s,c)=>{e||=Md,t||=Md;let l=e.length,u=t.length,d=Math.min(l,u),f=0;for(;f<d;f++){let r=t[f]=c?__(t[f]):g_(t[f]);h(e[f],r,n,null,i,a,o,s,c)}l>u?de(e,i,a,!0,!1,d):w(t,n,r,i,a,o,s,c,d)},ae=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,d=e.length-1,f=u-1;for(;l<=d&&l<=f;){let r=e[l],u=t[l]=c?__(t[l]):g_(t[l]);if(c_(r,u))h(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=d&&l<=f;){let r=e[d],l=t[f]=c?__(t[f]):g_(t[f]);if(c_(r,l))h(r,l,n,null,i,a,o,s,c);else break;d--,f--}if(l>d){if(l<=f){let e=f+1,d=e<u?t[e].el:r;for(;l<=f;)h(null,t[l]=c?__(t[l]):g_(t[l]),n,d,i,a,o,s,c),l++}}else if(l>f)for(;l<=d;)se(e[l],i,a,!0),l++;else{let p=l,m=l,g=new Map;for(l=m;l<=f;l++){let e=t[l]=c?__(t[l]):g_(t[l]);e.key!=null&&g.set(e.key,l)}let _,v=0,y=f-m+1,b=!1,x=0,S=Array(y);for(l=0;l<y;l++)S[l]=0;for(l=p;l<=d;l++){let r=e[l];if(v>=y){se(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=m;_<=f;_++)if(S[_-m]===0&&c_(r,t[_])){u=_;break}u===void 0?se(r,i,a,!0):(S[u-m]=l+1,u>=x?x=u:b=!0,h(r,t[u],n,null,i,a,o,s,c),v++)}let C=b?Wg(S):Md;for(_=C.length-1,l=y-1;l>=0;l--){let e=m+l,d=t[e],f=t[e+1],p=e+1<u?f.el||qg(f):r;S[l]===0?h(null,d,n,p,i,a,o,s,c):b&&(_<0||l!==C[_]?oe(d,n,p,2):_--)}}},oe=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){oe(e.component.subTree,t,n,a);return}if(d&128){e.suspense.move(t,n,a);return}if(d&64){c.move(e,t,n,he);return}if(c===Xg){r(s,t,n);for(let e=0;e<u.length;e++)oe(u[e],t,n,a);r(e.anchor,t,n);return}if(c===$g){y(e,t,n);return}if(a!==2&&d&1&&l){if(a===0)l.persisted&&!s[$m]?r(s,t,n):(l.beforeEnter(s),r(s,t,n),Lg(()=>l.enter(s),o));else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{let e=s._isLeaving||!!s[$m];s._isLeaving&&s[$m](!0),l.persisted&&!e?u():a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}}else r(s,t,n)},se=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&(ep(),sh(s,null,n,e,!0),tp()),p!=null&&(!e.ctx||e.ctx===t)&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!lh(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&b_(_,t,e),u&6)ue(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Hm(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,he,r):l&&!l.hasOnce&&(a!==Xg||d>0&&d&64)?de(l,t,n,!1,!0):(a===Xg&&d&384||!i&&u&16)&&de(c,t,n),r&&ce(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Lg(()=>{_&&b_(_,t,e),h&&Hm(e,null,t,`unmounted`),v&&(e.el=null)},n)},ce=e=>{let{type:t,el:n,anchor:r,transition:a}=e;if(t===Xg){le(n,r);return}if(t===$g){b(e),a&&!a.persisted&&a.afterLeave&&a.afterLeave();return}let o=()=>{i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(e.shapeFlag&1&&a&&!a.persisted){let{leave:t,delayLeave:r}=a,i=()=>t(n,o);r?r(e.el,o,i):i()}else o()},le=(e,t)=>{let n;for(;e!==t;)n=f(e),i(e),e=n;i(t)},ue=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Kg(c),Kg(l),r&&df(r),i.stop(),a?(a.flags|=8,se(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,se(o,e,t,n)),s&&Lg(s,t),Lg(()=>{e.isUnmounted=!0},t)},de=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)se(e[o],t,n,r,i)},fe=e=>{if(e.shapeFlag&6)return fe(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=f(e.anchor||e.el),n=t&&t[Zm];return n?f(n):t},pe=!1,me=(e,t,n)=>{let r;e==null?t._vnode&&(se(t._vnode,null,null,!0),r=t._vnode.component):h(t._vnode||null,e,t,null,null,null,n),t._vnode=e,pe||=(pe=!0,Nm(r),Pm(),!1)},he={p:h,um:se,m:oe,r:ce,mt:O,mc:w,pc:re,pbc:E,n:fe,o:e},ge,_e;return t&&([ge,_e]=t(he)),{render:me,hydrate:ge,createApp:ag(me,ge)}}function Bg({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Vg({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Hg(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ug(e,t,n=!1){let r=e.children,i=t.children;if(Vd(r)&&Vd(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=__(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Ug(t,a)),a.type===Zg&&(a.patchFlag===-1&&(a=i[e]=__(a)),a.el=t.el),a.type===Qg&&!a.el&&(a.el=t.el)}}function Wg(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function Gg(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Gg(t)}function Kg(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function qg(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?qg(t.subTree):null}var Jg=e=>e.__isSuspense;function Yg(e,t){t&&t.pendingBranch?Vd(e)?t.effects.push(...e):t.effects.push(e):Mm(e)}var Xg=Symbol.for(`v-fgt`),Zg=Symbol.for(`v-txt`),Qg=Symbol.for(`v-cmt`),$g=Symbol.for(`v-stc`),e_=[],t_=null;function Y(e=!1){e_.push(t_=e?null:[])}function n_(){e_.pop(),t_=e_[e_.length-1]||null}var r_=1;function i_(e,t=!1){r_+=e,e<0&&t_&&t&&(t_.hasOnce=!0)}function a_(e){return e.dynamicChildren=r_>0?t_||Md:null,n_(),r_>0&&t_&&t_.push(e),e}function X(e,t,n,r,i,a){return a_(Z(e,t,n,r,i,a,!0))}function o_(e,t,n,r,i){return a_(Q(e,t,n,r,i,!0))}function s_(e){return e?e.__v_isVNode===!0:!1}function c_(e,t){return e.type===t.type&&e.key===t.key}var l_=({key:e})=>e??null,u_=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:Kd(e)||im(e)||Gd(e)?{i:Lm,r:e,k:t,f:!!n}:e);function Z(e,t=null,n=null,r=0,i=null,a=e===Xg?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&l_(t),ref:t&&u_(t),scopeId:Rm,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Lm};return s?(v_(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=Kd(n)?8:16),r_>0&&!o&&t_&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&t_.push(c),c}var Q=d_;function d_(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===kh)&&(e=Qg),s_(e)){let r=p_(e,t,!0);return n&&v_(r,n),r_>0&&!a&&t_&&(r.shapeFlag&6?t_[t_.indexOf(e)]=r:t_.push(r)),r.patchFlag=-2,r}if(H_(e)&&(e=e.__vccOpts),t){t=f_(t);let{class:e,style:n}=t;e&&!Kd(e)&&(t.class=xf(e)),Jd(n)&&($p(n)&&!Vd(n)&&(n=Ld({},n)),t.style=gf(n))}let o=Kd(e)?1:Jg(e)?128:Qm(e)?64:Jd(e)?4:Gd(e)?2:0;return Z(e,t,n,r,i,o,a,!0)}function f_(e){return e?$p(e)||xg(e)?Ld({},e):e:null}function p_(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?y_(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&l_(l),ref:t&&t.ref?n&&a?Vd(a)?a.concat(u_(t)):[a,u_(t)]:u_(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Xg?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&p_(e.ssContent),ssFallback:e.ssFallback&&p_(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&nh(u,c.clone(u)),u}function m_(e=` `,t=0){return Q(Zg,null,e,t)}function h_(e,t){let n=Q($g,null,e);return n.staticCount=t,n}function $(e=``,t=!1){return t?(Y(),o_(Qg,null,e)):Q(Qg,null,e)}function g_(e){return e==null||typeof e==`boolean`?Q(Qg):Vd(e)?Q(Xg,null,e.slice()):s_(e)?__(e):Q(Zg,null,String(e))}function __(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:p_(e)}function v_(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(Vd(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),v_(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!xg(t)?t._ctx=Lm:r===3&&Lm&&(Lm.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(Gd(t)){if(r&65){v_(e,{default:t});return}t={default:t,_ctx:Lm},n=32}else t=String(t),r&64?(n=16,t=[m_(t)]):n=8;e.children=t,e.shapeFlag|=n}function y_(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=xf([t.class,r.class]));else if(e===`style`)t.style=gf([t.style,r.style]);else if(Fd(e)){let n=t[e],i=r[e];i&&n!==i&&!(Vd(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!Id(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function b_(e,t,n,r=null){vm(e,t,7,[n,r])}var x_=rg(),S_=0;function C_(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||x_,a={uid:S_++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ff(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Dg(r,i),emitsOptions:ug(r,i),emit:null,emitted:null,propsDefaults:jd,inheritAttrs:r.inheritAttrs,ctx:jd,data:jd,props:jd,attrs:jd,slots:jd,refs:jd,setupState:jd,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=cg.bind(null,a),e.ce&&e.ce(a),a}var w_=null,T_=()=>w_||Lm,E_,D_;{let e=hf(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};E_=t(`__VUE_INSTANCE_SETTERS__`,e=>w_=e),D_=t(`__VUE_SSR_SETTERS__`,e=>j_=e)}var O_=e=>{let t=w_;return E_(e),e.scope.on(),()=>{e.scope.off(),E_(t)}},k_=()=>{w_&&w_.scope.off(),E_(null)};function A_(e){return e.vnode.shapeFlag&4}var j_=!1;function M_(e,t=!1,n=!1){t&&D_(t);let{props:r,children:i}=e.vnode,a=A_(e);Sg(e,r,a,t),Fg(e,i,n||t);let o=a?N_(e,t):void 0;return t&&D_(!1),o}function N_(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Rh);let{setup:r}=n;if(r){ep();let n=e.setupContext=r.length>1?z_(e):null,i=O_(e),a=_m(r,e,0,[e.props,n]),o=Yd(a);if(tp(),i(),(o||e.sp)&&!lh(e)&&ih(e),o){if(a.then(k_,k_),t)return a.then(n=>{D_(!0);try{P_(e,n,t)}finally{D_(!1)}}).catch(t=>{ym(t,e,0)});e.asyncDep=a}else P_(e,a,t)}else L_(e,t)}function P_(e,t,n){Gd(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Jd(t)&&(e.setupState=cm(t)),L_(e,n)}var F_,I_;function L_(e,t,n){let r=e.type;if(!e.render){if(!t&&F_&&!r.render){let t=r.template||qh(e).template;if(t){let{isCustomElement:n,compilerOptions:i}=e.appContext.config,{delimiters:a,compilerOptions:o}=r;r.render=F_(t,Ld(Ld({isCustomElement:n,delimiters:a},i),o))}}e.render=r.render||Nd,I_&&I_(e)}{let t=O_(e);ep();try{Uh(e)}finally{tp(),t()}}}var R_={get(e,t){return dp(e,`get`,``),e[t]}};function z_(e){return{attrs:new Proxy(e.attrs,R_),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function B_(e){return e.exposed?e.exposeProxy||=new Proxy(cm(tm(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ih)return Ih[n](e)},has(e,t){return t in e||t in Ih}}):e.proxy}function V_(e,t=!0){return Gd(e)?e.displayName||e.name:e.name||t&&e.__name}function H_(e){return Gd(e)&&`__vccOpts`in e}var U_=(e,t)=>um(e,t,j_),W_=`3.5.43`,G_=void 0,K_=typeof window<`u`&&window.trustedTypes;if(K_)try{G_=K_.createPolicy(`vue`,{createHTML:e=>e})}catch{}var q_=G_?e=>G_.createHTML(e):e=>e,J_=`http://www.w3.org/2000/svg`,Y_=`http://www.w3.org/1998/Math/MathML`,X_=typeof document<`u`?document:null,Z_=X_&&X_.createElement(`template`),Q_={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?X_.createElementNS(J_,e):t===`mathml`?X_.createElementNS(Y_,e):n?X_.createElement(e,{is:n}):X_.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>X_.createTextNode(e),createComment:e=>X_.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>X_.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{Z_.innerHTML=q_(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Z_.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},$_=Symbol(`_vtc`);function ev(e,t,n){let r=e[$_];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var tv=Symbol(`_vod`),nv=Symbol(`_vsh`),rv={name:`show`,beforeMount(e,{value:t},{transition:n}){e[tv]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):iv(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),iv(e,!0),r.enter(e)):r.leave(e,()=>{iv(e,!1)}):iv(e,t))},beforeUnmount(e,{value:t}){iv(e,t)}};function iv(e,t){e.style.display=t?e[tv]:`none`,e[nv]=!t}var av=Symbol(``),ov=/(?:^|;)\s*display\s*:/;function sv(e,t,n){let r=e.style,i=Kd(n),a=!1;if(n&&!i){if(t){if(Kd(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??lv(r,t,``)}else for(let e in t)n[e]??lv(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?lv(r,i,``):pv(e,i,!Kd(t)&&t?t[i]:void 0,o)||lv(r,i,o)}}else if(i){if(t!==n){let e=r[av];e&&(n+=`;`+e),r.cssText=n,a=ov.test(n)}}else t&&e.removeAttribute(`style`);tv in e&&(e[tv]=a?r.display:``,e[nv]&&(r.display=`none`))}var cv=/\s*!important$/;function lv(e,t,n){if(Vd(n))n.forEach(n=>lv(e,t,n));else if(n??=``,t.startsWith(`--`))cv.test(n)?e.setProperty(t,n.replace(cv,``),`important`):e.setProperty(t,n);else{let r=fv(e,t);cv.test(n)?e.setProperty(sf(r),n.replace(cv,``),`important`):e[r]=n}}var uv=[`Webkit`,`Moz`,`ms`],dv={};function fv(e,t){let n=dv[t];if(n)return n;let r=af(t);if(r!==`filter`&&r in e)return dv[t]=r;r=cf(r);for(let n=0;n<uv.length;n++){let i=uv[n]+r;if(i in e)return dv[t]=i}return t}function pv(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&Kd(r)&&n===r}var mv=`http://www.w3.org/1999/xlink`;function hv(e,t,n,r,i,a=Cf(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(mv,t.slice(6,t.length)):e.setAttributeNS(mv,t,n):n==null||a&&!wf(n)?e.removeAttribute(t):e.setAttribute(t,a?``:qd(n)?String(n):n)}function gv(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?q_(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=wf(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function _v(e,t,n,r){e.addEventListener(t,n,r)}function vv(e,t,n,r){e.removeEventListener(t,n,r)}var yv=Symbol(`_vei`);function bv(e,t,n,r,i=null){let a=e[yv]||(e[yv]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=Cv(t);r?_v(e,n,a[t]=Dv(r,i),s):o&&(vv(e,n,o,s),a[t]=void 0)}}var xv=/(Once|Passive|Capture)$/,Sv=/^on:?(?:Once|Passive|Capture)$/;function Cv(e){let t,n;for(;(n=e.match(xv))&&!Sv.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):sf(e.slice(2)),t]}var wv=0,Tv=Promise.resolve(),Ev=()=>wv||=(Tv.then(()=>wv=0),Date.now());function Dv(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(Vd(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&vm(e,t,5,a)}}else vm(r,t,5,[e])};return n.value=e,n.attached=Ev(),n}var Ov=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,kv=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?ev(e,r,o):t===`style`?sv(e,n,r):Fd(t)?Id(t)||bv(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):Av(e,t,r,o))?(gv(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&hv(e,t,r,o,a,t!==`value`)):e._isVueCE&&(jv(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Kd(r)))?gv(e,af(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),hv(e,t,r,o))};function Av(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&Ov(t)&&Gd(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return Ov(t)&&Kd(n)?!1:t in e}function jv(e,t){let n=e._def.props;if(!n)return!1;let r=af(t);return Array.isArray(n)?n.some(e=>af(e)===r):Object.keys(n).some(e=>af(e)===r)}var Mv=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return Vd(t)?e=>df(t,e):t},Nv=Symbol(`_assign`),Pv={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,_v(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?pf(Lv(e)):Lv(e)),r=e.multiple,i=r?Ud(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?Vd(i)?t.slice():t:i];try{e[Nv](i)}finally{Om(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[Nv]=Mv(r)},mounted(e,{value:t}){Iv(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[Nv]=Mv(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Fv(t,n[1],n[0]))&&Iv(e,t)}};function Fv(e,t,n){if(!n||Vd(e))return kf(e,t);if(Ud(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Iv(e,t){let n=e.multiple,r=Vd(t);if(!n||r||Ud(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Lv(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):Af(t,o)>-1}else a.selected=t.has(o)}else if(kf(Lv(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Lv(e){return`_value`in e?e._value:e.value}var Rv=[`ctrl`,`shift`,`alt`,`meta`],zv={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Rv.some(n=>e[`${n}Key`]&&!t.includes(n))},Bv=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=zv[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Vv={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Hv=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=sf(n.key);if(t.some(e=>e===r||Vv[e]===r))return e(n)}))},Uv=Ld({patchProp:kv},Q_),Wv;function Gv(){return Wv||=Rg(Uv)}var Kv=((...e)=>{let t=Gv().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=Jv(e);if(!r)return;let i=t._component;!Gd(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,qv(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function qv(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function Jv(e){return Kd(e)?document.querySelector(e):e}var Yv={"circle-check":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512m118-366.3c-10.7-7.8-25.7-5.4-33.5 5.3L221.1 315.2 169 263.1c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l72 72c5 5 11.8 7.5 18.8 7s13.4-4.1 17.5-9.8l135.9-187c7.8-10.7 5.4-25.7-5.3-33.5"/></svg>`,"circle-exclamation":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512m0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64m0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"/></svg>`,"circle-xmark":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512m-89-345c9.4-9.4 24.6-9.4 33.9 0l55 55 55-55c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-55 55 55 55c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-55-55-55 55c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l55-55-55-55c-9.4-9.4-9.4-24.6 0-33.9"/></svg>`,cog:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M195.1 9.5c3-14.8 16.1-25.5 31.3-25.5h59.8c15.2 0 28.3 10.7 31.3 25.5l14.5 70c14.1 6 27.3 13.7 39.3 22.8l67.8-22.5c14.4-4.8 30.2 1.2 37.8 14.4l29.9 51.8c7.6 13.2 4.9 29.8-6.5 39.9L447 233.3c.9 7.4 1.3 15 1.3 22.7s-.5 15.3-1.3 22.7l53.4 47.5c11.4 10.1 14 26.8 6.5 39.9L477 417.9c-7.6 13.1-23.4 19.2-37.8 14.4l-67.8-22.5c-12.1 9.1-25.3 16.7-39.3 22.8l-14.4 69.9c-3.1 14.9-16.2 25.5-31.3 25.5h-59.8c-15.2 0-28.3-10.7-31.3-25.5l-14.4-69.9c-14.1-6-27.2-13.7-39.3-22.8l-68.1 22.5c-14.4 4.8-30.2-1.2-37.8-14.4L5.8 366.1c-7.6-13.2-4.9-29.8 6.5-39.9l53.4-47.5c-.9-7.4-1.3-15-1.3-22.7s.5-15.3 1.3-22.7l-53.4-47.5C.9 175.7-1.7 159 5.8 145.9l29.9-51.8c7.6-13.2 23.4-19.2 37.8-14.4l67.8 22.5c12.1-9.1 25.3-16.7 39.3-22.8zM256.3 336a80 80 0 1 0-.6-160 80 80 0 1 0 .6 160"/></svg>`,comment:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M512 240c0 132.5-114.6 240-256 240-37.1 0-72.3-7.4-104.1-20.7L33.5 510.1c-9.4 4-20.2 1.7-27.1-5.8s-8.4-18.5-3.6-27.5l48.8-92.2C19.2 344.3 0 294.3 0 240 0 107.5 114.6 0 256 0s256 107.5 256 240"/></svg>`,"comment-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M51.9 384.9C19.3 344.6 0 294.4 0 240 0 107.5 114.6 0 256 0s256 107.5 256 240-114.6 240-256 240c-36.5 0-71.2-7.2-102.6-20L37 509.9c-3.7 1.6-7.5 2.1-11.5 2.1C11.4 512 0 500.6 0 486.5c0-4.3 1.1-8.5 3.1-12.2zm37.3-30.2c12.2 15.1 14.1 36.1 4.8 53.2L76 441l58.5-25.1c11.8-5.1 25.2-5.2 37.1-.3 25.7 10.5 54.2 16.4 84.3 16.4 117.8 0 208-88.8 208-192S373.8 48 256 48 48 136.8 48 240c0 42.8 15.1 82.4 41.2 114.7"/></svg>`,"face-smile":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512m-90.6-190.1c20.4 28 53.4 46.1 90.6 46.1s70.2-18.1 90.6-46.1c7.8-10.7 22.8-13.1 33.5-5.3s13.1 22.8 5.3 33.5C356.3 390 309.2 416 256 416s-100.3-26-129.4-65.9c-7.8-10.7-5.4-25.7 5.3-33.5s25.7-5.4 33.5 5.3M144 208a32 32 0 1 1 64 0 32 32 0 1 1-64 0m192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64"/></svg>`,heart:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="m241 87.1 15 20.7 15-20.7C296 52.5 336.2 32 378.9 32 452.4 32 512 91.6 512 165.1v2.6c0 112.2-139.9 242.5-212.9 298.2-12.4 9.4-27.6 14.1-43.1 14.1s-30.8-4.6-43.1-14.1C139.9 410.2 0 279.9 0 167.7v-2.6C0 91.6 59.6 32 133.1 32 175.8 32 216 52.5 241 87.1"/></svg>`,image:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M64 32C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64zm64 80a48 48 0 1 1 0 96 48 48 0 1 1 0-96m144 112c8.4 0 16.1 4.4 20.5 11.5l88 144c4.5 7.4 4.7 16.7.5 24.3S368.7 416 360 416H88c-8.9 0-17.2-5-21.3-12.9s-3.5-17.5 1.6-24.8l56-80c4.5-6.4 11.8-10.2 19.7-10.2s15.2 3.8 19.7 10.2l26.4 37.8 61.4-100.5c4.4-7.1 12.1-11.5 20.5-11.5z"/></svg>`,"image-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M64 80c-8.8 0-16 7.2-16 16v320c0 8.8 7.2 16 16 16h320c8.8 0 16-7.2 16-16V96c0-8.8-7.2-16-16-16zM0 96c0-35.3 28.7-64 64-64h320c35.3 0 64 28.7 64 64v320c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64zm128 32a32 32 0 1 1 0 64 32 32 0 1 1 0-64m136 72c8.5 0 16.4 4.5 20.7 11.8l80 136c4.4 7.4 4.4 16.6.1 24.1S352.6 384 344 384H104c-8.9 0-17.2-5-21.3-12.9s-3.5-17.5 1.6-24.8l56-80c4.5-6.4 11.8-10.2 19.7-10.2s15.2 3.8 19.7 10.2l17.2 24.6 46.5-79c4.3-7.3 12.2-11.8 20.7-11.8z"/></svg>`,laugh:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512M101.6 314c-3.7-13.7 7.5-26 21.7-26h265.4c14.2 0 25.4 12.3 21.7 26-18.5 68-80.6 118-154.4 118s-136-50-154.4-118M144 192a32 32 0 1 1 64 0 32 32 0 1 1-64 0m192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64"/></svg>`,"laugh-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M464 256a208 208 0 1 0-416 0 208 208 0 1 0 416 0M0 256a256 256 0 1 1 512 0 256 256 0 1 1-512 0m118.3 58.2c-4.2-13.7 7.1-26.2 21.4-26.2h232.6c14.3 0 25.6 12.5 21.4 26.2C375.7 373.1 320.8 416 256 416s-119.7-42.9-137.7-101.8M144 192a32 32 0 1 1 64 0 32 32 0 1 1-64 0m192-32a32 32 0 1 1 0 64 32 32 0 1 1 0-64"/></svg>`,"location-arrow":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M477.9 75.5c4.5-11.8 1.7-25.2-7.2-34.1s-22.3-11.8-34.1-7.2l-416 160C7.9 199-.3 211.2 0 224.7s9.1 25.4 21.9 29.6l176.8 58.9L257.6 490c4.3 12.8 16.1 21.6 29.6 21.9s25.7-7.9 30.6-20.5l160-416z"/></svg>`,"magnifying-glass":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M416 208c0 45.9-14.9 88.3-40 122.7l126.6 126.7c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.1-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208M208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288"/></svg>`,"paper-plane":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M536.4-26.3c9.8-3.5 20.6-1 28 6.3s9.8 18.2 6.3 28l-178 496.9c-5 13.9-18.1 23.1-32.8 23.1-14.2 0-27-8.6-32.3-21.7l-64.2-158c-4.5-11-2.5-23.6 5.2-32.6l94.5-112.4c5.1-6.1 4.7-15-.9-20.6s-14.6-6-20.6-.9l-112.4 94.3c-9.1 7.6-21.6 9.6-32.6 5.2L38.1 216.8c-13.1-5.3-21.7-18.1-21.7-32.3 0-14.7 9.2-27.8 23.1-32.8z"/></svg>`,reply:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M204.2 18.4c12 5 19.8 16.6 19.8 29.6v80h112c97.2 0 176 78.8 176 176 0 113.3-81.5 163.9-100.2 174.1-2.5 1.4-5.3 1.9-8.1 1.9-10.9 0-19.7-8.9-19.7-19.7 0-7.5 4.3-14.4 9.8-19.5 9.4-8.8 22.2-26.4 22.2-56.7 0-53-43-96-96-96h-96v80c0 12.9-7.8 24.6-19.8 29.6s-25.7 2.2-34.9-6.9l-160-160c-12.5-12.5-12.5-32.8 0-45.3l160-160c9.2-9.2 22.9-11.9 34.9-6.9z"/></svg>`,spinner:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M208 48a48 48 0 1 1 96 0 48 48 0 1 1-96 0m0 416a48 48 0 1 1 96 0 48 48 0 1 1-96 0M48 208a48 48 0 1 1 0 96 48 48 0 1 1 0-96m368 48a48 48 0 1 1 96 0 48 48 0 1 1-96 0M75 369.1a48 48 0 1 1 67.9 67.9A48 48 0 1 1 75 369.1M75 75a48 48 0 1 1 67.9 67.9A48 48 0 1 1 75 75m362 294.1a48 48 0 1 1-67.9 67.9 48 48 0 1 1 67.9-67.9"/></svg>`,sync:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M65.9 228.5C79.2 135.5 159.3 64 256 64c53 0 101 21.5 135.8 56.2l.6.6 7.6 7.2h-47.9c-17.7 0-32 14.3-32 32s14.3 32 32 32h128c17.7 0 32-14.3 32-32V32c0-17.7-14.3-32-32-32s-32 14.3-32 32v53.4l-11.3-10.7C390.5 28.6 326.5 0 256 0 127 0 20.3 95.4 2.6 219.5c-2.5 17.5 9.6 33.7 27.1 36.2s33.7-9.7 36.2-27.1zm443.5 64c2.5-17.5-9.7-33.7-27.1-36.2s-33.7 9.7-36.2 27.1c-13.3 93-93.4 164.5-190.1 164.5-53 0-101-21.5-135.8-56.2l-.6-.6-7.6-7.2h47.9c17.7 0 32-14.3 32-32s-14.3-32-32-32L32 320c-8.5 0-16.7 3.4-22.7 9.5S-.1 343.7 0 352.3l1 127c.1 17.7 14.6 31.9 32.3 31.7s31.9-14.6 31.7-32.3l-.4-51.5 10.7 10.1C121.6 483.4 185.5 512 256 512c129 0 235.7-95.4 253.4-219.5"/></svg>`,"thumbs-down":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M384 32c26.5 0 48 21.5 48 48 0 6.3-1.3 12.2-3.4 17.7C449 103.2 464 121.8 464 144c0 9.1-2.6 17.6-7 24.9 22.2 4.2 39 23.7 39 47.1 0 19.7-11.9 36.6-28.9 44 17 7.4 28.9 24.3 28.9 44 0 26.5-21.5 48-48 48H288l28.2 70.4c2.5 6.3 3.8 13.1 3.8 19.9v4.2c0 27.3-22.1 49.4-49.4 49.4-18.7 0-35.8-10.6-44.2-27.3l-56.3-112.3c-6.7-13.3-10.1-28-10.1-42.9V126.8c0-19.4 8.9-37.8 24-50l12.2-9.7C224.6 44.4 259.8 32 296.1 32zM80 96c17.7 0 32 14.3 32 32v256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V128c0-17.7 14.3-32 32-32z"/></svg>`,"thumbs-down-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="m360 32 7.4.4c35 3.6 62.5 32.2 64.4 67.7 17.8 11.8 30.1 31.4 32 53.9l.2 6c0 5.7-.7 11.2-2 16.5 10.2 11.5 16.8 26.3 17.8 42.7l.2 4.8c0 13.2-3.6 25.4-9.8 36 4.9 8.4 8.2 17.9 9.3 28l.4 8c0 37.3-28.3 67.9-64.6 71.6l-7.4.4H298.2l14.1 30 3.1 7.6c12.5 35.7-1.8 75.5-34.2 95l-7.2 3.9c-37.5 17.6-81.7 3.6-102.6-31.2l-.6-.9-2.7-5-.6-1.2-30.1-64c-9.4 17.8-28 29.9-49.5 29.9h-32c-30.9 0-56-25.1-56-56L0 152c0-30.9 25.1-56 56-56h32c12.4 0 23.9 4.1 33.2 11 13.2-21.4 32-39.4 55-51.6l12.2-6.5.7-.3 6.6-3.2.7-.3 7.1-3c16.7-6.6 34.5-9.9 52.6-9.9zM255.9 80c-12 0-23.9 2.3-35.1 6.6l-4.7 2-5.3 2.6-12.2 6.5c-29.2 15.5-48.3 44.9-50.7 77.6l-.2 8v112.9l.1 4.1c.5 8.2 2.5 16.2 6 23.7l56.8 120.9 2.1 3.8c8.4 13.7 26 19.1 40.8 12.2l2.9-1.6c13-7.8 18.7-23.7 13.7-38l-1.2-3-30.2-64.2c-3.5-7.4-2.9-16.1 1.5-23.1s12-11.1 20.2-11.1h147.5l2.4-.1c11.3-1.1 20.3-10.1 21.4-21.4l.1-2.5c0-7.1-3.1-13.5-8.2-18-5.2-4.6-8.2-11.1-8.2-18s3-13.4 8.2-18c4.4-3.9 7.4-9.3 8-15.3l.2-2.7c0-8.4-4.4-15.9-11.2-20.2-10.7-6.9-14.2-20.9-8-32 1.5-2.6 2.5-5.6 2.9-8.6l.2-3.2c0-10.6-6.9-19.6-16.6-22.8-11.7-3.8-18.7-15.9-16-28 .2-.9.3-1.8.4-2.6l.2-2.6c0-12.4-9.5-22.6-21.6-23.8L360 80zM56 144c-4.4 0-8 3.6-8 8v224c0 4.4 3.6 8 8 8h32c4.4 0 8-3.6 8-8V152c0-4.4-3.6-8-8-8z"/></svg>`,"thumbs-up":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M80 160c17.7 0 32 14.3 32 32v256c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32V192c0-17.7 14.3-32 32-32zM270.6 16c27.3 0 49.4 22.1 49.4 49.4v4.2c0 6.8-1.3 13.6-3.8 19.9L288 160h160c26.5 0 48 21.5 48 48 0 19.7-11.9 36.6-28.9 44 17 7.4 28.9 24.3 28.9 44 0 23.4-16.8 42.9-39 47.1 4.4 7.3 7 15.8 7 24.9 0 22.2-15 40.8-35.4 46.3 2.2 5.5 3.4 11.5 3.4 17.7 0 26.5-21.5 48-48 48h-87.9c-36.3 0-71.6-12.4-99.9-35.1l-12.2-9.7c-15.2-12.1-24-30.5-24-50V198.6c0-14.9 3.5-29.6 10.1-42.9l56.2-112.4c8.4-16.7 25.5-27.3 44.3-27.3"/></svg>`,"thumbs-up-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M171.5 38.8C192.3 4 236.5-10 274 7.6l7.2 3.8C316 32.3 330 76.5 312.4 114l-14.1 30H408l7.4.4c36.3 3.7 64.6 34.4 64.6 71.6 0 13.2-3.6 25.4-9.8 36 6.1 10.6 9.7 22.8 9.8 36 0 18.3-6.9 34.8-18 47.5 1.3 5.3 2 10.8 2 16.5 0 25.1-12.9 47-32.2 59.9-1.9 35.5-29.4 64.2-64.4 67.7l-7.4.4H255.9c-18 0-35.9-3.4-52.6-9.9l-7.1-3-.7-.3-6.6-3.2-.7-.3-12.2-6.5c-12.3-6.5-23.3-14.7-32.9-24.1-4.1 26.9-27.3 47.4-55.3 47.4h-32c-30.9 0-56-25.1-56-56L0 200c0-30.9 25.1-56 56-56h32c10.8 0 20.9 3.1 29.5 8.5L167.6 46l.6-1.2 2.7-5 .6-.9zM56 192c-4.4 0-8 3.6-8 8v224c0 4.4 3.6 8 8 8h32c4.4 0 8-3.6 8-8V200c0-4.4-3.6-8-8-8zM253.6 51c-14.8-6.9-32.3-1.6-40.7 12l-2.2 4-56.8 120.9c-3.5 7.5-5.5 15.5-6 23.7l-.1 4.2v112.9l.2 7.9c2.4 32.7 21.4 62.1 50.7 77.7l11.5 6.1 6.3 3.1c12.4 5.6 25.8 8.5 39.4 8.5H360l2.4-.1c12.1-1.2 21.6-11.5 21.6-23.9l-.2-2.6c-.1-.9-.2-1.7-.4-2.6-2.7-12.1 4.3-24.2 16-28 9.7-3.1 16.6-12.2 16.6-22.8 0-4.3-1.1-8.2-3.1-11.8-6.3-11.1-2.8-25.2 8-32 6.8-4.3 11.2-11.8 11.2-20.2 0-7.1-3.1-13.5-8.2-18-5.2-4.6-8.2-11.1-8.2-18s3-13.4 8.2-18c5.1-4.5 8.2-10.9 8.2-18l-.1-2.4c-1.1-11.3-10.1-20.3-21.4-21.4l-2.4-.1H260.7c-8.2 0-15.8-4.2-20.2-11.1s-5-15.7-1.5-23.1l30-64.3c7-15 1.4-32.7-12.5-41z"/></svg>`,times:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0l137.3-137.4 137.4 137.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256l137.3-137.4c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7z"/></svg>`,trash:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M136.7 5.9C141.1-7.2 153.3-16 167.1-16H281c13.8 0 26 8.8 30.4 21.9L320 32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 96 0 81.7 0 64s14.3-32 32-32h96zM32 144h384v304c0 35.3-28.7 64-64 64H96c-35.3 0-64-28.7-64-64zm88 64c-13.3 0-24 10.7-24 24v192c0 13.3 10.7 24 24 24s24-10.7 24-24V232c0-13.3-10.7-24-24-24m104 0c-13.3 0-24 10.7-24 24v192c0 13.3 10.7 24 24 24s24-10.7 24-24V232c0-13.3-10.7-24-24-24m104 0c-13.3 0-24 10.7-24 24v192c0 13.3 10.7 24 24 24s24-10.7 24-24V232c0-13.3-10.7-24-24-24"/></svg>`,"trash-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M166.2-16c-13.3 0-25.3 8.3-30 20.8L120 48H24C10.7 48 0 58.7 0 72s10.7 24 24 24h400c13.3 0 24-10.7 24-24s-10.7-24-24-24h-96L311.8 4.8c-4.7-12.5-16.6-20.8-30-20.8zM32 144v304c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V144h-48v304c0 8.8-7.2 16-16 16H96c-8.8 0-16-7.2-16-16V144zm160 72c0-13.3-10.7-24-24-24s-24 10.7-24 24v176c0 13.3 10.7 24 24 24s24-10.7 24-24zm112 0c0-13.3-10.7-24-24-24s-24 10.7-24 24v176c0 13.3 10.7 24 24 24s24-10.7 24-24z"/></svg>`,"user-circle":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M399 384.2c-22.1-38.4-63.6-64.2-111-64.2h-64c-47.4 0-88.9 25.8-111 64.2 35.2 39.2 86.2 63.8 143 63.8s107.8-24.7 143-63.8M0 256a256 256 0 1 1 512 0 256 256 0 1 1-512 0m256 16a72 72 0 1 0 0-144 72 72 0 1 0 0 144"/></svg>`,"window-maximize":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M64 64C28.7 64 0 92.7 0 128v256c0 35.3 28.7 64 64 64h384c35.3 0 64-28.7 64-64V128c0-35.3-28.7-64-64-64zm24 64h336c13.3 0 24 10.7 24 24s-10.7 24-24 24H88c-13.3 0-24-10.7-24-24s10.7-24 24-24"/></svg>`,"window-maximize-regular":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M48 224v160c0 8.8 7.2 16 16 16h384c8.8 0 16-7.2 16-16V224zM0 128c0-35.3 28.7-64 64-64h384c35.3 0 64 28.7 64 64v256c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64z"/></svg>`,android:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M131.2 61.9c5.3-.5 10.6.6 15.3 3s8.6 6.2 11.3 10.8c17 29.5 34.2 58.9 51.2 88.4q5.25-2.1 10.5-3.9c31.3-10.9 64.2-16.6 97.4-16.9h3.2c38.1 0 76.2 7 111.6 21.1L483 75.7c1.8-3.2 4.3-6 7.2-8.2s6.2-3.9 9.8-4.8c3.1-.8 6.4-1.1 9.6-.8 4.2.4 8.3 1.7 11.9 3.8 4 2.4 7.3 5.7 9.7 9.7 2 3.4 3.3 7.2 3.8 11.2s.1 8-1.2 11.7c-.6 1.9-1.4 3.7-2.4 5.5l-49.7 85.8c19.5 12.2 37.6 26.5 53.9 42.8 12.3 12.2 23.5 25.4 33.5 39.5 8.2 11.5 15.6 23.6 22.2 36.2 17.5 33.6 28.6 70.5 32.7 108.1H16c4.1-37.7 15.2-74.5 32.7-108.1 14.5-27.9 33.4-53.5 55.7-75.7 16.5-16.4 34.7-30.9 54.5-43.1l-49.5-85.4c-3.7-6.4-4.7-14.1-2.8-21.2s6.4-13.1 12.7-16.8c3.6-2.2 7.7-3.5 11.9-3.8zm67.3 215.8c-12.2-8.1-30.1-2.5-40.1 12.5s-8.2 33.8 3.9 41.9 30.1 2.5 40.1-12.5 8.2-33.8-3.9-41.9m283.6 12.5c-10-15-27.9-20.6-40.1-12.5s-13.9 26.9-3.9 41.9 27.9 20.6 40.1 12.5 13.9-26.9 3.9-41.9"/></svg>`,apple:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M319.1 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7-55.8.9-115.1 44.5-115.1 133.2 0 26.2 4.8 53.3 14.4 81.2 12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9m-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3"/></svg>`,chrome:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M0 256c0-46.6 12.5-90.4 34.3-128.9l109.8 191.2C166 357.5 207.9 384 256 384c14.3 0 27.1-2.3 40.8-6.6l-76.3 132.2C95.9 492.3 0 385.3 0 256m365.1 65.6c12.3-19.2 18.9-42.5 18.9-65.6 0-38.2-16.8-72.5-43.3-96h152.7c12 29.6 18.6 62.1 18.6 96 0 141.4-114.6 255.1-256 256zM477.8 128H256c-62.9 0-113.7 44.1-125.5 102.7L54.2 98.5C101 38.5 174 0 256 0c94.8 0 177.5 51.5 221.8 128M344 256a88 88 0 1 1-176 0 88 88 0 1 1 176 0"/></svg>`,edge:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M120.1 37.4C161.1 12.2 207.7-.8 255 0c168 0 257 123.8 257 219.5-.1 32.7-13 63.9-35.9 87.2-22.9 23.2-54 36.5-86.7 37-75.2 0-91.5-23.1-91.5-32 0-3.8 1.2-6.2 4.8-9.4l1-1.2.4-1.6c10.5-11.5 15.9-26.2 15.9-41.6 0-78.7-82.2-142.7-184-142.7-37.5-.3-74.5 8.9-107.5 26.9 27-57.5 82.7-97.6 91.3-103.8.8-.6.3-.8.3-.8zm15.6 318.1c-1.4 30 4.6 60 16.4 87.2 13.6 26.4 32.7 51 56.5 69.3-59.5-11.5-111.5-43.9-149.4-89.3C21.1 376.3 0 318.4 0 257.9c0-51.2 62.4-94.4 136-94.4 36.6-.6 72.4 10.9 101.8 32.7l-3.6 1.2c-51.5 17.6-98.5 90.7-98.5 158.1M469.8 400l-.7.1c-11.8 18.8-25.9 35.1-42.2 49.5-30.8 28-68.1 45.5-108.8 49.9-18.6.3-36.8-3.2-53.8-11.4-25.6-10.3-47.1-30-61.6-53-14.4-23.9-21.1-51.7-19-79.6-.6-20.1 5.4-40.3 15-58.2 13.9 33.1 37.5 61.3 67.6 80.8s65.5 29.5 101.4 28.6c31 .3 62.1-6.7 90.2-20.5l1.9-.9c3.9-2.3 7.7-3.9 11.6 0 4.5 4.9 1.8 9.2-1.2 14-.2.2-.3.5-.4.7"/></svg>`,"firefox-browser":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M481.6 172.9c-10.6-25.5-32.1-53-48.9-61.7 13.7 26.9 21.7 53.9 24.7 74 0 .1 0 .3.1.4-27.6-68.8-74.4-96.5-112.6-156.8-15-23.7-10.9-25.2-13.1-24.7l-.1.1c-46.7 26-75.3 78.4-82.6 122.7-16.6.9-32.9 5-47.9 12.1-1.4.6-2.5 1.7-3.1 3s-.9 2.8-.6 4.3c.2.8.6 1.6 1.1 2.3s1.2 1.3 1.9 1.7 1.6.7 2.4.8 1.7 0 2.5-.3l.5-.2c15.5-7.3 32.4-11.2 49.5-11.3 62.8-.6 97.2 44 107.6 62.3-13-9.2-36.4-18.2-58.8-14.3 87.7 43.9 64.2 194.5-57.4 189.2-59.5-2.6-97.1-51-100.5-90.8 0 0 11.2-41.9 80.6-41.9 7.5 0 28.9-20.9 29.3-27-.1-2-42.5-18.9-59.1-35.2-8.8-8.7-13.1-12.9-16.8-16.1q-3-2.55-6.3-4.8c-5.6-19.5-5.8-40-.7-59.6-25.1 11.4-44.6 29.4-58.7 45.4h-.1c-9.7-12.2-9-52.6-8.4-61.1-.1-.5-7.2 3.7-8.2 4.3-8.6 6.1-16.5 12.9-23.8 20.4-16.3 16.6-44.1 50.2-55.5 101.2-4.5 20.4-6.8 44.4-6.8 52.3 0 134.7 109.2 243.9 243.9 243.9 120.6 0 223-87.2 240.4-202.6 11.6-76.7-14.7-131.1-14.7-132z"/></svg>`,"internet-explorer":`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M483.1 159.7c10.9-24.6 21.4-60.4 21.4-87.9 0-72.7-79.6-98.4-209.7-38.6C187.2 26 83.6 106.9 57.7 219.7c30.9-34.9 78.3-82.3 122-101.2C125.4 166.8 79.1 227.9 44 291.7c-20.7 37.9-44 99.2-44 145 0 98.6 92.9 86.5 180.3 42 31.4 15.4 66.6 15.6 101.7 15.6 97.1 0 184.2-54.3 216.8-146H378c-52.5 88.6-196.8 53-196.8-47.4H510c6.4-43.6-1.7-95.7-26.9-141.2M64.6 346.9c17.7 51.1 53.7 95.8 100.2 123.3C76.1 519.1-8.4 499.3 64.6 346.9M180.5 238c2-55.2 50.3-94.9 104-94.9 53.4 0 102 39.7 104 94.9zM365.1 50.4c21.4-10.3 48.6-22 72.6-22 31.4 0 54.3 21.7 54.3 53.7 0 20-7.4 49-14.6 67.9-26.3-42.3-66-81.6-112.3-99.6"/></svg>`,linux:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M220.9 123.3c1 .5 1.8 1.7 3 1.7 1.1 0 2.8-.4 2.9-1.5.2-1.4-1.9-2.3-3.2-2.9-1.7-.7-3.9-1-5.5-.1-.4.2-.8.7-.6 1.1.3 1.3 2.3 1.1 3.4 1.7M199 125c1.2 0 2-1.2 3-1.7 1.1-.6 3.1-.4 3.5-1.6.2-.4-.2-.9-.6-1.1-1.6-.9-3.8-.6-5.5.1-1.3.6-3.4 1.5-3.2 2.9.1 1 1.8 1.5 2.8 1.4m221 278.8c-3.6-4-5.3-11.6-7.2-19.7-1.8-8.1-3.9-16.8-10.5-22.4-1.3-1.1-2.6-2.1-4-2.9-1.3-.8-2.7-1.5-4.1-2 9.2-27.3 5.6-54.5-3.7-79.1-11.4-30.1-31.3-56.4-46.5-74.4-17.1-21.5-33.7-41.9-33.4-72C311.1 85.4 315.7.1 234.8 0 132.4-.2 158 103.4 156.9 135.2c-1.7 23.4-6.4 41.8-22.5 64.7-18.9 22.5-45.5 58.8-58.1 96.7-6 17.9-8.8 36.1-6.2 53.3-6.5 5.8-11.4 14.7-16.6 20.2-4.2 4.3-10.3 5.9-17 8.3s-14 6-18.5 14.5c-2.1 3.9-2.8 8.1-2.8 12.4 0 3.9.6 7.9 1.2 11.8 1.2 8.1 2.5 15.7.8 20.8-5.2 14.4-5.9 24.4-2.2 31.7 3.8 7.3 11.4 10.5 20.1 12.3 17.3 3.6 40.8 2.7 59.3 12.5 19.8 10.4 39.9 14.1 55.9 10.4 11.6-2.6 21.1-9.6 25.9-20.2 12.5-.1 26.3-5.4 48.3-6.6 14.9-1.2 33.6 5.3 55.1 4.1.6 2.3 1.4 4.6 2.5 6.7v.1c8.3 16.7 23.8 24.3 40.3 23 16.6-1.3 34.1-11 48.3-27.9 13.6-16.4 36-23.2 50.9-32.2 7.4-4.5 13.4-10.1 13.9-18.3.4-8.2-4.4-17.3-15.5-29.7M223.8 87.3c9.8-22.2 34.2-21.8 44-.4 6.5 14.2 3.6 30.9-4.3 40.4-1.6-.8-5.9-2.6-12.6-4.9 1.1-1.2 3.1-2.7 3.9-4.6 4.8-11.8-.2-27-9.1-27.3-7.3-.5-13.9 10.8-11.8 23-4.1-2-9.4-3.5-13-4.4-1-6.9-.3-14.6 2.9-21.8m-40.7-11.5c10.1 0 20.8 14.2 19.1 33.5-3.5 1-7.1 2.5-10.2 4.6 1.2-8.9-3.3-20.1-9.6-19.6-8.4.7-9.8 21.2-1.8 28.1 1 .8 1.9-.2-5.9 5.5-15.6-14.6-10.5-52.1 8.4-52.1m-13.6 60.7c6.2-4.6 13.6-10 14.1-10.5 4.7-4.4 13.5-14.2 27.9-14.2 7.1 0 15.6 2.3 25.9 8.9 6.3 4.1 11.3 4.4 22.6 9.3 8.4 3.5 13.7 9.7 10.5 18.2-2.6 7.1-11 14.4-22.7 18.1-11.1 3.6-19.8 16-38.2 14.9-3.9-.2-7-1-9.6-2.1-8-3.5-12.2-10.4-20-15-8.6-4.8-13.2-10.4-14.7-15.3q-2.1-7.35 4.2-12.3m3.3 334c-2.7 35.1-43.9 34.4-75.3 18-29.9-15.8-68.6-6.5-76.5-21.9-2.4-4.7-2.4-12.7 2.6-26.4v-.2c2.4-7.6.6-16-.6-23.9-1.2-7.8-1.8-15 .9-20 3.5-6.7 8.5-9.1 14.8-11.3 10.3-3.7 11.8-3.4 19.6-9.9 5.5-5.7 9.5-12.9 14.3-18 5.1-5.5 10-8.1 17.7-6.9 8.1 1.2 15.1 6.8 21.9 16l19.6 35.6c9.5 19.9 43.1 48.4 41 68.9m-1.4-25.9c-4.1-6.6-9.6-13.6-14.4-19.6 7.1 0 14.2-2.2 16.7-8.9 2.3-6.2 0-14.9-7.4-24.9-13.5-18.2-38.3-32.5-38.3-32.5-13.5-8.4-21.1-18.7-24.6-29.9s-3-23.3-.3-35.2c5.2-22.9 18.6-45.2 27.2-59.2 2.3-1.7.8 3.2-8.7 20.8-8.5 16.1-24.4 53.3-2.6 82.4.6-20.7 5.5-41.8 13.8-61.5 12-27.4 37.3-74.9 39.3-112.7 1.1.8 4.6 3.2 6.2 4.1 4.6 2.7 8.1 6.7 12.6 10.3 12.4 10 28.5 9.2 42.4 1.2 6.2-3.5 11.2-7.5 15.9-9 9.9-3.1 17.8-8.6 22.3-15 7.7 30.4 25.7 74.3 37.2 95.7 6.1 11.4 18.3 35.5 23.6 64.6 3.3-.1 7 .4 10.9 1.4 13.8-35.7-11.7-74.2-23.3-84.9-4.7-4.6-4.9-6.6-2.6-6.5 12.6 11.2 29.2 33.7 35.2 59 2.8 11.6 3.3 23.7.4 35.7 16.4 6.8 35.9 17.9 30.7 34.8-2.2-.1-3.2 0-4.2 0 3.2-10.1-3.9-17.6-22.8-26.1-19.6-8.6-36-8.6-38.3 12.5-12.1 4.2-18.3 14.7-21.4 27.3-2.8 11.2-3.6 24.7-4.4 39.9-.5 7.7-3.6 18-6.8 29-32.1 22.9-76.7 32.9-114.3 7.2m257.4-11.5c-.9 16.8-41.2 19.9-63.2 46.5-13.2 15.7-29.4 24.4-43.6 25.5s-26.5-4.8-33.7-19.3c-4.7-11.1-2.4-23.1 1.1-36.3 3.7-14.2 9.2-28.8 9.9-40.6.8-15.2 1.7-28.5 4.2-38.7 2.6-10.3 6.6-17.2 13.7-21.1.3-.2.7-.3 1-.5.8 13.2 7.3 26.6 18.8 29.5 12.6 3.3 30.7-7.5 38.4-16.3 9-.3 15.7-.9 22.6 5.1 9.9 8.5 7.1 30.3 17.1 41.6 10.6 11.6 14 19.5 13.7 24.6M173.4 148.7c2 1.9 4.7 4.5 8 7.1 6.6 5.2 15.8 10.6 27.3 10.6 11.6 0 22.5-5.9 31.8-10.8 4.9-2.6 10.9-7 14.8-10.4s5.9-6.3 3.1-6.6-2.6 2.6-6 5.1c-4.4 3.2-9.7 7.4-13.9 9.8-7.4 4.2-19.5 10.2-29.9 10.2s-18.7-4.8-24.9-9.7c-3.1-2.5-5.7-5-7.7-6.9-1.5-1.4-1.9-4.6-4.3-4.9-1.4-.1-1.8 3.7 1.7 6.5"/></svg>`,markdown:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path fill="currentColor" d="M593.8 59.1H46.2C20.7 59.1 0 79.8 0 105.2v301.5c0 25.5 20.7 46.2 46.2 46.2h547.7c25.5 0 46.2-20.7 46.1-46.1V105.2c0-25.4-20.7-46.1-46.2-46.1M338.5 360.6H277v-120l-61.5 76.9-61.5-76.9v120H92.3V151.4h61.5l61.5 76.9 61.5-76.9h61.5v209.2zm135.3 3.1L381.5 256H443V151.4h61.5V256H566z"/></svg>`,safari:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="m274.7 274.7-37.4-37.4L166 346zM256 8a248 248 0 1 0 0 496 248 248 0 1 0 0-496m155.8 174.8 14.8-6.1c1-.4 2-.6 3.1-.6s2.1.2 3.1.6 1.8 1 2.6 1.7 1.3 1.6 1.7 2.6.6 2 .6 3.1-.2 2.1-.6 3.1-1 1.9-1.7 2.6-1.6 1.3-2.6 1.7l-14.8 6.1c-2 .8-4.2.8-6.1 0s-3.5-2.4-4.3-4.3-.8-4.2 0-6.1 2.4-3.5 4.3-4.3zM314.4 94l6.1-14.8c.8-2 2.4-3.5 4.3-4.3s4.2-.8 6.1 0 3.5 2.4 4.3 4.3.8 4.2 0 6.1l-6.1 14.8c-.8 2-2.4 3.5-4.3 4.3s-4.2.8-6.1 0c-1-.4-1.9-1-2.6-1.7s-1.3-1.6-1.7-2.6-.6-2-.6-3.1.2-2.1.6-3.1zM256 60c2.1 0 4.2.8 5.7 2.3s2.3 3.6 2.3 5.7v16c0 2.1-.8 4.2-2.3 5.7S258.2 92 256 92s-4.2-.8-5.7-2.3-2.3-3.5-2.3-5.7V68c0-2.1.8-4.2 2.3-5.7s3.6-2.3 5.7-2.3m-75 14.9c1-.4 2-.6 3.1-.6s2.1.2 3.1.6 1.9 1 2.6 1.7 1.3 1.6 1.7 2.6l6.1 14.8c.4 1 .7 2 .7 3.1s-.2 2.1-.6 3.1-1 1.9-1.7 2.6-1.6 1.4-2.6 1.8-2 .6-3.1.6-2.1-.2-3.1-.6-1.9-1-2.6-1.8-1.3-1.7-1.7-2.7l-6.1-14.8c-.8-2-.8-4.2 0-6.1s2.4-3.5 4.3-4.3zm-63.6 42.5c1.5-1.5 3.5-2.3 5.7-2.3s4.2.8 5.7 2.3l11.2 11.3c1.5 1.5 2.3 3.5 2.3 5.6s-.8 4.1-2.3 5.6-3.5 2.3-5.7 2.3-4.2-.8-5.7-2.3l-11.3-11.3c-1.5-1.5-2.3-3.5-2.3-5.6s.8-4.1 2.3-5.6zM60 256c0-2.1.8-4.2 2.3-5.7s3.6-2.3 5.7-2.3h16c2.1 0 4.2.8 5.7 2.3s2.3 3.5 2.3 5.7-.8 4.2-2.3 5.7-3.5 2.3-5.7 2.3H68c-2.1 0-4.2-.8-5.7-2.3S60 258.1 60 256m40.2 73.2-14.8 6.1c-1 .4-2 .6-3.1.6s-2.1-.2-3.1-.6-1.9-1-2.6-1.7-1.3-1.6-1.7-2.6-.6-2-.6-3.1.2-2.1.6-3.1 1-1.9 1.7-2.6 1.6-1.3 2.6-1.7l14.8-6.1c2-.8 4.2-.8 6.1 0s3.5 2.4 4.3 4.3.8 4.2 0 6.1-2.4 3.5-4.3 4.3zm4.3-136c-.4 1-1 1.9-1.7 2.6s-1.6 1.3-2.6 1.7-2 .6-3.1.6-2.1-.2-3.1-.6l-14.8-6.1c-2-.8-3.5-2.4-4.3-4.3s-.8-4.2 0-6.1 2.4-3.5 4.3-4.3 4.2-.8 6.1 0l14.8 6.1c2 .8 3.5 2.4 4.3 4.3s.8 4.2 0 6.1zM197.6 418l-6.1 14.8c-.4 1-1 1.9-1.7 2.6s-1.6 1.3-2.6 1.7-2 .6-3.1.6-2.1-.2-3.1-.6-1.9-1-2.6-1.7-1.3-1.6-1.7-2.6-.6-2-.6-3.1.2-2.1.6-3.1l6.1-14.8c.4-1 1-1.9 1.7-2.7s1.6-1.4 2.6-1.8 2-.6 3.1-.6 2.1.2 3.1.6 1.9 1 2.6 1.8 1.3 1.7 1.7 2.6.6 2 .6 3.1-.2 2.1-.7 3.1zm66.4 26c0 2.1-.8 4.2-2.3 5.7s-3.5 2.3-5.7 2.3-4.2-.8-5.7-2.3-2.3-3.5-2.3-5.7v-16c0-2.1.8-4.2 2.3-5.7s3.5-2.3 5.7-2.3 4.2.8 5.7 2.3 2.3 3.5 2.3 5.7zm67-6.9c-1 .4-2 .6-3.1.6s-2.1-.2-3.1-.6-1.9-1-2.6-1.7-1.3-1.6-1.7-2.6l-6.1-14.8c-.8-2-.8-4.2 0-6.1s2.4-3.5 4.3-4.3 4.2-.8 6.1 0 3.5 2.4 4.3 4.3l6.1 14.8c.8 2 .8 4.2 0 6.1s-2.4 3.5-4.3 4.3zm63.6-42.5c-1.5 1.5-3.5 2.3-5.7 2.3s-4.2-.8-5.7-2.3L372 383.3c-1.5-1.5-2.3-3.5-2.3-5.6s.8-4.1 2.3-5.6 3.5-2.3 5.7-2.3 4.2.8 5.7 2.3l11.3 11.3c1.5 1.5 2.3 3.5 2.3 5.6s-.8 4.1-2.3 5.6zM286.2 286.2 110.3 401.7l115.5-175.9 175.9-115.5zM437.1 331c-.8 2-2.4 3.5-4.3 4.3s-4.2.8-6.1 0l-14.8-6.1c-2-.8-3.5-2.4-4.3-4.3s-.8-4.2 0-6.1c.4-1 1-1.9 1.7-2.6s1.6-1.3 2.6-1.7 2-.6 3.1-.6 2.1.2 3.1.6l14.8 6.1c2 .8 3.5 2.4 4.3 4.3s.8 4.2 0 6.1zm6.9-67h-16c-2.1 0-4.2-.8-5.7-2.3s-2.3-3.5-2.3-5.7.8-4.2 2.3-5.7 3.5-2.3 5.7-2.3h16c2.1 0 4.2.8 5.7 2.3s2.3 3.5 2.3 5.7-.8 4.2-2.3 5.7-3.5 2.3-5.7 2.3"/></svg>`,ubuntu:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path fill="currentColor" d="M469.2 75c0-20.1-8-39.3-22.2-53.5S413.6-.7 393.5-.7s-39.3 8-53.5 22.2-22.2 33.4-22.2 53.5 8 39.3 22.1 53.5 33.4 22.1 53.5 22.1 39.3-8 53.5-22.1S469 95.1 469 75h.1zm-315 165.7a75.6 75.6 0 1 0-151.2 0 75.6 75.6 0 1 0 151.2 0M57 346c18.6 46.9 51 87 93 115.1s91.5 42.6 142 41.7c-14.7-18.6-22.9-41.5-23.2-65.2-6.8-.9-13.3-2.1-19.5-3.4-26.8-5.7-51.9-17.3-73.6-34s-39.3-38.1-51.7-62.5c-20.9 9.9-44.5 12.8-67.1 8.2zm395.1 89.8a75.6 75.6 0 1 0-151.2 0 75.6 75.6 0 1 0 151.2 0m-8.1-84.2c18.5 14.8 31.6 35.2 37.2 58.2 33.3-41.3 52.6-92.2 54.8-145.2s-12.5-105.4-42.2-149.4c-8.6 21.5-24 39.6-43.8 51.6 15.4 28.6 22.9 60.8 21.9 93.2s-10.7 64-28 91.6zM101.1 135.4c12.4 2.7 24.3 7.5 35.1 14.3 16.6-24.2 38.9-44.1 64.8-58s54.8-21.3 84.2-21.7c.2-5.9.9-11.9 2-17.7C290.8 35.6 298.3 20 309 6.8c-47.7-3.8-95.4 6-137.6 28.5S94.3 91.7 70.8 133.4c2.7-.2 5.3-.3 8-.3 7.5 0 15 .8 22.4 2.3z"/></svg>`,windows:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="m0 93.7 183.6-25.3v177.4H0zm0 324.6 183.6 25.3V268.4H0zm203.8 28L448 480V268.4H203.8zm0-380.6v180.1H448V32z"/></svg>`},Xv=[`innerHTML`],Zv=rh({__name:`TkIcon`,props:{name:{}},setup(e){let t=e,n=U_(()=>Yv[t.name]||(console.warn(`[twikoo] 未注册的图标: ${t.name}(请在 components/icons.ts 登记)`),``));return(e,t)=>(Y(),X(Xg,null,[$(` SVG 内容来自 fontawesome-free 官方文件(构建期内联,非运行时注入用户数据) `),$(` eslint-disable-next-line vue/no-v-html `),Z(`i`,{class:`tk-icon`,innerHTML:n.value},null,8,Xv)],2112))}}),Qv={class:`tk-action`},$v={class:`tk-action-icon`},ey={class:`tk-action-icon tk-action-icon-solid`},ty={class:`tk-action-icon`},ny={class:`tk-action-icon tk-action-icon-solid`},ry={class:`tk-action-count`},iy={class:`tk-action-icon`},ay={class:`tk-action-icon tk-action-icon-solid`},oy={class:`tk-action-count`},sy={class:`tk-action-icon`},cy={class:`tk-action-icon tk-action-icon-solid`},ly={class:`tk-action-count`},uy=rh({__name:`TkAction`,props:{liked:{type:Boolean,default:!1},disliked:{type:Boolean,default:!1},likeCount:{default:0},dislikeCount:{default:0},repliesCount:{default:0},showDislike:{type:Boolean,default:!0},showDelete:{type:Boolean,default:!1}},emits:[`like`,`dislike`,`reply`,`delete`],setup(e,{emit:t}){let n=e,r=t,i=U_(()=>n.likeCount>0?`${n.likeCount}`:``),a=U_(()=>n.dislikeCount>0?`${n.dislikeCount}`:``),o=U_(()=>n.repliesCount>0?`${n.repliesCount}`:``);return(t,n)=>(Y(),X(`div`,Qv,[e.showDelete?(Y(),X(`button`,{key:0,class:`tk-action-link`,onClick:n[0]||=e=>r(`delete`)},[Z(`span`,$v,[Q(Zv,{name:`trash-regular`})]),Z(`span`,ey,[Q(Zv,{name:`trash`})]),n[4]||=Z(`span`,{class:`tk-action-count`},null,-1)])):$(`v-if`,!0),Z(`button`,{class:xf([`tk-action-link`,{"tk-liked":e.liked}]),onClick:n[1]||=e=>r(`like`)},[Z(`span`,ty,[Q(Zv,{name:`thumbs-up-regular`})]),Z(`span`,ny,[Q(Zv,{name:`thumbs-up`})]),Z(`span`,ry,K(i.value),1)],2),e.showDislike?(Y(),X(`button`,{key:1,class:xf([`tk-action-link`,{"tk-disliked":e.disliked}]),onClick:n[2]||=e=>r(`dislike`)},[Z(`span`,iy,[Q(Zv,{name:`thumbs-down-regular`})]),Z(`span`,ay,[Q(Zv,{name:`thumbs-down`})]),Z(`span`,oy,K(a.value),1)],2)):$(`v-if`,!0),Z(`button`,{class:`tk-action-link`,onClick:n[3]||=e=>r(`reply`)},[Z(`span`,sy,[Q(Zv,{name:`comment-regular`})]),Z(`span`,cy,[Q(Zv,{name:`comment`})]),Z(`span`,ly,K(o.value),1)])]))}}),dy={},fy={key:0,class:`tk-avatar-img`},py=[`src`],my=rh({__name:`TkAvatar`,props:{nick:{default:``},avatar:{default:``},mail:{default:``},mailMd5:{default:``},link:{default:``},config:{default:dy}},setup(e){let t=e,n=U_(()=>Kc({avatar:t.avatar,mailMd5:t.mailMd5,mail:t.mail,nick:t.nick},t.config));function r(){t.link&&window.open(ld(t.link),`_blank`)?.focus()}return(t,i)=>(Y(),X(`div`,{class:xf([`tk-avatar`,{"tk-clickable":!!e.link,"tk-has-avatar":!!n.value}]),onClick:r},[n.value?(Y(),X(`img`,{key:1,class:`tk-avatar-img`,src:n.value,alt:``},null,8,py)):(Y(),X(`div`,fy,[Q(Zv,{name:`user-circle`})]))],2))}}),hy={key:0,class:`tk-input-group__prepend`},gy=[`name`,`value`,`placeholder`,`rows`,`disabled`,`readonly`,`maxlength`],_y=[`type`,`name`,`value`,`placeholder`,`disabled`,`readonly`,`maxlength`,`min`,`max`],vy={key:3,class:`tk-input__suffix`},yy={key:4,class:`tk-input__count`},by={key:5,class:`tk-input-group__append`},xy=rh({__name:`TkInput`,props:{modelValue:{default:``},type:{default:`text`},placeholder:{default:``},rows:{default:2},autosize:{type:[Boolean,Object],default:!1},disabled:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},maxlength:{default:void 0},showWordLimit:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},size:{default:``},name:{default:``},min:{default:void 0},max:{default:void 0}},emits:[`update:modelValue`,`input`,`change`,`blur`,`focus`,`clear`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=zh(),o=q(),s=U_(()=>!!a.prepend),c=U_(()=>!!a.append),l=U_(()=>r.clearable&&!r.disabled&&!r.readonly&&u.value),u=U_(()=>r.modelValue!==``&&r.modelValue!==void 0&&r.modelValue!==null),d=U_(()=>String(r.modelValue??``).length);function f(e){let t=e.target.value;i(`update:modelValue`,t),i(`input`,t,e)}function p(e){i(`change`,e.target.value)}function m(e){i(`blur`,e)}function h(e){i(`focus`,e)}function g(){i(`update:modelValue`,``),i(`clear`),o.value?.focus()}function _(){o.value?.focus()}function v(){o.value?.blur()}function y(){let e=o.value;if(r.type!==`textarea`||!r.autosize||!(e instanceof HTMLTextAreaElement))return;let t=typeof r.autosize==`object`?r.autosize.minRows??r.rows:r.rows,n=getComputedStyle(e),i=parseFloat(n.lineHeight)||20,a=parseFloat(n.paddingTop)+parseFloat(n.paddingBottom),s=parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth),c=t*i+a+s;e.style.overflow=`hidden`,e.style.height=`auto`,e.style.height=`${Math.max(e.scrollHeight,c)}px`}return qm(()=>r.modelValue,()=>{Om(y)}),vh(()=>{Om(y)}),t({focus:_,blur:v,inputEl:o}),(t,n)=>(Y(),X(`div`,{class:xf([`tk-input`,[e.size?`tk-input--${e.size}`:``,e.type===`textarea`?`tk-textarea`:``,{"is-disabled":e.disabled,"tk-input--group":s.value||c.value}]])},[s.value?(Y(),X(`div`,hy,[Nh(t.$slots,`prepend`)])):$(`v-if`,!0),e.type===`textarea`?(Y(),X(`textarea`,{key:1,ref_key:`inputRef`,ref:o,class:`tk-input__inner tk-textarea__inner`,name:e.name,value:e.modelValue,placeholder:e.placeholder,rows:e.rows,disabled:e.disabled,readonly:e.readonly,maxlength:e.maxlength,onInput:f,onChange:p,onBlur:m,onFocus:h},null,40,gy)):(Y(),X(`input`,{key:2,ref_key:`inputRef`,ref:o,class:`tk-input__inner`,type:e.type,name:e.name,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,maxlength:e.maxlength,min:e.min,max:e.max,onInput:f,onChange:p,onBlur:m,onFocus:h},null,40,_y)),l.value?(Y(),X(`span`,vy,[e.clearable&&!e.disabled&&!e.readonly&&u.value?(Y(),X(`i`,{key:0,class:`tk-input__icon tk-input__clear`,onClick:g},[Q(Zv,{name:`circle-xmark`})])):$(`v-if`,!0)])):$(`v-if`,!0),e.showWordLimit&&e.maxlength?(Y(),X(`span`,yy,K(d.value)+`/`+K(e.maxlength),1)):$(`v-if`,!0),c.value?(Y(),X(`div`,by,[Nh(t.$slots,`append`)])):$(`v-if`,!0)],2))}}),Sy=new Map,Cy=`configUpdated`,wy=`initMeta`,Ty=`showAdminEntry`;function Ey(e,t){let n=Sy.get(e)??new Set;n.add(t),Sy.set(e,n)}function Dy(e,t){Sy.get(e)?.delete(t)}function Oy(e,...t){for(let n of Sy.get(e)??[])n(...t)}var ky={class:`tk-meta-input`},Ay=rh({__name:`TkMetaInput`,props:{nick:{default:``},mail:{default:``},link:{default:``},config:{default:dy}},emits:[`update`],setup(e,{emit:t}){let n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,r=e,i=t,a=[{key:`nick`,locale:W(`META_INPUT_NICK`),name:`nick`,type:`text`},{key:`mail`,locale:W(`META_INPUT_MAIL`),name:`mail`,type:`email`},{key:`link`,locale:W(`META_INPUT_LINK`),name:`link`,type:`text`}],o=Kp({nick:``,mail:``,link:``}),s=U_(()=>r.config??{}),c=U_(()=>{let e=s.value.DISPLAYED_FIELDS,t=typeof e==`string`?e:void 0;return{nick:!t||t.indexOf(`nick`)!==-1,mail:!t||t.indexOf(`mail`)!==-1,link:!t||t.indexOf(`link`)!==-1}}),l=U_(()=>a.filter(e=>!!c.value[e.key])),u=U_(()=>{let e=s.value.REQUIRED_FIELDS,t=typeof e==`string`?e:void 0;return{nick:!t||t.indexOf(`nick`)!==-1,mail:!t||t.indexOf(`mail`)!==-1,link:t?t.indexOf(`link`)!==-1:!1}});function d(){let e=n.test(o.mail);return(!!o.nick||!u.value.nick)&&(e||!u.value.mail)&&(!!o.link||!u.value.link)}function f(){localStorage.setItem(`twikoo`,JSON.stringify(o)),i(`update`,{meta:{...o},valid:d()})}function p(e,t){let n=t.target.name;n&&(o[n]=e,localStorage.setItem(`twikoo`,JSON.stringify(o)))}function m(){let e=localStorage.getItem(`twikoo`),t={};if(e)try{t=JSON.parse(e)}catch{t={}}o.nick=t.nick??r.nick??``,o.mail=t.mail??r.mail??``,o.link=t.link??r.link??``,f()}function h(){if(!cd(o.nick))return;let e=o.nick.replace(/@qq\.com/gi,``);o.mail=`${e}@qq.com`,_(e)}function g(){cd(o.nick)&&(o.nick=``,f())}async function _(e){try{let t=await Co(null,`GET_QQ_NICK`,{qq:e}),n=t.result??t;n.nick?(o.nick=n.nick,f()):g()}catch(e){console.warn(`获取 QQ 昵称失败:`,e),g()}}function v(){let e=s.value.HIDE_ADMIN_CRYPT;Oy(Ty,!e||e===o.nick)}function y(){h(),f(),v()}function b(){r.nick!==void 0&&o.nick!==r.nick&&(o.nick=r.nick),r.mail!==void 0&&o.mail!==r.mail&&(o.mail=r.mail),r.link!==void 0&&o.link!==r.link&&(o.link=r.link)}return qm(()=>[r.nick,r.mail,r.link],b),qm(u,()=>{i(`update`,{meta:{...o},valid:d()})}),qm(()=>s.value.VERSION,()=>{v()}),vh(()=>{Ey(wy,m),m()}),Sh(()=>{Dy(wy,m)}),(e,t)=>(Y(),X(`div`,ky,[(Y(!0),X(Xg,null,Mh(l.value,e=>(Y(),o_(xy,{key:e.key,class:`tk-meta-input__item`,name:e.name,type:e.type,"model-value":o[e.key],placeholder:u.value[e.key]?J(W)(`META_INPUT_REQUIRED`):J(W)(`META_INPUT_NOT_REQUIRED`),size:`small`,onInput:p,onChange:y},{prepend:Bm(()=>[m_(K(e.locale),1)]),_:2},1032,[`name`,`type`,`model-value`,`placeholder`]))),128))]))}}),jy=[`disabled`,`type`],My={class:`tk-button__label`},Ny=rh({__name:`TkButton`,props:{type:{default:`default`},size:{default:``},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},nativeType:{default:`button`}},emits:[`click`],setup(e,{emit:t}){let n=e,r=t;function i(e){n.disabled||n.loading||r(`click`,e)}return(t,n)=>(Y(),X(`button`,{class:xf([`tk-button`,[e.type==="default"?``:`tk-button--${e.type}`,e.size?`tk-button--${e.size}`:``,{"is-disabled":e.disabled,"is-loading":e.loading}]]),disabled:e.disabled||e.loading,type:e.nativeType,onClick:i},[e.loading?(Y(),o_(Zv,{key:0,name:`spinner`,class:`tk-button__spinner`})):$(`v-if`,!0),Z(`span`,My,[Nh(t.$slots,`default`)])],10,jy))}}),Py={logo:`OwO表情`,position:`down`,maxHeight:`250px`,odata:{}},Fy=class{container;target;odata;packagesEle;logo;area;packages;constructor(e){for(let[t,n]of Object.entries(Py))n&&!e[t]&&(e[t]=n);this.container=e.container,this.target=e.target,e.position===`up`&&this.container.classList.add(`OwO-up`),this.odata=e.odata,setTimeout(()=>{this.init(e)})}init(e){this.area=e.target,this.packages=Object.keys(this.odata);let t=`<div class="OwO-logo">${e.logo??``}</div><div class="OwO-body">`;for(let n of this.packages){let r=parseInt(e.maxHeight??`250`,10)-53;t+=`<ul class="OwO-items OwO-items-${this.odata[n]?.type??``}" style="max-height: ${r}px;">`;for(let e of this.odata[n]?.container??[])t+=`<li class="OwO-item" title="${e.text??``}">${e.icon.replace(`<img`,`<img loading="lazy"`)}</li>`;t+=`</ul>`}t+=`<div class="OwO-bar"><ul class="OwO-packages">`+this.packages.map(e=>`<li><span>${e}</span></li>`).join(``)+`</ul></div></div>`,this.container.innerHTML=t,this.logo=this.container.getElementsByClassName(`OwO-logo`)[0],this.logo.addEventListener(`click`,()=>{this.toggle()}),this.container.getElementsByClassName(`OwO-body`)[0]?.addEventListener(`click`,e=>this.onItemClick(e)),this.packagesEle=this.container.getElementsByClassName(`OwO-packages`)[0];for(let e=0;e<this.packagesEle.children.length;e++)this.packagesEle.children[e].addEventListener(`click`,()=>{this.tab(e)});this.tab(0)}onItemClick(e){let t=e.target;if(!t)return;let n=null;if(t.classList.contains(`OwO-item`)?n=t:t.parentNode instanceof HTMLElement&&t.parentNode.classList.contains(`OwO-item`)&&(n=t.parentNode),!n)return;let r=this.area.selectionEnd??this.area.value.length,i=this.area.value,a=n.innerHTML;if(a.indexOf(`<img`)!==-1){if(n.title)a=`:${n.title}: `;else{let e=a.indexOf(`src="`)+5,t=a.indexOf(`"`,e);e!==-1&&t!==-1&&(a=`![${n.title||``}](${a.substring(e,t)})`)}}this.area.value=i.slice(0,r)+a+i.slice(r),this.area.dispatchEvent(new Event(`input`,{bubbles:!0})),this.area.focus(),this.toggle()}toggle(){this.container.classList.toggle(`OwO-open`)}tab(e){let t=this.container.getElementsByClassName(`OwO-items-show`)[0];t&&t.classList.remove(`OwO-items-show`),this.container.getElementsByClassName(`OwO-items`)[e]?.classList.add(`OwO-items-show`);let n=this.container.getElementsByClassName(`OwO-package-active`)[0];n&&n.classList.remove(`OwO-package-active`),this.packagesEle.getElementsByTagName(`li`)[e]?.classList.add(`OwO-package-active`)}},Iy={class:`tk-row`},Ly={class:`tk-col`},Ry={class:`tk-row actions`},zy={class:`tk-row-actions-start`},By=[`innerHTML`],Vy={class:`tk-submit-action-icon __markdown`,alt:`Markdown is supported`,href:`https://guides.github.com/features/mastering-markdown/`,target:`_blank`,rel:`noopener noreferrer`},Hy={key:0,ref:`commentPreviewRef`,class:`tk-preview-container`},Uy=[`innerHTML`],Wy=rh({__name:`TkSubmit`,props:{replyId:{default:``},pid:{default:``},config:{default:dy}},emits:[`load`,`cancel`,`error`],setup(e,{emit:t}){let n=[`apng`,`bmp`,`gif`,`jpeg`,`jpg`,`png`,`svg`,`tif`,`tiff`,`webp`],r=Yv[`laugh-regular`],i=e,a=t,o=q(!1),s=q(!1),c=q(!1),l=q();qm(l,e=>{e&&a(`error`,e)});let u=q(null),d=q(``),f=q(``),p=q(``),m=q(``),h=q(``),g=q(null),_=q(null),v=q(null),y=q(),b=q(),x=q(),S=q(),C=q(),w=q(),T=q(),E=q(),D=q(),ee=U_(()=>{let e=i.config;return e.CAPTCHA_PROVIDER===void 0?e.TURNSTILE_SITE_KEY?`Turnstile`:e.GEETEST_CAPTCHA_ID?`Geetest`:e.CAP_API_ENDPOINT||e.CAP_BUILTIN?`Cap`:``:e.CAPTCHA_PROVIDER}),te=U_(()=>!!i.config.IMAGE_CDN),O=U_(()=>!o.value&&c.value&&!!d.value.trim()),k=U_(()=>{let e=bo().options.placeholder??i.config.COMMENT_PLACEHOLDER;return(typeof e==`string`?e:``).replace(/<br>/g,`
241
- `)}),A=U_(()=>{let e=parseInt(String(i.config.LIMIT_LENGTH),10);return Number.isNaN(e)&&(e=500),e>0?e:void 0}),ne=U_(()=>{let e=b.value?.inputEl;return e instanceof HTMLTextAreaElement?e:null});function re(){localStorage.setItem(`twikoo-draft`,d.value)}function ie(){let e=localStorage.getItem(`twikoo-draft`);!d.value&&e&&(d.value=e)}async function ae(){if(i.config.SHOW_EMOTION!==`true`)return;let e=await Ju(String(i.config.EMOTION_CDN||`https://owo.imaegoo.com/owo.json`));Yu(e),x.value&&ne.value&&(u.value=new Fy({logo:r,container:x.value,target:ne.value,odata:e,position:`down`,maxHeight:`250px`}))}function oe(){u.value?.container.classList.contains(`OwO-open`)&&u.value.toggle()}function se(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.onload=()=>t(),r.onerror=()=>n(Error(`脚本加载失败:${e}`)),document.head.appendChild(r)})}function ce(e,t){return{ok:e,json:()=>Promise.resolve(t)}}function le(){if(ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY){if(window.turnstile){g.value=Promise.resolve();return}g.value||=se(`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`)}}function ue(){return new Promise((e,t)=>{g.value?.then(()=>{let n=window.turnstile,r=n.render(w.value,{sitekey:i.config.TURNSTILE_SITE_KEY,callback:t=>{e(t),setTimeout(()=>n.remove(r),1e3)},"error-callback":()=>t(Error(`验证码校验失败,请重试`)),"expired-callback":()=>t(Error(`验证码已过期,请重试`)),"timeout-callback":()=>t(Error(`验证码超时,请重试`))})})})}function de(){if(ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID){if(window.initGeetest4){_.value=Promise.resolve();return}_.value||=se(`https://static.geetest.com/v4/gt4.js`)}}function fe(){return new Promise((e,t)=>{_.value?.then(()=>{let n=window.initGeetest4;n({captchaId:i.config.GEETEST_CAPTCHA_ID,product:`bind`,language:`zho`},n=>{n.onReady(()=>n.showCaptcha()).onSuccess(()=>{let t=n.getValidate();e({geeTestLotNumber:t.lot_number,geeTestCaptchaOutput:t.captcha_output,geeTestPassToken:t.pass_token,geeTestGenTime:t.gen_time})}).onError(e=>t(e instanceof Error?e:Error(`Geetest 验证失败,请重试`))).onClose(()=>t(Error(`验证已取消`)))})})})}function pe(){if(ee.value!==`Cap`||!i.config.CAP_API_ENDPOINT&&!i.config.CAP_BUILTIN)return;let e=window;if(i.config.CAP_BUILTIN&&(e.CAP_CUSTOM_FETCH=async(e,t={})=>{let n=String(e),r=t.body?JSON.parse(t.body):{};try{if(n.includes(`challenge`)){let e=await Co(bo().tcb,`CAP_CHALLENGE`),t=e.result??e;return t.code&&t.code!==0?ce(!1,{error:t.message??`challenge_failed`}):ce(!0,{challenge:t.challenge,token:t.token,expires:t.expires})}if(n.includes(`redeem`)){let e=await Co(bo().tcb,`CAP_REDEEM`,r),t=e.result??e;return t.code&&t.code!==0&&t.success!==!0?ce(!0,{success:!1,error:t.message??t.error??`redeem_failed`}):ce(!0,{success:t.success,token:t.token,expires:t.expires,message:t.message,error:t.error??t.message})}return ce(!1,{error:`unknown_cap_path`})}catch(e){return ce(!1,{error:e instanceof Error?e.message:`cap_fetch_failed`})}}),e.Cap||customElements.get(`cap-widget`)){v.value=Promise.resolve();return}v.value||=se(`https://cdn.jsdmirror.com/npm/@cap.js/widget`)}function me(){return new Promise((e,t)=>{v.value?.then(()=>{let n=document.createElement(`cap-widget`);n.setAttribute(`id`,`cap-widget`);let r=i.config.CAP_BUILTIN?`/`:String(i.config.CAP_API_ENDPOINT);n.setAttribute(`data-cap-api-endpoint`,r),D.value?.appendChild(n);let a=()=>{n.parentNode?.removeChild(n)};n.solve().then(n=>{a(),n.success?e(typeof n.token==`string`?n.token:``):t(Error(`Cap 验证失败`))}).catch(e=>{a(),t(e instanceof Error?e:Error(`Cap 验证失败`))})}).catch(t)})}function he(e){p.value=e.meta.nick,m.value=e.meta.mail,h.value=e.meta.link,c.value=e.valid}function ge(){a(`cancel`)}function _e(){re(),j()}function ve(){s.value=!s.value,j()}function j(){s.value&&(f.value=uc(Hu(d.value)),Om(()=>{let e=C.value;e&&(Td(e),Ed(e,bo().options.katex),i.config.HIGHLIGHT===`true`&&Tc(e,i.config.HIGHLIGHT_THEME,i.config.HIGHLIGHT_PLUGIN))}))}async function ye(){o.value=!0,l.value=void 0;try{if(d.value.match(RegExp(`!\\[${W(`IMAGE_UPLOAD_PLACEHOLDER`)}.+\\]\\(\\)`)))throw Error(W(`IMAGE_UPLOAD_PLEASE_WAIT`));let e={nick:p.value,mail:m.value,link:h.value,ua:await wd(),url:md(bo().options.path),href:hd(bo().options.href),comment:Hu(d.value),pid:i.pid?i.pid:i.replyId,rid:i.replyId};ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY&&(e.turnstileToken=await ue()),ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID&&Object.assign(e,await fe()),ee.value===`Cap`&&(i.config.CAP_API_ENDPOINT||i.config.CAP_BUILTIN)&&(e.capToken=await me());let t=await Co(bo().tcb,`COMMENT_SUBMIT`,e),n=t.result??t;if(n.id)d.value=``,l.value=void 0,a(`load`),re();else throw new _o(n.code===void 0?`UNKNOWN`:`REJECTED`,n.message??W(`COMMENT_FAILED`),{rawMessage:n.message??``})}catch(e){To.error(`评论失败`,e),l.value=e instanceof _o?e:new _o(`UNKNOWN`,`${W(`COMMENT_FAILED`)}: ${e.message}`,{rawMessage:e.message})}finally{o.value=!1}}function be(e){(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&ye()}function xe(){S.value?.click()}function Se(){let e=S.value?.files?.[0];we(e)}function Ce(e){e.clipboardData&&we(e.clipboardData.files[0]??e.clipboardData.items[0]?.getAsFile()??void 0)}async function we(e){if(!e||!te.value)return;let t=e.name.split(`.`),r=t.length>1?String(t.pop()):``;if(n.indexOf(r.toLowerCase())===-1)return;let{tcb:a}=bo(),o=a?.auth?.currentUser?.uid??localStorage.getItem(`twikoo-access-token`)??``,s=`${Date.now()}-${o}`,c=t.join(`.`),l=e.type===`image/gif`,u=l?c:`${c}.webp`,d=l?r:`webp`;De(Oe(s,d));let f=String(i.config.IMAGE_CDN??``),p=await Te(e);a&&(!f||f===`qcloud`)?M(s,u,d,p):f?Ee(s,u,d,p):P(s,d,W(`IMAGE_UPLOAD_FAILED_NO_CONF`))}async function Te(e){return e.type===`image/gif`?e:new Promise(t=>{let n=new FileReader;n.onload=n=>{let r=new Image;r.onload=()=>{let n=document.createElement(`canvas`),i=r.width,a=r.height,o=1920;(i>o||a>o)&&(i>a?(a=a*o/i,i=o):(i=i*o/a,a=o)),n.width=i,n.height=a,n.getContext(`2d`)?.drawImage(r,0,0,i,a);let s=`image/webp`,c=e.name.replace(/\.[^.]+$/,`.webp`);n.toBlob(e=>t(new File([e??new Blob],c,{type:s})),s,.85)};let i=n.target?.result;r.src=typeof i==`string`?i:``},n.readAsDataURL(e)})}async function M(e,t,n,r){try{let i=bo().tcb?.app,a=await i.uploadFile({cloudPath:`tk-img/${e}.${n}`,filePath:r});if(!a.fileID)return;N(e,t,n,(await i.getTempFileURL({fileList:[a.fileID]})).fileList[0].tempFileURL)}catch(t){console.error(t),P(e,n,t.message)}}async function Ee(e,t,n,r){try{let i=await Co(bo().tcb,`UPLOAD_IMAGE`,{fileName:t,photo:await Cd(r)}),a=i.result??i;a.data?N(e,t,n,String(a.data.url)):a.code===1041?P(e,n,W(`IMAGE_UPLOAD_NSFW`)):(console.error(a),P(e,n,String(a.err)))}catch(t){console.error(t),P(e,n,t.message)}}function N(e,t,n,r){let i=t.replace(/[[\]]/g,`_`);d.value=d.value.replace(Oe(e,n),`![${i}](${r})`),S.value&&(S.value.value=``)}function P(e,t,n){d.value=d.value.replace(Oe(e,t),`_${W(`IMAGE_UPLOAD_FAILED`)}: ${n}_`),S.value&&(S.value.value=``)}function De(e){let t=ne.value,n=t?.selectionStart??d.value.length,r=t?.selectionEnd??d.value.length;d.value=d.value.substring(0,n)+e+d.value.substring(r),Om(()=>{if(!t)return;let r=n+e.length;t.selectionStart=r,t.selectionEnd=r})}function Oe(e,t){return`![${W(`IMAGE_UPLOAD_PLACEHOLDER`)} ${e}.${t}]()`}function ke(){i.config.COMMENT_BG_IMG&&ne.value&&(ne.value.style[`background-image`]=`url("${String(i.config.COMMENT_BG_IMG)}")`)}function Ae(){le(),de(),pe()}return qm(()=>i.config.SHOW_EMOTION,()=>{ae()}),qm(()=>i.config.COMMENT_BG_IMG,()=>{ke()}),qm(()=>i.config.TURNSTILE_SITE_KEY,()=>{le()}),qm(()=>i.config.GEETEST_CAPTCHA_ID,()=>{de()}),qm(()=>i.config.CAP_API_ENDPOINT,()=>{pe()}),qm(ee,()=>{Ae()}),vh(()=>{i.pid&&y.value?.scrollIntoView({behavior:`instant`,block:`center`}),ie(),ne.value?.addEventListener(`paste`,Ce),ke(),Ae(),ae()}),Sh(()=>{ne.value?.removeEventListener(`paste`,Ce)}),(t,n)=>(Y(),X(`div`,{ref_key:`tkSubmitRef`,ref:y,class:`tk-submit tk-fade-in`},[Z(`div`,Iy,[Q(my,{config:e.config,mail:m.value,nick:p.value},null,8,[`config`,`mail`,`nick`]),Z(`div`,Ly,[Q(Ay,{nick:p.value,mail:m.value,link:h.value,config:e.config,onUpdate:he},null,8,[`nick`,`mail`,`link`,`config`]),Q(xy,{ref_key:`textareaRef`,ref:b,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`tk-input`,type:`textarea`,placeholder:k.value,autosize:{minRows:3},maxlength:A.value,"show-word-limit":``,onInput:_e,onKeyup:be},null,8,[`modelValue`,`placeholder`,`maxlength`])])]),Z(`div`,Ry,[Z(`div`,zy,[$(` 表情按钮:首屏先渲染图标,随后由 OwO 面板以同样的 logo 接管容器内容 `),$(` 图标为构建期内联的 fontawesome 官方 SVG,非运行时用户数据 `),$(` eslint-disable vue/no-v-html `),Vm(Z(`div`,{ref_key:`owoRef`,ref:x,class:`tk-submit-action-icon OwO`,innerHTML:J(r)},null,8,By),[[rv,e.config.SHOW_EMOTION===`true`],[J(id),oe]]),$(` eslint-enable vue/no-v-html `),Vm(Z(`div`,{class:`tk-submit-action-icon`,onClick:xe},[Q(Zv,{name:`image-regular`})],512),[[rv,te.value]]),Z(`input`,{ref_key:`inputFileRef`,ref:S,class:`tk-input-image`,type:`file`,accept:`image/*`,value:``,onChange:Se},null,544)]),Z(`a`,Vy,[Q(Zv,{name:`markdown`})]),e.replyId?(Y(),o_(Ny,{key:0,class:`tk-cancel`,size:`small`,onClick:ge},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_CANCEL`)),1)]),_:1})):$(`v-if`,!0),Q(Ny,{class:`tk-preview`,size:`small`,onClick:ve},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_PREVIEW`)),1)]),_:1}),Q(Ny,{class:`tk-send`,type:`primary`,size:`small`,disabled:!O.value,onClick:ye},{default:Bm(()=>[m_(K(o.value?J(W)(`SUBMIT_SENDING`):J(W)(`SUBMIT_SEND`)),1)]),_:1},8,[`disabled`]),Vm(Z(`div`,{ref_key:`turnstileContainerRef`,ref:T,class:`tk-turnstile-container`},[Z(`div`,{ref_key:`turnstileRef`,ref:w,class:`tk-turnstile`},null,512)],512),[[rv,ee.value===`Turnstile`]]),Vm(Z(`div`,{ref_key:`geetestContainerRef`,ref:E,class:`tk-geetest-container`},null,512),[[rv,ee.value===`Geetest`]]),Vm(Z(`div`,{ref_key:`capContainerRef`,ref:D,class:`tk-cap-container`},null,512),[[rv,ee.value===`Cap`]])]),s.value?(Y(),X(`div`,Hy,[$(` 预览内容经 sanitizeHtml 消毒 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`div`,{innerHTML:f.value},null,8,Uy)],512)):$(`v-if`,!0)],512))}}),Gy=Kp({serverConfig:{}});function Ky(e){Gy.serverConfig=e}function qy(){return Gy.serverConfig}var Jy=[`id`],Yy={class:`tk-main`},Xy={class:`tk-row`},Zy={class:`tk-meta`},Qy={key:0,class:`tk-nick`},$y=[`href`],eb={key:2,class:`tk-tag tk-tag-green`},tb={key:3,class:`tk-tag tk-tag-red`},nb={key:4,class:`tk-tag tk-tag-yellow`},rb={class:`tk-time`},ib=[`datetime`,`title`],ab={key:5,class:`tk-actions`},ob={key:0},sb=[`innerHTML`],cb={key:0,class:`tk-expand-wrap`},lb={key:1,class:`tk-collapse-wrap`},ub={key:2,class:`tk-extras`},db={key:0,class:`tk-extra`},fb={class:`tk-icon __comment`},pb={class:`tk-extra-text`},mb={key:1,class:`tk-extra`},hb={class:`tk-icon __comment`},gb={class:`tk-extra-text`},_b={key:2,class:`tk-extra`},vb={class:`tk-icon __comment`},yb={class:`tk-extra-text`},bb={key:4,class:`tk-expand-wrap`},xb={key:5,class:`tk-collapse-wrap`},Sb=rh({__name:`TkComment`,props:{comment:{},replyId:{default:``},replying:{type:Boolean,default:!1},config:{default:dy}},emits:[`reply`,`load`,`expand`,`refreshed`,`error`],setup(e,{emit:t}){let n=e,r=t,i={win:`windows`,mac:`apple`,ipad:`apple`,iphone:`apple`,ios:`apple`,android:`android`,ubuntu:`ubuntu`,linux:`linux`},a={edge:`edge`,chrome:`chrome`,firefox:`firefox-browser`,safari:`safari`,explorer:`internet-explorer`,ie:`internet-explorer`},o=q(``),s=q(n.comment.ups??0),c=q(n.comment.downs??0),l=q(n.comment.liked===!0),u=q(n.comment.disliked===!0),d=q(!1),f=q(!1),p=q(!1),m=q(!1),h=q(!1),g=q(!1),_=q(n.comment.isSpam===!0),v=q(n.comment.top===!0),y=q(!1),b=q(),x=q(),S=q(),C=q(),w=U_(()=>uc(n.comment.comment)),T=U_(()=>ud(n.comment.created)),E=U_(()=>new Date(n.comment.created??0).toJSON()),D=U_(()=>new Date(n.comment.created??0).toLocaleString()),ee=U_(()=>ie(n.comment.os??``,i)),te=U_(()=>ie(n.comment.browser??``,a)),O=U_(()=>p.value&&!f.value),k=U_(()=>p.value&&f.value),A=U_(()=>h.value&&!m.value),ne=U_(()=>h.value&&m.value),re=U_(()=>ld(n.comment.link));function ie(e,t){let n=e.toLowerCase();for(let e of Object.keys(t))if(n.indexOf(e)!==-1)return t[e];return`window-maximize-regular`}function ae(){let e=C.value;n.comment.replies.length>0&&e&&(p.value=e.scrollHeight>236)}function oe(){let e=x.value;e&&(h.value=h.value||e.scrollHeight>500)}function se(){x.value?.querySelectorAll(`img`).forEach(e=>{e.onload=oe})}function ce(){window.location.hash.indexOf(n.comment.id)!==-1&&(b.value?.scrollIntoView({behavior:`smooth`}),r(`expand`))}function le(e){document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`center`})}async function ue(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`up`}),l.value?s.value--:(s.value++,u.value&&c.value--),l.value=!l.value,u.value=!1}finally{d.value=!1}}}async function de(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`down`}),u.value?c.value--:(c.value++,l.value&&s.value--),u.value=!u.value,l.value=!1}finally{d.value=!1}}}function fe(e){o.value=e,r(`reply`,n.comment.id)}async function pe(){if(!confirm(W(`COMMENT_DELETE_CONFIRM`)))return;let e=await Co(bo().tcb,`COMMENT_DELETE_FOR_USER`,{id:n.comment.id}),t=e.result??e;t.code?alert(t.message):r(`load`)}function me(e){o.value=e,r(`reply`,e?n.comment.id:``)}function he(){o.value=``,r(`reply`,``)}function ge(){o.value=``,r(`reply`,``),r(`load`),f.value=!0}function _e(){r(`refreshed`),Om(()=>{let e=C.value?.lastElementChild;n.comment.replies.length>0&&e&&e.scrollIntoView({behavior:`smooth`,block:`center`})})}async function ve(){let{tcb:e}=bo();if(e?.auth){let t=await e.auth.getCurrentUser();g.value=t.loginType===`CUSTOM`}else g.value=qy().IS_ADMIN===!0}function j(e){xe({isSpam:e})}function ye(e){xe({top:e})}function be(e){if(qy().LIGHTBOX!==`true`)return;let t=e.target;if(t.tagName!==`IMG`||t.classList.contains(`tk-owo-emotion`))return;let n=document.createElement(`div`);n.className=`tk-lightbox`;let r=document.createElement(`img`);r.className=`tk-lightbox-image`,r.src=t.src,n.appendChild(r),n.addEventListener(`click`,()=>{document.body.removeChild(n)}),document.body.appendChild(n)}async function xe(e){y.value=!0;try{await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:n.comment.id,set:e}),e.isSpam!==void 0&&(_.value=e.isSpam),e.top!==void 0&&(v.value=e.top)}finally{y.value=!1}}function Se(){let e=S.value;e&&(Td(e),Ed(e,bo().options.katex),n.config.HIGHLIGHT===`true`&&Tc(e,n.config.HIGHLIGHT_THEME,n.config.HIGHLIGHT_PLUGIN))}return qm(()=>n.comment.isSpam,e=>{_.value=e===!0}),qm(()=>n.comment.top,e=>{v.value=e===!0}),qm(()=>n.comment.ups,()=>{s.value=n.comment.ups??0,l.value=n.comment.liked===!0},{immediate:!0}),qm(()=>n.comment.downs,()=>{c.value=n.comment.downs??0,u.value=n.comment.disliked===!0},{immediate:!0}),qm(()=>n.config.HIGHLIGHT,e=>{e===`true`&&Om(Se)},{immediate:!0}),vh(()=>{Om(oe),Om(se),Om(ae),Om(ce),Om(Se),ve()}),(t,n)=>{let i=Oh(`TkComment`,!0);return Y(),X(`div`,{id:e.comment.id,ref_key:`tkCommentRef`,ref:b,class:xf([`tk-comment`,{"tk-master":e.comment.master}])},[Q(my,{config:e.config,nick:e.comment.nick,avatar:e.comment.avatar,"mail-md5":e.comment.mailMd5,link:re.value},null,8,[`config`,`nick`,`avatar`,`mail-md5`,`link`]),Z(`div`,Yy,[Z(`div`,Xy,[Z(`div`,Zy,[re.value?$(`v-if`,!0):(Y(),X(`strong`,Qy,K(e.comment.nick),1)),re.value?(Y(),X(`a`,{key:1,class:`tk-nick tk-nick-link`,href:re.value,target:`_blank`,rel:`noopener noreferrer nofollow ugc`},[Z(`strong`,null,K(e.comment.nick),1)],8,$y)):$(`v-if`,!0),e.comment.master?(Y(),X(`span`,eb,K(e.config.MASTER_TAG||J(W)(`COMMENT_MASTER_TAG`)),1)):$(`v-if`,!0),v.value?(Y(),X(`span`,tb,K(J(W)(`COMMENT_TOP_TAG`)),1)):$(`v-if`,!0),_.value?(Y(),X(`span`,nb,K(J(W)(`COMMENT_REVIEWING_TAG`)),1)):$(`v-if`,!0),Z(`small`,rb,[Z(`time`,{datetime:E.value,title:D.value},K(T.value),9,ib)]),g.value?(Y(),X(`small`,ab,[_.value?(Y(),X(`button`,{key:0,onClick:n[0]||=e=>j(!1)},K(J(W)(`ADMIN_COMMENT_SHOW`)),1)):$(`v-if`,!0),_.value?$(`v-if`,!0):(Y(),X(`button`,{key:1,onClick:n[1]||=e=>j(!0)},K(J(W)(`ADMIN_COMMENT_HIDE`)),1)),!e.comment.rid&&v.value?(Y(),X(`button`,{key:2,onClick:n[2]||=e=>ye(!1)},K(J(W)(`ADMIN_COMMENT_UNTOP`)),1)):$(`v-if`,!0),!e.comment.rid&&!v.value?(Y(),X(`button`,{key:3,onClick:n[3]||=e=>ye(!0)},K(J(W)(`ADMIN_COMMENT_TOP`)),1)):$(`v-if`,!0)])):$(`v-if`,!0)]),Q(uy,{liked:l.value,disliked:u.value,"like-count":s.value,"dislike-count":c.value,"replies-count":e.comment.replies.length,"show-dislike":e.config.SHOW_DISLIKE!==`false`,"show-delete":e.comment.isOwner===!0,onLike:ue,onDislike:de,onReply:fe,onDelete:pe},null,8,[`liked`,`disliked`,`like-count`,`dislike-count`,`replies-count`,`show-dislike`,`show-delete`])]),Z(`div`,{ref_key:`tkContentRef`,ref:x,class:xf([`tk-content`,{"tk-content-expand":m.value}])},[e.comment.pid?(Y(),X(`span`,ob,[m_(K(J(W)(`COMMENT_REPLIED`))+` `,1),Z(`a`,{class:`tk-ruser`,href:`#`,onClick:n[4]||=Bv(t=>le(e.comment.pid),[`prevent`])},K(`@${e.comment.ruser}`),1),n[12]||=m_(` : `,-1)])):$(`v-if`,!0),$(` 正文:服务端已 DOMPurify 消毒,客户端再走一次 sanitizeHtml 双保险 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`span`,{ref_key:`commentRef`,ref:S,onClick:be,innerHTML:w.value},null,8,sb)],2),A.value?(Y(),X(`div`,cb,[Z(`div`,{class:`tk-expand`,onClick:n[5]||=e=>m.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),ne.value?(Y(),X(`div`,lb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[6]||=e=>m.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0),e.comment.ipRegion||e.comment.os||e.comment.browser?(Y(),X(`div`,ub,[e.comment.ipRegion?(Y(),X(`div`,db,[Z(`span`,fb,[Q(Zv,{name:`location-arrow`})]),Z(`span`,pb,`\xA0`+K(e.comment.ipRegion),1)])):$(`v-if`,!0),e.comment.os?(Y(),X(`div`,mb,[Z(`span`,hb,[Q(Zv,{name:ee.value},null,8,[`name`])]),Z(`span`,gb,`\xA0`+K(e.comment.os),1)])):$(`v-if`,!0),e.comment.browser?(Y(),X(`div`,_b,[Z(`span`,vb,[Q(Zv,{name:te.value},null,8,[`name`])]),Z(`span`,yb,`\xA0`+K(e.comment.browser),1)])):$(`v-if`,!0)])):$(`v-if`,!0),$(` 回复框(主楼被回复时挂载;楼中楼由子评论自身挂载) `),e.replying&&!o.value?(Y(),o_(Wy,{key:3,"reply-id":e.replyId?e.replyId:e.comment.id,pid:e.comment.id,config:e.config,onLoad:ge,onCancel:he,onError:n[7]||=e=>r(`error`,e)},null,8,[`reply-id`,`pid`,`config`])):$(`v-if`,!0),$(` 回复列表 `),Z(`div`,{ref_key:`tkRepliesRef`,ref:C,class:xf([`tk-replies`,{"tk-replies-expand":f.value||!O.value||e.replying}])},[(Y(!0),X(Xg,null,Mh(e.comment.replies,t=>(Y(),o_(i,{key:t.id,comment:t,"reply-id":e.comment.id,replying:e.replying&&o.value===t.id,config:e.config,onExpand:n[8]||=e=>f.value=!0,onLoad:ge,onReply:me,onRefreshed:_e,onError:n[9]||=e=>r(`error`,e)},null,8,[`comment`,`reply-id`,`replying`,`config`]))),128))],2),O.value&&!e.replying?(Y(),X(`div`,bb,[Z(`div`,{class:`tk-expand`,onClick:n[10]||=e=>f.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),k.value&&!e.replying?(Y(),X(`div`,xb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[11]||=e=>f.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0)])],10,Jy)}}}),Cb={class:`tk-error`},wb={class:`tk-error__icon`},Tb={class:`tk-error__body`},Eb={class:`tk-error__title`},Db={class:`tk-error__message`},Ob={class:`tk-error__detail`},kb={key:0,class:`tk-error__row`},Ab={key:1,class:`tk-error__row`},jb={key:2,class:`tk-error__raw`},Mb=rh({__name:`TkError`,props:{error:{}},setup(e){let t=e,n=q(!1),r={NETWORK:`无法连接到后端`,CORS:`请求被跨域策略拦截`,TIMEOUT:`请求超时`,REJECTED:`请求过于频繁`,NOT_FOUND:`接口地址不存在`,CLIENT_ERROR:`请求失败`,SERVER_ERROR:`后端异常`,UNKNOWN:`出现未知错误`},i=U_(()=>r[t.error.kind]??`出现错误`),a=U_(()=>{let e=t.error.rawMessage||t.error.message;return e.length>120?`${e.slice(0,120)}...`:e}),o=U_(()=>t.error.logText||t.error.rawMessage||``),s=U_(()=>t.error.httpStatus),c=U_(()=>t.error.requestId);return(e,t)=>(Y(),X(`div`,Cb,[Z(`div`,wb,[Q(Zv,{name:`circle-exclamation`})]),Z(`div`,Tb,[Z(`div`,Eb,K(i.value),1),Z(`div`,Db,K(a.value),1),Z(`button`,{class:`tk-error__toggle`,type:`button`,onClick:t[0]||=e=>n.value=!n.value},K(n.value?`收起详情`:`展开详情`),1),Vm(Z(`div`,Ob,[s.value?(Y(),X(`div`,kb,`HTTP: `+K(s.value),1)):$(`v-if`,!0),c.value?(Y(),X(`div`,Ab,`Request ID: `+K(c.value),1)):$(`v-if`,!0),o.value?(Y(),X(`pre`,jb,K(o.value),1)):$(`v-if`,!0)],512),[[rv,n.value]])])]))}}),Nb={class:`tk-comments`},Pb={class:`tk-comments-container`},Fb={class:`tk-comments-title`},Ib={key:0},Lb={class:`tk-comments-actions`},Rb={key:0,class:`tk-comments-sort`},zb={class:`tk-comments-search`},Bb={key:1,class:`tk-comments-no`},Vb={key:0},Hb={key:1},Ub={key:2,class:`tk-expand-wrap`},Wb=rh({__name:`TkComments`,props:{showAdminEntry:{type:Boolean,default:!1}},emits:[`admin`,`refreshed`],setup(e,{emit:t}){let n=t,r=q(!0),i=q(!1),a=q(null),o=q({}),s=q([]),c=q(!0),l=q(0),u=q(``),d=q(1),f=q(`newest`),p=q(``),m=q(``),h=q(!1),g=q(0),_=q();async function v(){try{let e=await Co(bo().tcb,`GET_CONFIG`),t=e.result??e;t.config&&(o.value=t.config,Ky(t.config))}catch(e){To.warn(`加载公开配置失败`,e)}}async function y(){let e=++g.value;r.value=!0,a.value=null;let t={url:md(bo().options.path),sort:f.value,keyword:m.value};m.value&&(t.page=1),await k(t),e===g.value&&(r.value=!1)}function b(){s.value=[],d.value=1}function x(){let e=p.value.trim();p.value=e,m.value!==e&&(m.value=e,b(),y())}function S(){m.value&&(m.value=``,b(),y())}function C(){h.value=!h.value,h.value?setTimeout(()=>_.value?.focus(),0):(p.value=``,S())}function w(){b(),y()}async function T(){let e=++g.value;r.value=!0,a.value=null;try{let e=md(bo().options.path),t=d.value,n={url:e,sort:f.value,keyword:m.value};if(m.value&&(n.page=1),!await k(n))return;for(let n=2;n<=t&&await te(e,n);n++);}finally{e===g.value&&(r.value=!1)}e===g.value&&n(`refreshed`)}function E(e){f.value!==e&&(f.value=e,b(),y())}async function D(){if(!i.value){i.value=!0,d.value++;try{await te(md(bo().options.path),d.value)}finally{i.value=!1}}}function ee(){let e=1/0;for(let t of s.value)!t.top&&(t.created??1/0)<e&&(e=t.created??1/0);return e===1/0?void 0:e}async function te(e,t=d.value){if(m.value)return k({url:e,page:t,sort:f.value,keyword:m.value});let n=ee();return n!==void 0&&k({url:e,before:n,sort:f.value,keyword:m.value})}function O(){let e=bo().options.onCommentLoaded;typeof e==`function`&&e()}async function k(e){let t=g.value;try{let n=await Co(bo().tcb,`COMMENT_GET`,e);if(t!==g.value)return!1;let r=n.result??n;if(r?.message)return a.value=new _o(`CLIENT_ERROR`,r.message,{rawMessage:r.message}),!1;if(r?.data)return s.value=e.before||typeof e.page==`number`&&e.page>1?s.value.concat(r.data):r.data,c.value=r.more===!0,l.value=r.count??s.value.length,setTimeout(O,0),!0}catch(e){t===g.value&&(a.value=e instanceof _o?e:new _o(`UNKNOWN`,e.message,{rawMessage:e.message}))}return!1}function A(e){a.value=e}function ne(e){u.value=e}function re(){n(`admin`)}function ie(){v()}function ae(){T()}return vh(()=>{v(),y(),Ey(Cy,ie),Ey(Cy,ae)}),Sh(()=>{Dy(Cy,ie),Dy(Cy,ae)}),(t,n)=>(Y(),X(`div`,Nb,[Q(Wy,{config:o.value,onLoad:y,onError:A},null,8,[`config`]),Vm((Y(),X(`div`,Pb,[Z(`div`,Fb,[Z(`span`,{class:xf([`tk-comments-count`,{__hidden:r.value||!s.value.length&&!m.value}])},[m.value?(Y(),X(`span`,Ib,K(J(W)(`COMMENTS_SEARCH_COUNT_PREFIX`)),1)):$(`v-if`,!0),Z(`span`,null,K(l.value),1),Z(`span`,null,K(J(W)(`COMMENTS_COUNT_SUFFIX`)),1)],2),Z(`span`,Lb,[!r.value&&s.value.length&&o.value.SHOW_ORDER!==`false`?(Y(),X(`span`,Rb,[Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`newest`}]),type:`button`,onClick:n[0]||=e=>E(`newest`)},K(J(W)(`COMMENTS_SORT_NEWEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`oldest`}]),type:`button`,onClick:n[1]||=e=>E(`oldest`)},K(J(W)(`COMMENTS_SORT_OLDEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`popular`}]),type:`button`,onClick:n[2]||=e=>E(`popular`)},K(J(W)(`COMMENTS_SORT_POPULAR`)),3)])):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:1,class:xf([`tk-icon __comments`,{__active:h.value}]),onClick:C},[Q(Zv,{name:`magnifying-glass`})],2)):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:2,class:`tk-icon __comments`,onClick:w},[Q(Zv,{name:`sync`})])):$(`v-if`,!0),e.showAdminEntry?(Y(),X(`span`,{key:3,class:`tk-icon __comments`,onClick:re},[Q(Zv,{name:`cog`})])):$(`v-if`,!0)])]),Vm(Z(`div`,zb,[Q(xy,{ref_key:`searchInputRef`,ref:_,modelValue:p.value,"onUpdate:modelValue":n[3]||=e=>p.value=e,size:`small`,clearable:``,maxlength:100,placeholder:J(W)(`COMMENTS_SEARCH_PLACEHOLDER`),onClear:S,onKeyup:Hv(x,[`enter`])},null,8,[`modelValue`,`placeholder`]),Q(Ny,{size:`small`,type:`primary`,onClick:x},{default:Bm(()=>[m_(K(J(W)(`COMMENTS_SEARCH`)),1)]),_:1})],512),[[rv,h.value]]),$(` 评论区唯一错误卡片:列表/提交/回复失败共用,位于空态块上方 `),a.value?(Y(),o_(Mb,{key:0,error:a.value},null,8,[`error`])):$(`v-if`,!0),!s.value.length&&!r.value&&!a.value?(Y(),X(`div`,Bb,[m.value?(Y(),X(`span`,Vb,K(J(W)(`COMMENTS_SEARCH_NO_RESULT`)),1)):$(`v-if`,!0),m.value?$(`v-if`,!0):(Y(),X(`span`,Hb,K(J(W)(`COMMENTS_NO_COMMENTS`)),1))])):$(`v-if`,!0),(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),o_(Sb,{key:e.id,comment:e,replying:u.value===e.id,config:o.value,onReply:ne,onLoad:T,onError:A},null,8,[`comment`,`replying`,`config`]))),128)),c.value&&!r.value&&!a.value?(Y(),X(`div`,Ub,[Vm((Y(),X(`div`,{class:`tk-expand`,onClick:D},[m_(K(J(W)(`COMMENTS_EXPAND`)),1)])),[[J(td),i.value]])])):$(`v-if`,!0)])),[[J(td),r.value]])]))}}),Gb={class:`tk-footer`},Kb=rh({__name:`TkFooter`,setup(e){let t=ho;return(e,n)=>(Y(),X(`div`,Gb,[n[0]||=m_(` Powered by `,-1),n[1]||=Z(`a`,{href:`https://twikoo.js.org`,target:`_blank`,rel:`noopener noreferrer`},`Twikoo`,-1),m_(` v`+K(J(t)),1)]))}}),qb={class:`tk-pagination`},Jb={key:0,class:`tk-pagination-options`},Yb={class:`tk-pagination-pagers`},Xb=[`onClick`],Zb={key:1,class:`tk-pagination-options`},Qb=rh({__name:`TkPagination`,props:{pageSize:{default:10},total:{default:0}},emits:[`current-change`,`page-size-change`],setup(e,{emit:t}){let n=e,r=t,i=q(1),a=q(0),o=q(0),s=q([]),c=U_(()=>Math.ceil(n.total/n.pageSize));function l(){let e=[];for(let t=1;t<=c.value;t++)Math.abs(i.value-t)<3||t===1||t===c.value?e.push({title:`${t}`,page:t}):Math.abs(i.value-t)<4&&e.push({title:`...`,page:t});s.value=e}function u(e){i.value=parseInt(String(e),10)||1,i.value>c.value&&(i.value=c.value),i.value<1&&(i.value=1),a.value=0,r(`current-change`,i.value),l()}function d(e){o.value=0,r(`page-size-change`,parseInt(String(e),10))}function f(e){a.value=parseInt(String(e),10)}function p(e){o.value=parseInt(String(e),10)}function m(){l()}return qm(()=>n.total,m,{immediate:!0}),qm(()=>n.pageSize,m),(t,n)=>(Y(),X(`div`,qb,[c.value?(Y(),X(`div`,Jb,[Z(`div`,null,[Z(`span`,null,K(J(W)(`PAGINATION_COUNT_PREFIX`)),1),Z(`span`,null,K(e.total),1),Z(`span`,null,K(J(W)(`PAGINATION_COUNT_SUFFIX`)),1)]),Q(xy,{class:`tk-pagination-size`,type:`number`,min:1,max:100,"model-value":o.value?o.value:e.pageSize,onInput:p,onChange:d},null,8,[`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_PAGESIZE`)),1)])):$(`v-if`,!0),Z(`div`,Yb,[(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),X(`div`,{key:e.page,class:xf([`tk-pagination-pager`,{__current:e.page===i.value}]),onClick:t=>u(e.page)},K(e.title),11,Xb))),128))]),c.value?(Y(),X(`div`,Zb,[Z(`span`,null,K(J(W)(`PAGINATION_GOTO_PREFIX`)),1),Q(xy,{class:`tk-pagination-goto`,type:`number`,min:1,max:c.value,"model-value":a.value?a.value:i.value,onInput:f,onChange:u},null,8,[`max`,`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_GOTO_SUFFIX`)),1)])):$(`v-if`,!0)]))}}),$b={class:`tk-admin-comment`},ex={key:0,class:`tk-admin-warn`},tx={class:`tk-admin-comment-filter`},nx={value:``},rx={value:`VISIBLE`},ix={value:`HIDDEN`},ax={class:`tk-admin-comment-meta`},ox={key:0},sx=[`href`],cx={key:2},lx=[`href`],ux={key:3},dx={class:`tk-time`},fx=[`title`],px=[`innerHTML`],mx={key:0,class:`tk-admin-warn tk-admin-security-alert`},hx={class:`tk-admin-security-alert-message`},gx={key:0,class:`tk-admin-security-alert-url`},_x={class:`tk-admin-actions`},vx=5,yx=rh({__name:`TkAdminComment`,setup(e){let t=qy().VERSION,n=q(!0),r=q([]),i=Kp({}),a=q(typeof t==`string`?t:``),o=ho,s=q(0),c=q(vx),l=q(1),u=Kp({keyword:``,type:``}),d=q(null),f=q();function p(e){return ud(e.created)}async function m(){n.value=!0;let e=await Co(bo().tcb,`COMMENT_GET_FOR_ADMIN`,{per:c.value,page:l.value,keyword:u.keyword,type:u.type}),t=e.result??e;t&&!t.code&&(s.value=t.count??0,r.value=(t.data??[]).map(e=>({...e,comment:uc(e.comment)}))),setTimeout(()=>{w(f.value)},0),n.value=!1}async function h(){let e=await Co(bo().tcb,`GET_CONFIG_FOR_ADMIN`),t=e.result??e;t&&!t.code&&t.config&&(Object.assign(i,t.config),a.value=typeof t.config.VERSION==`string`?t.config.VERSION:``,g())}function g(){i.HIGHLIGHT||=`true`;let e={},t=localStorage.getItem(`twikoo`);if(t)try{e=JSON.parse(t)}catch{e={}}for(let t of[`nick`,`mail`,`avatar`])i[t]=e[t]??``;!e.nick&&i.BLOGGER_NICK&&(e.nick=String(i.BLOGGER_NICK)),!e.mail&&i.BLOGGER_EMAIL&&(e.mail=String(i.BLOGGER_EMAIL)),!e.link&&i.SITE_URL&&(e.link=String(i.SITE_URL)),localStorage.setItem(`twikoo`,JSON.stringify(e))}function _(e){c.value=e,m()}function v(e){l.value=e,m()}function y(e){let t=`${e.url??``}#${e.id}`;try{if(new URL(t).hostname!==window.location.hostname){d.value={commentId:e.id,message:W(`ADMIN_COMMENT_SECURITY_ALERT`),url:t};return}window.open(t)}catch{try{new URL(t,window.location.origin),window.open(t)}catch{d.value={commentId:e.id,message:W(`ADMIN_COMMENT_PARSE_ERROR`),url:e.url}}}}async function b(e){confirm(W(`ADMIN_COMMENT_DELETE_CONFIRM`))&&(n.value=!0,await Co(bo().tcb,`COMMENT_DELETE_FOR_ADMIN`,{id:e.id}),await m(),n.value=!1)}function x(e,t){C(e,{isSpam:t})}function S(e,t){C(e,{top:t})}async function C(e,t){n.value=!0,await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:e.id,set:t}),await m(),n.value=!1}function w(e){e&&(Td(e),Ed(e,bo().options.katex),i.HIGHLIGHT===`true`&&Tc(e,i.HIGHLIGHT_THEME,i.HIGHLIGHT_PLUGIN))}return vh(async()=>{await Promise.all([h(),m()]),w(f.value)}),(e,t)=>Vm((Y(),X(`div`,$b,[J(o)===a.value?$(`v-if`,!0):(Y(),X(`div`,ex,[Z(`span`,null,K(J(W)(`ADMIN_CLIENT_VERSION`))+K(J(o))+`,`,1),Z(`span`,null,K(J(W)(`ADMIN_SERVER_VERSION`))+K(a.value)+`,`,1),$(`
241
+ `)}),A=U_(()=>{let e=parseInt(String(i.config.LIMIT_LENGTH),10);return Number.isNaN(e)&&(e=500),e>0?e:void 0}),ne=U_(()=>{let e=b.value?.inputEl;return e instanceof HTMLTextAreaElement?e:null});function re(){localStorage.setItem(`twikoo-draft`,d.value)}function ie(){let e=localStorage.getItem(`twikoo-draft`);!d.value&&e&&(d.value=e)}async function ae(){if(i.config.SHOW_EMOTION!==`true`)return;let e=await Ju(String(i.config.EMOTION_CDN||`https://owo.imaegoo.com/owo.json`));Yu(e),x.value&&ne.value&&(u.value=new Fy({logo:r,container:x.value,target:ne.value,odata:e,position:`down`,maxHeight:`250px`}))}function oe(){u.value?.container.classList.contains(`OwO-open`)&&u.value.toggle()}function se(e){return new Promise((t,n)=>{let r=document.createElement(`script`);r.src=e,r.onload=()=>t(),r.onerror=()=>n(Error(`脚本加载失败:${e}`)),document.head.appendChild(r)})}function ce(e,t){return{ok:e,json:()=>Promise.resolve(t)}}function le(){if(ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY){if(window.turnstile){g.value=Promise.resolve();return}g.value||=se(`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`)}}function ue(){return new Promise((e,t)=>{g.value?.then(()=>{let n=window.turnstile,r=n.render(w.value,{sitekey:i.config.TURNSTILE_SITE_KEY,callback:t=>{e(t),setTimeout(()=>n.remove(r),1e3)},"error-callback":()=>t(Error(`验证码校验失败,请重试`)),"expired-callback":()=>t(Error(`验证码已过期,请重试`)),"timeout-callback":()=>t(Error(`验证码超时,请重试`))})})})}function de(){if(ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID){if(window.initGeetest4){_.value=Promise.resolve();return}_.value||=se(`https://static.geetest.com/v4/gt4.js`)}}function fe(){return new Promise((e,t)=>{_.value?.then(()=>{let n=window.initGeetest4;n({captchaId:i.config.GEETEST_CAPTCHA_ID,product:`bind`,language:`zho`},n=>{n.onReady(()=>n.showCaptcha()).onSuccess(()=>{let t=n.getValidate();e({geeTestLotNumber:t.lot_number,geeTestCaptchaOutput:t.captcha_output,geeTestPassToken:t.pass_token,geeTestGenTime:t.gen_time})}).onError(e=>t(e instanceof Error?e:Error(`Geetest 验证失败,请重试`))).onClose(()=>t(Error(`验证已取消`)))})})})}function pe(){if(ee.value!==`Cap`||!i.config.CAP_API_ENDPOINT&&!i.config.CAP_BUILTIN)return;let e=window;if(i.config.CAP_BUILTIN&&(e.CAP_CUSTOM_FETCH=async(e,t={})=>{let n=String(e),r=t.body?JSON.parse(t.body):{};try{if(n.includes(`challenge`)){let e=await Co(bo().tcb,`CAP_CHALLENGE`),t=e.result??e;return t.code&&t.code!==0?ce(!1,{error:t.message??`challenge_failed`}):ce(!0,{challenge:t.challenge,token:t.token,expires:t.expires})}if(n.includes(`redeem`)){let e=await Co(bo().tcb,`CAP_REDEEM`,r),t=e.result??e;return t.code&&t.code!==0&&t.success!==!0?ce(!0,{success:!1,error:t.message??t.error??`redeem_failed`}):ce(!0,{success:t.success,token:t.token,expires:t.expires,message:t.message,error:t.error??t.message})}return ce(!1,{error:`unknown_cap_path`})}catch(e){return ce(!1,{error:e instanceof Error?e.message:`cap_fetch_failed`})}}),e.Cap||customElements.get(`cap-widget`)){v.value=Promise.resolve();return}v.value||=se(`https://cdn.jsdmirror.com/npm/@cap.js/widget`)}function me(){return new Promise((e,t)=>{v.value?.then(()=>{let n=document.createElement(`cap-widget`);n.setAttribute(`id`,`cap-widget`);let r=i.config.CAP_BUILTIN?`/`:String(i.config.CAP_API_ENDPOINT);n.setAttribute(`data-cap-api-endpoint`,r),D.value?.appendChild(n);let a=()=>{n.parentNode?.removeChild(n)};n.solve().then(n=>{a(),n.success?e(typeof n.token==`string`?n.token:``):t(Error(`Cap 验证失败`))}).catch(e=>{a(),t(e instanceof Error?e:Error(`Cap 验证失败`))})}).catch(t)})}function he(e){p.value=e.meta.nick,m.value=e.meta.mail,h.value=e.meta.link,c.value=e.valid}function ge(){a(`cancel`)}function _e(){re(),j()}function ve(){s.value=!s.value,j()}function j(){s.value&&(f.value=uc(Hu(d.value)),Om(()=>{let e=C.value;e&&(Td(e),Ed(e,bo().options.katex),i.config.HIGHLIGHT===`true`&&Tc(e,i.config.HIGHLIGHT_THEME,i.config.HIGHLIGHT_PLUGIN))}))}async function ye(){o.value=!0,l.value=void 0;try{if(d.value.match(RegExp(`!\\[${W(`IMAGE_UPLOAD_PLACEHOLDER`)}.+\\]\\(\\)`)))throw Error(W(`IMAGE_UPLOAD_PLEASE_WAIT`));let e={nick:p.value,mail:m.value,link:h.value,ua:await wd(),url:md(bo().options.path),href:hd(bo().options.href),comment:Hu(d.value),pid:i.pid?i.pid:i.replyId,rid:i.replyId};ee.value===`Turnstile`&&i.config.TURNSTILE_SITE_KEY&&(e.turnstileToken=await ue()),ee.value===`Geetest`&&i.config.GEETEST_CAPTCHA_ID&&Object.assign(e,await fe()),ee.value===`Cap`&&(i.config.CAP_API_ENDPOINT||i.config.CAP_BUILTIN)&&(e.capToken=await me());let t=await Co(bo().tcb,`COMMENT_SUBMIT`,e),n=t.result??t;if(n.id)d.value=``,l.value=void 0,a(`load`),re();else throw new _o(n.code===void 0?`UNKNOWN`:`REJECTED`,n.message??W(`COMMENT_FAILED`),{rawMessage:n.message??``})}catch(e){To.error(`评论失败`,e),l.value=e instanceof _o?e:new _o(`UNKNOWN`,`${W(`COMMENT_FAILED`)}: ${e.message}`,{rawMessage:e.message})}finally{o.value=!1}}function be(e){(e.ctrlKey||e.metaKey)&&e.key===`Enter`&&ye()}function xe(){S.value?.click()}function Se(){let e=S.value?.files?.[0];we(e)}function Ce(e){e.clipboardData&&we(e.clipboardData.files[0]??e.clipboardData.items[0]?.getAsFile()??void 0)}async function we(e){if(!e||!te.value)return;let t=e.name.split(`.`),r=t.length>1?String(t.pop()):``;if(n.indexOf(r.toLowerCase())===-1)return;let{tcb:a}=bo(),o=a?.auth?.currentUser?.uid??localStorage.getItem(`twikoo-access-token`)??``,s=`${Date.now()}-${o}`,c=t.join(`.`),l=e.type===`image/gif`,u=l?c:`${c}.webp`,d=l?r:`webp`;De(Oe(s,d));let f=String(i.config.IMAGE_CDN??``),p=await Te(e);a&&(!f||f===`qcloud`)?M(s,u,d,p):f?Ee(s,u,d,p):P(s,d,W(`IMAGE_UPLOAD_FAILED_NO_CONF`))}async function Te(e){return e.type===`image/gif`?e:new Promise(t=>{let n=new FileReader;n.onload=n=>{let r=new Image;r.onload=()=>{let n=document.createElement(`canvas`),i=r.width,a=r.height,o=1920;(i>o||a>o)&&(i>a?(a=a*o/i,i=o):(i=i*o/a,a=o)),n.width=i,n.height=a,n.getContext(`2d`)?.drawImage(r,0,0,i,a);let s=`image/webp`,c=e.name.replace(/\.[^.]+$/,`.webp`);n.toBlob(e=>t(new File([e??new Blob],c,{type:s})),s,.85)};let i=n.target?.result;r.src=typeof i==`string`?i:``},n.readAsDataURL(e)})}async function M(e,t,n,r){try{let i=bo().tcb?.app,a=await i.uploadFile({cloudPath:`tk-img/${e}.${n}`,filePath:r});if(!a.fileID)return;N(e,t,n,(await i.getTempFileURL({fileList:[a.fileID]})).fileList[0].tempFileURL)}catch(t){console.error(t),P(e,n,t.message)}}async function Ee(e,t,n,r){try{let i=await Co(bo().tcb,`UPLOAD_IMAGE`,{fileName:t,photo:await Cd(r)}),a=i.result??i;a.data?N(e,t,n,String(a.data.url)):a.code===1041?P(e,n,W(`IMAGE_UPLOAD_NSFW`)):(console.error(a),P(e,n,String(a.err)))}catch(t){console.error(t),P(e,n,t.message)}}function N(e,t,n,r){let i=t.replace(/[[\]]/g,`_`);d.value=d.value.replace(Oe(e,n),`![${i}](${r})`),S.value&&(S.value.value=``)}function P(e,t,n){d.value=d.value.replace(Oe(e,t),`_${W(`IMAGE_UPLOAD_FAILED`)}: ${n}_`),S.value&&(S.value.value=``)}function De(e){let t=ne.value,n=t?.selectionStart??d.value.length,r=t?.selectionEnd??d.value.length;d.value=d.value.substring(0,n)+e+d.value.substring(r),Om(()=>{if(!t)return;let r=n+e.length;t.selectionStart=r,t.selectionEnd=r})}function Oe(e,t){return`![${W(`IMAGE_UPLOAD_PLACEHOLDER`)} ${e}.${t}]()`}function ke(){i.config.COMMENT_BG_IMG&&ne.value&&(ne.value.style[`background-image`]=`url("${String(i.config.COMMENT_BG_IMG)}")`)}function Ae(){le(),de(),pe()}return qm(()=>i.config.SHOW_EMOTION,()=>{ae()}),qm(()=>i.config.COMMENT_BG_IMG,()=>{ke()}),qm(()=>i.config.TURNSTILE_SITE_KEY,()=>{le()}),qm(()=>i.config.GEETEST_CAPTCHA_ID,()=>{de()}),qm(()=>i.config.CAP_API_ENDPOINT,()=>{pe()}),qm(ee,()=>{Ae()}),vh(()=>{i.pid&&y.value?.scrollIntoView({behavior:`instant`,block:`center`}),ie(),ne.value?.addEventListener(`paste`,Ce),ke(),Ae(),ae()}),Sh(()=>{ne.value?.removeEventListener(`paste`,Ce)}),(t,n)=>(Y(),X(`div`,{ref_key:`tkSubmitRef`,ref:y,class:`tk-submit tk-fade-in`},[Z(`div`,Iy,[Q(my,{config:e.config,mail:m.value,nick:p.value},null,8,[`config`,`mail`,`nick`]),Z(`div`,Ly,[Q(Ay,{nick:p.value,mail:m.value,link:h.value,config:e.config,onUpdate:he},null,8,[`nick`,`mail`,`link`,`config`]),Q(xy,{ref_key:`textareaRef`,ref:b,modelValue:d.value,"onUpdate:modelValue":n[0]||=e=>d.value=e,class:`tk-input`,type:`textarea`,placeholder:k.value,autosize:{minRows:3},maxlength:A.value,"show-word-limit":``,onInput:_e,onKeyup:be},null,8,[`modelValue`,`placeholder`,`maxlength`])])]),Z(`div`,Ry,[Z(`div`,zy,[$(` 表情按钮:首屏先渲染图标,随后由 OwO 面板以同样的 logo 接管容器内容 `),$(` 图标为构建期内联的 fontawesome 官方 SVG,非运行时用户数据 `),$(` eslint-disable vue/no-v-html `),Vm(Z(`div`,{ref_key:`owoRef`,ref:x,class:`tk-submit-action-icon OwO`,innerHTML:J(r)},null,8,By),[[rv,e.config.SHOW_EMOTION===`true`],[J(id),oe]]),$(` eslint-enable vue/no-v-html `),Vm(Z(`div`,{class:`tk-submit-action-icon`,onClick:xe},[Q(Zv,{name:`image-regular`})],512),[[rv,te.value]]),Z(`input`,{ref_key:`inputFileRef`,ref:S,class:`tk-input-image`,type:`file`,accept:`image/*`,value:``,onChange:Se},null,544)]),Z(`a`,Vy,[Q(Zv,{name:`markdown`})]),e.replyId?(Y(),o_(Ny,{key:0,class:`tk-cancel`,size:`small`,onClick:ge},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_CANCEL`)),1)]),_:1})):$(`v-if`,!0),Q(Ny,{class:`tk-preview`,size:`small`,onClick:ve},{default:Bm(()=>[m_(K(J(W)(`SUBMIT_PREVIEW`)),1)]),_:1}),Q(Ny,{class:`tk-send`,type:`primary`,size:`small`,disabled:!O.value,onClick:ye},{default:Bm(()=>[m_(K(o.value?J(W)(`SUBMIT_SENDING`):J(W)(`SUBMIT_SEND`)),1)]),_:1},8,[`disabled`]),Vm(Z(`div`,{ref_key:`turnstileContainerRef`,ref:T,class:`tk-turnstile-container`},[Z(`div`,{ref_key:`turnstileRef`,ref:w,class:`tk-turnstile`},null,512)],512),[[rv,ee.value===`Turnstile`]]),Vm(Z(`div`,{ref_key:`geetestContainerRef`,ref:E,class:`tk-geetest-container`},null,512),[[rv,ee.value===`Geetest`]]),Vm(Z(`div`,{ref_key:`capContainerRef`,ref:D,class:`tk-cap-container`},null,512),[[rv,ee.value===`Cap`]])]),s.value?(Y(),X(`div`,Hy,[$(` 预览内容经 sanitizeHtml 消毒 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`div`,{innerHTML:f.value},null,8,Uy)],512)):$(`v-if`,!0)],512))}}),Gy=Kp({serverConfig:{}});function Ky(e){Gy.serverConfig=e}function qy(){return Gy.serverConfig}var Jy=[`id`],Yy={class:`tk-main`},Xy={class:`tk-row`},Zy={class:`tk-meta`},Qy={key:0,class:`tk-nick`},$y=[`href`],eb={key:2,class:`tk-tag tk-tag-green`},tb={key:3,class:`tk-tag tk-tag-red`},nb={key:4,class:`tk-tag tk-tag-yellow`},rb={class:`tk-time`},ib=[`datetime`,`title`],ab={key:5,class:`tk-actions`},ob={key:0},sb=[`innerHTML`],cb={key:0,class:`tk-expand-wrap`},lb={key:1,class:`tk-collapse-wrap`},ub={key:2,class:`tk-extras`},db={key:0,class:`tk-extra`},fb={class:`tk-icon __comment`},pb={class:`tk-extra-text`},mb={key:1,class:`tk-extra`},hb={class:`tk-icon __comment`},gb={class:`tk-extra-text`},_b={key:2,class:`tk-extra`},vb={class:`tk-icon __comment`},yb={class:`tk-extra-text`},bb={key:4,class:`tk-expand-wrap`},xb={key:5,class:`tk-collapse-wrap`},Sb=rh({__name:`TkComment`,props:{comment:{},replyId:{default:``},replying:{type:Boolean,default:!1},config:{default:dy}},emits:[`reply`,`load`,`expand`,`refreshed`,`error`],setup(e,{emit:t}){let n=e,r=t,i={win:`windows`,mac:`apple`,ipad:`apple`,iphone:`apple`,ios:`apple`,android:`android`,ubuntu:`ubuntu`,linux:`linux`},a={edge:`edge`,chrome:`chrome`,firefox:`firefox-browser`,safari:`safari`,explorer:`internet-explorer`,ie:`internet-explorer`},o=q(``),s=q(n.comment.ups??0),c=q(n.comment.downs??0),l=q(n.comment.liked===!0),u=q(n.comment.disliked===!0),d=q(!1),f=q(!1),p=q(!1),m=q(!1),h=q(!1),g=q(!1),_=q(n.comment.isSpam===!0),v=q(n.comment.top===!0),y=q(!1),b=q(),x=q(),S=q(),C=q(),w=U_(()=>uc(n.comment.comment)),T=U_(()=>ud(n.comment.created)),E=U_(()=>new Date(n.comment.created??0).toJSON()),D=U_(()=>new Date(n.comment.created??0).toLocaleString()),ee=U_(()=>ie(n.comment.os??``,i)),te=U_(()=>ie(n.comment.browser??``,a)),O=U_(()=>p.value&&!f.value),k=U_(()=>p.value&&f.value),A=U_(()=>h.value&&!m.value),ne=U_(()=>h.value&&m.value),re=U_(()=>ld(n.comment.link));function ie(e,t){let n=e.toLowerCase();for(let e of Object.keys(t))if(n.indexOf(e)!==-1)return t[e];return`window-maximize-regular`}function ae(){let e=C.value;n.comment.replies.length>0&&e&&(p.value=e.scrollHeight>236)}function oe(){let e=x.value;e&&(h.value=h.value||e.scrollHeight>500)}function se(){x.value?.querySelectorAll(`img`).forEach(e=>{e.onload=oe})}function ce(){window.location.hash.indexOf(n.comment.id)!==-1&&(b.value?.scrollIntoView({behavior:`smooth`}),r(`expand`))}function le(e){document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`center`})}async function ue(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`up`}),l.value?s.value--:(s.value++,u.value&&c.value--),l.value=!l.value,u.value=!1}finally{d.value=!1}}}async function de(){if(!d.value){d.value=!0;try{await Co(bo().tcb,`COMMENT_LIKE`,{id:n.comment.id,type:`down`}),u.value?c.value--:(c.value++,l.value&&s.value--),u.value=!u.value,l.value=!1}finally{d.value=!1}}}function fe(e){o.value=e,r(`reply`,n.comment.id)}async function pe(){if(!confirm(W(`COMMENT_DELETE_CONFIRM`)))return;let e=await Co(bo().tcb,`COMMENT_DELETE_FOR_USER`,{id:n.comment.id}),t=e.result??e;t.code?alert(t.message):r(`load`)}function me(e){o.value=e,r(`reply`,e?n.comment.id:``)}function he(){o.value=``,r(`reply`,``)}function ge(){o.value=``,r(`reply`,``),r(`load`),f.value=!0}function _e(){r(`refreshed`),Om(()=>{let e=C.value?.lastElementChild;n.comment.replies.length>0&&e&&e.scrollIntoView({behavior:`smooth`,block:`center`})})}async function ve(){let{tcb:e}=bo();if(e?.auth){let t=await e.auth.getCurrentUser();g.value=t.loginType===`CUSTOM`}else g.value=qy().IS_ADMIN===!0}function j(e){xe({isSpam:e})}function ye(e){xe({top:e})}function be(e){if(qy().LIGHTBOX!==`true`)return;let t=e.target;if(t.tagName!==`IMG`||t.classList.contains(`tk-owo-emotion`))return;let n=document.createElement(`div`);n.className=`tk-lightbox`;let r=document.createElement(`img`);r.className=`tk-lightbox-image`,r.src=t.src,n.appendChild(r),n.addEventListener(`click`,()=>{document.body.removeChild(n)}),document.body.appendChild(n)}async function xe(e){y.value=!0;try{await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:n.comment.id,set:e}),e.isSpam!==void 0&&(_.value=e.isSpam),e.top!==void 0&&(v.value=e.top)}finally{y.value=!1}}function Se(){let e=S.value;e&&(Td(e),Ed(e,bo().options.katex),n.config.HIGHLIGHT===`true`&&Tc(e,n.config.HIGHLIGHT_THEME,n.config.HIGHLIGHT_PLUGIN))}return qm(()=>n.comment.isSpam,e=>{_.value=e===!0}),qm(()=>n.comment.top,e=>{v.value=e===!0}),qm(()=>n.comment.ups,()=>{s.value=n.comment.ups??0,l.value=n.comment.liked===!0},{immediate:!0}),qm(()=>n.comment.downs,()=>{c.value=n.comment.downs??0,u.value=n.comment.disliked===!0},{immediate:!0}),qm(()=>n.config.HIGHLIGHT,e=>{e===`true`&&Om(Se)},{immediate:!0}),vh(()=>{Om(oe),Om(se),Om(ae),Om(ce),Om(Se),ve()}),(t,n)=>{let i=Oh(`TkComment`,!0);return Y(),X(`div`,{id:e.comment.id,ref_key:`tkCommentRef`,ref:b,class:xf([`tk-comment`,{"tk-master":e.comment.master}])},[Q(my,{config:e.config,nick:e.comment.nick,avatar:e.comment.avatar,"mail-md5":e.comment.mailMd5,link:re.value},null,8,[`config`,`nick`,`avatar`,`mail-md5`,`link`]),Z(`div`,Yy,[Z(`div`,Xy,[Z(`div`,Zy,[re.value?$(`v-if`,!0):(Y(),X(`strong`,Qy,K(e.comment.nick),1)),re.value?(Y(),X(`a`,{key:1,class:`tk-nick tk-nick-link`,href:re.value,target:`_blank`,rel:`noopener noreferrer nofollow ugc`},[Z(`strong`,null,K(e.comment.nick),1)],8,$y)):$(`v-if`,!0),e.comment.master?(Y(),X(`span`,eb,K(e.config.MASTER_TAG||J(W)(`COMMENT_MASTER_TAG`)),1)):$(`v-if`,!0),v.value?(Y(),X(`span`,tb,K(J(W)(`COMMENT_TOP_TAG`)),1)):$(`v-if`,!0),_.value?(Y(),X(`span`,nb,K(J(W)(`COMMENT_REVIEWING_TAG`)),1)):$(`v-if`,!0),Z(`small`,rb,[Z(`time`,{datetime:E.value,title:D.value},K(T.value),9,ib)]),g.value?(Y(),X(`small`,ab,[_.value?(Y(),X(`button`,{key:0,onClick:n[0]||=e=>j(!1)},K(J(W)(`ADMIN_COMMENT_SHOW`)),1)):$(`v-if`,!0),_.value?$(`v-if`,!0):(Y(),X(`button`,{key:1,onClick:n[1]||=e=>j(!0)},K(J(W)(`ADMIN_COMMENT_HIDE`)),1)),!e.comment.rid&&v.value?(Y(),X(`button`,{key:2,onClick:n[2]||=e=>ye(!1)},K(J(W)(`ADMIN_COMMENT_UNTOP`)),1)):$(`v-if`,!0),!e.comment.rid&&!v.value?(Y(),X(`button`,{key:3,onClick:n[3]||=e=>ye(!0)},K(J(W)(`ADMIN_COMMENT_TOP`)),1)):$(`v-if`,!0)])):$(`v-if`,!0)]),Q(uy,{liked:l.value,disliked:u.value,"like-count":s.value,"dislike-count":c.value,"replies-count":e.comment.replies.length,"show-dislike":e.config.SHOW_DISLIKE!==`false`,"show-delete":e.comment.isOwner===!0,onLike:ue,onDislike:de,onReply:fe,onDelete:pe},null,8,[`liked`,`disliked`,`like-count`,`dislike-count`,`replies-count`,`show-dislike`,`show-delete`])]),Z(`div`,{ref_key:`tkContentRef`,ref:x,class:xf([`tk-content`,{"tk-content-expand":m.value}])},[e.comment.pid?(Y(),X(`span`,ob,[m_(K(J(W)(`COMMENT_REPLIED`))+` `,1),Z(`a`,{class:`tk-ruser`,href:`#`,onClick:n[4]||=Bv(t=>le(e.comment.pid),[`prevent`])},K(`@${e.comment.ruser}`),1),n[12]||=m_(` : `,-1)])):$(`v-if`,!0),$(` 正文:服务端已 DOMPurify 消毒,客户端再走一次 sanitizeHtml 双保险 `),$(` eslint-disable-next-line vue/no-v-html `),Z(`span`,{ref_key:`commentRef`,ref:S,onClick:be,innerHTML:w.value},null,8,sb)],2),A.value?(Y(),X(`div`,cb,[Z(`div`,{class:`tk-expand`,onClick:n[5]||=e=>m.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),ne.value?(Y(),X(`div`,lb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[6]||=e=>m.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0),e.comment.ipRegion||e.comment.os||e.comment.browser?(Y(),X(`div`,ub,[e.comment.ipRegion?(Y(),X(`div`,db,[Z(`span`,fb,[Q(Zv,{name:`location-arrow`})]),Z(`span`,pb,`\xA0`+K(e.comment.ipRegion),1)])):$(`v-if`,!0),e.comment.os?(Y(),X(`div`,mb,[Z(`span`,hb,[Q(Zv,{name:ee.value},null,8,[`name`])]),Z(`span`,gb,`\xA0`+K(e.comment.os),1)])):$(`v-if`,!0),e.comment.browser?(Y(),X(`div`,_b,[Z(`span`,vb,[Q(Zv,{name:te.value},null,8,[`name`])]),Z(`span`,yb,`\xA0`+K(e.comment.browser),1)])):$(`v-if`,!0)])):$(`v-if`,!0),$(` 回复框(主楼被回复时挂载;楼中楼由子评论自身挂载) `),e.replying&&!o.value?(Y(),o_(Wy,{key:3,"reply-id":e.replyId?e.replyId:e.comment.id,pid:e.comment.id,config:e.config,onLoad:ge,onCancel:he,onError:n[7]||=e=>r(`error`,e)},null,8,[`reply-id`,`pid`,`config`])):$(`v-if`,!0),$(` 回复列表 `),Z(`div`,{ref_key:`tkRepliesRef`,ref:C,class:xf([`tk-replies`,{"tk-replies-expand":f.value||!O.value||e.replying}])},[(Y(!0),X(Xg,null,Mh(e.comment.replies,t=>(Y(),o_(i,{key:t.id,comment:t,"reply-id":e.comment.id,replying:e.replying&&o.value===t.id,config:e.config,onExpand:n[8]||=e=>f.value=!0,onLoad:ge,onReply:me,onRefreshed:_e,onError:n[9]||=e=>r(`error`,e)},null,8,[`comment`,`reply-id`,`replying`,`config`]))),128))],2),O.value&&!e.replying?(Y(),X(`div`,bb,[Z(`div`,{class:`tk-expand`,onClick:n[10]||=e=>f.value=!0},K(J(W)(`COMMENT_EXPAND`)),1)])):$(`v-if`,!0),k.value&&!e.replying?(Y(),X(`div`,xb,[Z(`div`,{class:`tk-expand _collapse`,onClick:n[11]||=e=>f.value=!1},K(J(W)(`COMMENT_COLLAPSE`)),1)])):$(`v-if`,!0)])],10,Jy)}}}),Cb={class:`tk-error`},wb={class:`tk-error__icon`},Tb={class:`tk-error__body`},Eb={class:`tk-error__title`},Db={class:`tk-error__message`},Ob={class:`tk-error__detail`},kb={key:0,class:`tk-error__row`},Ab={key:1,class:`tk-error__row`},jb={key:2,class:`tk-error__raw`},Mb=rh({__name:`TkError`,props:{error:{}},setup(e){let t=e,n=q(!1),r={NETWORK:`无法连接到后端`,CORS:`请求被跨域策略拦截`,TIMEOUT:`请求超时`,REJECTED:`请求过于频繁`,NOT_FOUND:`接口地址不存在`,CLIENT_ERROR:`请求失败`,SERVER_ERROR:`后端异常`,UNKNOWN:`出现未知错误`},i=U_(()=>r[t.error.kind]??`出现错误`),a=U_(()=>{let e=t.error.rawMessage||t.error.message;return e.length>120?`${e.slice(0,120)}...`:e}),o=U_(()=>t.error.rawMessage||``),s=U_(()=>t.error.httpStatus),c=U_(()=>t.error.requestId);return(e,t)=>(Y(),X(`div`,Cb,[Z(`div`,wb,[Q(Zv,{name:`circle-exclamation`})]),Z(`div`,Tb,[Z(`div`,Eb,K(i.value),1),Z(`div`,Db,K(a.value),1),Z(`button`,{class:`tk-error__toggle`,type:`button`,onClick:t[0]||=e=>n.value=!n.value},K(n.value?`收起详情`:`展开详情`),1),Vm(Z(`div`,Ob,[s.value?(Y(),X(`div`,kb,`HTTP: `+K(s.value),1)):$(`v-if`,!0),c.value?(Y(),X(`div`,Ab,`Request ID: `+K(c.value),1)):$(`v-if`,!0),o.value?(Y(),X(`pre`,jb,K(o.value),1)):$(`v-if`,!0)],512),[[rv,n.value]])])]))}}),Nb={class:`tk-comments`},Pb={class:`tk-comments-container`},Fb={class:`tk-comments-title`},Ib={key:0},Lb={class:`tk-comments-actions`},Rb={key:0,class:`tk-comments-sort`},zb={class:`tk-comments-search`},Bb={key:1,class:`tk-comments-no`},Vb={key:0},Hb={key:1},Ub={key:2,class:`tk-expand-wrap`},Wb=rh({__name:`TkComments`,props:{showAdminEntry:{type:Boolean,default:!1}},emits:[`admin`,`refreshed`],setup(e,{emit:t}){let n=t,r=q(!0),i=q(!1),a=q(null),o=q({}),s=q([]),c=q(!0),l=q(0),u=q(``),d=q(1),f=q(`newest`),p=q(``),m=q(``),h=q(!1),g=q(0),_=q();async function v(){try{let e=await Co(bo().tcb,`GET_CONFIG`),t=e.result??e;t.config&&(o.value=t.config,Ky(t.config))}catch(e){To.warn(`加载公开配置失败`,e)}}async function y(){let e=++g.value;r.value=!0,a.value=null;let t={url:md(bo().options.path),sort:f.value,keyword:m.value};m.value&&(t.page=1),await k(t),e===g.value&&(r.value=!1)}function b(){s.value=[],d.value=1}function x(){let e=p.value.trim();p.value=e,m.value!==e&&(m.value=e,b(),y())}function S(){m.value&&(m.value=``,b(),y())}function C(){h.value=!h.value,h.value?setTimeout(()=>_.value?.focus(),0):(p.value=``,S())}function w(){b(),y()}async function T(){let e=++g.value;r.value=!0,a.value=null;try{let e=md(bo().options.path),t=d.value,n={url:e,sort:f.value,keyword:m.value};if(m.value&&(n.page=1),!await k(n))return;for(let n=2;n<=t&&await te(e,n);n++);}finally{e===g.value&&(r.value=!1)}e===g.value&&n(`refreshed`)}function E(e){f.value!==e&&(f.value=e,b(),y())}async function D(){if(!i.value){i.value=!0,d.value++;try{await te(md(bo().options.path),d.value)}finally{i.value=!1}}}function ee(){let e=1/0;for(let t of s.value)!t.top&&(t.created??1/0)<e&&(e=t.created??1/0);return e===1/0?void 0:e}async function te(e,t=d.value){if(m.value)return k({url:e,page:t,sort:f.value,keyword:m.value});let n=ee();return n!==void 0&&k({url:e,before:n,sort:f.value,keyword:m.value})}function O(){let e=bo().options.onCommentLoaded;typeof e==`function`&&e()}async function k(e){let t=g.value;try{let n=await Co(bo().tcb,`COMMENT_GET`,e);if(t!==g.value)return!1;let r=n.result??n;if(r?.message)return a.value=new _o(`CLIENT_ERROR`,r.message,{rawMessage:r.message}),!1;if(r?.data)return s.value=e.before||typeof e.page==`number`&&e.page>1?s.value.concat(r.data):r.data,c.value=r.more===!0,l.value=r.count??s.value.length,setTimeout(O,0),!0}catch(e){t===g.value&&(a.value=e instanceof _o?e:new _o(`UNKNOWN`,e.message,{rawMessage:e.message}))}return!1}function A(e){a.value=e}function ne(e){u.value=e}function re(){n(`admin`)}function ie(){v()}function ae(){T()}return vh(()=>{v(),y(),Ey(Cy,ie),Ey(Cy,ae)}),Sh(()=>{Dy(Cy,ie),Dy(Cy,ae)}),(t,n)=>(Y(),X(`div`,Nb,[Q(Wy,{config:o.value,onLoad:y,onError:A},null,8,[`config`]),Vm((Y(),X(`div`,Pb,[Z(`div`,Fb,[Z(`span`,{class:xf([`tk-comments-count`,{__hidden:r.value||!s.value.length&&!m.value}])},[m.value?(Y(),X(`span`,Ib,K(J(W)(`COMMENTS_SEARCH_COUNT_PREFIX`)),1)):$(`v-if`,!0),Z(`span`,null,K(l.value),1),Z(`span`,null,K(J(W)(`COMMENTS_COUNT_SUFFIX`)),1)],2),Z(`span`,Lb,[!r.value&&s.value.length&&o.value.SHOW_ORDER!==`false`?(Y(),X(`span`,Rb,[Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`newest`}]),type:`button`,onClick:n[0]||=e=>E(`newest`)},K(J(W)(`COMMENTS_SORT_NEWEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`oldest`}]),type:`button`,onClick:n[1]||=e=>E(`oldest`)},K(J(W)(`COMMENTS_SORT_OLDEST`)),3),Z(`button`,{class:xf([`tk-sort-item`,{__active:f.value===`popular`}]),type:`button`,onClick:n[2]||=e=>E(`popular`)},K(J(W)(`COMMENTS_SORT_POPULAR`)),3)])):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:1,class:xf([`tk-icon __comments`,{__active:h.value}]),onClick:C},[Q(Zv,{name:`magnifying-glass`})],2)):$(`v-if`,!0),!r.value&&!i.value?(Y(),X(`span`,{key:2,class:`tk-icon __comments`,onClick:w},[Q(Zv,{name:`sync`})])):$(`v-if`,!0),e.showAdminEntry?(Y(),X(`span`,{key:3,class:`tk-icon __comments`,onClick:re},[Q(Zv,{name:`cog`})])):$(`v-if`,!0)])]),Vm(Z(`div`,zb,[Q(xy,{ref_key:`searchInputRef`,ref:_,modelValue:p.value,"onUpdate:modelValue":n[3]||=e=>p.value=e,size:`small`,clearable:``,maxlength:100,placeholder:J(W)(`COMMENTS_SEARCH_PLACEHOLDER`),onClear:S,onKeyup:Hv(x,[`enter`])},null,8,[`modelValue`,`placeholder`]),Q(Ny,{size:`small`,type:`primary`,onClick:x},{default:Bm(()=>[m_(K(J(W)(`COMMENTS_SEARCH`)),1)]),_:1})],512),[[rv,h.value]]),$(` 评论区唯一错误卡片:列表/提交/回复失败共用,位于空态块上方 `),a.value?(Y(),o_(Mb,{key:0,error:a.value},null,8,[`error`])):$(`v-if`,!0),!s.value.length&&!r.value&&!a.value?(Y(),X(`div`,Bb,[m.value?(Y(),X(`span`,Vb,K(J(W)(`COMMENTS_SEARCH_NO_RESULT`)),1)):$(`v-if`,!0),m.value?$(`v-if`,!0):(Y(),X(`span`,Hb,K(J(W)(`COMMENTS_NO_COMMENTS`)),1))])):$(`v-if`,!0),(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),o_(Sb,{key:e.id,comment:e,replying:u.value===e.id,config:o.value,onReply:ne,onLoad:T,onError:A},null,8,[`comment`,`replying`,`config`]))),128)),c.value&&!r.value&&!a.value?(Y(),X(`div`,Ub,[Vm((Y(),X(`div`,{class:`tk-expand`,onClick:D},[m_(K(J(W)(`COMMENTS_EXPAND`)),1)])),[[J(td),i.value]])])):$(`v-if`,!0)])),[[J(td),r.value]])]))}}),Gb={class:`tk-footer`},Kb=rh({__name:`TkFooter`,setup(e){let t=ho;return(e,n)=>(Y(),X(`div`,Gb,[n[0]||=m_(` Powered by `,-1),n[1]||=Z(`a`,{href:`https://twikoo.js.org`,target:`_blank`,rel:`noopener noreferrer`},`Twikoo`,-1),m_(` v`+K(J(t)),1)]))}}),qb={class:`tk-pagination`},Jb={key:0,class:`tk-pagination-options`},Yb={class:`tk-pagination-pagers`},Xb=[`onClick`],Zb={key:1,class:`tk-pagination-options`},Qb=rh({__name:`TkPagination`,props:{pageSize:{default:10},total:{default:0}},emits:[`current-change`,`page-size-change`],setup(e,{emit:t}){let n=e,r=t,i=q(1),a=q(0),o=q(0),s=q([]),c=U_(()=>Math.ceil(n.total/n.pageSize));function l(){let e=[];for(let t=1;t<=c.value;t++)Math.abs(i.value-t)<3||t===1||t===c.value?e.push({title:`${t}`,page:t}):Math.abs(i.value-t)<4&&e.push({title:`...`,page:t});s.value=e}function u(e){i.value=parseInt(String(e),10)||1,i.value>c.value&&(i.value=c.value),i.value<1&&(i.value=1),a.value=0,r(`current-change`,i.value),l()}function d(e){o.value=0,r(`page-size-change`,parseInt(String(e),10))}function f(e){a.value=parseInt(String(e),10)}function p(e){o.value=parseInt(String(e),10)}function m(){l()}return qm(()=>n.total,m,{immediate:!0}),qm(()=>n.pageSize,m),(t,n)=>(Y(),X(`div`,qb,[c.value?(Y(),X(`div`,Jb,[Z(`div`,null,[Z(`span`,null,K(J(W)(`PAGINATION_COUNT_PREFIX`)),1),Z(`span`,null,K(e.total),1),Z(`span`,null,K(J(W)(`PAGINATION_COUNT_SUFFIX`)),1)]),Q(xy,{class:`tk-pagination-size`,type:`number`,min:1,max:100,"model-value":o.value?o.value:e.pageSize,onInput:p,onChange:d},null,8,[`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_PAGESIZE`)),1)])):$(`v-if`,!0),Z(`div`,Yb,[(Y(!0),X(Xg,null,Mh(s.value,e=>(Y(),X(`div`,{key:e.page,class:xf([`tk-pagination-pager`,{__current:e.page===i.value}]),onClick:t=>u(e.page)},K(e.title),11,Xb))),128))]),c.value?(Y(),X(`div`,Zb,[Z(`span`,null,K(J(W)(`PAGINATION_GOTO_PREFIX`)),1),Q(xy,{class:`tk-pagination-goto`,type:`number`,min:1,max:c.value,"model-value":a.value?a.value:i.value,onInput:f,onChange:u},null,8,[`max`,`model-value`]),Z(`span`,null,K(J(W)(`PAGINATION_GOTO_SUFFIX`)),1)])):$(`v-if`,!0)]))}}),$b={class:`tk-admin-comment`},ex={key:0,class:`tk-admin-warn`},tx={class:`tk-admin-comment-filter`},nx={value:``},rx={value:`VISIBLE`},ix={value:`HIDDEN`},ax={class:`tk-admin-comment-meta`},ox={key:0},sx=[`href`],cx={key:2},lx=[`href`],ux={key:3},dx={class:`tk-time`},fx=[`title`],px=[`innerHTML`],mx={key:0,class:`tk-admin-warn tk-admin-security-alert`},hx={class:`tk-admin-security-alert-message`},gx={key:0,class:`tk-admin-security-alert-url`},_x={class:`tk-admin-actions`},vx=5,yx=rh({__name:`TkAdminComment`,setup(e){let t=qy().VERSION,n=q(!0),r=q([]),i=Kp({}),a=q(typeof t==`string`?t:``),o=ho,s=q(0),c=q(vx),l=q(1),u=Kp({keyword:``,type:``}),d=q(null),f=q();function p(e){return ud(e.created)}async function m(){n.value=!0;let e=await Co(bo().tcb,`COMMENT_GET_FOR_ADMIN`,{per:c.value,page:l.value,keyword:u.keyword,type:u.type}),t=e.result??e;t&&!t.code&&(s.value=t.count??0,r.value=(t.data??[]).map(e=>({...e,comment:uc(e.comment)}))),setTimeout(()=>{w(f.value)},0),n.value=!1}async function h(){let e=await Co(bo().tcb,`GET_CONFIG_FOR_ADMIN`),t=e.result??e;t&&!t.code&&t.config&&(Object.assign(i,t.config),a.value=typeof t.config.VERSION==`string`?t.config.VERSION:``,g())}function g(){i.HIGHLIGHT||=`true`;let e={},t=localStorage.getItem(`twikoo`);if(t)try{e=JSON.parse(t)}catch{e={}}for(let t of[`nick`,`mail`,`avatar`])i[t]=e[t]??``;!e.nick&&i.BLOGGER_NICK&&(e.nick=String(i.BLOGGER_NICK)),!e.mail&&i.BLOGGER_EMAIL&&(e.mail=String(i.BLOGGER_EMAIL)),!e.link&&i.SITE_URL&&(e.link=String(i.SITE_URL)),localStorage.setItem(`twikoo`,JSON.stringify(e))}function _(e){c.value=e,m()}function v(e){l.value=e,m()}function y(e){let t=`${e.url??``}#${e.id}`;try{if(new URL(t).hostname!==window.location.hostname){d.value={commentId:e.id,message:W(`ADMIN_COMMENT_SECURITY_ALERT`),url:t};return}window.open(t)}catch{try{new URL(t,window.location.origin),window.open(t)}catch{d.value={commentId:e.id,message:W(`ADMIN_COMMENT_PARSE_ERROR`),url:e.url}}}}async function b(e){confirm(W(`ADMIN_COMMENT_DELETE_CONFIRM`))&&(n.value=!0,await Co(bo().tcb,`COMMENT_DELETE_FOR_ADMIN`,{id:e.id}),await m(),n.value=!1)}function x(e,t){C(e,{isSpam:t})}function S(e,t){C(e,{top:t})}async function C(e,t){n.value=!0,await Co(bo().tcb,`COMMENT_SET_FOR_ADMIN`,{id:e.id,set:t}),await m(),n.value=!1}function w(e){e&&(Td(e),Ed(e,bo().options.katex),i.HIGHLIGHT===`true`&&Tc(e,i.HIGHLIGHT_THEME,i.HIGHLIGHT_PLUGIN))}return vh(async()=>{await Promise.all([h(),m()]),w(f.value)}),(e,t)=>Vm((Y(),X(`div`,$b,[J(o)===a.value?$(`v-if`,!0):(Y(),X(`div`,ex,[Z(`span`,null,K(J(W)(`ADMIN_CLIENT_VERSION`))+K(J(o))+`,`,1),Z(`span`,null,K(J(W)(`ADMIN_SERVER_VERSION`))+K(a.value)+`,`,1),$(`
242
242
  用 prettier-ignore 保持单行:这一段的换行/缩进空白会被 Vue 3 的 condense 折叠成
243
243
  一个空格(Vue 2 保留、HTML 同样折叠),与两侧的 &nbsp; 叠加后会让「版本更新」
244
244
  链接左右各宽约一个空格,而 1.x 只有 &nbsp;。所以必须让 &nbsp; 与 <a> 紧贴。