@cloudbase/js-sdk 2.5.43-beta.0 → 2.5.44-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/miniprogram_dist/app.js +1 -1
- package/miniprogram_dist/index.js +1 -1
- package/package.json +10 -10
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase",[],e):"object"==typeof exports?exports.cloudbase=e():t.cloudbase=e()}("undefined"!=typeof window?window:this,(function(){return function(){var t={829:function(t,e,n){"use strict";var r;n.d(e,{jJ:function(){return i},x_:function(){return o},Z1:function(){return r},CN:function(){return s}}),function(t){t.local="local",t.none="none",t.session="session"}(r||(r={}));var i=function(){},o=function(){};function s(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),i="";for(var o in n)""===i?!r&&(e+="?"):i+="&",i+=o+"="+encodeURIComponent(n[o]);return/^http(s)?\:\/\//.test(e+=i)?e:""+t+e}},195:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=r(n(805)),o=n(344),s=n(338),a=n(766),u=n(337),c=n(98),h=n(529),f=r(n(536)).default.version;i.default.registerVersion(f);try{(0,o.registerAuth)(i.default),(0,s.registerFunctions)(i.default),(0,a.registerStorage)(i.default),(0,h.registerDatabase)(i.default),(0,u.registerRealtime)(i.default),(0,c.registerAnalytics)(i.default)}catch(t){}try{window.cloudbase=i.default}catch(t){}e.default=i.default,t.exports=i.default},98:function(t,e,n){"use strict";n.r(e),n.d(e,{registerAnalytics:function(){return l}});var r=n(142),i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},o=r._G.Sg,s=r._G.vM,a=r.BM.D,u="analytics",c=["mall"],h=new(function(){function t(){}return t.prototype.analytics=function(t){return e=this,n=void 0,i=function(){var e,n,r;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(i){if(!function(t){if("Object"!==Object.prototype.toString.call(t).slice(8,-1))return!1;var e=t.report_data,n=t.report_type;return!1!==c.includes(n)&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!(void 0!==e.action_time&&!Number.isInteger(e.action_time))&&"string"==typeof e.action_type}(t))throw new Error(JSON.stringify({code:o.INVALID_PARAMS,msg:"[".concat(u,".analytics] invalid report data")}));return e=void 0===t.report_data.action_time?Math.floor(Date.now()/1e3):t.report_data.action_time,n={analytics_scene:t.report_type,analytics_data:Object.assign({},t.report_data,{action_time:e})},r={requestData:n},this.request.send("analytics.report",r),[2]}))},new((r=void 0)||(r=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((i=i.apply(e,n||[])).next())}));var e,n,r,i},function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);o>3&&s&&Object.defineProperty(e,n,s)}([a({customInfo:{className:"Cloudbase",methodName:"analytics"},title:"上报调用失败",messages:["请确认以下各项:"," 1 - 调用 analytics() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(s)]}),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],t.prototype,"analytics",null),t}()),f={name:u,entity:{analytics:h.analytics}};try{cloudbase.registerComponent(f)}catch(t){}function l(t){try{t.registerComponent(f)}catch(t){console.warn(t)}}},805:function(t,e,n){"use strict";n.r(e),n.d(e,{cloudbase:function(){return st},default:function(){return at},getBaseEndPoint:function(){return L}});var r,i=n(142),o=n(829),s=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},a.apply(this,arguments)},u=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this,r=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=i||"请求超时",n._restrictedMethods=o||["get","post","upload","download"],n}return s(e,t),e.prototype.post=function(t){var e=this;return new Promise((function(n,r){var i=t.url,s=t.data,a=t.headers,u=wx.request({url:(0,o.CN)("https:",i),data:s,timeout:e._timeout,method:"POST",header:a,success:function(t){n(t)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("post")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e.prototype.upload=function(t){var e=this,n=this;return new Promise((function(r){return i=e,o=void 0,u=function(){var e,i,o,s,u,c;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(h){return e=t.url,i=t.file,o=t.data,s=t.headers,u=t.onUploadProgress,c=wx.uploadFile({url:e,filePath:i,name:"file",formData:a({},o),header:s,timeout:this._timeout,success:function(t){var e={statusCode:t.statusCode,data:t.data||{}};200===t.statusCode&&o.success_action_status&&(e.statusCode=parseInt(o.success_action_status,10)),r(e)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("upload")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{c.abort()}catch(t){}}}}),u&&c.onProgressUpdate((function(t){u(t)})),[2]}))},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{a(u.next(t))}catch(t){e(t)}}function r(t){try{a(u.throw(t))}catch(t){e(t)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(n,r)}a((u=u.apply(i,o||[])).next())}));var i,o,s,u}))},e.prototype.download=function(t){var e=this,n=this;return new Promise((function(r,i){var s=t.url,a=t.headers,u=wx.downloadFile({url:(0,o.CN)("https:",s),header:a,timeout:e._timeout,success:function(t){200===t.statusCode&&t.tempFilePath?r({statusCode:200,tempFilePath:t.tempFilePath}):r(t)},fail:function(t){i(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("download")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e}(o.jJ),c={setItem:function(t,e){wx.setStorageSync(t,e)},getItem:function(t){return wx.getStorageSync(t)},removeItem:function(t){wx.removeStorageSync(t)},clear:function(){wx.clearStorageSync()}},h=function(t,e){void 0===e&&(e={});var n=wx.connectSocket(a({url:t},e));return{set onopen(t){n.onOpen(t)},set onmessage(t){n.onMessage(t)},set onclose(t){n.onClose(t)},set onerror(t){n.onError(t)},send:function(t){return n.send({data:t})},close:function(t,e){return n.close({code:t,reason:e})},get readyState(){return n.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}},f={genAdapter:function(){return{root:{},reqClass:u,wsClass:h,localStorage:c,primaryStorage:o.Z1.local,getAppSign:function(){var t=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?t&&t.miniProgram?t.miniProgram.appId:"":t&&t.plugin?t.plugin.appId:""}}},isMatch:function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0},runtime:"wx_mp"},l=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},p=i._G.Sg,d={};function y(t,e){var n=e.name,r=e.namespace,i=e.entity,o=e.injectEvents,s=e.IIFE,a=void 0!==s&&s;if(d[n]||r&&t[r])throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(a){if(!i||"function"!=typeof i)throw new Error(JSON.stringify({code:p.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));i.call(t)}if(d[n]=e,r?t.prototype[r]=i:g(t.prototype,i),o){var u=o.bus,c=o.events;if(!u||!c||0===c.length)return;var h=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[n]?t.prototype.events[n].events=l(l([],t.prototype.events[n].events,!0),c,!0):t.prototype.events[n]={bus:u,events:c},t.prototype.fire=function(t,e){h(t,e);for(var n=0,r=Object.keys(this.events);n<r.length;n++){var i=r[n],o=this.events[i],s=o.bus;if(o.events.includes(t)){s.fire(t,e);break}}}}}function g(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=g(t[i],e[i]))}return t}var v={},m=function(){return m=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},m.apply(this,arguments)},b="user_info",w=i.Fs.q,E={},_={};function S(t){var e=t.env,n=t.platformInfo,r={userInfoKey:"".concat(b,"_").concat(e)};E[e]=E[e]||new w(m(m({},t),{keys:r,platformInfo:n})),_[e]=_[e]||new w(m(m({},t),{keys:r,platformInfo:n,persistence:"local"}))}function I(t){return _[t]}var T,O=i._G.tC,A=i._G.pM,R="",N="@cloudbase/js-sdk",x="https:",C="//tcb-api.tencentcloudapi.com/web";function P(t,e){C=t,e&&(x=e,A(e))}function D(){return{BASE_URL:C,PROTOCOL:x}}function L(){var t=D(),e=t.PROTOCOL,n=t.BASE_URL;return"".concat(e).concat(n).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(t){t.NULL="NULL",t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.WECHAT_PUBLIC="WECHAT-PUBLIC",t.WECHAT_OPEN="WECHAT-OPEN",t.CUSTOM="CUSTOM",t.EMAIL="EMAIL",t.USERNAME="USERNAME",t.PHONE="PHONE"}(T||(T={}));var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},U.apply(this,arguments)},j=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},B=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},k=i._G.Sg,M=i.P6.Jc,q=i.P6.hp,V=i.P6.CN,F=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function H(t,e,n){var r=t[e];t[e]=function(e){var i={},o={};n.forEach((function(n){var r=n.call(t,e),s=r.data,a=r.headers;Object.assign(i,s),Object.assign(o,a)}));var s=e.data;return s&&(q(s)?Object.keys(i).forEach((function(t){s.append(t,i[t])})):e.data=U(U({},s),i)),e.headers=U(U({},e.headers||{}),o),r.call(t,e)}}function W(){var t=M();return{data:{seqId:t},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(R),"x-seqid":t}}}var $=function(){function t(t){this.throwWhenRequestFail=!1,this.config=t;var e={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new v.adapter.reqClass(e),this.throwWhenRequestFail=t.throw||!1,this.localCache=I(this.config.env),H(this.reqClass,"post",[W]),H(this.reqClass,"upload",[W]),H(this.reqClass,"download",[W])}return t.prototype.post=function(t){return j(this,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.post(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.upload=function(t){return j(this,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.upload(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.download=function(t){return j(this,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.download(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getBaseEndPoint=function(){return L()},t.prototype.getOauthAccessTokenV2=function(t){return j(this,void 0,void 0,(function(){var e,n;return B(this,(function(r){switch(r.label){case 0:return[4,t.getAccessToken()];case 1:return e=r.sent(),[4,t.getCredentials()];case 2:return n=r.sent(),[2,{accessToken:e,accessTokenExpire:new Date(n.expires_at).getTime()}]}}))}))},t.prototype.request=function(t,e,n){var r;return j(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,f,l,p,d,y,g,v,m,b,w,E,_,S;return B(this,(function(I){switch(I.label){case 0:if(i="x-tcb-trace_".concat(this.config.env),o="application/x-www-form-urlencoded",s=U({action:t,dataVersion:"2020-01-10",env:this.config.env},e),-1!==F.indexOf(t))return[3,2];if(!(a=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return u=a.oauthInstance,c=u.oauth2client,h=s,[4,this.getOauthAccessTokenV2(c)];case 1:h.access_token=I.sent().accessToken,I.label=2;case 2:return"storage.uploadFile"===t?(f=new FormData,Object.keys(f).forEach((function(t){Object.prototype.hasOwnProperty.call(f,t)&&void 0!==f[t]&&f.append(t,s[t])})),o="multipart/form-data"):(o="application/json;charset=UTF-8",f={},Object.keys(s).forEach((function(t){void 0!==s[t]&&(f[t]=s[t])}))),l={headers:{"content-type":o}},(null==n?void 0:n.onUploadProgress)&&(l.onUploadProgress=n.onUploadProgress),this.config.region&&(l.headers["X-TCB-Region"]=this.config.region),(p=this.localCache.getStore(i))&&(l.headers["X-TCB-Trace"]=p),d=e.parse,y=e.inQuery,g=e.search,v={env:this.config.env},d&&(v.parse=!0),y&&(v=U(U({},y),v)),m=D(),b=m.BASE_URL,w=m.PROTOCOL,E=V(w,b,v),g&&(E+=g),[4,this.post(U({url:E,data:f},l))];case 3:if(_=I.sent(),(S=null===(r=_.header)||void 0===r?void 0:r["x-tcb-trace"])&&this.localCache.setStore(i,S),200!==Number(_.status)&&200!==Number(_.statusCode)||!_.data)throw new Error("network request error");return[2,_]}}))}))},t.prototype.send=function(t,e){return void 0===e&&(e={}),j(this,void 0,void 0,(function(){var n;return B(this,(function(r){switch(r.label){case 0:return[4,this.request(t,e,{onUploadProgress:e.onUploadProgress})];case 1:if((n=r.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:k.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},t}(),G={},K=function(){return K=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},K.apply(this,arguments)},J=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},Y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},z=i.j$.Fk,Z=i.j$.xY,Q=i._G.Sg,X=i._G.vM,tt=i.P6.xe,et=i.BM.D,nt={timeout:15e3,persistence:"local"},rt=6e5,it={},ot=function(){function t(t){this.cloudbaseConfig=t||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null}return Object.defineProperty(t.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return v},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return t=this.cloudbaseConfig.env,E[t];var t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return I(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return t=this.cloudbaseConfig.env,G[t];var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){if(!e.env)throw new Error(JSON.stringify({code:Q.INVALID_PARAMS,msg:"env must not be specified"}));v.adapter||this.useDefaultAdapter();var n={timeout:e.timeout||5e3,timeoutMsg:"[".concat(N,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(e.timeout/1e3,"s")};this.requestClient=new v.adapter.reqClass(n),this.cloudbaseConfig=K(K({},nt),e),this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var r=this.cloudbaseConfig,i=r.env,o=r.persistence,s=r.debug,a=r.timeout,u=r.oauthClient;S({env:i,persistence:o,debug:s,platformInfo:this.platform}),function(t,e,n){P(e?"//".concat(t,".").concat(e,".tcb-api.tencentcloudapi.com/web"):"//".concat(t,".ap-shanghai.tcb-api.tencentcloudapi.com/web"),void 0)}(i,e.region||"");var c=new t(this.cloudbaseConfig);return function(t){G[t.env]=new $(U(U({},t),{throw:!0}))}({env:i,region:e.region||"",timeout:a,oauthClient:u,_fromApp:c}),c.requestClient=this.requestClient,c},t.prototype.updateConfig=function(t){var e=t.persistence,n=t.debug;this.cloudbaseConfig.persistence=e,this.cloudbaseConfig.debug=n,S({env:this.cloudbaseConfig.env,persistence:e,debug:n,platformInfo:this.platform})},t.prototype.registerExtension=function(t){it[t.name]=t},t.prototype.invokeExtension=function(t,e){return n=this,r=void 0,o=function(){var n;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(r){switch(r.label){case 0:if(!(n=it[t]))throw new Error(JSON.stringify({code:Q.INVALID_PARAMS,msg:"extension:".concat(t," must be registered before invoke")}));return[4,n.invoke(e,this)];case 1:return[2,r.sent()]}}))},new((i=void 0)||(i=Promise))((function(t,e){function s(t){try{u(o.next(t))}catch(t){e(t)}}function a(t){try{u(o.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(s,a)}u((o=o.apply(n,r||[])).next())}));var n,r,i,o},t.prototype.useAdapters=function(t){var e=z(t)||{},n=e.adapter,r=e.runtime;n&&(v.adapter=n),r&&(v.runtime=r)},t.prototype.registerHook=function(e){!function(t,e){var n=e.entity,r=e.target;if(Object.prototype.hasOwnProperty.call(t,r))throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not exist")}));var i=t.prototype[r];if("function"!=typeof i)throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not a function which is the only type supports hook")}));t.prototype[r]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,l([this],t,!1)),i.call.apply(i,l([this],t,!1))}}(t,e)},t.prototype.registerComponent=function(e){y(t,e)},t.prototype.registerVersion=function(t){!function(t){R=t}(t)},t.prototype.registerSdkName=function(t){!function(t){N=t,O(t)}(t)},t.prototype.registerEndPoint=function(t,e){P(t,e)},t.prototype.useDefaultAdapter=function(){var t=Z(),e=t.adapter,n=t.runtime;v.adapter=e,v.runtime=n},t.prototype.formatTimeout=function(t){switch(!0){case t>rt:return tt(Q.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),rt;case t<100:return tt(Q.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return t}},J([et({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(X)]}),Y("design:type",Function),Y("design:paramtypes",[Object]),Y("design:returntype",t)],t.prototype,"init",null),J([et({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(X)]}),Y("design:type",Function),Y("design:paramtypes",[String,Object]),Y("design:returntype",Promise)],t.prototype,"invokeExtension",null),t}(),st=new ot;st.useAdapters(f);var at=st},344:function(t,e,n){"use strict";n.r(e),n.d(e,{Auth:function(){return ce},LoginState:function(){return ue},registerAuth:function(){return fe}});var r,i,o,s,a,u,c,h=n(142);function f(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}!function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(r||(r={})),(c=i||(i={})).UNREACHABLE="unreachable",c.LOCAL="local",c.CANCELLED="cancelled",c.UNKNOWN="unknown",c.INVALID_ARGUMENT="invalid_argument",c.DEADLINE_EXCEEDED="deadline_exceeded",c.NOT_FOUND="not_found",c.ALREADY_EXISTS="already_exists",c.PERMISSION_DENIED="permission_denied",c.UNAUTHENTICATED="unauthenticated",c.RESOURCE_EXHAUSTED="resource_exhausted",c.FAILED_PRECONDITION="failed_precondition",c.ABORTED="aborted",c.OUT_OF_RANGE="out_of_range",c.UNIMPLEMENTED="unimplemented",c.INTERNAL="internal",c.UNAVAILABLE="unavailable",c.DATA_LOSS="data_loss",c.CAPTCHA_REQUIRED="captcha_required",c.CAPTCHA_INVALID="captcha_invalid",c.INVALID_PASSWORD="invalid_password",c.INVALID_STATUS="invalid_status",c.USER_PENDING="user_pending",c.USER_BLOCKED="user_blocked",c.INVALID_VERIFICATION_CODE="invalid_verification_code",c.TWO_FACTOR_REQUIRED="two_factor_required",c.INVALID_TWO_FACTOR="invalid_two_factor",c.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",c.UNDER_REVIEW="under_review",c.INVALID_REQUEST="invalid_request",c.UNAUTHORIZED_CLIENT="unauthorized_client",c.ACCESS_DENIED="access_denied",c.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",c.INVALID_SCOPE="invalid_scope",c.INVALID_GRANT="invalid_grant",c.SERVER_ERROR="server_error",c.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",c.INTERACTION_REQUIRED="interaction_required",c.LOGIN_REQUIRED="login_required",c.ACCOUNT_SELECTION_REQUIRED="account_selection_required",c.CONSENT_REQUIRED="consent_required",c.INVALID_REQUEST_URI="invalid_request_uri",c.INVALID_REQUEST_OBJECT="invalid_request_object",c.REQUEST_NOT_SUPPORTED="request_not_supported",c.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",c.REGISTRATION_NOT_SUPPORTED="registration_not_supported",function(t){t.AUTH_SIGN_IN_URL="/auth/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",t.AUTH_SIGN_UP_URL="/auth/v1/signup",t.AUTH_TOKEN_URL="/auth/v1/token",t.AUTH_REVOKE_URL="/auth/v1/revoke",t.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",t.PROVIDER_TOKEN_URL="/auth/v1/provider/token",t.PROVIDER_URI_URL="/auth/v1/provider/uri",t.USER_ME_URL="/auth/v1/user/me",t.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",t.USER_QUERY_URL="/auth/v1/user/query",t.USER_PRIFILE_URL="/auth/v1/user/profile",t.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",t.VERIFICATION_URL="/auth/v1/verification",t.VERIFY_URL="/auth/v1/verification/verify",t.CAPTCHA_DATA_URL="/auth/v1/captcha/data",t.VARIFY_CAPTCHA_DATA_URL="/auth/v1/captcha/data/verify",t.GET_CAPTCHA_URL="/auth/v1/captcha/init",t.PROVIDER_LIST="/auth/v1/user/provider",t.PROVIDER_UNBIND_URL="/auth/v1/user/provider",t.CHECK_PWD_URL="/auth/v1/user/sudo",t.SUDO_URL="/auth/v1/user/sudo",t.BIND_CONTACT_URL="/auth/v1/user/contact",t.AUTH_SET_PASSWORD="/auth/v1/user/password",t.AUTH_RESET_PASSWORD="/auth/v1/reset",t.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",t.CHECK_USERNAME="/auth/v1/checkUsername",t.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist",t.GET_PROVIDER_TYPE="/auth/v1/mgr/provider/providerSubType"}(o||(o={})),function(t){t.AUTH_SIGN_IN_URL="/auth/v2/signin/username",t.AUTH_TOKEN_URL="/auth/v2/token",t.USER_ME_URL="/auth/v2/user/me",t.VERIFY_URL="/auth/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider",t.AUTH_PUBLIC_KEY="/auth/v2/signin/publichkey"}(s||(s={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(a||(a={})),function(t){t.INVALID_ARGUMENT="invalid_argument",t.DEADLINE_EXCEEDED="deadline_exceeded",t.NOT_FOUND="not_found",t.ALREADY_EXISTS="already_exists",t.PERMISSION_DENIED="permission_denied",t.ABORTED="aborted",t.OUT_OF_RANGE="out_of_range",t.UNIMPLEMENTED="unimplemented",t.INTERNAL="internal",t.UNAVAILABLE="unavailable",t.DATA_LOSS="data_loss",t.CAPTCHA_REQUIRED="captcha_required",t.CAPTCHA_INVALID="captcha_invalid",t.INVALID_PASSWORD="invalid_password",t.PASSWORD_NOT_SET="password_not_set",t.INVALID_STATUS="invalid_status",t.USER_PENDING="user_pending",t.USER_BLOCKED="user_blocked"}(u||(u={}));var l=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},p=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},d=function(){function t(){this.fnPromiseMap=new Map}return t.prototype.run=function(t,e){return l(this,void 0,void 0,(function(){var n,r=this;return p(this,(function(i){switch(i.label){case 0:return[4,n=this.fnPromiseMap.get(t)];case 1:return i.sent()||(n=new Promise((function(n,i){l(r,void 0,void 0,(function(){var r,o,s;return p(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return a.sent(),r=e(),o=n,[4,r];case 2:return o.apply(void 0,[a.sent()]),[3,5];case 3:return s=a.sent(),i(s),[3,5];case 4:return this.fnPromiseMap.delete(t),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(t,n)),[2,n]}}))}))},t.prototype.runIdlePromise=function(){return Promise.resolve()},t}(),y=function(){return y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},y.apply(this,arguments)},g=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},v=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},m="x-request-id",b="x-device-id",w="device_id",E=function(t,e){return g(this,void 0,void 0,(function(){var n,r,o,s,a;return v(this,(function(u){switch(u.label){case 0:n=null,r=null,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=Object.assign({},e)).method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body)),[4,fetch(t,o)];case 2:return[4,u.sent().json()];case 3:return(null==(s=u.sent())?void 0:s.error)?(r=s).error_uri=new URL(t).pathname:n=s,[3,5];case 4:return a=u.sent(),r={error:i.UNREACHABLE,error_description:a.message,error_uri:new URL(t).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},_=new(function(){function t(){}return t.prototype.getItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,window.localStorage.getItem(t)]}))}))},t.prototype.removeItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return window.localStorage.removeItem(t),[2]}))}))},t.prototype.setItem=function(t,e){return g(this,void 0,void 0,(function(){return v(this,(function(n){return window.localStorage.setItem(t,e),[2]}))}))},t.prototype.getItemSync=function(t){return window.localStorage.getItem(t)},t.prototype.removeItemSync=function(t){window.localStorage.removeItem(t)},t.prototype.setItemSync=function(t,e){window.localStorage.setItem(t,e)},t}());function S(t){var e=!0;return(null==t?void 0:t.expires_at)&&(null==t?void 0:t.access_token)&&(e=t.expires_at<new Date),e}var I,T,O=function(){function t(t){this.credentials=null,this.singlePromise=new d,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage}return t.prototype.getStorageCredentialsSync=function(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t},t.prototype.setCredentials=function(t){return g(this,void 0,void 0,(function(){var e;return v(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.expires_in)?(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30)),this.storage?(e=JSON.stringify(t),[4,this.storage.setItem(this.tokenSectionName,e)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=t,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:n.sent(),n.label=5;case 5:this.credentials=null,n.label=6;case 6:return[2]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("getCredentials",(function(){return g(t,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return S(this.credentials)?(t=this,[4,this.getStorageCredentials()]):[3,2];case 1:t.credentials=e.sent(),e.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},t.prototype.getStorageCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return g(t,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return t=null,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(null==(e=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),t=null,[3,5];case 5:return[2,t]}}))}))}))]}))}))},t}(),A=function(){function t(e){this.singlePromise=new d,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,t.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=E,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||_,this.localCredentials=new O({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage}),this.clientSecret=e.clientSecret,this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}return t.prototype.setCredentials=function(t){return this.localCredentials.setCredentials(t)},t.prototype.getAccessToken=function(){return g(this,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(t=n.sent())?void 0:t.access_token)?[2,Promise.resolve(t.access_token)]:(e={error:i.UNAUTHENTICATED},[2,Promise.reject(e)])}}))}))},t.prototype.request=function(e,n){return g(this,void 0,void 0,(function(){var r,o,s,a,u,c,h;return v(this,(function(l){switch(l.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=y(y({},this.headers),n.headers)),n.headers[m]||(n.headers[m]=f()),n.headers[b]?[3,2]:[4,this.getDeviceId()];case 1:o=l.sent(),n.headers[b]=o,l.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(s=l.sent())&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(s.access_token)):n.headers.Authorization="".concat(s.token_type," ").concat(s.access_token)),[3,5];case 4:this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId)),l.label=5;case 5:e.startsWith("/")&&(e=this.apiOrigin+e),a=null,u=r+1,c=0,l.label=6;case 6:if(!(c<u))return[3,15];l.label=7;case 7:return l.trys.push([7,9,,12]),[4,this.baseRequest(e,n)];case 8:return a=l.sent(),[3,15];case 9:return h=l.sent(),n.withCredentials&&h&&h.error===i.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return l.sent(),[2,Promise.reject(h)];case 11:return c!==r&&h&&"unreachable"===h.error?[3,12]:[2,Promise.reject(h)];case 12:return[4,this.sleep(t.retryInterval)];case 13:l.sent(),l.label=14;case 14:return c++,[3,6];case 15:return[2,a]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t,e,n;return v(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return S(t=r.sent())?t&&"anonymous"===t.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(t)]:[3,5]:[3,8]:[3,10];case 2:return e=r.sent(),(n=e)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return t=n,[3,7];case 5:return[4,this.anonymousSignIn(t)];case 6:t=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(t)];case 9:t=r.sent(),r.label=10;case 10:return[2,t]}}))}))},t.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},t.prototype.getCredentialsAsync=function(){return this.getCredentials()},t.prototype.getScope=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.getGroups=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.refreshToken=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||!t.refresh_token)return[2,this.unAuthenticatedError("no refresh token found in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.refreshTokenFunc(t.refresh_token,t)];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.checkRetry=function(e){var n=null;if(("number"!=typeof e||e<t.minRetry||e>t.maxRetry)&&(n={error:i.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return e},t.prototype.formatRetry=function(t,e){return void 0===t?e:this.checkRetry(t)},t.prototype.sleep=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.prototype.anonymousSignIn=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||"anonymous"!==t.scope)return[2,this.unAuthenticatedError("no anonymous in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret}})];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.defaultRefreshTokenFunc=function(t,e){return g(this,void 0,void 0,(function(){var n,r;return v(this,(function(i){switch(i.label){case 0:return void 0===t||""===t?[2,this.unAuthenticatedError("refresh token not found")]:(n=o.AUTH_TOKEN_URL,"v2"===(null==e?void 0:e.version)&&(n=s.AUTH_TOKEN_URL),[4,this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:t}})]);case 1:return r=i.sent(),[2,y(y({},r),{version:(null==e?void 0:e.version)||"v1"})]}}))}))},t.prototype.getDeviceId=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(w)];case 1:return"string"==typeof(t=e.sent())&&t.length>=16&&t.length<=48?[3,3]:(t=f(),[4,this.storage.setItem(w,t)]);case 2:e.sent(),e.label=3;case 3:return this.deviceID=t,[2,t]}}))}))},t.prototype.unAuthenticatedError=function(t){var e={error:i.UNAUTHENTICATED,error_description:t};return Promise.reject(e)},t.defaultRetry=2,t.minRetry=0,t.maxRetry=5,t.retryInterval=1e3,t}();function R(){var t=globalThis.wx;if(void 0===t)return!1;if(void 0===globalThis.Page)return!1;if(!t.getSystemInfoSync)return!1;if(!t.getStorageSync)return!1;if(!t.setStorageSync)return!1;if(!t.connectSocket)return!1;if(!t.request)return!1;try{if(!t.getSystemInfoSync())return!1;if("qq"===t.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0}var N=!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment;function x(){N=N||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}function C(){return N}R()||((null===(I=null===window||void 0===window?void 0:window.WeixinJSBridge)||void 0===I?void 0:I.invoke)?x():"undefined"!=typeof document&&(null===(T=document.addEventListener)||void 0===T||T.call(document,"WeixinJSBridgeReady",x,!1)));var P,D=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},L=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},U=function(){function t(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=_),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}return t.prototype.request=function(t,e){return D(this,void 0,void 0,(function(){var n,r,i,o;return L(this,(function(s){switch(s.label){case 0:return e||(e={}),e.method||(e.method="GET"),n="".concat(e.method,":").concat(t),r=t,e.withCaptcha?[4,this.appendCaptchaTokenToURL(t,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,e)];case 3:return i=s.sent(),[3,7];case 4:return(o=s.sent()).error!==u.CAPTCHA_REQUIRED&&o.error!==u.CAPTCHA_INVALID?[3,6]:[4,this.appendCaptchaTokenToURL(t,n,o.error===u.CAPTCHA_INVALID)];case 5:return t=s.sent(),[2,this.config.request(t,e)];case 6:return[2,Promise.reject(o)];case 7:return[2,i]}}))}))},t.prototype.getDefaultOpenURIWithCallback=function(){if(!R()&&!C()&&(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap"))){var t=document.createElement("div");t.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback},t.prototype.defaultOpenURIWithCallback=function(t,e){return D(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return L(this,(function(h){return r=(n=e||{}).width,i=void 0===r?"355px":r,o=n.height,s=void 0===o?"355px":o,t.match(/^(data:.*)$/)?[2,Promise.reject({error:u.UNIMPLEMENTED,error_description:"need to impl captcha data"})]:(a=document.getElementById("captcha_panel_wrap"),c=document.createElement("iframe"),a.innerHTML="",c.setAttribute("src",t),c.setAttribute("id","review-panel-iframe"),c.style.cssText="min-width:".concat(i,";display:block;height:").concat(s,";margin:0 auto;background-color: rgb(255, 255, 255);border: none;"),a.appendChild(c),a.style.display="block",[2,new Promise((function(t,e){c.onload=function(){try{var n=window.location,r=c.contentWindow.location;if(r.host+r.pathname===n.host+n.pathname){a.style.display="none";var i=new URLSearchParams(r.search),o=i.get("captcha_token");return o?t({captcha_token:o,expires_in:Number(i.get("expires_in"))}):e({error:i.get("error"),error_description:i.get("error_description")})}a.style.display="block"}catch(t){a.style.display="block"}}}))])}))}))},t.prototype.getCaptchaToken=function(t,e){return D(this,void 0,void 0,(function(){var n,r,i,s,a,u;return L(this,(function(c){switch(c.label){case 0:return t?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=c.sent())return[2,n];c.label=2;case 2:return R()||C()?[3,4]:(i="".concat(window.location.origin+window.location.pathname,"?__captcha=on"),[4,this.config.request(o.GET_CAPTCHA_URL,{method:"POST",body:{client_id:this.config.clientId,redirect_uri:i,state:e},withCredentials:!1})]);case 3:return(r=c.sent()).captcha_token?(s={captcha_token:r.captcha_token,expires_in:r.expires_in},this.saveCaptchaToken(s),[2,r.captcha_token]):[3,6];case 4:return[4,this.config.request(o.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:""},withCredentials:!1})];case 5:a=c.sent(),r={url:"".concat(a.data,"?state=").concat(encodeURIComponent(e),"&token=").concat(encodeURIComponent(a.token))},c.label=6;case 6:return[4,this.config.openURIWithCallback(r.url)];case 7:return u=c.sent(),this.saveCaptchaToken(u),[2,u.captcha_token]}}))}))},t.prototype.appendCaptchaTokenToURL=function(t,e,n){return D(this,void 0,void 0,(function(){var r;return L(this,(function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,e)];case 1:return r=i.sent(),t.indexOf("?")>0?t+="&captcha_token=".concat(r):t+="?captcha_token=".concat(r),[2,t]}}))}))},t.prototype.saveCaptchaToken=function(t){return D(this,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10)),e=JSON.stringify(t),[4,this.config.storage.setItem(this.tokenSectionName,e)];case 1:return n.sent(),[2]}}))}))},t.prototype.findCaptchaToken=function(){return D(this,void 0,void 0,(function(){var t,e;return L(this,(function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if(null==(t=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),e.expires_at<new Date?[2,null]:[2,e.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}}))}))},t}(),j=function(t){var e=function(e){for(var n in t)t.hasOwnProperty(n)&&(e[n]=j(t[n]));return e},n=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(n))return t.slice();switch(n){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},B=(P=function(t,e){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},P(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}P(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),k="0123456789abcdefghijklmnopqrstuvwxyz";function M(t){return k.charAt(t)}function q(t,e){return t&e}function V(t,e){return t|e}function F(t,e){return t^e}function H(t,e){return t&~e}function W(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function $(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="=";function J(t){var e,n,r="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),r+=G.charAt(n>>6)+G.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),r+=G.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),r+=G.charAt(n>>2)+G.charAt((3&n)<<4));(3&r.length)>0;)r+=K;return r}function Y(t){var e,n="",r=0,i=0;for(e=0;e<t.length&&t.charAt(e)!=K;++e){var o=G.indexOf(t.charAt(e));o<0||(0==r?(n+=M(o>>2),i=3&o,r=1):1==r?(n+=M(i<<2|o>>4),i=15&o,r=2):2==r?(n+=M(i),n+=M(o>>2),i=3&o,r=3):(n+=M(i<<2|o>>4),n+=M(15&o),r=0))}return 1==r&&(n+=M(i<<2)),n}var z,Z,Q={decode:function(t){var e;if(void 0===Z){var n="= \f\n\r\t \u2028\u2029";for(Z=Object.create(null),e=0;e<64;++e)Z["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<n.length;++e)Z[n.charAt(e)]=-1}var r=[],i=0,o=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=Z[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++o>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=Q.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return Q.decode(t)}},X=1e13,tt=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var n,r,i=this.buf,o=i.length;for(n=0;n<o;++n)(r=i[n]*t+e)<X?e=0:r-=(e=0|r/X)*X,i[n]=r;e>0&&(i[n]=e)},t.prototype.sub=function(t){var e,n,r=this.buf,i=r.length;for(e=0;e<i;++e)(n=r[e]-t)<0?(n+=X,t=1):t=0,r[e]=n;for(;0===r[r.length-1];)r.pop()},t.prototype.toString=function(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,n=e[e.length-1].toString(),r=e.length-2;r>=0;--r)n+=(X+e[r]).toString().substring(1);return n},t.prototype.valueOf=function(){for(var t=this.buf,e=0,n=t.length-1;n>=0;--n)e=e*X+t[n];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),et="…",nt=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,rt=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function it(t,e){return t.length>e&&(t=t.substring(0,e)+et),t}var ot,st=function(){function t(e,n){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,n){for(var r="",i=t;i<e;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},t.prototype.isASCII=function(t,e){for(var n=t;n<e;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var n="",r=t;r<e;++r)n+=String.fromCharCode(this.get(r));return n},t.prototype.parseStringUTF=function(t,e){for(var n="",r=t;r<e;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},t.prototype.parseStringBMP=function(t,e){for(var n,r,i="",o=t;o<e;)n=this.get(o++),r=this.get(o++),i+=String.fromCharCode(n<<8|r);return i},t.prototype.parseTime=function(t,e,n){var r=this.parseStringISO(t,e),i=(n?nt:rt).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(r+=":"+i[5],i[6]&&(r+=":"+i[6],i[7]&&(r+="."+i[7]))),i[8]&&(r+=" UTC","Z"!=i[8]&&(r+=i[8],i[9]&&(r+=":"+i[9]))),r):"Unrecognized time: "+r},t.prototype.parseInteger=function(t,e){for(var n,r=this.get(t),i=r>127,o=i?255:0,s="";r==o&&++t<e;)r=this.get(t);if(0==(n=e-t))return i?-1:0;if(n>4){for(s=r,n<<=3;0==(128&(+s^o));)s=+s<<1,--n;s="("+n+" bit)\n"}i&&(r-=256);for(var a=new tt(r),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()},t.prototype.parseBitString=function(t,e,n){for(var r=this.get(t),i="("+((e-t-1<<3)-r)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?r:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>n)return i+it(o,n)}return i+o},t.prototype.parseOctetString=function(t,e,n){if(this.isASCII(t,e))return it(this.parseStringISO(t,e),n);var r=e-t,i="("+r+" byte)\n";r>(n/=2)&&(e=t+n);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return r>n&&(i+=et),i},t.prototype.parseOID=function(t,e,n){for(var r="",i=new tt,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===r)if((i=i.simplify())instanceof tt)i.sub(80),r="2."+i.toString();else{var u=i<80?i<40?0:1:2;r=u+"."+(i-40*u)}else r+="."+i.toString();if(r.length>n)return it(r,n);i=new tt,o=0}}return o>0&&(r+=".incomplete"),r},t}(),at=function(){function t(t,e,n,r,i){if(!(r instanceof ut))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=n,this.tag=r,this.sub=i}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+n,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);case 6:return this.stream.parseOID(e,e+n,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return it(this.stream.parseStringUTF(e,e+n),t);case 18:case 19:case 20:case 21:case 22:case 26:return it(this.stream.parseStringISO(e,e+n),t);case 30:return it(this.stream.parseStringBMP(e,e+n),t);case 23:case 24:return this.stream.parseTime(e,e+n,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var n=0,r=this.sub.length;n<r;++n)e+=this.sub[n].toPrettyString(t)}return e},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(t){var e=t.get(),n=127&e;if(n==e)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===n)return null;e=0;for(var r=0;r<n;++r)e=256*e+t.get();return e},t.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,n=2*this.length;return t.substr(e,n)},t.decode=function(e){var n;n=e instanceof st?e:new st(e,0);var r=new st(n),i=new ut(n),o=t.decodeLength(n),s=n.pos,a=s-r.pos,u=null,c=function(){var e=[];if(null!==o){for(var r=s+o;n.pos<r;)e[e.length]=t.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=t.decode(n);if(i.tag.isEOC())break;e[e.length]=i}o=s-n.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return e};if(i.tagConstructed)u=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");u=c();for(var h=0;h<u.length;++h)if(u[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){u=null}if(null===u){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);n.pos=s+Math.abs(o)}return new t(r,a,o,i,u)},t}(),ut=function(){function t(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){var n=new tt;do{e=t.get(),n.mulAdd(128,127&e)}while(128&e);this.tagNumber=n.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),ct=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ht=(1<<26)/ct[ct.length-1],ft=function(){function t(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return t.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,r=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=M(n));s>=0;)a<e?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=M(n));return i?o:"0"},t.prototype.negate=function(){var e=gt();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+St(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var n=gt();return this.abs().divRemTo(e,null,n),this.s<0&&n.compareTo(t.ZERO)>0&&e.subTo(n,n),n},t.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new pt(e):new dt(e),this.exp(t,n)},t.prototype.clone=function(){var t=gt();return this.copyTo(t),t},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},t.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var n,r=this.DB-t*this.DB%8,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e},t.prototype.equals=function(t){return 0==this.compareTo(t)},t.prototype.min=function(t){return this.compareTo(t)<0?this:t},t.prototype.max=function(t){return this.compareTo(t)>0?this:t},t.prototype.and=function(t){var e=gt();return this.bitwiseTo(t,q,e),e},t.prototype.or=function(t){var e=gt();return this.bitwiseTo(t,V,e),e},t.prototype.xor=function(t){var e=gt();return this.bitwiseTo(t,F,e),e},t.prototype.andNot=function(t){var e=gt();return this.bitwiseTo(t,H,e),e},t.prototype.not=function(){for(var t=gt(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},t.prototype.shiftLeft=function(t){var e=gt();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},t.prototype.shiftRight=function(t){var e=gt();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},t.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+W(this[t]);return this.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=$(this[n]^e);return t},t.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},t.prototype.setBit=function(t){return this.changeBit(t,V)},t.prototype.clearBit=function(t){return this.changeBit(t,H)},t.prototype.flipBit=function(t){return this.changeBit(t,F)},t.prototype.add=function(t){var e=gt();return this.addTo(t,e),e},t.prototype.subtract=function(t){var e=gt();return this.subTo(t,e),e},t.prototype.multiply=function(t){var e=gt();return this.multiplyTo(t,e),e},t.prototype.divide=function(t){var e=gt();return this.divRemTo(t,e,null),e},t.prototype.remainder=function(t){var e=gt();return this.divRemTo(t,null,e),e},t.prototype.divideAndRemainder=function(t){var e=gt(),n=gt();return this.divRemTo(t,e,n),[e,n]},t.prototype.modPow=function(t,e){var n,r,i=t.bitLength(),o=_t(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new pt(e):e.isEven()?new yt(e):new dt(e);var s=[],a=3,u=n-1,c=(1<<n)-1;if(s[1]=r.convert(this),n>1){var h=gt();for(r.sqrTo(s[1],h);a<=c;)s[a]=gt(),r.mulTo(h,s[a-2],s[a]),a+=2}var f,l,p=t.t-1,d=!0,y=gt();for(i=St(t[p])-1;p>=0;){for(i>=u?f=t[p]>>i-u&c:(f=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(f|=t[p-1]>>this.DB+i-u)),a=n;0==(1&f);)f>>=1,--a;if((i-=a)<0&&(i+=this.DB,--p),d)s[f].copyTo(o),d=!1;else{for(;a>1;)r.sqrTo(o,y),r.sqrTo(y,o),a-=2;a>0?r.sqrTo(o,y):(l=o,o=y,y=l),r.mulTo(y,s[f],o)}for(;p>=0&&0==(t[p]&1<<i);)r.sqrTo(o,y),l=o,o=y,y=l,--i<0&&(i=this.DB-1,--p)}return r.revert(o)},t.prototype.modInverse=function(e){var n=e.isEven();if(this.isEven()&&n||0==e.signum())return t.ZERO;for(var r=e.clone(),i=this.clone(),o=_t(1),s=_t(0),a=_t(0),u=_t(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),n?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(r,i),n&&a.subTo(o,a),u.subTo(s,u))}return 0!=i.compareTo(t.ONE)?t.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u},t.prototype.pow=function(t){return this.exp(t,new lt)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var i=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},t.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=ct[ct.length-1]){for(e=0;e<ct.length;++e)if(n[0]==ct[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<ct.length;){for(var r=ct[e],i=e+1;i<ct.length&&r<ht;)r*=ct[i++];for(r=n.modInt(r);e<i;)if(r%ct[e++]==0)return!1}return n.millerRabin(t)},t.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(e,n);r=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var a=8==r?255&+e[i]:Et(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&+e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},t.prototype.lShiftTo=function(t,e){for(var n=t%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(t/this.DB),s=this.s<<n&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>r|s,s=(this[a]&i)<<n;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,i=this.DB-r,o=(1<<r)-1;e[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<i,e[s-n]=this[s]>>r;r>0&&(e[this.t-n-1]|=(this.s&o)<<i),e.t=this.t-n,e.clamp()}},t.prototype.subTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},t.prototype.multiplyTo=function(e,n){var r=this.abs(),i=e.abs(),o=r.t;for(n.t=o+i.t;--o>=0;)n[o]=0;for(o=0;o<i.t;++o)n[o+r.t]=r.am(0,i[o],n,o,0,r.t);n.s=0,n.clamp(),this.s!=e.s&&t.ZERO.subTo(n,n)},t.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,n,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=gt());var s=gt(),a=this.s,u=e.s,c=this.DB-St(i[i.t-1]);c>0?(i.lShiftTo(c,s),o.lShiftTo(c,r)):(i.copyTo(s),o.copyTo(r));var h=s.t,f=s[h-1];if(0!=f){var l=f*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),p=this.FV/l,d=(1<<this.F1)/l,y=1<<this.F2,g=r.t,v=g-h,m=null==n?gt():n;for(s.dlShiftTo(v,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),t.ONE.dlShiftTo(h,m),m.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--v>=0;){var b=r[--g]==f?this.DM:Math.floor(r[g]*p+(r[g-1]+y)*d);if((r[g]+=s.am(0,b,r,v,0,h))<b)for(s.dlShiftTo(v,m),r.subTo(m,r);r[g]<--b;)r.subTo(m,r)}null!=n&&(r.drShiftTo(h,n),a!=u&&t.ZERO.subTo(n,n)),r.t=h,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&t.ZERO.subTo(r,r)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,n){if(e>4294967295||e<1)return t.ONE;var r=gt(),i=gt(),o=n.convert(this),s=St(e)-1;for(o.copyTo(r);--s>=0;)if(n.sqrTo(r,i),(e&1<<s)>0)n.mulTo(i,o,r);else{var a=r;r=i,i=a}return n.revert(r)},t.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=_t(n),i=gt(),o=gt(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(t).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(t)+s},t.prototype.fromRadix=function(e,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),o=!1,s=0,a=0,u=0;u<e.length;++u){var c=Et(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(o=!0):(a=n*a+c,++s>=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(n,s)),this.dAddOffset(a,0)),o&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,n,r){if("number"==typeof n)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),V,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var i=[],o=7&e;i.length=1+(e>>3),n.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},t.prototype.bitwiseTo=function(t,e,n){var r,i,o=Math.min(t.t,this.t);for(r=0;r<o;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(i=t.s&this.DM,r=o;r<this.t;++r)n[r]=e(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<t.t;++r)n[r]=e(i,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},t.prototype.changeBit=function(e,n){var r=t.ONE.shiftLeft(e);return this.bitwiseTo(r,n,r),r},t.prototype.addTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,n){var r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,t[r],n,r,0,this.t);for(i=Math.min(t.t,e);r<i;++r)this.am(0,t[r],n,r,0,e-r);n.clamp()},t.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},t.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},t.prototype.millerRabin=function(e){var n=this.subtract(t.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);(e=e+1>>1)>ct.length&&(e=ct.length);for(var o=gt(),s=0;s<e;++s){o.fromInt(ct[Math.floor(Math.random()*ct.length)]);var a=o.modPow(i,this);if(0!=a.compareTo(t.ONE)&&0!=a.compareTo(n)){for(var u=1;u++<r&&0!=a.compareTo(n);)if(0==(a=a.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},t.prototype.square=function(){var t=gt();return this.squareTo(t),t},t.prototype.gcda=function(t,e){var n=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var o=n.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)e(n);else{o<s&&(s=o),s>0&&(n.rShiftTo(s,n),r.rShiftTo(s,r));var a=function(){(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(a,0):(s>0&&r.lShiftTo(s,r),setTimeout((function(){e(r)}),0))};setTimeout(a,10)}},t.prototype.fromNumberAsync=function(e,n,r,i){if("number"==typeof n)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),V,this),this.isEven()&&this.dAddOffset(1,0);var o=this,s=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(t.ONE.shiftLeft(e-1),o),o.isProbablePrime(n)?setTimeout((function(){i()}),0):setTimeout(s,0)};setTimeout(s,0)}else{var a=[],u=7&e;a.length=1+(e>>3),n.nextBytes(a),u>0?a[0]&=(1<<u)-1:a[0]=0,this.fromString(a,256)}},t}(),lt=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),pt=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),dt=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=gt();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(ft.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=gt();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),yt=function(){function t(t){this.m=t,this.r2=gt(),this.q3=gt(),ft.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=gt();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function gt(){return new ft(null)}function vt(t,e){return new ft(t,e)}"Microsoft Internet Explorer"==(null===navigator||void 0===navigator?void 0:navigator.appName)?(ft.prototype.am=function(t,e,n,r,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+n[r]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),n[r++]=1073741823&u}return i},ot=30):"Netscape"!=(null===navigator||void 0===navigator?void 0:navigator.appName)?(ft.prototype.am=function(t,e,n,r,i,o){for(;--o>=0;){var s=e*this[t++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},ot=26):(ft.prototype.am=function(t,e,n,r,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+n[r]+i)>>28)+(h>>14)+a*c,n[r++]=268435455&u}return i},ot=28),ft.prototype.DB=ot,ft.prototype.DM=(1<<ot)-1,ft.prototype.DV=1<<ot,ft.prototype.FV=Math.pow(2,52),ft.prototype.F1=52-ot,ft.prototype.F2=2*ot-52;var mt,bt,wt=[];for(mt="0".charCodeAt(0),bt=0;bt<=9;++bt)wt[mt++]=bt;for(mt="a".charCodeAt(0),bt=10;bt<36;++bt)wt[mt++]=bt;for(mt="A".charCodeAt(0),bt=10;bt<36;++bt)wt[mt++]=bt;function Et(t,e){var n=wt[t.charCodeAt(e)];return null==n?-1:n}function _t(t){var e=gt();return e.fromInt(t),e}function St(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}ft.ZERO=_t(0),ft.ONE=_t(1);var It,Tt,Ot=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}(),At=256,Rt=null;if(null==Rt){Rt=[],Tt=0;var Nt=void 0;if((null===window||void 0===window?void 0:window.crypto)&&(null===window||void 0===window?void 0:window.crypto.getRandomValues)){var xt=new Uint32Array(256);for(null===window||void 0===window||window.crypto.getRandomValues(xt),Nt=0;Nt<xt.length;++Nt)Rt[Tt++]=255&xt[Nt]}var Ct=function(t){if(this.count=this.count||0,this.count>=256||Tt>=At)(null===window||void 0===window?void 0:window.removeEventListener)?null===window||void 0===window||window.removeEventListener("mousemove",Ct,!1):(null===window||void 0===window?void 0:window.detachEvent)&&(null===window||void 0===window||window.detachEvent("onmousemove",Ct));else try{var e=t.x+t.y;Rt[Tt++]=255&e,this.count+=1}catch(t){}};(null===window||void 0===window?void 0:window.addEventListener)?null===window||void 0===window||window.addEventListener("mousemove",Ct,!1):(null===window||void 0===window?void 0:window.attachEvent)&&(null===window||void 0===window||window.attachEvent("onmousemove",Ct))}function Pt(){if(null==It){for(It=new Ot;Tt<At;){var t=Math.floor(65536*Math.random());Rt[Tt++]=255&t}for(It.init(Rt),Tt=0;Tt<Rt.length;++Tt)Rt[Tt]=0;Tt=0}return It.next()}var Dt=function(){function t(){}return t.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=Pt()},t}(),Lt=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),n=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(n)<0;)e=e.add(this.p);return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},t.prototype.setPublic=function(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=vt(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var n=[],r=t.length-1;r>=0&&e>0;){var i=t.charCodeAt(r--);i<128?n[--e]=i:i>127&&i<2048?(n[--e]=63&i|128,n[--e]=i>>6|192):(n[--e]=63&i|128,n[--e]=i>>6&63|128,n[--e]=i>>12|224)}n[--e]=0;for(var o=new Dt,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);n[--e]=s[0]}return n[--e]=2,n[--e]=0,new ft(n)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var r=n.toString(16);return 0==(1&r.length)?r:"0"+r},t.prototype.encryptLong=function(t){var e=this,n=(this.n.bitLength()+7>>3)-11;try{var r="";return t.length>n?(t.match(/.{1,117}/g).forEach((function(t){var n=e.encrypt(t);r+=n})),J(r)):J(this.encrypt(t))}catch(t){return!1}},t.prototype.decryptLong=function(t){var e=this,n=this.n.bitLength()+7>>3;t=Y(t);try{if(t.length>n){var r="";return t.match(/.{1,256}/g).forEach((function(t){var n=e.decrypt(t);r+=n})),r}return this.decrypt(t)}catch(t){return!1}},t.prototype.setPrivate=function(t,e,n){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=vt(t,16),this.e=parseInt(e,16),this.d=vt(n,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,n,r,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=vt(t,16),this.e=parseInt(e,16),this.d=vt(n,16),this.p=vt(r,16),this.q=vt(i,16),this.dmp1=vt(o,16),this.dmq1=vt(s,16),this.coeff=vt(a,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var n=new Dt,r=t>>1;this.e=parseInt(e,16);for(var i=new ft(e,16);;){for(;this.p=new ft(t-r,1,n),0!=this.p.subtract(ft.ONE).gcd(i).compareTo(ft.ONE)||!this.p.isProbablePrime(10););for(;this.q=new ft(r,1,n),0!=this.q.subtract(ft.ONE).gcd(i).compareTo(ft.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(ft.ONE),a=this.q.subtract(ft.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(ft.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=vt(t,16),n=this.doPrivate(e);return null==n?null:function(t,e){for(var n=t.toByteArray(),r=0;r<n.length&&0==n[r];)++r;if(n.length-r!=e-1||2!=n[r])return null;for(++r;0!=n[r];)if(++r>=n.length)return null;for(var i="";++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,n){var r=new Dt,i=t>>1;this.e=parseInt(e,16);var o=new ft(e,16),s=this,a=function(){var e=function(){if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(ft.ONE),r=s.q.subtract(ft.ONE),i=e.multiply(r);0==i.gcd(o).compareTo(ft.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(r),s.coeff=s.q.modInverse(s.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},u=function(){s.q=gt(),s.q.fromNumberAsync(i,1,r,(function(){s.q.subtract(ft.ONE).gcda(o,(function(t){0==t.compareTo(ft.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},c=function(){s.p=gt(),s.p.fromNumberAsync(t-i,1,r,(function(){s.p.subtract(ft.ONE).gcda(o,(function(t){0==t.compareTo(ft.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},t.prototype.sign=function(t,e,n){var r=function(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var n=e-t.length-6,r="",i=0;i<n;i+=2)r+="ff";return vt("0001"+r+"00"+t,16)}((Ut[n]||"")+e(t).toString(),this.n.bitLength()/4);if(null==r)return null;var i=this.doPrivate(r);if(null==i)return null;var o=i.toString(16);return 0==(1&o.length)?o:"0"+o},t.prototype.verify=function(t,e,n){var r=vt(e,16),i=this.doPublic(r);return null==i?null:function(t){for(var e in Ut)if(Ut.hasOwnProperty(e)){var n=Ut[e],r=n.length;if(t.substr(0,r)==n)return t.substr(r)}return t}(i.toString(16).replace(/^1f+00/,""))==n(t).toString()},t}(),Ut={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"},jt={};jt.lang={extend:function(t,e,n){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var r=function(){};if(r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),n){var i;for(i in n)t.prototype[i]=n[i];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(o=function(t,e){for(i=0;i<s.length;i+=1){var n=s[i],r=e[n];"function"==typeof r&&r!=Object.prototype[n]&&(t[n]=r)}})}catch(t){}o(t.prototype,n)}}};var Bt={};void 0!==Bt.asn1&&Bt.asn1||(Bt.asn1={}),Bt.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var n=e.substr(1).length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";e=new ft(r,16).xor(t).add(ft.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=Bt.asn1,n=e.DERBoolean,r=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,s=e.DERNull,a=e.DERObjectIdentifier,u=e.DEREnumerated,c=e.DERUTF8String,h=e.DERNumericString,f=e.DERPrintableString,l=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,y=e.DERGeneralizedTime,g=e.DERSequence,v=e.DERSet,m=e.DERTaggedObject,b=e.ASN1Util.newObject,w=Object.keys(t);if(1!=w.length)throw"key of param shall be only one.";var E=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+E+":"))throw"undefined key: "+E;if("bool"==E)return new n(t[E]);if("int"==E)return new r(t[E]);if("bitstr"==E)return new i(t[E]);if("octstr"==E)return new o(t[E]);if("null"==E)return new s(t[E]);if("oid"==E)return new a(t[E]);if("enum"==E)return new u(t[E]);if("utf8str"==E)return new c(t[E]);if("numstr"==E)return new h(t[E]);if("prnstr"==E)return new f(t[E]);if("telstr"==E)return new l(t[E]);if("ia5str"==E)return new p(t[E]);if("utctime"==E)return new d(t[E]);if("gentime"==E)return new y(t[E]);if("seq"==E){for(var _=t[E],S=[],I=0;I<_.length;I++){var T=b(_[I]);S.push(T)}return new g({array:S})}if("set"==E){for(_=t[E],S=[],I=0;I<_.length;I++)T=b(_[I]),S.push(T);return new v({array:S})}if("tag"==E){var O=t[E];if("[object Array]"===Object.prototype.toString.call(O)&&3==O.length){var A=b(O[2]);return new m({tag:O[0],explicit:O[1],obj:A})}var R={};if(void 0!==O.explicit&&(R.explicit=O.explicit),void 0!==O.tag&&(R.tag=O.tag),void 0===O.obj)throw"obj shall be specified for 'tag'.";return R.obj=b(O.obj),new m(R)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},Bt.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",n=parseInt(t.substr(0,2),16),r=(e=Math.floor(n/40)+"."+n%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);r+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new ft(r,2).toString(10),r="")}return e},Bt.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new ft(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},Bt.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+n).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},Bt.asn1.DERAbstractString=function(t){Bt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},jt.lang.extend(Bt.asn1.DERAbstractString,Bt.asn1.ASN1Object),Bt.asn1.DERAbstractTime=function(t){Bt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,n){var r=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var a=i.getMilliseconds();if(0!=a){var u=r(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,n,r,i,o){var s=new Date(Date.UTC(t,e-1,n,r,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},jt.lang.extend(Bt.asn1.DERAbstractTime,Bt.asn1.ASN1Object),Bt.asn1.DERAbstractStructured=function(t){Bt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},jt.lang.extend(Bt.asn1.DERAbstractStructured,Bt.asn1.ASN1Object),Bt.asn1.DERBoolean=function(){Bt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},jt.lang.extend(Bt.asn1.DERBoolean,Bt.asn1.ASN1Object),Bt.asn1.DERInteger=function(t){Bt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Bt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new ft(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},jt.lang.extend(Bt.asn1.DERInteger,Bt.asn1.ASN1Object),Bt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Bt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}Bt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var n="0"+t;this.hTLV=null,this.isModified=!0,this.hV=n+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var n=0;n<=e;n++)t+="0";var r="";for(n=0;n<t.length-1;n+=8){var i=t.substr(n,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),r+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",n=0;n<t.length;n++)1==t[n]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},jt.lang.extend(Bt.asn1.DERBitString,Bt.asn1.ASN1Object),Bt.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Bt.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}Bt.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},jt.lang.extend(Bt.asn1.DEROctetString,Bt.asn1.DERAbstractString),Bt.asn1.DERNull=function(){Bt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},jt.lang.extend(Bt.asn1.DERNull,Bt.asn1.ASN1Object),Bt.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new ft(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};Bt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var e=Bt.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},jt.lang.extend(Bt.asn1.DERObjectIdentifier,Bt.asn1.ASN1Object),Bt.asn1.DEREnumerated=function(t){Bt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Bt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new ft(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},jt.lang.extend(Bt.asn1.DEREnumerated,Bt.asn1.ASN1Object),Bt.asn1.DERUTF8String=function(t){Bt.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},jt.lang.extend(Bt.asn1.DERUTF8String,Bt.asn1.DERAbstractString),Bt.asn1.DERNumericString=function(t){Bt.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},jt.lang.extend(Bt.asn1.DERNumericString,Bt.asn1.DERAbstractString),Bt.asn1.DERPrintableString=function(t){Bt.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},jt.lang.extend(Bt.asn1.DERPrintableString,Bt.asn1.DERAbstractString),Bt.asn1.DERTeletexString=function(t){Bt.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},jt.lang.extend(Bt.asn1.DERTeletexString,Bt.asn1.DERAbstractString),Bt.asn1.DERIA5String=function(t){Bt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},jt.lang.extend(Bt.asn1.DERIA5String,Bt.asn1.DERAbstractString),Bt.asn1.DERUTCTime=function(t){Bt.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},jt.lang.extend(Bt.asn1.DERUTCTime,Bt.asn1.DERAbstractTime),Bt.asn1.DERGeneralizedTime=function(t){Bt.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},jt.lang.extend(Bt.asn1.DERGeneralizedTime,Bt.asn1.DERAbstractTime),Bt.asn1.DERSequence=function(t){Bt.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},jt.lang.extend(Bt.asn1.DERSequence,Bt.asn1.DERAbstractStructured),Bt.asn1.DERSet=function(t){Bt.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t.push(n.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},jt.lang.extend(Bt.asn1.DERSet,Bt.asn1.DERAbstractStructured),Bt.asn1.DERTaggedObject=function(t){Bt.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},jt.lang.extend(Bt.asn1.DERTaggedObject,Bt.asn1.ASN1Object);var kt=function(t){function e(t){void 0===t&&(t="");var e=this;return t&&("string"==typeof t?e.parseKey(t):(e.hasPrivateKeyProperty(t)||e.hasPublicKeyProperty(t))&&e.parsePropertiesFrom(t)),e}return B(e,t),e.prototype.parseKey=function(t){try{var e=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?function(t){var e;if(void 0===z){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(z={},e=0;e<16;++e)z[n.charAt(e)]=e;for(n=n.toLowerCase(),e=10;e<16;++e)z[n.charAt(e)]=e;for(e=0;e<r.length;++e)z[r.charAt(e)]=-1}var i=[],o=0,s=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=z[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);o|=a,++s>=2?(i[i.length]=o,o=0,s=0):o<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return i}(t):Q.unarmor(t),i=at.decode(r);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=vt(e,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var o=i.sub[3].getHexStringValue();this.d=vt(o,16);var s=i.sub[4].getHexStringValue();this.p=vt(s,16);var a=i.sub[5].getHexStringValue();this.q=vt(a,16);var u=i.sub[6].getHexStringValue();this.dmp1=vt(u,16);var c=i.sub[7].getHexStringValue();this.dmq1=vt(c,16);var h=i.sub[8].getHexStringValue();this.coeff=vt(h,16)}else{if(2!==i.sub.length)return!1;var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=vt(e,16),n=f.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new Bt.asn1.DERInteger({int:0}),new Bt.asn1.DERInteger({bigint:this.n}),new Bt.asn1.DERInteger({int:this.e}),new Bt.asn1.DERInteger({bigint:this.d}),new Bt.asn1.DERInteger({bigint:this.p}),new Bt.asn1.DERInteger({bigint:this.q}),new Bt.asn1.DERInteger({bigint:this.dmp1}),new Bt.asn1.DERInteger({bigint:this.dmq1}),new Bt.asn1.DERInteger({bigint:this.coeff})]};return new Bt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return J(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new Bt.asn1.DERSequence({array:[new Bt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new Bt.asn1.DERNull]}),e=new Bt.asn1.DERSequence({array:[new Bt.asn1.DERInteger({bigint:this.n}),new Bt.asn1.DERInteger({int:this.e})]}),n=new Bt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new Bt.asn1.DERSequence({array:[t,n]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return J(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(void 0===e&&(e=void 0),!t)return t;var n="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(n,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.prototype.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.prototype.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(Lt);function Mt(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}Mt.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new kt(t)},Mt.prototype.setPrivateKey=function(t){this.setKey(t)},Mt.prototype.setPublicKey=function(t){this.setKey(t)},Mt.prototype.decrypt=function(t){try{return this.getKey().decrypt(Y(t))}catch(t){return!1}},Mt.prototype.encrypt=function(t){try{return J(this.getKey().encrypt(t))}catch(t){return!1}},Mt.prototype.encryptLong=function(t){try{for(var e=this.getKey().encryptLong(t)||"",n=this.getKey().decryptLong(e)||"",r=0,i=/null$/g;i.test(n)&&(r++,e=this.getKey().encryptLong(t)||"",n=this.getKey().decryptLong(e)||"",!(r>10)););return e}catch(t){return!1}},Mt.prototype.decryptLong=function(t){try{return this.getKey().decryptLong(t)}catch(t){return!1}},Mt.prototype.sign=function(t,e,n){try{return J(this.getKey().sign(t,e,n))}catch(t){return!1}},Mt.prototype.verify=function(t,e,n){try{return this.getKey().verify(t,Y(e),n)}catch(t){return!1}},Mt.prototype.getKey=function(t){if(!this.key){if(this.key=new kt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},Mt.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},Mt.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},Mt.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},Mt.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},Mt.version="3.1.4";var qt=Mt,Vt=function(t){var e=void 0===t?{}:t,n=e.publicKey,r=void 0===n?"":n,i=e.payload,o=void 0===i?{}:i;if(!r)return"";try{var s=j(o),a=new qt;return a.setPublicKey(r),a.encryptLong(JSON.stringify(s))}catch(t){}return""},Ft=function(){return Ft=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ft.apply(this,arguments)},Ht=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Wt=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},$t=function(){function t(t){var e=t.request,n=t.credentialsClient;if(!n){var r={apiOrigin:t.apiOrigin,clientId:t.clientId,storage:t.storage};n=new A(r)}if(!e){var i=n.request.bind(n),o=new U(Ft({clientId:t.clientId,request:i,storage:t.storage},t.captchaOptions));e=o.request.bind(o)}this.config={apiOrigin:t.apiOrigin,clientId:t.clientId,request:e,credentialsClient:n,storage:t.storage||_}}return t.parseParamsToSearch=function(t){return Object.keys(t).forEach((function(e){t[e]||delete t[e]})),new URLSearchParams(t).toString()},t.prototype.getParamsByVersion=function(t,e){var n,r=j(t),i=(null===(n={v2:s}[null==r?void 0:r.version])||void 0===n?void 0:n[e])||o[e];return r&&delete r.version,{params:r,url:i}},t.prototype.signIn=function(t){return Ht(this,void 0,void 0,(function(){var e,n,r,i;return Wt(this,(function(o){switch(o.label){case 0:return e=t.version||"v1",(n=this.getParamsByVersion(t,"AUTH_SIGN_IN_URL")).params.query&&delete n.params.query,[4,this.getEncryptParams(n.params)];case 1:return r=o.sent(),[4,this.config.request(n.url,{method:"POST",body:r})];case 2:return i=o.sent(),[4,this.config.credentialsClient.setCredentials(Ft(Ft({},i),{version:e}))];case 3:return o.sent(),[2,Promise.resolve(i)]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.request(o.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signUp=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.request(o.AUTH_SIGN_UP_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signOut=function(){return Ht(this,void 0,void 0,(function(){var t,e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return t=n.sent(),[4,this.config.request(o.AUTH_REVOKE_URL,{method:"POST",body:{token:t}})];case 2:return e=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.getVerification=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return e=!1,"CUR_USER"!==t.target?[3,1]:(e=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(e=!0),n.label=3;case 3:return[2,this.config.request(o.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:!0,withCredentials:e})]}}))}))},t.prototype.verify=function(t){return Ht(this,void 0,void 0,(function(){var e,n;return Wt(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"VERIFY_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),"v2"!==(null==t?void 0:t.version)?[3,3]:[4,this.config.credentialsClient.setCredentials(Ft(Ft({},n),{version:"v2"}))];case 2:r.sent(),r.label=3;case 3:return[2,n]}}))}))},t.prototype.genProviderRedirectUri=function(t){return Ht(this,void 0,void 0,(function(){var e,n;return Wt(this,(function(r){return e="".concat(o.PROVIDER_URI_URL,"?client_id=").concat(this.config.clientId,"&provider_id=").concat(t.provider_id,"&redirect_uri=").concat(encodeURIComponent(t.provider_redirect_uri),"&state=").concat(t.state),(n=t.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(e+="&other_params[sign_out_uri]=".concat(n.sign_out_uri)),[2,this.config.request(e,{method:"GET"})]}))}))},t.prototype.grantProviderToken=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.PROVIDER_TOKEN_URL,{method:"POST",body:t})]}))}))},t.prototype.patchProviderToken=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})]}))}))},t.prototype.signInWithProvider=function(t){return Ht(this,void 0,void 0,(function(){var e,n;return Wt(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(Ft(Ft({},n),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return r.sent(),[2,Promise.resolve(n)]}}))}))},t.prototype.bindWithProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.getUserProfile=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.getUserInfo(t)]}))}))},t.prototype.getUserInfo=function(t){var e;return void 0===t&&(t={}),Ht(this,void 0,void 0,(function(){var n,r,i;return Wt(this,(function(o){switch(o.label){case 0:return n=this.getParamsByVersion(t,"USER_ME_URL"),(null===(e=n.params)||void 0===e?void 0:e.query)&&(r=new URLSearchParams(n.params.query),n.url+="?".concat(r.toString())),[4,this.config.request(n.url,{method:"GET",withCredentials:!0})];case 1:return(i=o.sent()).sub&&(i.uid=i.sub),[2,i]}}))}))},t.prototype.getWedaUserInfo=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){switch(t.label){case 0:return[4,this.config.request(o.WEDA_USER_URL,{method:"GET",withCredentials:!0})];case 1:return[2,t.sent()]}}))}))},t.prototype.deleteMe=function(e){return Ht(this,void 0,void 0,(function(){var n,r;return Wt(this,(function(i){return n=this.getParamsByVersion(e,"USER_ME_URL"),r="".concat(n.url,"?").concat(t.parseParamsToSearch(n.params)),[2,this.config.request(r,{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.hasLoginState=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},t.prototype.getLoginState=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},t.prototype.transByProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.grantToken=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){return e=this.getParamsByVersion(t,"AUTH_TOKEN_URL"),[2,this.config.request(e.url,{method:"POST",body:e.params})]}))}))},t.prototype.getProviders=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},t.prototype.unbindProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.checkPassword=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.bindPhone=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.bindEmail=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.setPassword=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.updatePasswordByOld=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:t.old_password})];case 1:return e=n.sent(),[2,this.setPassword({sudo_token:e.sudo_token,new_password:t.new_password})]}}))}))},t.prototype.sudo=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.SUDO_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.getCurUserVerification=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return t.target="CUR_USER",[2,this.config.request(o.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})]}))}))},t.prototype.changeBindedProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})]}))}))},t.prototype.setUserProfile=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.queryUserProfile=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(o.USER_QUERY_URL,"?").concat(e.toString()),{method:"GET",withCredentials:!0})]}))}))},t.prototype.setCustomSignFunc=function(t){this.getCustomSignTicketFn=t},t.prototype.signInWithCustomTicket=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=n.sent(),[2,this.signInWithProvider(Ft(Ft({},t),{provider_id:"custom",provider_token:e}))]}}))}))},t.prototype.resetPassword=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.AUTH_RESET_PASSWORD,{method:"POST",body:t})]}))}))},t.prototype.deviceAuthorize=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.checkUsername=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})]}))}))},t.prototype.checkIfUserExist=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(o.CHECK_IF_USER_EXIST,"?").concat(e.toString()),{method:"GET"})]}))}))},t.prototype.loginScope=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getScope()]}))}))},t.prototype.loginGroups=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getGroups()]}))}))},t.prototype.refreshTokenForce=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return e=n.sent(),[4,this.config.credentialsClient.refreshToken(Ft(Ft({},e),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return[2,n.sent()]}}))}))},t.prototype.getCredentials=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getCredentials()]}))}))},t.prototype.getPublicKey=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(s.AUTH_PUBLIC_KEY,{method:"POST",body:{}})]}))}))},t.prototype.getEncryptParams=function(t){return Ht(this,void 0,void 0,(function(){var e,n,r,i;return Wt(this,(function(o){switch(o.label){case 0:if(!(e=j(t)).isEncrypt)return[2,t];n="",r="",o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.getPublicKey()];case 2:return i=o.sent(),n=i.public_key,r=i.public_key_thumbprint,[3,4];case 3:return o.sent(),[3,4];case 4:if(!n||!r)throw new Error("public_key or public_key_thumbprint is empty");return delete e.isEncrypt,[2,{params:Vt({publicKey:n,payload:e}),public_key_thumbprint:r}]}}))}))},t.prototype.getProviderSubType=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})]}))}))},t.prototype.varifyCaptchaData=function(t){var e=t.token,n=t.key;return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.VARIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:e,key:n},withCredentials:!1})]}))}))},t.prototype.createCaptchaData=function(t){var e=t.state,n=t.redirect_uri,r=void 0===n?void 0:n;return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:r},withCredentials:!1})]}))}))},t}(),Gt=function(){return Gt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Gt.apply(this,arguments)},Kt=function(t){var e=t.apiOrigin,n=t.clientId,r=t.storage,i=t.request,o=t.baseRequest,s=t.anonymousSignInFunc;this.oauth2client=new A({apiOrigin:e,clientId:n,storage:r,baseRequest:o||i,anonymousSignInFunc:s}),this.authApi=new $t(Gt(Gt({credentialsClient:this.oauth2client},t),{request:i?this.oauth2client.request.bind(this.oauth2client):void 0}))},Jt=function(){return Jt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Jt.apply(this,arguments)},Yt=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},zt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Qt=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Xt=h.P6.xe,te=h.P6._y,ee=h._G.Sg,ne=h._G.vM,re=h.BM.D,ie=h.U3.yE,oe="loginStateChanged",se=new ie,ae=function(){function t(t){var e=t.cache,n=t.oauthInstance;this.cache=e,this.oauthInstance=n,this.setUserInfo()}return t.prototype.checkLocalInfo=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},t.prototype.checkLocalInfoAsync=function(){return Zt(this,void 0,void 0,(function(){var t,e,n,r;return Qt(this,(function(i){switch(i.label){case 0:return t=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return t.uid=i.sent(),e=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return e.gender=i.sent(),this.picture=this.getLocalUserInfo("picture"),n=this,[4,this.getLocalUserInfoAsync("email")];case 3:return n.email=i.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),r=this,[4,this.getLocalUserInfoAsync("username")];case 4:return r.username=i.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},t.prototype.update=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(Jt({},t))];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2]}}))}))},t.prototype.updatePassword=function(t,e){return this.oauthInstance.authApi.updatePasswordByOld({old_password:e,new_password:t})},t.prototype.updateUsername=function(t){return"string"!=typeof t&&te(ee.INVALID_PARAMS,"username must be a string"),this.update({username:t})},t.prototype.refresh=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(t)];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2,e]}}))}))},t.prototype.getLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;return this.cache.getStore(e)[t]},t.prototype.getLocalUserInfoAsync=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(e)];case 1:return[2,n.sent()[t]]}}))}))},t.prototype.setUserInfo=function(){var t=this,e=this.cache.keys.userInfoKey,n=this.cache.getStore(e);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(e){t[e]=n[e]}))},t.prototype.setLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;this.cache.setStore(e,t),this.setUserInfo()},Yt([re({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"update",null),Yt([re({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[String,String]),zt("design:returntype",void 0)],t.prototype,"updatePassword",null),Yt([re({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[String]),zt("design:returntype",void 0)],t.prototype,"updateUsername",null),Yt([re({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"refresh",null),t}(),ue=function(){function t(t){var e=t.envId,n=t.cache,r=t.oauthInstance;e||te(ee.INVALID_PARAMS,"envId is not defined"),this.cache=n,this.oauthInstance=r,this.user=new ae({cache:this.cache,oauthInstance:r})}return t.prototype.checkLocalState=function(){var t;this.oauthLoginState=null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},t.prototype.checkLocalStateAsync=function(){var t;return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}}))}))},t}(),ce=function(){function t(t){this.config=t,this.cache=t.cache,this.oauthInstance=t.oauthInstance}return t.prototype.bindPhoneNumber=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.bindPhone(t)]}))}))},t.prototype.unbindProvider=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.unbindProvider(t)]}))}))},t.prototype.bindEmail=function(t){return this.oauthInstance.authApi.bindEmail(t)},t.prototype.verify=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.verify(t)]}))}))},t.prototype.getVerification=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.getVerification(t)]}))}))},Object.defineProperty(t.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var t=this.hasLoginState();return t&&t.user||null}Xt(ee.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),t.prototype.getCurrentUser=function(){return Zt(this,void 0,void 0,(function(){var t;return Qt(this,(function(e){switch(e.label){case 0:return[4,this.getLoginState()];case 1:return(t=e.sent())?[4,t.user.checkLocalInfoAsync()]:[3,3];case 2:return e.sent(),[2,t.user||null];case 3:return[2,null]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setCustomSignFunc=function(t){this.oauthInstance.authApi.setCustomSignFunc(t)},t.prototype.signInWithCustomTicket=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signIn=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signIn(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signUp=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signUp(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setPassword=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.setPassword(t)]}))}))},t.prototype.isUsernameRegistered=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return"string"!=typeof t&&te(ee.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:t})];case 1:return[2,e.sent().exist]}}))}))},t.prototype.signOut=function(){return Zt(this,void 0,void 0,(function(){var t;return Qt(this,(function(e){switch(e.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut()];case 1:return e.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return e.sent(),se.fire(oe),[2]}}))}))},t.prototype.hasLoginState=function(){var t;if("async"!==this.cache.mode)return(null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync())?new ue({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;Xt(ee.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},t.prototype.getLoginState=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return t.sent()?[2,new ue({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},t.prototype.getUserInfo=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.getUserInfo(t)]}))}))},t.prototype.getWedaUserInfo=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},t.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},t.prototype.bindWithProvider=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.bindWithProvider(t)]}))}))},t.prototype.queryUser=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.queryUserProfile(t)]}))}))},t.prototype.getAccessToken=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:t.sent(),env:this.config.env}]}}))}))},t.prototype.grantProviderToken=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.grantProviderToken(t)]}))}))},t.prototype.patchProviderToken=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.patchProviderToken(t)]}))}))},t.prototype.signInWithProvider=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.grantToken=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.grantToken(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.genProviderRedirectUri=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.genProviderRedirectUri(t)]}))}))},t.prototype.resetPassword=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.resetPassword(t)]}))}))},t.prototype.deviceAuthorize=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.deviceAuthorize(t)]}))}))},t.prototype.sudo=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.sudo(t)]}))}))},t.prototype.deleteMe=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.deleteMe(t)]}))}))},t.prototype.getProviders=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getProviders()]}))}))},t.prototype.loginScope=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.loginScope()]}))}))},t.prototype.loginGroups=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},t.prototype.onLoginStateChanged=function(t){return Zt(this,void 0,void 0,(function(){var e,n=this;return Qt(this,(function(r){switch(r.label){case 0:return se.on(oe,(function(){return Zt(n,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return e=n.sent(),t.call(this,e),[2]}}))}))})),[4,this.getLoginState()];case 1:return e=r.sent(),t.call(this,e),[2]}}))}))},t.prototype.refreshTokenForce=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.refreshTokenForce(t)]}))}))},t.prototype.getCredentials=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},t.prototype.getProviderSubType=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getProviderSubType()]}))}))},t.prototype.createCaptchaData=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.createCaptchaData(t)]}))}))},t.prototype.varifyCaptchaData=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.varifyCaptchaData(t)]}))}))},t.prototype.createLoginState=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,(e=new ue({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return n.sent(),[4,e.user.refresh(t)];case 2:return n.sent(),se.fire(oe),[2,e]}}))}))},Yt([re({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"bindPhoneNumber",null),Yt([re({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"unbindProvider",null),Yt([re({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",void 0)],t.prototype,"bindEmail",null),Yt([re({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"verify",null),Yt([re({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"getVerification",null),Yt([re({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getCurrentUser",null),Yt([re({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"signInAnonymously",null),Yt([re({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"signInWithCustomTicket",null),Yt([re({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"signUp",null),Yt([re({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[String]),zt("design:returntype",Promise)],t.prototype,"isUsernameRegistered",null),Yt([re({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"signOut",null),Yt([re({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getLoginState",null),Yt([re({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"getUserInfo",null),Yt([re({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getWedaUserInfo",null),Yt([re({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"bindWithProvider",null),Yt([re({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getProviderSubType",null),t}(),he={name:"auth",namespace:"auth",entity:function(t){if(void 0===t&&(t={region:"",persistence:"local"}),this.authInstance)return Xt(ee.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var e=this.platform,n=e.adapter,r=e.runtime,i=t.persistence||n.primaryStorage;i&&i!==this.config.persistence&&this.updateConfig({persistence:i});var o=this.config,s=o.env,a=o.persistence,u=o.debug,c=o.clientId,h=o.storage,f=new Kt({clientId:c,apiOrigin:this.request.getBaseEndPoint(),storage:(null==t?void 0:t.storage)||h,baseRequest:null==t?void 0:t.baseRequest,request:null==t?void 0:t.request,anonymousSignInFunc:null==t?void 0:t.anonymousSignInFunc,captchaOptions:null==t?void 0:t.captchaOptions});return this.oauthInstance=f,this.authInstance=new ce({env:s,region:t.region,persistence:a,debug:u,cache:this.cache,runtime:r,_fromApp:this,oauthInstance:f}),this.authInstance}};try{cloudbase.registerComponent(he)}catch(t){}function fe(t){try{t.registerComponent(he)}catch(t){console.warn(t)}}},529:function(t,e,n){"use strict";n.r(e),n.d(e,{registerDatabase:function(){return kn}});var r,i,o={};n.r(o),n.d(o,{LineString:function(){return W},MultiLineString:function(){return Y},MultiPoint:function(){return K},MultiPolygon:function(){return Z},Point:function(){return it},Polygon:function(){return G}}),function(t){t.DocIDError="文档ID不合法",t.CollNameError="集合名称不合法",t.OpStrError="操作符不合法",t.DirectionError="排序字符不合法",t.IntergerError="must be integer",t.QueryParamTypeError="查询参数必须为对象",t.QueryParamValueError="查询参数对象值不能均为undefined"}(i||(i={}));var s,a,u="Object",c="GeoPoint",h="GeoLineString",f="GeoPolygon",l="GeoMultiPoint",p="GeoMultiLineString",d="GeoMultiPolygon",y="Date",g="ServerDate",v=["desc","asc"],m=["<","<=","==",">=",">"];!function(t){t.lt="<",t.gt=">",t.lte="<=",t.gte=">=",t.eq="=="}(s||(s={})),(r={})[s.eq]="$eq",r[s.lt]="$lt",r[s.lte]="$lte",r[s.gt]="$gt",r[s.gte]="$gte",function(t){t.WHERE="WHERE",t.DOC="DOC"}(a||(a={}));var b,w=(b=function(t,e){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},b(t,e)},function(t,e){function n(){this.constructor=t}b(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),E=[],_={},S=function(t){function e(e,n){if(n!==_)throw new TypeError("InternalSymbol cannot be constructed with new operator");return t.call(this,e)||this}return w(e,t),e.for=function(t){for(var n=0,r=E.length;n<r;n++)if(E[n].target===t)return E[n].instance;var i=new e(t,_);return E.push({target:t,instance:i}),i},e}((function(t){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:t}})})),I=S,T=I.for("UNSET_FIELD_NAME"),O=I.for("UPDATE_COMMAND"),A=I.for("QUERY_COMMAND"),R=I.for("LOGIC_COMMAND"),N=I.for("GEO_POINT"),x=I.for("SYMBOL_GEO_LINE_STRING"),C=I.for("SYMBOL_GEO_POLYGON"),P=I.for("SYMBOL_GEO_MULTI_POINT"),D=I.for("SYMBOL_GEO_MULTI_LINE_STRING"),L=I.for("SYMBOL_GEO_MULTI_POLYGON"),U=I.for("SERVER_DATE"),j=I.for("REGEXP"),B=function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()},k=function(t){return"object"===B(t)},M=function(t){return"number"===B(t)},q=function(t){return Array.isArray(t)},V=function(t){return"date"===B(t)},F=function(t){return"regexp"===B(t)},H=function(t){return t&&t._internalType instanceof S},W=function(){function t(t){if(!q(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(t.length<2)throw new Error('"points" must contain 2 points at least');t.forEach((function(t){if(!(t instanceof it))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("LineString"!==t.type||!q(t.coordinates))return!1;try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t.coordinates),i=r.next();!i.done;i=r.next()){var o=i.value;if(!M(o[0])||!M(o[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!0},t.isClosed=function(t){var e=t.points[0],n=t.points[t.points.length-1];if(e.latitude===n.latitude&&e.longitude===n.longitude)return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return x},enumerable:!0,configurable:!0}),t}(),$=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},G=function(){function t(t){if(!q(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof W))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]");if(!W.isClosed(t))throw new Error("LineString "+t.points.map((function(t){return t.toReadableString()}))+" is not a closed cycle")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,r,i;if("Polygon"!==t.type||!q(t.coordinates))return!1;try{for(var o=$(t.coordinates),s=o.next();!s.done;s=o.next()){var a=s.value;if(!this.isCloseLineString(a))return!1;try{for(var u=(r=void 0,$(a)),c=u.next();!c.done;c=u.next()){var h=c.value;if(!M(h[0])||!M(h[1]))return!1}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},t.isCloseLineString=function(t){var e=t[0],n=t[t.length-1];return e[0]===n[0]&&e[1]===n[1]},Object.defineProperty(t.prototype,"_internalType",{get:function(){return L},enumerable:!0,configurable:!0}),t}(),K=function(){function t(t){if(!q(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(0===t.length)throw new Error('"points" must contain 1 point at least');t.forEach((function(t){if(!(t instanceof it))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("MultiPoint"!==t.type||!q(t.coordinates))return!1;try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t.coordinates),i=r.next();!i.done;i=r.next()){var o=i.value;if(!M(o[0])||!M(o[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return P},enumerable:!0,configurable:!0}),t}(),J=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Y=function(){function t(t){if(!q(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof W))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,r,i;if("MultiLineString"!==t.type||!q(t.coordinates))return!1;try{for(var o=J(t.coordinates),s=o.next();!s.done;s=o.next()){var a=s.value;try{for(var u=(r=void 0,J(a)),c=u.next();!c.done;c=u.next()){var h=c.value;if(!M(h[0])||!M(h[1]))return!1}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return D},enumerable:!0,configurable:!0}),t}(),z=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Z=function(){function t(t){var e,n;if(!q(t))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof t);if(0===t.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var r=z(t),i=r.next();!i.done;i=r.next()){var o=i.value;if(!(o instanceof G))throw new TypeError('"polygon" must be of type Polygon[]. Received type '+typeof o+"[]")}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}this.polygons=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))},e},t.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))}},t.validate=function(t){var e,n,r,i,o,s;if("MultiPolygon"!==t.type||!q(t.coordinates))return!1;try{for(var a=z(t.coordinates),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var h=(r=void 0,z(c)),f=h.next();!f.done;f=h.next()){var l=f.value;try{for(var p=(o=void 0,z(l)),d=p.next();!d.done;d=p.next()){var y=d.value;if(!M(y[0])||!M(y[1]))return!1}}catch(t){o={error:t}}finally{try{d&&!d.done&&(s=p.return)&&s.call(p)}finally{if(o)throw o.error}}}}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return C},enumerable:!0,configurable:!0}),t}(),Q=function(){function t(t){var e=(void 0===t?{}:t).offset,n=void 0===e?0:e;this.offset=n}return Object.defineProperty(t.prototype,"_internalType",{get:function(){return U},enumerable:!0,configurable:!0}),t.prototype.parse=function(){return{$date:{offset:this.offset}}},t}();function X(t){return new Q(t)}var tt,et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},nt=function(){function t(){}return t.formatResDocumentData=function(e){return e.map((function(e){return t.formatField(e)}))},t.formatField=function(e){var n=Object.keys(e),r={};return Array.isArray(e)&&(r=[]),n.forEach((function(n){var i,o=e[n];switch(t.whichType(o)){case c:i=new it(o.coordinates[0],o.coordinates[1]);break;case h:i=new W(o.coordinates.map((function(t){return new it(t[0],t[1])})));break;case f:i=new G(o.coordinates.map((function(t){return new W(t.map((function(t){var e=et(t,2),n=e[0],r=e[1];return new it(n,r)})))})));break;case l:i=new K(o.coordinates.map((function(t){return new it(t[0],t[1])})));break;case p:i=new Y(o.coordinates.map((function(t){return new W(t.map((function(t){var e=et(t,2),n=e[0],r=e[1];return new it(n,r)})))})));break;case d:i=new Z(o.coordinates.map((function(t){return new G(t.map((function(t){return new W(t.map((function(t){var e=et(t,2),n=e[0],r=e[1];return new it(n,r)})))})))})));break;case y:i=new Date(1e3*o.$timestamp);break;case u:case"Array":i=t.formatField(o);break;case g:i=new Date(o.$date);break;default:i=o}Array.isArray(r)?r.push(i):r[n]=i})),r},t.whichType=function(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(e===y)return"BsonDate";if(e===u){if(t instanceof it)return c;if(t instanceof Date)return y;if(t instanceof Q)return g;t.$timestamp?e=y:t.$date?e=g:it.validate(t)?e=c:W.validate(t)?e=h:G.validate(t)?e=f:K.validate(t)?e=l:Y.validate(t)?e=p:Z.validate(t)&&(e=d)}return e},t.generateDocId=function(){for(var t="ABCDEFabcdef0123456789",e="",n=0;n<24;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},t}(),rt=function(){function t(){}return t.isGeopoint=function(t,e){if("Number"!==nt.whichType(e))throw new Error("Geo Point must be number type");var n=Math.abs(e);if("latitude"===t&&n>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===t&&n>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},t.isInteger=function(t,e){if(!Number.isInteger(e))throw new Error(t+i.IntergerError);return!0},t.isFieldOrder=function(t){if(-1===v.indexOf(t))throw new Error(i.DirectionError);return!0},t.isFieldPath=function(t){if(!/^[a-zA-Z0-9-_\.]/.test(t))throw new Error;return!0},t.isOperator=function(t){if(-1===m.indexOf(t))throw new Error(i.OpStrError);return!0},t.isCollName=function(t){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(t))throw new Error(i.CollNameError);return!0},t.isDocID=function(t){if(!/^([a-fA-F0-9]){24}$/.test(t))throw new Error(i.DocIDError);return!0},t}(),it=function(){function t(t,e){rt.isGeopoint("longitude",t),rt.isGeopoint("latitude",e),this.longitude=t,this.latitude=e}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Point",coordinates:[this.longitude,this.latitude]},e},t.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},t.prototype.toReadableString=function(){return"["+this.longitude+","+this.latitude+"]"},t.validate=function(t){return"Point"===t.type&&q(t.coordinates)&&rt.isGeopoint("longitude",t.coordinates[0])&&rt.isGeopoint("latitude",t.coordinates[1])},Object.defineProperty(t.prototype,"_internalType",{get:function(){return N},enumerable:!0,configurable:!0}),t}(),ot=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var n=new Promise((function(e,n){t=function(t,r){return t?n(t):e(r)}}));return t.promise=n,t};!function(t){t.SET="set",t.REMOVE="remove",t.INC="inc",t.MUL="mul",t.PUSH="push",t.PULL="pull",t.PULL_ALL="pullAll",t.POP="pop",t.SHIFT="shift",t.UNSHIFT="unshift",t.ADD_TO_SET="addToSet",t.BIT="bit",t.RENAME="rename",t.MAX="max",t.MIN="min"}(tt||(tt={}));var st,at=function(){function t(t,e,n){this._internalType=O,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||T}return t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t}();function ut(t){return t&&t instanceof at&&t._internalType===O}!function(t){t.AND="and",t.OR="or",t.NOT="not",t.NOR="nor"}(st||(st={}));var ct=function(){function t(t,e,n){if(this._internalType=R,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||T,this.fieldName!==T)if(Array.isArray(e)){e=e.slice(),this.operands=e;for(var r=0,i=e.length;r<i;r++)(ht(o=e[r])||dt(o))&&(e[r]=o._setFieldName(this.fieldName))}else{var o;(ht(o=e)||dt(o))&&(e=o._setFieldName(this.fieldName))}}return t.prototype._setFieldName=function(e){var n=this.operands.map((function(n){return n instanceof t?n._setFieldName(e):n}));return new t(this.operator,n,e)},t.prototype.and=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return r.unshift(this),new t(st.AND,r,this.fieldName)},t.prototype.or=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return r.unshift(this),new t(st.OR,r,this.fieldName)},t}();function ht(t){return t&&t instanceof ct&&t._internalType===R}var ft,lt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t.EQ="eq",t.NEQ="neq",t.GT="gt",t.GTE="gte",t.LT="lt",t.LTE="lte",t.IN="in",t.NIN="nin",t.ALL="all",t.ELEM_MATCH="elemMatch",t.EXISTS="exists",t.SIZE="size",t.MOD="mod",t.GEO_NEAR="geoNear",t.GEO_WITHIN="geoWithin",t.GEO_INTERSECTS="geoIntersects"}(ft||(ft={}));var pt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.operator=e,i._internalType=A,i}return lt(e,t),e.prototype.toJSON=function(){var t,e;switch(this.operator){case ft.IN:case ft.NIN:return(t={})["$"+this.operator]=this.operands,t;default:return(e={})["$"+this.operator]=this.operands[0],e}},e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e.prototype.eq=function(t){var n=new e(ft.EQ,[t],this.fieldName);return this.and(n)},e.prototype.neq=function(t){var n=new e(ft.NEQ,[t],this.fieldName);return this.and(n)},e.prototype.gt=function(t){var n=new e(ft.GT,[t],this.fieldName);return this.and(n)},e.prototype.gte=function(t){var n=new e(ft.GTE,[t],this.fieldName);return this.and(n)},e.prototype.lt=function(t){var n=new e(ft.LT,[t],this.fieldName);return this.and(n)},e.prototype.lte=function(t){var n=new e(ft.LTE,[t],this.fieldName);return this.and(n)},e.prototype.in=function(t){var n=new e(ft.IN,t,this.fieldName);return this.and(n)},e.prototype.nin=function(t){var n=new e(ft.NIN,t,this.fieldName);return this.and(n)},e.prototype.geoNear=function(t){if(!(t.geometry instanceof it))throw new TypeError('"geometry" must be of type Point. Received type '+typeof t.geometry);if(void 0!==t.maxDistance&&!M(t.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof t.maxDistance);if(void 0!==t.minDistance&&!M(t.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof t.minDistance);var n=new e(ft.GEO_NEAR,[t],this.fieldName);return this.and(n)},e.prototype.geoWithin=function(t){if(!(t.geometry instanceof Z||t.geometry instanceof G))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof t.geometry);var n=new e(ft.GEO_WITHIN,[t],this.fieldName);return this.and(n)},e.prototype.geoIntersects=function(t){if(!(t.geometry instanceof it||t.geometry instanceof W||t.geometry instanceof G||t.geometry instanceof K||t.geometry instanceof Y||t.geometry instanceof Z))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof t.geometry);var n=new e(ft.GEO_INTERSECTS,[t],this.fieldName);return this.and(n)},e}(ct);function dt(t){return t&&t instanceof pt&&t._internalType===A}function yt(t){return dt(t)}var gt={};for(var vt in ft)gt[vt]="$"+vt;for(var vt in st)gt[vt]="$"+vt;for(var vt in tt)gt[vt]="$"+vt;function mt(t){return gt[t]||"$"+t}gt[ft.NEQ]="$ne",gt[tt.REMOVE]="$unset",gt[tt.SHIFT]="$pop",gt[tt.UNSHIFT]="$push";var bt=function(){return bt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},bt.apply(this,arguments)},wt=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Et=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(wt(arguments[e]));return t};function _t(t){return St(t,[t])}function St(t,e){if(!H(t)){if(V(t))return{$date:+t};if(F(t))return{$regex:t.source,$options:t.flags};if(q(t))return t.map((function(t){if(e.indexOf(t)>-1)throw new Error("Cannot convert circular structure to JSON");return St(t,Et(e,[t]))}));if(k(t)){var n=bt({},t);for(var r in n){if(e.indexOf(n[r])>-1)throw new Error("Cannot convert circular structure to JSON");n[r]=St(n[r],Et(e,[n[r]]))}return n}return t}switch(t._internalType){case N:return t.toJSON();case U:case j:return t.parse();default:return t.toJSON?t.toJSON():t}}var It=function(){return It=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},It.apply(this,arguments)},Tt=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Ot=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Tt(arguments[e]));return t};function At(t,e,n,r){var i=It({},t);for(var o in t)if(!/^\$/.test(o)){var s=t[o];if(s&&k(s)&&!e(s)){if(r.indexOf(s)>-1)throw new Error("Cannot convert circular structure to JSON");var a=At(s,e,Ot(n,[o]),Ot(r,[s]));i[o]=a;var u=!1;for(var c in a)/^\$/.test(c)?u=!0:(i[o+"."+c]=a[c],delete i[o][c]);u||delete i[o]}}return i}function Rt(t){return At(t,xt,[],[t])}function Nt(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?q(t[r])?t[r].push(e[r]):k(t[r])?k(e[r])?Object.assign(t[r],e[r]):(console.warn("unmergable condition, query is object but condition is "+B(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+B(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]}function xt(t){return H(t)||V(t)||F(t)}function Ct(t){return _t(t)}var Pt=function(){function t(){}return t.encode=function(e){return(new t).encodeUpdate(e)},t.prototype.encodeUpdate=function(t){return ut(t)?this.encodeUpdateCommand(t):"object"===B(t)?this.encodeUpdateObject(t):t},t.prototype.encodeUpdateCommand=function(t){if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");switch(t.operator){case tt.PUSH:case tt.PULL:case tt.PULL_ALL:case tt.POP:case tt.SHIFT:case tt.UNSHIFT:case tt.ADD_TO_SET:return this.encodeArrayUpdateCommand(t);default:return this.encodeFieldUpdateCommand(t)}},t.prototype.encodeFieldUpdateCommand=function(t){var e,n,r,i,o=mt(t.operator);return t.operator===tt.REMOVE?((e={})[o]=((n={})[t.fieldName]="",n),e):((r={})[o]=((i={})[t.fieldName]=t.operands[0],i),r)},t.prototype.encodeArrayUpdateCommand=function(t){var e,n,r,i,o,s,a,u,c,h,f=mt(t.operator);switch(t.operator){case tt.PUSH:var l=void 0;return l=q(t.operands)?{$each:t.operands.map(Ct)}:t.operands,(e={})[f]=((n={})[t.fieldName]=l,n),e;case tt.UNSHIFT:return l={$each:t.operands.map(Ct),$position:0},(r={})[f]=((i={})[t.fieldName]=l,i),r;case tt.POP:return(o={})[f]=((s={})[t.fieldName]=1,s),o;case tt.SHIFT:return(a={})[f]=((u={})[t.fieldName]=-1,u),a;default:return(c={})[f]=((h={})[t.fieldName]=Ct(t.operands),h),c}},t.prototype.encodeUpdateObject=function(t){var e=Rt(t);for(var n in e)if(!/^\$/.test(n)){var r=e[n];if(ut(r))e[n]=r._setFieldName(n),Nt(e,this.encodeUpdateCommand(e[n]),n);else{e[n]=r=Ct(r);var i=new at(tt.SET,[r],n);Nt(e,this.encodeUpdateCommand(i),n)}}return e},t}(),Dt={};function Lt(t){if(!Un.wsClientClass)throw new Error("to use realtime you must import realtime module first");var e=t.config.env;return Dt[e]||(Dt[e]=new Un.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new Un.reqClass(t.config)}}})),Dt[e]}for(var Ut=function(){return Ut=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ut.apply(this,arguments)},jt=function(){function t(t,e,n,r){var i=this;void 0===r&&(r={}),this.watch=function(t){return Lt(i._db).watch(Ut(Ut({},t),{envId:i._db.config.env,collectionName:i._coll,query:JSON.stringify({_id:i.id})}))},this._db=t,this._coll=e,this.id=n,this.request=new Un.reqClass(this._db.config),this.projection=r}return t.prototype.create=function(t,e){e=e||ot();var n={collectionName:this._coll,data:_t(t)};return this.id&&(n._id=this.id),this.request.send("database.addDocument",n).then((function(t){t.code?e(0,t):e(0,{id:t.data._id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.set=function(t,e){if(e=e||ot(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n=!1,r=function(t){if("object"==typeof t)for(var e in t)t[e]instanceof at?n=!0:"object"==typeof t[e]&&r(t[e])};if(r(t),n)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var i={collectionName:this._coll,queryType:a.DOC,data:_t(t),multi:!1,merge:!1,upsert:!0};return this.id&&(i.query={_id:this.id}),this.request.send("database.updateDocument",i).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.update=function(t,e){if(e=e||ot(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={_id:this.id},r={collectionName:this._coll,data:Pt.encode(t),query:n,queryType:a.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",r).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.remove=function(t){t=t||ot();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:a.DOC,multi:!1};return this.request.send("database.deleteDocument",n).then((function(e){e.code?t(0,e):t(0,{deleted:e.data.deleted,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},t.prototype.get=function(t){t=t||ot();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:a.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n=nt.formatResDocumentData(e.data.list);t(0,{data:n,requestId:e.requestId})}})).catch((function(e){t(e)})),t.promise},t.prototype.field=function(e){for(var n in e)e[n]?e[n]=1:e[n]=0;return new t(this._db,this._coll,this.id,e)},t}(),Bt=function(){function t(){}return t.encode=function(t){return(new kt).encodeQuery(t)},t}(),kt=function(){function t(){}return t.prototype.encodeQuery=function(t,e){var n;return xt(t)?ht(t)?this.encodeLogicCommand(t):dt(t)?this.encodeQueryCommand(t):((n={})[e]=this.encodeQueryObject(t),n):k(t)?this.encodeQueryObject(t):t},t.prototype.encodeRegExp=function(t){return{$regex:t.source,$options:t.flags}},t.prototype.encodeLogicCommand=function(t){var e,n,r,i,o,s,a,u=this;switch(t.operator){case st.NOR:case st.AND:case st.OR:var c=mt(t.operator),h=t.operands.map((function(e){return u.encodeQuery(e,t.fieldName)}));return(e={})[c]=h,e;case st.NOT:c=mt(t.operator);var f=t.operands[0];return F(f)?((n={})[t.fieldName]=((r={})[c]=this.encodeRegExp(f),r),n):(h=this.encodeQuery(f)[t.fieldName],(i={})[t.fieldName]=((o={})[c]=h,o),i);default:if(c=mt(t.operator),1===t.operands.length){var l=this.encodeQuery(t.operands[0]);return(s={})[c]=l,s}return h=t.operands.map(this.encodeQuery.bind(this)),(a={})[c]=h,a}},t.prototype.encodeQueryCommand=function(t){return yt(t),this.encodeComparisonCommand(t)},t.prototype.encodeComparisonCommand=function(t){var e,n,r,i,o,s,a,u,c;if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");var h=mt(t.operator);switch(t.operator){case ft.EQ:case ft.NEQ:case ft.LT:case ft.LTE:case ft.GT:case ft.GTE:case ft.ELEM_MATCH:case ft.EXISTS:case ft.SIZE:case ft.MOD:return(e={})[t.fieldName]=((n={})[h]=Ct(t.operands[0]),n),e;case ft.IN:case ft.NIN:case ft.ALL:return(r={})[t.fieldName]=((i={})[h]=Ct(t.operands),i),r;case ft.GEO_NEAR:var f=t.operands[0];return(o={})[t.fieldName]={$nearSphere:{$geometry:f.geometry.toJSON(),$maxDistance:f.maxDistance,$minDistance:f.minDistance}},o;case ft.GEO_WITHIN:return f=t.operands[0],(s={})[t.fieldName]={$geoWithin:{$geometry:f.geometry.toJSON()}},s;case ft.GEO_INTERSECTS:return f=t.operands[0],(a={})[t.fieldName]={$geoIntersects:{$geometry:f.geometry.toJSON()}},a;default:return(u={})[t.fieldName]=((c={})[h]=Ct(t.operands[0]),c),u}},t.prototype.encodeQueryObject=function(t){var e=Rt(t);for(var n in e){var r=e[n];if(ht(r)){e[n]=r._setFieldName(n);var i=this.encodeLogicCommand(e[n]);this.mergeConditionAfterEncode(e,i,n)}else yt(r)?(e[n]=r._setFieldName(n),i=this.encodeComparisonCommand(e[n]),this.mergeConditionAfterEncode(e,i,n)):xt(r)&&(e[n]=Ct(r))}return e},t.prototype.mergeConditionAfterEncode=function(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?q(t[r])?t[r]=t[r].concat(e[r]):k(t[r])?k(e[r])?Object.assign(t,e):(console.warn("unmergable condition, query is object but condition is "+B(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+B(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]},t}(),Mt=function(){return Mt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Mt.apply(this,arguments)},qt=function(){function t(t,e,n,r,i){var o=this;this.watch=function(t){return Lt(o._db).watch(Mt(Mt({},t),{envId:o._db.config.env,collectionName:o._coll,query:JSON.stringify(o._fieldFilters||{}),limit:o._queryOptions.limit,orderBy:o._fieldOrders?o._fieldOrders.reduce((function(t,e){return t[e.field]=e.direction,t}),{}):void 0}))},this._db=t,this._coll=e,this._fieldFilters=n,this._fieldOrders=r||[],this._queryOptions=i||{},this._request=new Un.reqClass(this._db.config)}return t.prototype.get=function(t){t=t||ot();var e=[];this._fieldOrders&&this._fieldOrders.forEach((function(t){e.push(t)}));var n={collectionName:this._coll,queryType:a.WHERE};return this._fieldFilters&&(n.query=this._fieldFilters),e.length>0&&(n.order=e),this._queryOptions.offset&&(n.offset=this._queryOptions.offset),this._queryOptions.limit?n.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:n.limit=100,this._queryOptions.projection&&(n.projection=this._queryOptions.projection),this._request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n={data:nt.formatResDocumentData(e.data.list),requestId:e.requestId};e.total&&(n.total=e.total),e.limit&&(n.limit=e.limit),e.offset&&(n.offset=e.offset),t(0,n)}})).catch((function(e){t(e)})),t.promise},t.prototype.count=function(t){t=t||ot();var e={collectionName:this._coll,queryType:a.WHERE};return this._fieldFilters&&(e.query=this._fieldFilters),this._request.send("database.countDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,total:e.data.total})})).catch((function(e){t(e)})),t.promise},t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(i.QueryParamTypeError);var n=Object.keys(e),r=n.some((function(t){return void 0!==e[t]}));if(n.length&&!r)throw Error(i.QueryParamValueError);return new t(this._db,this._coll,Bt.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,n){rt.isFieldPath(e),rt.isFieldOrder(n);var r={field:e,direction:n},i=this._fieldOrders.concat(r);return new t(this._db,this._coll,this._fieldFilters,i,this._queryOptions)},t.prototype.limit=function(e){rt.isInteger("limit",e);var n=Mt({},this._queryOptions);return n.limit=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.skip=function(e){rt.isInteger("offset",e);var n=Mt({},this._queryOptions);return n.offset=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.update=function(t,e){if(e=e||ot(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={collectionName:this._coll,query:this._fieldFilters,queryType:a.WHERE,multi:!0,merge:!0,upsert:!1,data:Pt.encode(t)};return this._request.send("database.updateDocument",n).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,updated:t.data.updated,upsertId:t.data.upsert_id})})).catch((function(t){e(t)})),e.promise},t.prototype.field=function(e){for(var n in e)e[n]?"object"!=typeof e[n]&&(e[n]=1):e[n]=0;var r=Mt({},this._queryOptions);return r.projection=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.remove=function(t){t=t||ot(),Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation");var e={collectionName:this._coll,query:Bt.encode(this._fieldFilters),queryType:a.WHERE,multi:!0};return this._request.send("database.deleteDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,deleted:e.data.deleted})})).catch((function(e){t(e)})),t.promise},t}(),Vt=[],Ft=[],Ht="undefined"!=typeof Uint8Array?Uint8Array:Array,Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$t=0,Gt=Wt.length;$t<Gt;++$t)Vt[$t]=Wt[$t],Ft[Wt.charCodeAt($t)]=$t;function Kt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function Jt(t,e,n){for(var r,i,o=[],s=e;s<n;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(Vt[(i=r)>>18&63]+Vt[i>>12&63]+Vt[i>>6&63]+Vt[63&i]);return o.join("")}Ft["-".charCodeAt(0)]=62,Ft["_".charCodeAt(0)]=63;var Yt=function(t){var e,n,r=Kt(t),i=r[0],o=r[1],s=new Ht(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)e=Ft[t.charCodeAt(n)]<<18|Ft[t.charCodeAt(n+1)]<<12|Ft[t.charCodeAt(n+2)]<<6|Ft[t.charCodeAt(n+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=Ft[t.charCodeAt(n)]<<2|Ft[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=Ft[t.charCodeAt(n)]<<10|Ft[t.charCodeAt(n+1)]<<4|Ft[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},zt=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(Jt(t,s,s+o>a?a:s+o));return 1===r?(e=t[n-1],i.push(Vt[e>>2]+Vt[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(Vt[e>>10]+Vt[e>>4&63]+Vt[e<<2&63]+"=")),i.join("")},Zt=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,h=-7,f=n?i-1:0,l=n?-1:1,p=t[e+f];for(f+=l,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+f],f+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+f],f+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},Qt=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,f=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=h?(a=0,s=h):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+p]=255&s,p+=d,s/=256,c-=8);t[n+p-d]|=128*y},Xt=function(t,e){return function(t,e){var n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50;var r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,n)}function s(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|l(t,e),r=i(n),s=r.write(t,e);return s!==n&&(r=r.slice(0,s)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(k(t,Uint8Array)){var e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(k(t,ArrayBuffer)||t&&k(t.buffer,ArrayBuffer))return h(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(k(t,SharedArrayBuffer)||t&&k(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);var s=function(t){if(o.isBuffer(t)){var e=0|f(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||M(t.length)?i(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return a(t),i(t<0?0:0|f(t))}function c(t){for(var e=t.length<0?0:0|f(t.length),n=i(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,o.prototype),r}function f(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function l(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||k(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(t).length;default:if(i)return r?-1:U(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return _(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),M(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){var o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){f=!1;break}if(f)return o}return-1}function v(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(M(a))return s;t[n+s]=a}return s}function m(t,e,n,r){return B(U(e,t.length-n),t,n,r)}function b(t,e,n,r){return B(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function w(t,e,n,r){return B(j(e),t,n,r)}function E(t,e,n,r){return B(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function _(t,e,n){return 0===e&&n===t.length?zt(t):zt(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,u,c=t[i],h=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,f=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=f}return function(t){var e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=I));return n}(r)}e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,n){return s(t,e,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,n){return function(t,e,n){return a(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}(t,e,n)},o.allocUnsafe=function(t){return u(t)},o.allocUnsafeSlow=function(t){return u(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(k(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),k(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=o.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(k(s,Uint8Array))i+s.length>r.length?o.from(s).copy(r,i):Uint8Array.prototype.set.call(r,s,i);else{if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i)}i+=s.length}return r},o.byteLength=l,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(k(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(s,a),c=this.slice(r,i),h=t.slice(e,n),f=0;f<u;++f)if(c[f]!==h[f]){s=c[f],a=h[f];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return m(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return w(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function A(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=q[t[o]];return i}function R(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function N(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,r,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function C(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,i){return e=+e,n>>>=0,i||C(t,0,n,4),Qt(t,e,n,r,23,4),n+4}function D(t,e,n,r,i){return e=+e,n>>>=0,i||C(t,0,n,8),Qt(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||N(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||N(t,4,this.length),Zt(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),Zt(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),Zt(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),Zt(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var i=t.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=o.isBuffer(t)?t:o.from(t,r),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var L=/[^+/0-9A-Za-z-_]/g;function U(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function j(t){return Yt(function(t){if((t=(t=t.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function B(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function k(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function M(t){return t!=t}var q=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)e[r+i]=t[n]+t[i];return e}()}(e={exports:{}},e.exports),e.exports}(),te=Xt.Buffer;Xt.SlowBuffer,Xt.INSPECT_MAX_BYTES,Xt.kMaxLength;var ee=function(t,e){return ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ee(t,e)};function ne(t,e){function n(){this.constructor=t}ee(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var re=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return ne(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),ie=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return ne(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function oe(t){return t&&t.Math==Math&&t}function se(){return oe("object"==typeof globalThis&&globalThis)||oe("object"==typeof window&&window)||oe("object"==typeof self&&self)||oe("object"==typeof n.g&&n.g)||Function("return this")()}var ae=function(t){var e,n="object"==typeof(e=se()).navigator&&"ReactNative"===e.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(n);for(var r=te.alloc(t),i=0;i<t;++i)r[i]=Math.floor(256*Math.random());return r},ue=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(te.alloc(e))}}return void 0!==n.g&&n.g.crypto&&n.g.crypto.getRandomValues?function(t){return n.g.crypto.getRandomValues(te.alloc(t))}:ae}();function ce(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function he(t){return"object"==typeof t&&null!==t}function fe(t,e){var n=!1;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return n||(console.warn(e),n=!0),t.apply(this,r)}}function le(t){if(ArrayBuffer.isView(t))return te.from(t.buffer,t.byteOffset,t.byteLength);if(e=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e)))return te.from(t);var e;throw new ie("Must use either Buffer or TypedArray")}var pe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,de=function(t){return"string"==typeof t&&pe.test(t)},ye=function(t){if(!de(t))throw new ie('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return te.from(e,"hex")},ge=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},ve=(Math.pow(2,63),Math.pow(2,63),Math.pow(2,53)),me=-Math.pow(2,53),be=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new ie("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=te.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=te.from(e,"binary"):Array.isArray(e)?this.buffer=te.from(e):this.buffer=le(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new ie("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new ie("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||n>255)throw new ie("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var r=te.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=n}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var n=te.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(le(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===n.length?"0"+n:n}:{$binary:{base64:e,subType:1===n.length?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new we(this.buffer.slice(0,this.position));throw new re('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,n){var r,i;if(n=n||{},"$binary"in e?n.legacy&&"string"==typeof e.$binary&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,r=te.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=te.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,r=ye(e.$uuid)),!r)throw new ie("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return 4===i?new we(r):new t(r,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(be.prototype,"_bsontype",{value:"Binary"});var we=function(t){function e(n){var r,i,o=this;if(null==n)r=e.generate();else if(n instanceof e)r=te.from(n.buffer),i=n.__id;else if(ArrayBuffer.isView(n)&&16===n.byteLength)r=le(n);else{if("string"!=typeof n)throw new ie("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");r=ye(n)}return(o=t.call(this,r,4)||this).__id=i,o}return ne(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(t){this.buffer=t,e.cacheHexString&&(this.__id=ge(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=ge(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(t){return!1}},e.prototype.toBinary=function(){return new be(this.id,be.SUBTYPE_UUID)},e.generate=function(){var t=ue(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,te.from(t)},e.isValid=function(t){return!!t&&(t instanceof e||("string"==typeof t?de(t):!!ce(t)&&16===t.length&&64==(240&t[6])&&128==(128&t[8])))},e.createFromHexString=function(t){return new e(ye(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(be),Ee=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);this.code=e,this.scope=n}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},t}();Object.defineProperty(Ee.prototype,"_bsontype",{value:"Code"});var _e=function(){function t(e,n,r,i){if(!(this instanceof t))return new t(e,n,r,i);var o=e.split(".");2===o.length&&(r=o.shift(),e=o.shift()),this.collection=e,this.oid=n,this.db=r,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var n=Object.assign({},e);return delete n.$ref,delete n.$id,delete n.$db,new t(e.$ref,e.$id,e.$db,n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(_e.prototype,"_bsontype",{value:"DBRef"});var Se=void 0;try{Se=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(r){}var Ie=4294967296,Te=0x10000000000000000,Oe=Te/2,Ae={},Re={},Ne=function(){function t(e,n,r){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,n,r);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!n)):"string"==typeof e?Object.assign(this,t.fromString(e,!!n)):(this.low=0|e,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,n,r){return new t(e,n,r)},t.fromInt=function(e,n){var r,i,o;return n?(o=0<=(e>>>=0)&&e<256)&&(i=Re[e])?i:(r=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(Re[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=Ae[e])?i:(r=t.fromBits(e,e<0?-1:0,!1),o&&(Ae[e]=r),r)},t.fromNumber=function(e,n){if(isNaN(e))return n?t.UZERO:t.ZERO;if(n){if(e<0)return t.UZERO;if(e>=Te)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Oe)return t.MIN_VALUE;if(e+1>=Oe)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%Ie|0,e/Ie|0,n)},t.fromBigInt=function(e,n){return t.fromString(e.toString(),n)},t.fromString=function(e,n,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return t.fromString(e.substring(1),n,r).neg();for(var o=t.fromNumber(Math.pow(r,8)),s=t.ZERO,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+u),r);if(u<8){var h=t.fromNumber(Math.pow(r,u));s=s.mul(h).add(t.fromNumber(c))}else s=(s=s.mul(o)).add(t.fromNumber(c))}return s.unsigned=n,s},t.fromBytes=function(e,n,r){return r?t.fromBytesLE(e,n):t.fromBytesBE(e,n)},t.fromBytesLE=function(e,n){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)},t.fromBytesBE=function(e,n){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)},t.isLong=function(t){return he(t)&&!0===t.__isLong__},t.fromValue=function(e,n){return"number"==typeof e?t.fromNumber(e,n):"string"==typeof e?t.fromString(e,n):t.fromBits(e.low,e.high,"boolean"==typeof n?n:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,h=0,f=0,l=0;return f+=(l+=o+(65535&e.low))>>>16,l&=65535,h+=(f+=i+u)>>>16,f&=65535,c+=(h+=r+a)>>>16,h&=65535,c+=n+s,c&=65535,t.fromBits(f<<16|l,c<<16|h,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Se){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?Se.div_u:Se.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Se.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var r,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(r=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(r)),o=r.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),u=t.fromNumber(r),c=u.mul(e);c.isNegative()||c.gt(i);)r-=a,c=(u=t.fromNumber(r,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),o=o.add(u),i=i.sub(c)}return o},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,n=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(n&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Se){var n=(this.unsigned?Se.rem_u:Se.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Se.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Se){var n=Se.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,Se.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=65535&e.high,c=e.low>>>16,h=65535&e.low,f=0,l=0,p=0,d=0;return p+=(d+=s*h)>>>16,d&=65535,l+=(p+=o*h)>>>16,p&=65535,l+=(p+=s*c)>>>16,p&=65535,f+=(l+=i*h)>>>16,l&=65535,f+=(l+=o*c)>>>16,l&=65535,f+=(l+=s*u)>>>16,l&=65535,f+=r*h+i*c+o*u+s*a,f&=65535,t.fromBits(p<<16|d,f<<16|l,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0==(e&=63))return this;var n=this.high;if(e<32){var r=this.low;return t.fromBits(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?t.fromBits(n,0,this.unsigned):t.fromBits(n>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Ie+(this.low>>>0):this.high*Ie+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var n=t.fromNumber(e),r=this.div(n),i=r.mul(n).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var u=s.div(o),c=(s.sub(u.mul(o)).toInt()>>>0).toString(e);if((s=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,n){var r=t.fromString(e.$numberLong);return n&&n.relaxed?r.toNumber():r},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(16777216),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Ne.prototype,"__isLong__",{value:!0}),Object.defineProperty(Ne.prototype,"_bsontype",{value:"Long"});var xe=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Ce=/^(\+|-)?(Infinity|inf)$/i,Pe=/^(\+|-)?NaN$/i,De=6111,Le=-6176,Ue=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),je=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Be=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ke=/^([-+])?(\d+)?$/;function Me(t){return!isNaN(parseInt(t,10))}function qe(t){var e=Ne.fromNumber(1e9),n=Ne.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new Ne(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function Ve(t,e){throw new ie('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Fe=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!ce(e))throw new ie("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new ie("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}}return t.fromString=function(e){var n,r=!1,i=!1,o=!1,s=0,a=0,u=0,c=0,h=0,f=[0],l=0,p=0,d=0,y=0,g=0,v=0,m=new Ne(0,0),b=new Ne(0,0),w=0;if(e.length>=7e3)throw new ie(e+" not a valid Decimal128 string");var E=e.match(xe),_=e.match(Ce),S=e.match(Pe);if(!E&&!_&&!S||0===e.length)throw new ie(e+" not a valid Decimal128 string");if(E){var I=E[2],T=E[4],O=E[5],A=E[6];T&&void 0===A&&Ve(e,"missing exponent power"),T&&void 0===I&&Ve(e,"missing exponent base"),void 0===T&&(O||A)&&Ve(e,"missing e before exponent")}if("+"!==e[w]&&"-"!==e[w]||(r="-"===e[w++]),!Me(e[w])&&"."!==e[w]){if("i"===e[w]||"I"===e[w])return new t(te.from(r?je:Be));if("N"===e[w])return new t(te.from(Ue))}for(;Me(e[w])||"."===e[w];)"."!==e[w]?(l<34&&("0"!==e[w]||o)&&(o||(h=a),o=!0,f[p++]=parseInt(e[w],10),l+=1),o&&(u+=1),i&&(c+=1),a+=1,w+=1):(i&&Ve(e,"contains multiple periods"),i=!0,w+=1);if(i&&!a)throw new ie(e+" not a valid Decimal128 string");if("e"===e[w]||"E"===e[w]){var R=e.substr(++w).match(ke);if(!R||!R[2])return new t(te.from(Ue));g=parseInt(R[0],10),w+=R[0].length}if(e[w])return new t(te.from(Ue));if(d=0,l){if(y=l-1,1!==(s=u))for(;0===f[h+s-1];)s-=1}else d=0,y=0,f[0]=0,u=1,l=1,s=0;for(g<=c&&c-g>16384?g=Le:g-=c;g>De;){if((y+=1)-d>34){if(f.join("").match(/^0+$/)){g=De;break}Ve(e,"overflow")}g-=1}for(;g<Le||l<u;){if(0===y&&s<l){g=Le,s=0;break}if(l<u?u-=1:y-=1,g<De)g+=1;else{if(f.join("").match(/^0+$/)){g=De;break}Ve(e,"overflow")}}if(y-d+1<s){var N=a;i&&(h+=1,N+=1),r&&(h+=1,N+=1);var x=parseInt(e[h+y+1],10),C=0;if(x>=5&&(C=1,5===x))for(C=f[y]%2==1?1:0,v=h+y+2;v<N;v++)if(parseInt(e[v],10)){C=1;break}if(C)for(var P=y;P>=0;P--)if(++f[P]>9&&(f[P]=0,0===P)){if(!(g<De))return new t(te.from(r?je:Be));g+=1,f[P]=1}}if(m=Ne.fromNumber(0),b=Ne.fromNumber(0),0===s)m=Ne.fromNumber(0),b=Ne.fromNumber(0);else if(y-d<17)for(P=d,b=Ne.fromNumber(f[P++]),m=new Ne(0,0);P<=y;P++)b=(b=b.multiply(Ne.fromNumber(10))).add(Ne.fromNumber(f[P]));else{for(P=d,m=Ne.fromNumber(f[P++]);P<=y-17;P++)m=(m=m.multiply(Ne.fromNumber(10))).add(Ne.fromNumber(f[P]));for(b=Ne.fromNumber(f[P++]);P<=y;P++)b=(b=b.multiply(Ne.fromNumber(10))).add(Ne.fromNumber(f[P]))}var D,L,U,j,B=function(t,e){if(!t&&!e)return{high:Ne.fromNumber(0),low:Ne.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new Ne(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new Ne(e.getLowBits(),0),s=n.multiply(i),a=n.multiply(o),u=r.multiply(i),c=r.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new Ne(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new Ne(c.getLowBits(),0))}}(m,Ne.fromString("100000000000000000"));B.low=B.low.add(b),L=b,((U=(D=B.low).high>>>0)<(j=L.high>>>0)||U===j&&D.low>>>0<L.low>>>0)&&(B.high=B.high.add(Ne.fromNumber(1))),n=g+6176;var k={low:Ne.fromNumber(0),high:Ne.fromNumber(0)};B.high.shiftRightUnsigned(49).and(Ne.fromNumber(1)).equals(Ne.fromNumber(1))?(k.high=k.high.or(Ne.fromNumber(3).shiftLeft(61)),k.high=k.high.or(Ne.fromNumber(n).and(Ne.fromNumber(16383).shiftLeft(47))),k.high=k.high.or(B.high.and(Ne.fromNumber(0x7fffffffffff)))):(k.high=k.high.or(Ne.fromNumber(16383&n).shiftLeft(49)),k.high=k.high.or(B.high.and(Ne.fromNumber(562949953421311)))),k.low=B.low,r&&(k.high=k.high.or(Ne.fromString("9223372036854775808")));var M=te.alloc(16);return w=0,M[w++]=255&k.low.low,M[w++]=k.low.low>>8&255,M[w++]=k.low.low>>16&255,M[w++]=k.low.low>>24&255,M[w++]=255&k.low.high,M[w++]=k.low.high>>8&255,M[w++]=k.low.high>>16&255,M[w++]=k.low.high>>24&255,M[w++]=255&k.high.low,M[w++]=k.high.low>>8&255,M[w++]=k.high.low>>16&255,M[w++]=k.high.low>>24&255,M[w++]=255&k.high.high,M[w++]=k.high.high>>8&255,M[w++]=k.high.high>>16&255,M[w++]=k.high.high>>24&255,new t(M)},t.prototype.toString=function(){for(var t,e=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var i,o,s,a=0,u=!1,c={parts:[0,0,0,0]},h=[];a=0;var f=this.bytes,l=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,p=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,d=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,y=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24;a=0,(new Ne(l,p),new Ne(d,y)).lessThan(Ne.ZERO)&&h.push("-");var g=y>>26&31;if(g>>3==3){if(30===g)return h.join("")+"Infinity";if(31===g)return"NaN";t=y>>15&16383,i=8+(y>>14&1)}else i=y>>14&7,t=y>>17&16383;var v=t-6176;if(c.parts[0]=(16383&y)+((15&i)<<14),c.parts[1]=d,c.parts[2]=p,c.parts[3]=l,0===c.parts[0]&&0===c.parts[1]&&0===c.parts[2]&&0===c.parts[3])u=!0;else for(s=3;s>=0;s--){var m=0,b=qe(c);if(c=b.quotient,m=b.rem.low)for(o=8;o>=0;o--)n[9*s+o]=m%10,m=Math.floor(m/10)}if(u)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var w=e-1+v;if(w>=34||w<=-7||v>0){if(e>34)return h.push("".concat(0)),v>0?h.push("E+".concat(v)):v<0&&h.push("E".concat(v)),h.join("");for(h.push("".concat(n[a++])),(e-=1)&&h.push("."),r=0;r<e;r++)h.push("".concat(n[a++]));h.push("E"),w>0?h.push("+".concat(w)):h.push("".concat(w))}else if(v>=0)for(r=0;r<e;r++)h.push("".concat(n[a++]));else{var E=e+v;if(E>0)for(r=0;r<E;r++)h.push("".concat(n[a++]));else h.push("0");for(h.push(".");E++<0;)h.push("0");for(r=0;r<e-Math.max(E-1,0);r++)h.push("".concat(n[a++]))}return h.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Fe.prototype,"_bsontype",{value:"Decimal128"});var He=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,n){var r=parseFloat(e.$numberDouble);return n&&n.relaxed?r:new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},t}();Object.defineProperty(He.prototype,"_bsontype",{value:"Double"});var We=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,n){return n&&n.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(We.prototype,"_bsontype",{value:"Int32"});var $e=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty($e.prototype,"_bsontype",{value:"MaxKey"});var Ge=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Ge.prototype,"_bsontype",{value:"MinKey"});var Ke=new RegExp("^[0-9a-fA-F]{24}$"),Je=null,Ye=Symbol("id"),ze=function(){function t(e){if(!(this instanceof t))return new t(e);var n;if("object"==typeof e&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new ie("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?te.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[Ye]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Ye]=n instanceof te?n:le(n);else{if("string"!=typeof n)throw new ie("Argument passed in does not match the accepted types");if(12===n.length){var r=te.from(n);if(12!==r.byteLength)throw new ie("Argument passed in must be a string of 12 bytes");this[Ye]=r}else{if(24!==n.length||!Ke.test(n))throw new ie("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Ye]=te.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Ye]},set:function(e){this[Ye]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var n=t.getInc(),r=te.alloc(12);return r.writeUInt32BE(e,0),null===Je&&(Je=ue(5)),r[4]=Je[0],r[5]=Je[1],r[6]=Je[2],r[7]=Je[3],r[8]=Je[4],r[11]=255&n,r[10]=n>>8&255,r[9]=n>>16&255,r},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(null==e)return!1;if(e instanceof t)return this[Ye][11]===e[Ye][11]&&this[Ye].equals(e[Ye]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&ce(this.id))return e===te.prototype.toString.call(this.id,"latin1");if("string"==typeof e&&t.isValid(e)&&24===e.length)return e.toLowerCase()===this.toHexString();if("string"==typeof e&&t.isValid(e)&&12===e.length)return te.from(e).equals(this.id);if("object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString){var n=e.toHexString(),r=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===r}return!1},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var n=te.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(e,0),new t(n)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new ie("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(te.from(e,"hex"))},t.isValid=function(e){if(null==e)return!1;try{return new t(e),!0}catch(t){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(ze.prototype,"generate",{value:fe((function(t){return ze.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(ze.prototype,"getInc",{value:fe((function(){return ze.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ze.prototype,"get_inc",{value:fe((function(){return ze.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ze,"get_inc",{value:fe((function(){return ze.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ze.prototype,"_bsontype",{value:"ObjectID"});var Ze=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(this.pattern=e,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new re("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new re("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new re("The regular expression option [".concat(this.options[r],"] is not supported"))}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new ie("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Ze.prototype,"_bsontype",{value:"BSONRegExp"});var Qe=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(Qe.prototype,"_bsontype",{value:"Symbol"});var Xe=function(t){function e(n,r){var i=this;return i instanceof e?(i=Ne.isLong(n)?t.call(this,n.low,n.high,!0)||this:he(n)&&void 0!==n.t&&void 0!==n.i?t.call(this,n.i,n.t,!0)||this:t.call(this,n,r,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(n,r)}return ne(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(Ne.fromInt(t,!0))},e.fromNumber=function(t){return new e(Ne.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(Ne.fromString(t,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=Ne.MAX_UNSIGNED_VALUE,e}(Ne);var tn=2147483647,en=-2147483648,nn=0x8000000000000000,rn=-0x8000000000000000,on={$oid:ze,$binary:be,$uuid:be,$symbol:Qe,$numberInt:We,$numberDecimal:Fe,$numberDouble:He,$numberLong:Ne,$minKey:Ge,$maxKey:$e,$regex:Ze,$regularExpression:Ze,$timestamp:Xe};function sn(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=en&&t<=tn)return new We(t);if(t>=rn&&t<=nn)return Ne.fromNumber(t)}return new He(t)}if(null==t||"object"!=typeof t)return t;if(t.$undefined)return null;for(var n=Object.keys(t).filter((function(e){return e.startsWith("$")&&null!=t[e]})),r=0;r<n.length;r++){var i=on[n[r]];if(i)return i.fromExtendedJSON(t,e)}if(null!=t.$date){var o=t.$date,s=new Date;return e.legacy?"number"==typeof o?s.setTime(o):"string"==typeof o&&s.setTime(Date.parse(o)):"string"==typeof o?s.setTime(Date.parse(o)):Ne.isLong(o)?s.setTime(o.toNumber()):"number"==typeof o&&e.relaxed&&s.setTime(o),s}if(null!=t.$code){var a=Object.assign({},t);return t.$scope&&(a.$scope=sn(t.$scope)),Ee.fromExtendedJSON(t)}if(function(t){return he(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof _e)return u;var c=Object.keys(u).filter((function(t){return t.startsWith("$")})),h=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(h=!1)})),h)return _e.fromExtendedJSON(u)}return t}function an(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function un(t,e){if(("object"==typeof t||"function"==typeof t)&&null!==t){var n=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==n){var r=e.seenObjects.map((function(t){return t.propertyName})),i=r.slice(0,n).map((function(t){return"".concat(t," -> ")})).join(""),o=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(t){return"".concat(t," -> ")})).join(""),a=r[r.length-1],u=" ".repeat(i.length+o.length/2),c="-".repeat(s.length+(o.length+a.length)/2-1);throw new ie("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(u,"\\").concat(c,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return un(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||he(l=t)&&"[object Date]"===Object.prototype.toString.call(l)){var h=t.getTime(),f=h>-1&&h<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:an(t)}:e.relaxed&&f?{$date:an(t)}:{$date:{$numberLong:t.getTime().toString()}}}var l;if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var p=t>=rn&&t<=nn;if(t>=en&&t<=tn)return{$numberInt:t.toString()};if(p)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(t)){var d=t.flags;if(void 0===d){var y=t.toString().match(/[gimuy]*$/);y&&(d=y[0])}return new Ze(t.source,d).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new re("not an object instance");var n=t._bsontype;if(void 0===n){var r={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=un(t[i],e);"__proto__"===i?Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):r[i]=o}finally{e.seenObjects.pop()}}return r}if(function(t){return he(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=hn[t._bsontype];if(!a)throw new ie("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new Ee(s.code,un(s.scope,e)):"DBRef"===n&&s.oid&&(s=new _e(un(s.collection,e),un(s.oid,e),un(s.db,e),un(s.fields,e))),s.toExtendedJSON(e)}throw new re("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var cn,hn={Binary:function(t){return new be(t.value(),t.sub_type)},Code:function(t){return new Ee(t.code,t.scope)},DBRef:function(t){return new _e(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Fe(t.bytes)},Double:function(t){return new He(t.value)},Int32:function(t){return new We(t.value)},Long:function(t){return Ne.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new $e},MinKey:function(){return new Ge},ObjectID:function(t){return new ze(t)},ObjectId:function(t){return new ze(t)},BSONRegExp:function(t){return new Ze(t.pattern,t.options)},Symbol:function(t){return new Qe(t.value)},Timestamp:function(t){return Xe.fromBits(t.low,t.high)}};!function(t){function e(t,e){var n=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new re("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return sn(e,n)}))}function n(t,e,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==e||"object"!=typeof e||Array.isArray(e)||(r=e,e=void 0,n=0);var i=un(t,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(i,e,n)}t.parse=e,t.stringify=n,t.serialize=function(t,e){return e=e||{},JSON.parse(n(t,e))},t.deserialize=function(t,n){return n=n||{},e(JSON.stringify(t),n)}}(cn||(cn={}));var fn=se();fn.Map?fn.Map:function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var n=t[e],r=n[0],i=n[1];this._keys.push(r),this._values[r]={v:i,i:this._keys.length-1}}}t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?[n,t._values[n].v]:void 0,done:void 0===n}}}},t.prototype.forEach=function(t,e){e=e||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];t.call(e,this._values[r].v,r,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?t._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}(),Ne.fromNumber(ve),Ne.fromNumber(me),new Set(["$db","$ref","$id","$clusterTime"]);var ln=new Uint8Array(8);new DataView(ln.buffer,ln.byteOffset,ln.byteLength);te.alloc(17825792);var pn=function(){function t(t,e){this._stages=[],t&&e&&(this._db=t,this._request=new Un.reqClass(this._db.config),this._collectionName=e)}return t.prototype.end=function(){return t=this,e=void 0,r=function(){var t;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(e){switch(e.label){case 0:if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");return[4,this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages})];case 1:return(t=e.sent())&&t.data&&t.data.list?[2,{requestId:t.requestId,data:JSON.parse(t.data.list).map(cn.parse)}]:[2,t]}}))},new((n=void 0)||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}));var t,e,n,r},t.prototype.unwrap=function(){return this._stages},t.prototype.done=function(){return this._stages.map((function(t){var e,n=t.stageKey,r=t.stageValue;return(e={})[n]=JSON.parse(r),e}))},t.prototype._pipe=function(t,e){return this._stages.push({stageKey:"$"+t,stageValue:JSON.stringify(e)}),this},t.prototype.addFields=function(t){return this._pipe("addFields",t)},t.prototype.bucket=function(t){return this._pipe("bucket",t)},t.prototype.bucketAuto=function(t){return this._pipe("bucketAuto",t)},t.prototype.count=function(t){return this._pipe("count",t)},t.prototype.geoNear=function(t){return t.query&&(t.query=Bt.encode(t.query)),t.distanceMultiplier&&"number"==typeof t.distanceMultiplier&&(t.distanceMultiplier=t.distanceMultiplier),t.near&&(t.near=new it(t.near.longitude,t.near.latitude).toJSON()),this._pipe("geoNear",t)},t.prototype.group=function(t){return this._pipe("group",t)},t.prototype.limit=function(t){return this._pipe("limit",t)},t.prototype.match=function(t){return this._pipe("match",Bt.encode(t))},t.prototype.project=function(t){return this._pipe("project",t)},t.prototype.lookup=function(t){return this._pipe("lookup",t)},t.prototype.replaceRoot=function(t){return this._pipe("replaceRoot",t)},t.prototype.sample=function(t){return this._pipe("sample",t)},t.prototype.skip=function(t){return this._pipe("skip",t)},t.prototype.sort=function(t){return this._pipe("sort",t)},t.prototype.sortByCount=function(t){return this._pipe("sortByCount",t)},t.prototype.unwind=function(t){return this._pipe("unwind",t)},t}(),dn=pn,yn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),gn=function(t){function e(e,n){return t.call(this,e,n)||this}return yn(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new jt(this._db,this._coll,t)},e.prototype.add=function(t,e){return new jt(this._db,this._coll,void 0).create(t,e)},e.prototype.aggregate=function(){return new dn(this._db,this._coll)},e}(qt),vn={eq:function(t){return new pt(ft.EQ,[t])},neq:function(t){return new pt(ft.NEQ,[t])},lt:function(t){return new pt(ft.LT,[t])},lte:function(t){return new pt(ft.LTE,[t])},gt:function(t){return new pt(ft.GT,[t])},gte:function(t){return new pt(ft.GTE,[t])},in:function(t){return new pt(ft.IN,t)},nin:function(t){return new pt(ft.NIN,t)},all:function(t){return new pt(ft.ALL,t)},elemMatch:function(t){return new pt(ft.ELEM_MATCH,[t])},exists:function(t){return new pt(ft.EXISTS,[t])},size:function(t){return new pt(ft.SIZE,[t])},mod:function(t){return new pt(ft.MOD,[t])},geoNear:function(t){return new pt(ft.GEO_NEAR,[t])},geoWithin:function(t){return new pt(ft.GEO_WITHIN,[t])},geoIntersects:function(t){return new pt(ft.GEO_INTERSECTS,[t])},and:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.AND,n)},nor:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.NOR,n)},or:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.OR,n)},not:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.NOT,n)},set:function(t){return new at(tt.SET,[t])},remove:function(){return new at(tt.REMOVE,[])},inc:function(t){return new at(tt.INC,[t])},mul:function(t){return new at(tt.MUL,[t])},push:function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(k(e[0])&&e[0].hasOwnProperty("each")){var r=e[0];t={$each:r.each,$position:r.position,$sort:r.sort,$slice:r.slice}}else t=q(e[0])?e[0]:Array.from(e);return new at(tt.PUSH,t)},pull:function(t){return new at(tt.PULL,t)},pullAll:function(t){return new at(tt.PULL_ALL,t)},pop:function(){return new at(tt.POP,[])},shift:function(){return new at(tt.SHIFT,[])},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new at(tt.UNSHIFT,n)},addToSet:function(t){return new at(tt.ADD_TO_SET,t)},rename:function(t){return new at(tt.RENAME,[t])},bit:function(t){return new at(tt.BIT,[t])},max:function(t){return new at(tt.MAX,[t])},min:function(t){return new at(tt.MIN,[t])},expr:function(t){return{$expr:t}},jsonSchema:function(t){return{$jsonSchema:t}},text:function(t){return"string"===B(t)?{$search:t.search}:{$search:t.search,$language:t.language,$caseSensitive:t.caseSensitive,$diacriticSensitive:t.diacriticSensitive}},aggregate:{pipeline:function(){return new dn},abs:function(t){return new mn("abs",t)},add:function(t){return new mn("add",t)},ceil:function(t){return new mn("ceil",t)},divide:function(t){return new mn("divide",t)},exp:function(t){return new mn("exp",t)},floor:function(t){return new mn("floor",t)},ln:function(t){return new mn("ln",t)},log:function(t){return new mn("log",t)},log10:function(t){return new mn("log10",t)},mod:function(t){return new mn("mod",t)},multiply:function(t){return new mn("multiply",t)},pow:function(t){return new mn("pow",t)},sqrt:function(t){return new mn("sqrt",t)},subtract:function(t){return new mn("subtract",t)},trunc:function(t){return new mn("trunc",t)},arrayElemAt:function(t){return new mn("arrayElemAt",t)},arrayToObject:function(t){return new mn("arrayToObject",t)},concatArrays:function(t){return new mn("concatArrays",t)},filter:function(t){return new mn("filter",t)},in:function(t){return new mn("in",t)},indexOfArray:function(t){return new mn("indexOfArray",t)},isArray:function(t){return new mn("isArray",t)},map:function(t){return new mn("map",t)},range:function(t){return new mn("range",t)},reduce:function(t){return new mn("reduce",t)},reverseArray:function(t){return new mn("reverseArray",t)},size:function(t){return new mn("size",t)},slice:function(t){return new mn("slice",t)},zip:function(t){return new mn("zip",t)},and:function(t){return new mn("and",t)},not:function(t){return new mn("not",t)},or:function(t){return new mn("or",t)},cmp:function(t){return new mn("cmp",t)},eq:function(t){return new mn("eq",t)},gt:function(t){return new mn("gt",t)},gte:function(t){return new mn("gte",t)},lt:function(t){return new mn("lt",t)},lte:function(t){return new mn("lte",t)},neq:function(t){return new mn("ne",t)},cond:function(t){return new mn("cond",t)},ifNull:function(t){return new mn("ifNull",t)},switch:function(t){return new mn("switch",t)},dateFromParts:function(t){return new mn("dateFromParts",t)},dateFromString:function(t){return new mn("dateFromString",t)},dayOfMonth:function(t){return new mn("dayOfMonth",t)},dayOfWeek:function(t){return new mn("dayOfWeek",t)},dayOfYear:function(t){return new mn("dayOfYear",t)},isoDayOfWeek:function(t){return new mn("isoDayOfWeek",t)},isoWeek:function(t){return new mn("isoWeek",t)},isoWeekYear:function(t){return new mn("isoWeekYear",t)},millisecond:function(t){return new mn("millisecond",t)},minute:function(t){return new mn("minute",t)},month:function(t){return new mn("month",t)},second:function(t){return new mn("second",t)},hour:function(t){return new mn("hour",t)},week:function(t){return new mn("week",t)},year:function(t){return new mn("year",t)},literal:function(t){return new mn("literal",t)},mergeObjects:function(t){return new mn("mergeObjects",t)},objectToArray:function(t){return new mn("objectToArray",t)},allElementsTrue:function(t){return new mn("allElementsTrue",t)},anyElementTrue:function(t){return new mn("anyElementTrue",t)},setDifference:function(t){return new mn("setDifference",t)},setEquals:function(t){return new mn("setEquals",t)},setIntersection:function(t){return new mn("setIntersection",t)},setIsSubset:function(t){return new mn("setIsSubset",t)},setUnion:function(t){return new mn("setUnion",t)},concat:function(t){return new mn("concat",t)},dateToString:function(t){return new mn("dateToString",t)},indexOfBytes:function(t){return new mn("indexOfBytes",t)},indexOfCP:function(t){return new mn("indexOfCP",t)},split:function(t){return new mn("split",t)},strLenBytes:function(t){return new mn("strLenBytes",t)},strLenCP:function(t){return new mn("strLenCP",t)},strcasecmp:function(t){return new mn("strcasecmp",t)},substr:function(t){return new mn("substr",t)},substrBytes:function(t){return new mn("substrBytes",t)},substrCP:function(t){return new mn("substrCP",t)},toLower:function(t){return new mn("toLower",t)},toUpper:function(t){return new mn("toUpper",t)},meta:function(t){return new mn("meta",t)},addToSet:function(t){return new mn("addToSet",t)},avg:function(t){return new mn("avg",t)},first:function(t){return new mn("first",t)},last:function(t){return new mn("last",t)},max:function(t){return new mn("max",t)},min:function(t){return new mn("min",t)},push:function(t){return new mn("push",t)},stdDevPop:function(t){return new mn("stdDevPop",t)},stdDevSamp:function(t){return new mn("stdDevSamp",t)},sum:function(t){return new mn("sum",t)},let:function(t){return new mn("let",t)}},project:{slice:function(t){return new bn("slice",t)},elemMatch:function(t){return new bn("elemMatch",t)}}},mn=function(t,e){this["$"+t]=e},bn=function(t,e){this["$"+t]=e},wn=function(){function t(t){var e=t.regexp,n=t.options;if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=n}return t.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(t.prototype,"_internalType",{get:function(){return j},enumerable:!0,configurable:!0}),t}();function En(t){return new wn(t)}var _n={CREATE_WATCH_NET_ERROR:{code:"CREATE_WATCH_NET_ERROR",message:"create watch network error"},CREATE_WACTH_EXCEED_ERROR:{code:"CREATE_WACTH_EXCEED_ERROR",message:"maximum connections exceed"},CREATE_WATCH_SERVER_ERROR:{code:"CREATE_WATCH_SERVER_ERROR",message:"create watch server error"},CONN_ERROR:{code:"CONN_ERROR",message:"connection error"},INVALID_PARAM:{code:"INVALID_PARAM",message:"Invalid request param"},INSERT_DOC_FAIL:{code:"INSERT_DOC_FAIL",message:"insert document failed"},DATABASE_TRANSACTION_CONFLICT:{code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"}},Sn=function(){return Sn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Sn.apply(this,arguments)},In=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Tn=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},On="database.updateDocInTransaction",An=function(){function t(t,e,n){this._coll=e,this.id=n,this._transaction=t,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.create=function(t){return In(this,void 0,void 0,(function(){var e,n,r,i;return Tn(this,(function(o){switch(o.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,data:cn.stringify(_t(t),{relaxed:!1})},this.id&&(e._id=this.id),[4,this._request.send("database.insertDocInTransaction",e)];case 1:if((n=o.sent()).code)throw n;if(r=cn.parse(n.inserted),1==(i=cn.parse(n.ok))&&1==r)return[2,Sn(Sn({},n),{ok:i,inserted:r})];throw new Error(_n.INSERT_DOC_FAIL.message)}}))}))},t.prototype.get=function(){return In(this,void 0,void 0,(function(){var t,e;return Tn(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,{data:"null"!==e.data?nt.formatField(cn.parse(e.data)):cn.parse(e.data),requestId:e.requestId}]}}))}))},t.prototype.set=function(t){return In(this,void 0,void 0,(function(){var e,n;return Tn(this,(function(r){switch(r.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:cn.stringify(_t(t),{relaxed:!1}),upsert:!0},[4,this._request.send(On,e)];case 1:if((n=r.sent()).code)throw n;return[2,Sn(Sn({},n),{updated:cn.parse(n.updated),upserted:n.upserted?JSON.parse(n.upserted):null})]}}))}))},t.prototype.update=function(t){return In(this,void 0,void 0,(function(){var e,n;return Tn(this,(function(r){switch(r.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:cn.stringify(Pt.encode(t),{relaxed:!1})},[4,this._request.send(On,e)];case 1:if((n=r.sent()).code)throw n;return[2,Sn(Sn({},n),{updated:cn.parse(n.updated)})]}}))}))},t.prototype.delete=function(){return In(this,void 0,void 0,(function(){var t,e;return Tn(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,Sn(Sn({},e),{deleted:cn.parse(e.deleted)})]}}))}))},t}(),Rn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Nn=function(t){function e(e,n){return t.call(this,e,n)||this}return Rn(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new An(this._transaction,this._coll,t)},e.prototype.add=function(t){var e;return void 0!==t._id&&(e=t._id),new An(this._transaction,this._coll,e).create(t)},e}((function(t,e){this._coll=e,this._transaction=t})),xn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Cn=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Pn=function(){function t(t){this._db=t,this._request=new Un.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return t.prototype.init=function(){return xn(this,void 0,void 0,(function(){var t;return Cn(this,(function(e){switch(e.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((t=e.sent()).code)throw t;return this.inited=!0,this._id=t.transactionId,[2]}}))}))},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new Nn(this,t)},t.prototype.getTransactionId=function(){return this._id},t.prototype.getRequestMethod=function(){return this._request},t.prototype.commit=function(){return xn(this,void 0,void 0,(function(){var t,e;return Cn(this,(function(n){switch(n.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.commitTransaction",t)];case 1:if((e=n.sent()).code)throw e;return this.commited=!0,[2,e]}}))}))},t.prototype.rollback=function(t){return xn(this,void 0,void 0,(function(){var e,n;return Cn(this,(function(r){switch(r.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.abortTransaction",e)];case 1:if((n=r.sent()).code)throw n;return this.aborted=!0,this.abortReason=t,[2,n]}}))}))},t}();function Dn(){return xn(this,void 0,void 0,(function(){var t;return Cn(this,(function(e){switch(e.label){case 0:return[4,(t=new Pn(this)).init()];case 1:return e.sent(),[2,t]}}))}))}function Ln(t,e){return void 0===e&&(e=3),xn(this,void 0,void 0,(function(){var n,r,i,o,s=this;return Cn(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,10]),[4,(n=new Pn(this)).init()];case 1:return a.sent(),[4,t(n)];case 2:if(r=a.sent(),!0===n.aborted)throw n.abortReason;return[4,n.commit()];case 3:return a.sent(),[2,r];case 4:if(i=a.sent(),!1===n.inited)throw i;return o=function(t){return xn(s,void 0,void 0,(function(){return Cn(this,(function(e){switch(e.label){case 0:if(n.aborted||n.commited)return[3,5];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,n.rollback()];case 2:case 3:return e.sent(),[3,4];case 4:throw t;case 5:if(!0===n.aborted)throw n.abortReason;throw t}}))}))},e<=0?[4,o(i)]:[3,6];case 5:a.sent(),a.label=6;case 6:return i&&i.code===_n.DATABASE_TRANSACTION_CONFLICT.code?[4,Ln.bind(this)(t,--e)]:[3,8];case 7:return[2,a.sent()];case 8:return[4,o(i)];case 9:return a.sent(),[3,10];case 10:return[2]}}))}))}var Un=function(){function t(t){this.config=t,this.Geo=o,this.serverDate=X,this.command=vn,this.RegExp=En,this.startTransaction=Dn,this.runTransaction=Ln,this.logicCommand=ct,this.updateCommand=at,this.queryCommand=pt}return t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new gn(this,t)},t.prototype.createCollection=function(e){var n={collectionName:e};return new t.reqClass(this.config).send("database.addCollection",n)},t}(),jn=function(){return jn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},jn.apply(this,arguments)},Bn={name:"database",entity:{database:function(t){var e=this.platform,n=e.adapter,r=e.runtime;return Un.reqClass=this.request.constructor,Un.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},Un.runtime=r,this.wsClientClass&&(Un.wsClass=n.wsClass,Un.wsClientClass=this.wsClientClass),Un.ws||(Un.ws=null),new Un(jn(jn(jn({},this.config),{_fromApp:this}),t))}}};try{cloudbase.registerComponent(Bn)}catch(t){}function kn(t){try{t.registerComponent(Bn)}catch(t){console.warn(t)}}},338:function(t,e,n){"use strict";n.r(e),n.d(e,{registerFunctions:function(){return p}});var r=n(142),i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},o=r._G.eX,s=r._G.Sg,a=r._G.vM,u=r.P6.Gc,c=r.BM.D,h="functions",f=new(function(){function t(){}return t.prototype.callFunction=function(t,e){return n=this,r=void 0,a=function(){var n,r,i,a,c,f,l,p,d,y,g,v;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(m){switch(m.label){case 0:if(n=t.name,r=t.data,i=t.query,a=t.parse,c=t.search,!n)throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(h,".callFunction] invalid function name")}));try{f=r?JSON.stringify(r):""}catch(t){throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(h,".callFunction] invalid data")}))}l="functions.invokeFunction",p={inQuery:i,parse:a,search:c,function_name:n,request_data:f},d=this.request,m.label=1;case 1:return m.trys.push([1,3,,4]),[4,d.send(l,p)];case 2:if((y=m.sent()).code)return[2,u(e,null,y)];if(g=y.data.response_data,a)return[2,u(e,null,{result:g,requestId:y.requestId})];try{return g=JSON.parse(y.data.response_data),[2,u(e,null,{result:g,requestId:y.requestId})]}catch(t){u(e,new Error("[".concat(o(),"][").concat(s.INVALID_PARAMS,"][").concat(h,".callFunction] response data must be json")))}return[3,4];case 3:return v=m.sent(),u(e,v),[3,4];case 4:return[2]}}))},new((i=void 0)||(i=Promise))((function(t,e){function o(t){try{u(a.next(t))}catch(t){e(t)}}function s(t){try{u(a.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(o,s)}u((a=a.apply(n,r||[])).next())}));var n,r,i,a},function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);o>3&&s&&Object.defineProperty(e,n,s)}([c({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(a)]}),i("design:type",Function),i("design:paramtypes",[Object,Function]),i("design:returntype",Promise)],t.prototype,"callFunction",null),t}()),l={name:h,entity:{callFunction:f.callFunction}};try{cloudbase.registerComponent(l)}catch(t){}function p(t){try{t.registerComponent(l)}catch(t){console.warn(t)}}},337:function(t,e,n){"use strict";n.r(e),n.d(e,{registerRealtime:function(){return V}});var r=n(880),i=n.n(r),o=n(373),s=n.n(o),a=n(907),u=n.n(a);function c(t){return void 0===t&&(t=""),"".concat(t?"".concat(t,"_"):"").concat(+new Date,"_").concat(Math.random())}var h,f,l=function(t){this.close=t.close,this.onChange=t.onChange,this.onError=t.onError,t.debug&&Object.defineProperty(this,"virtualClient",{get:function(){return t.virtualClient}})},p=function(t){var e,n,r=t.id,i=t.docChanges,o=t.docs,s=t.msgType,a=t.type;Object.defineProperties(this,{id:{get:function(){return r},enumerable:!0},docChanges:{get:function(){return e||(e=JSON.parse(JSON.stringify(i))),e},enumerable:!0},docs:{get:function(){return n||(n=JSON.parse(JSON.stringify(o))),n},enumerable:!0},msgType:{get:function(){return s},enumerable:!0},type:{get:function(){return a},enumerable:!0}})},d=(h=function(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},h(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),y=function(t){function e(e){var n=t.call(this,"Watch Error ".concat(JSON.stringify(e.msgData)," (requestid: ").concat(e.requestId,")"))||this;return n.isRealtimeErrorMessageError=!0,n.payload=e,n}return d(e,t),e}(Error),g=function(t){return null==t?void 0:t.isRealtimeErrorMessageError},v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeout",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cancelled",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),b=function(t){function e(e){var n=t.call(this,e.errMsg)||this;return n.errCode="UNKNOWN_ERROR",Object.defineProperties(n,{message:{get:function(){return"errCode: ".concat(this.errCode," ").concat(w[this.errCode]||""," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t}}}),n.errCode=e.errCode||"UNKNOWN_ERROR",n.errMsg=e.errMsg,n}return d(e,t),Object.defineProperty(e.prototype,"message",{get:function(){return"errCode: ".concat(this.errCode," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t},enumerable:!1,configurable:!0}),e}(Error),w={UNKNOWN_ERROR:"UNKNOWN_ERROR",SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG:"SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG",SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA:"SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED",SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL",SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR:"SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR"},E=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},S=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},I=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};!function(t){t.LOGGINGIN="LOGGINGIN",t.INITING="INITING",t.REBUILDING="REBUILDING",t.ACTIVE="ACTIVE",t.ERRORED="ERRORED",t.CLOSING="CLOSING",t.CLOSED="CLOSED",t.PAUSED="PAUSED",t.RESUMING="RESUMING"}(f||(f={}));var T=function(){function t(t){var e=this;this.watchStatus=f.INITING,this.wsLogin=function(t,n){return _(e,void 0,void 0,(function(){var e;return S(this,(function(r){switch(r.label){case 0:return this.watchStatus=f.LOGGINGIN,[4,this.login(t,n)];case 1:return e=r.sent(),this.envId||(this.envId=e.envId),[2,e]}}))}))},this.initWatch=function(t){return _(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.initWatchPromise&&void 0!==this.initWatchPromise)return[2,this.initWatchPromise];this.initWatchPromise=new Promise((function(e,r){_(n,void 0,void 0,(function(){var n,i,o,s,a,u,h,l,d,y;return S(this,(function(g){switch(g.label){case 0:return g.trys.push([0,3,,4]),this.watchStatus===f.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:return n=g.sent().envId,this.watchStatus===f.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):(this.watchStatus=f.INITING,i={watchId:this.watchId,requestId:c(),msgType:"INIT_WATCH",msgData:{envId:n,collName:this.collectionName,query:this.query,limit:this.limit,orderBy:this.orderBy}},[4,this.send({msg:i,waitResponse:!0,skipOnMessage:!0,timeout:1e4})]);case 2:if(o=g.sent(),s=o.msgData,a=s.events,u=s.currEvent,this.sessionInfo={queryID:o.msgData.queryID,currentEventId:u-1,currentDocs:[]},a.length>0){for(h=0,l=a;h<l.length;h++)l[h].ID=u;this.handleServerEvents(o)}else this.sessionInfo.currentEventId=u,d=new p({id:u,docChanges:[],docs:[],type:"init"}),this.listener.onChange(d),this.scheduleSendACK();return this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=f.ACTIVE,this.availableRetries.INIT_WATCH=2,e(),[3,4];case 3:return y=g.sent(),this.handleWatchEstablishmentError(y,{operationName:"INIT_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.initWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.initWatchPromise=void 0,[7];case 4:return console.log("[realtime] initWatch ".concat(e?"success":"fail")),[2]}}))}))},this.rebuildWatch=function(t){return _(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.rebuildWatchPromise&&void 0!==this.rebuildWatchPromise)return[2,this.rebuildWatchPromise];this.rebuildWatchPromise=new Promise((function(e,r){_(n,void 0,void 0,(function(){var n,i,o,s;return S(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),this.watchStatus===f.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:if(n=a.sent().envId,!this.sessionInfo)throw new Error("can not rebuildWatch without a successful initWatch (lack of sessionInfo)");return this.watchStatus===f.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):(this.watchStatus=f.REBUILDING,i={watchId:this.watchId,requestId:c(),msgType:"REBUILD_WATCH",msgData:{envId:n,collName:this.collectionName,queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:i,waitResponse:!0,skipOnMessage:!1,timeout:1e4})]);case 2:return o=a.sent(),this.handleServerEvents(o),this.watchStatus=f.ACTIVE,this.availableRetries.REBUILD_WATCH=2,e(),[3,4];case 3:return s=a.sent(),this.handleWatchEstablishmentError(s,{operationName:"REBUILD_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.rebuildWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.rebuildWatchPromise=void 0,[7];case 4:return console.log("[realtime] rebuildWatch ".concat(e?"success":"fail")),[2]}}))}))},this.handleWatchEstablishmentError=function(t,n){return _(e,void 0,void 0,(function(){var e,r,i,o=this;return S(this,(function(s){return e="INIT_WATCH"===n.operationName,r=function(){o.closeWithError(new b({errCode:e?w.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:w.SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL,errMsg:t})),n.reject(t)},i=function(t){o.useRetryTicket(n.operationName)?e?(o.initWatchPromise=void 0,n.resolve(o.initWatch(t))):(o.rebuildWatchPromise=void 0,n.resolve(o.rebuildWatch(t))):r()},this.handleCommonError(t,{onSignError:function(){return i(!0)},onTimeoutError:function(){return i(!1)},onNotRetryableError:r,onCancelledError:n.reject,onUnknownError:function(){_(o,void 0,void 0,(function(){var t,e=this;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,8,,9]),t=function(){return _(e,void 0,void 0,(function(){return S(this,(function(t){switch(t.label){case 0:return this.pause(),[4,this.onceWSConnected()];case 1:return t.sent(),i(!0),[2]}}))}))},this.isWSConnected()?[3,2]:[4,t()];case 1:return r.sent(),[3,7];case 2:return[4,E(100)];case 3:return r.sent(),this.watchStatus!==f.PAUSED?[3,4]:(n.reject(new m("".concat(n.operationName," cancelled due to pause after unknownError"))),[3,7]);case 4:return this.isWSConnected()?[3,6]:[4,t()];case 5:return r.sent(),[3,7];case 6:i(!1),r.label=7;case 7:return[3,9];case 8:return r.sent(),i(!0),[3,9];case 9:return[2]}}))}))}}),[2]}))}))},this.closeWatch=function(){return _(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:if(t=this.sessionInfo?this.sessionInfo.queryID:"",this.watchStatus!==f.ACTIVE)return this.watchStatus=f.CLOSED,this.onWatchClose(this,t),[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.watchStatus=f.CLOSING,e={watchId:this.watchId,requestId:c(),msgType:"CLOSE_WATCH",msgData:null},[4,this.send({msg:e})];case 2:return r.sent(),this.sessionInfo=void 0,this.watchStatus=f.CLOSED,[3,5];case 3:return n=r.sent(),this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL,errMsg:n})),[3,5];case 4:return this.onWatchClose(this,t),[7];case 5:return[2]}}))}))},this.scheduleSendACK=function(){e.clearACKSchedule(),e.ackTimeoutId=setTimeout((function(){e.waitExpectedTimeoutId?e.scheduleSendACK():e.sendACK()}),1e4)},this.clearACKSchedule=function(){e.ackTimeoutId&&clearTimeout(e.ackTimeoutId)},this.sendACK=function(){return _(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.watchStatus!==f.ACTIVE?(this.scheduleSendACK(),[2]):this.sessionInfo?(t={watchId:this.watchId,requestId:c(),msgType:"CHECK_LAST",msgData:{queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:t})]):(console.warn("[realtime listener] can not send ack without a successful initWatch (lack of sessionInfo)"),[2]);case 1:return r.sent(),this.scheduleSendACK(),[3,3];case 2:if(e=r.sent(),g(e))switch((n=e.payload).msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return this.rebuildWatch(),[2];case"QUERYID_INVALID_ERROR":case"SYS_ERR":case"INVALIID_ENV":case"COLLECTION_PERMISSION_DENIED":return this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:n.msgData.code})),[2]}return this.availableRetries.CHECK_LAST&&this.availableRetries.CHECK_LAST>0?(this.availableRetries.CHECK_LAST-=1,this.scheduleSendACK()):this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:e})),[3,3];case 3:return[2]}}))}))},this.handleCommonError=function(t,e){if(g(t))switch(t.payload.msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return void e.onSignError(t);default:return void e.onNotRetryableError(t)}else{if(function(t){return"timeout"===t.type}(t))return void e.onTimeoutError(t);if(function(t){return"cancelled"===t.type}(t))return void e.onCancelledError(t)}e.onUnknownError(t)},this.watchId="watchid_".concat(+new Date,"_").concat(Math.random()),this.envId=t.envId,this.collectionName=t.collectionName,this.query=t.query,this.limit=t.limit,this.orderBy=t.orderBy,this.send=t.send,this.login=t.login,this.isWSConnected=t.isWSConnected,this.onceWSConnected=t.onceWSConnected,this.getWaitExpectedTimeoutLength=t.getWaitExpectedTimeoutLength,this.onWatchStart=t.onWatchStart,this.onWatchClose=t.onWatchClose,this.debug=t.debug,this.availableRetries={INIT_WATCH:2,REBUILD_WATCH:2,CHECK_LAST:2},this.listener=new l({close:function(){e.closeWatch()},onChange:t.onChange,onError:t.onError,debug:this.debug,virtualClient:this}),this.initWatch()}return t.prototype.onMessage=function(t){var e=this;switch(this.watchStatus){case f.PAUSED:if("ERROR"!==t.msgType)return;break;case f.LOGGINGIN:case f.INITING:case f.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while ".concat(this.watchStatus));case f.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case f.ERRORED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has ended with error")}if(this.sessionInfo)switch(this.scheduleSendACK(),t.msgType){case"NEXT_EVENT":console.warn("nextevent ".concat(t.msgData.currEvent," ignored"),t),this.handleServerEvents(t);break;case"CHECK_EVENT":this.sessionInfo.currentEventId<t.msgData.currEvent&&(this.sessionInfo.expectEventId=t.msgData.currEvent,this.clearWaitExpectedEvent(),this.waitExpectedTimeoutId=setTimeout((function(){e.rebuildWatch()}),this.getWaitExpectedTimeoutLength()),console.log("[realtime] waitExpectedTimeoutLength ".concat(this.getWaitExpectedTimeoutLength())));break;case"ERROR":this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG,errMsg:"".concat(t.msgData.code," - ").concat(t.msgData.message)}));break;default:console.warn("[realtime listener] virtual client receive unexpected msg ".concat(t.msgType,": "),t)}else console.warn("[realtime listener] internal non-fatal error: sessionInfo not found while message is received.")},t.prototype.closeWithError=function(t){var e;this.watchStatus=f.ERRORED,this.clearACKSchedule(),this.listener.onError(t),this.onWatchClose(this,(null===(e=this.sessionInfo)||void 0===e?void 0:e.queryID)||""),console.log("[realtime] client closed (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.pause=function(){this.watchStatus=f.PAUSED,console.log("[realtime] client paused (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.resume=function(){return _(this,void 0,void 0,(function(){var t;return S(this,(function(e){switch(e.label){case 0:this.watchStatus=f.RESUMING,console.log("[realtime] client resuming with ".concat(this.sessionInfo?"REBUILD_WATCH":"INIT_WATCH"," (").concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.sessionInfo?this.rebuildWatch():this.initWatch()];case 2:return e.sent(),console.log("[realtime] client successfully resumed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),[3,4];case 3:return t=e.sent(),console.error("[realtime] client resume failed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")"),t),[3,4];case 4:return[2]}}))}))},t.prototype.useRetryTicket=function(t){return!!(this.availableRetries[t]&&this.availableRetries[t]>0)&&(this.availableRetries[t]-=1,console.log("[realtime] ".concat(t," use a retry ticket, now only ").concat(this.availableRetries[t]," retry left")),!0)},t.prototype.handleServerEvents=function(t){return _(this,void 0,void 0,(function(){var e;return S(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.scheduleSendACK(),[4,this.handleServerEventsInternel(t)];case 1:return n.sent(),this.postHandleServerEventsValidityCheck(t),[3,3];case 2:throw e=n.sent(),console.error("[realtime listener] internal non-fatal error: handle server events failed with error: ",e),e;case 3:return[2]}}))}))},t.prototype.handleServerEventsInternel=function(t){return _(this,void 0,void 0,(function(){var e,n,r,o,a,c,h,f,l,d,y,g;return S(this,(function(v){switch(v.label){case 0:if(e=t.requestId,n=t.msgData.events,r=t.msgType,!n.length||!this.sessionInfo)return[2];o=this.sessionInfo;try{a=n.map(O)}catch(t){return this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:t})),[2]}c=I([],o.currentDocs,!0),h=!1,f=function(n,f){var d,y,g,v,m,E,_,T,O,A,R,N;return S(this,(function(S){switch(S.label){case 0:return d=a[n],o.currentEventId>=d.id?(!a[n-1]||d.id>a[n-1].id?console.warn("[realtime] duplicate event received, cur ".concat(o.currentEventId," but got ").concat(d.id)):console.error("[realtime listener] server non-fatal error: events out of order (the latter event's id is smaller than that of the former) (requestId ".concat(e,")")),[2,"continue"]):[3,1];case 1:if(o.currentEventId!==d.id-1)return[3,2];switch(d.dataType){case"update":if(!d.doc)switch(d.queueType){case"update":case"dequeue":if(y=c.find((function(t){return t._id===d.docId})),y){if(g=u()(y),d.updatedFields&&Object.keys(d.updatedFields).forEach((function(t){i()(g,t,d.updatedFields[t])})),d.removedFields)for(v=0,m=d.removedFields;v<m.length;v++)E=m[v],s()(g,E);d.doc=g}else console.error("[realtime listener] internal non-fatal server error: unexpected update dataType event where no doc is associated.");break;case"enqueue":throw T=new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="update" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),l.closeWithError(T),T}break;case"replace":if(!d.doc)throw T=new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="replace" (requestId '.concat(t.requestId,")")}),l.closeWithError(T),T;break;case"remove":(_=c.find((function(t){return t._id===d.docId})))?d.doc=_:console.error("[realtime listener] internal non-fatal server error: unexpected remove event where no doc is associated.");break;case"limit":if(!d.doc)switch(d.queueType){case"dequeue":(_=c.find((function(t){return t._id===d.docId})))?d.doc=_:console.error("[realtime listener] internal non-fatal server error: unexpected limit dataType event where no doc is associated.");break;case"enqueue":throw T=new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="limit" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),l.closeWithError(T),T}}switch(d.queueType){case"init":h?c.push(d.doc):(h=!0,c=[d.doc]);break;case"enqueue":c.push(d.doc);break;case"dequeue":O=c.findIndex((function(t){return t._id===d.docId})),O>-1?c.splice(O,1):console.error("[realtime listener] internal non-fatal server error: unexpected dequeue event where no doc is associated.");break;case"update":O=c.findIndex((function(t){return t._id===d.docId})),O>-1?c[O]=d.doc:console.error("[realtime listener] internal non-fatal server error: unexpected queueType update event where no doc is associated.")}return(n===f-1||a[n+1]&&a[n+1].id!==d.id)&&(A=I([],c,!0),R=a.slice(0,n+1).filter((function(t){return t.id===d.id})),l.sessionInfo.currentEventId=d.id,l.sessionInfo.currentDocs=c,N=new p({id:d.id,docChanges:R,docs:A,msgType:r}),l.listener.onChange(N)),[3,4];case 2:return console.warn("[realtime listener] event received is out of order, cur ".concat(l.sessionInfo.currentEventId," but got ").concat(d.id)),[4,l.rebuildWatch()];case 3:return S.sent(),[2,{value:void 0}];case 4:return[2]}}))},l=this,d=0,y=a.length,v.label=1;case 1:return d<y?[5,f(d,y)]:[3,4];case 2:if("object"==typeof(g=v.sent()))return[2,g.value];v.label=3;case 3:return d++,[3,1];case 4:return[2]}}))}))},t.prototype.postHandleServerEventsValidityCheck=function(t){this.sessionInfo?(this.sessionInfo.expectEventId&&this.sessionInfo.currentEventId>=this.sessionInfo.expectEventId&&this.clearWaitExpectedEvent(),this.sessionInfo.currentEventId<t.msgData.currEvent&&console.warn("[realtime listener] internal non-fatal error: client eventId does not match with server event id after server event handling")):console.error("[realtime listener] internal non-fatal error: sessionInfo lost after server event handling, this should never occur")},t.prototype.clearWaitExpectedEvent=function(){this.waitExpectedTimeoutId&&(clearTimeout(this.waitExpectedTimeoutId),this.waitExpectedTimeoutId=void 0)},t}();function O(t){var e={id:t.ID,dataType:t.DataType,queueType:t.QueueType,docId:t.DocID,doc:t.Doc&&"{}"!==t.Doc?JSON.parse(t.Doc):void 0};return"update"===t.DataType&&(t.UpdatedFields&&(e.updatedFields=JSON.parse(t.UpdatedFields)),(t.removedFields||t.RemovedFields)&&(e.removedFields=JSON.parse(t.removedFields))),e}var A,R={1e3:{code:1e3,name:"Normal Closure",description:"Normal closure; the connection successfully completed whatever purpose for which it was created."},1001:{code:1001,name:"Going Away",description:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{code:1002,name:"Protocol Error",description:"The endpoint is terminating the connection due to a protocol error."},1003:{code:1003,name:"Unsupported Data",description:"The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data)."},1005:{code:1005,name:"No Status Received",description:"Indicates that no status code was provided even though one was expected."},1006:{code:1006,name:"Abnormal Closure",description:"Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{code:1007,name:"Invalid frame payload data",description:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{code:1008,name:"Policy Violation",description:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{code:1009,name:"Message too big",description:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{code:1010,name:"Missing Extension",description:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{code:1011,name:"Internal Error",description:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{code:1012,name:"Service Restart",description:"The server is terminating the connection because it is restarting."},1013:{code:1013,name:"Try Again Later",description:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{code:1014,name:"Bad Gateway",description:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{code:1015,name:"TLS Handshake",description:"Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},3e3:{code:3e3,name:"Reconnect WebSocket",description:"The client is terminating the connection because it wants to reconnect"},3001:{code:3001,name:"No Realtime Listeners",description:"The client is terminating the connection because no more realtime listeners exist"},3002:{code:3002,name:"Heartbeat Ping Error",description:"The client is terminating the connection due to its failure in sending heartbeat messages"},3003:{code:3003,name:"Heartbeat Pong Timeout Error",description:"The client is terminating the connection because no heartbeat response is received from the server"},3050:{code:3050,name:"Server Close",description:"The client is terminating the connection because no heartbeat response is received from the server"}};!function(t){t[t.NormalClosure=1e3]="NormalClosure",t[t.GoingAway=1001]="GoingAway",t[t.ProtocolError=1002]="ProtocolError",t[t.UnsupportedData=1003]="UnsupportedData",t[t.NoStatusReceived=1005]="NoStatusReceived",t[t.AbnormalClosure=1006]="AbnormalClosure",t[t.InvalidFramePayloadData=1007]="InvalidFramePayloadData",t[t.PolicyViolation=1008]="PolicyViolation",t[t.MessageTooBig=1009]="MessageTooBig",t[t.MissingExtension=1010]="MissingExtension",t[t.InternalError=1011]="InternalError",t[t.ServiceRestart=1012]="ServiceRestart",t[t.TryAgainLater=1013]="TryAgainLater",t[t.BadGateway=1014]="BadGateway",t[t.TLSHandshake=1015]="TLSHandshake",t[t.ReconnectWebSocket=3e3]="ReconnectWebSocket",t[t.NoRealtimeListeners=3001]="NoRealtimeListeners",t[t.HeartbeatPingError=3002]="HeartbeatPingError",t[t.HeartbeatPongTimeoutError=3003]="HeartbeatPongTimeoutError",t[t.NoAuthentication=3050]="NoAuthentication"}(A||(A={}));var N=function(t,e){var n=R[t],r=n?"".concat(n.name,", code ").concat(t,", reason ").concat(e||n.description):"code ".concat(t);return new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:r})},x=null,C="web";function P(){return x}function D(){return C}function L(t){C=t}var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},U.apply(this,arguments)},j=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},B=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},k=function(){function t(t){var e=this;this.virtualWSClient=new Set,this.queryIdClientMap=new Map,this.watchIdClientMap=new Map,this.pingFailed=0,this.pongMissed=0,this.logins=new Map,this.wsReadySubsribers=[],this.wsResponseWait=new Map,this.rttObserved=[],this.send=function(t){return j(e,void 0,void 0,(function(){var e=this;return B(this,(function(n){return[2,new Promise((function(n,r){j(e,void 0,void 0,(function(){var e,i,o,s,a,u,c,h,f=this;return B(this,(function(l){switch(l.label){case 0:i=!1,o=!1,s=function(t){i=!0,e&&clearTimeout(e),n(t)},a=function(t){o=!0,e&&clearTimeout(e),r(t)},t.timeout&&(e=setTimeout((function(){j(f,void 0,void 0,(function(){return B(this,(function(t){switch(t.label){case 0:return i&&o?[3,2]:[4,E(0)];case 1:t.sent(),i&&o||a(new v("wsclient.send timedout")),t.label=2;case 2:return[2]}}))}))}),t.timeout)),l.label=1;case 1:return l.trys.push([1,8,,9]),void 0===this.wsInitPromise&&null===this.wsInitPromise?[3,3]:[4,this.wsInitPromise];case 2:l.sent(),l.label=3;case 3:if(!this.ws)return a(new Error("invalid state: ws connection not exists, can not send message")),[2];if(1!==this.ws.readyState)return a(new Error("ws readyState invalid: ".concat(this.ws.readyState,", can not send message"))),[2];t.waitResponse&&(u={resolve:s,reject:a,skipOnMessage:t.skipOnMessage},this.wsResponseWait.set(t.msg.requestId,u)),l.label=4;case 4:return l.trys.push([4,6,,7]),[4,this.ws.send(JSON.stringify(t.msg))];case 5:return l.sent(),t.waitResponse||s(void 0),[3,7];case 6:return(c=l.sent())&&(a(c),t.waitResponse&&this.wsResponseWait.delete(t.msg.requestId)),[3,7];case 7:return[3,9];case 8:return h=l.sent(),a(h),[3,9];case 9:return[2]}}))}))}))]}))}))},this.closeAllClients=function(t){e.virtualWSClient.forEach((function(e){e.closeWithError(t)}))},this.pauseClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.pause()}))},this.resumeClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.resume()}))},this.initWebSocketConnection=function(t,n){return void 0===n&&(n=e.maxReconnect),j(e,void 0,void 0,(function(){var e=this;return B(this,(function(r){switch(r.label){case 0:if(t&&this.reconnectState)return[2];if(t&&(this.reconnectState=!0),void 0!==this.wsInitPromise&&null!==this.wsInitPromise)return[2,this.wsInitPromise];t&&this.pauseClients(),this.close(A.ReconnectWebSocket),this.wsInitPromise=new Promise((function(r,i){j(e,void 0,void 0,(function(){var e,o,s=this;return B(this,(function(a){switch(a.label){case 0:return a.trys.push([0,6,,11]),[4,this.getWsSign()];case 1:return e=a.sent(),[4,new Promise((function(t){var n=e.wsUrl||"wss://tcb-ws.tencentcloudapi.com",r=P();s.ws=r?new r(n):new WebSocket(n),t(void 0)}))];case 2:return a.sent(),this.ws.connect?[4,this.ws.connect()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[4,this.initWebSocketEvent()];case 5:return a.sent(),r(),t&&(this.resumeClients(),this.reconnectState=!1),[3,11];case 6:return o=a.sent(),console.error("[realtime] initWebSocketConnection connect fail",o),n>0?(this.wsInitPromise=void 0,[4,E(this.reconnectInterval)]):[3,9];case 7:a.sent(),t&&(this.reconnectState=!1),a.label=8;case 8:return r(this.initWebSocketConnection(t,n-1)),[3,10];case 9:i(o),t&&this.closeAllClients(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL,errMsg:o})),a.label=10;case 10:return[3,11];case 11:return[2]}}))}))})),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.wsInitPromise];case 2:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.resolve)()})),[3,5];case 3:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.reject)()})),[3,5];case 4:return this.wsInitPromise=void 0,this.wsReadySubsribers=[],[7];case 5:return[2]}}))}))},this.initWebSocketEvent=function(){return new Promise((function(t,n){if(!e.ws)throw new Error("can not initWebSocketEvent, ws not exists");var r=!1;e.ws.onopen=function(e){console.warn("[realtime] ws event: open",e),r=!0,t()},e.ws.onerror=function(t){e.logins=new Map,r?(console.error("[realtime] ws event: error",t),e.clearHeartbeat(),e.virtualWSClient.forEach((function(e){return e.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR,errMsg:t}))}))):(console.error("[realtime] ws open failed with ws event: error",t),n(t))},e.ws.onclose=function(t){switch(console.warn("[realtime] ws event: close",t),e.logins=new Map,e.clearHeartbeat(),t.code){case A.ReconnectWebSocket:case A.NoRealtimeListeners:break;case A.HeartbeatPingError:case A.HeartbeatPongTimeoutError:case A.NormalClosure:case A.AbnormalClosure:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(N(t.code));break;case A.NoAuthentication:e.closeAllClients(N(t.code,t.reason));break;default:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(N(t.code))}},e.ws.onmessage=function(t){var n,r=t.data;e.heartbeat();try{n=JSON.parse(r)}catch(t){throw new Error("[realtime] onMessage parse res.data error: ".concat(t))}if("ERROR"===n.msgType){var i=null;e.virtualWSClient.forEach((function(t){t.watchId===n.watchId&&(i=t)})),i&&i.listener.onError(n)}var o=e.wsResponseWait.get(n.requestId);if(o){try{"ERROR"===n.msgType?o.reject(new y(n)):o.resolve(n)}catch(t){console.error("ws onMessage responseWaitSpec.resolve(msg) errored:",t)}finally{e.wsResponseWait.delete(n.requestId)}if(o.skipOnMessage)return}if("PONG"!==n.msgType){var s=n.watchId&&e.watchIdClientMap.get(n.watchId);if(s)s.onMessage(n);else switch(console.error("[realtime] no realtime listener found responsible for watchId ".concat(n.watchId,": "),n),n.msgType){case"INIT_EVENT":case"NEXT_EVENT":case"CHECK_EVENT":(s=e.queryIdClientMap.get(n.msgData.queryID))&&s.onMessage(n);break;default:for(var a=0,u=Array.from(e.watchIdClientMap.entries());a<u.length;a++){u[a][1].onMessage(n);break}}}else if(e.lastPingSendTS){var c=Date.now()-e.lastPingSendTS;if(c>1e4)return void console.warn("[realtime] untrusted rtt observed: ".concat(c));e.rttObserved.length>=3&&e.rttObserved.splice(0,e.rttObserved.length-3+1),e.rttObserved.push(c)}},e.heartbeat()}))},this.isWSConnected=function(){return Boolean(e.ws&&1===e.ws.readyState)},this.onceWSConnected=function(){return j(e,void 0,void 0,(function(){var t=this;return B(this,(function(e){return this.isWSConnected()?[2]:null!==this.wsInitPromise&&void 0!==this.wsInitPromise?[2,this.wsInitPromise]:[2,new Promise((function(e,n){t.wsReadySubsribers.push({resolve:e,reject:n})}))]}))}))},this.webLogin=function(t,n){return j(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,h,f=this;return B(this,(function(l){switch(l.label){case 0:if(!n)if(t){if(e=this.logins.get(t)){if(e.loggedIn&&e.loginResult)return[2,e.loginResult];if(null!==e.loggingInPromise&&void 0!==e.loggingInPromise)return[2,e.loggingInPromise]}}else if(null!==(null==(r=this.logins.get(""))?void 0:r.loggingInPromise)&&void 0!==(null==r?void 0:r.loggingInPromise))return[2,r.loggingInPromise];i=new Promise((function(t,e){j(f,void 0,void 0,(function(){var n,r,i,o,s;return B(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getWsSign()];case 1:return n=a.sent(),r={envId:n.envId||"",accessToken:"",referrer:"web",sdkVersion:"",dataVersion:""},i={watchId:void 0,requestId:c(),msgType:"LOGIN",msgData:r,exMsgData:{runtime:D(),signStr:n.signStr,secretVersion:n.secretVersion}},[4,this.send({msg:i,waitResponse:!0,skipOnMessage:!0,timeout:5e3})];case 2:return(o=a.sent()).msgData.code?e(new Error("".concat(o.msgData.code," ").concat(o.msgData.message))):t({envId:n.envId}),[3,4];case 3:return s=a.sent(),e(s),[3,4];case 4:return[2]}}))}))})),o=t&&this.logins.get(t),s=Date.now(),o?(o.loggedIn=!1,o.loggingInPromise=i,o.loginStartTS=s):(o={loggedIn:!1,loggingInPromise:i,loginStartTS:s},this.logins.set(t||"",o)),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,i];case 2:if(a=l.sent(),(u=t&&this.logins.get(t))&&u===o&&u.loginStartTS===s)return o.loggedIn=!0,o.loggingInPromise=void 0,o.loginStartTS=void 0,o.loginResult=a,[2,a];if(u){if(u.loggedIn&&u.loginResult)return[2,u.loginResult];if(null!==u.loggingInPromise&&void 0!==u.loggingInPromise)return[2,u.loggingInPromise];throw new Error("ws unexpected login info")}throw new Error("ws login info reset");case 3:throw h=l.sent(),o.loggedIn=!1,o.loggingInPromise=void 0,o.loginStartTS=void 0,o.loginResult=void 0,h;case 4:return[2]}}))}))},this.getWsSign=function(){return j(e,void 0,void 0,(function(){var t,e,n,r,i,o,s;return B(this,(function(a){switch(a.label){case 0:return this.wsSign&&this.wsSign.expiredTs>Date.now()?[2,this.wsSign]:(t=Date.now()+6e4,[4,this.context.appConfig.request.send("auth.wsWebSign",{runtime:D()})]);case 1:if((e=a.sent()).code)throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败: ".concat(e.code));if(e.data)return n=e.data,r=n.signStr,i=n.wsUrl,o=n.secretVersion,s=n.envId,[2,{signStr:r,wsUrl:i,secretVersion:o,envId:s,expiredTs:t}];throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败")}}))}))},this.getWaitExpectedTimeoutLength=function(){return e.rttObserved.length?e.rttObserved.reduce((function(t,e){return t+e}))/e.rttObserved.length*1.5:5e3},this.ping=function(){return j(e,void 0,void 0,(function(){var t;return B(this,(function(e){switch(e.label){case 0:return t={watchId:void 0,requestId:c(),msgType:"PING",msgData:null},[4,this.send({msg:t})];case 1:return e.sent(),[2]}}))}))},this.onWatchStart=function(t,n){e.queryIdClientMap.set(n,t)},this.onWatchClose=function(t,n){n&&e.queryIdClientMap.delete(n),e.watchIdClientMap.delete(t.watchId),e.virtualWSClient.delete(t),e.virtualWSClient.size||e.close(A.NoRealtimeListeners)},this.maxReconnect=t.maxReconnect||5,this.reconnectInterval=t.reconnectInterval||1e4,this.context=t.context}return t.prototype.clearHeartbeat=function(){this.pingTimeoutId&&clearTimeout(this.pingTimeoutId),this.pongTimeoutId&&clearTimeout(this.pongTimeoutId)},t.prototype.close=function(t){this.clearHeartbeat(),this.ws&&(this.ws.close(t,R[t].name),this.ws=void 0)},t.prototype.watch=function(t){this.ws||void 0!==this.wsInitPromise&&null!==this.wsInitPromise||this.initWebSocketConnection(!1);var e=new T(U(U({},t),{send:this.send,login:this.webLogin,isWSConnected:this.isWSConnected,onceWSConnected:this.onceWSConnected,getWaitExpectedTimeoutLength:this.getWaitExpectedTimeoutLength,onWatchStart:this.onWatchStart,onWatchClose:this.onWatchClose,debug:!0}));return this.virtualWSClient.add(e),this.watchIdClientMap.set(e.watchId,e),e.listener},t.prototype.heartbeat=function(t){var e=this;this.clearHeartbeat(),this.pingTimeoutId=setTimeout((function(){j(e,void 0,void 0,(function(){var t=this;return B(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.ws&&1===this.ws.readyState?(this.lastPingSendTS=Date.now(),[4,this.ping()]):[2];case 1:return e.sent(),this.pingFailed=0,this.pongTimeoutId=setTimeout((function(){console.error("pong timed out"),t.pongMissed<2?(t.pongMissed+=1,t.heartbeat(!0)):t.initWebSocketConnection(!0)}),this.context.appConfig.realtimePongWaitTimeout),[3,3];case 2:return e.sent(),this.pingFailed<2?(this.pingFailed+=1,this.heartbeat()):this.close(A.HeartbeatPingError),[3,3];case 3:return[2]}}))}))}),t?0:this.context.appConfig.realtimePingInterval)},t}(),M={target:"database",entity:function(){var t,e=this.platform,n=e.adapter,r=e.runtime;t=n.wsClass,x=t,L(r)}},q={name:"realtime",IIFE:!0,entity:function(){this.prototype.wsClientClass=k}};try{cloudbase.registerComponent(q),cloudbase.registerHook(M)}catch(t){}function V(t){try{t.registerComponent(q),t.registerHook(M)}catch(t){console.warn(t)}}},766:function(t,e,n){"use strict";n.r(e),n.d(e,{registerStorage:function(){return E}});var r,i=n(142),o=function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)},s=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},a=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},c=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};!function(t){t.put="put",t.post="post"}(r||(r={}));var h=i._G.eX,f=i._G.Sg,l=i._G.vM,p=i.P6.kJ,d=i.P6.HD,y=i.P6.JV,g=i.P6.Gc,v=i.BM.D,m="storage",b=new(function(){function t(){}return t.prototype.uploadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,i,s,a,u,l,p,y,v,b,w,E,_,S,I,T,O,A,R,N,x,C,P,D,L;return c(this,(function(c){switch(c.label){case 0:if(n=t.cloudPath,i=t.filePath,s=t.onUploadProgress,a=t.method,u=void 0===a?"put":a,l=t.headers,p=void 0===l?{}:l,!d(n)||!i)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".uploadFile] invalid params")}));return y={put:r.put,post:r.post}[u.toLocaleLowerCase()]||r.put,v=this.request,b={path:n,method:y},y===r.put&&(b.headers=p),[4,v.send("storage.getUploadMetadata",b)];case 1:return w=c.sent(),E=w.data,_=E.url,S=E.authorization,I=E.token,T=E.fileId,O=E.cosFileId,A=E.download_url,R=w.requestId,x=o(o({},N={url:_,file:i,name:n,onUploadProgress:s}),{method:r.put,headers:o(o({},p),{authorization:S,"x-cos-meta-fileid":O,"x-cos-security-token":I})}),C=o(o({},N),{method:r.post,data:{key:n,signature:S,"x-cos-meta-fileid":O,success_action_status:"201","x-cos-security-token":I}}),(L={})[r.put]={params:x,isSuccess:function(t){return t>=200&&t<300}},L[r.post]={params:C,isSuccess:function(t){return 201===t}},P=L,[4,v.upload(P[y].params)];case 2:return D=c.sent(),P[y].isSuccess(D.statusCode)?[2,g(e,null,{fileID:T,download_url:A,requestId:R})]:[2,g(e,new Error("[".concat(h(),"][").concat(f.OPERATION_FAIL,"][").concat(m,"]:").concat(D.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s;return c(this,(function(a){switch(a.label){case 0:if(n=t.cloudPath,!d(n))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getUploadMetadata] invalid cloudPath")}));r=this.request,i="storage.getUploadMetadata",a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.send(i,{path:n})];case 2:return o=a.sent(),[2,g(e,null,o)];case 3:return s=a.sent(),[2,g(e,s)];case 4:return[2]}}))}))},t.prototype.deleteFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileList must not be empty")}));for(r=0,i=n;r<i.length;r++)if(!(o=i[r])||!d(o))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileID must be string")}));return[4,this.request.send("storage.batchDeleteFile",{fileid_list:n})];case 1:return(s=u.sent()).code?[2,g(e,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,g(e,null,a)])}}))}))},t.prototype.getTempFileURL=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileList must not be empty")}));for(r=[],i=0,o=n;i<o.length;i++)if(s=o[i],y(s)){if(!Object.prototype.hasOwnProperty.call(s,"fileID")||!Object.prototype.hasOwnProperty.call(s,"maxAge"))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] file info must include fileID and maxAge")}));r.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!d(s))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] invalid fileList")}));r.push({fileid:s})}return[4,this.request.send("storage.batchGetDownloadUrl",{file_list:r})];case 1:return(a=u.sent()).code?[2,g(e,null,a)]:[2,g(e,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},t.prototype.downloadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return c(this,(function(u){switch(u.label){case 0:if(n=t.fileID,!d(n))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}]})];case 1:return r=u.sent(),"SUCCESS"!==(i=r.fileList[0]).code?[2,g(e,i)]:(o=this.request,s=encodeURI(i.download_url),[4,o.download({url:s})]);case 2:return a=u.sent(),[2,g(e,null,a)]}}))}))},s([v({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"uploadFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getUploadMetadata",null),s([v({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"deleteFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getTempFileURL",null),s([v({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"downloadFile",null),t}()),w={name:m,entity:{uploadFile:b.uploadFile,deleteFile:b.deleteFile,getTempFileURL:b.getTempFileURL,downloadFile:b.downloadFile,getUploadMetadata:b.getUploadMetadata}};try{cloudbase.registerComponent(w)}catch(t){}function E(t){try{t.registerComponent(w)}catch(t){console.warn(t)}}},142:function(t,e,n){"use strict";n.d(e,{j$:function(){return o},Fs:function(){return s},_G:function(){return r},U3:function(){return a},BM:function(){return u},P6:function(){return i}});var r={};n.r(r),n.d(r,{vM:function(){return y},Sg:function(){return g},Fk:function(){return d},eX:function(){return f},pM:function(){return p},tC:function(){return h}});var i={};n.r(i),n.d(i,{Gc:function(){return O},CN:function(){return I},Jc:function(){return S},kJ:function(){return m},hp:function(){return _},V9:function(){return E},JV:function(){return w},HD:function(){return b},Jz:function(){return N},xe:function(){return A},_y:function(){return R},UK:function(){return T}});var o={};n.r(o),n.d(o,{Fk:function(){return U},xY:function(){return j}});var s={};n.r(s),n.d(s,{q:function(){return V}});var a={};n.r(a),n.d(a,{yE:function(){return $}});var u={};n.r(u),n.d(u,{D:function(){return Z}});var c="@cloudbase/js-sdk";function h(t){c=t}function f(){return c}var l="https:";function p(t){l=t}var d=!1,y="https://support.qq.com/products/148793",g={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},v=n(829);function m(t){return"[object Array]"===Object.prototype.toString.call(t)}function b(t){return"string"==typeof t}function w(t){return"[object Object]"===Object.prototype.toString.call(t)}function E(t,e){return t instanceof e}function _(t){return"[object FormData]"===Object.prototype.toString.call(t)}function S(){return Math.random().toString(16).slice(2)}function I(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),i="";return Object.keys(n).forEach((function(t){""===i?!r&&(e+="?"):i+="&",i+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=i)?e:"".concat(t).concat(e)}function T(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}function O(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n}function A(t,e){console.warn("[".concat(f(),"][").concat(t,"]:").concat(e))}function R(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(f(),"][").concat(t,"]:").concat(e)}))}function N(t){var e=t.title,n=t.subtitle,r=void 0===n?"":n,i=t.content,o=void 0===i?[]:i,s=t.printTrace,a=void 0!==s&&s,u=t.collapsed;void 0!==u&&u?console.groupCollapsed(e,r):console.group(e,r);for(var c=0,h=o;c<h.length;c++){var f=h[c],l=f.type,p=f.body;switch(l){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}a&&console.trace("stack trace:"),console.groupEnd()}var x,C,P=(x=function(t,e){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},x(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}x(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),D=function(){return D=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},D.apply(this,arguments)},L=function(t){function e(e){var n=t.call(this)||this,r=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||"请求超时",n.restrictedMethods=o||["get","post","upload","download"],n}return P(e,t),e.prototype.get=function(t){return this.request(D(D({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(D(D({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(D(D({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,i=t.method,o=t.headers,s=void 0===o?{}:o,a={post:"post",put:"put"}[null==i?void 0:i.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",r),u.append("file",n),this.request(D(D({},t),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(D(D({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return e=this,n=void 0,i=function(){var e,n,r,i;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.get(D(D({},t),{headers:{},responseType:"blob"}))];case 1:return e=o.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(i=document.createElement("a")).href=n,i.setAttribute("download",r),i.style.display="none",document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return o.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))},new((r=void 0)||(r=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((i=i.apply(e,n||[])).next())}));var e,n,r,i},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(i){var o,s,a=t.url,u=t.headers,c=void 0===u?{}:u,h=t.data,f=t.responseType,p=t.withCredentials,d=t.body,y=t.onUploadProgress,g=I(l,a,"get"===r?h:{}),v=new XMLHttpRequest;v.open(r,g),f&&(v.responseType=f),Object.keys(c).forEach((function(t){v.setRequestHeader(t,c[t])})),y&&v.upload.addEventListener("progress",y),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),i=e.join(": ");n[r]=i})),t.header=n,t.statusCode=v.status;try{t.data="blob"===f?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===f?v.response:v.responseText}clearTimeout(o),i(t)}},e&&n.timeout&&(o=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),s=_(h)?h:"application/x-www-form-urlencoded"===c["content-type"]?T(h):d||(h?JSON.stringify(h):void 0),p&&(v.withCredentials=!0),v.send(s)}))},e}(v.jJ);function U(t){for(var e=0,n=m(t)?t:[t];e<n.length;e++){var r=n[e],i=r.isMatch,o=r.genAdapter,s=r.runtime;if(i())return{adapter:o(),runtime:s}}}function j(){return{adapter:{root:window,reqClass:L,wsClass:WebSocket,localStorage:localStorage},runtime:C.WEB}}!function(t){t.WEB="web",t.WX_MP="wx_mp"}(C||(C={}));var B=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),k=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},M=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},q=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return B(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(v.x_),V=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,i=t.keys,o=void 0===i?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(A(g.INVALID_PARAMS,"localStorage is not supported on current platform"),new q(e.root));case"none":return new q(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:g.OPERATION_FAIL,msg:"[".concat(f(),"][").concat(g.OPERATION_FAIL,"]setStore failed"),info:t}))}}else A(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return k(this,void 0,void 0,(function(){var r;return M(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}A(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return k(this,void 0,void 0,(function(){var r;return M(this,(function(i){switch(i.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=i.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):A(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return k(this,void 0,void 0,(function(){return M(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}(),F=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),H=function(t,e){this.data=e||null,this.name=t},W=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return F(e,t),e}(H),$=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(E(t,W))return console.error(t.error),this;var n=b(t)?new H(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,o=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];i<o.length;i++)o[i].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new $;var G=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},K=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},J=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(J=-1!==navigator.userAgent.indexOf("Firefox"));var Y=J?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,z=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function Z(t){var e=t.mode,n=void 0===e?"async":e,r=t.customInfo,i=void 0===r?{}:r,o=t.title,s=t.messages,a=void 0===s?[]:s;return function(t,e,r){if(d){var s=i.className||t.constructor.name,u=i.methodName||e,c=r.value,h=function(t){var e="",n=(new Error).stack.split("\n"),r=n.findIndex((function(t){return Y.test(t)}));if(-1!==r){var i=z.exec(n[r+1]||"");e=i?i[0]:""}return e}();r.value="sync"===n?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Q({err:new Error,className:s,methodName:u,sourceLink:h});try{return c.apply(this,t)}catch(t){var r=t,i=t.message,f=t.error,l=t.error_description,p={title:o||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:t}]};if(i&&/^\{.*\}$/.test(i)){var d=JSON.parse(i);p.subtitle=i,d.code&&(n?(n.code=d.code,n.msg=d.msg):(t.code=d.code,t.message=d.msg),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}})))}throw f&&l&&(p.subtitle=l,n?(n.code=f,n.msg=l):(t.code=f,t.message=l),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}}))),N(p),r}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return G(this,void 0,void 0,(function(){var e,n,r,i,f,l,p,d;return K(this,(function(y){switch(y.label){case 0:e=Q({err:new Error,className:s,methodName:u,sourceLink:h}),y.label=1;case 1:return y.trys.push([1,3,,4]),[4,c.apply(this,t)];case 2:return[2,y.sent()];case 3:throw n=y.sent(),r=n,i=n.message,f=n.error,l=n.error_description,p={title:o||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:n}]},i&&/^\{.*\}$/.test(i)&&(d=JSON.parse(i),p.subtitle=d,d.code&&(e?(e.code=d.code,e.message=d.msg):(n.code=d.code,n.message=d.msg),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}})))),f&&l&&(p.subtitle=l,e?(e.code=f,e.msg=l):(n.code=f,n.message=l),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}}))),N(p),r;case 4:return[2]}}))}))}}}}function Q(t){var e=t.err,n=t.className,r=t.methodName,i=t.sourceLink;if(!i)return null;var o,s=e.stack.split("\n"),a=J?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),u=J?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]")),c=s.findIndex((function(t){return a.test(t)}));if(-1!==c){var h=s.filter((function(t,e){return e>c}));h.unshift(s[c].replace(u,"".concat(n,".").concat(r)).replace(z,i)),(o=new Error).stack="".concat(J?"@debugger":"Error","\n").concat(h.join("\n"))}return o}function X(t){this.message=t}function tt(t){this.message=t}X.prototype=new Error,X.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),tt.prototype=new Error,tt.prototype.name="InvalidTokenError"},907:function(t,e,n){t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",c="[object GeneratorFunction]",h="[object Map]",f="[object Number]",l="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",E="[object Float32Array]",_="[object Float64Array]",S="[object Int8Array]",I="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",A="[object Uint8ClampedArray]",R="[object Uint16Array]",N="[object Uint32Array]",x=/\w*$/,C=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,D={};D[o]=D["[object Array]"]=D[b]=D[w]=D[s]=D[a]=D[E]=D[_]=D[S]=D[I]=D[T]=D[h]=D[f]=D[l]=D[d]=D[y]=D[g]=D[v]=D[O]=D[A]=D[R]=D[N]=!0,D["[object Error]"]=D[u]=D[m]=!1;var L="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,U="object"==typeof self&&self&&self.Object===Object&&self,j=L||U||Function("return this")(),B=e&&!e.nodeType&&e,k=B&&t&&!t.nodeType&&t,M=k&&k.exports===B;function q(t,e){return t.set(e[0],e[1]),t}function V(t,e){return t.add(e),t}function F(t,e,n,r){var i=-1,o=t?t.length:0;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function H(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function W(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function $(t,e){return function(n){return t(e(n))}}function G(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var K,J=Array.prototype,Y=Function.prototype,z=Object.prototype,Z=j["__core-js_shared__"],Q=(K=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",X=Y.toString,tt=z.hasOwnProperty,et=z.toString,nt=RegExp("^"+X.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=M?j.Buffer:void 0,it=j.Symbol,ot=j.Uint8Array,st=$(Object.getPrototypeOf,Object),at=Object.create,ut=z.propertyIsEnumerable,ct=J.splice,ht=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,lt=$(Object.keys,Object),pt=jt(j,"DataView"),dt=jt(j,"Map"),yt=jt(j,"Promise"),gt=jt(j,"Set"),vt=jt(j,"WeakMap"),mt=jt(Object,"create"),bt=Vt(pt),wt=Vt(dt),Et=Vt(yt),_t=Vt(gt),St=Vt(vt),It=it?it.prototype:void 0,Tt=It?It.valueOf:void 0;function Ot(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function At(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Rt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Nt(t){this.__data__=new At(t)}function xt(t,e,n){var r=t[e];tt.call(t,e)&&Ft(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ct(t,e){for(var n=t.length;n--;)if(Ft(t[n][0],e))return n;return-1}function Pt(t,e,n,r,i,p,m){var C;if(r&&(C=p?r(t,i,p,m):r(t)),void 0!==C)return C;if(!Kt(t))return t;var P=Ht(t);if(P){if(C=function(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!e)return function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(t,C)}else{var L=kt(t),U=L==u||L==c;if($t(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(L==l||L==o||U&&!p){if(H(t))return p?t:{};if(C=function(t){return"function"!=typeof t.constructor||qt(t)?{}:Kt(e=st(t))?at(e):{};var e}(U?{}:t),!e)return function(t,e){return Lt(t,Bt(t),e)}(t,function(t,e){return t&&Lt(e,Jt(e),t)}(C,t))}else{if(!D[L])return p?t:{};C=function(t,e,n,r){var i,o=t.constructor;switch(e){case b:return Dt(t);case s:case a:return new o(+t);case w:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case E:case _:case S:case I:case T:case O:case A:case R:case N:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case h:return function(t,e,n){return F(e?n(W(t),!0):W(t),q,new t.constructor)}(t,r,n);case f:case g:return new o(t);case d:return function(t){var e=new t.constructor(t.source,x.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return F(e?n(G(t),!0):G(t),V,new t.constructor)}(t,r,n);case v:return i=t,Tt?Object(Tt.call(i)):{}}}(t,L,Pt,e)}}m||(m=new Nt);var j=m.get(t);if(j)return j;if(m.set(t,C),!P)var B=n?function(t){return function(t,e,n){var r=e(t);return Ht(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,Jt,Bt)}(t):Jt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(B||t,(function(i,o){B&&(i=t[o=i]),xt(C,o,Pt(i,e,n,r,o,t,m))})),C}function Dt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Lt(t,e,n,r){n||(n={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=r?r(n[s],t[s],s,n,t):void 0;xt(n,s,void 0===a?t[s]:a)}return n}function Ut(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function jt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Kt(t)||(e=t,Q&&Q in e))&&(Gt(t)||H(t)?nt:C).test(Vt(t));var e}(n)?n:void 0}Ot.prototype.clear=function(){this.__data__=mt?mt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(mt){var n=e[t];return n===r?void 0:n}return tt.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return mt?void 0!==e[t]:tt.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=mt&&void 0===e?r:e,this},At.prototype.clear=function(){this.__data__=[]},At.prototype.delete=function(t){var e=this.__data__,n=Ct(e,t);return!(n<0||(n==e.length-1?e.pop():ct.call(e,n,1),0))},At.prototype.get=function(t){var e=this.__data__,n=Ct(e,t);return n<0?void 0:e[n][1]},At.prototype.has=function(t){return Ct(this.__data__,t)>-1},At.prototype.set=function(t,e){var n=this.__data__,r=Ct(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Rt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(dt||At),string:new Ot}},Rt.prototype.delete=function(t){return Ut(this,t).delete(t)},Rt.prototype.get=function(t){return Ut(this,t).get(t)},Rt.prototype.has=function(t){return Ut(this,t).has(t)},Rt.prototype.set=function(t,e){return Ut(this,t).set(t,e),this},Nt.prototype.clear=function(){this.__data__=new At},Nt.prototype.delete=function(t){return this.__data__.delete(t)},Nt.prototype.get=function(t){return this.__data__.get(t)},Nt.prototype.has=function(t){return this.__data__.has(t)},Nt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof At){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new Rt(r)}return n.set(t,e),this};var Bt=ht?$(ht,Object):function(){return[]},kt=function(t){return et.call(t)};function Mt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function qt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||z)}function Vt(t){if(null!=t){try{return X.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ft(t,e){return t===e||t!=t&&e!=e}(pt&&kt(new pt(new ArrayBuffer(1)))!=w||dt&&kt(new dt)!=h||yt&&kt(yt.resolve())!=p||gt&&kt(new gt)!=y||vt&&kt(new vt)!=m)&&(kt=function(t){var e=et.call(t),n=e==l?t.constructor:void 0,r=n?Vt(n):void 0;if(r)switch(r){case bt:return w;case wt:return h;case Et:return p;case _t:return y;case St:return m}return e});var Ht=Array.isArray;function Wt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Gt(t)}var $t=ft||function(){return!1};function Gt(t){var e=Kt(t)?et.call(t):"";return e==u||e==c}function Kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Wt(t)?function(t,e){var n=Ht(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Wt(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var s in t)!e&&!tt.call(t,s)||i&&("length"==s||Mt(s,r))||n.push(s);return n}(t):function(t){if(!qt(t))return lt(t);var e=[];for(var n in Object(t))tt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}},880:function(t,e,n){var r,i="Expected a function",o="__lodash_hash_undefined__",s=1/0,a=9007199254740991,u="[object Function]",c="[object GeneratorFunction]",h="[object Symbol]",f=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/,p=/^\./,d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,v=/^(?:0|[1-9]\d*)$/,m="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,b="object"==typeof self&&self&&self.Object===Object&&self,w=m||b||Function("return this")(),E=Array.prototype,_=Function.prototype,S=Object.prototype,I=w["__core-js_shared__"],T=(r=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",O=_.toString,A=S.hasOwnProperty,R=S.toString,N=RegExp("^"+O.call(A).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),x=w.Symbol,C=E.splice,P=F(w,"Map"),D=F(Object,"create"),L=x?x.prototype:void 0,U=L?L.toString:void 0;function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function B(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function k(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function M(t,e,n){var r=t[e];A.call(t,e)&&K(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function q(t,e){for(var n=t.length;n--;)if(K(t[n][0],e))return n;return-1}function V(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function F(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!Y(t)||T&&T in t)return!1;var e=function(t){var e=Y(t)?R.call(t):"";return e==u||e==c}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?N:g;return e.test(function(t){if(null!=t){try{return O.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function H(t,e){return!!(e=null==e?a:e)&&("number"==typeof t||v.test(t))&&t>-1&&t%1==0&&t<e}j.prototype.clear=function(){this.__data__=D?D(null):{}},j.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},j.prototype.get=function(t){var e=this.__data__;if(D){var n=e[t];return n===o?void 0:n}return A.call(e,t)?e[t]:void 0},j.prototype.has=function(t){var e=this.__data__;return D?void 0!==e[t]:A.call(e,t)},j.prototype.set=function(t,e){return this.__data__[t]=D&&void 0===e?o:e,this},B.prototype.clear=function(){this.__data__=[]},B.prototype.delete=function(t){var e=this.__data__,n=q(e,t);return!(n<0||(n==e.length-1?e.pop():C.call(e,n,1),0))},B.prototype.get=function(t){var e=this.__data__,n=q(e,t);return n<0?void 0:e[n][1]},B.prototype.has=function(t){return q(this.__data__,t)>-1},B.prototype.set=function(t,e){var n=this.__data__,r=q(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},k.prototype.clear=function(){this.__data__={hash:new j,map:new(P||B),string:new j}},k.prototype.delete=function(t){return V(this,t).delete(t)},k.prototype.get=function(t){return V(this,t).get(t)},k.prototype.has=function(t){return V(this,t).has(t)},k.prototype.set=function(t,e){return V(this,t).set(t,e),this};var W=G((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(z(t))return U?U.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return p.test(t)&&n.push(""),t.replace(d,(function(t,e,r,i){n.push(r?i.replace(y,"$1"):e||t)})),n}));function $(t){if("string"==typeof t||z(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function G(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(G.Cache||k),n}function K(t,e){return t===e||t!=t&&e!=e}G.Cache=k;var J=Array.isArray;function Y(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function z(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&R.call(t)==h}t.exports=function(t,e,n){return null==t?t:function(t,e,n,r){if(!Y(t))return t;e=function(t,e){if(J(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!z(t))||l.test(t)||!f.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return J(t)?t:W(t)}(e);for(var i=-1,o=e.length,s=o-1,a=t;null!=a&&++i<o;){var u=$(e[i]),c=n;if(i!=s){var h=a[u];void 0===(c=r?r(h,u,a):void 0)&&(c=Y(h)?h:H(e[i+1])?[]:{})}M(a,u,c),a=a[u]}return t}(t,e,n)}},373:function(t,e,n){var r,i="Expected a function",o="__lodash_hash_undefined__",s=1/0,a="[object Function]",u="[object GeneratorFunction]",c="[object Symbol]",h=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,f=/^\w*$/,l=/^\./,p=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/\\(\\)?/g,y=/^\[object .+?Constructor\]$/,g="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,v="object"==typeof self&&self&&self.Object===Object&&self,m=g||v||Function("return this")(),b=Array.prototype,w=Function.prototype,E=Object.prototype,_=m["__core-js_shared__"],S=(r=/[^.]+$/.exec(_&&_.keys&&_.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",I=w.toString,T=E.hasOwnProperty,O=E.toString,A=RegExp("^"+I.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=m.Symbol,N=b.splice,x=q(m,"Map"),C=q(Object,"create"),P=R?R.prototype:void 0,D=P?P.toString:void 0;function L(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function U(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function B(t,e){for(var n,r,i=t.length;i--;)if((n=t[i][0])===(r=e)||n!=n&&r!=r)return i;return-1}function k(t){return $(t)?t:F(t)}function M(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!G(t)||S&&S in t)return!1;var e=function(t){var e=G(t)?O.call(t):"";return e==a||e==u}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?A:y;return e.test(function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function V(t,e){if($(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!K(t))||f.test(t)||!h.test(t)||null!=e&&t in Object(e)}L.prototype.clear=function(){this.__data__=C?C(null):{}},L.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},L.prototype.get=function(t){var e=this.__data__;if(C){var n=e[t];return n===o?void 0:n}return T.call(e,t)?e[t]:void 0},L.prototype.has=function(t){var e=this.__data__;return C?void 0!==e[t]:T.call(e,t)},L.prototype.set=function(t,e){return this.__data__[t]=C&&void 0===e?o:e,this},U.prototype.clear=function(){this.__data__=[]},U.prototype.delete=function(t){var e=this.__data__,n=B(e,t);return!(n<0||(n==e.length-1?e.pop():N.call(e,n,1),0))},U.prototype.get=function(t){var e=this.__data__,n=B(e,t);return n<0?void 0:e[n][1]},U.prototype.has=function(t){return B(this.__data__,t)>-1},U.prototype.set=function(t,e){var n=this.__data__,r=B(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},j.prototype.clear=function(){this.__data__={hash:new L,map:new(x||U),string:new L}},j.prototype.delete=function(t){return M(this,t).delete(t)},j.prototype.get=function(t){return M(this,t).get(t)},j.prototype.has=function(t){return M(this,t).has(t)},j.prototype.set=function(t,e){return M(this,t).set(t,e),this};var F=W((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(K(t))return D?D.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return l.test(t)&&n.push(""),t.replace(p,(function(t,e,r,i){n.push(r?i.replace(d,"$1"):e||t)})),n}));function H(t){if("string"==typeof t||K(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function W(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(W.Cache||j),n}W.Cache=j;var $=Array.isArray;function G(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function K(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&O.call(t)==c}t.exports=function(t,e){return null==t||function(t,e){t=function(t,e){return 1==e.length?t:function(t,e){for(var n=0,r=(e=V(e,t)?[e]:k(e)).length;null!=t&&n<r;)t=t[H(e[n++])];return n&&n==r?t:void 0}(t,function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}(e,0,-1))}(t,e=V(e,t)?[e]:k(e));var n,r,i=H((r=(n=e)?n.length:0)?n[r-1]:void 0);return!(null!=t&&T.call(t,i))||delete t[i]}(t,e)}},47:function(t){var e=function(t){"use strict";var e,n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof v?e:v,s=Object.create(o.prototype),a=new x(r||[]);return i(s,"_invoke",{value:O(t,n,a)}),s}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var l="suspendedStart",p="suspendedYield",d="executing",y="completed",g={};function v(){}function m(){}function b(){}var w={};c(w,s,(function(){return this}));var E=Object.getPrototypeOf,_=E&&E(E(C([])));_&&_!==n&&r.call(_,s)&&(w=_);var S=b.prototype=v.prototype=Object.create(w);function I(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function n(i,o,s,a){var u=f(t[i],t,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function O(t,e,n){var r=l;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===y){if("throw"===i)throw o;return P()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=A(s,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=f(t,e,n);if("normal"===u.type){if(r=n.done?y:p,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=y,n.method="throw",n.arg=u.arg)}}}function A(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function C(t){if(t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:m,configurable:!0}),m.displayName=c(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},I(T.prototype),c(T.prototype,a,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new T(h(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},I(S),c(S,u,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(N),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return a.type="throw",a.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;N(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},536:function(t){"use strict";t.exports=JSON.parse('{"version":"2.5.43-beta.0"}')}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},n(47),n(195)}()}));
|
|
2
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase",[],e):"object"==typeof exports?exports.cloudbase=e():t.cloudbase=e()}("undefined"!=typeof window?window:this,(function(){return function(){var t={829:function(t,e,n){"use strict";var r;n.d(e,{jJ:function(){return i},x_:function(){return o},Z1:function(){return r},CN:function(){return s}}),function(t){t.local="local",t.none="none",t.session="session"}(r||(r={}));var i=function(){},o=function(){};function s(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),i="";for(var o in n)""===i?!r&&(e+="?"):i+="&",i+=o+"="+encodeURIComponent(n[o]);return/^http(s)?\:\/\//.test(e+=i)?e:""+t+e}},195:function(t,e,n){"use strict";var r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},i=r(n(805)),o=n(344),s=n(338),a=n(766),u=n(337),c=n(98),h=n(529),f=r(n(536)).default.version;i.default.registerVersion(f);try{(0,o.registerAuth)(i.default),(0,s.registerFunctions)(i.default),(0,a.registerStorage)(i.default),(0,h.registerDatabase)(i.default),(0,u.registerRealtime)(i.default),(0,c.registerAnalytics)(i.default)}catch(t){}try{window.cloudbase=i.default}catch(t){}e.default=i.default,t.exports=i.default},98:function(t,e,n){"use strict";n.r(e),n.d(e,{registerAnalytics:function(){return l}});var r=n(142),i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},o=r._G.Sg,s=r._G.vM,a=r.BM.D,u="analytics",c=["mall"],h=new(function(){function t(){}return t.prototype.analytics=function(t){return e=this,n=void 0,i=function(){var e,n,r;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(i){if(!function(t){if("Object"!==Object.prototype.toString.call(t).slice(8,-1))return!1;var e=t.report_data,n=t.report_type;return!1!==c.includes(n)&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!(void 0!==e.action_time&&!Number.isInteger(e.action_time))&&"string"==typeof e.action_type}(t))throw new Error(JSON.stringify({code:o.INVALID_PARAMS,msg:"[".concat(u,".analytics] invalid report data")}));return e=void 0===t.report_data.action_time?Math.floor(Date.now()/1e3):t.report_data.action_time,n={analytics_scene:t.report_type,analytics_data:Object.assign({},t.report_data,{action_time:e})},r={requestData:n},this.request.send("analytics.report",r),[2]}))},new((r=void 0)||(r=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((i=i.apply(e,n||[])).next())}));var e,n,r,i},function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);o>3&&s&&Object.defineProperty(e,n,s)}([a({customInfo:{className:"Cloudbase",methodName:"analytics"},title:"上报调用失败",messages:["请确认以下各项:"," 1 - 调用 analytics() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(s)]}),i("design:type",Function),i("design:paramtypes",[Object]),i("design:returntype",Promise)],t.prototype,"analytics",null),t}()),f={name:u,entity:{analytics:h.analytics}};try{cloudbase.registerComponent(f)}catch(t){}function l(t){try{t.registerComponent(f)}catch(t){console.warn(t)}}},805:function(t,e,n){"use strict";n.r(e),n.d(e,{cloudbase:function(){return st},default:function(){return at},getBaseEndPoint:function(){return L}});var r,i=n(142),o=n(829),s=(r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},r(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),a=function(){return a=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},a.apply(this,arguments)},u=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this,r=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return n._timeout=r||0,n._timeoutMsg=i||"请求超时",n._restrictedMethods=o||["get","post","upload","download"],n}return s(e,t),e.prototype.post=function(t){var e=this;return new Promise((function(n,r){var i=t.url,s=t.data,a=t.headers,u=wx.request({url:(0,o.CN)("https:",i),data:s,timeout:e._timeout,method:"POST",header:a,success:function(t){n(t)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("post")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e.prototype.upload=function(t){var e=this,n=this;return new Promise((function(r){return i=e,o=void 0,u=function(){var e,i,o,s,u,c;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(h){return e=t.url,i=t.file,o=t.data,s=t.headers,u=t.onUploadProgress,c=wx.uploadFile({url:e,filePath:i,name:"file",formData:a({},o),header:s,timeout:this._timeout,success:function(t){var e={statusCode:t.statusCode,data:t.data||{}};200===t.statusCode&&o.success_action_status&&(e.statusCode=parseInt(o.success_action_status,10)),r(e)},fail:function(t){r(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("upload")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{c.abort()}catch(t){}}}}),u&&c.onProgressUpdate((function(t){u(t)})),[2]}))},new((s=void 0)||(s=Promise))((function(t,e){function n(t){try{a(u.next(t))}catch(t){e(t)}}function r(t){try{a(u.throw(t))}catch(t){e(t)}}function a(e){var i;e.done?t(e.value):(i=e.value,i instanceof s?i:new s((function(t){t(i)}))).then(n,r)}a((u=u.apply(i,o||[])).next())}));var i,o,s,u}))},e.prototype.download=function(t){var e=this,n=this;return new Promise((function(r,i){var s=t.url,a=t.headers,u=wx.downloadFile({url:(0,o.CN)("https:",s),header:a,timeout:e._timeout,success:function(t){200===t.statusCode&&t.tempFilePath?r({statusCode:200,tempFilePath:t.tempFilePath}):r(t)},fail:function(t){i(t)},complete:function(t){if(t&&t.errMsg&&n._timeout&&-1!==n._restrictedMethods.indexOf("download")&&"request:fail timeout"===t.errMsg){console.warn(n._timeoutMsg);try{u.abort()}catch(t){}}}})}))},e}(o.jJ),c={setItem:function(t,e){wx.setStorageSync(t,e)},getItem:function(t){return wx.getStorageSync(t)},removeItem:function(t){wx.removeStorageSync(t)},clear:function(){wx.clearStorageSync()}},h=function(t,e){void 0===e&&(e={});var n=wx.connectSocket(a({url:t},e));return{set onopen(t){n.onOpen(t)},set onmessage(t){n.onMessage(t)},set onclose(t){n.onClose(t)},set onerror(t){n.onError(t)},send:function(t){return n.send({data:t})},close:function(t,e){return n.close({code:t,reason:e})},get readyState(){return n.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}},f={genAdapter:function(){return{root:{},reqClass:u,wsClass:h,localStorage:c,primaryStorage:o.Z1.local,getAppSign:function(){var t=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?t&&t.miniProgram?t.miniProgram.appId:"":t&&t.plugin?t.plugin.appId:""}}},isMatch:function(){if("undefined"==typeof wx)return!1;if("undefined"==typeof Page)return!1;if(!wx.getSystemInfoSync)return!1;if(!wx.getStorageSync)return!1;if(!wx.setStorageSync)return!1;if(!wx.connectSocket)return!1;if(!wx.request)return!1;try{if(!wx.getSystemInfoSync())return!1;if("qq"===wx.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0},runtime:"wx_mp"},l=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))},p=i._G.Sg,d={};function y(t,e){var n=e.name,r=e.namespace,i=e.entity,o=e.injectEvents,s=e.IIFE,a=void 0!==s&&s;if(d[n]||r&&t[r])throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"Duplicate component ".concat(n)}));if(a){if(!i||"function"!=typeof i)throw new Error(JSON.stringify({code:p.INVALID_PARAMS,msg:"IIFE component's entity must be a function"}));i.call(t)}if(d[n]=e,r?t.prototype[r]=i:g(t.prototype,i),o){var u=o.bus,c=o.events;if(!u||!c||0===c.length)return;var h=t.prototype.fire||function(){};t.prototype.events||(t.prototype.events={}),(t.prototype.events||{})[n]?t.prototype.events[n].events=l(l([],t.prototype.events[n].events,!0),c,!0):t.prototype.events[n]={bus:u,events:c},t.prototype.fire=function(t,e){h(t,e);for(var n=0,r=Object.keys(this.events);n<r.length;n++){var i=r[n],o=this.events[i],s=o.bus;if(o.events.includes(t)){s.fire(t,e);break}}}}}function g(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n=0,r=Object.keys(e);n<r.length;n++){var i=r[n];Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=g(t[i],e[i]))}return t}var v={},m=function(){return m=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},m.apply(this,arguments)},b="user_info",w=i.Fs.q,E={},_={};function S(t){var e=t.env,n=t.platformInfo,r={userInfoKey:"".concat(b,"_").concat(e)};E[e]=E[e]||new w(m(m({},t),{keys:r,platformInfo:n})),_[e]=_[e]||new w(m(m({},t),{keys:r,platformInfo:n,persistence:"local"}))}function I(t){return _[t]}var T,O=i._G.tC,A=i._G.pM,R="",N="@cloudbase/js-sdk",x="https:",C="//tcb-api.tencentcloudapi.com/web";function P(t,e){C=t,e&&(x=e,A(e))}function D(){return{BASE_URL:C,PROTOCOL:x}}function L(){var t=D(),e=t.PROTOCOL,n=t.BASE_URL;return"".concat(e).concat(n).match(/(http(s)?:)?\/\/([^/?#]*)/)[0]}!function(t){t.NULL="NULL",t.ANONYMOUS="ANONYMOUS",t.WECHAT="WECHAT",t.WECHAT_PUBLIC="WECHAT-PUBLIC",t.WECHAT_OPEN="WECHAT-OPEN",t.CUSTOM="CUSTOM",t.EMAIL="EMAIL",t.USERNAME="USERNAME",t.PHONE="PHONE"}(T||(T={}));var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},U.apply(this,arguments)},j=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},B=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},k=i._G.Sg,M=i.P6.Jc,q=i.P6.hp,V=i.P6.CN,F=["auth.getJwt","auth.logout","auth.signInWithTicket","auth.signInAnonymously","auth.signIn","auth.fetchAccessTokenWithRefreshToken","auth.signUpWithEmailAndPassword","auth.activateEndUserMail","auth.sendPasswordResetEmail","auth.resetPasswordWithToken","auth.isUsernameRegistered"];function H(t,e,n){var r=t[e];t[e]=function(e){var i={},o={};n.forEach((function(n){var r=n.call(t,e),s=r.data,a=r.headers;Object.assign(i,s),Object.assign(o,a)}));var s=e.data;return s&&(q(s)?Object.keys(i).forEach((function(t){s.append(t,i[t])})):e.data=U(U({},s),i)),e.headers=U(U({},e.headers||{}),o),r.call(t,e)}}function W(){var t=M();return{data:{seqId:t},headers:{"X-SDK-Version":"@cloudbase/js-sdk/".concat(R),"x-seqid":t}}}var $=function(){function t(t){this.throwWhenRequestFail=!1,this.config=t;var e={timeout:this.config.timeout,timeoutMsg:"[@cloudbase/js-sdk] 请求在".concat(this.config.timeout/1e3,"s内未完成,已中断"),restrictedMethods:["post","put"]};this.reqClass=new v.adapter.reqClass(e),this.throwWhenRequestFail=t.throw||!1,this.localCache=I(this.config.env),H(this.reqClass,"post",[W]),H(this.reqClass,"upload",[W]),H(this.reqClass,"download",[W])}return t.prototype.post=function(t){return j(this,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.post(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.upload=function(t){return j(this,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.upload(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.download=function(t){return j(this,void 0,void 0,(function(){return B(this,(function(e){switch(e.label){case 0:return[4,this.reqClass.download(t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getBaseEndPoint=function(){return L()},t.prototype.getOauthAccessTokenV2=function(t){return j(this,void 0,void 0,(function(){var e,n;return B(this,(function(r){switch(r.label){case 0:return[4,t.getAccessToken()];case 1:return e=r.sent(),[4,t.getCredentials()];case 2:return n=r.sent(),[2,{accessToken:e,accessTokenExpire:new Date(n.expires_at).getTime()}]}}))}))},t.prototype.request=function(t,e,n){var r;return j(this,void 0,void 0,(function(){var i,o,s,a,u,c,h,f,l,p,d,y,g,v,m,b,w,E,_,S;return B(this,(function(I){switch(I.label){case 0:if(i="x-tcb-trace_".concat(this.config.env),o="application/x-www-form-urlencoded",s=U({action:t,dataVersion:"2020-01-10",env:this.config.env},e),-1!==F.indexOf(t))return[3,2];if(!(a=this.config._fromApp).oauthInstance)throw new Error("you can't request without auth");return u=a.oauthInstance,c=u.oauth2client,h=s,[4,this.getOauthAccessTokenV2(c)];case 1:h.access_token=I.sent().accessToken,I.label=2;case 2:return"storage.uploadFile"===t?(f=new FormData,Object.keys(f).forEach((function(t){Object.prototype.hasOwnProperty.call(f,t)&&void 0!==f[t]&&f.append(t,s[t])})),o="multipart/form-data"):(o="application/json;charset=UTF-8",f={},Object.keys(s).forEach((function(t){void 0!==s[t]&&(f[t]=s[t])}))),l={headers:{"content-type":o}},(null==n?void 0:n.onUploadProgress)&&(l.onUploadProgress=n.onUploadProgress),this.config.region&&(l.headers["X-TCB-Region"]=this.config.region),(p=this.localCache.getStore(i))&&(l.headers["X-TCB-Trace"]=p),d=e.parse,y=e.inQuery,g=e.search,v={env:this.config.env},d&&(v.parse=!0),y&&(v=U(U({},y),v)),m=D(),b=m.BASE_URL,w=m.PROTOCOL,E=V(w,b,v),g&&(E+=g),[4,this.post(U({url:E,data:f},l))];case 3:if(_=I.sent(),(S=null===(r=_.header)||void 0===r?void 0:r["x-tcb-trace"])&&this.localCache.setStore(i,S),200!==Number(_.status)&&200!==Number(_.statusCode)||!_.data)throw new Error("network request error");return[2,_]}}))}))},t.prototype.send=function(t,e){return void 0===e&&(e={}),j(this,void 0,void 0,(function(){var n;return B(this,(function(r){switch(r.label){case 0:return[4,this.request(t,e,{onUploadProgress:e.onUploadProgress})];case 1:if((n=r.sent()).data.code&&this.throwWhenRequestFail)throw new Error(JSON.stringify({code:k.OPERATION_FAIL,msg:"[".concat(n.data.code,"] ").concat(n.data.message)}));return[2,n.data]}}))}))},t}(),G={},K=function(){return K=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},K.apply(this,arguments)},J=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},Y=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},z=i.j$.Fk,Z=i.j$.xY,Q=i._G.Sg,X=i._G.vM,tt=i.P6.xe,et=i.BM.D,nt={timeout:15e3,persistence:"local"},rt=6e5,it={},ot=function(){function t(t){this.cloudbaseConfig=t||this.cloudbaseConfig,this.authInstance=null,this.oauthInstance=null}return Object.defineProperty(t.prototype,"config",{get:function(){return this.cloudbaseConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return v},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cache",{get:function(){return t=this.cloudbaseConfig.env,E[t];var t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCache",{get:function(){return I(this.cloudbaseConfig.env)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return t=this.cloudbaseConfig.env,G[t];var t},enumerable:!1,configurable:!0}),t.prototype.init=function(e){if(!e.env)throw new Error(JSON.stringify({code:Q.INVALID_PARAMS,msg:"env must not be specified"}));v.adapter||this.useDefaultAdapter();var n={timeout:e.timeout||5e3,timeoutMsg:"[".concat(N,"][REQUEST TIMEOUT] request had been abort since didn't finished within").concat(e.timeout/1e3,"s")};this.requestClient=new v.adapter.reqClass(n),this.cloudbaseConfig=K(K({},nt),e),this.cloudbaseConfig.timeout=this.formatTimeout(this.cloudbaseConfig.timeout);var r=this.cloudbaseConfig,i=r.env,o=r.persistence,s=r.debug,a=r.timeout,u=r.oauthClient;S({env:i,persistence:o,debug:s,platformInfo:this.platform}),function(t,e,n){P(e?"//".concat(t,".").concat(e,".tcb-api.tencentcloudapi.com/web"):"//".concat(t,".ap-shanghai.tcb-api.tencentcloudapi.com/web"),void 0)}(i,e.region||"");var c=new t(this.cloudbaseConfig);return function(t){G[t.env]=new $(U(U({},t),{throw:!0}))}({env:i,region:e.region||"",timeout:a,oauthClient:u,_fromApp:c}),c.requestClient=this.requestClient,c},t.prototype.updateConfig=function(t){var e=t.persistence,n=t.debug;this.cloudbaseConfig.persistence=e,this.cloudbaseConfig.debug=n,S({env:this.cloudbaseConfig.env,persistence:e,debug:n,platformInfo:this.platform})},t.prototype.registerExtension=function(t){it[t.name]=t},t.prototype.invokeExtension=function(t,e){return n=this,r=void 0,o=function(){var n;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(r){switch(r.label){case 0:if(!(n=it[t]))throw new Error(JSON.stringify({code:Q.INVALID_PARAMS,msg:"extension:".concat(t," must be registered before invoke")}));return[4,n.invoke(e,this)];case 1:return[2,r.sent()]}}))},new((i=void 0)||(i=Promise))((function(t,e){function s(t){try{u(o.next(t))}catch(t){e(t)}}function a(t){try{u(o.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(s,a)}u((o=o.apply(n,r||[])).next())}));var n,r,i,o},t.prototype.useAdapters=function(t){var e=z(t)||{},n=e.adapter,r=e.runtime;n&&(v.adapter=n),r&&(v.runtime=r)},t.prototype.registerHook=function(e){!function(t,e){var n=e.entity,r=e.target;if(Object.prototype.hasOwnProperty.call(t,r))throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not exist")}));var i=t.prototype[r];if("function"!=typeof i)throw new Error(JSON.stringify({code:p.INVALID_OPERATION,msg:"target:".concat(r," is not a function which is the only type supports hook")}));t.prototype[r]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n.call.apply(n,l([this],t,!1)),i.call.apply(i,l([this],t,!1))}}(t,e)},t.prototype.registerComponent=function(e){y(t,e)},t.prototype.registerVersion=function(t){!function(t){R=t}(t)},t.prototype.registerSdkName=function(t){!function(t){N=t,O(t)}(t)},t.prototype.registerEndPoint=function(t,e){P(t,e)},t.prototype.useDefaultAdapter=function(){var t=Z(),e=t.adapter,n=t.runtime;v.adapter=e,v.runtime=n},t.prototype.formatTimeout=function(t){switch(!0){case t>rt:return tt(Q.INVALID_PARAMS,"timeout is greater than maximum value[10min]"),rt;case t<100:return tt(Q.INVALID_PARAMS,"timeout is less than maximum value[100ms]"),100;default:return t}},J([et({mode:"sync",title:"Cloudbase 初始化失败",messages:["请确认以下各项:"," 1 - 调用 cloudbase.init() 的语法或参数是否正确"," 2 - 如果是非浏览器环境,是否配置了安全应用来源(https://docs.cloudbase.net/api-reference/webv3/adapter#%E7%AC%AC-2-%E6%AD%A5%E9%85%8D%E7%BD%AE%E5%AE%89%E5%85%A8%E5%BA%94%E7%94%A8%E6%9D%A5%E6%BA%90)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(X)]}),Y("design:type",Function),Y("design:paramtypes",[Object]),Y("design:returntype",t)],t.prototype,"init",null),J([et({title:"调用扩展能力失败",messages:["请确认以下各项:"," 1 - 调用 invokeExtension() 的语法或参数是否正确"," 2 - 被调用的扩展能力是否已经安装并通过 registerExtension() 注册","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(X)]}),Y("design:type",Function),Y("design:paramtypes",[String,Object]),Y("design:returntype",Promise)],t.prototype,"invokeExtension",null),t}(),st=new ot;st.useAdapters(f);var at=st},344:function(t,e,n){"use strict";n.r(e),n.d(e,{Auth:function(){return ce},LoginState:function(){return ue},registerAuth:function(){return fe}});var r,i,o,s,a,u,c,h=n(142);function f(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)}))}!function(t){t.CLIENT_ID="client_id",t.CLIENT_SECRET="client_secret",t.RESPONSE_TYPE="response_type",t.SCOPE="scope",t.STATE="state",t.REDIRECT_URI="redirect_uri",t.ERROR="error",t.ERROR_DESCRIPTION="error_description",t.ERROR_URI="error_uri",t.GRANT_TYPE="grant_type",t.CODE="code",t.ACCESS_TOKEN="access_token",t.TOKEN_TYPE="token_type",t.EXPIRES_IN="expires_in",t.USERNAME="username",t.PASSWORD="password",t.REFRESH_TOKEN="refresh_token"}(r||(r={})),(c=i||(i={})).UNREACHABLE="unreachable",c.LOCAL="local",c.CANCELLED="cancelled",c.UNKNOWN="unknown",c.INVALID_ARGUMENT="invalid_argument",c.DEADLINE_EXCEEDED="deadline_exceeded",c.NOT_FOUND="not_found",c.ALREADY_EXISTS="already_exists",c.PERMISSION_DENIED="permission_denied",c.UNAUTHENTICATED="unauthenticated",c.RESOURCE_EXHAUSTED="resource_exhausted",c.FAILED_PRECONDITION="failed_precondition",c.ABORTED="aborted",c.OUT_OF_RANGE="out_of_range",c.UNIMPLEMENTED="unimplemented",c.INTERNAL="internal",c.UNAVAILABLE="unavailable",c.DATA_LOSS="data_loss",c.CAPTCHA_REQUIRED="captcha_required",c.CAPTCHA_INVALID="captcha_invalid",c.INVALID_PASSWORD="invalid_password",c.INVALID_STATUS="invalid_status",c.USER_PENDING="user_pending",c.USER_BLOCKED="user_blocked",c.INVALID_VERIFICATION_CODE="invalid_verification_code",c.TWO_FACTOR_REQUIRED="two_factor_required",c.INVALID_TWO_FACTOR="invalid_two_factor",c.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",c.UNDER_REVIEW="under_review",c.INVALID_REQUEST="invalid_request",c.UNAUTHORIZED_CLIENT="unauthorized_client",c.ACCESS_DENIED="access_denied",c.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",c.INVALID_SCOPE="invalid_scope",c.INVALID_GRANT="invalid_grant",c.SERVER_ERROR="server_error",c.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",c.INTERACTION_REQUIRED="interaction_required",c.LOGIN_REQUIRED="login_required",c.ACCOUNT_SELECTION_REQUIRED="account_selection_required",c.CONSENT_REQUIRED="consent_required",c.INVALID_REQUEST_URI="invalid_request_uri",c.INVALID_REQUEST_OBJECT="invalid_request_object",c.REQUEST_NOT_SUPPORTED="request_not_supported",c.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",c.REGISTRATION_NOT_SUPPORTED="registration_not_supported",function(t){t.AUTH_SIGN_IN_URL="/auth/v1/signin",t.AUTH_SIGN_IN_ANONYMOUSLY_URL="/auth/v1/signin/anonymously",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v1/signin/with/provider",t.AUTH_SIGN_UP_URL="/auth/v1/signup",t.AUTH_TOKEN_URL="/auth/v1/token",t.AUTH_REVOKE_URL="/auth/v1/revoke",t.PROVIDER_BIND_URL="/auth/v1/user/provider/bind",t.PROVIDER_TOKEN_URL="/auth/v1/provider/token",t.PROVIDER_URI_URL="/auth/v1/provider/uri",t.USER_ME_URL="/auth/v1/user/me",t.WEDA_USER_URL="/auth/v1/plugin/weda/userinfo",t.USER_QUERY_URL="/auth/v1/user/query",t.USER_PRIFILE_URL="/auth/v1/user/profile",t.USER_TRANS_BY_PROVIDER_URL="/auth/v1/user/trans/by/provider",t.VERIFICATION_URL="/auth/v1/verification",t.VERIFY_URL="/auth/v1/verification/verify",t.CAPTCHA_DATA_URL="/auth/v1/captcha/data",t.VARIFY_CAPTCHA_DATA_URL="/auth/v1/captcha/data/verify",t.GET_CAPTCHA_URL="/auth/v1/captcha/init",t.PROVIDER_LIST="/auth/v1/user/provider",t.PROVIDER_UNBIND_URL="/auth/v1/user/provider",t.CHECK_PWD_URL="/auth/v1/user/sudo",t.SUDO_URL="/auth/v1/user/sudo",t.BIND_CONTACT_URL="/auth/v1/user/contact",t.AUTH_SET_PASSWORD="/auth/v1/user/password",t.AUTH_RESET_PASSWORD="/auth/v1/reset",t.AUTH_GET_DEVICE_CODE="/auth/v1/device/code",t.CHECK_USERNAME="/auth/v1/checkUsername",t.CHECK_IF_USER_EXIST="/auth/v1/checkIfUserExist",t.GET_PROVIDER_TYPE="/auth/v1/mgr/provider/providerSubType"}(o||(o={})),function(t){t.AUTH_SIGN_IN_URL="/auth/v2/signin/username",t.AUTH_TOKEN_URL="/auth/v2/token",t.USER_ME_URL="/auth/v2/user/me",t.VERIFY_URL="/auth/v2/signin/verificationcode",t.AUTH_SIGN_IN_WITH_PROVIDER_URL="/auth/v2/signin/with/provider",t.AUTH_PUBLIC_KEY="/auth/v2/signin/publichkey"}(s||(s={})),function(t){t.REGISTER="REGISTER",t.SIGN_IN="SIGN_IN",t.PASSWORD_RESET="PASSWORD_RESET",t.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",t.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(a||(a={})),function(t){t.INVALID_ARGUMENT="invalid_argument",t.DEADLINE_EXCEEDED="deadline_exceeded",t.NOT_FOUND="not_found",t.ALREADY_EXISTS="already_exists",t.PERMISSION_DENIED="permission_denied",t.ABORTED="aborted",t.OUT_OF_RANGE="out_of_range",t.UNIMPLEMENTED="unimplemented",t.INTERNAL="internal",t.UNAVAILABLE="unavailable",t.DATA_LOSS="data_loss",t.CAPTCHA_REQUIRED="captcha_required",t.CAPTCHA_INVALID="captcha_invalid",t.INVALID_PASSWORD="invalid_password",t.PASSWORD_NOT_SET="password_not_set",t.INVALID_STATUS="invalid_status",t.USER_PENDING="user_pending",t.USER_BLOCKED="user_blocked"}(u||(u={}));var l=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},p=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},d=function(){function t(){this.fnPromiseMap=new Map}return t.prototype.run=function(t,e){return l(this,void 0,void 0,(function(){var n,r=this;return p(this,(function(i){switch(i.label){case 0:return[4,n=this.fnPromiseMap.get(t)];case 1:return i.sent()||(n=new Promise((function(n,i){l(r,void 0,void 0,(function(){var r,o,s;return p(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,4,5]),[4,this.runIdlePromise()];case 1:return a.sent(),r=e(),o=n,[4,r];case 2:return o.apply(void 0,[a.sent()]),[3,5];case 3:return s=a.sent(),i(s),[3,5];case 4:return this.fnPromiseMap.delete(t),[7];case 5:return[2]}}))}))})),this.fnPromiseMap.set(t,n)),[2,n]}}))}))},t.prototype.runIdlePromise=function(){return Promise.resolve()},t}(),y=function(){return y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},y.apply(this,arguments)},g=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},v=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},m="x-request-id",b="x-device-id",w="device_id",E=function(t,e){return g(this,void 0,void 0,(function(){var n,r,o,s,a;return v(this,(function(u){switch(u.label){case 0:n=null,r=null,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=Object.assign({},e)).method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body)),[4,fetch(t,o)];case 2:return[4,u.sent().json()];case 3:return(null==(s=u.sent())?void 0:s.error)?(r=s).error_uri=new URL(t).pathname:n=s,[3,5];case 4:return a=u.sent(),r={error:i.UNREACHABLE,error_description:a.message,error_uri:new URL(t).pathname},[3,5];case 5:if(r)throw r;return[2,n]}}))}))},_=new(function(){function t(){}return t.prototype.getItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,window.localStorage.getItem(t)]}))}))},t.prototype.removeItem=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return window.localStorage.removeItem(t),[2]}))}))},t.prototype.setItem=function(t,e){return g(this,void 0,void 0,(function(){return v(this,(function(n){return window.localStorage.setItem(t,e),[2]}))}))},t.prototype.getItemSync=function(t){return window.localStorage.getItem(t)},t.prototype.removeItemSync=function(t){window.localStorage.removeItem(t)},t.prototype.setItemSync=function(t,e){window.localStorage.setItem(t,e)},t}());function S(t){var e=!0;return(null==t?void 0:t.expires_at)&&(null==t?void 0:t.access_token)&&(e=t.expires_at<new Date),e}var I,T,O=function(){function t(t){this.credentials=null,this.singlePromise=new d,this.tokenSectionName=t.tokenSectionName,this.storage=t.storage}return t.prototype.getStorageCredentialsSync=function(){var t=null,e=this.storage.getItemSync(this.tokenSectionName);if(null!=e)try{(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at))}catch(e){this.storage.removeItem(this.tokenSectionName),t=null}return t},t.prototype.setCredentials=function(t){return g(this,void 0,void 0,(function(){var e;return v(this,(function(n){switch(n.label){case 0:return(null==t?void 0:t.expires_in)?(t.expires_at=new Date(Date.now()+1e3*(t.expires_in-30)),this.storage?(e=JSON.stringify(t),[4,this.storage.setItem(this.tokenSectionName,e)]):[3,2]):[3,3];case 1:n.sent(),n.label=2;case 2:return this.credentials=t,[3,6];case 3:return this.storage?[4,this.storage.removeItem(this.tokenSectionName)]:[3,5];case 4:n.sent(),n.label=5;case 5:this.credentials=null,n.label=6;case 6:return[2]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("getCredentials",(function(){return g(t,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return S(this.credentials)?(t=this,[4,this.getStorageCredentials()]):[3,2];case 1:t.credentials=e.sent(),e.label=2;case 2:return[2,this.credentials]}}))}))}))]}))}))},t.prototype.getStorageCredentials=function(){return g(this,void 0,void 0,(function(){var t=this;return v(this,(function(e){return[2,this.singlePromise.run("_getStorageCredentials",(function(){return g(t,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return t=null,[4,this.storage.getItem(this.tokenSectionName)];case 1:if(null==(e=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(t=JSON.parse(e))?void 0:t.expires_at)&&(t.expires_at=new Date(t.expires_at)),[3,5];case 3:return n.sent(),[4,this.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),t=null,[3,5];case 5:return[2,t]}}))}))}))]}))}))},t}(),A=function(){function t(e){this.singlePromise=new d,this.apiOrigin=e.apiOrigin,this.clientId=e.clientId,this.retry=this.formatRetry(e.retry,t.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=E,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||_,this.localCredentials=new O({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage}),this.clientSecret=e.clientSecret,this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc}return t.prototype.setCredentials=function(t){return this.localCredentials.setCredentials(t)},t.prototype.getAccessToken=function(){return g(this,void 0,void 0,(function(){var t,e;return v(this,(function(n){switch(n.label){case 0:return[4,this.getCredentials()];case 1:return(null==(t=n.sent())?void 0:t.access_token)?[2,Promise.resolve(t.access_token)]:(e={error:i.UNAUTHENTICATED},[2,Promise.reject(e)])}}))}))},t.prototype.request=function(e,n){return g(this,void 0,void 0,(function(){var r,o,s,a,u,c,h;return v(this,(function(l){switch(l.label){case 0:return n||(n={}),r=this.formatRetry(n.retry,this.retry),n.headers=n.headers||{},this.headers&&(n.headers=y(y({},this.headers),n.headers)),n.headers[m]||(n.headers[m]=f()),n.headers[b]?[3,2]:[4,this.getDeviceId()];case 1:o=l.sent(),n.headers[b]=o,l.label=2;case 2:return(null==n?void 0:n.withCredentials)?[4,this.getCredentials()]:[3,4];case 3:return(s=l.sent())&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(s.access_token)):n.headers.Authorization="".concat(s.token_type," ").concat(s.access_token)),[3,5];case 4:this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId)),l.label=5;case 5:e.startsWith("/")&&(e=this.apiOrigin+e),a=null,u=r+1,c=0,l.label=6;case 6:if(!(c<u))return[3,15];l.label=7;case 7:return l.trys.push([7,9,,12]),[4,this.baseRequest(e,n)];case 8:return a=l.sent(),[3,15];case 9:return h=l.sent(),n.withCredentials&&h&&h.error===i.UNAUTHENTICATED?[4,this.setCredentials(null)]:[3,11];case 10:return l.sent(),[2,Promise.reject(h)];case 11:return c!==r&&h&&"unreachable"===h.error?[3,12]:[2,Promise.reject(h)];case 12:return[4,this.sleep(t.retryInterval)];case 13:l.sent(),l.label=14;case 14:return c++,[3,6];case 15:return[2,a]}}))}))},t.prototype.getCredentials=function(){return g(this,void 0,void 0,(function(){var t,e,n;return v(this,(function(r){switch(r.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return S(t=r.sent())?t&&"anonymous"===t.scope?this.anonymousSignInFunc?[4,this.anonymousSignInFunc(t)]:[3,5]:[3,8]:[3,10];case 2:return e=r.sent(),(n=e)?[3,4]:[4,this.localCredentials.getCredentials()];case 3:n=r.sent(),r.label=4;case 4:return t=n,[3,7];case 5:return[4,this.anonymousSignIn(t)];case 6:t=r.sent(),r.label=7;case 7:return[3,10];case 8:return[4,this.refreshToken(t)];case 9:t=r.sent(),r.label=10;case 10:return[2,t]}}))}))},t.prototype.getCredentialsSync=function(){return this.localCredentials.getStorageCredentialsSync()},t.prototype.getCredentialsAsync=function(){return this.getCredentials()},t.prototype.getScope=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.scope]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.getGroups=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return[4,this.localCredentials.getCredentials()];case 1:return(t=e.sent())?[2,t.groups]:[2,this.unAuthenticatedError("credentials not found")]}}))}))},t.prototype.refreshToken=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_refreshToken",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||!t.refresh_token)return[2,this.unAuthenticatedError("no refresh token found in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.refreshTokenFunc(t.refresh_token,t)];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.checkRetry=function(e){var n=null;if(("number"!=typeof e||e<t.minRetry||e>t.maxRetry)&&(n={error:i.UNREACHABLE,error_description:"wrong options param: retry"}),n)throw n;return e},t.prototype.formatRetry=function(t,e){return void 0===t?e:this.checkRetry(t)},t.prototype.sleep=function(t){return g(this,void 0,void 0,(function(){return v(this,(function(e){return[2,new Promise((function(e){setTimeout((function(){e()}),t)}))]}))}))},t.prototype.anonymousSignIn=function(t){return g(this,void 0,void 0,(function(){var e=this;return v(this,(function(n){return[2,this.singlePromise.run("_anonymous",(function(){return g(e,void 0,void 0,(function(){var e,n;return v(this,(function(r){switch(r.label){case 0:if(!t||"anonymous"!==t.scope)return[2,this.unAuthenticatedError("no anonymous in credentials")];r.label=1;case 1:return r.trys.push([1,4,,7]),[4,this.request("/auth/v1/signin/anonymously",{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret}})];case 2:return e=r.sent(),[4,this.localCredentials.setCredentials(e)];case 3:return r.sent(),[2,e];case 4:return(n=r.sent()).error!==i.INVALID_GRANT?[3,6]:[4,this.localCredentials.setCredentials(null)];case 5:return r.sent(),[2,this.unAuthenticatedError(n.error_description)];case 6:return[2,Promise.reject(n)];case 7:return[2]}}))}))}))]}))}))},t.prototype.defaultRefreshTokenFunc=function(t,e){return g(this,void 0,void 0,(function(){var n,r;return v(this,(function(i){switch(i.label){case 0:return void 0===t||""===t?[2,this.unAuthenticatedError("refresh token not found")]:(n=o.AUTH_TOKEN_URL,"v2"===(null==e?void 0:e.version)&&(n=s.AUTH_TOKEN_URL),[4,this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:t}})]);case 1:return r=i.sent(),[2,y(y({},r),{version:(null==e?void 0:e.version)||"v1"})]}}))}))},t.prototype.getDeviceId=function(){return g(this,void 0,void 0,(function(){var t;return v(this,(function(e){switch(e.label){case 0:return this.deviceID?[2,this.deviceID]:[4,this.storage.getItem(w)];case 1:return"string"==typeof(t=e.sent())&&t.length>=16&&t.length<=48?[3,3]:(t=f(),[4,this.storage.setItem(w,t)]);case 2:e.sent(),e.label=3;case 3:return this.deviceID=t,[2,t]}}))}))},t.prototype.unAuthenticatedError=function(t){var e={error:i.UNAUTHENTICATED,error_description:t};return Promise.reject(e)},t.defaultRetry=2,t.minRetry=0,t.maxRetry=5,t.retryInterval=1e3,t}();function R(){var t=globalThis.wx;if(void 0===t)return!1;if(void 0===globalThis.Page)return!1;if(!t.getSystemInfoSync)return!1;if(!t.getStorageSync)return!1;if(!t.setStorageSync)return!1;if(!t.connectSocket)return!1;if(!t.request)return!1;try{if(!t.getSystemInfoSync())return!1;if("qq"===t.getSystemInfoSync().AppPlatform)return!1}catch(t){return!1}return!0}var N=!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment;function x(){N=N||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}function C(){return N}R()||((null===(I=null===window||void 0===window?void 0:window.WeixinJSBridge)||void 0===I?void 0:I.invoke)?x():"undefined"!=typeof document&&(null===(T=document.addEventListener)||void 0===T||T.call(document,"WeixinJSBridgeReady",x,!1)));var P,D=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},L=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},U=function(){function t(t){t.openURIWithCallback||(t.openURIWithCallback=this.getDefaultOpenURIWithCallback()),t.storage||(t.storage=_),this.config=t,this.tokenSectionName="captcha_".concat(t.clientId)}return t.prototype.request=function(t,e){return D(this,void 0,void 0,(function(){var n,r,i,o;return L(this,(function(s){switch(s.label){case 0:return e||(e={}),e.method||(e.method="GET"),n="".concat(e.method,":").concat(t),r=t,e.withCaptcha?[4,this.appendCaptchaTokenToURL(t,n,!1)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this.config.request(r,e)];case 3:return i=s.sent(),[3,7];case 4:return(o=s.sent()).error!==u.CAPTCHA_REQUIRED&&o.error!==u.CAPTCHA_INVALID?[3,6]:[4,this.appendCaptchaTokenToURL(t,n,o.error===u.CAPTCHA_INVALID)];case 5:return t=s.sent(),[2,this.config.request(t,e)];case 6:return[2,Promise.reject(o)];case 7:return[2,i]}}))}))},t.prototype.getDefaultOpenURIWithCallback=function(){if(!R()&&!C()&&(window.location.search.indexOf("__captcha")>0&&(document.body.style.display="none"),null===document.getElementById("captcha_panel_wrap"))){var t=document.createElement("div");t.style.cssText="background-color: rgba(0, 0, 0, 0.7);position: fixed;left: 0px;right: 0px;top: 0px;bottom: 0px;padding: 9vw 0 0 0;display: none;z-index:100;",t.setAttribute("id","captcha_panel_wrap"),setTimeout((function(){document.body.appendChild(t)}),0)}return this.defaultOpenURIWithCallback},t.prototype.defaultOpenURIWithCallback=function(t,e){return D(this,void 0,void 0,(function(){var n,r,i,o,s,a,c;return L(this,(function(h){return r=(n=e||{}).width,i=void 0===r?"355px":r,o=n.height,s=void 0===o?"355px":o,t.match(/^(data:.*)$/)?[2,Promise.reject({error:u.UNIMPLEMENTED,error_description:"need to impl captcha data"})]:(a=document.getElementById("captcha_panel_wrap"),c=document.createElement("iframe"),a.innerHTML="",c.setAttribute("src",t),c.setAttribute("id","review-panel-iframe"),c.style.cssText="min-width:".concat(i,";display:block;height:").concat(s,";margin:0 auto;background-color: rgb(255, 255, 255);border: none;"),a.appendChild(c),a.style.display="block",[2,new Promise((function(t,e){c.onload=function(){try{var n=window.location,r=c.contentWindow.location;if(r.host+r.pathname===n.host+n.pathname){a.style.display="none";var i=new URLSearchParams(r.search),o=i.get("captcha_token");return o?t({captcha_token:o,expires_in:Number(i.get("expires_in"))}):e({error:i.get("error"),error_description:i.get("error_description")})}a.style.display="block"}catch(t){a.style.display="block"}}}))])}))}))},t.prototype.getCaptchaToken=function(t,e){return D(this,void 0,void 0,(function(){var n,r,i,s,a,u;return L(this,(function(c){switch(c.label){case 0:return t?[3,2]:[4,this.findCaptchaToken()];case 1:if(n=c.sent())return[2,n];c.label=2;case 2:return R()||C()?[3,4]:(i="".concat(window.location.origin+window.location.pathname,"?__captcha=on"),[4,this.config.request(o.GET_CAPTCHA_URL,{method:"POST",body:{client_id:this.config.clientId,redirect_uri:i,state:e},withCredentials:!1})]);case 3:return(r=c.sent()).captcha_token?(s={captcha_token:r.captcha_token,expires_in:r.expires_in},this.saveCaptchaToken(s),[2,r.captcha_token]):[3,6];case 4:return[4,this.config.request(o.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:""},withCredentials:!1})];case 5:a=c.sent(),r={url:"".concat(a.data,"?state=").concat(encodeURIComponent(e),"&token=").concat(encodeURIComponent(a.token))},c.label=6;case 6:return[4,this.config.openURIWithCallback(r.url)];case 7:return u=c.sent(),this.saveCaptchaToken(u),[2,u.captcha_token]}}))}))},t.prototype.appendCaptchaTokenToURL=function(t,e,n){return D(this,void 0,void 0,(function(){var r;return L(this,(function(i){switch(i.label){case 0:return[4,this.getCaptchaToken(n,e)];case 1:return r=i.sent(),t.indexOf("?")>0?t+="&captcha_token=".concat(r):t+="?captcha_token=".concat(r),[2,t]}}))}))},t.prototype.saveCaptchaToken=function(t){return D(this,void 0,void 0,(function(){var e;return L(this,(function(n){switch(n.label){case 0:return t.expires_at=new Date(Date.now()+1e3*(t.expires_in-10)),e=JSON.stringify(t),[4,this.config.storage.setItem(this.tokenSectionName,e)];case 1:return n.sent(),[2]}}))}))},t.prototype.findCaptchaToken=function(){return D(this,void 0,void 0,(function(){var t,e;return L(this,(function(n){switch(n.label){case 0:return[4,this.config.storage.getItem(this.tokenSectionName)];case 1:if(null==(t=n.sent()))return[3,5];n.label=2;case 2:return n.trys.push([2,3,,5]),(null==(e=JSON.parse(t))?void 0:e.expires_at)&&(e.expires_at=new Date(e.expires_at)),e.expires_at<new Date?[2,null]:[2,e.captcha_token];case 3:return n.sent(),[4,this.config.storage.removeItem(this.tokenSectionName)];case 4:return n.sent(),[2,null];case 5:return[2,null]}}))}))},t}(),j=function(t){var e=function(e){for(var n in t)t.hasOwnProperty(n)&&(e[n]=j(t[n]));return e},n=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(n))return t.slice();switch(n){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},B=(P=function(t,e){return P=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},P(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}P(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),k="0123456789abcdefghijklmnopqrstuvwxyz";function M(t){return k.charAt(t)}function q(t,e){return t&e}function V(t,e){return t|e}function F(t,e){return t^e}function H(t,e){return t&~e}function W(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function $(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",K="=";function J(t){var e,n,r="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),r+=G.charAt(n>>6)+G.charAt(63&n);for(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),r+=G.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),r+=G.charAt(n>>2)+G.charAt((3&n)<<4));(3&r.length)>0;)r+=K;return r}function Y(t){var e,n="",r=0,i=0;for(e=0;e<t.length&&t.charAt(e)!=K;++e){var o=G.indexOf(t.charAt(e));o<0||(0==r?(n+=M(o>>2),i=3&o,r=1):1==r?(n+=M(i<<2|o>>4),i=15&o,r=2):2==r?(n+=M(i),n+=M(o>>2),i=3&o,r=3):(n+=M(i<<2|o>>4),n+=M(15&o),r=0))}return 1==r&&(n+=M(i<<2)),n}var z,Z,Q={decode:function(t){var e;if(void 0===Z){var n="= \f\n\r\t \u2028\u2029";for(Z=Object.create(null),e=0;e<64;++e)Z["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<n.length;++e)Z[n.charAt(e)]=-1}var r=[],i=0,o=0;for(e=0;e<t.length;++e){var s=t.charAt(e);if("="==s)break;if(-1!=(s=Z[s])){if(void 0===s)throw new Error("Illegal character at offset "+e);i|=s,++o>=4?(r[r.length]=i>>16,r[r.length]=i>>8&255,r[r.length]=255&i,i=0,o=0):i<<=6}}switch(o){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=i>>10;break;case 3:r[r.length]=i>>16,r[r.length]=i>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=Q.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return Q.decode(t)}},X=1e13,tt=function(){function t(t){this.buf=[+t||0]}return t.prototype.mulAdd=function(t,e){var n,r,i=this.buf,o=i.length;for(n=0;n<o;++n)(r=i[n]*t+e)<X?e=0:r-=(e=0|r/X)*X,i[n]=r;e>0&&(i[n]=e)},t.prototype.sub=function(t){var e,n,r=this.buf,i=r.length;for(e=0;e<i;++e)(n=r[e]-t)<0?(n+=X,t=1):t=0,r[e]=n;for(;0===r[r.length-1];)r.pop()},t.prototype.toString=function(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,n=e[e.length-1].toString(),r=e.length-2;r>=0;--r)n+=(X+e[r]).toString().substring(1);return n},t.prototype.valueOf=function(){for(var t=this.buf,e=0,n=t.length-1;n>=0;--n)e=e*X+t[n];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),et="…",nt=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,rt=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function it(t,e){return t.length>e&&(t=t.substring(0,e)+et),t}var ot,st=function(){function t(e,n){this.hexDigits="0123456789ABCDEF",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=n)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]},t.prototype.hexByte=function(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)},t.prototype.hexDump=function(t,e,n){for(var r="",i=t;i<e;++i)if(r+=this.hexByte(this.get(i)),!0!==n)switch(15&i){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},t.prototype.isASCII=function(t,e){for(var n=t;n<e;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},t.prototype.parseStringISO=function(t,e){for(var n="",r=t;r<e;++r)n+=String.fromCharCode(this.get(r));return n},t.prototype.parseStringUTF=function(t,e){for(var n="",r=t;r<e;){var i=this.get(r++);n+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(r++)):String.fromCharCode((15&i)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},t.prototype.parseStringBMP=function(t,e){for(var n,r,i="",o=t;o<e;)n=this.get(o++),r=this.get(o++),i+=String.fromCharCode(n<<8|r);return i},t.prototype.parseTime=function(t,e,n){var r=this.parseStringISO(t,e),i=(n?nt:rt).exec(r);return i?(n&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),r=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(r+=":"+i[5],i[6]&&(r+=":"+i[6],i[7]&&(r+="."+i[7]))),i[8]&&(r+=" UTC","Z"!=i[8]&&(r+=i[8],i[9]&&(r+=":"+i[9]))),r):"Unrecognized time: "+r},t.prototype.parseInteger=function(t,e){for(var n,r=this.get(t),i=r>127,o=i?255:0,s="";r==o&&++t<e;)r=this.get(t);if(0==(n=e-t))return i?-1:0;if(n>4){for(s=r,n<<=3;0==(128&(+s^o));)s=+s<<1,--n;s="("+n+" bit)\n"}i&&(r-=256);for(var a=new tt(r),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()},t.prototype.parseBitString=function(t,e,n){for(var r=this.get(t),i="("+((e-t-1<<3)-r)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?r:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>n)return i+it(o,n)}return i+o},t.prototype.parseOctetString=function(t,e,n){if(this.isASCII(t,e))return it(this.parseStringISO(t,e),n);var r=e-t,i="("+r+" byte)\n";r>(n/=2)&&(e=t+n);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return r>n&&(i+=et),i},t.prototype.parseOID=function(t,e,n){for(var r="",i=new tt,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===r)if((i=i.simplify())instanceof tt)i.sub(80),r="2."+i.toString();else{var u=i<80?i<40?0:1:2;r=u+"."+(i-40*u)}else r+="."+i.toString();if(r.length>n)return it(r,n);i=new tt,o=0}}return o>0&&(r+=".incomplete"),r},t}(),at=function(){function t(t,e,n,r,i){if(!(r instanceof ut))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=n,this.tag=r,this.sub=i}return t.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+n,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+n,t);case 6:return this.stream.parseOID(e,e+n,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return it(this.stream.parseStringUTF(e,e+n),t);case 18:case 19:case 20:case 21:case 22:case 26:return it(this.stream.parseStringISO(e,e+n),t);case 30:return it(this.stream.parseStringBMP(e,e+n),t);case 23:case 24:return this.stream.parseTime(e,e+n,23==this.tag.tagNumber)}return null},t.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toPrettyString=function(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var n=0,r=this.sub.length;n<r;++n)e+=this.sub[n].toPrettyString(t)}return e},t.prototype.posStart=function(){return this.stream.pos},t.prototype.posContent=function(){return this.stream.pos+this.header},t.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},t.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},t.decodeLength=function(t){var e=t.get(),n=127&e;if(n==e)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===n)return null;e=0;for(var r=0;r<n;++r)e=256*e+t.get();return e},t.prototype.getHexStringValue=function(){var t=this.toHexString(),e=2*this.header,n=2*this.length;return t.substr(e,n)},t.decode=function(e){var n;n=e instanceof st?e:new st(e,0);var r=new st(n),i=new ut(n),o=t.decodeLength(n),s=n.pos,a=s-r.pos,u=null,c=function(){var e=[];if(null!==o){for(var r=s+o;n.pos<r;)e[e.length]=t.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var i=t.decode(n);if(i.tag.isEOC())break;e[e.length]=i}o=s-n.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return e};if(i.tagConstructed)u=c();else if(i.isUniversal()&&(3==i.tagNumber||4==i.tagNumber))try{if(3==i.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");u=c();for(var h=0;h<u.length;++h)if(u[h].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){u=null}if(null===u){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);n.pos=s+Math.abs(o)}return new t(r,a,o,i,u)},t}(),ut=function(){function t(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=0!=(32&e),this.tagNumber=31&e,31==this.tagNumber){var n=new tt;do{e=t.get(),n.mulAdd(128,127&e)}while(128&e);this.tagNumber=n.simplify()}}return t.prototype.isUniversal=function(){return 0===this.tagClass},t.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},t}(),ct=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ht=(1<<26)/ct[ct.length-1],ft=function(){function t(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}return t.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,r=(1<<e)-1,i=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(i=!0,o=M(n));s>=0;)a<e?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&r,a<=0&&(a+=this.DB,--s)),n>0&&(i=!0),i&&(o+=M(n));return i?o:"0"},t.prototype.negate=function(){var e=gt();return t.ZERO.subTo(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},t.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+St(this[this.t-1]^this.s&this.DM)},t.prototype.mod=function(e){var n=gt();return this.abs().divRemTo(e,null,n),this.s<0&&n.compareTo(t.ZERO)>0&&e.subTo(n,n),n},t.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new pt(e):new dt(e),this.exp(t,n)},t.prototype.clone=function(){var t=gt();return this.copyTo(t),t},t.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},t.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},t.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.toByteArray=function(){var t=this.t,e=[];e[0]=this.s;var n,r=this.DB-t*this.DB%8,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e},t.prototype.equals=function(t){return 0==this.compareTo(t)},t.prototype.min=function(t){return this.compareTo(t)<0?this:t},t.prototype.max=function(t){return this.compareTo(t)>0?this:t},t.prototype.and=function(t){var e=gt();return this.bitwiseTo(t,q,e),e},t.prototype.or=function(t){var e=gt();return this.bitwiseTo(t,V,e),e},t.prototype.xor=function(t){var e=gt();return this.bitwiseTo(t,F,e),e},t.prototype.andNot=function(t){var e=gt();return this.bitwiseTo(t,H,e),e},t.prototype.not=function(){for(var t=gt(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},t.prototype.shiftLeft=function(t){var e=gt();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},t.prototype.shiftRight=function(t){var e=gt();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},t.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+W(this[t]);return this.s<0?this.t*this.DB:-1},t.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=$(this[n]^e);return t},t.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},t.prototype.setBit=function(t){return this.changeBit(t,V)},t.prototype.clearBit=function(t){return this.changeBit(t,H)},t.prototype.flipBit=function(t){return this.changeBit(t,F)},t.prototype.add=function(t){var e=gt();return this.addTo(t,e),e},t.prototype.subtract=function(t){var e=gt();return this.subTo(t,e),e},t.prototype.multiply=function(t){var e=gt();return this.multiplyTo(t,e),e},t.prototype.divide=function(t){var e=gt();return this.divRemTo(t,e,null),e},t.prototype.remainder=function(t){var e=gt();return this.divRemTo(t,null,e),e},t.prototype.divideAndRemainder=function(t){var e=gt(),n=gt();return this.divRemTo(t,e,n),[e,n]},t.prototype.modPow=function(t,e){var n,r,i=t.bitLength(),o=_t(1);if(i<=0)return o;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new pt(e):e.isEven()?new yt(e):new dt(e);var s=[],a=3,u=n-1,c=(1<<n)-1;if(s[1]=r.convert(this),n>1){var h=gt();for(r.sqrTo(s[1],h);a<=c;)s[a]=gt(),r.mulTo(h,s[a-2],s[a]),a+=2}var f,l,p=t.t-1,d=!0,y=gt();for(i=St(t[p])-1;p>=0;){for(i>=u?f=t[p]>>i-u&c:(f=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(f|=t[p-1]>>this.DB+i-u)),a=n;0==(1&f);)f>>=1,--a;if((i-=a)<0&&(i+=this.DB,--p),d)s[f].copyTo(o),d=!1;else{for(;a>1;)r.sqrTo(o,y),r.sqrTo(y,o),a-=2;a>0?r.sqrTo(o,y):(l=o,o=y,y=l),r.mulTo(y,s[f],o)}for(;p>=0&&0==(t[p]&1<<i);)r.sqrTo(o,y),l=o,o=y,y=l,--i<0&&(i=this.DB-1,--p)}return r.revert(o)},t.prototype.modInverse=function(e){var n=e.isEven();if(this.isEven()&&n||0==e.signum())return t.ZERO;for(var r=e.clone(),i=this.clone(),o=_t(1),s=_t(0),a=_t(0),u=_t(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),n?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(e,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;i.isEven();)i.rShiftTo(1,i),n?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(e,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(e,u),u.rShiftTo(1,u);r.compareTo(i)>=0?(r.subTo(i,r),n&&o.subTo(a,o),s.subTo(u,s)):(i.subTo(r,i),n&&a.subTo(o,a),u.subTo(s,u))}return 0!=i.compareTo(t.ONE)?t.ZERO:u.compareTo(e)>=0?u.subtract(e):u.signum()<0?(u.addTo(e,u),u.signum()<0?u.add(e):u):u},t.prototype.pow=function(t){return this.exp(t,new lt)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var i=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},t.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=ct[ct.length-1]){for(e=0;e<ct.length;++e)if(n[0]==ct[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<ct.length;){for(var r=ct[e],i=e+1;i<ct.length&&r<ht;)r*=ct[i++];for(r=n.modInt(r);e<i;)if(r%ct[e++]==0)return!1}return n.millerRabin(t)},t.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},t.prototype.fromString=function(e,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(e,n);r=2}this.t=0,this.s=0;for(var i=e.length,o=!1,s=0;--i>=0;){var a=8==r?255&+e[i]:Et(e,i);a<0?"-"==e.charAt(i)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&+e[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&t.ZERO.subTo(this,this)},t.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},t.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},t.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},t.prototype.lShiftTo=function(t,e){for(var n=t%this.DB,r=this.DB-n,i=(1<<r)-1,o=Math.floor(t/this.DB),s=this.s<<n&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>r|s,s=(this[a]&i)<<n;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()},t.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,i=this.DB-r,o=(1<<r)-1;e[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<i,e[s-n]=this[s]>>r;r>0&&(e[this.t-n-1]|=(this.s&o)<<i),e.t=this.t-n,e.clamp()}},t.prototype.subTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},t.prototype.multiplyTo=function(e,n){var r=this.abs(),i=e.abs(),o=r.t;for(n.t=o+i.t;--o>=0;)n[o]=0;for(o=0;o<i.t;++o)n[o+r.t]=r.am(0,i[o],n,o,0,r.t);n.s=0,n.clamp(),this.s!=e.s&&t.ZERO.subTo(n,n)},t.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},t.prototype.divRemTo=function(e,n,r){var i=e.abs();if(!(i.t<=0)){var o=this.abs();if(o.t<i.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=gt());var s=gt(),a=this.s,u=e.s,c=this.DB-St(i[i.t-1]);c>0?(i.lShiftTo(c,s),o.lShiftTo(c,r)):(i.copyTo(s),o.copyTo(r));var h=s.t,f=s[h-1];if(0!=f){var l=f*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),p=this.FV/l,d=(1<<this.F1)/l,y=1<<this.F2,g=r.t,v=g-h,m=null==n?gt():n;for(s.dlShiftTo(v,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),t.ONE.dlShiftTo(h,m),m.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--v>=0;){var b=r[--g]==f?this.DM:Math.floor(r[g]*p+(r[g-1]+y)*d);if((r[g]+=s.am(0,b,r,v,0,h))<b)for(s.dlShiftTo(v,m),r.subTo(m,r);r[g]<--b;)r.subTo(m,r)}null!=n&&(r.drShiftTo(h,n),a!=u&&t.ZERO.subTo(n,n)),r.t=h,r.clamp(),c>0&&r.rShiftTo(c,r),a<0&&t.ZERO.subTo(r,r)}}},t.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},t.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,n){if(e>4294967295||e<1)return t.ONE;var r=gt(),i=gt(),o=n.convert(this),s=St(e)-1;for(o.copyTo(r);--s>=0;)if(n.sqrTo(r,i),(e&1<<s)>0)n.mulTo(i,o,r);else{var a=r;r=i,i=a}return n.revert(r)},t.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},t.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=_t(n),i=gt(),o=gt(),s="";for(this.divRemTo(r,i,o);i.signum()>0;)s=(n+o.intValue()).toString(t).substr(1)+s,i.divRemTo(r,i,o);return o.intValue().toString(t)+s},t.prototype.fromRadix=function(e,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),i=Math.pow(n,r),o=!1,s=0,a=0,u=0;u<e.length;++u){var c=Et(e,u);c<0?"-"==e.charAt(u)&&0==this.signum()&&(o=!0):(a=n*a+c,++s>=r&&(this.dMultiply(i),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(n,s)),this.dAddOffset(a,0)),o&&t.ZERO.subTo(this,this)},t.prototype.fromNumber=function(e,n,r){if("number"==typeof n)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),V,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(n);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(t.ONE.shiftLeft(e-1),this);else{var i=[],o=7&e;i.length=1+(e>>3),n.nextBytes(i),o>0?i[0]&=(1<<o)-1:i[0]=0,this.fromString(i,256)}},t.prototype.bitwiseTo=function(t,e,n){var r,i,o=Math.min(t.t,this.t);for(r=0;r<o;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(i=t.s&this.DM,r=o;r<this.t;++r)n[r]=e(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=o;r<t.t;++r)n[r]=e(i,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},t.prototype.changeBit=function(e,n){var r=t.ONE.shiftLeft(e);return this.bitwiseTo(r,n,r),r},t.prototype.addTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},t.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},t.prototype.multiplyLowerTo=function(t,e,n){var r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(var i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,t[r],n,r,0,this.t);for(i=Math.min(t.t,e);r<i;++r)this.am(0,t[r],n,r,0,e-r);n.clamp()},t.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},t.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},t.prototype.millerRabin=function(e){var n=this.subtract(t.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var i=n.shiftRight(r);(e=e+1>>1)>ct.length&&(e=ct.length);for(var o=gt(),s=0;s<e;++s){o.fromInt(ct[Math.floor(Math.random()*ct.length)]);var a=o.modPow(i,this);if(0!=a.compareTo(t.ONE)&&0!=a.compareTo(n)){for(var u=1;u++<r&&0!=a.compareTo(n);)if(0==(a=a.modPowInt(2,this)).compareTo(t.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},t.prototype.square=function(){var t=gt();return this.squareTo(t),t},t.prototype.gcda=function(t,e){var n=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(n.compareTo(r)<0){var i=n;n=r,r=i}var o=n.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)e(n);else{o<s&&(s=o),s>0&&(n.rShiftTo(s,n),r.rShiftTo(s,r));var a=function(){(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(a,0):(s>0&&r.lShiftTo(s,r),setTimeout((function(){e(r)}),0))};setTimeout(a,10)}},t.prototype.fromNumberAsync=function(e,n,r,i){if("number"==typeof n)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(t.ONE.shiftLeft(e-1),V,this),this.isEven()&&this.dAddOffset(1,0);var o=this,s=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(t.ONE.shiftLeft(e-1),o),o.isProbablePrime(n)?setTimeout((function(){i()}),0):setTimeout(s,0)};setTimeout(s,0)}else{var a=[],u=7&e;a.length=1+(e>>3),n.nextBytes(a),u>0?a[0]&=(1<<u)-1:a[0]=0,this.fromString(a,256)}},t}(),lt=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),pt=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),dt=function(){function t(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}return t.prototype.convert=function(t){var e=gt();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(ft.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=gt();return t.copyTo(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),yt=function(){function t(t){this.m=t,this.r2=gt(),this.q3=gt(),ft.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=gt();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},t.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function gt(){return new ft(null)}function vt(t,e){return new ft(t,e)}"Microsoft Internet Explorer"==(null===navigator||void 0===navigator?void 0:navigator.appName)?(ft.prototype.am=function(t,e,n,r,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+n[r]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),n[r++]=1073741823&u}return i},ot=30):"Netscape"!=(null===navigator||void 0===navigator?void 0:navigator.appName)?(ft.prototype.am=function(t,e,n,r,i,o){for(;--o>=0;){var s=e*this[t++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},ot=26):(ft.prototype.am=function(t,e,n,r,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+n[r]+i)>>28)+(h>>14)+a*c,n[r++]=268435455&u}return i},ot=28),ft.prototype.DB=ot,ft.prototype.DM=(1<<ot)-1,ft.prototype.DV=1<<ot,ft.prototype.FV=Math.pow(2,52),ft.prototype.F1=52-ot,ft.prototype.F2=2*ot-52;var mt,bt,wt=[];for(mt="0".charCodeAt(0),bt=0;bt<=9;++bt)wt[mt++]=bt;for(mt="a".charCodeAt(0),bt=10;bt<36;++bt)wt[mt++]=bt;for(mt="A".charCodeAt(0),bt=10;bt<36;++bt)wt[mt++]=bt;function Et(t,e){var n=wt[t.charCodeAt(e)];return null==n?-1:n}function _t(t){var e=gt();return e.fromInt(t),e}function St(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}ft.ZERO=_t(0),ft.ONE=_t(1);var It,Tt,Ot=function(){function t(){this.i=0,this.j=0,this.S=[]}return t.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},t.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},t}(),At=256,Rt=null;if(null==Rt){Rt=[],Tt=0;var Nt=void 0;if((null===window||void 0===window?void 0:window.crypto)&&(null===window||void 0===window?void 0:window.crypto.getRandomValues)){var xt=new Uint32Array(256);for(null===window||void 0===window||window.crypto.getRandomValues(xt),Nt=0;Nt<xt.length;++Nt)Rt[Tt++]=255&xt[Nt]}var Ct=function(t){if(this.count=this.count||0,this.count>=256||Tt>=At)(null===window||void 0===window?void 0:window.removeEventListener)?null===window||void 0===window||window.removeEventListener("mousemove",Ct,!1):(null===window||void 0===window?void 0:window.detachEvent)&&(null===window||void 0===window||window.detachEvent("onmousemove",Ct));else try{var e=t.x+t.y;Rt[Tt++]=255&e,this.count+=1}catch(t){}};(null===window||void 0===window?void 0:window.addEventListener)?null===window||void 0===window||window.addEventListener("mousemove",Ct,!1):(null===window||void 0===window?void 0:window.attachEvent)&&(null===window||void 0===window||window.attachEvent("onmousemove",Ct))}function Pt(){if(null==It){for(It=new Ot;Tt<At;){var t=Math.floor(65536*Math.random());Rt[Tt++]=255&t}for(It.init(Rt),Tt=0;Tt<Rt.length;++Tt)Rt[Tt]=0;Tt=0}return It.next()}var Dt=function(){function t(){}return t.prototype.nextBytes=function(t){for(var e=0;e<t.length;++e)t[e]=Pt()},t}(),Lt=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return t.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},t.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),n=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(n)<0;)e=e.add(this.p);return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},t.prototype.setPublic=function(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=vt(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")},t.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var n=[],r=t.length-1;r>=0&&e>0;){var i=t.charCodeAt(r--);i<128?n[--e]=i:i>127&&i<2048?(n[--e]=63&i|128,n[--e]=i>>6|192):(n[--e]=63&i|128,n[--e]=i>>6&63|128,n[--e]=i>>12|224)}n[--e]=0;for(var o=new Dt,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);n[--e]=s[0]}return n[--e]=2,n[--e]=0,new ft(n)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var r=n.toString(16);return 0==(1&r.length)?r:"0"+r},t.prototype.encryptLong=function(t){var e=this,n=(this.n.bitLength()+7>>3)-11;try{var r="";return t.length>n?(t.match(/.{1,117}/g).forEach((function(t){var n=e.encrypt(t);r+=n})),J(r)):J(this.encrypt(t))}catch(t){return!1}},t.prototype.decryptLong=function(t){var e=this,n=this.n.bitLength()+7>>3;t=Y(t);try{if(t.length>n){var r="";return t.match(/.{1,256}/g).forEach((function(t){var n=e.decrypt(t);r+=n})),r}return this.decrypt(t)}catch(t){return!1}},t.prototype.setPrivate=function(t,e,n){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=vt(t,16),this.e=parseInt(e,16),this.d=vt(n,16)):console.error("Invalid RSA private key")},t.prototype.setPrivateEx=function(t,e,n,r,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=vt(t,16),this.e=parseInt(e,16),this.d=vt(n,16),this.p=vt(r,16),this.q=vt(i,16),this.dmp1=vt(o,16),this.dmq1=vt(s,16),this.coeff=vt(a,16)):console.error("Invalid RSA private key")},t.prototype.generate=function(t,e){var n=new Dt,r=t>>1;this.e=parseInt(e,16);for(var i=new ft(e,16);;){for(;this.p=new ft(t-r,1,n),0!=this.p.subtract(ft.ONE).gcd(i).compareTo(ft.ONE)||!this.p.isProbablePrime(10););for(;this.q=new ft(r,1,n),0!=this.q.subtract(ft.ONE).gcd(i).compareTo(ft.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract(ft.ONE),a=this.q.subtract(ft.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo(ft.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},t.prototype.decrypt=function(t){var e=vt(t,16),n=this.doPrivate(e);return null==n?null:function(t,e){for(var n=t.toByteArray(),r=0;r<n.length&&0==n[r];)++r;if(n.length-r!=e-1||2!=n[r])return null;for(++r;0!=n[r];)if(++r>=n.length)return null;for(var i="";++r<n.length;){var o=255&n[r];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&o)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},t.prototype.generateAsync=function(t,e,n){var r=new Dt,i=t>>1;this.e=parseInt(e,16);var o=new ft(e,16),s=this,a=function(){var e=function(){if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract(ft.ONE),r=s.q.subtract(ft.ONE),i=e.multiply(r);0==i.gcd(o).compareTo(ft.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(r),s.coeff=s.q.modInverse(s.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},u=function(){s.q=gt(),s.q.fromNumberAsync(i,1,r,(function(){s.q.subtract(ft.ONE).gcda(o,(function(t){0==t.compareTo(ft.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)}))}))},c=function(){s.p=gt(),s.p.fromNumberAsync(t-i,1,r,(function(){s.p.subtract(ft.ONE).gcda(o,(function(t){0==t.compareTo(ft.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)}))}))};setTimeout(c,0)};setTimeout(a,0)},t.prototype.sign=function(t,e,n){var r=function(t,e){if(e<t.length+22)return console.error("Message too long for RSA"),null;for(var n=e-t.length-6,r="",i=0;i<n;i+=2)r+="ff";return vt("0001"+r+"00"+t,16)}((Ut[n]||"")+e(t).toString(),this.n.bitLength()/4);if(null==r)return null;var i=this.doPrivate(r);if(null==i)return null;var o=i.toString(16);return 0==(1&o.length)?o:"0"+o},t.prototype.verify=function(t,e,n){var r=vt(e,16),i=this.doPublic(r);return null==i?null:function(t){for(var e in Ut)if(Ut.hasOwnProperty(e)){var n=Ut[e],r=n.length;if(t.substr(0,r)==n)return t.substr(r)}return t}(i.toString(16).replace(/^1f+00/,""))==n(t).toString()},t}(),Ut={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"},jt={};jt.lang={extend:function(t,e,n){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var r=function(){};if(r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),n){var i;for(i in n)t.prototype[i]=n[i];var o=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(o=function(t,e){for(i=0;i<s.length;i+=1){var n=s[i],r=e[n];"function"==typeof r&&r!=Object.prototype[n]&&(t[n]=r)}})}catch(t){}o(t.prototype,n)}}};var Bt={};void 0!==Bt.asn1&&Bt.asn1||(Bt.asn1={}),Bt.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var n=e.substr(1).length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";e=new ft(r,16).xor(t).add(ft.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return hextopem(t,e)},this.newObject=function(t){var e=Bt.asn1,n=e.DERBoolean,r=e.DERInteger,i=e.DERBitString,o=e.DEROctetString,s=e.DERNull,a=e.DERObjectIdentifier,u=e.DEREnumerated,c=e.DERUTF8String,h=e.DERNumericString,f=e.DERPrintableString,l=e.DERTeletexString,p=e.DERIA5String,d=e.DERUTCTime,y=e.DERGeneralizedTime,g=e.DERSequence,v=e.DERSet,m=e.DERTaggedObject,b=e.ASN1Util.newObject,w=Object.keys(t);if(1!=w.length)throw"key of param shall be only one.";var E=w[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+E+":"))throw"undefined key: "+E;if("bool"==E)return new n(t[E]);if("int"==E)return new r(t[E]);if("bitstr"==E)return new i(t[E]);if("octstr"==E)return new o(t[E]);if("null"==E)return new s(t[E]);if("oid"==E)return new a(t[E]);if("enum"==E)return new u(t[E]);if("utf8str"==E)return new c(t[E]);if("numstr"==E)return new h(t[E]);if("prnstr"==E)return new f(t[E]);if("telstr"==E)return new l(t[E]);if("ia5str"==E)return new p(t[E]);if("utctime"==E)return new d(t[E]);if("gentime"==E)return new y(t[E]);if("seq"==E){for(var _=t[E],S=[],I=0;I<_.length;I++){var T=b(_[I]);S.push(T)}return new g({array:S})}if("set"==E){for(_=t[E],S=[],I=0;I<_.length;I++)T=b(_[I]),S.push(T);return new v({array:S})}if("tag"==E){var O=t[E];if("[object Array]"===Object.prototype.toString.call(O)&&3==O.length){var A=b(O[2]);return new m({tag:O[0],explicit:O[1],obj:A})}var R={};if(void 0!==O.explicit&&(R.explicit=O.explicit),void 0!==O.tag&&(R.tag=O.tag),void 0===O.obj)throw"obj shall be specified for 'tag'.";return R.obj=b(O.obj),new m(R)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},Bt.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",n=parseInt(t.substr(0,2),16),r=(e=Math.floor(n/40)+"."+n%40,""),i=2;i<t.length;i+=2){var o=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);r+=o.substr(1,7),"0"==o.substr(0,1)&&(e=e+"."+new ft(r,2).toString(10),r="")}return e},Bt.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new ft(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},Bt.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+n).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},Bt.asn1.DERAbstractString=function(t){Bt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},jt.lang.extend(Bt.asn1.DERAbstractString,Bt.asn1.ASN1Object),Bt.asn1.DERAbstractTime=function(t){Bt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,n){var r=this.zeroPadding,i=this.localDateToUTC(t),o=String(i.getFullYear());"utc"==e&&(o=o.substr(2,2));var s=o+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var a=i.getMilliseconds();if(0!=a){var u=r(String(a),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=stohex(t)},this.setByDateValue=function(t,e,n,r,i,o){var s=new Date(Date.UTC(t,e-1,n,r,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},jt.lang.extend(Bt.asn1.DERAbstractTime,Bt.asn1.ASN1Object),Bt.asn1.DERAbstractStructured=function(t){Bt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},jt.lang.extend(Bt.asn1.DERAbstractStructured,Bt.asn1.ASN1Object),Bt.asn1.DERBoolean=function(){Bt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},jt.lang.extend(Bt.asn1.DERBoolean,Bt.asn1.ASN1Object),Bt.asn1.DERInteger=function(t){Bt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Bt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new ft(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},jt.lang.extend(Bt.asn1.DERInteger,Bt.asn1.ASN1Object),Bt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Bt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}Bt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var n="0"+t;this.hTLV=null,this.isModified=!0,this.hV=n+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var n=0;n<=e;n++)t+="0";var r="";for(n=0;n<t.length-1;n+=8){var i=t.substr(n,8),o=parseInt(i,2).toString(16);1==o.length&&(o="0"+o),r+=o}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",n=0;n<t.length;n++)1==t[n]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},jt.lang.extend(Bt.asn1.DERBitString,Bt.asn1.ASN1Object),Bt.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=Bt.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}Bt.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},jt.lang.extend(Bt.asn1.DEROctetString,Bt.asn1.DERAbstractString),Bt.asn1.DERNull=function(){Bt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},jt.lang.extend(Bt.asn1.DERNull,Bt.asn1.ASN1Object),Bt.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new ft(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var o="",s=0;s<i;s++)o+="0";for(r=o+r,s=0;s<r.length-1;s+=7){var a=r.substr(s,7);s!=r.length-7&&(a="1"+a),n+=e(parseInt(a,2))}return n};Bt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),o=40*parseInt(i[0])+parseInt(i[1]);r+=e(o),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var e=Bt.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},jt.lang.extend(Bt.asn1.DERObjectIdentifier,Bt.asn1.ASN1Object),Bt.asn1.DEREnumerated=function(t){Bt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Bt.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new ft(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},jt.lang.extend(Bt.asn1.DEREnumerated,Bt.asn1.ASN1Object),Bt.asn1.DERUTF8String=function(t){Bt.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},jt.lang.extend(Bt.asn1.DERUTF8String,Bt.asn1.DERAbstractString),Bt.asn1.DERNumericString=function(t){Bt.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},jt.lang.extend(Bt.asn1.DERNumericString,Bt.asn1.DERAbstractString),Bt.asn1.DERPrintableString=function(t){Bt.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},jt.lang.extend(Bt.asn1.DERPrintableString,Bt.asn1.DERAbstractString),Bt.asn1.DERTeletexString=function(t){Bt.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},jt.lang.extend(Bt.asn1.DERTeletexString,Bt.asn1.DERAbstractString),Bt.asn1.DERIA5String=function(t){Bt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},jt.lang.extend(Bt.asn1.DERIA5String,Bt.asn1.DERAbstractString),Bt.asn1.DERUTCTime=function(t){Bt.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},jt.lang.extend(Bt.asn1.DERUTCTime,Bt.asn1.DERAbstractTime),Bt.asn1.DERGeneralizedTime=function(t){Bt.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},jt.lang.extend(Bt.asn1.DERGeneralizedTime,Bt.asn1.DERAbstractTime),Bt.asn1.DERSequence=function(t){Bt.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].getEncodedHex();return this.hV=t,this.hV}},jt.lang.extend(Bt.asn1.DERSequence,Bt.asn1.DERAbstractStructured),Bt.asn1.DERSet=function(t){Bt.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t.push(n.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},jt.lang.extend(Bt.asn1.DERSet,Bt.asn1.DERAbstractStructured),Bt.asn1.DERTaggedObject=function(t){Bt.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},jt.lang.extend(Bt.asn1.DERTaggedObject,Bt.asn1.ASN1Object);var kt=function(t){function e(t){void 0===t&&(t="");var e=this;return t&&("string"==typeof t?e.parseKey(t):(e.hasPrivateKeyProperty(t)||e.hasPublicKeyProperty(t))&&e.parsePropertiesFrom(t)),e}return B(e,t),e.prototype.parseKey=function(t){try{var e=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?function(t){var e;if(void 0===z){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(z={},e=0;e<16;++e)z[n.charAt(e)]=e;for(n=n.toLowerCase(),e=10;e<16;++e)z[n.charAt(e)]=e;for(e=0;e<r.length;++e)z[r.charAt(e)]=-1}var i=[],o=0,s=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=z[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);o|=a,++s>=2?(i[i.length]=o,o=0,s=0):o<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return i}(t):Q.unarmor(t),i=at.decode(r);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=vt(e,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var o=i.sub[3].getHexStringValue();this.d=vt(o,16);var s=i.sub[4].getHexStringValue();this.p=vt(s,16);var a=i.sub[5].getHexStringValue();this.q=vt(a,16);var u=i.sub[6].getHexStringValue();this.dmp1=vt(u,16);var c=i.sub[7].getHexStringValue();this.dmq1=vt(c,16);var h=i.sub[8].getHexStringValue();this.coeff=vt(h,16)}else{if(2!==i.sub.length)return!1;var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=vt(e,16),n=f.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(t){return!1}},e.prototype.getPrivateBaseKey=function(){var t={array:[new Bt.asn1.DERInteger({int:0}),new Bt.asn1.DERInteger({bigint:this.n}),new Bt.asn1.DERInteger({int:this.e}),new Bt.asn1.DERInteger({bigint:this.d}),new Bt.asn1.DERInteger({bigint:this.p}),new Bt.asn1.DERInteger({bigint:this.q}),new Bt.asn1.DERInteger({bigint:this.dmp1}),new Bt.asn1.DERInteger({bigint:this.dmq1}),new Bt.asn1.DERInteger({bigint:this.coeff})]};return new Bt.asn1.DERSequence(t).getEncodedHex()},e.prototype.getPrivateBaseKeyB64=function(){return J(this.getPrivateBaseKey())},e.prototype.getPublicBaseKey=function(){var t=new Bt.asn1.DERSequence({array:[new Bt.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new Bt.asn1.DERNull]}),e=new Bt.asn1.DERSequence({array:[new Bt.asn1.DERInteger({bigint:this.n}),new Bt.asn1.DERInteger({int:this.e})]}),n=new Bt.asn1.DERBitString({hex:"00"+e.getEncodedHex()});return new Bt.asn1.DERSequence({array:[t,n]}).getEncodedHex()},e.prototype.getPublicBaseKeyB64=function(){return J(this.getPublicBaseKey())},e.wordwrap=function(t,e){if(void 0===e&&(e=void 0),!t)return t;var n="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(RegExp(n,"g")).join("\n")},e.prototype.getPrivateKey=function(){var t="-----BEGIN RSA PRIVATE KEY-----\n";return(t+=e.wordwrap(this.getPrivateBaseKeyB64())+"\n")+"-----END RSA PRIVATE KEY-----"},e.prototype.getPublicKey=function(){var t="-----BEGIN PUBLIC KEY-----\n";return(t+=e.wordwrap(this.getPublicBaseKeyB64())+"\n")+"-----END PUBLIC KEY-----"},e.prototype.hasPublicKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")},e.prototype.hasPrivateKeyProperty=function(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")},e.prototype.parsePropertiesFrom=function(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(Lt);function Mt(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}Mt.prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new kt(t)},Mt.prototype.setPrivateKey=function(t){this.setKey(t)},Mt.prototype.setPublicKey=function(t){this.setKey(t)},Mt.prototype.decrypt=function(t){try{return this.getKey().decrypt(Y(t))}catch(t){return!1}},Mt.prototype.encrypt=function(t){try{return J(this.getKey().encrypt(t))}catch(t){return!1}},Mt.prototype.encryptLong=function(t){try{for(var e=this.getKey().encryptLong(t)||"",n=this.getKey().decryptLong(e)||"",r=0,i=/null$/g;i.test(n)&&(r++,e=this.getKey().encryptLong(t)||"",n=this.getKey().decryptLong(e)||"",!(r>10)););return e}catch(t){return!1}},Mt.prototype.decryptLong=function(t){try{return this.getKey().decryptLong(t)}catch(t){return!1}},Mt.prototype.sign=function(t,e,n){try{return J(this.getKey().sign(t,e,n))}catch(t){return!1}},Mt.prototype.verify=function(t,e,n){try{return this.getKey().verify(t,Y(e),n)}catch(t){return!1}},Mt.prototype.getKey=function(t){if(!this.key){if(this.key=new kt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},Mt.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},Mt.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},Mt.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},Mt.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},Mt.version="3.1.4";var qt=Mt,Vt=function(t){var e=void 0===t?{}:t,n=e.publicKey,r=void 0===n?"":n,i=e.payload,o=void 0===i?{}:i;if(!r)return"";try{var s=j(o),a=new qt;return a.setPublicKey(r),a.encryptLong(JSON.stringify(s))}catch(t){}return""},Ft=function(){return Ft=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ft.apply(this,arguments)},Ht=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Wt=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},$t=function(){function t(t){var e=t.request,n=t.credentialsClient;if(!n){var r={apiOrigin:t.apiOrigin,clientId:t.clientId,storage:t.storage};n=new A(r)}if(!e){var i=n.request.bind(n),o=new U(Ft({clientId:t.clientId,request:i,storage:t.storage},t.captchaOptions));e=o.request.bind(o)}this.config={apiOrigin:t.apiOrigin,clientId:t.clientId,request:e,credentialsClient:n,storage:t.storage||_}}return t.parseParamsToSearch=function(t){return Object.keys(t).forEach((function(e){t[e]||delete t[e]})),new URLSearchParams(t).toString()},t.prototype.getParamsByVersion=function(t,e){var n,r=j(t),i=(null===(n={v2:s}[null==r?void 0:r.version])||void 0===n?void 0:n[e])||o[e];return r&&delete r.version,{params:r,url:i}},t.prototype.signIn=function(t){return Ht(this,void 0,void 0,(function(){var e,n,r,i;return Wt(this,(function(o){switch(o.label){case 0:return e=t.version||"v1",(n=this.getParamsByVersion(t,"AUTH_SIGN_IN_URL")).params.query&&delete n.params.query,[4,this.getEncryptParams(n.params)];case 1:return r=o.sent(),[4,this.config.request(n.url,{method:"POST",body:r})];case 2:return i=o.sent(),[4,this.config.credentialsClient.setCredentials(Ft(Ft({},i),{version:e}))];case 3:return o.sent(),[2,Promise.resolve(i)]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.request(o.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signUp=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.request(o.AUTH_SIGN_UP_URL,{method:"POST",body:t})];case 1:return e=n.sent(),[4,this.config.credentialsClient.setCredentials(e)];case 2:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.signOut=function(){return Ht(this,void 0,void 0,(function(){var t,e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getAccessToken()];case 1:return t=n.sent(),[4,this.config.request(o.AUTH_REVOKE_URL,{method:"POST",body:{token:t}})];case 2:return e=n.sent(),[4,this.config.credentialsClient.setCredentials()];case 3:return n.sent(),[2,Promise.resolve(e)]}}))}))},t.prototype.getVerification=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return e=!1,"CUR_USER"!==t.target?[3,1]:(e=!0,[3,3]);case 1:return[4,this.hasLoginState()];case 2:n.sent()&&(e=!0),n.label=3;case 3:return[2,this.config.request(o.VERIFICATION_URL,{method:"POST",body:t,withCaptcha:!0,withCredentials:e})]}}))}))},t.prototype.verify=function(t){return Ht(this,void 0,void 0,(function(){var e,n;return Wt(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"VERIFY_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),"v2"!==(null==t?void 0:t.version)?[3,3]:[4,this.config.credentialsClient.setCredentials(Ft(Ft({},n),{version:"v2"}))];case 2:r.sent(),r.label=3;case 3:return[2,n]}}))}))},t.prototype.genProviderRedirectUri=function(t){return Ht(this,void 0,void 0,(function(){var e,n;return Wt(this,(function(r){return e="".concat(o.PROVIDER_URI_URL,"?client_id=").concat(this.config.clientId,"&provider_id=").concat(t.provider_id,"&redirect_uri=").concat(encodeURIComponent(t.provider_redirect_uri),"&state=").concat(t.state),(n=t.other_params)&&"string"==typeof n.sign_out_uri&&n.sign_out_uri.length>0&&(e+="&other_params[sign_out_uri]=".concat(n.sign_out_uri)),[2,this.config.request(e,{method:"GET"})]}))}))},t.prototype.grantProviderToken=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.PROVIDER_TOKEN_URL,{method:"POST",body:t})]}))}))},t.prototype.patchProviderToken=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.PROVIDER_TOKEN_URL,{method:"PATCH",body:t})]}))}))},t.prototype.signInWithProvider=function(t){return Ht(this,void 0,void 0,(function(){var e,n;return Wt(this,(function(r){switch(r.label){case 0:return e=this.getParamsByVersion(t,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),[4,this.config.request(e.url,{method:"POST",body:e.params})];case 1:return n=r.sent(),[4,this.config.credentialsClient.setCredentials(Ft(Ft({},n),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return r.sent(),[2,Promise.resolve(n)]}}))}))},t.prototype.bindWithProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.PROVIDER_BIND_URL,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.getUserProfile=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.getUserInfo(t)]}))}))},t.prototype.getUserInfo=function(t){var e;return void 0===t&&(t={}),Ht(this,void 0,void 0,(function(){var n,r,i;return Wt(this,(function(o){switch(o.label){case 0:return n=this.getParamsByVersion(t,"USER_ME_URL"),(null===(e=n.params)||void 0===e?void 0:e.query)&&(r=new URLSearchParams(n.params.query),n.url+="?".concat(r.toString())),[4,this.config.request(n.url,{method:"GET",withCredentials:!0})];case 1:return(i=o.sent()).sub&&(i.uid=i.sub),[2,i]}}))}))},t.prototype.getWedaUserInfo=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){switch(t.label){case 0:return[4,this.config.request(o.WEDA_USER_URL,{method:"GET",withCredentials:!0})];case 1:return[2,t.sent()]}}))}))},t.prototype.deleteMe=function(e){return Ht(this,void 0,void 0,(function(){var n,r;return Wt(this,(function(i){return n=this.getParamsByVersion(e,"USER_ME_URL"),r="".concat(n.url,"?").concat(t.parseParamsToSearch(n.params)),[2,this.config.request(r,{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.hasLoginState=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.config.credentialsClient.getAccessToken()];case 1:return t.sent(),[2,!0];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},t.prototype.hasLoginStateSync=function(){return this.config.credentialsClient.getCredentialsSync()},t.prototype.getLoginState=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getCredentialsAsync()]}))}))},t.prototype.transByProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.grantToken=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){return e=this.getParamsByVersion(t,"AUTH_TOKEN_URL"),[2,this.config.request(e.url,{method:"POST",body:e.params})]}))}))},t.prototype.getProviders=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.PROVIDER_LIST,{method:"GET",withCredentials:!0})]}))}))},t.prototype.unbindProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.PROVIDER_UNBIND_URL,"/").concat(t.provider_id),{method:"DELETE",withCredentials:!0})]}))}))},t.prototype.checkPassword=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.bindPhone=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.bindEmail=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.setPassword=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:t})]}))}))},t.prototype.updatePasswordByOld=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.sudo({password:t.old_password})];case 1:return e=n.sent(),[2,this.setPassword({sudo_token:e.sudo_token,new_password:t.new_password})]}}))}))},t.prototype.sudo=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.SUDO_URL),{method:"POST",withCredentials:!0,body:t})]}))}))},t.prototype.getCurUserVerification=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return t.target="CUR_USER",[2,this.config.request(o.VERIFICATION_URL,{method:"POST",body:t,withCredentials:!0,withCaptcha:!0})]}))}))},t.prototype.changeBindedProvider=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request("".concat(o.PROVIDER_LIST,"/").concat(t.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:t.trans_token},withCredentials:!0})]}))}))},t.prototype.setUserProfile=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.USER_PRIFILE_URL,{method:"PATCH",body:t,withCredentials:!0})]}))}))},t.prototype.queryUserProfile=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(o.USER_QUERY_URL,"?").concat(e.toString()),{method:"GET",withCredentials:!0})]}))}))},t.prototype.setCustomSignFunc=function(t){this.getCustomSignTicketFn=t},t.prototype.signInWithCustomTicket=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.getCustomSignTicketFn()];case 1:return e=n.sent(),[2,this.signInWithProvider(Ft(Ft({},t),{provider_id:"custom",provider_token:e}))]}}))}))},t.prototype.resetPassword=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.AUTH_RESET_PASSWORD,{method:"POST",body:t})]}))}))},t.prototype.deviceAuthorize=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.AUTH_GET_DEVICE_CODE,{method:"POST",body:t,withCredentials:!0})]}))}))},t.prototype.checkUsername=function(t){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(e){return[2,this.config.request(o.CHECK_USERNAME,{method:"GET",body:t,withCredentials:!0})]}))}))},t.prototype.checkIfUserExist=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){return e=new URLSearchParams(t),[2,this.config.request("".concat(o.CHECK_IF_USER_EXIST,"?").concat(e.toString()),{method:"GET"})]}))}))},t.prototype.loginScope=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getScope()]}))}))},t.prototype.loginGroups=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getGroups()]}))}))},t.prototype.refreshTokenForce=function(t){return Ht(this,void 0,void 0,(function(){var e;return Wt(this,(function(n){switch(n.label){case 0:return[4,this.config.credentialsClient.getCredentials()];case 1:return e=n.sent(),[4,this.config.credentialsClient.refreshToken(Ft(Ft({},e),{version:(null==t?void 0:t.version)||"v1"}))];case 2:return[2,n.sent()]}}))}))},t.prototype.getCredentials=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.credentialsClient.getCredentials()]}))}))},t.prototype.getPublicKey=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(s.AUTH_PUBLIC_KEY,{method:"POST",body:{}})]}))}))},t.prototype.getEncryptParams=function(t){return Ht(this,void 0,void 0,(function(){var e,n,r,i;return Wt(this,(function(o){switch(o.label){case 0:if(!(e=j(t)).isEncrypt)return[2,t];n="",r="",o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.getPublicKey()];case 2:return i=o.sent(),n=i.public_key,r=i.public_key_thumbprint,[3,4];case 3:return o.sent(),[3,4];case 4:if(!n||!r)throw new Error("public_key or public_key_thumbprint is empty");return delete e.isEncrypt,[2,{params:Vt({publicKey:n,payload:e}),public_key_thumbprint:r}]}}))}))},t.prototype.getProviderSubType=function(){return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})]}))}))},t.prototype.varifyCaptchaData=function(t){var e=t.token,n=t.key;return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.VARIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:e,key:n},withCredentials:!1})]}))}))},t.prototype.createCaptchaData=function(t){var e=t.state,n=t.redirect_uri,r=void 0===n?void 0:n;return Ht(this,void 0,void 0,(function(){return Wt(this,(function(t){return[2,this.config.request(o.CAPTCHA_DATA_URL,{method:"POST",body:{state:e,redirect_uri:r},withCredentials:!1})]}))}))},t}(),Gt=function(){return Gt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Gt.apply(this,arguments)},Kt=function(t){var e=t.apiOrigin,n=t.clientId,r=t.storage,i=t.request,o=t.baseRequest,s=t.anonymousSignInFunc;this.oauth2client=new A({apiOrigin:e,clientId:n,storage:r,baseRequest:o||i,anonymousSignInFunc:s}),this.authApi=new $t(Gt(Gt({credentialsClient:this.oauth2client},t),{request:i?this.oauth2client.request.bind(this.oauth2client):void 0}))},Jt=function(){return Jt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Jt.apply(this,arguments)},Yt=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},zt=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zt=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Qt=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Xt=h.P6.xe,te=h.P6._y,ee=h._G.Sg,ne=h._G.vM,re=h.BM.D,ie=h.U3.yE,oe="loginStateChanged",se=new ie,ae=function(){function t(t){var e=t.cache,n=t.oauthInstance;this.cache=e,this.oauthInstance=n,this.setUserInfo()}return t.prototype.checkLocalInfo=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}))}))},t.prototype.checkLocalInfoAsync=function(){return Zt(this,void 0,void 0,(function(){var t,e,n,r;return Qt(this,(function(i){switch(i.label){case 0:return t=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return t.uid=i.sent(),e=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return e.gender=i.sent(),this.picture=this.getLocalUserInfo("picture"),n=this,[4,this.getLocalUserInfoAsync("email")];case 3:return n.email=i.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),r=this,[4,this.getLocalUserInfoAsync("username")];case 4:return r.username=i.sent(),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]}}))}))},t.prototype.update=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(Jt({},t))];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2]}}))}))},t.prototype.updatePassword=function(t,e){return this.oauthInstance.authApi.updatePasswordByOld({old_password:e,new_password:t})},t.prototype.updateUsername=function(t){return"string"!=typeof t&&te(ee.INVALID_PARAMS,"username must be a string"),this.update({username:t})},t.prototype.refresh=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(t)];case 1:return e=n.sent(),this.setLocalUserInfo(e),[2,e]}}))}))},t.prototype.getLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;return this.cache.getStore(e)[t]},t.prototype.getLocalUserInfoAsync=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return e=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(e)];case 1:return[2,n.sent()[t]]}}))}))},t.prototype.setUserInfo=function(){var t=this,e=this.cache.keys.userInfoKey,n=this.cache.getStore(e);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username"].forEach((function(e){t[e]=n[e]}))},t.prototype.setLocalUserInfo=function(t){var e=this.cache.keys.userInfoKey;this.cache.setStore(e,t),this.setUserInfo()},Yt([re({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"update",null),Yt([re({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[String,String]),zt("design:returntype",void 0)],t.prototype,"updatePassword",null),Yt([re({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[String]),zt("design:returntype",void 0)],t.prototype,"updateUsername",null),Yt([re({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"refresh",null),t}(),ue=function(){function t(t){var e=t.envId,n=t.cache,r=t.oauthInstance;e||te(ee.INVALID_PARAMS,"envId is not defined"),this.cache=n,this.oauthInstance=r,this.user=new ae({cache:this.cache,oauthInstance:r})}return t.prototype.checkLocalState=function(){var t;this.oauthLoginState=null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},t.prototype.checkLocalStateAsync=function(){var t;return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.getLoginState()];case 1:return e.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return e.sent(),[2]}}))}))},t}(),ce=function(){function t(t){this.config=t,this.cache=t.cache,this.oauthInstance=t.oauthInstance}return t.prototype.bindPhoneNumber=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.bindPhone(t)]}))}))},t.prototype.unbindProvider=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.unbindProvider(t)]}))}))},t.prototype.bindEmail=function(t){return this.oauthInstance.authApi.bindEmail(t)},t.prototype.verify=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.verify(t)]}))}))},t.prototype.getVerification=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.getVerification(t)]}))}))},Object.defineProperty(t.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var t=this.hasLoginState();return t&&t.user||null}Xt(ee.INVALID_OPERATION,"current platform's storage is asynchronous, please use getCurrentUser insteed")},enumerable:!1,configurable:!0}),t.prototype.getCurrentUser=function(){return Zt(this,void 0,void 0,(function(){var t;return Qt(this,(function(e){switch(e.label){case 0:return[4,this.getLoginState()];case 1:return(t=e.sent())?[4,t.user.checkLocalInfoAsync()]:[3,3];case 2:return e.sent(),[2,t.user||null];case 3:return[2,null]}}))}))},t.prototype.signInAnonymously=function(t){return void 0===t&&(t={}),Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInAnonymously(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setCustomSignFunc=function(t){this.oauthInstance.authApi.setCustomSignFunc(t)},t.prototype.signInWithCustomTicket=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithCustomTicket(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.signIn=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signIn(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.signUp=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signUp(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.setPassword=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.setPassword(t)]}))}))},t.prototype.isUsernameRegistered=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return"string"!=typeof t&&te(ee.INVALID_PARAMS,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:t})];case 1:return[2,e.sent().exist]}}))}))},t.prototype.signOut=function(){return Zt(this,void 0,void 0,(function(){var t;return Qt(this,(function(e){switch(e.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut()];case 1:return e.sent(),[4,this.cache.removeStoreAsync(t)];case 2:return e.sent(),se.fire(oe),[2]}}))}))},t.prototype.hasLoginState=function(){var t;if("async"!==this.cache.mode)return(null===(t=this.oauthInstance)||void 0===t?void 0:t.authApi.hasLoginStateSync())?new ue({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;Xt(ee.INVALID_OPERATION,"current platform's storage is asynchronous, please use getLoginState insteed")},t.prototype.getLoginState=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.getLoginState()];case 1:return t.sent()?[2,new ue({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}}))}))},t.prototype.getUserInfo=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.getUserInfo(t)]}))}))},t.prototype.getWedaUserInfo=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getWedaUserInfo()]}))}))},t.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},t.prototype.bindWithProvider=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.bindWithProvider(t)]}))}))},t.prototype.queryUser=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.queryUserProfile(t)]}))}))},t.prototype.getAccessToken=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:t.sent(),env:this.config.env}]}}))}))},t.prototype.grantProviderToken=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.grantProviderToken(t)]}))}))},t.prototype.patchProviderToken=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.patchProviderToken(t)]}))}))},t.prototype.signInWithProvider=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(t)];case 1:return e.sent(),[2,this.createLoginState(t)]}}))}))},t.prototype.grantToken=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){switch(e.label){case 0:return[4,this.oauthInstance.authApi.grantToken(t)];case 1:return e.sent(),[2,this.createLoginState()]}}))}))},t.prototype.genProviderRedirectUri=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.genProviderRedirectUri(t)]}))}))},t.prototype.resetPassword=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.resetPassword(t)]}))}))},t.prototype.deviceAuthorize=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.deviceAuthorize(t)]}))}))},t.prototype.sudo=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.sudo(t)]}))}))},t.prototype.deleteMe=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.deleteMe(t)]}))}))},t.prototype.getProviders=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getProviders()]}))}))},t.prototype.loginScope=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.loginScope()]}))}))},t.prototype.loginGroups=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.loginGroups()]}))}))},t.prototype.onLoginStateChanged=function(t){return Zt(this,void 0,void 0,(function(){var e,n=this;return Qt(this,(function(r){switch(r.label){case 0:return se.on(oe,(function(){return Zt(n,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,this.getLoginState()];case 1:return e=n.sent(),t.call(this,e),[2]}}))}))})),[4,this.getLoginState()];case 1:return e=r.sent(),t.call(this,e),[2]}}))}))},t.prototype.refreshTokenForce=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.refreshTokenForce(t)]}))}))},t.prototype.getCredentials=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getCredentials()]}))}))},t.prototype.getProviderSubType=function(){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(t){return[2,this.oauthInstance.authApi.getProviderSubType()]}))}))},t.prototype.createCaptchaData=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.createCaptchaData(t)]}))}))},t.prototype.varifyCaptchaData=function(t){return Zt(this,void 0,void 0,(function(){return Qt(this,(function(e){return[2,this.oauthInstance.authApi.varifyCaptchaData(t)]}))}))},t.prototype.createLoginState=function(t){return Zt(this,void 0,void 0,(function(){var e;return Qt(this,(function(n){switch(n.label){case 0:return[4,(e=new ue({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return n.sent(),[4,e.user.refresh(t)];case 2:return n.sent(),se.fire(oe),[2,e]}}))}))},Yt([re({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"bindPhoneNumber",null),Yt([re({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"unbindProvider",null),Yt([re({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",void 0)],t.prototype,"bindEmail",null),Yt([re({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"verify",null),Yt([re({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"getVerification",null),Yt([re({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getCurrentUser",null),Yt([re({title:"匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymously() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"signInAnonymously",null),Yt([re({title:"自定义登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了自定义登录"," 2 - 调用 auth().signInWithCustomTicket() 的语法或参数是否正确"," 3 - ticket 是否归属于当前环境"," 4 - 创建 ticket 的自定义登录私钥是否过期","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"signInWithCustomTicket",null),Yt([re({title:"注册失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了指定登录方式"," 2 - 调用 auth().signUp() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"signUp",null),Yt([re({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[String]),zt("design:returntype",Promise)],t.prototype,"isUsernameRegistered",null),Yt([re({title:"用户登出失败",messages:["请确认以下各项:"," 1 - 调用 auth().signOut() 的语法或参数是否正确"," 2 - 当前用户是否为匿名登录(匿名登录不支持signOut)","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"signOut",null),Yt([re({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getLoginState",null),Yt([re({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"getUserInfo",null),Yt([re({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getWedaUserInfo",null),Yt([re({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[Object]),zt("design:returntype",Promise)],t.prototype,"bindWithProvider",null),Yt([re({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(ne)]}),zt("design:type",Function),zt("design:paramtypes",[]),zt("design:returntype",Promise)],t.prototype,"getProviderSubType",null),t}(),he={name:"auth",namespace:"auth",entity:function(t){if(void 0===t&&(t={region:"",persistence:"local"}),this.authInstance)return Xt(ee.INVALID_OPERATION,"every cloudbase instance should has only one auth object"),this.authInstance;var e=this.platform,n=e.adapter,r=e.runtime,i=t.persistence||n.primaryStorage;i&&i!==this.config.persistence&&this.updateConfig({persistence:i});var o=this.config,s=o.env,a=o.persistence,u=o.debug,c=o.clientId,h=o.storage,f=new Kt({clientId:c,apiOrigin:this.request.getBaseEndPoint(),storage:(null==t?void 0:t.storage)||h,baseRequest:null==t?void 0:t.baseRequest,request:null==t?void 0:t.request,anonymousSignInFunc:null==t?void 0:t.anonymousSignInFunc,captchaOptions:null==t?void 0:t.captchaOptions});return this.oauthInstance=f,this.authInstance=new ce({env:s,region:t.region,persistence:a,debug:u,cache:this.cache,runtime:r,_fromApp:this,oauthInstance:f}),this.authInstance}};try{cloudbase.registerComponent(he)}catch(t){}function fe(t){try{t.registerComponent(he)}catch(t){console.warn(t)}}},529:function(t,e,n){"use strict";n.r(e),n.d(e,{registerDatabase:function(){return kn}});var r,i,o={};n.r(o),n.d(o,{LineString:function(){return W},MultiLineString:function(){return Y},MultiPoint:function(){return K},MultiPolygon:function(){return Z},Point:function(){return it},Polygon:function(){return G}}),function(t){t.DocIDError="文档ID不合法",t.CollNameError="集合名称不合法",t.OpStrError="操作符不合法",t.DirectionError="排序字符不合法",t.IntergerError="must be integer",t.QueryParamTypeError="查询参数必须为对象",t.QueryParamValueError="查询参数对象值不能均为undefined"}(i||(i={}));var s,a,u="Object",c="GeoPoint",h="GeoLineString",f="GeoPolygon",l="GeoMultiPoint",p="GeoMultiLineString",d="GeoMultiPolygon",y="Date",g="ServerDate",v=["desc","asc"],m=["<","<=","==",">=",">"];!function(t){t.lt="<",t.gt=">",t.lte="<=",t.gte=">=",t.eq="=="}(s||(s={})),(r={})[s.eq]="$eq",r[s.lt]="$lt",r[s.lte]="$lte",r[s.gt]="$gt",r[s.gte]="$gte",function(t){t.WHERE="WHERE",t.DOC="DOC"}(a||(a={}));var b,w=(b=function(t,e){return b=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},b(t,e)},function(t,e){function n(){this.constructor=t}b(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),E=[],_={},S=function(t){function e(e,n){if(n!==_)throw new TypeError("InternalSymbol cannot be constructed with new operator");return t.call(this,e)||this}return w(e,t),e.for=function(t){for(var n=0,r=E.length;n<r;n++)if(E[n].target===t)return E[n].instance;var i=new e(t,_);return E.push({target:t,instance:i}),i},e}((function(t){Object.defineProperties(this,{target:{enumerable:!1,writable:!1,configurable:!1,value:t}})})),I=S,T=I.for("UNSET_FIELD_NAME"),O=I.for("UPDATE_COMMAND"),A=I.for("QUERY_COMMAND"),R=I.for("LOGIC_COMMAND"),N=I.for("GEO_POINT"),x=I.for("SYMBOL_GEO_LINE_STRING"),C=I.for("SYMBOL_GEO_POLYGON"),P=I.for("SYMBOL_GEO_MULTI_POINT"),D=I.for("SYMBOL_GEO_MULTI_LINE_STRING"),L=I.for("SYMBOL_GEO_MULTI_POLYGON"),U=I.for("SERVER_DATE"),j=I.for("REGEXP"),B=function(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()},k=function(t){return"object"===B(t)},M=function(t){return"number"===B(t)},q=function(t){return Array.isArray(t)},V=function(t){return"date"===B(t)},F=function(t){return"regexp"===B(t)},H=function(t){return t&&t._internalType instanceof S},W=function(){function t(t){if(!q(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(t.length<2)throw new Error('"points" must contain 2 points at least');t.forEach((function(t){if(!(t instanceof it))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"LineString",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("LineString"!==t.type||!q(t.coordinates))return!1;try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t.coordinates),i=r.next();!i.done;i=r.next()){var o=i.value;if(!M(o[0])||!M(o[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!0},t.isClosed=function(t){var e=t.points[0],n=t.points[t.points.length-1];if(e.latitude===n.latitude&&e.longitude===n.longitude)return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return x},enumerable:!0,configurable:!0}),t}(),$=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},G=function(){function t(t){if(!q(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof W))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]");if(!W.isClosed(t))throw new Error("LineString "+t.points.map((function(t){return t.toReadableString()}))+" is not a closed cycle")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,r,i;if("Polygon"!==t.type||!q(t.coordinates))return!1;try{for(var o=$(t.coordinates),s=o.next();!s.done;s=o.next()){var a=s.value;if(!this.isCloseLineString(a))return!1;try{for(var u=(r=void 0,$(a)),c=u.next();!c.done;c=u.next()){var h=c.value;if(!M(h[0])||!M(h[1]))return!1}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},t.isCloseLineString=function(t){var e=t[0],n=t[t.length-1];return e[0]===n[0]&&e[1]===n[1]},Object.defineProperty(t.prototype,"_internalType",{get:function(){return L},enumerable:!0,configurable:!0}),t}(),K=function(){function t(t){if(!q(t))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t);if(0===t.length)throw new Error('"points" must contain 1 point at least');t.forEach((function(t){if(!(t instanceof it))throw new TypeError('"points" must be of type Point[]. Received type '+typeof t+"[]")})),this.points=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))},e},t.prototype.toJSON=function(){return{type:"MultiPoint",coordinates:this.points.map((function(t){return t.toJSON().coordinates}))}},t.validate=function(t){var e,n;if("MultiPoint"!==t.type||!q(t.coordinates))return!1;try{for(var r=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}(t.coordinates),i=r.next();!i.done;i=r.next()){var o=i.value;if(!M(o[0])||!M(o[1]))return!1}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return P},enumerable:!0,configurable:!0}),t}(),J=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Y=function(){function t(t){if(!q(t))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t);if(0===t.length)throw new Error("Polygon must contain 1 linestring at least");t.forEach((function(t){if(!(t instanceof W))throw new TypeError('"lines" must be of type LineString[]. Received type '+typeof t+"[]")})),this.lines=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))},e},t.prototype.toJSON=function(){return{type:"MultiLineString",coordinates:this.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}},t.validate=function(t){var e,n,r,i;if("MultiLineString"!==t.type||!q(t.coordinates))return!1;try{for(var o=J(t.coordinates),s=o.next();!s.done;s=o.next()){var a=s.value;try{for(var u=(r=void 0,J(a)),c=u.next();!c.done;c=u.next()){var h=c.value;if(!M(h[0])||!M(h[1]))return!1}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return D},enumerable:!0,configurable:!0}),t}(),z=function(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Z=function(){function t(t){var e,n;if(!q(t))throw new TypeError('"polygons" must be of type Polygon[]. Received type '+typeof t);if(0===t.length)throw new Error("MultiPolygon must contain 1 polygon at least");try{for(var r=z(t),i=r.next();!i.done;i=r.next()){var o=i.value;if(!(o instanceof G))throw new TypeError('"polygon" must be of type Polygon[]. Received type '+typeof o+"[]")}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}this.polygons=t}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))},e},t.prototype.toJSON=function(){return{type:"MultiPolygon",coordinates:this.polygons.map((function(t){return t.lines.map((function(t){return t.points.map((function(t){return[t.longitude,t.latitude]}))}))}))}},t.validate=function(t){var e,n,r,i,o,s;if("MultiPolygon"!==t.type||!q(t.coordinates))return!1;try{for(var a=z(t.coordinates),u=a.next();!u.done;u=a.next()){var c=u.value;try{for(var h=(r=void 0,z(c)),f=h.next();!f.done;f=h.next()){var l=f.value;try{for(var p=(o=void 0,z(l)),d=p.next();!d.done;d=p.next()){var y=d.value;if(!M(y[0])||!M(y[1]))return!1}}catch(t){o={error:t}}finally{try{d&&!d.done&&(s=p.return)&&s.call(p)}finally{if(o)throw o.error}}}}catch(t){r={error:t}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}return!0},Object.defineProperty(t.prototype,"_internalType",{get:function(){return C},enumerable:!0,configurable:!0}),t}(),Q=function(){function t(t){var e=(void 0===t?{}:t).offset,n=void 0===e?0:e;this.offset=n}return Object.defineProperty(t.prototype,"_internalType",{get:function(){return U},enumerable:!0,configurable:!0}),t.prototype.parse=function(){return{$date:{offset:this.offset}}},t}();function X(t){return new Q(t)}var tt,et=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},nt=function(){function t(){}return t.formatResDocumentData=function(e){return e.map((function(e){return t.formatField(e)}))},t.formatField=function(e){var n=Object.keys(e),r={};return Array.isArray(e)&&(r=[]),n.forEach((function(n){var i,o=e[n];switch(t.whichType(o)){case c:i=new it(o.coordinates[0],o.coordinates[1]);break;case h:i=new W(o.coordinates.map((function(t){return new it(t[0],t[1])})));break;case f:i=new G(o.coordinates.map((function(t){return new W(t.map((function(t){var e=et(t,2),n=e[0],r=e[1];return new it(n,r)})))})));break;case l:i=new K(o.coordinates.map((function(t){return new it(t[0],t[1])})));break;case p:i=new Y(o.coordinates.map((function(t){return new W(t.map((function(t){var e=et(t,2),n=e[0],r=e[1];return new it(n,r)})))})));break;case d:i=new Z(o.coordinates.map((function(t){return new G(t.map((function(t){return new W(t.map((function(t){var e=et(t,2),n=e[0],r=e[1];return new it(n,r)})))})))})));break;case y:i=new Date(1e3*o.$timestamp);break;case u:case"Array":i=t.formatField(o);break;case g:i=new Date(o.$date);break;default:i=o}Array.isArray(r)?r.push(i):r[n]=i})),r},t.whichType=function(t){var e=Object.prototype.toString.call(t).slice(8,-1);if(e===y)return"BsonDate";if(e===u){if(t instanceof it)return c;if(t instanceof Date)return y;if(t instanceof Q)return g;t.$timestamp?e=y:t.$date?e=g:it.validate(t)?e=c:W.validate(t)?e=h:G.validate(t)?e=f:K.validate(t)?e=l:Y.validate(t)?e=p:Z.validate(t)&&(e=d)}return e},t.generateDocId=function(){for(var t="ABCDEFabcdef0123456789",e="",n=0;n<24;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e},t}(),rt=function(){function t(){}return t.isGeopoint=function(t,e){if("Number"!==nt.whichType(e))throw new Error("Geo Point must be number type");var n=Math.abs(e);if("latitude"===t&&n>90)throw new Error("latitude should be a number ranges from -90 to 90");if("longitude"===t&&n>180)throw new Error("longitude should be a number ranges from -180 to 180");return!0},t.isInteger=function(t,e){if(!Number.isInteger(e))throw new Error(t+i.IntergerError);return!0},t.isFieldOrder=function(t){if(-1===v.indexOf(t))throw new Error(i.DirectionError);return!0},t.isFieldPath=function(t){if(!/^[a-zA-Z0-9-_\.]/.test(t))throw new Error;return!0},t.isOperator=function(t){if(-1===m.indexOf(t))throw new Error(i.OpStrError);return!0},t.isCollName=function(t){if(!/^[a-zA-Z0-9]([a-zA-Z0-9-_]){1,32}$/.test(t))throw new Error(i.CollNameError);return!0},t.isDocID=function(t){if(!/^([a-fA-F0-9]){24}$/.test(t))throw new Error(i.DocIDError);return!0},t}(),it=function(){function t(t,e){rt.isGeopoint("longitude",t),rt.isGeopoint("latitude",e),this.longitude=t,this.latitude=e}return t.prototype.parse=function(t){var e;return(e={})[t]={type:"Point",coordinates:[this.longitude,this.latitude]},e},t.prototype.toJSON=function(){return{type:"Point",coordinates:[this.longitude,this.latitude]}},t.prototype.toReadableString=function(){return"["+this.longitude+","+this.latitude+"]"},t.validate=function(t){return"Point"===t.type&&q(t.coordinates)&&rt.isGeopoint("longitude",t.coordinates[0])&&rt.isGeopoint("latitude",t.coordinates[1])},Object.defineProperty(t.prototype,"_internalType",{get:function(){return N},enumerable:!0,configurable:!0}),t}(),ot=function(){var t;if(!Promise){(t=function(){}).promise={};var e=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(t.promise,"then",{get:e}),Object.defineProperty(t.promise,"catch",{get:e}),t}var n=new Promise((function(e,n){t=function(t,r){return t?n(t):e(r)}}));return t.promise=n,t};!function(t){t.SET="set",t.REMOVE="remove",t.INC="inc",t.MUL="mul",t.PUSH="push",t.PULL="pull",t.PULL_ALL="pullAll",t.POP="pop",t.SHIFT="shift",t.UNSHIFT="unshift",t.ADD_TO_SET="addToSet",t.BIT="bit",t.RENAME="rename",t.MAX="max",t.MIN="min"}(tt||(tt={}));var st,at=function(){function t(t,e,n){this._internalType=O,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||T}return t.prototype._setFieldName=function(e){return new t(this.operator,this.operands,e)},t}();function ut(t){return t&&t instanceof at&&t._internalType===O}!function(t){t.AND="and",t.OR="or",t.NOT="not",t.NOR="nor"}(st||(st={}));var ct=function(){function t(t,e,n){if(this._internalType=R,Object.defineProperties(this,{_internalType:{enumerable:!1,configurable:!1}}),this.operator=t,this.operands=e,this.fieldName=n||T,this.fieldName!==T)if(Array.isArray(e)){e=e.slice(),this.operands=e;for(var r=0,i=e.length;r<i;r++)(ht(o=e[r])||dt(o))&&(e[r]=o._setFieldName(this.fieldName))}else{var o;(ht(o=e)||dt(o))&&(e=o._setFieldName(this.fieldName))}}return t.prototype._setFieldName=function(e){var n=this.operands.map((function(n){return n instanceof t?n._setFieldName(e):n}));return new t(this.operator,n,e)},t.prototype.and=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return r.unshift(this),new t(st.AND,r,this.fieldName)},t.prototype.or=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=Array.isArray(arguments[0])?arguments[0]:Array.from(arguments);return r.unshift(this),new t(st.OR,r,this.fieldName)},t}();function ht(t){return t&&t instanceof ct&&t._internalType===R}var ft,lt=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(t){t.EQ="eq",t.NEQ="neq",t.GT="gt",t.GTE="gte",t.LT="lt",t.LTE="lte",t.IN="in",t.NIN="nin",t.ALL="all",t.ELEM_MATCH="elemMatch",t.EXISTS="exists",t.SIZE="size",t.MOD="mod",t.GEO_NEAR="geoNear",t.GEO_WITHIN="geoWithin",t.GEO_INTERSECTS="geoIntersects"}(ft||(ft={}));var pt=function(t){function e(e,n,r){var i=t.call(this,e,n,r)||this;return i.operator=e,i._internalType=A,i}return lt(e,t),e.prototype.toJSON=function(){var t,e;switch(this.operator){case ft.IN:case ft.NIN:return(t={})["$"+this.operator]=this.operands,t;default:return(e={})["$"+this.operator]=this.operands[0],e}},e.prototype._setFieldName=function(t){return new e(this.operator,this.operands,t)},e.prototype.eq=function(t){var n=new e(ft.EQ,[t],this.fieldName);return this.and(n)},e.prototype.neq=function(t){var n=new e(ft.NEQ,[t],this.fieldName);return this.and(n)},e.prototype.gt=function(t){var n=new e(ft.GT,[t],this.fieldName);return this.and(n)},e.prototype.gte=function(t){var n=new e(ft.GTE,[t],this.fieldName);return this.and(n)},e.prototype.lt=function(t){var n=new e(ft.LT,[t],this.fieldName);return this.and(n)},e.prototype.lte=function(t){var n=new e(ft.LTE,[t],this.fieldName);return this.and(n)},e.prototype.in=function(t){var n=new e(ft.IN,t,this.fieldName);return this.and(n)},e.prototype.nin=function(t){var n=new e(ft.NIN,t,this.fieldName);return this.and(n)},e.prototype.geoNear=function(t){if(!(t.geometry instanceof it))throw new TypeError('"geometry" must be of type Point. Received type '+typeof t.geometry);if(void 0!==t.maxDistance&&!M(t.maxDistance))throw new TypeError('"maxDistance" must be of type Number. Received type '+typeof t.maxDistance);if(void 0!==t.minDistance&&!M(t.minDistance))throw new TypeError('"minDistance" must be of type Number. Received type '+typeof t.minDistance);var n=new e(ft.GEO_NEAR,[t],this.fieldName);return this.and(n)},e.prototype.geoWithin=function(t){if(!(t.geometry instanceof Z||t.geometry instanceof G))throw new TypeError('"geometry" must be of type Polygon or MultiPolygon. Received type '+typeof t.geometry);var n=new e(ft.GEO_WITHIN,[t],this.fieldName);return this.and(n)},e.prototype.geoIntersects=function(t){if(!(t.geometry instanceof it||t.geometry instanceof W||t.geometry instanceof G||t.geometry instanceof K||t.geometry instanceof Y||t.geometry instanceof Z))throw new TypeError('"geometry" must be of type Point, LineString, Polygon, MultiPoint, MultiLineString or MultiPolygon. Received type '+typeof t.geometry);var n=new e(ft.GEO_INTERSECTS,[t],this.fieldName);return this.and(n)},e}(ct);function dt(t){return t&&t instanceof pt&&t._internalType===A}function yt(t){return dt(t)}var gt={};for(var vt in ft)gt[vt]="$"+vt;for(var vt in st)gt[vt]="$"+vt;for(var vt in tt)gt[vt]="$"+vt;function mt(t){return gt[t]||"$"+t}gt[ft.NEQ]="$ne",gt[tt.REMOVE]="$unset",gt[tt.SHIFT]="$pop",gt[tt.UNSHIFT]="$push";var bt=function(){return bt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},bt.apply(this,arguments)},wt=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Et=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(wt(arguments[e]));return t};function _t(t){return St(t,[t])}function St(t,e){if(!H(t)){if(V(t))return{$date:+t};if(F(t))return{$regex:t.source,$options:t.flags};if(q(t))return t.map((function(t){if(e.indexOf(t)>-1)throw new Error("Cannot convert circular structure to JSON");return St(t,Et(e,[t]))}));if(k(t)){var n=bt({},t);for(var r in n){if(e.indexOf(n[r])>-1)throw new Error("Cannot convert circular structure to JSON");n[r]=St(n[r],Et(e,[n[r]]))}return n}return t}switch(t._internalType){case N:return t.toJSON();case U:case j:return t.parse();default:return t.toJSON?t.toJSON():t}}var It=function(){return It=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},It.apply(this,arguments)},Tt=function(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s},Ot=function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(Tt(arguments[e]));return t};function At(t,e,n,r){var i=It({},t);for(var o in t)if(!/^\$/.test(o)){var s=t[o];if(s&&k(s)&&!e(s)){if(r.indexOf(s)>-1)throw new Error("Cannot convert circular structure to JSON");var a=At(s,e,Ot(n,[o]),Ot(r,[s]));i[o]=a;var u=!1;for(var c in a)/^\$/.test(c)?u=!0:(i[o+"."+c]=a[c],delete i[o][c]);u||delete i[o]}}return i}function Rt(t){return At(t,xt,[],[t])}function Nt(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?q(t[r])?t[r].push(e[r]):k(t[r])?k(e[r])?Object.assign(t[r],e[r]):(console.warn("unmergable condition, query is object but condition is "+B(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+B(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]}function xt(t){return H(t)||V(t)||F(t)}function Ct(t){return _t(t)}var Pt=function(){function t(){}return t.encode=function(e){return(new t).encodeUpdate(e)},t.prototype.encodeUpdate=function(t){return ut(t)?this.encodeUpdateCommand(t):"object"===B(t)?this.encodeUpdateObject(t):t},t.prototype.encodeUpdateCommand=function(t){if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");switch(t.operator){case tt.PUSH:case tt.PULL:case tt.PULL_ALL:case tt.POP:case tt.SHIFT:case tt.UNSHIFT:case tt.ADD_TO_SET:return this.encodeArrayUpdateCommand(t);default:return this.encodeFieldUpdateCommand(t)}},t.prototype.encodeFieldUpdateCommand=function(t){var e,n,r,i,o=mt(t.operator);return t.operator===tt.REMOVE?((e={})[o]=((n={})[t.fieldName]="",n),e):((r={})[o]=((i={})[t.fieldName]=t.operands[0],i),r)},t.prototype.encodeArrayUpdateCommand=function(t){var e,n,r,i,o,s,a,u,c,h,f=mt(t.operator);switch(t.operator){case tt.PUSH:var l=void 0;return l=q(t.operands)?{$each:t.operands.map(Ct)}:t.operands,(e={})[f]=((n={})[t.fieldName]=l,n),e;case tt.UNSHIFT:return l={$each:t.operands.map(Ct),$position:0},(r={})[f]=((i={})[t.fieldName]=l,i),r;case tt.POP:return(o={})[f]=((s={})[t.fieldName]=1,s),o;case tt.SHIFT:return(a={})[f]=((u={})[t.fieldName]=-1,u),a;default:return(c={})[f]=((h={})[t.fieldName]=Ct(t.operands),h),c}},t.prototype.encodeUpdateObject=function(t){var e=Rt(t);for(var n in e)if(!/^\$/.test(n)){var r=e[n];if(ut(r))e[n]=r._setFieldName(n),Nt(e,this.encodeUpdateCommand(e[n]),n);else{e[n]=r=Ct(r);var i=new at(tt.SET,[r],n);Nt(e,this.encodeUpdateCommand(i),n)}}return e},t}(),Dt={};function Lt(t){if(!Un.wsClientClass)throw new Error("to use realtime you must import realtime module first");var e=t.config.env;return Dt[e]||(Dt[e]=new Un.wsClientClass({context:{appConfig:{docSizeLimit:1e3,realtimePingInterval:1e4,realtimePongWaitTimeout:5e3,request:new Un.reqClass(t.config)}}})),Dt[e]}for(var Ut=function(){return Ut=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ut.apply(this,arguments)},jt=function(){function t(t,e,n,r){var i=this;void 0===r&&(r={}),this.watch=function(t){return Lt(i._db).watch(Ut(Ut({},t),{envId:i._db.config.env,collectionName:i._coll,query:JSON.stringify({_id:i.id})}))},this._db=t,this._coll=e,this.id=n,this.request=new Un.reqClass(this._db.config),this.projection=r}return t.prototype.create=function(t,e){e=e||ot();var n={collectionName:this._coll,data:_t(t)};return this.id&&(n._id=this.id),this.request.send("database.addDocument",n).then((function(t){t.code?e(0,t):e(0,{id:t.data._id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.set=function(t,e){if(e=e||ot(),!this.id)return Promise.resolve({code:"INVALID_PARAM",message:"docId不能为空"});if(!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n=!1,r=function(t){if("object"==typeof t)for(var e in t)t[e]instanceof at?n=!0:"object"==typeof t[e]&&r(t[e])};if(r(t),n)return Promise.resolve({code:"DATABASE_REQUEST_FAILED",message:"update operator complicit"});var i={collectionName:this._coll,queryType:a.DOC,data:_t(t),multi:!1,merge:!1,upsert:!0};return this.id&&(i.query={_id:this.id}),this.request.send("database.updateDocument",i).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.update=function(t,e){if(e=e||ot(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={_id:this.id},r={collectionName:this._coll,data:Pt.encode(t),query:n,queryType:a.DOC,multi:!1,merge:!0,upsert:!1};return this.request.send("database.updateDocument",r).then((function(t){t.code?e(0,t):e(0,{updated:t.data.updated,upsertedId:t.data.upserted_id,requestId:t.requestId})})).catch((function(t){e(t)})),e.promise},t.prototype.remove=function(t){t=t||ot();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:a.DOC,multi:!1};return this.request.send("database.deleteDocument",n).then((function(e){e.code?t(0,e):t(0,{deleted:e.data.deleted,requestId:e.requestId})})).catch((function(e){t(e)})),t.promise},t.prototype.get=function(t){t=t||ot();var e={_id:this.id},n={collectionName:this._coll,query:e,queryType:a.DOC,multi:!1,projection:this.projection};return this.request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n=nt.formatResDocumentData(e.data.list);t(0,{data:n,requestId:e.requestId})}})).catch((function(e){t(e)})),t.promise},t.prototype.field=function(e){for(var n in e)e[n]?e[n]=1:e[n]=0;return new t(this._db,this._coll,this.id,e)},t}(),Bt=function(){function t(){}return t.encode=function(t){return(new kt).encodeQuery(t)},t}(),kt=function(){function t(){}return t.prototype.encodeQuery=function(t,e){var n;return xt(t)?ht(t)?this.encodeLogicCommand(t):dt(t)?this.encodeQueryCommand(t):((n={})[e]=this.encodeQueryObject(t),n):k(t)?this.encodeQueryObject(t):t},t.prototype.encodeRegExp=function(t){return{$regex:t.source,$options:t.flags}},t.prototype.encodeLogicCommand=function(t){var e,n,r,i,o,s,a,u=this;switch(t.operator){case st.NOR:case st.AND:case st.OR:var c=mt(t.operator),h=t.operands.map((function(e){return u.encodeQuery(e,t.fieldName)}));return(e={})[c]=h,e;case st.NOT:c=mt(t.operator);var f=t.operands[0];return F(f)?((n={})[t.fieldName]=((r={})[c]=this.encodeRegExp(f),r),n):(h=this.encodeQuery(f)[t.fieldName],(i={})[t.fieldName]=((o={})[c]=h,o),i);default:if(c=mt(t.operator),1===t.operands.length){var l=this.encodeQuery(t.operands[0]);return(s={})[c]=l,s}return h=t.operands.map(this.encodeQuery.bind(this)),(a={})[c]=h,a}},t.prototype.encodeQueryCommand=function(t){return yt(t),this.encodeComparisonCommand(t)},t.prototype.encodeComparisonCommand=function(t){var e,n,r,i,o,s,a,u,c;if(t.fieldName===T)throw new Error("Cannot encode a comparison command with unset field name");var h=mt(t.operator);switch(t.operator){case ft.EQ:case ft.NEQ:case ft.LT:case ft.LTE:case ft.GT:case ft.GTE:case ft.ELEM_MATCH:case ft.EXISTS:case ft.SIZE:case ft.MOD:return(e={})[t.fieldName]=((n={})[h]=Ct(t.operands[0]),n),e;case ft.IN:case ft.NIN:case ft.ALL:return(r={})[t.fieldName]=((i={})[h]=Ct(t.operands),i),r;case ft.GEO_NEAR:var f=t.operands[0];return(o={})[t.fieldName]={$nearSphere:{$geometry:f.geometry.toJSON(),$maxDistance:f.maxDistance,$minDistance:f.minDistance}},o;case ft.GEO_WITHIN:return f=t.operands[0],(s={})[t.fieldName]={$geoWithin:{$geometry:f.geometry.toJSON()}},s;case ft.GEO_INTERSECTS:return f=t.operands[0],(a={})[t.fieldName]={$geoIntersects:{$geometry:f.geometry.toJSON()}},a;default:return(u={})[t.fieldName]=((c={})[h]=Ct(t.operands[0]),c),u}},t.prototype.encodeQueryObject=function(t){var e=Rt(t);for(var n in e){var r=e[n];if(ht(r)){e[n]=r._setFieldName(n);var i=this.encodeLogicCommand(e[n]);this.mergeConditionAfterEncode(e,i,n)}else yt(r)?(e[n]=r._setFieldName(n),i=this.encodeComparisonCommand(e[n]),this.mergeConditionAfterEncode(e,i,n)):xt(r)&&(e[n]=Ct(r))}return e},t.prototype.mergeConditionAfterEncode=function(t,e,n){for(var r in e[n]||delete t[n],e)t[r]?q(t[r])?t[r]=t[r].concat(e[r]):k(t[r])?k(e[r])?Object.assign(t,e):(console.warn("unmergable condition, query is object but condition is "+B(e)+", can only overwrite",e,n),t[r]=e[r]):(console.warn("to-merge query is of type "+B(t)+", can only overwrite",t,e,n),t[r]=e[r]):t[r]=e[r]},t}(),Mt=function(){return Mt=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Mt.apply(this,arguments)},qt=function(){function t(t,e,n,r,i){var o=this;this.watch=function(t){return Lt(o._db).watch(Mt(Mt({},t),{envId:o._db.config.env,collectionName:o._coll,query:JSON.stringify(o._fieldFilters||{}),limit:o._queryOptions.limit,orderBy:o._fieldOrders?o._fieldOrders.reduce((function(t,e){return t[e.field]=e.direction,t}),{}):void 0}))},this._db=t,this._coll=e,this._fieldFilters=n,this._fieldOrders=r||[],this._queryOptions=i||{},this._request=new Un.reqClass(this._db.config)}return t.prototype.get=function(t){t=t||ot();var e=[];this._fieldOrders&&this._fieldOrders.forEach((function(t){e.push(t)}));var n={collectionName:this._coll,queryType:a.WHERE};return this._fieldFilters&&(n.query=this._fieldFilters),e.length>0&&(n.order=e),this._queryOptions.offset&&(n.offset=this._queryOptions.offset),this._queryOptions.limit?n.limit=this._queryOptions.limit<1e3?this._queryOptions.limit:1e3:n.limit=100,this._queryOptions.projection&&(n.projection=this._queryOptions.projection),this._request.send("database.queryDocument",n).then((function(e){if(e.code)t(0,e);else{var n={data:nt.formatResDocumentData(e.data.list),requestId:e.requestId};e.total&&(n.total=e.total),e.limit&&(n.limit=e.limit),e.offset&&(n.offset=e.offset),t(0,n)}})).catch((function(e){t(e)})),t.promise},t.prototype.count=function(t){t=t||ot();var e={collectionName:this._coll,queryType:a.WHERE};return this._fieldFilters&&(e.query=this._fieldFilters),this._request.send("database.countDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,total:e.data.total})})).catch((function(e){t(e)})),t.promise},t.prototype.where=function(e){if("Object"!==Object.prototype.toString.call(e).slice(8,-1))throw Error(i.QueryParamTypeError);var n=Object.keys(e),r=n.some((function(t){return void 0!==e[t]}));if(n.length&&!r)throw Error(i.QueryParamValueError);return new t(this._db,this._coll,Bt.encode(e),this._fieldOrders,this._queryOptions)},t.prototype.orderBy=function(e,n){rt.isFieldPath(e),rt.isFieldOrder(n);var r={field:e,direction:n},i=this._fieldOrders.concat(r);return new t(this._db,this._coll,this._fieldFilters,i,this._queryOptions)},t.prototype.limit=function(e){rt.isInteger("limit",e);var n=Mt({},this._queryOptions);return n.limit=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.skip=function(e){rt.isInteger("offset",e);var n=Mt({},this._queryOptions);return n.offset=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,n)},t.prototype.update=function(t,e){if(e=e||ot(),!t||"object"!=typeof t)return Promise.resolve({code:"INVALID_PARAM",message:"参数必需是非空对象"});if(t.hasOwnProperty("_id"))return Promise.resolve({code:"INVALID_PARAM",message:"不能更新_id的值"});var n={collectionName:this._coll,query:this._fieldFilters,queryType:a.WHERE,multi:!0,merge:!0,upsert:!1,data:Pt.encode(t)};return this._request.send("database.updateDocument",n).then((function(t){t.code?e(0,t):e(0,{requestId:t.requestId,updated:t.data.updated,upsertId:t.data.upsert_id})})).catch((function(t){e(t)})),e.promise},t.prototype.field=function(e){for(var n in e)e[n]?"object"!=typeof e[n]&&(e[n]=1):e[n]=0;var r=Mt({},this._queryOptions);return r.projection=e,new t(this._db,this._coll,this._fieldFilters,this._fieldOrders,r)},t.prototype.remove=function(t){t=t||ot(),Object.keys(this._queryOptions).length>0&&console.warn("`offset`, `limit` and `projection` are not supported in remove() operation"),this._fieldOrders.length>0&&console.warn("`orderBy` is not supported in remove() operation");var e={collectionName:this._coll,query:Bt.encode(this._fieldFilters),queryType:a.WHERE,multi:!0};return this._request.send("database.deleteDocument",e).then((function(e){e.code?t(0,e):t(0,{requestId:e.requestId,deleted:e.data.deleted})})).catch((function(e){t(e)})),t.promise},t}(),Vt=[],Ft=[],Ht="undefined"!=typeof Uint8Array?Uint8Array:Array,Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$t=0,Gt=Wt.length;$t<Gt;++$t)Vt[$t]=Wt[$t],Ft[Wt.charCodeAt($t)]=$t;function Kt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function Jt(t,e,n){for(var r,i,o=[],s=e;s<n;s+=3)r=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(Vt[(i=r)>>18&63]+Vt[i>>12&63]+Vt[i>>6&63]+Vt[63&i]);return o.join("")}Ft["-".charCodeAt(0)]=62,Ft["_".charCodeAt(0)]=63;var Yt=function(t){var e,n,r=Kt(t),i=r[0],o=r[1],s=new Ht(function(t,e,n){return 3*(e+n)/4-n}(0,i,o)),a=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)e=Ft[t.charCodeAt(n)]<<18|Ft[t.charCodeAt(n+1)]<<12|Ft[t.charCodeAt(n+2)]<<6|Ft[t.charCodeAt(n+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=Ft[t.charCodeAt(n)]<<2|Ft[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=Ft[t.charCodeAt(n)]<<10|Ft[t.charCodeAt(n+1)]<<4|Ft[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},zt=function(t){for(var e,n=t.length,r=n%3,i=[],o=16383,s=0,a=n-r;s<a;s+=o)i.push(Jt(t,s,s+o>a?a:s+o));return 1===r?(e=t[n-1],i.push(Vt[e>>2]+Vt[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],i.push(Vt[e>>10]+Vt[e>>4&63]+Vt[e<<2&63]+"=")),i.join("")},Zt=function(t,e,n,r,i){var o,s,a=8*i-r-1,u=(1<<a)-1,c=u>>1,h=-7,f=n?i-1:0,l=n?-1:1,p=t[e+f];for(f+=l,o=p&(1<<-h)-1,p>>=-h,h+=a;h>0;o=256*o+t[e+f],f+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=r;h>0;s=256*s+t[e+f],f+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,r),o-=c}return(p?-1:1)*s*Math.pow(2,o-r)},Qt=function(t,e,n,r,i,o){var s,a,u,c=8*o-i-1,h=(1<<c)-1,f=h>>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,d=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+f>=1?l/u:l*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=h?(a=0,s=h):s+f>=1?(a=(e*u-1)*Math.pow(2,i),s+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[n+p]=255&s,p+=d,s/=256,c-=8);t[n+p-d]|=128*y},Xt=function(t,e){return function(t,e){var n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(t){return+t!=t&&(t=0),o.alloc(+t)},e.INSPECT_MAX_BYTES=50;var r=2147483647;function i(t){if(t>r)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,o.prototype),e}function o(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return s(t,e,n)}function s(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!o.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var n=0|l(t,e),r=i(n),s=r.write(t,e);return s!==n&&(r=r.slice(0,s)),r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(k(t,Uint8Array)){var e=new Uint8Array(t);return h(e.buffer,e.byteOffset,e.byteLength)}return c(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t));if(k(t,ArrayBuffer)||t&&k(t.buffer,ArrayBuffer))return h(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(k(t,SharedArrayBuffer)||t&&k(t.buffer,SharedArrayBuffer)))return h(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return o.from(r,e,n);var s=function(t){if(o.isBuffer(t)){var e=0|f(t.length),n=i(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||M(t.length)?i(0):c(t):"Buffer"===t.type&&Array.isArray(t.data)?c(t.data):void 0}(t);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return o.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+babelHelpers.typeof(t))}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return a(t),i(t<0?0:0|f(t))}function c(t){for(var e=t.length<0?0:0|f(t.length),n=i(e),r=0;r<e;r+=1)n[r]=255&t[r];return n}function h(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,o.prototype),r}function f(t){if(t>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|t}function l(t,e){if(o.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||k(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+babelHelpers.typeof(t));var n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(t).length;default:if(i)return r?-1:U(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,n);case"utf8":case"utf-8":return S(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return _(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function d(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),M(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=o.from(e,r)),o.isBuffer(e))return 0===e.length?-1:g(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):g(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function g(t,e,n,r,i){var o,s=1,a=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var f=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){f=!1;break}if(f)return o}return-1}function v(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=e.length;r>o/2&&(r=o/2);for(var s=0;s<r;++s){var a=parseInt(e.substr(2*s,2),16);if(M(a))return s;t[n+s]=a}return s}function m(t,e,n,r){return B(U(e,t.length-n),t,n,r)}function b(t,e,n,r){return B(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function w(t,e,n,r){return B(j(e),t,n,r)}function E(t,e,n,r){return B(function(t,e){for(var n,r,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=(n=t.charCodeAt(s))>>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function _(t,e,n){return 0===e&&n===t.length?zt(t):zt(t.slice(e,n))}function S(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var o,s,a,u,c=t[i],h=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,f=1):h>65535&&(h-=65536,r.push(h>>>10&1023|55296),h=56320|1023&h),r.push(h),i+=f}return function(t){var e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=I));return n}(r)}e.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(t,e,n){return s(t,e,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(t,e,n){return function(t,e,n){return a(t),t<=0?i(t):void 0!==e?"string"==typeof n?i(t).fill(e,n):i(t).fill(e):i(t)}(t,e,n)},o.allocUnsafe=function(t){return u(t)},o.allocUnsafeSlow=function(t){return u(t)},o.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==o.prototype},o.compare=function(t,e){if(k(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),k(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(t)||!o.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return o.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=o.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(k(s,Uint8Array))i+s.length>r.length?o.from(s).copy(r,i):Uint8Array.prototype.set.call(r,s,i);else{if(!o.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,i)}i+=s.length}return r},o.byteLength=l,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},o.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},o.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},o.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?S(this,0,t):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(t){if(!o.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===o.compare(this,t)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(t,e,n,r,i){if(k(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+babelHelpers.typeof(t));if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(s,a),c=this.slice(r,i),h=t.slice(e,n),f=0;f<u;++f)if(c[f]!==h[f]){s=c[f],a=h[f];break}return s<a?-1:a<s?1:0},o.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},o.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},o.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},o.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return v(this,t,e,n);case"utf8":case"utf-8":return m(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return w(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function T(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function O(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function A(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=e;o<n;++o)i+=q[t[o]];return i}function R(t,e,n){for(var r=t.slice(e,n),i="",o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function N(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function x(t,e,n,r,i,s){if(!o.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function C(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,i){return e=+e,n>>>=0,i||C(t,0,n,4),Qt(t,e,n,r,23,4),n+4}function D(t,e,n,r,i){return e=+e,n>>>=0,i||C(t,0,n,8),Qt(t,e,n,r,52,8),n+8}o.prototype.slice=function(t,e){var n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r=this.subarray(t,e);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),this[t]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]|this[t+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(t,e){return t>>>=0,e||N(t,2,this.length),this[t]<<8|this[t+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},o.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=this[t],i=1,o=0;++o<e&&(i*=256);)r+=this[t+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},o.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||N(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},o.prototype.readInt8=function(t,e){return t>>>=0,e||N(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},o.prototype.readInt16LE=function(t,e){t>>>=0,e||N(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(t,e){t>>>=0,e||N(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},o.prototype.readInt32BE=function(t,e){return t>>>=0,e||N(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},o.prototype.readFloatLE=function(t,e){return t>>>=0,e||N(t,4,this.length),Zt(this,t,!0,23,4)},o.prototype.readFloatBE=function(t,e){return t>>>=0,e||N(t,4,this.length),Zt(this,t,!1,23,4)},o.prototype.readDoubleLE=function(t,e){return t>>>=0,e||N(t,8,this.length),Zt(this,t,!0,52,8)},o.prototype.readDoubleBE=function(t,e){return t>>>=0,e||N(t,8,this.length),Zt(this,t,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o<n&&(i*=256);)this[e+o]=t/i&255;return e+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(t,e,n,r){t=+t,e>>>=0,n>>>=0,r||x(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,255,0),this[e]=255&t,e+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){var i=Math.pow(2,8*n-1);x(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},o.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},o.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},o.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},o.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},o.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||x(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},o.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},o.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},o.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},o.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},o.prototype.copy=function(t,e,n,r){if(!o.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},o.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){var i=t.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(t=i)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=o.isBuffer(t)?t:o.from(t,r),u=a.length;if(0===u)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var L=/[^+/0-9A-Za-z-_]/g;function U(t,e){var n;e=e||1/0;for(var r=t.length,i=null,o=[],s=0;s<r;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function j(t){return Yt(function(t){if((t=(t=t.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function B(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function k(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function M(t){return t!=t}var q=function(){for(var t="0123456789abcdef",e=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)e[r+i]=t[n]+t[i];return e}()}(e={exports:{}},e.exports),e.exports}(),te=Xt.Buffer;Xt.SlowBuffer,Xt.INSPECT_MAX_BYTES,Xt.kMaxLength;var ee=function(t,e){return ee=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},ee(t,e)};function ne(t,e){function n(){this.constructor=t}ee(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var re=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return ne(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONError"},enumerable:!1,configurable:!0}),e}(Error),ie=function(t){function e(n){var r=t.call(this,n)||this;return Object.setPrototypeOf(r,e.prototype),r}return ne(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return"BSONTypeError"},enumerable:!1,configurable:!0}),e}(TypeError);function oe(t){return t&&t.Math==Math&&t}function se(){return oe("object"==typeof globalThis&&globalThis)||oe("object"==typeof window&&window)||oe("object"==typeof self&&self)||oe("object"==typeof n.g&&n.g)||Function("return this")()}var ae=function(t){var e,n="object"==typeof(e=se()).navigator&&"ReactNative"===e.navigator.product?"BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.":"BSON: No cryptographic implementation for random bytes present, falling back to a less secure implementation.";console.warn(n);for(var r=te.alloc(t),i=0;i<t;++i)r[i]=Math.floor(256*Math.random());return r},ue=function(){if("undefined"!=typeof window){var t=window.crypto||window.msCrypto;if(t&&t.getRandomValues)return function(e){return t.getRandomValues(te.alloc(e))}}return void 0!==n.g&&n.g.crypto&&n.g.crypto.getRandomValues?function(t){return n.g.crypto.getRandomValues(te.alloc(t))}:ae}();function ce(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)}function he(t){return"object"==typeof t&&null!==t}function fe(t,e){var n=!1;return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return n||(console.warn(e),n=!0),t.apply(this,r)}}function le(t){if(ArrayBuffer.isView(t))return te.from(t.buffer,t.byteOffset,t.byteLength);if(e=t,["[object ArrayBuffer]","[object SharedArrayBuffer]"].includes(Object.prototype.toString.call(e)))return te.from(t);var e;throw new ie("Must use either Buffer or TypedArray")}var pe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15})$/i,de=function(t){return"string"==typeof t&&pe.test(t)},ye=function(t){if(!de(t))throw new ie('UUID string representations must be a 32 or 36 character hex string (dashes excluded/included). Format: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" or "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx".');var e=t.replace(/-/g,"");return te.from(e,"hex")},ge=function(t,e){return void 0===e&&(e=!0),e?t.toString("hex",0,4)+"-"+t.toString("hex",4,6)+"-"+t.toString("hex",6,8)+"-"+t.toString("hex",8,10)+"-"+t.toString("hex",10,16):t.toString("hex")},ve=(Math.pow(2,63),Math.pow(2,63),Math.pow(2,53)),me=-Math.pow(2,53),be=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(!(null==e||"string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||Array.isArray(e)))throw new ie("Binary can only be constructed from string, Buffer, TypedArray, or Array<number>");this.sub_type=null!=n?n:t.BSON_BINARY_SUBTYPE_DEFAULT,null==e?(this.buffer=te.alloc(t.BUFFER_SIZE),this.position=0):("string"==typeof e?this.buffer=te.from(e,"binary"):Array.isArray(e)?this.buffer=te.from(e):this.buffer=le(e),this.position=this.buffer.byteLength)}return t.prototype.put=function(e){if("string"==typeof e&&1!==e.length)throw new ie("only accepts single character String");if("number"!=typeof e&&1!==e.length)throw new ie("only accepts single character Uint8Array or Array");var n;if((n="string"==typeof e?e.charCodeAt(0):"number"==typeof e?e:e[0])<0||n>255)throw new ie("only accepts number in a valid unsigned byte range 0-255");if(this.buffer.length>this.position)this.buffer[this.position++]=n;else{var r=te.alloc(t.BUFFER_SIZE+this.buffer.length);this.buffer.copy(r,0,0,this.buffer.length),this.buffer=r,this.buffer[this.position++]=n}},t.prototype.write=function(t,e){if(e="number"==typeof e?e:this.position,this.buffer.length<e+t.length){var n=te.alloc(this.buffer.length+t.length);this.buffer.copy(n,0,0,this.buffer.length),this.buffer=n}ArrayBuffer.isView(t)?(this.buffer.set(le(t),e),this.position=e+t.byteLength>this.position?e+t.length:this.position):"string"==typeof t&&(this.buffer.write(t,e,t.length,"binary"),this.position=e+t.length>this.position?e+t.length:this.position)},t.prototype.read=function(t,e){return e=e&&e>0?e:this.position,this.buffer.slice(t,t+e)},t.prototype.value=function(t){return(t=!!t)&&this.buffer.length===this.position?this.buffer:t?this.buffer.slice(0,this.position):this.buffer.toString("binary",0,this.position)},t.prototype.length=function(){return this.position},t.prototype.toJSON=function(){return this.buffer.toString("base64")},t.prototype.toString=function(t){return this.buffer.toString(t)},t.prototype.toExtendedJSON=function(t){t=t||{};var e=this.buffer.toString("base64"),n=Number(this.sub_type).toString(16);return t.legacy?{$binary:e,$type:1===n.length?"0"+n:n}:{$binary:{base64:e,subType:1===n.length?"0"+n:n}}},t.prototype.toUUID=function(){if(this.sub_type===t.SUBTYPE_UUID)return new we(this.buffer.slice(0,this.position));throw new re('Binary sub_type "'.concat(this.sub_type,'" is not supported for converting to UUID. Only "').concat(t.SUBTYPE_UUID,'" is currently supported.'))},t.fromExtendedJSON=function(e,n){var r,i;if(n=n||{},"$binary"in e?n.legacy&&"string"==typeof e.$binary&&"$type"in e?(i=e.$type?parseInt(e.$type,16):0,r=te.from(e.$binary,"base64")):"string"!=typeof e.$binary&&(i=e.$binary.subType?parseInt(e.$binary.subType,16):0,r=te.from(e.$binary.base64,"base64")):"$uuid"in e&&(i=4,r=ye(e.$uuid)),!r)throw new ie("Unexpected Binary Extended JSON format ".concat(JSON.stringify(e)));return 4===i?new we(r):new t(r,i)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.value(!0);return'new Binary(Buffer.from("'.concat(t.toString("hex"),'", "hex"), ').concat(this.sub_type,")")},t.BSON_BINARY_SUBTYPE_DEFAULT=0,t.BUFFER_SIZE=256,t.SUBTYPE_DEFAULT=0,t.SUBTYPE_FUNCTION=1,t.SUBTYPE_BYTE_ARRAY=2,t.SUBTYPE_UUID_OLD=3,t.SUBTYPE_UUID=4,t.SUBTYPE_MD5=5,t.SUBTYPE_ENCRYPTED=6,t.SUBTYPE_COLUMN=7,t.SUBTYPE_USER_DEFINED=128,t}();Object.defineProperty(be.prototype,"_bsontype",{value:"Binary"});var we=function(t){function e(n){var r,i,o=this;if(null==n)r=e.generate();else if(n instanceof e)r=te.from(n.buffer),i=n.__id;else if(ArrayBuffer.isView(n)&&16===n.byteLength)r=le(n);else{if("string"!=typeof n)throw new ie("Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).");r=ye(n)}return(o=t.call(this,r,4)||this).__id=i,o}return ne(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this.buffer},set:function(t){this.buffer=t,e.cacheHexString&&(this.__id=ge(t))},enumerable:!1,configurable:!0}),e.prototype.toHexString=function(t){if(void 0===t&&(t=!0),e.cacheHexString&&this.__id)return this.__id;var n=ge(this.id,t);return e.cacheHexString&&(this.__id=n),n},e.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},e.prototype.toJSON=function(){return this.toHexString()},e.prototype.equals=function(t){if(!t)return!1;if(t instanceof e)return t.id.equals(this.id);try{return new e(t).id.equals(this.id)}catch(t){return!1}},e.prototype.toBinary=function(){return new be(this.id,be.SUBTYPE_UUID)},e.generate=function(){var t=ue(16);return t[6]=15&t[6]|64,t[8]=63&t[8]|128,te.from(t)},e.isValid=function(t){return!!t&&(t instanceof e||("string"==typeof t?de(t):!!ce(t)&&16===t.length&&64==(240&t[6])&&128==(128&t[8])))},e.createFromHexString=function(t){return new e(ye(t))},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return'new UUID("'.concat(this.toHexString(),'")')},e}(be),Ee=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);this.code=e,this.scope=n}return t.prototype.toJSON=function(){return{code:this.code,scope:this.scope}},t.prototype.toExtendedJSON=function(){return this.scope?{$code:this.code,$scope:this.scope}:{$code:this.code}},t.fromExtendedJSON=function(e){return new t(e.$code,e.$scope)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toJSON();return'new Code("'.concat(String(t.code),'"').concat(t.scope?", ".concat(JSON.stringify(t.scope)):"",")")},t}();Object.defineProperty(Ee.prototype,"_bsontype",{value:"Code"});var _e=function(){function t(e,n,r,i){if(!(this instanceof t))return new t(e,n,r,i);var o=e.split(".");2===o.length&&(r=o.shift(),e=o.shift()),this.collection=e,this.oid=n,this.db=r,this.fields=i||{}}return Object.defineProperty(t.prototype,"namespace",{get:function(){return this.collection},set:function(t){this.collection=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){var t=Object.assign({$ref:this.collection,$id:this.oid},this.fields);return null!=this.db&&(t.$db=this.db),t},t.prototype.toExtendedJSON=function(t){t=t||{};var e={$ref:this.collection,$id:this.oid};return t.legacy?e:(this.db&&(e.$db=this.db),e=Object.assign(e,this.fields))},t.fromExtendedJSON=function(e){var n=Object.assign({},e);return delete n.$ref,delete n.$id,delete n.$db,new t(e.$ref,e.$id,e.$db,n)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=void 0===this.oid||void 0===this.oid.toString?this.oid:this.oid.toString();return'new DBRef("'.concat(this.namespace,'", new ObjectId("').concat(String(t),'")').concat(this.db?', "'.concat(this.db,'"'):"",")")},t}();Object.defineProperty(_e.prototype,"_bsontype",{value:"DBRef"});var Se=void 0;try{Se=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(r){}var Ie=4294967296,Te=0x10000000000000000,Oe=Te/2,Ae={},Re={},Ne=function(){function t(e,n,r){if(void 0===e&&(e=0),!(this instanceof t))return new t(e,n,r);"bigint"==typeof e?Object.assign(this,t.fromBigInt(e,!!n)):"string"==typeof e?Object.assign(this,t.fromString(e,!!n)):(this.low=0|e,this.high=0|n,this.unsigned=!!r),Object.defineProperty(this,"__isLong__",{value:!0,configurable:!1,writable:!1,enumerable:!1})}return t.fromBits=function(e,n,r){return new t(e,n,r)},t.fromInt=function(e,n){var r,i,o;return n?(o=0<=(e>>>=0)&&e<256)&&(i=Re[e])?i:(r=t.fromBits(e,(0|e)<0?-1:0,!0),o&&(Re[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=Ae[e])?i:(r=t.fromBits(e,e<0?-1:0,!1),o&&(Ae[e]=r),r)},t.fromNumber=function(e,n){if(isNaN(e))return n?t.UZERO:t.ZERO;if(n){if(e<0)return t.UZERO;if(e>=Te)return t.MAX_UNSIGNED_VALUE}else{if(e<=-Oe)return t.MIN_VALUE;if(e+1>=Oe)return t.MAX_VALUE}return e<0?t.fromNumber(-e,n).neg():t.fromBits(e%Ie|0,e/Ie|0,n)},t.fromBigInt=function(e,n){return t.fromString(e.toString(),n)},t.fromString=function(e,n,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return t.ZERO;if("number"==typeof n?(r=n,n=!1):n=!!n,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return t.fromString(e.substring(1),n,r).neg();for(var o=t.fromNumber(Math.pow(r,8)),s=t.ZERO,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+u),r);if(u<8){var h=t.fromNumber(Math.pow(r,u));s=s.mul(h).add(t.fromNumber(c))}else s=(s=s.mul(o)).add(t.fromNumber(c))}return s.unsigned=n,s},t.fromBytes=function(e,n,r){return r?t.fromBytesLE(e,n):t.fromBytesBE(e,n)},t.fromBytesLE=function(e,n){return new t(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,n)},t.fromBytesBE=function(e,n){return new t(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],n)},t.isLong=function(t){return he(t)&&!0===t.__isLong__},t.fromValue=function(e,n){return"number"==typeof e?t.fromNumber(e,n):"string"==typeof e?t.fromString(e,n):t.fromBits(e.low,e.high,"boolean"==typeof n?n:e.unsigned)},t.prototype.add=function(e){t.isLong(e)||(e=t.fromValue(e));var n=this.high>>>16,r=65535&this.high,i=this.low>>>16,o=65535&this.low,s=e.high>>>16,a=65535&e.high,u=e.low>>>16,c=0,h=0,f=0,l=0;return f+=(l+=o+(65535&e.low))>>>16,l&=65535,h+=(f+=i+u)>>>16,f&=65535,c+=(h+=r+a)>>>16,h&=65535,c+=n+s,c&=65535,t.fromBits(f<<16|l,c<<16|h,this.unsigned)},t.prototype.and=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low&e.low,this.high&e.high,this.unsigned)},t.prototype.compare=function(e){if(t.isLong(e)||(e=t.fromValue(e)),this.eq(e))return 0;var n=this.isNegative(),r=e.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},t.prototype.comp=function(t){return this.compare(t)},t.prototype.divide=function(e){if(t.isLong(e)||(e=t.fromValue(e)),e.isZero())throw Error("division by zero");if(Se){if(!this.unsigned&&-2147483648===this.high&&-1===e.low&&-1===e.high)return this;var n=(this.unsigned?Se.div_u:Se.div_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Se.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?t.UZERO:t.ZERO;var r,i,o;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return t.UZERO;if(e.gt(this.shru(1)))return t.UONE;o=t.UZERO}else{if(this.eq(t.MIN_VALUE))return e.eq(t.ONE)||e.eq(t.NEG_ONE)?t.MIN_VALUE:e.eq(t.MIN_VALUE)?t.ONE:(r=this.shr(1).div(e).shl(1)).eq(t.ZERO)?e.isNegative()?t.ONE:t.NEG_ONE:(i=this.sub(e.mul(r)),o=r.add(i.div(e)));if(e.eq(t.MIN_VALUE))return this.unsigned?t.UZERO:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();o=t.ZERO}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),a=s<=48?1:Math.pow(2,s-48),u=t.fromNumber(r),c=u.mul(e);c.isNegative()||c.gt(i);)r-=a,c=(u=t.fromNumber(r,this.unsigned)).mul(e);u.isZero()&&(u=t.ONE),o=o.add(u),i=i.sub(c)}return o},t.prototype.div=function(t){return this.divide(t)},t.prototype.equals=function(e){return t.isLong(e)||(e=t.fromValue(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},t.prototype.eq=function(t){return this.equals(t)},t.prototype.getHighBits=function(){return this.high},t.prototype.getHighBitsUnsigned=function(){return this.high>>>0},t.prototype.getLowBits=function(){return this.low},t.prototype.getLowBitsUnsigned=function(){return this.low>>>0},t.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.eq(t.MIN_VALUE)?64:this.neg().getNumBitsAbs();var e,n=0!==this.high?this.high:this.low;for(e=31;e>0&&0==(n&1<<e);e--);return 0!==this.high?e+33:e+1},t.prototype.greaterThan=function(t){return this.comp(t)>0},t.prototype.gt=function(t){return this.greaterThan(t)},t.prototype.greaterThanOrEqual=function(t){return this.comp(t)>=0},t.prototype.gte=function(t){return this.greaterThanOrEqual(t)},t.prototype.ge=function(t){return this.greaterThanOrEqual(t)},t.prototype.isEven=function(){return 0==(1&this.low)},t.prototype.isNegative=function(){return!this.unsigned&&this.high<0},t.prototype.isOdd=function(){return 1==(1&this.low)},t.prototype.isPositive=function(){return this.unsigned||this.high>=0},t.prototype.isZero=function(){return 0===this.high&&0===this.low},t.prototype.lessThan=function(t){return this.comp(t)<0},t.prototype.lt=function(t){return this.lessThan(t)},t.prototype.lessThanOrEqual=function(t){return this.comp(t)<=0},t.prototype.lte=function(t){return this.lessThanOrEqual(t)},t.prototype.modulo=function(e){if(t.isLong(e)||(e=t.fromValue(e)),Se){var n=(this.unsigned?Se.rem_u:Se.rem_s)(this.low,this.high,e.low,e.high);return t.fromBits(n,Se.get_high(),this.unsigned)}return this.sub(this.div(e).mul(e))},t.prototype.mod=function(t){return this.modulo(t)},t.prototype.rem=function(t){return this.modulo(t)},t.prototype.multiply=function(e){if(this.isZero())return t.ZERO;if(t.isLong(e)||(e=t.fromValue(e)),Se){var n=Se.mul(this.low,this.high,e.low,e.high);return t.fromBits(n,Se.get_high(),this.unsigned)}if(e.isZero())return t.ZERO;if(this.eq(t.MIN_VALUE))return e.isOdd()?t.MIN_VALUE:t.ZERO;if(e.eq(t.MIN_VALUE))return this.isOdd()?t.MIN_VALUE:t.ZERO;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(t.TWO_PWR_24)&&e.lt(t.TWO_PWR_24))return t.fromNumber(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,o=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=65535&e.high,c=e.low>>>16,h=65535&e.low,f=0,l=0,p=0,d=0;return p+=(d+=s*h)>>>16,d&=65535,l+=(p+=o*h)>>>16,p&=65535,l+=(p+=s*c)>>>16,p&=65535,f+=(l+=i*h)>>>16,l&=65535,f+=(l+=o*c)>>>16,l&=65535,f+=(l+=s*u)>>>16,l&=65535,f+=r*h+i*c+o*u+s*a,f&=65535,t.fromBits(p<<16|d,f<<16|l,this.unsigned)},t.prototype.mul=function(t){return this.multiply(t)},t.prototype.negate=function(){return!this.unsigned&&this.eq(t.MIN_VALUE)?t.MIN_VALUE:this.not().add(t.ONE)},t.prototype.neg=function(){return this.negate()},t.prototype.not=function(){return t.fromBits(~this.low,~this.high,this.unsigned)},t.prototype.notEquals=function(t){return!this.equals(t)},t.prototype.neq=function(t){return this.notEquals(t)},t.prototype.ne=function(t){return this.notEquals(t)},t.prototype.or=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low|e.low,this.high|e.high,this.unsigned)},t.prototype.shiftLeft=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):t.fromBits(0,this.low<<e-32,this.unsigned)},t.prototype.shl=function(t){return this.shiftLeft(t)},t.prototype.shiftRight=function(e){return t.isLong(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?t.fromBits(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):t.fromBits(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},t.prototype.shr=function(t){return this.shiftRight(t)},t.prototype.shiftRightUnsigned=function(e){if(t.isLong(e)&&(e=e.toInt()),0==(e&=63))return this;var n=this.high;if(e<32){var r=this.low;return t.fromBits(r>>>e|n<<32-e,n>>>e,this.unsigned)}return 32===e?t.fromBits(n,0,this.unsigned):t.fromBits(n>>>e-32,0,this.unsigned)},t.prototype.shr_u=function(t){return this.shiftRightUnsigned(t)},t.prototype.shru=function(t){return this.shiftRightUnsigned(t)},t.prototype.subtract=function(e){return t.isLong(e)||(e=t.fromValue(e)),this.add(e.neg())},t.prototype.sub=function(t){return this.subtract(t)},t.prototype.toInt=function(){return this.unsigned?this.low>>>0:this.low},t.prototype.toNumber=function(){return this.unsigned?(this.high>>>0)*Ie+(this.low>>>0):this.high*Ie+(this.low>>>0)},t.prototype.toBigInt=function(){return BigInt(this.toString())},t.prototype.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},t.prototype.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},t.prototype.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},t.prototype.toSigned=function(){return this.unsigned?t.fromBits(this.low,this.high,!1):this},t.prototype.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(t.MIN_VALUE)){var n=t.fromNumber(e),r=this.div(n),i=r.mul(n).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var o=t.fromNumber(Math.pow(e,6),this.unsigned),s=this,a="";;){var u=s.div(o),c=(s.sub(u.mul(o)).toInt()>>>0).toString(e);if((s=u).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},t.prototype.toUnsigned=function(){return this.unsigned?this:t.fromBits(this.low,this.high,!0)},t.prototype.xor=function(e){return t.isLong(e)||(e=t.fromValue(e)),t.fromBits(this.low^e.low,this.high^e.high,this.unsigned)},t.prototype.eqz=function(){return this.isZero()},t.prototype.le=function(t){return this.lessThanOrEqual(t)},t.prototype.toExtendedJSON=function(t){return t&&t.relaxed?this.toNumber():{$numberLong:this.toString()}},t.fromExtendedJSON=function(e,n){var r=t.fromString(e.$numberLong);return n&&n.relaxed?r.toNumber():r},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Long("'.concat(this.toString(),'"').concat(this.unsigned?", true":"",")")},t.TWO_PWR_24=t.fromInt(16777216),t.MAX_UNSIGNED_VALUE=t.fromBits(-1,-1,!0),t.ZERO=t.fromInt(0),t.UZERO=t.fromInt(0,!0),t.ONE=t.fromInt(1),t.UONE=t.fromInt(1,!0),t.NEG_ONE=t.fromInt(-1),t.MAX_VALUE=t.fromBits(-1,2147483647,!1),t.MIN_VALUE=t.fromBits(0,-2147483648,!1),t}();Object.defineProperty(Ne.prototype,"__isLong__",{value:!0}),Object.defineProperty(Ne.prototype,"_bsontype",{value:"Long"});var xe=/^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/,Ce=/^(\+|-)?(Infinity|inf)$/i,Pe=/^(\+|-)?NaN$/i,De=6111,Le=-6176,Ue=[124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),je=[248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),Be=[120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].reverse(),ke=/^([-+])?(\d+)?$/;function Me(t){return!isNaN(parseInt(t,10))}function qe(t){var e=Ne.fromNumber(1e9),n=Ne.fromNumber(0);if(!(t.parts[0]||t.parts[1]||t.parts[2]||t.parts[3]))return{quotient:t,rem:n};for(var r=0;r<=3;r++)n=(n=n.shiftLeft(32)).add(new Ne(t.parts[r],0)),t.parts[r]=n.div(e).low,n=n.modulo(e);return{quotient:t,rem:n}}function Ve(t,e){throw new ie('"'.concat(t,'" is not a valid Decimal128 string - ').concat(e))}var Fe=function(){function t(e){if(!(this instanceof t))return new t(e);if("string"==typeof e)this.bytes=t.fromString(e).bytes;else{if(!ce(e))throw new ie("Decimal128 must take a Buffer or string");if(16!==e.byteLength)throw new ie("Decimal128 must take a Buffer of 16 bytes");this.bytes=e}}return t.fromString=function(e){var n,r=!1,i=!1,o=!1,s=0,a=0,u=0,c=0,h=0,f=[0],l=0,p=0,d=0,y=0,g=0,v=0,m=new Ne(0,0),b=new Ne(0,0),w=0;if(e.length>=7e3)throw new ie(e+" not a valid Decimal128 string");var E=e.match(xe),_=e.match(Ce),S=e.match(Pe);if(!E&&!_&&!S||0===e.length)throw new ie(e+" not a valid Decimal128 string");if(E){var I=E[2],T=E[4],O=E[5],A=E[6];T&&void 0===A&&Ve(e,"missing exponent power"),T&&void 0===I&&Ve(e,"missing exponent base"),void 0===T&&(O||A)&&Ve(e,"missing e before exponent")}if("+"!==e[w]&&"-"!==e[w]||(r="-"===e[w++]),!Me(e[w])&&"."!==e[w]){if("i"===e[w]||"I"===e[w])return new t(te.from(r?je:Be));if("N"===e[w])return new t(te.from(Ue))}for(;Me(e[w])||"."===e[w];)"."!==e[w]?(l<34&&("0"!==e[w]||o)&&(o||(h=a),o=!0,f[p++]=parseInt(e[w],10),l+=1),o&&(u+=1),i&&(c+=1),a+=1,w+=1):(i&&Ve(e,"contains multiple periods"),i=!0,w+=1);if(i&&!a)throw new ie(e+" not a valid Decimal128 string");if("e"===e[w]||"E"===e[w]){var R=e.substr(++w).match(ke);if(!R||!R[2])return new t(te.from(Ue));g=parseInt(R[0],10),w+=R[0].length}if(e[w])return new t(te.from(Ue));if(d=0,l){if(y=l-1,1!==(s=u))for(;0===f[h+s-1];)s-=1}else d=0,y=0,f[0]=0,u=1,l=1,s=0;for(g<=c&&c-g>16384?g=Le:g-=c;g>De;){if((y+=1)-d>34){if(f.join("").match(/^0+$/)){g=De;break}Ve(e,"overflow")}g-=1}for(;g<Le||l<u;){if(0===y&&s<l){g=Le,s=0;break}if(l<u?u-=1:y-=1,g<De)g+=1;else{if(f.join("").match(/^0+$/)){g=De;break}Ve(e,"overflow")}}if(y-d+1<s){var N=a;i&&(h+=1,N+=1),r&&(h+=1,N+=1);var x=parseInt(e[h+y+1],10),C=0;if(x>=5&&(C=1,5===x))for(C=f[y]%2==1?1:0,v=h+y+2;v<N;v++)if(parseInt(e[v],10)){C=1;break}if(C)for(var P=y;P>=0;P--)if(++f[P]>9&&(f[P]=0,0===P)){if(!(g<De))return new t(te.from(r?je:Be));g+=1,f[P]=1}}if(m=Ne.fromNumber(0),b=Ne.fromNumber(0),0===s)m=Ne.fromNumber(0),b=Ne.fromNumber(0);else if(y-d<17)for(P=d,b=Ne.fromNumber(f[P++]),m=new Ne(0,0);P<=y;P++)b=(b=b.multiply(Ne.fromNumber(10))).add(Ne.fromNumber(f[P]));else{for(P=d,m=Ne.fromNumber(f[P++]);P<=y-17;P++)m=(m=m.multiply(Ne.fromNumber(10))).add(Ne.fromNumber(f[P]));for(b=Ne.fromNumber(f[P++]);P<=y;P++)b=(b=b.multiply(Ne.fromNumber(10))).add(Ne.fromNumber(f[P]))}var D,L,U,j,B=function(t,e){if(!t&&!e)return{high:Ne.fromNumber(0),low:Ne.fromNumber(0)};var n=t.shiftRightUnsigned(32),r=new Ne(t.getLowBits(),0),i=e.shiftRightUnsigned(32),o=new Ne(e.getLowBits(),0),s=n.multiply(i),a=n.multiply(o),u=r.multiply(i),c=r.multiply(o);return s=s.add(a.shiftRightUnsigned(32)),a=new Ne(a.getLowBits(),0).add(u).add(c.shiftRightUnsigned(32)),{high:s=s.add(a.shiftRightUnsigned(32)),low:c=a.shiftLeft(32).add(new Ne(c.getLowBits(),0))}}(m,Ne.fromString("100000000000000000"));B.low=B.low.add(b),L=b,((U=(D=B.low).high>>>0)<(j=L.high>>>0)||U===j&&D.low>>>0<L.low>>>0)&&(B.high=B.high.add(Ne.fromNumber(1))),n=g+6176;var k={low:Ne.fromNumber(0),high:Ne.fromNumber(0)};B.high.shiftRightUnsigned(49).and(Ne.fromNumber(1)).equals(Ne.fromNumber(1))?(k.high=k.high.or(Ne.fromNumber(3).shiftLeft(61)),k.high=k.high.or(Ne.fromNumber(n).and(Ne.fromNumber(16383).shiftLeft(47))),k.high=k.high.or(B.high.and(Ne.fromNumber(0x7fffffffffff)))):(k.high=k.high.or(Ne.fromNumber(16383&n).shiftLeft(49)),k.high=k.high.or(B.high.and(Ne.fromNumber(562949953421311)))),k.low=B.low,r&&(k.high=k.high.or(Ne.fromString("9223372036854775808")));var M=te.alloc(16);return w=0,M[w++]=255&k.low.low,M[w++]=k.low.low>>8&255,M[w++]=k.low.low>>16&255,M[w++]=k.low.low>>24&255,M[w++]=255&k.low.high,M[w++]=k.low.high>>8&255,M[w++]=k.low.high>>16&255,M[w++]=k.low.high>>24&255,M[w++]=255&k.high.low,M[w++]=k.high.low>>8&255,M[w++]=k.high.low>>16&255,M[w++]=k.high.low>>24&255,M[w++]=255&k.high.high,M[w++]=k.high.high>>8&255,M[w++]=k.high.high>>16&255,M[w++]=k.high.high>>24&255,new t(M)},t.prototype.toString=function(){for(var t,e=0,n=new Array(36),r=0;r<n.length;r++)n[r]=0;var i,o,s,a=0,u=!1,c={parts:[0,0,0,0]},h=[];a=0;var f=this.bytes,l=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,p=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,d=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24,y=f[a++]|f[a++]<<8|f[a++]<<16|f[a++]<<24;a=0,(new Ne(l,p),new Ne(d,y)).lessThan(Ne.ZERO)&&h.push("-");var g=y>>26&31;if(g>>3==3){if(30===g)return h.join("")+"Infinity";if(31===g)return"NaN";t=y>>15&16383,i=8+(y>>14&1)}else i=y>>14&7,t=y>>17&16383;var v=t-6176;if(c.parts[0]=(16383&y)+((15&i)<<14),c.parts[1]=d,c.parts[2]=p,c.parts[3]=l,0===c.parts[0]&&0===c.parts[1]&&0===c.parts[2]&&0===c.parts[3])u=!0;else for(s=3;s>=0;s--){var m=0,b=qe(c);if(c=b.quotient,m=b.rem.low)for(o=8;o>=0;o--)n[9*s+o]=m%10,m=Math.floor(m/10)}if(u)e=1,n[a]=0;else for(e=36;!n[a];)e-=1,a+=1;var w=e-1+v;if(w>=34||w<=-7||v>0){if(e>34)return h.push("".concat(0)),v>0?h.push("E+".concat(v)):v<0&&h.push("E".concat(v)),h.join("");for(h.push("".concat(n[a++])),(e-=1)&&h.push("."),r=0;r<e;r++)h.push("".concat(n[a++]));h.push("E"),w>0?h.push("+".concat(w)):h.push("".concat(w))}else if(v>=0)for(r=0;r<e;r++)h.push("".concat(n[a++]));else{var E=e+v;if(E>0)for(r=0;r<E;r++)h.push("".concat(n[a++]));else h.push("0");for(h.push(".");E++<0;)h.push("0");for(r=0;r<e-Math.max(E-1,0);r++)h.push("".concat(n[a++]))}return h.join("")},t.prototype.toJSON=function(){return{$numberDecimal:this.toString()}},t.prototype.toExtendedJSON=function(){return{$numberDecimal:this.toString()}},t.fromExtendedJSON=function(e){return t.fromString(e.$numberDecimal)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new Decimal128("'.concat(this.toString(),'")')},t}();Object.defineProperty(Fe.prototype,"_bsontype",{value:"Decimal128"});var He=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toJSON=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toExtendedJSON=function(t){return t&&(t.legacy||t.relaxed&&isFinite(this.value))?this.value:Object.is(Math.sign(this.value),-0)?{$numberDouble:"-".concat(this.value.toFixed(1))}:{$numberDouble:Number.isInteger(this.value)?this.value.toFixed(1):this.value.toString()}},t.fromExtendedJSON=function(e,n){var r=parseFloat(e.$numberDouble);return n&&n.relaxed?r:new t(r)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){var t=this.toExtendedJSON();return"new Double(".concat(t.$numberDouble,")")},t}();Object.defineProperty(He.prototype,"_bsontype",{value:"Double"});var We=function(){function t(e){if(!(this instanceof t))return new t(e);e instanceof Number&&(e=e.valueOf()),this.value=0|+e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(t){return this.value.toString(t)},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(t){return t&&(t.relaxed||t.legacy)?this.value:{$numberInt:this.value.toString()}},t.fromExtendedJSON=function(e,n){return n&&n.relaxed?parseInt(e.$numberInt,10):new t(e.$numberInt)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new Int32(".concat(this.valueOf(),")")},t}();Object.defineProperty(We.prototype,"_bsontype",{value:"Int32"});var $e=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$maxKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MaxKey()"},t}();Object.defineProperty($e.prototype,"_bsontype",{value:"MaxKey"});var Ge=function(){function t(){if(!(this instanceof t))return new t}return t.prototype.toExtendedJSON=function(){return{$minKey:1}},t.fromExtendedJSON=function(){return new t},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return"new MinKey()"},t}();Object.defineProperty(Ge.prototype,"_bsontype",{value:"MinKey"});var Ke=new RegExp("^[0-9a-fA-F]{24}$"),Je=null,Ye=Symbol("id"),ze=function(){function t(e){if(!(this instanceof t))return new t(e);var n;if("object"==typeof e&&e&&"id"in e){if("string"!=typeof e.id&&!ArrayBuffer.isView(e.id))throw new ie("Argument passed in must have an id that is of type string or Buffer");n="toHexString"in e&&"function"==typeof e.toHexString?te.from(e.toHexString(),"hex"):e.id}else n=e;if(null==n||"number"==typeof n)this[Ye]=t.generate("number"==typeof n?n:void 0);else if(ArrayBuffer.isView(n)&&12===n.byteLength)this[Ye]=n instanceof te?n:le(n);else{if("string"!=typeof n)throw new ie("Argument passed in does not match the accepted types");if(12===n.length){var r=te.from(n);if(12!==r.byteLength)throw new ie("Argument passed in must be a string of 12 bytes");this[Ye]=r}else{if(24!==n.length||!Ke.test(n))throw new ie("Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer");this[Ye]=te.from(n,"hex")}}t.cacheHexString&&(this.__id=this.id.toString("hex"))}return Object.defineProperty(t.prototype,"id",{get:function(){return this[Ye]},set:function(e){this[Ye]=e,t.cacheHexString&&(this.__id=e.toString("hex"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"generationTime",{get:function(){return this.id.readInt32BE(0)},set:function(t){this.id.writeUInt32BE(t,0)},enumerable:!1,configurable:!0}),t.prototype.toHexString=function(){if(t.cacheHexString&&this.__id)return this.__id;var e=this.id.toString("hex");return t.cacheHexString&&!this.__id&&(this.__id=e),e},t.getInc=function(){return t.index=(t.index+1)%16777215},t.generate=function(e){"number"!=typeof e&&(e=Math.floor(Date.now()/1e3));var n=t.getInc(),r=te.alloc(12);return r.writeUInt32BE(e,0),null===Je&&(Je=ue(5)),r[4]=Je[0],r[5]=Je[1],r[6]=Je[2],r[7]=Je[3],r[8]=Je[4],r[11]=255&n,r[10]=n>>8&255,r[9]=n>>16&255,r},t.prototype.toString=function(t){return t?this.id.toString(t):this.toHexString()},t.prototype.toJSON=function(){return this.toHexString()},t.prototype.equals=function(e){if(null==e)return!1;if(e instanceof t)return this[Ye][11]===e[Ye][11]&&this[Ye].equals(e[Ye]);if("string"==typeof e&&t.isValid(e)&&12===e.length&&ce(this.id))return e===te.prototype.toString.call(this.id,"latin1");if("string"==typeof e&&t.isValid(e)&&24===e.length)return e.toLowerCase()===this.toHexString();if("string"==typeof e&&t.isValid(e)&&12===e.length)return te.from(e).equals(this.id);if("object"==typeof e&&"toHexString"in e&&"function"==typeof e.toHexString){var n=e.toHexString(),r=this.toHexString().toLowerCase();return"string"==typeof n&&n.toLowerCase()===r}return!1},t.prototype.getTimestamp=function(){var t=new Date,e=this.id.readUInt32BE(0);return t.setTime(1e3*Math.floor(e)),t},t.createPk=function(){return new t},t.createFromTime=function(e){var n=te.from([0,0,0,0,0,0,0,0,0,0,0,0]);return n.writeUInt32BE(e,0),new t(n)},t.createFromHexString=function(e){if(void 0===e||null!=e&&24!==e.length)throw new ie("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");return new t(te.from(e,"hex"))},t.isValid=function(e){if(null==e)return!1;try{return new t(e),!0}catch(t){return!1}},t.prototype.toExtendedJSON=function(){return this.toHexString?{$oid:this.toHexString()}:{$oid:this.toString("hex")}},t.fromExtendedJSON=function(e){return new t(e.$oid)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t.prototype.inspect=function(){return'new ObjectId("'.concat(this.toHexString(),'")')},t.index=Math.floor(16777215*Math.random()),t}();Object.defineProperty(ze.prototype,"generate",{value:fe((function(t){return ze.generate(t)}),"Please use the static `ObjectId.generate(time)` instead")}),Object.defineProperty(ze.prototype,"getInc",{value:fe((function(){return ze.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ze.prototype,"get_inc",{value:fe((function(){return ze.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ze,"get_inc",{value:fe((function(){return ze.getInc()}),"Please use the static `ObjectId.getInc()` instead")}),Object.defineProperty(ze.prototype,"_bsontype",{value:"ObjectID"});var Ze=function(){function t(e,n){if(!(this instanceof t))return new t(e,n);if(this.pattern=e,this.options=(null!=n?n:"").split("").sort().join(""),-1!==this.pattern.indexOf("\0"))throw new re("BSON Regex patterns cannot contain null bytes, found: ".concat(JSON.stringify(this.pattern)));if(-1!==this.options.indexOf("\0"))throw new re("BSON Regex options cannot contain null bytes, found: ".concat(JSON.stringify(this.options)));for(var r=0;r<this.options.length;r++)if("i"!==this.options[r]&&"m"!==this.options[r]&&"x"!==this.options[r]&&"l"!==this.options[r]&&"s"!==this.options[r]&&"u"!==this.options[r])throw new re("The regular expression option [".concat(this.options[r],"] is not supported"))}return t.parseOptions=function(t){return t?t.split("").sort().join(""):""},t.prototype.toExtendedJSON=function(t){return(t=t||{}).legacy?{$regex:this.pattern,$options:this.options}:{$regularExpression:{pattern:this.pattern,options:this.options}}},t.fromExtendedJSON=function(e){if("$regex"in e){if("string"==typeof e.$regex)return new t(e.$regex,t.parseOptions(e.$options));if("BSONRegExp"===e.$regex._bsontype)return e}if("$regularExpression"in e)return new t(e.$regularExpression.pattern,t.parseOptions(e.$regularExpression.options));throw new ie("Unexpected BSONRegExp EJSON object form: ".concat(JSON.stringify(e)))},t}();Object.defineProperty(Ze.prototype,"_bsontype",{value:"BSONRegExp"});var Qe=function(){function t(e){if(!(this instanceof t))return new t(e);this.value=e}return t.prototype.valueOf=function(){return this.value},t.prototype.toString=function(){return this.value},t.prototype.inspect=function(){return'new BSONSymbol("'.concat(this.value,'")')},t.prototype.toJSON=function(){return this.value},t.prototype.toExtendedJSON=function(){return{$symbol:this.value}},t.fromExtendedJSON=function(e){return new t(e.$symbol)},t.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},t}();Object.defineProperty(Qe.prototype,"_bsontype",{value:"Symbol"});var Xe=function(t){function e(n,r){var i=this;return i instanceof e?(i=Ne.isLong(n)?t.call(this,n.low,n.high,!0)||this:he(n)&&void 0!==n.t&&void 0!==n.i?t.call(this,n.i,n.t,!0)||this:t.call(this,n,r,!0)||this,Object.defineProperty(i,"_bsontype",{value:"Timestamp",writable:!1,configurable:!1,enumerable:!1}),i):new e(n,r)}return ne(e,t),e.prototype.toJSON=function(){return{$timestamp:this.toString()}},e.fromInt=function(t){return new e(Ne.fromInt(t,!0))},e.fromNumber=function(t){return new e(Ne.fromNumber(t,!0))},e.fromBits=function(t,n){return new e(t,n)},e.fromString=function(t,n){return new e(Ne.fromString(t,!0,n))},e.prototype.toExtendedJSON=function(){return{$timestamp:{t:this.high>>>0,i:this.low>>>0}}},e.fromExtendedJSON=function(t){return new e(t.$timestamp)},e.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return this.inspect()},e.prototype.inspect=function(){return"new Timestamp({ t: ".concat(this.getHighBits(),", i: ").concat(this.getLowBits()," })")},e.MAX_VALUE=Ne.MAX_UNSIGNED_VALUE,e}(Ne);var tn=2147483647,en=-2147483648,nn=0x8000000000000000,rn=-0x8000000000000000,on={$oid:ze,$binary:be,$uuid:be,$symbol:Qe,$numberInt:We,$numberDecimal:Fe,$numberDouble:He,$numberLong:Ne,$minKey:Ge,$maxKey:$e,$regex:Ze,$regularExpression:Ze,$timestamp:Xe};function sn(t,e){if(void 0===e&&(e={}),"number"==typeof t){if(e.relaxed||e.legacy)return t;if(Math.floor(t)===t){if(t>=en&&t<=tn)return new We(t);if(t>=rn&&t<=nn)return Ne.fromNumber(t)}return new He(t)}if(null==t||"object"!=typeof t)return t;if(t.$undefined)return null;for(var n=Object.keys(t).filter((function(e){return e.startsWith("$")&&null!=t[e]})),r=0;r<n.length;r++){var i=on[n[r]];if(i)return i.fromExtendedJSON(t,e)}if(null!=t.$date){var o=t.$date,s=new Date;return e.legacy?"number"==typeof o?s.setTime(o):"string"==typeof o&&s.setTime(Date.parse(o)):"string"==typeof o?s.setTime(Date.parse(o)):Ne.isLong(o)?s.setTime(o.toNumber()):"number"==typeof o&&e.relaxed&&s.setTime(o),s}if(null!=t.$code){var a=Object.assign({},t);return t.$scope&&(a.$scope=sn(t.$scope)),Ee.fromExtendedJSON(t)}if(function(t){return he(t)&&null!=t.$id&&"string"==typeof t.$ref&&(null==t.$db||"string"==typeof t.$db)}(t)||t.$dbPointer){var u=t.$ref?t:t.$dbPointer;if(u instanceof _e)return u;var c=Object.keys(u).filter((function(t){return t.startsWith("$")})),h=!0;if(c.forEach((function(t){-1===["$ref","$id","$db"].indexOf(t)&&(h=!1)})),h)return _e.fromExtendedJSON(u)}return t}function an(t){var e=t.toISOString();return 0!==t.getUTCMilliseconds()?e:e.slice(0,-5)+"Z"}function un(t,e){if(("object"==typeof t||"function"==typeof t)&&null!==t){var n=e.seenObjects.findIndex((function(e){return e.obj===t}));if(-1!==n){var r=e.seenObjects.map((function(t){return t.propertyName})),i=r.slice(0,n).map((function(t){return"".concat(t," -> ")})).join(""),o=r[n],s=" -> "+r.slice(n+1,r.length-1).map((function(t){return"".concat(t," -> ")})).join(""),a=r[r.length-1],u=" ".repeat(i.length+o.length/2),c="-".repeat(s.length+(o.length+a.length)/2-1);throw new ie("Converting circular structure to EJSON:\n"+" ".concat(i).concat(o).concat(s).concat(a,"\n")+" ".concat(u,"\\").concat(c,"/"))}e.seenObjects[e.seenObjects.length-1].obj=t}if(Array.isArray(t))return function(t,e){return t.map((function(t,n){e.seenObjects.push({propertyName:"index ".concat(n),obj:null});try{return un(t,e)}finally{e.seenObjects.pop()}}))}(t,e);if(void 0===t)return null;if(t instanceof Date||he(l=t)&&"[object Date]"===Object.prototype.toString.call(l)){var h=t.getTime(),f=h>-1&&h<2534023188e5;return e.legacy?e.relaxed&&f?{$date:t.getTime()}:{$date:an(t)}:e.relaxed&&f?{$date:an(t)}:{$date:{$numberLong:t.getTime().toString()}}}var l;if(!("number"!=typeof t||e.relaxed&&isFinite(t))){if(Math.floor(t)===t){var p=t>=rn&&t<=nn;if(t>=en&&t<=tn)return{$numberInt:t.toString()};if(p)return{$numberLong:t.toString()}}return{$numberDouble:t.toString()}}if(t instanceof RegExp||function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}(t)){var d=t.flags;if(void 0===d){var y=t.toString().match(/[gimuy]*$/);y&&(d=y[0])}return new Ze(t.source,d).toExtendedJSON(e)}return null!=t&&"object"==typeof t?function(t,e){if(null==t||"object"!=typeof t)throw new re("not an object instance");var n=t._bsontype;if(void 0===n){var r={};for(var i in t){e.seenObjects.push({propertyName:i,obj:null});try{var o=un(t[i],e);"__proto__"===i?Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0}):r[i]=o}finally{e.seenObjects.pop()}}return r}if(function(t){return he(t)&&Reflect.has(t,"_bsontype")&&"string"==typeof t._bsontype}(t)){var s=t;if("function"!=typeof s.toExtendedJSON){var a=hn[t._bsontype];if(!a)throw new ie("Unrecognized or invalid _bsontype: "+t._bsontype);s=a(s)}return"Code"===n&&s.scope?s=new Ee(s.code,un(s.scope,e)):"DBRef"===n&&s.oid&&(s=new _e(un(s.collection,e),un(s.oid,e),un(s.db,e),un(s.fields,e))),s.toExtendedJSON(e)}throw new re("_bsontype must be a string, but was: "+typeof n)}(t,e):t}var cn,hn={Binary:function(t){return new be(t.value(),t.sub_type)},Code:function(t){return new Ee(t.code,t.scope)},DBRef:function(t){return new _e(t.collection||t.namespace,t.oid,t.db,t.fields)},Decimal128:function(t){return new Fe(t.bytes)},Double:function(t){return new He(t.value)},Int32:function(t){return new We(t.value)},Long:function(t){return Ne.fromBits(null!=t.low?t.low:t.low_,null!=t.low?t.high:t.high_,null!=t.low?t.unsigned:t.unsigned_)},MaxKey:function(){return new $e},MinKey:function(){return new Ge},ObjectID:function(t){return new ze(t)},ObjectId:function(t){return new ze(t)},BSONRegExp:function(t){return new Ze(t.pattern,t.options)},Symbol:function(t){return new Qe(t.value)},Timestamp:function(t){return Xe.fromBits(t.low,t.high)}};!function(t){function e(t,e){var n=Object.assign({},{relaxed:!0,legacy:!1},e);return"boolean"==typeof n.relaxed&&(n.strict=!n.relaxed),"boolean"==typeof n.strict&&(n.relaxed=!n.strict),JSON.parse(t,(function(t,e){if(-1!==t.indexOf("\0"))throw new re("BSON Document field names cannot contain null bytes, found: ".concat(JSON.stringify(t)));return sn(e,n)}))}function n(t,e,n,r){null!=n&&"object"==typeof n&&(r=n,n=0),null==e||"object"!=typeof e||Array.isArray(e)||(r=e,e=void 0,n=0);var i=un(t,Object.assign({relaxed:!0,legacy:!1},r,{seenObjects:[{propertyName:"(root)",obj:null}]}));return JSON.stringify(i,e,n)}t.parse=e,t.stringify=n,t.serialize=function(t,e){return e=e||{},JSON.parse(n(t,e))},t.deserialize=function(t,n){return n=n||{},e(JSON.stringify(t),n)}}(cn||(cn={}));var fn=se();fn.Map?fn.Map:function(){function t(t){void 0===t&&(t=[]),this._keys=[],this._values={};for(var e=0;e<t.length;e++)if(null!=t[e]){var n=t[e],r=n[0],i=n[1];this._keys.push(r),this._values[r]={v:i,i:this._keys.length-1}}}t.prototype.clear=function(){this._keys=[],this._values={}},t.prototype.delete=function(t){var e=this._values[t];return null!=e&&(delete this._values[t],this._keys.splice(e.i,1),!0)},t.prototype.entries=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?[n,t._values[n].v]:void 0,done:void 0===n}}}},t.prototype.forEach=function(t,e){e=e||this;for(var n=0;n<this._keys.length;n++){var r=this._keys[n];t.call(e,this._values[r].v,r,e)}},t.prototype.get=function(t){return this._values[t]?this._values[t].v:void 0},t.prototype.has=function(t){return null!=this._values[t]},t.prototype.keys=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?n:void 0,done:void 0===n}}}},t.prototype.set=function(t,e){return this._values[t]?(this._values[t].v=e,this):(this._keys.push(t),this._values[t]={v:e,i:this._keys.length-1},this)},t.prototype.values=function(){var t=this,e=0;return{next:function(){var n=t._keys[e++];return{value:void 0!==n?t._values[n].v:void 0,done:void 0===n}}}},Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!1,configurable:!0})}(),Ne.fromNumber(ve),Ne.fromNumber(me),new Set(["$db","$ref","$id","$clusterTime"]);var ln=new Uint8Array(8);new DataView(ln.buffer,ln.byteOffset,ln.byteLength);te.alloc(17825792);var pn=function(){function t(t,e){this._stages=[],t&&e&&(this._db=t,this._request=new Un.reqClass(this._db.config),this._collectionName=e)}return t.prototype.end=function(){return t=this,e=void 0,r=function(){var t;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(e){switch(e.label){case 0:if(!this._collectionName||!this._db)throw new Error("Aggregation pipeline cannot send request");return[4,this._request.send("database.aggregate",{collectionName:this._collectionName,stages:this._stages})];case 1:return(t=e.sent())&&t.data&&t.data.list?[2,{requestId:t.requestId,data:JSON.parse(t.data.list).map(cn.parse)}]:[2,t]}}))},new((n=void 0)||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}));var t,e,n,r},t.prototype.unwrap=function(){return this._stages},t.prototype.done=function(){return this._stages.map((function(t){var e,n=t.stageKey,r=t.stageValue;return(e={})[n]=JSON.parse(r),e}))},t.prototype._pipe=function(t,e){return this._stages.push({stageKey:"$"+t,stageValue:JSON.stringify(e)}),this},t.prototype.addFields=function(t){return this._pipe("addFields",t)},t.prototype.bucket=function(t){return this._pipe("bucket",t)},t.prototype.bucketAuto=function(t){return this._pipe("bucketAuto",t)},t.prototype.count=function(t){return this._pipe("count",t)},t.prototype.geoNear=function(t){return t.query&&(t.query=Bt.encode(t.query)),t.distanceMultiplier&&"number"==typeof t.distanceMultiplier&&(t.distanceMultiplier=t.distanceMultiplier),t.near&&(t.near=new it(t.near.longitude,t.near.latitude).toJSON()),this._pipe("geoNear",t)},t.prototype.group=function(t){return this._pipe("group",t)},t.prototype.limit=function(t){return this._pipe("limit",t)},t.prototype.match=function(t){return this._pipe("match",Bt.encode(t))},t.prototype.project=function(t){return this._pipe("project",t)},t.prototype.lookup=function(t){return this._pipe("lookup",t)},t.prototype.replaceRoot=function(t){return this._pipe("replaceRoot",t)},t.prototype.sample=function(t){return this._pipe("sample",t)},t.prototype.skip=function(t){return this._pipe("skip",t)},t.prototype.sort=function(t){return this._pipe("sort",t)},t.prototype.sortByCount=function(t){return this._pipe("sortByCount",t)},t.prototype.unwind=function(t){return this._pipe("unwind",t)},t}(),dn=pn,yn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),gn=function(t){function e(e,n){return t.call(this,e,n)||this}return yn(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new jt(this._db,this._coll,t)},e.prototype.add=function(t,e){return new jt(this._db,this._coll,void 0).create(t,e)},e.prototype.aggregate=function(){return new dn(this._db,this._coll)},e}(qt),vn={eq:function(t){return new pt(ft.EQ,[t])},neq:function(t){return new pt(ft.NEQ,[t])},lt:function(t){return new pt(ft.LT,[t])},lte:function(t){return new pt(ft.LTE,[t])},gt:function(t){return new pt(ft.GT,[t])},gte:function(t){return new pt(ft.GTE,[t])},in:function(t){return new pt(ft.IN,t)},nin:function(t){return new pt(ft.NIN,t)},all:function(t){return new pt(ft.ALL,t)},elemMatch:function(t){return new pt(ft.ELEM_MATCH,[t])},exists:function(t){return new pt(ft.EXISTS,[t])},size:function(t){return new pt(ft.SIZE,[t])},mod:function(t){return new pt(ft.MOD,[t])},geoNear:function(t){return new pt(ft.GEO_NEAR,[t])},geoWithin:function(t){return new pt(ft.GEO_WITHIN,[t])},geoIntersects:function(t){return new pt(ft.GEO_INTERSECTS,[t])},and:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.AND,n)},nor:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.NOR,n)},or:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.OR,n)},not:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new ct(st.NOT,n)},set:function(t){return new at(tt.SET,[t])},remove:function(){return new at(tt.REMOVE,[])},inc:function(t){return new at(tt.INC,[t])},mul:function(t){return new at(tt.MUL,[t])},push:function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(k(e[0])&&e[0].hasOwnProperty("each")){var r=e[0];t={$each:r.each,$position:r.position,$sort:r.sort,$slice:r.slice}}else t=q(e[0])?e[0]:Array.from(e);return new at(tt.PUSH,t)},pull:function(t){return new at(tt.PULL,t)},pullAll:function(t){return new at(tt.PULL_ALL,t)},pop:function(){return new at(tt.POP,[])},shift:function(){return new at(tt.SHIFT,[])},unshift:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=q(arguments[0])?arguments[0]:Array.from(arguments);return new at(tt.UNSHIFT,n)},addToSet:function(t){return new at(tt.ADD_TO_SET,t)},rename:function(t){return new at(tt.RENAME,[t])},bit:function(t){return new at(tt.BIT,[t])},max:function(t){return new at(tt.MAX,[t])},min:function(t){return new at(tt.MIN,[t])},expr:function(t){return{$expr:t}},jsonSchema:function(t){return{$jsonSchema:t}},text:function(t){return"string"===B(t)?{$search:t.search}:{$search:t.search,$language:t.language,$caseSensitive:t.caseSensitive,$diacriticSensitive:t.diacriticSensitive}},aggregate:{pipeline:function(){return new dn},abs:function(t){return new mn("abs",t)},add:function(t){return new mn("add",t)},ceil:function(t){return new mn("ceil",t)},divide:function(t){return new mn("divide",t)},exp:function(t){return new mn("exp",t)},floor:function(t){return new mn("floor",t)},ln:function(t){return new mn("ln",t)},log:function(t){return new mn("log",t)},log10:function(t){return new mn("log10",t)},mod:function(t){return new mn("mod",t)},multiply:function(t){return new mn("multiply",t)},pow:function(t){return new mn("pow",t)},sqrt:function(t){return new mn("sqrt",t)},subtract:function(t){return new mn("subtract",t)},trunc:function(t){return new mn("trunc",t)},arrayElemAt:function(t){return new mn("arrayElemAt",t)},arrayToObject:function(t){return new mn("arrayToObject",t)},concatArrays:function(t){return new mn("concatArrays",t)},filter:function(t){return new mn("filter",t)},in:function(t){return new mn("in",t)},indexOfArray:function(t){return new mn("indexOfArray",t)},isArray:function(t){return new mn("isArray",t)},map:function(t){return new mn("map",t)},range:function(t){return new mn("range",t)},reduce:function(t){return new mn("reduce",t)},reverseArray:function(t){return new mn("reverseArray",t)},size:function(t){return new mn("size",t)},slice:function(t){return new mn("slice",t)},zip:function(t){return new mn("zip",t)},and:function(t){return new mn("and",t)},not:function(t){return new mn("not",t)},or:function(t){return new mn("or",t)},cmp:function(t){return new mn("cmp",t)},eq:function(t){return new mn("eq",t)},gt:function(t){return new mn("gt",t)},gte:function(t){return new mn("gte",t)},lt:function(t){return new mn("lt",t)},lte:function(t){return new mn("lte",t)},neq:function(t){return new mn("ne",t)},cond:function(t){return new mn("cond",t)},ifNull:function(t){return new mn("ifNull",t)},switch:function(t){return new mn("switch",t)},dateFromParts:function(t){return new mn("dateFromParts",t)},dateFromString:function(t){return new mn("dateFromString",t)},dayOfMonth:function(t){return new mn("dayOfMonth",t)},dayOfWeek:function(t){return new mn("dayOfWeek",t)},dayOfYear:function(t){return new mn("dayOfYear",t)},isoDayOfWeek:function(t){return new mn("isoDayOfWeek",t)},isoWeek:function(t){return new mn("isoWeek",t)},isoWeekYear:function(t){return new mn("isoWeekYear",t)},millisecond:function(t){return new mn("millisecond",t)},minute:function(t){return new mn("minute",t)},month:function(t){return new mn("month",t)},second:function(t){return new mn("second",t)},hour:function(t){return new mn("hour",t)},week:function(t){return new mn("week",t)},year:function(t){return new mn("year",t)},literal:function(t){return new mn("literal",t)},mergeObjects:function(t){return new mn("mergeObjects",t)},objectToArray:function(t){return new mn("objectToArray",t)},allElementsTrue:function(t){return new mn("allElementsTrue",t)},anyElementTrue:function(t){return new mn("anyElementTrue",t)},setDifference:function(t){return new mn("setDifference",t)},setEquals:function(t){return new mn("setEquals",t)},setIntersection:function(t){return new mn("setIntersection",t)},setIsSubset:function(t){return new mn("setIsSubset",t)},setUnion:function(t){return new mn("setUnion",t)},concat:function(t){return new mn("concat",t)},dateToString:function(t){return new mn("dateToString",t)},indexOfBytes:function(t){return new mn("indexOfBytes",t)},indexOfCP:function(t){return new mn("indexOfCP",t)},split:function(t){return new mn("split",t)},strLenBytes:function(t){return new mn("strLenBytes",t)},strLenCP:function(t){return new mn("strLenCP",t)},strcasecmp:function(t){return new mn("strcasecmp",t)},substr:function(t){return new mn("substr",t)},substrBytes:function(t){return new mn("substrBytes",t)},substrCP:function(t){return new mn("substrCP",t)},toLower:function(t){return new mn("toLower",t)},toUpper:function(t){return new mn("toUpper",t)},meta:function(t){return new mn("meta",t)},addToSet:function(t){return new mn("addToSet",t)},avg:function(t){return new mn("avg",t)},first:function(t){return new mn("first",t)},last:function(t){return new mn("last",t)},max:function(t){return new mn("max",t)},min:function(t){return new mn("min",t)},push:function(t){return new mn("push",t)},stdDevPop:function(t){return new mn("stdDevPop",t)},stdDevSamp:function(t){return new mn("stdDevSamp",t)},sum:function(t){return new mn("sum",t)},let:function(t){return new mn("let",t)}},project:{slice:function(t){return new bn("slice",t)},elemMatch:function(t){return new bn("elemMatch",t)}}},mn=function(t,e){this["$"+t]=e},bn=function(t,e){this["$"+t]=e},wn=function(){function t(t){var e=t.regexp,n=t.options;if(!e)throw new TypeError("regexp must be a string");this.$regex=e,this.$options=n}return t.prototype.parse=function(){return{$regex:this.$regex,$options:this.$options}},Object.defineProperty(t.prototype,"_internalType",{get:function(){return j},enumerable:!0,configurable:!0}),t}();function En(t){return new wn(t)}var _n={CREATE_WATCH_NET_ERROR:{code:"CREATE_WATCH_NET_ERROR",message:"create watch network error"},CREATE_WACTH_EXCEED_ERROR:{code:"CREATE_WACTH_EXCEED_ERROR",message:"maximum connections exceed"},CREATE_WATCH_SERVER_ERROR:{code:"CREATE_WATCH_SERVER_ERROR",message:"create watch server error"},CONN_ERROR:{code:"CONN_ERROR",message:"connection error"},INVALID_PARAM:{code:"INVALID_PARAM",message:"Invalid request param"},INSERT_DOC_FAIL:{code:"INSERT_DOC_FAIL",message:"insert document failed"},DATABASE_TRANSACTION_CONFLICT:{code:"DATABASE_TRANSACTION_CONFLICT",message:"database transaction conflict"}},Sn=function(){return Sn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Sn.apply(this,arguments)},In=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Tn=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},On="database.updateDocInTransaction",An=function(){function t(t,e,n){this._coll=e,this.id=n,this._transaction=t,this._request=this._transaction.getRequestMethod(),this._transactionId=this._transaction.getTransactionId()}return t.prototype.create=function(t){return In(this,void 0,void 0,(function(){var e,n,r,i;return Tn(this,(function(o){switch(o.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,data:cn.stringify(_t(t),{relaxed:!1})},this.id&&(e._id=this.id),[4,this._request.send("database.insertDocInTransaction",e)];case 1:if((n=o.sent()).code)throw n;if(r=cn.parse(n.inserted),1==(i=cn.parse(n.ok))&&1==r)return[2,Sn(Sn({},n),{ok:i,inserted:r})];throw new Error(_n.INSERT_DOC_FAIL.message)}}))}))},t.prototype.get=function(){return In(this,void 0,void 0,(function(){var t,e;return Tn(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.getInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,{data:"null"!==e.data?nt.formatField(cn.parse(e.data)):cn.parse(e.data),requestId:e.requestId}]}}))}))},t.prototype.set=function(t){return In(this,void 0,void 0,(function(){var e,n;return Tn(this,(function(r){switch(r.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:cn.stringify(_t(t),{relaxed:!1}),upsert:!0},[4,this._request.send(On,e)];case 1:if((n=r.sent()).code)throw n;return[2,Sn(Sn({},n),{updated:cn.parse(n.updated),upserted:n.upserted?JSON.parse(n.upserted):null})]}}))}))},t.prototype.update=function(t){return In(this,void 0,void 0,(function(){var e,n;return Tn(this,(function(r){switch(r.label){case 0:return e={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}},data:cn.stringify(Pt.encode(t),{relaxed:!1})},[4,this._request.send(On,e)];case 1:if((n=r.sent()).code)throw n;return[2,Sn(Sn({},n),{updated:cn.parse(n.updated)})]}}))}))},t.prototype.delete=function(){return In(this,void 0,void 0,(function(){var t,e;return Tn(this,(function(n){switch(n.label){case 0:return t={collectionName:this._coll,transactionId:this._transactionId,query:{_id:{$eq:this.id}}},[4,this._request.send("database.deleteDocInTransaction",t)];case 1:if((e=n.sent()).code)throw e;return[2,Sn(Sn({},e),{deleted:cn.parse(e.deleted)})]}}))}))},t}(),Rn=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Nn=function(t){function e(e,n){return t.call(this,e,n)||this}return Rn(e,t),Object.defineProperty(e.prototype,"name",{get:function(){return this._coll},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if("string"!=typeof t&&"number"!=typeof t)throw new Error("docId必须为字符串或数字");return new An(this._transaction,this._coll,t)},e.prototype.add=function(t){var e;return void 0!==t._id&&(e=t._id),new An(this._transaction,this._coll,e).create(t)},e}((function(t,e){this._coll=e,this._transaction=t})),xn=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},Cn=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},Pn=function(){function t(t){this._db=t,this._request=new Un.reqClass(this._db.config),this.aborted=!1,this.commited=!1,this.inited=!1}return t.prototype.init=function(){return xn(this,void 0,void 0,(function(){var t;return Cn(this,(function(e){switch(e.label){case 0:return[4,this._request.send("database.startTransaction")];case 1:if((t=e.sent()).code)throw t;return this.inited=!0,this._id=t.transactionId,[2]}}))}))},t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new Nn(this,t)},t.prototype.getTransactionId=function(){return this._id},t.prototype.getRequestMethod=function(){return this._request},t.prototype.commit=function(){return xn(this,void 0,void 0,(function(){var t,e;return Cn(this,(function(n){switch(n.label){case 0:return t={transactionId:this._id},[4,this._request.send("database.commitTransaction",t)];case 1:if((e=n.sent()).code)throw e;return this.commited=!0,[2,e]}}))}))},t.prototype.rollback=function(t){return xn(this,void 0,void 0,(function(){var e,n;return Cn(this,(function(r){switch(r.label){case 0:return e={transactionId:this._id},[4,this._request.send("database.abortTransaction",e)];case 1:if((n=r.sent()).code)throw n;return this.aborted=!0,this.abortReason=t,[2,n]}}))}))},t}();function Dn(){return xn(this,void 0,void 0,(function(){var t;return Cn(this,(function(e){switch(e.label){case 0:return[4,(t=new Pn(this)).init()];case 1:return e.sent(),[2,t]}}))}))}function Ln(t,e){return void 0===e&&(e=3),xn(this,void 0,void 0,(function(){var n,r,i,o,s=this;return Cn(this,(function(a){switch(a.label){case 0:return a.trys.push([0,4,,10]),[4,(n=new Pn(this)).init()];case 1:return a.sent(),[4,t(n)];case 2:if(r=a.sent(),!0===n.aborted)throw n.abortReason;return[4,n.commit()];case 3:return a.sent(),[2,r];case 4:if(i=a.sent(),!1===n.inited)throw i;return o=function(t){return xn(s,void 0,void 0,(function(){return Cn(this,(function(e){switch(e.label){case 0:if(n.aborted||n.commited)return[3,5];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,n.rollback()];case 2:case 3:return e.sent(),[3,4];case 4:throw t;case 5:if(!0===n.aborted)throw n.abortReason;throw t}}))}))},e<=0?[4,o(i)]:[3,6];case 5:a.sent(),a.label=6;case 6:return i&&i.code===_n.DATABASE_TRANSACTION_CONFLICT.code?[4,Ln.bind(this)(t,--e)]:[3,8];case 7:return[2,a.sent()];case 8:return[4,o(i)];case 9:return a.sent(),[3,10];case 10:return[2]}}))}))}var Un=function(){function t(t){this.config=t,this.Geo=o,this.serverDate=X,this.command=vn,this.RegExp=En,this.startTransaction=Dn,this.runTransaction=Ln,this.logicCommand=ct,this.updateCommand=at,this.queryCommand=pt}return t.prototype.collection=function(t){if(!t)throw new Error("Collection name is required");return new gn(this,t)},t.prototype.createCollection=function(e){var n={collectionName:e};return new t.reqClass(this.config).send("database.addCollection",n)},t}(),jn=function(){return jn=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},jn.apply(this,arguments)},Bn={name:"database",entity:{database:function(t){var e=this.platform,n=e.adapter,r=e.runtime;return Un.reqClass=this.request.constructor,Un.getAccessToken=this.authInstance?this.authInstance.getAccessToken.bind(this.authInstance):function(){return""},Un.runtime=r,this.wsClientClass&&(Un.wsClass=n.wsClass,Un.wsClientClass=this.wsClientClass),Un.ws||(Un.ws=null),new Un(jn(jn(jn({},this.config),{_fromApp:this}),t))}}};try{cloudbase.registerComponent(Bn)}catch(t){}function kn(t){try{t.registerComponent(Bn)}catch(t){console.warn(t)}}},338:function(t,e,n){"use strict";n.r(e),n.d(e,{registerFunctions:function(){return p}});var r=n(142),i=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},o=r._G.eX,s=r._G.Sg,a=r._G.vM,u=r.P6.Gc,c=r.BM.D,h="functions",f=new(function(){function t(){}return t.prototype.callFunction=function(t,e){return n=this,r=void 0,a=function(){var n,r,i,a,c,f,l,p,d,y,g,v;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(m){switch(m.label){case 0:if(n=t.name,r=t.data,i=t.query,a=t.parse,c=t.search,!n)throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(h,".callFunction] invalid function name")}));try{f=r?JSON.stringify(r):""}catch(t){throw new Error(JSON.stringify({code:s.INVALID_PARAMS,msg:"[".concat(h,".callFunction] invalid data")}))}l="functions.invokeFunction",p={inQuery:i,parse:a,search:c,function_name:n,request_data:f},d=this.request,m.label=1;case 1:return m.trys.push([1,3,,4]),[4,d.send(l,p)];case 2:if((y=m.sent()).code)return[2,u(e,null,y)];if(g=y.data.response_data,a)return[2,u(e,null,{result:g,requestId:y.requestId})];try{return g=JSON.parse(y.data.response_data),[2,u(e,null,{result:g,requestId:y.requestId})]}catch(t){u(e,new Error("[".concat(o(),"][").concat(s.INVALID_PARAMS,"][").concat(h,".callFunction] response data must be json")))}return[3,4];case 3:return v=m.sent(),u(e,v),[3,4];case 4:return[2]}}))},new((i=void 0)||(i=Promise))((function(t,e){function o(t){try{u(a.next(t))}catch(t){e(t)}}function s(t){try{u(a.throw(t))}catch(t){e(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(t){t(n)}))).then(o,s)}u((a=a.apply(n,r||[])).next())}));var n,r,i,a},function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);o>3&&s&&Object.defineProperty(e,n,s)}([c({customInfo:{className:"Cloudbase",methodName:"callFunction"},title:"函数调用失败",messages:["请确认以下各项:"," 1 - 调用 callFunction() 的语法或参数是否正确"," 2 - 当前环境下是否存在此函数"," 3 - 函数安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(a)]}),i("design:type",Function),i("design:paramtypes",[Object,Function]),i("design:returntype",Promise)],t.prototype,"callFunction",null),t}()),l={name:h,entity:{callFunction:f.callFunction}};try{cloudbase.registerComponent(l)}catch(t){}function p(t){try{t.registerComponent(l)}catch(t){console.warn(t)}}},337:function(t,e,n){"use strict";n.r(e),n.d(e,{registerRealtime:function(){return V}});var r=n(880),i=n.n(r),o=n(373),s=n.n(o),a=n(907),u=n.n(a);function c(t){return void 0===t&&(t=""),"".concat(t?"".concat(t,"_"):"").concat(+new Date,"_").concat(Math.random())}var h,f,l=function(t){this.close=t.close,this.onChange=t.onChange,this.onError=t.onError,t.debug&&Object.defineProperty(this,"virtualClient",{get:function(){return t.virtualClient}})},p=function(t){var e,n,r=t.id,i=t.docChanges,o=t.docs,s=t.msgType,a=t.type;Object.defineProperties(this,{id:{get:function(){return r},enumerable:!0},docChanges:{get:function(){return e||(e=JSON.parse(JSON.stringify(i))),e},enumerable:!0},docs:{get:function(){return n||(n=JSON.parse(JSON.stringify(o))),n},enumerable:!0},msgType:{get:function(){return s},enumerable:!0},type:{get:function(){return a},enumerable:!0}})},d=(h=function(t,e){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},h(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}h(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),y=function(t){function e(e){var n=t.call(this,"Watch Error ".concat(JSON.stringify(e.msgData)," (requestid: ").concat(e.requestId,")"))||this;return n.isRealtimeErrorMessageError=!0,n.payload=e,n}return d(e,t),e}(Error),g=function(t){return null==t?void 0:t.isRealtimeErrorMessageError},v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="timeout",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="cancelled",e.payload=null,e.generic=!0,e}return d(e,t),e}(Error),b=function(t){function e(e){var n=t.call(this,e.errMsg)||this;return n.errCode="UNKNOWN_ERROR",Object.defineProperties(n,{message:{get:function(){return"errCode: ".concat(this.errCode," ").concat(w[this.errCode]||""," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t}}}),n.errCode=e.errCode||"UNKNOWN_ERROR",n.errMsg=e.errMsg,n}return d(e,t),Object.defineProperty(e.prototype,"message",{get:function(){return"errCode: ".concat(this.errCode," | errMsg: ").concat(this.errMsg)},set:function(t){this.errMsg=t},enumerable:!1,configurable:!0}),e}(Error),w={UNKNOWN_ERROR:"UNKNOWN_ERROR",SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL",SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG:"SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG",SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA:"SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR",SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED:"SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED",SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL:"SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL",SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR:"SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR"},E=function(t){return void 0===t&&(t=0),new Promise((function(e){return setTimeout(e,t)}))},_=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},S=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},I=function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};!function(t){t.LOGGINGIN="LOGGINGIN",t.INITING="INITING",t.REBUILDING="REBUILDING",t.ACTIVE="ACTIVE",t.ERRORED="ERRORED",t.CLOSING="CLOSING",t.CLOSED="CLOSED",t.PAUSED="PAUSED",t.RESUMING="RESUMING"}(f||(f={}));var T=function(){function t(t){var e=this;this.watchStatus=f.INITING,this.wsLogin=function(t,n){return _(e,void 0,void 0,(function(){var e;return S(this,(function(r){switch(r.label){case 0:return this.watchStatus=f.LOGGINGIN,[4,this.login(t,n)];case 1:return e=r.sent(),this.envId||(this.envId=e.envId),[2,e]}}))}))},this.initWatch=function(t){return _(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.initWatchPromise&&void 0!==this.initWatchPromise)return[2,this.initWatchPromise];this.initWatchPromise=new Promise((function(e,r){_(n,void 0,void 0,(function(){var n,i,o,s,a,u,h,l,d,y;return S(this,(function(g){switch(g.label){case 0:return g.trys.push([0,3,,4]),this.watchStatus===f.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:return n=g.sent().envId,this.watchStatus===f.PAUSED?(console.log("[realtime] initWatch cancelled on pause"),[2,e()]):(this.watchStatus=f.INITING,i={watchId:this.watchId,requestId:c(),msgType:"INIT_WATCH",msgData:{envId:n,collName:this.collectionName,query:this.query,limit:this.limit,orderBy:this.orderBy}},[4,this.send({msg:i,waitResponse:!0,skipOnMessage:!0,timeout:1e4})]);case 2:if(o=g.sent(),s=o.msgData,a=s.events,u=s.currEvent,this.sessionInfo={queryID:o.msgData.queryID,currentEventId:u-1,currentDocs:[]},a.length>0){for(h=0,l=a;h<l.length;h++)l[h].ID=u;this.handleServerEvents(o)}else this.sessionInfo.currentEventId=u,d=new p({id:u,docChanges:[],docs:[],type:"init"}),this.listener.onChange(d),this.scheduleSendACK();return this.onWatchStart(this,this.sessionInfo.queryID),this.watchStatus=f.ACTIVE,this.availableRetries.INIT_WATCH=2,e(),[3,4];case 3:return y=g.sent(),this.handleWatchEstablishmentError(y,{operationName:"INIT_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.initWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.initWatchPromise=void 0,[7];case 4:return console.log("[realtime] initWatch ".concat(e?"success":"fail")),[2]}}))}))},this.rebuildWatch=function(t){return _(e,void 0,void 0,(function(){var e,n=this;return S(this,(function(r){switch(r.label){case 0:if(null!==this.rebuildWatchPromise&&void 0!==this.rebuildWatchPromise)return[2,this.rebuildWatchPromise];this.rebuildWatchPromise=new Promise((function(e,r){_(n,void 0,void 0,(function(){var n,i,o,s;return S(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),this.watchStatus===f.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):[4,this.wsLogin(this.envId,t)];case 1:if(n=a.sent().envId,!this.sessionInfo)throw new Error("can not rebuildWatch without a successful initWatch (lack of sessionInfo)");return this.watchStatus===f.PAUSED?(console.log("[realtime] rebuildWatch cancelled on pause"),[2,e()]):(this.watchStatus=f.REBUILDING,i={watchId:this.watchId,requestId:c(),msgType:"REBUILD_WATCH",msgData:{envId:n,collName:this.collectionName,queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:i,waitResponse:!0,skipOnMessage:!1,timeout:1e4})]);case 2:return o=a.sent(),this.handleServerEvents(o),this.watchStatus=f.ACTIVE,this.availableRetries.REBUILD_WATCH=2,e(),[3,4];case 3:return s=a.sent(),this.handleWatchEstablishmentError(s,{operationName:"REBUILD_WATCH",resolve:e,reject:r}),[3,4];case 4:return[2]}}))}))})),e=!1,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.rebuildWatchPromise];case 2:return r.sent(),e=!0,[3,4];case 3:return this.rebuildWatchPromise=void 0,[7];case 4:return console.log("[realtime] rebuildWatch ".concat(e?"success":"fail")),[2]}}))}))},this.handleWatchEstablishmentError=function(t,n){return _(e,void 0,void 0,(function(){var e,r,i,o=this;return S(this,(function(s){return e="INIT_WATCH"===n.operationName,r=function(){o.closeWithError(new b({errCode:e?w.SDK_DATABASE_REALTIME_LISTENER_INIT_WATCH_FAIL:w.SDK_DATABASE_REALTIME_LISTENER_REBUILD_WATCH_FAIL,errMsg:t})),n.reject(t)},i=function(t){o.useRetryTicket(n.operationName)?e?(o.initWatchPromise=void 0,n.resolve(o.initWatch(t))):(o.rebuildWatchPromise=void 0,n.resolve(o.rebuildWatch(t))):r()},this.handleCommonError(t,{onSignError:function(){return i(!0)},onTimeoutError:function(){return i(!1)},onNotRetryableError:r,onCancelledError:n.reject,onUnknownError:function(){_(o,void 0,void 0,(function(){var t,e=this;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,8,,9]),t=function(){return _(e,void 0,void 0,(function(){return S(this,(function(t){switch(t.label){case 0:return this.pause(),[4,this.onceWSConnected()];case 1:return t.sent(),i(!0),[2]}}))}))},this.isWSConnected()?[3,2]:[4,t()];case 1:return r.sent(),[3,7];case 2:return[4,E(100)];case 3:return r.sent(),this.watchStatus!==f.PAUSED?[3,4]:(n.reject(new m("".concat(n.operationName," cancelled due to pause after unknownError"))),[3,7]);case 4:return this.isWSConnected()?[3,6]:[4,t()];case 5:return r.sent(),[3,7];case 6:i(!1),r.label=7;case 7:return[3,9];case 8:return r.sent(),i(!0),[3,9];case 9:return[2]}}))}))}}),[2]}))}))},this.closeWatch=function(){return _(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:if(t=this.sessionInfo?this.sessionInfo.queryID:"",this.watchStatus!==f.ACTIVE)return this.watchStatus=f.CLOSED,this.onWatchClose(this,t),[2];r.label=1;case 1:return r.trys.push([1,3,4,5]),this.watchStatus=f.CLOSING,e={watchId:this.watchId,requestId:c(),msgType:"CLOSE_WATCH",msgData:null},[4,this.send({msg:e})];case 2:return r.sent(),this.sessionInfo=void 0,this.watchStatus=f.CLOSED,[3,5];case 3:return n=r.sent(),this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_CLOSE_WATCH_FAIL,errMsg:n})),[3,5];case 4:return this.onWatchClose(this,t),[7];case 5:return[2]}}))}))},this.scheduleSendACK=function(){e.clearACKSchedule(),e.ackTimeoutId=setTimeout((function(){e.waitExpectedTimeoutId?e.scheduleSendACK():e.sendACK()}),1e4)},this.clearACKSchedule=function(){e.ackTimeoutId&&clearTimeout(e.ackTimeoutId)},this.sendACK=function(){return _(e,void 0,void 0,(function(){var t,e,n;return S(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.watchStatus!==f.ACTIVE?(this.scheduleSendACK(),[2]):this.sessionInfo?(t={watchId:this.watchId,requestId:c(),msgType:"CHECK_LAST",msgData:{queryID:this.sessionInfo.queryID,eventID:this.sessionInfo.currentEventId}},[4,this.send({msg:t})]):(console.warn("[realtime listener] can not send ack without a successful initWatch (lack of sessionInfo)"),[2]);case 1:return r.sent(),this.scheduleSendACK(),[3,3];case 2:if(e=r.sent(),g(e))switch((n=e.payload).msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return this.rebuildWatch(),[2];case"QUERYID_INVALID_ERROR":case"SYS_ERR":case"INVALIID_ENV":case"COLLECTION_PERMISSION_DENIED":return this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:n.msgData.code})),[2]}return this.availableRetries.CHECK_LAST&&this.availableRetries.CHECK_LAST>0?(this.availableRetries.CHECK_LAST-=1,this.scheduleSendACK()):this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_CHECK_LAST_FAIL,errMsg:e})),[3,3];case 3:return[2]}}))}))},this.handleCommonError=function(t,e){if(g(t))switch(t.payload.msgData.code){case"CHECK_LOGIN_FAILED":case"SIGN_EXPIRED_ERROR":case"SIGN_INVALID_ERROR":case"SIGN_PARAM_INVALID":return void e.onSignError(t);default:return void e.onNotRetryableError(t)}else{if(function(t){return"timeout"===t.type}(t))return void e.onTimeoutError(t);if(function(t){return"cancelled"===t.type}(t))return void e.onCancelledError(t)}e.onUnknownError(t)},this.watchId="watchid_".concat(+new Date,"_").concat(Math.random()),this.envId=t.envId,this.collectionName=t.collectionName,this.query=t.query,this.limit=t.limit,this.orderBy=t.orderBy,this.send=t.send,this.login=t.login,this.isWSConnected=t.isWSConnected,this.onceWSConnected=t.onceWSConnected,this.getWaitExpectedTimeoutLength=t.getWaitExpectedTimeoutLength,this.onWatchStart=t.onWatchStart,this.onWatchClose=t.onWatchClose,this.debug=t.debug,this.availableRetries={INIT_WATCH:2,REBUILD_WATCH:2,CHECK_LAST:2},this.listener=new l({close:function(){e.closeWatch()},onChange:t.onChange,onError:t.onError,debug:this.debug,virtualClient:this}),this.initWatch()}return t.prototype.onMessage=function(t){var e=this;switch(this.watchStatus){case f.PAUSED:if("ERROR"!==t.msgType)return;break;case f.LOGGINGIN:case f.INITING:case f.REBUILDING:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received while ".concat(this.watchStatus));case f.CLOSED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has closed");case f.ERRORED:return void console.warn("[realtime listener] internal non-fatal error: unexpected message received when the watch has ended with error")}if(this.sessionInfo)switch(this.scheduleSendACK(),t.msgType){case"NEXT_EVENT":console.warn("nextevent ".concat(t.msgData.currEvent," ignored"),t),this.handleServerEvents(t);break;case"CHECK_EVENT":this.sessionInfo.currentEventId<t.msgData.currEvent&&(this.sessionInfo.expectEventId=t.msgData.currEvent,this.clearWaitExpectedEvent(),this.waitExpectedTimeoutId=setTimeout((function(){e.rebuildWatch()}),this.getWaitExpectedTimeoutLength()),console.log("[realtime] waitExpectedTimeoutLength ".concat(this.getWaitExpectedTimeoutLength())));break;case"ERROR":this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_SERVER_ERROR_MSG,errMsg:"".concat(t.msgData.code," - ").concat(t.msgData.message)}));break;default:console.warn("[realtime listener] virtual client receive unexpected msg ".concat(t.msgType,": "),t)}else console.warn("[realtime listener] internal non-fatal error: sessionInfo not found while message is received.")},t.prototype.closeWithError=function(t){var e;this.watchStatus=f.ERRORED,this.clearACKSchedule(),this.listener.onError(t),this.onWatchClose(this,(null===(e=this.sessionInfo)||void 0===e?void 0:e.queryID)||""),console.log("[realtime] client closed (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.pause=function(){this.watchStatus=f.PAUSED,console.log("[realtime] client paused (".concat(this.collectionName," ").concat(this.query,") (watchId ").concat(this.watchId,")"))},t.prototype.resume=function(){return _(this,void 0,void 0,(function(){var t;return S(this,(function(e){switch(e.label){case 0:this.watchStatus=f.RESUMING,console.log("[realtime] client resuming with ".concat(this.sessionInfo?"REBUILD_WATCH":"INIT_WATCH"," (").concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.sessionInfo?this.rebuildWatch():this.initWatch()];case 2:return e.sent(),console.log("[realtime] client successfully resumed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")")),[3,4];case 3:return t=e.sent(),console.error("[realtime] client resume failed (".concat(this.collectionName," ").concat(this.query,") (").concat(this.watchId,")"),t),[3,4];case 4:return[2]}}))}))},t.prototype.useRetryTicket=function(t){return!!(this.availableRetries[t]&&this.availableRetries[t]>0)&&(this.availableRetries[t]-=1,console.log("[realtime] ".concat(t," use a retry ticket, now only ").concat(this.availableRetries[t]," retry left")),!0)},t.prototype.handleServerEvents=function(t){return _(this,void 0,void 0,(function(){var e;return S(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),this.scheduleSendACK(),[4,this.handleServerEventsInternel(t)];case 1:return n.sent(),this.postHandleServerEventsValidityCheck(t),[3,3];case 2:throw e=n.sent(),console.error("[realtime listener] internal non-fatal error: handle server events failed with error: ",e),e;case 3:return[2]}}))}))},t.prototype.handleServerEventsInternel=function(t){return _(this,void 0,void 0,(function(){var e,n,r,o,a,c,h,f,l,d,y,g;return S(this,(function(v){switch(v.label){case 0:if(e=t.requestId,n=t.msgData.events,r=t.msgType,!n.length||!this.sessionInfo)return[2];o=this.sessionInfo;try{a=n.map(O)}catch(t){return this.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_RECEIVE_INVALID_SERVER_DATA,errMsg:t})),[2]}c=I([],o.currentDocs,!0),h=!1,f=function(n,f){var d,y,g,v,m,E,_,T,O,A,R,N;return S(this,(function(S){switch(S.label){case 0:return d=a[n],o.currentEventId>=d.id?(!a[n-1]||d.id>a[n-1].id?console.warn("[realtime] duplicate event received, cur ".concat(o.currentEventId," but got ").concat(d.id)):console.error("[realtime listener] server non-fatal error: events out of order (the latter event's id is smaller than that of the former) (requestId ".concat(e,")")),[2,"continue"]):[3,1];case 1:if(o.currentEventId!==d.id-1)return[3,2];switch(d.dataType){case"update":if(!d.doc)switch(d.queueType){case"update":case"dequeue":if(y=c.find((function(t){return t._id===d.docId})),y){if(g=u()(y),d.updatedFields&&Object.keys(d.updatedFields).forEach((function(t){i()(g,t,d.updatedFields[t])})),d.removedFields)for(v=0,m=d.removedFields;v<m.length;v++)E=m[v],s()(g,E);d.doc=g}else console.error("[realtime listener] internal non-fatal server error: unexpected update dataType event where no doc is associated.");break;case"enqueue":throw T=new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="update" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),l.closeWithError(T),T}break;case"replace":if(!d.doc)throw T=new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="replace" (requestId '.concat(t.requestId,")")}),l.closeWithError(T),T;break;case"remove":(_=c.find((function(t){return t._id===d.docId})))?d.doc=_:console.error("[realtime listener] internal non-fatal server error: unexpected remove event where no doc is associated.");break;case"limit":if(!d.doc)switch(d.queueType){case"dequeue":(_=c.find((function(t){return t._id===d.docId})))?d.doc=_:console.error("[realtime listener] internal non-fatal server error: unexpected limit dataType event where no doc is associated.");break;case"enqueue":throw T=new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_UNEXPECTED_FATAL_ERROR,errMsg:'HandleServerEvents: full doc is not provided with dataType="limit" and queueType="enqueue" (requestId '.concat(t.requestId,")")}),l.closeWithError(T),T}}switch(d.queueType){case"init":h?c.push(d.doc):(h=!0,c=[d.doc]);break;case"enqueue":c.push(d.doc);break;case"dequeue":O=c.findIndex((function(t){return t._id===d.docId})),O>-1?c.splice(O,1):console.error("[realtime listener] internal non-fatal server error: unexpected dequeue event where no doc is associated.");break;case"update":O=c.findIndex((function(t){return t._id===d.docId})),O>-1?c[O]=d.doc:console.error("[realtime listener] internal non-fatal server error: unexpected queueType update event where no doc is associated.")}return(n===f-1||a[n+1]&&a[n+1].id!==d.id)&&(A=I([],c,!0),R=a.slice(0,n+1).filter((function(t){return t.id===d.id})),l.sessionInfo.currentEventId=d.id,l.sessionInfo.currentDocs=c,N=new p({id:d.id,docChanges:R,docs:A,msgType:r}),l.listener.onChange(N)),[3,4];case 2:return console.warn("[realtime listener] event received is out of order, cur ".concat(l.sessionInfo.currentEventId," but got ").concat(d.id)),[4,l.rebuildWatch()];case 3:return S.sent(),[2,{value:void 0}];case 4:return[2]}}))},l=this,d=0,y=a.length,v.label=1;case 1:return d<y?[5,f(d,y)]:[3,4];case 2:if("object"==typeof(g=v.sent()))return[2,g.value];v.label=3;case 3:return d++,[3,1];case 4:return[2]}}))}))},t.prototype.postHandleServerEventsValidityCheck=function(t){this.sessionInfo?(this.sessionInfo.expectEventId&&this.sessionInfo.currentEventId>=this.sessionInfo.expectEventId&&this.clearWaitExpectedEvent(),this.sessionInfo.currentEventId<t.msgData.currEvent&&console.warn("[realtime listener] internal non-fatal error: client eventId does not match with server event id after server event handling")):console.error("[realtime listener] internal non-fatal error: sessionInfo lost after server event handling, this should never occur")},t.prototype.clearWaitExpectedEvent=function(){this.waitExpectedTimeoutId&&(clearTimeout(this.waitExpectedTimeoutId),this.waitExpectedTimeoutId=void 0)},t}();function O(t){var e={id:t.ID,dataType:t.DataType,queueType:t.QueueType,docId:t.DocID,doc:t.Doc&&"{}"!==t.Doc?JSON.parse(t.Doc):void 0};return"update"===t.DataType&&(t.UpdatedFields&&(e.updatedFields=JSON.parse(t.UpdatedFields)),(t.removedFields||t.RemovedFields)&&(e.removedFields=JSON.parse(t.removedFields))),e}var A,R={1e3:{code:1e3,name:"Normal Closure",description:"Normal closure; the connection successfully completed whatever purpose for which it was created."},1001:{code:1001,name:"Going Away",description:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{code:1002,name:"Protocol Error",description:"The endpoint is terminating the connection due to a protocol error."},1003:{code:1003,name:"Unsupported Data",description:"The connection is being terminated because the endpoint received data of a type it cannot accept (for example, a text-only endpoint received binary data)."},1005:{code:1005,name:"No Status Received",description:"Indicates that no status code was provided even though one was expected."},1006:{code:1006,name:"Abnormal Closure",description:"Used to indicate that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{code:1007,name:"Invalid frame payload data",description:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{code:1008,name:"Policy Violation",description:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{code:1009,name:"Message too big",description:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{code:1010,name:"Missing Extension",description:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{code:1011,name:"Internal Error",description:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{code:1012,name:"Service Restart",description:"The server is terminating the connection because it is restarting."},1013:{code:1013,name:"Try Again Later",description:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{code:1014,name:"Bad Gateway",description:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{code:1015,name:"TLS Handshake",description:"Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},3e3:{code:3e3,name:"Reconnect WebSocket",description:"The client is terminating the connection because it wants to reconnect"},3001:{code:3001,name:"No Realtime Listeners",description:"The client is terminating the connection because no more realtime listeners exist"},3002:{code:3002,name:"Heartbeat Ping Error",description:"The client is terminating the connection due to its failure in sending heartbeat messages"},3003:{code:3003,name:"Heartbeat Pong Timeout Error",description:"The client is terminating the connection because no heartbeat response is received from the server"},3050:{code:3050,name:"Server Close",description:"The client is terminating the connection because no heartbeat response is received from the server"}};!function(t){t[t.NormalClosure=1e3]="NormalClosure",t[t.GoingAway=1001]="GoingAway",t[t.ProtocolError=1002]="ProtocolError",t[t.UnsupportedData=1003]="UnsupportedData",t[t.NoStatusReceived=1005]="NoStatusReceived",t[t.AbnormalClosure=1006]="AbnormalClosure",t[t.InvalidFramePayloadData=1007]="InvalidFramePayloadData",t[t.PolicyViolation=1008]="PolicyViolation",t[t.MessageTooBig=1009]="MessageTooBig",t[t.MissingExtension=1010]="MissingExtension",t[t.InternalError=1011]="InternalError",t[t.ServiceRestart=1012]="ServiceRestart",t[t.TryAgainLater=1013]="TryAgainLater",t[t.BadGateway=1014]="BadGateway",t[t.TLSHandshake=1015]="TLSHandshake",t[t.ReconnectWebSocket=3e3]="ReconnectWebSocket",t[t.NoRealtimeListeners=3001]="NoRealtimeListeners",t[t.HeartbeatPingError=3002]="HeartbeatPingError",t[t.HeartbeatPongTimeoutError=3003]="HeartbeatPongTimeoutError",t[t.NoAuthentication=3050]="NoAuthentication"}(A||(A={}));var N=function(t,e){var n=R[t],r=n?"".concat(n.name,", code ").concat(t,", reason ").concat(e||n.description):"code ".concat(t);return new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_CLOSED,errMsg:r})},x=null,C="web";function P(){return x}function D(){return C}function L(t){C=t}var U=function(){return U=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},U.apply(this,arguments)},j=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},B=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},k=function(){function t(t){var e=this;this.virtualWSClient=new Set,this.queryIdClientMap=new Map,this.watchIdClientMap=new Map,this.pingFailed=0,this.pongMissed=0,this.logins=new Map,this.wsReadySubsribers=[],this.wsResponseWait=new Map,this.rttObserved=[],this.send=function(t){return j(e,void 0,void 0,(function(){var e=this;return B(this,(function(n){return[2,new Promise((function(n,r){j(e,void 0,void 0,(function(){var e,i,o,s,a,u,c,h,f=this;return B(this,(function(l){switch(l.label){case 0:i=!1,o=!1,s=function(t){i=!0,e&&clearTimeout(e),n(t)},a=function(t){o=!0,e&&clearTimeout(e),r(t)},t.timeout&&(e=setTimeout((function(){j(f,void 0,void 0,(function(){return B(this,(function(t){switch(t.label){case 0:return i&&o?[3,2]:[4,E(0)];case 1:t.sent(),i&&o||a(new v("wsclient.send timedout")),t.label=2;case 2:return[2]}}))}))}),t.timeout)),l.label=1;case 1:return l.trys.push([1,8,,9]),void 0===this.wsInitPromise&&null===this.wsInitPromise?[3,3]:[4,this.wsInitPromise];case 2:l.sent(),l.label=3;case 3:if(!this.ws)return a(new Error("invalid state: ws connection not exists, can not send message")),[2];if(1!==this.ws.readyState)return a(new Error("ws readyState invalid: ".concat(this.ws.readyState,", can not send message"))),[2];t.waitResponse&&(u={resolve:s,reject:a,skipOnMessage:t.skipOnMessage},this.wsResponseWait.set(t.msg.requestId,u)),l.label=4;case 4:return l.trys.push([4,6,,7]),[4,this.ws.send(JSON.stringify(t.msg))];case 5:return l.sent(),t.waitResponse||s(void 0),[3,7];case 6:return(c=l.sent())&&(a(c),t.waitResponse&&this.wsResponseWait.delete(t.msg.requestId)),[3,7];case 7:return[3,9];case 8:return h=l.sent(),a(h),[3,9];case 9:return[2]}}))}))}))]}))}))},this.closeAllClients=function(t){e.virtualWSClient.forEach((function(e){e.closeWithError(t)}))},this.pauseClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.pause()}))},this.resumeClients=function(t){(t||e.virtualWSClient).forEach((function(t){t.resume()}))},this.initWebSocketConnection=function(t,n){return void 0===n&&(n=e.maxReconnect),j(e,void 0,void 0,(function(){var e=this;return B(this,(function(r){switch(r.label){case 0:if(t&&this.reconnectState)return[2];if(t&&(this.reconnectState=!0),void 0!==this.wsInitPromise&&null!==this.wsInitPromise)return[2,this.wsInitPromise];t&&this.pauseClients(),this.close(A.ReconnectWebSocket),this.wsInitPromise=new Promise((function(r,i){j(e,void 0,void 0,(function(){var e,o,s=this;return B(this,(function(a){switch(a.label){case 0:return a.trys.push([0,6,,11]),[4,this.getWsSign()];case 1:return e=a.sent(),[4,new Promise((function(t){var n=e.wsUrl||"wss://tcb-ws.tencentcloudapi.com",r=P();s.ws=r?new r(n):new WebSocket(n),t(void 0)}))];case 2:return a.sent(),this.ws.connect?[4,this.ws.connect()]:[3,4];case 3:a.sent(),a.label=4;case 4:return[4,this.initWebSocketEvent()];case 5:return a.sent(),r(),t&&(this.resumeClients(),this.reconnectState=!1),[3,11];case 6:return o=a.sent(),console.error("[realtime] initWebSocketConnection connect fail",o),n>0?(this.wsInitPromise=void 0,[4,E(this.reconnectInterval)]):[3,9];case 7:a.sent(),t&&(this.reconnectState=!1),a.label=8;case 8:return r(this.initWebSocketConnection(t,n-1)),[3,10];case 9:i(o),t&&this.closeAllClients(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_RECONNECT_WATCH_FAIL,errMsg:o})),a.label=10;case 10:return[3,11];case 11:return[2]}}))}))})),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.wsInitPromise];case 2:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.resolve)()})),[3,5];case 3:return r.sent(),this.wsReadySubsribers.forEach((function(t){return(0,t.reject)()})),[3,5];case 4:return this.wsInitPromise=void 0,this.wsReadySubsribers=[],[7];case 5:return[2]}}))}))},this.initWebSocketEvent=function(){return new Promise((function(t,n){if(!e.ws)throw new Error("can not initWebSocketEvent, ws not exists");var r=!1;e.ws.onopen=function(e){console.warn("[realtime] ws event: open",e),r=!0,t()},e.ws.onerror=function(t){e.logins=new Map,r?(console.error("[realtime] ws event: error",t),e.clearHeartbeat(),e.virtualWSClient.forEach((function(e){return e.closeWithError(new b({errCode:w.SDK_DATABASE_REALTIME_LISTENER_WEBSOCKET_CONNECTION_ERROR,errMsg:t}))}))):(console.error("[realtime] ws open failed with ws event: error",t),n(t))},e.ws.onclose=function(t){switch(console.warn("[realtime] ws event: close",t),e.logins=new Map,e.clearHeartbeat(),t.code){case A.ReconnectWebSocket:case A.NoRealtimeListeners:break;case A.HeartbeatPingError:case A.HeartbeatPongTimeoutError:case A.NormalClosure:case A.AbnormalClosure:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(N(t.code));break;case A.NoAuthentication:e.closeAllClients(N(t.code,t.reason));break;default:e.maxReconnect>0?e.initWebSocketConnection(!0,e.maxReconnect):e.closeAllClients(N(t.code))}},e.ws.onmessage=function(t){var n,r=t.data;e.heartbeat();try{n=JSON.parse(r)}catch(t){throw new Error("[realtime] onMessage parse res.data error: ".concat(t))}if("ERROR"===n.msgType){var i=null;e.virtualWSClient.forEach((function(t){t.watchId===n.watchId&&(i=t)})),i&&i.listener.onError(n)}var o=e.wsResponseWait.get(n.requestId);if(o){try{"ERROR"===n.msgType?o.reject(new y(n)):o.resolve(n)}catch(t){console.error("ws onMessage responseWaitSpec.resolve(msg) errored:",t)}finally{e.wsResponseWait.delete(n.requestId)}if(o.skipOnMessage)return}if("PONG"!==n.msgType){var s=n.watchId&&e.watchIdClientMap.get(n.watchId);if(s)s.onMessage(n);else switch(console.error("[realtime] no realtime listener found responsible for watchId ".concat(n.watchId,": "),n),n.msgType){case"INIT_EVENT":case"NEXT_EVENT":case"CHECK_EVENT":(s=e.queryIdClientMap.get(n.msgData.queryID))&&s.onMessage(n);break;default:for(var a=0,u=Array.from(e.watchIdClientMap.entries());a<u.length;a++){u[a][1].onMessage(n);break}}}else if(e.lastPingSendTS){var c=Date.now()-e.lastPingSendTS;if(c>1e4)return void console.warn("[realtime] untrusted rtt observed: ".concat(c));e.rttObserved.length>=3&&e.rttObserved.splice(0,e.rttObserved.length-3+1),e.rttObserved.push(c)}},e.heartbeat()}))},this.isWSConnected=function(){return Boolean(e.ws&&1===e.ws.readyState)},this.onceWSConnected=function(){return j(e,void 0,void 0,(function(){var t=this;return B(this,(function(e){return this.isWSConnected()?[2]:null!==this.wsInitPromise&&void 0!==this.wsInitPromise?[2,this.wsInitPromise]:[2,new Promise((function(e,n){t.wsReadySubsribers.push({resolve:e,reject:n})}))]}))}))},this.webLogin=function(t,n){return j(e,void 0,void 0,(function(){var e,r,i,o,s,a,u,h,f=this;return B(this,(function(l){switch(l.label){case 0:if(!n)if(t){if(e=this.logins.get(t)){if(e.loggedIn&&e.loginResult)return[2,e.loginResult];if(null!==e.loggingInPromise&&void 0!==e.loggingInPromise)return[2,e.loggingInPromise]}}else if(null!==(null==(r=this.logins.get(""))?void 0:r.loggingInPromise)&&void 0!==(null==r?void 0:r.loggingInPromise))return[2,r.loggingInPromise];i=new Promise((function(t,e){j(f,void 0,void 0,(function(){var n,r,i,o,s;return B(this,(function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.getWsSign()];case 1:return n=a.sent(),r={envId:n.envId||"",accessToken:"",referrer:"web",sdkVersion:"",dataVersion:""},i={watchId:void 0,requestId:c(),msgType:"LOGIN",msgData:r,exMsgData:{runtime:D(),signStr:n.signStr,secretVersion:n.secretVersion}},[4,this.send({msg:i,waitResponse:!0,skipOnMessage:!0,timeout:5e3})];case 2:return(o=a.sent()).msgData.code?e(new Error("".concat(o.msgData.code," ").concat(o.msgData.message))):t({envId:n.envId}),[3,4];case 3:return s=a.sent(),e(s),[3,4];case 4:return[2]}}))}))})),o=t&&this.logins.get(t),s=Date.now(),o?(o.loggedIn=!1,o.loggingInPromise=i,o.loginStartTS=s):(o={loggedIn:!1,loggingInPromise:i,loginStartTS:s},this.logins.set(t||"",o)),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,i];case 2:if(a=l.sent(),(u=t&&this.logins.get(t))&&u===o&&u.loginStartTS===s)return o.loggedIn=!0,o.loggingInPromise=void 0,o.loginStartTS=void 0,o.loginResult=a,[2,a];if(u){if(u.loggedIn&&u.loginResult)return[2,u.loginResult];if(null!==u.loggingInPromise&&void 0!==u.loggingInPromise)return[2,u.loggingInPromise];throw new Error("ws unexpected login info")}throw new Error("ws login info reset");case 3:throw h=l.sent(),o.loggedIn=!1,o.loggingInPromise=void 0,o.loginStartTS=void 0,o.loginResult=void 0,h;case 4:return[2]}}))}))},this.getWsSign=function(){return j(e,void 0,void 0,(function(){var t,e,n,r,i,o,s;return B(this,(function(a){switch(a.label){case 0:return this.wsSign&&this.wsSign.expiredTs>Date.now()?[2,this.wsSign]:(t=Date.now()+6e4,[4,this.context.appConfig.request.send("auth.wsWebSign",{runtime:D()})]);case 1:if((e=a.sent()).code)throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败: ".concat(e.code));if(e.data)return n=e.data,r=n.signStr,i=n.wsUrl,o=n.secretVersion,s=n.envId,[2,{signStr:r,wsUrl:i,secretVersion:o,envId:s,expiredTs:t}];throw new Error("[tcb-js-sdk] 获取实时数据推送登录票据失败")}}))}))},this.getWaitExpectedTimeoutLength=function(){return e.rttObserved.length?e.rttObserved.reduce((function(t,e){return t+e}))/e.rttObserved.length*1.5:5e3},this.ping=function(){return j(e,void 0,void 0,(function(){var t;return B(this,(function(e){switch(e.label){case 0:return t={watchId:void 0,requestId:c(),msgType:"PING",msgData:null},[4,this.send({msg:t})];case 1:return e.sent(),[2]}}))}))},this.onWatchStart=function(t,n){e.queryIdClientMap.set(n,t)},this.onWatchClose=function(t,n){n&&e.queryIdClientMap.delete(n),e.watchIdClientMap.delete(t.watchId),e.virtualWSClient.delete(t),e.virtualWSClient.size||e.close(A.NoRealtimeListeners)},this.maxReconnect=t.maxReconnect||5,this.reconnectInterval=t.reconnectInterval||1e4,this.context=t.context}return t.prototype.clearHeartbeat=function(){this.pingTimeoutId&&clearTimeout(this.pingTimeoutId),this.pongTimeoutId&&clearTimeout(this.pongTimeoutId)},t.prototype.close=function(t){this.clearHeartbeat(),this.ws&&(this.ws.close(t,R[t].name),this.ws=void 0)},t.prototype.watch=function(t){this.ws||void 0!==this.wsInitPromise&&null!==this.wsInitPromise||this.initWebSocketConnection(!1);var e=new T(U(U({},t),{send:this.send,login:this.webLogin,isWSConnected:this.isWSConnected,onceWSConnected:this.onceWSConnected,getWaitExpectedTimeoutLength:this.getWaitExpectedTimeoutLength,onWatchStart:this.onWatchStart,onWatchClose:this.onWatchClose,debug:!0}));return this.virtualWSClient.add(e),this.watchIdClientMap.set(e.watchId,e),e.listener},t.prototype.heartbeat=function(t){var e=this;this.clearHeartbeat(),this.pingTimeoutId=setTimeout((function(){j(e,void 0,void 0,(function(){var t=this;return B(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),this.ws&&1===this.ws.readyState?(this.lastPingSendTS=Date.now(),[4,this.ping()]):[2];case 1:return e.sent(),this.pingFailed=0,this.pongTimeoutId=setTimeout((function(){console.error("pong timed out"),t.pongMissed<2?(t.pongMissed+=1,t.heartbeat(!0)):t.initWebSocketConnection(!0)}),this.context.appConfig.realtimePongWaitTimeout),[3,3];case 2:return e.sent(),this.pingFailed<2?(this.pingFailed+=1,this.heartbeat()):this.close(A.HeartbeatPingError),[3,3];case 3:return[2]}}))}))}),t?0:this.context.appConfig.realtimePingInterval)},t}(),M={target:"database",entity:function(){var t,e=this.platform,n=e.adapter,r=e.runtime;t=n.wsClass,x=t,L(r)}},q={name:"realtime",IIFE:!0,entity:function(){this.prototype.wsClientClass=k}};try{cloudbase.registerComponent(q),cloudbase.registerHook(M)}catch(t){}function V(t){try{t.registerComponent(q),t.registerHook(M)}catch(t){console.warn(t)}}},766:function(t,e,n){"use strict";n.r(e),n.d(e,{registerStorage:function(){return E}});var r,i=n(142),o=function(){return o=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)},s=function(t,e,n,r){var i,o=arguments.length,s=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(s=(o<3?i(s):o>3?i(e,n,s):i(e,n))||s);return o>3&&s&&Object.defineProperty(e,n,s),s},a=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},u=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},c=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};!function(t){t.put="put",t.post="post"}(r||(r={}));var h=i._G.eX,f=i._G.Sg,l=i._G.vM,p=i.P6.kJ,d=i.P6.HD,y=i.P6.JV,g=i.P6.Gc,v=i.BM.D,m="storage",b=new(function(){function t(){}return t.prototype.uploadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,i,s,a,u,l,p,y,v,b,w,E,_,S,I,T,O,A,R,N,x,C,P,D,L;return c(this,(function(c){switch(c.label){case 0:if(n=t.cloudPath,i=t.filePath,s=t.onUploadProgress,a=t.method,u=void 0===a?"put":a,l=t.headers,p=void 0===l?{}:l,!d(n)||!i)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".uploadFile] invalid params")}));return y={put:r.put,post:r.post}[u.toLocaleLowerCase()]||r.put,v=this.request,b={path:n,method:y},y===r.put&&(b.headers=p),[4,v.send("storage.getUploadMetadata",b)];case 1:return w=c.sent(),E=w.data,_=E.url,S=E.authorization,I=E.token,T=E.fileId,O=E.cosFileId,A=E.download_url,R=w.requestId,x=o(o({},N={url:_,file:i,name:n,onUploadProgress:s}),{method:r.put,headers:o(o({},p),{authorization:S,"x-cos-meta-fileid":O,"x-cos-security-token":I})}),C=o(o({},N),{method:r.post,data:{key:n,signature:S,"x-cos-meta-fileid":O,success_action_status:"201","x-cos-security-token":I}}),(L={})[r.put]={params:x,isSuccess:function(t){return t>=200&&t<300}},L[r.post]={params:C,isSuccess:function(t){return 201===t}},P=L,[4,v.upload(P[y].params)];case 2:return D=c.sent(),P[y].isSuccess(D.statusCode)?[2,g(e,null,{fileID:T,download_url:A,requestId:R})]:[2,g(e,new Error("[".concat(h(),"][").concat(f.OPERATION_FAIL,"][").concat(m,"]:").concat(D.data)))]}}))}))},t.prototype.getUploadMetadata=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s;return c(this,(function(a){switch(a.label){case 0:if(n=t.cloudPath,!d(n))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getUploadMetadata] invalid cloudPath")}));r=this.request,i="storage.getUploadMetadata",a.label=1;case 1:return a.trys.push([1,3,,4]),[4,r.send(i,{path:n})];case 2:return o=a.sent(),[2,g(e,null,o)];case 3:return s=a.sent(),[2,g(e,s)];case 4:return[2]}}))}))},t.prototype.deleteFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileList must not be empty")}));for(r=0,i=n;r<i.length;r++)if(!(o=i[r])||!d(o))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".deleteFile] fileID must be string")}));return[4,this.request.send("storage.batchDeleteFile",{fileid_list:n})];case 1:return(s=u.sent()).code?[2,g(e,null,s)]:(a={fileList:s.data.delete_list,requestId:s.requestId},[2,g(e,null,a)])}}))}))},t.prototype.getTempFileURL=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return c(this,(function(u){switch(u.label){case 0:if(!(n=t.fileList)||!p(n)||0===n.length)throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileList must not be empty")}));for(r=[],i=0,o=n;i<o.length;i++)if(s=o[i],y(s)){if(!Object.prototype.hasOwnProperty.call(s,"fileID")||!Object.prototype.hasOwnProperty.call(s,"maxAge"))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] file info must include fileID and maxAge")}));r.push({fileid:s.fileID,max_age:s.maxAge})}else{if(!d(s))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] invalid fileList")}));r.push({fileid:s})}return[4,this.request.send("storage.batchGetDownloadUrl",{file_list:r})];case 1:return(a=u.sent()).code?[2,g(e,null,a)]:[2,g(e,null,{fileList:a.data.download_list,requestId:a.requestId})]}}))}))},t.prototype.downloadFile=function(t,e){return u(this,void 0,void 0,(function(){var n,r,i,o,s,a;return c(this,(function(u){switch(u.label){case 0:if(n=t.fileID,!d(n))throw new Error(JSON.stringify({code:f.INVALID_PARAMS,msg:"[".concat(m,".getTempFileURL] fileID must be string")}));return[4,this.getTempFileURL.call(this,{fileList:[{fileID:n,maxAge:600}]})];case 1:return r=u.sent(),"SUCCESS"!==(i=r.fileList[0]).code?[2,g(e,i)]:(o=this.request,s=encodeURI(i.download_url),[4,o.download({url:s})]);case 2:return a=u.sent(),[2,g(e,null,a)]}}))}))},s([v({customInfo:{className:"Cloudbase",methodName:"uploadFile"},title:"上传文件失败",messages:["请确认以下各项:"," 1 - 调用 uploadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"uploadFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getUploadMetadata"},title:"获取上传元信息失败",messages:["请确认以下各项:"," 1 - 调用 getUploadMetadata() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getUploadMetadata",null),s([v({customInfo:{className:"Cloudbase",methodName:"deleteFile"},title:"删除文件失败",messages:["请确认以下各项:"," 1 - 调用 deleteFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"deleteFile",null),s([v({customInfo:{className:"Cloudbase",methodName:"getTempFileURL"},title:"获取文件下载链接",messages:["请确认以下各项:"," 1 - 调用 getTempFileURL() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"getTempFileURL",null),s([v({customInfo:{className:"Cloudbase",methodName:"downloadFile"},title:"下载文件失败",messages:["请确认以下各项:"," 1 - 调用 downloadFile() 的语法或参数是否正确"," 2 - 当前域名是否在安全域名列表中:https://console.cloud.tencent.com/tcb/env/safety"," 3 - 云存储安全规则是否限制了当前登录状态访问","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(l)]}),a("design:type",Function),a("design:paramtypes",[Object,Function]),a("design:returntype",Promise)],t.prototype,"downloadFile",null),t}()),w={name:m,entity:{uploadFile:b.uploadFile,deleteFile:b.deleteFile,getTempFileURL:b.getTempFileURL,downloadFile:b.downloadFile,getUploadMetadata:b.getUploadMetadata}};try{cloudbase.registerComponent(w)}catch(t){}function E(t){try{t.registerComponent(w)}catch(t){console.warn(t)}}},142:function(t,e,n){"use strict";n.d(e,{j$:function(){return o},Fs:function(){return s},_G:function(){return r},U3:function(){return a},BM:function(){return u},P6:function(){return i}});var r={};n.r(r),n.d(r,{vM:function(){return y},Sg:function(){return g},Fk:function(){return d},eX:function(){return f},pM:function(){return p},tC:function(){return h}});var i={};n.r(i),n.d(i,{Gc:function(){return O},CN:function(){return I},Jc:function(){return S},kJ:function(){return m},hp:function(){return _},V9:function(){return E},JV:function(){return w},HD:function(){return b},Jz:function(){return N},xe:function(){return A},_y:function(){return R},UK:function(){return T}});var o={};n.r(o),n.d(o,{Fk:function(){return U},xY:function(){return j}});var s={};n.r(s),n.d(s,{q:function(){return V}});var a={};n.r(a),n.d(a,{yE:function(){return $}});var u={};n.r(u),n.d(u,{D:function(){return Z}});var c="@cloudbase/js-sdk";function h(t){c=t}function f(){return c}var l="https:";function p(t){l=t}var d=!1,y="https://support.qq.com/products/148793",g={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"},v=n(829);function m(t){return"[object Array]"===Object.prototype.toString.call(t)}function b(t){return"string"==typeof t}function w(t){return"[object Object]"===Object.prototype.toString.call(t)}function E(t,e){return t instanceof e}function _(t){return"[object FormData]"===Object.prototype.toString.call(t)}function S(){return Math.random().toString(16).slice(2)}function I(t,e,n){void 0===n&&(n={});var r=/\?/.test(e),i="";return Object.keys(n).forEach((function(t){""===i?!r&&(e+="?"):i+="&",i+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=i)?e:"".concat(t).concat(e)}function T(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}function O(t,e,n){if(void 0===n&&(n=null),t&&"function"==typeof t)return t(e,n);if(e)throw e;return n}function A(t,e){console.warn("[".concat(f(),"][").concat(t,"]:").concat(e))}function R(t,e){throw new Error(JSON.stringify({code:t,msg:"[".concat(f(),"][").concat(t,"]:").concat(e)}))}function N(t){var e=t.title,n=t.subtitle,r=void 0===n?"":n,i=t.content,o=void 0===i?[]:i,s=t.printTrace,a=void 0!==s&&s,u=t.collapsed;void 0!==u&&u?console.groupCollapsed(e,r):console.group(e,r);for(var c=0,h=o;c<h.length;c++){var f=h[c],l=f.type,p=f.body;switch(l){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}a&&console.trace("stack trace:"),console.groupEnd()}var x,C,P=(x=function(t,e){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},x(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}x(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),D=function(){return D=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},D.apply(this,arguments)},L=function(t){function e(e){var n=t.call(this)||this,r=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return n.timeout=r||0,n.timeoutMsg=i||"请求超时",n.restrictedMethods=o||["get","post","upload","download"],n}return P(e,t),e.prototype.get=function(t){return this.request(D(D({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(D(D({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(D(D({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,r=t.name,i=t.method,o=t.headers,s=void 0===o?{}:o,a={post:"post",put:"put"}[null==i?void 0:i.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(e).forEach((function(t){u.append(t,e[t])})),u.append("key",r),u.append("file",n),this.request(D(D({},t),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(D(D({},t),{method:"put",headers:s,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return e=this,n=void 0,i=function(){var e,n,r,i;return function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}}(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.get(D(D({},t),{headers:{},responseType:"blob"}))];case 1:return e=o.sent().data,n=window.URL.createObjectURL(new Blob([e])),r=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(i=document.createElement("a")).href=n,i.setAttribute("download",r),i.style.display="none",document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i),[3,3];case 2:return o.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))},new((r=void 0)||(r=Promise))((function(t,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r((function(t){t(n)}))).then(s,a)}u((i=i.apply(e,n||[])).next())}));var e,n,r,i},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var r=String(t.method).toLowerCase()||"get";return new Promise((function(i){var o,s,a=t.url,u=t.headers,c=void 0===u?{}:u,h=t.data,f=t.responseType,p=t.withCredentials,d=t.body,y=t.onUploadProgress,g=I(l,a,"get"===r?h:{}),v=new XMLHttpRequest;v.open(r,g),f&&(v.responseType=f),Object.keys(c).forEach((function(t){v.setRequestHeader(t,c[t])})),y&&v.upload.addEventListener("progress",y),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),r=e.shift().toLowerCase(),i=e.join(": ");n[r]=i})),t.header=n,t.statusCode=v.status;try{t.data="blob"===f?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===f?v.response:v.responseText}clearTimeout(o),i(t)}},e&&n.timeout&&(o=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),s=_(h)?h:"application/x-www-form-urlencoded"===c["content-type"]?T(h):d||(h?JSON.stringify(h):void 0),p&&(v.withCredentials=!0),v.send(s)}))},e}(v.jJ);function U(t){for(var e=0,n=m(t)?t:[t];e<n.length;e++){var r=n[e],i=r.isMatch,o=r.genAdapter,s=r.runtime;if(i())return{adapter:o(),runtime:s}}}function j(){return{adapter:{root:window,reqClass:L,wsClass:WebSocket,localStorage:localStorage},runtime:C.WEB}}!function(t){t.WEB="web",t.WX_MP="wx_mp"}(C||(C={}));var B=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),k=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},M=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},q=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return B(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}(v.x_),V=function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,r=void 0===n?{}:n,i=t.keys,o=void 0===i?{}:i;this.platformInfo=r,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(A(g.INVALID_PARAMS,"localStorage is not supported on current platform"),new q(e.root));case"none":return new q(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=o)}return Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var r={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(r))}catch(t){throw new Error(JSON.stringify({code:g.OPERATION_FAIL,msg:"[".concat(f(),"][").concat(g.OPERATION_FAIL,"]setStore failed"),info:t}))}}else A(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return k(this,void 0,void 0,(function(){var r;return M(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2];i.label=1;case 1:return i.trys.push([1,3,,4]),r={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(r))];case 2:return i.sent(),[3,4];case 3:return i.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var r=this.storage.getItem(t);return r&&r.indexOf(e)>=0?JSON.parse(r).content:""}A(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return k(this,void 0,void 0,(function(){var r;return M(this,(function(i){switch(i.label){case 0:try{if("undefined"!=typeof process&&(null===(n=process.env)||void 0===n?void 0:n.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(r=i.sent())&&r.indexOf(e)>=0?[2,JSON.parse(r).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):A(g.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return k(this,void 0,void 0,(function(){return M(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))},t}(),F=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),H=function(t,e){this.data=e||null,this.name=t},W=function(t){function e(e,n){var r=t.call(this,"error",{error:e,data:n})||this;return r.error=e,r}return F(e,t),e}(H),$=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var r=n[t].indexOf(e);-1!==r&&n[t].splice(r,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(E(t,W))return console.error(t.error),this;var n=b(t)?new H(t,e||{}):t,r=n.name;if(this.listens(r)){n.target=this;for(var i=0,o=this.listeners[r]?function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}([],this.listeners[r],!0):[];i<o.length;i++)o[i].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();new $;var G=function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},K=function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},J=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(J=-1!==navigator.userAgent.indexOf("Firefox"));var Y=J?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,z=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function Z(t){var e=t.mode,n=void 0===e?"async":e,r=t.customInfo,i=void 0===r?{}:r,o=t.title,s=t.messages,a=void 0===s?[]:s;return function(t,e,r){if(d){var s=i.className||t.constructor.name,u=i.methodName||e,c=r.value,h=function(t){var e="",n=(new Error).stack.split("\n"),r=n.findIndex((function(t){return Y.test(t)}));if(-1!==r){var i=z.exec(n[r+1]||"");e=i?i[0]:""}return e}();r.value="sync"===n?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Q({err:new Error,className:s,methodName:u,sourceLink:h});try{return c.apply(this,t)}catch(t){var r=t,i=t.message,f=t.error,l=t.error_description,p={title:o||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:t}]};if(i&&/^\{.*\}$/.test(i)){var d=JSON.parse(i);p.subtitle=i,d.code&&(n?(n.code=d.code,n.msg=d.msg):(t.code=d.code,t.message=d.msg),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}})))}throw f&&l&&(p.subtitle=l,n?(n.code=f,n.msg=l):(t.code=f,t.message=l),r=n||t,p.content=a.map((function(t){return{type:"info",body:t}}))),N(p),r}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return G(this,void 0,void 0,(function(){var e,n,r,i,f,l,p,d;return K(this,(function(y){switch(y.label){case 0:e=Q({err:new Error,className:s,methodName:u,sourceLink:h}),y.label=1;case 1:return y.trys.push([1,3,,4]),[4,c.apply(this,t)];case 2:return[2,y.sent()];case 3:throw n=y.sent(),r=n,i=n.message,f=n.error,l=n.error_description,p={title:o||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:n}]},i&&/^\{.*\}$/.test(i)&&(d=JSON.parse(i),p.subtitle=d,d.code&&(e?(e.code=d.code,e.message=d.msg):(n.code=d.code,n.message=d.msg),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}})))),f&&l&&(p.subtitle=l,e?(e.code=f,e.msg=l):(n.code=f,n.message=l),r=e||n,p.content=a.map((function(t){return{type:"info",body:t}}))),N(p),r;case 4:return[2]}}))}))}}}}function Q(t){var e=t.err,n=t.className,r=t.methodName,i=t.sourceLink;if(!i)return null;var o,s=e.stack.split("\n"),a=J?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]\\s*\\(.*\\)$")),u=J?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(n,"\\.descriptor.value\\s*\\[as\\s").concat(r,"\\]")),c=s.findIndex((function(t){return a.test(t)}));if(-1!==c){var h=s.filter((function(t,e){return e>c}));h.unshift(s[c].replace(u,"".concat(n,".").concat(r)).replace(z,i)),(o=new Error).stack="".concat(J?"@debugger":"Error","\n").concat(h.join("\n"))}return o}function X(t){this.message=t}function tt(t){this.message=t}X.prototype=new Error,X.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),tt.prototype=new Error,tt.prototype.name="InvalidTokenError"},907:function(t,e,n){t=n.nmd(t);var r="__lodash_hash_undefined__",i=9007199254740991,o="[object Arguments]",s="[object Boolean]",a="[object Date]",u="[object Function]",c="[object GeneratorFunction]",h="[object Map]",f="[object Number]",l="[object Object]",p="[object Promise]",d="[object RegExp]",y="[object Set]",g="[object String]",v="[object Symbol]",m="[object WeakMap]",b="[object ArrayBuffer]",w="[object DataView]",E="[object Float32Array]",_="[object Float64Array]",S="[object Int8Array]",I="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",A="[object Uint8ClampedArray]",R="[object Uint16Array]",N="[object Uint32Array]",x=/\w*$/,C=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,D={};D[o]=D["[object Array]"]=D[b]=D[w]=D[s]=D[a]=D[E]=D[_]=D[S]=D[I]=D[T]=D[h]=D[f]=D[l]=D[d]=D[y]=D[g]=D[v]=D[O]=D[A]=D[R]=D[N]=!0,D["[object Error]"]=D[u]=D[m]=!1;var L="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,U="object"==typeof self&&self&&self.Object===Object&&self,j=L||U||Function("return this")(),B=e&&!e.nodeType&&e,k=B&&t&&!t.nodeType&&t,M=k&&k.exports===B;function q(t,e){return t.set(e[0],e[1]),t}function V(t,e){return t.add(e),t}function F(t,e,n,r){var i=-1,o=t?t.length:0;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function H(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function W(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}function $(t,e){return function(n){return t(e(n))}}function G(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}var K,J=Array.prototype,Y=Function.prototype,z=Object.prototype,Z=j["__core-js_shared__"],Q=(K=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",X=Y.toString,tt=z.hasOwnProperty,et=z.toString,nt=RegExp("^"+X.call(tt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=M?j.Buffer:void 0,it=j.Symbol,ot=j.Uint8Array,st=$(Object.getPrototypeOf,Object),at=Object.create,ut=z.propertyIsEnumerable,ct=J.splice,ht=Object.getOwnPropertySymbols,ft=rt?rt.isBuffer:void 0,lt=$(Object.keys,Object),pt=jt(j,"DataView"),dt=jt(j,"Map"),yt=jt(j,"Promise"),gt=jt(j,"Set"),vt=jt(j,"WeakMap"),mt=jt(Object,"create"),bt=Vt(pt),wt=Vt(dt),Et=Vt(yt),_t=Vt(gt),St=Vt(vt),It=it?it.prototype:void 0,Tt=It?It.valueOf:void 0;function Ot(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function At(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Rt(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function Nt(t){this.__data__=new At(t)}function xt(t,e,n){var r=t[e];tt.call(t,e)&&Ft(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function Ct(t,e){for(var n=t.length;n--;)if(Ft(t[n][0],e))return n;return-1}function Pt(t,e,n,r,i,p,m){var C;if(r&&(C=p?r(t,i,p,m):r(t)),void 0!==C)return C;if(!Kt(t))return t;var P=Ht(t);if(P){if(C=function(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&tt.call(t,"index")&&(n.index=t.index,n.input=t.input),n}(t),!e)return function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}(t,C)}else{var L=kt(t),U=L==u||L==c;if($t(t))return function(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}(t,e);if(L==l||L==o||U&&!p){if(H(t))return p?t:{};if(C=function(t){return"function"!=typeof t.constructor||qt(t)?{}:Kt(e=st(t))?at(e):{};var e}(U?{}:t),!e)return function(t,e){return Lt(t,Bt(t),e)}(t,function(t,e){return t&&Lt(e,Jt(e),t)}(C,t))}else{if(!D[L])return p?t:{};C=function(t,e,n,r){var i,o=t.constructor;switch(e){case b:return Dt(t);case s:case a:return new o(+t);case w:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}(t,r);case E:case _:case S:case I:case T:case O:case A:case R:case N:return function(t,e){var n=e?Dt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}(t,r);case h:return function(t,e,n){return F(e?n(W(t),!0):W(t),q,new t.constructor)}(t,r,n);case f:case g:return new o(t);case d:return function(t){var e=new t.constructor(t.source,x.exec(t));return e.lastIndex=t.lastIndex,e}(t);case y:return function(t,e,n){return F(e?n(G(t),!0):G(t),V,new t.constructor)}(t,r,n);case v:return i=t,Tt?Object(Tt.call(i)):{}}}(t,L,Pt,e)}}m||(m=new Nt);var j=m.get(t);if(j)return j;if(m.set(t,C),!P)var B=n?function(t){return function(t,e,n){var r=e(t);return Ht(t)?r:function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}(r,n(t))}(t,Jt,Bt)}(t):Jt(t);return function(t,e){for(var n=-1,r=t?t.length:0;++n<r&&!1!==e(t[n],n););}(B||t,(function(i,o){B&&(i=t[o=i]),xt(C,o,Pt(i,e,n,r,o,t,m))})),C}function Dt(t){var e=new t.constructor(t.byteLength);return new ot(e).set(new ot(t)),e}function Lt(t,e,n,r){n||(n={});for(var i=-1,o=e.length;++i<o;){var s=e[i],a=r?r(n[s],t[s],s,n,t):void 0;xt(n,s,void 0===a?t[s]:a)}return n}function Ut(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function jt(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Kt(t)||(e=t,Q&&Q in e))&&(Gt(t)||H(t)?nt:C).test(Vt(t));var e}(n)?n:void 0}Ot.prototype.clear=function(){this.__data__=mt?mt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(mt){var n=e[t];return n===r?void 0:n}return tt.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return mt?void 0!==e[t]:tt.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=mt&&void 0===e?r:e,this},At.prototype.clear=function(){this.__data__=[]},At.prototype.delete=function(t){var e=this.__data__,n=Ct(e,t);return!(n<0||(n==e.length-1?e.pop():ct.call(e,n,1),0))},At.prototype.get=function(t){var e=this.__data__,n=Ct(e,t);return n<0?void 0:e[n][1]},At.prototype.has=function(t){return Ct(this.__data__,t)>-1},At.prototype.set=function(t,e){var n=this.__data__,r=Ct(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},Rt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(dt||At),string:new Ot}},Rt.prototype.delete=function(t){return Ut(this,t).delete(t)},Rt.prototype.get=function(t){return Ut(this,t).get(t)},Rt.prototype.has=function(t){return Ut(this,t).has(t)},Rt.prototype.set=function(t,e){return Ut(this,t).set(t,e),this},Nt.prototype.clear=function(){this.__data__=new At},Nt.prototype.delete=function(t){return this.__data__.delete(t)},Nt.prototype.get=function(t){return this.__data__.get(t)},Nt.prototype.has=function(t){return this.__data__.has(t)},Nt.prototype.set=function(t,e){var n=this.__data__;if(n instanceof At){var r=n.__data__;if(!dt||r.length<199)return r.push([t,e]),this;n=this.__data__=new Rt(r)}return n.set(t,e),this};var Bt=ht?$(ht,Object):function(){return[]},kt=function(t){return et.call(t)};function Mt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function qt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||z)}function Vt(t){if(null!=t){try{return X.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ft(t,e){return t===e||t!=t&&e!=e}(pt&&kt(new pt(new ArrayBuffer(1)))!=w||dt&&kt(new dt)!=h||yt&&kt(yt.resolve())!=p||gt&&kt(new gt)!=y||vt&&kt(new vt)!=m)&&(kt=function(t){var e=et.call(t),n=e==l?t.constructor:void 0,r=n?Vt(n):void 0;if(r)switch(r){case bt:return w;case wt:return h;case Et:return p;case _t:return y;case St:return m}return e});var Ht=Array.isArray;function Wt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Gt(t)}var $t=ft||function(){return!1};function Gt(t){var e=Kt(t)?et.call(t):"";return e==u||e==c}function Kt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Wt(t)?function(t,e){var n=Ht(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Wt(t)}(t)&&tt.call(t,"callee")&&(!ut.call(t,"callee")||et.call(t)==o)}(t)?function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}(t.length,String):[],r=n.length,i=!!r;for(var s in t)!e&&!tt.call(t,s)||i&&("length"==s||Mt(s,r))||n.push(s);return n}(t):function(t){if(!qt(t))return lt(t);var e=[];for(var n in Object(t))tt.call(t,n)&&"constructor"!=n&&e.push(n);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}},880:function(t,e,n){var r,i="Expected a function",o="__lodash_hash_undefined__",s=1/0,a=9007199254740991,u="[object Function]",c="[object GeneratorFunction]",h="[object Symbol]",f=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,l=/^\w*$/,p=/^\./,d=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,y=/\\(\\)?/g,g=/^\[object .+?Constructor\]$/,v=/^(?:0|[1-9]\d*)$/,m="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,b="object"==typeof self&&self&&self.Object===Object&&self,w=m||b||Function("return this")(),E=Array.prototype,_=Function.prototype,S=Object.prototype,I=w["__core-js_shared__"],T=(r=/[^.]+$/.exec(I&&I.keys&&I.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",O=_.toString,A=S.hasOwnProperty,R=S.toString,N=RegExp("^"+O.call(A).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),x=w.Symbol,C=E.splice,P=F(w,"Map"),D=F(Object,"create"),L=x?x.prototype:void 0,U=L?L.toString:void 0;function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function B(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function k(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function M(t,e,n){var r=t[e];A.call(t,e)&&K(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function q(t,e){for(var n=t.length;n--;)if(K(t[n][0],e))return n;return-1}function V(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function F(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!Y(t)||T&&T in t)return!1;var e=function(t){var e=Y(t)?R.call(t):"";return e==u||e==c}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?N:g;return e.test(function(t){if(null!=t){try{return O.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function H(t,e){return!!(e=null==e?a:e)&&("number"==typeof t||v.test(t))&&t>-1&&t%1==0&&t<e}j.prototype.clear=function(){this.__data__=D?D(null):{}},j.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},j.prototype.get=function(t){var e=this.__data__;if(D){var n=e[t];return n===o?void 0:n}return A.call(e,t)?e[t]:void 0},j.prototype.has=function(t){var e=this.__data__;return D?void 0!==e[t]:A.call(e,t)},j.prototype.set=function(t,e){return this.__data__[t]=D&&void 0===e?o:e,this},B.prototype.clear=function(){this.__data__=[]},B.prototype.delete=function(t){var e=this.__data__,n=q(e,t);return!(n<0||(n==e.length-1?e.pop():C.call(e,n,1),0))},B.prototype.get=function(t){var e=this.__data__,n=q(e,t);return n<0?void 0:e[n][1]},B.prototype.has=function(t){return q(this.__data__,t)>-1},B.prototype.set=function(t,e){var n=this.__data__,r=q(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},k.prototype.clear=function(){this.__data__={hash:new j,map:new(P||B),string:new j}},k.prototype.delete=function(t){return V(this,t).delete(t)},k.prototype.get=function(t){return V(this,t).get(t)},k.prototype.has=function(t){return V(this,t).has(t)},k.prototype.set=function(t,e){return V(this,t).set(t,e),this};var W=G((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(z(t))return U?U.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return p.test(t)&&n.push(""),t.replace(d,(function(t,e,r,i){n.push(r?i.replace(y,"$1"):e||t)})),n}));function $(t){if("string"==typeof t||z(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function G(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(G.Cache||k),n}function K(t,e){return t===e||t!=t&&e!=e}G.Cache=k;var J=Array.isArray;function Y(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function z(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&R.call(t)==h}t.exports=function(t,e,n){return null==t?t:function(t,e,n,r){if(!Y(t))return t;e=function(t,e){if(J(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!z(t))||l.test(t)||!f.test(t)||null!=e&&t in Object(e)}(e,t)?[e]:function(t){return J(t)?t:W(t)}(e);for(var i=-1,o=e.length,s=o-1,a=t;null!=a&&++i<o;){var u=$(e[i]),c=n;if(i!=s){var h=a[u];void 0===(c=r?r(h,u,a):void 0)&&(c=Y(h)?h:H(e[i+1])?[]:{})}M(a,u,c),a=a[u]}return t}(t,e,n)}},373:function(t,e,n){var r,i="Expected a function",o="__lodash_hash_undefined__",s=1/0,a="[object Function]",u="[object GeneratorFunction]",c="[object Symbol]",h=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,f=/^\w*$/,l=/^\./,p=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,d=/\\(\\)?/g,y=/^\[object .+?Constructor\]$/,g="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,v="object"==typeof self&&self&&self.Object===Object&&self,m=g||v||Function("return this")(),b=Array.prototype,w=Function.prototype,E=Object.prototype,_=m["__core-js_shared__"],S=(r=/[^.]+$/.exec(_&&_.keys&&_.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",I=w.toString,T=E.hasOwnProperty,O=E.toString,A=RegExp("^"+I.call(T).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),R=m.Symbol,N=b.splice,x=q(m,"Map"),C=q(Object,"create"),P=R?R.prototype:void 0,D=P?P.toString:void 0;function L(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function U(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function j(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function B(t,e){for(var n,r,i=t.length;i--;)if((n=t[i][0])===(r=e)||n!=n&&r!=r)return i;return-1}function k(t){return $(t)?t:F(t)}function M(t,e){var n,r,i=t.__data__;return("string"==(r=typeof(n=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof e?"string":"hash"]:i.map}function q(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){if(!G(t)||S&&S in t)return!1;var e=function(t){var e=G(t)?O.call(t):"";return e==a||e==u}(t)||function(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}(t)?A:y;return e.test(function(t){if(null!=t){try{return I.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))}(n)?n:void 0}function V(t,e){if($(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!K(t))||f.test(t)||!h.test(t)||null!=e&&t in Object(e)}L.prototype.clear=function(){this.__data__=C?C(null):{}},L.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},L.prototype.get=function(t){var e=this.__data__;if(C){var n=e[t];return n===o?void 0:n}return T.call(e,t)?e[t]:void 0},L.prototype.has=function(t){var e=this.__data__;return C?void 0!==e[t]:T.call(e,t)},L.prototype.set=function(t,e){return this.__data__[t]=C&&void 0===e?o:e,this},U.prototype.clear=function(){this.__data__=[]},U.prototype.delete=function(t){var e=this.__data__,n=B(e,t);return!(n<0||(n==e.length-1?e.pop():N.call(e,n,1),0))},U.prototype.get=function(t){var e=this.__data__,n=B(e,t);return n<0?void 0:e[n][1]},U.prototype.has=function(t){return B(this.__data__,t)>-1},U.prototype.set=function(t,e){var n=this.__data__,r=B(n,t);return r<0?n.push([t,e]):n[r][1]=e,this},j.prototype.clear=function(){this.__data__={hash:new L,map:new(x||U),string:new L}},j.prototype.delete=function(t){return M(this,t).delete(t)},j.prototype.get=function(t){return M(this,t).get(t)},j.prototype.has=function(t){return M(this,t).has(t)},j.prototype.set=function(t,e){return M(this,t).set(t,e),this};var F=W((function(t){var e;t=null==(e=t)?"":function(t){if("string"==typeof t)return t;if(K(t))return D?D.call(t):"";var e=t+"";return"0"==e&&1/t==-s?"-0":e}(e);var n=[];return l.test(t)&&n.push(""),t.replace(p,(function(t,e,r,i){n.push(r?i.replace(d,"$1"):e||t)})),n}));function H(t){if("string"==typeof t||K(t))return t;var e=t+"";return"0"==e&&1/t==-s?"-0":e}function W(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(i);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var s=t.apply(this,r);return n.cache=o.set(i,s),s};return n.cache=new(W.Cache||j),n}W.Cache=j;var $=Array.isArray;function G(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function K(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&O.call(t)==c}t.exports=function(t,e){return null==t||function(t,e){t=function(t,e){return 1==e.length?t:function(t,e){for(var n=0,r=(e=V(e,t)?[e]:k(e)).length;null!=t&&n<r;)t=t[H(e[n++])];return n&&n==r?t:void 0}(t,function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r<i;)o[r]=t[r+e];return o}(e,0,-1))}(t,e=V(e,t)?[e]:k(e));var n,r,i=H((r=(n=e)?n.length:0)?n[r-1]:void 0);return!(null!=t&&T.call(t,i))||delete t[i]}(t,e)}},47:function(t){var e=function(t){"use strict";var e,n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var o=e&&e.prototype instanceof v?e:v,s=Object.create(o.prototype),a=new x(r||[]);return i(s,"_invoke",{value:O(t,n,a)}),s}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=h;var l="suspendedStart",p="suspendedYield",d="executing",y="completed",g={};function v(){}function m(){}function b(){}var w={};c(w,s,(function(){return this}));var E=Object.getPrototypeOf,_=E&&E(E(C([])));_&&_!==n&&r.call(_,s)&&(w=_);var S=b.prototype=v.prototype=Object.create(w);function I(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function n(i,o,s,a){var u=f(t[i],t,o);if("throw"!==u.type){var c=u.arg,h=c.value;return h&&"object"==typeof h&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){n("next",t,s,a)}),(function(t){n("throw",t,s,a)})):e.resolve(h).then((function(t){c.value=t,s(c)}),(function(t){return n("throw",t,s,a)}))}a(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function O(t,e,n){var r=l;return function(i,o){if(r===d)throw new Error("Generator is already running");if(r===y){if("throw"===i)throw o;return P()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=A(s,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===l)throw r=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=d;var u=f(t,e,n);if("normal"===u.type){if(r=n.done?y:p,u.arg===g)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r=y,n.method="throw",n.arg=u.arg)}}}function A(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var o=f(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,g;var s=o.arg;return s?s.done?(n[t.resultName]=s.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):s:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function C(t){if(t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}return{next:P}}function P(){return{value:e,done:!0}}return m.prototype=b,i(S,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:m,configurable:!0}),m.displayName=c(b,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},I(T.prototype),c(T.prototype,a,(function(){return this})),t.AsyncIterator=T,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var s=new T(h(e,n,r,i),o);return t.isGeneratorFunction(n)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},I(S),c(S,u,"Generator"),c(S,s,(function(){return this})),c(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},t.values=C,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(N),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return a.type="throw",a.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var u=r.call(s,"catchLoc"),c=r.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=t,s.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),N(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;N(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:C(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}(t.exports);try{regeneratorRuntime=e}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}},536:function(t){"use strict";t.exports=JSON.parse('{"version":"2.5.44-beta.0"}')}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var o=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}return n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,{a:e}),e},n.d=function(t,e){for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},n(47),n(195)}()}));
|