@cloudbase/wx-cloud-client-sdk 1.8.2 → 1.8.4
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/README.md +207 -36
- package/lib/auth/index.d.ts +3 -1
- package/lib/index.d.ts +2 -0
- package/lib/types/index.d.ts +2 -2
- package/lib/wxCloudClientSDK.cjs.js +2 -2
- package/lib/wxCloudClientSDK.esm.js +2 -2
- package/lib/wxCloudClientSDK.umd.js +2 -2
- package/package.json +3 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).wxCloudClientSDK={})}(this,function(e){"use strict";var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function o(e,t,r,n){return new(r||(r=Promise))(function(t,o){function i(e){try{a(n.next(e))}catch(e){o(e)}}function s(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r(function(e){e(n)})).then(i,s)}a((n=n.apply(e,[])).next())})}function i(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var s=function(e){function t(t,r){var n=e.call(this,t)||this;return n.name="WxCloudSDKError",n.code=null==r?void 0:r.code,n.requestId=null==r?void 0:r.requestId,n.originError=null==r?void 0:r.originError,n}return r(t,e),t}(Error);function a(){return"undefined"!=typeof window&&window||"undefined"!=typeof globalThis&&globalThis}function c(){try{var e=a();if(!e)return;return"undefined"==typeof wx?a().location.href:e.__wxRoute}catch(e){}}var u=function(e){return o(void 0,0,void 0,function(){var t,r,n;return i(this,function(o){switch(o.label){case 0:if(!(null==e?void 0:e.auth))return[2,""];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e.auth.getSession()];case 2:return t=o.sent().data,[2,(null===(n=t.session)||void 0===n?void 0:n.access_token)||""];case 3:return r=o.sent(),console.log("[WxCloudSDKError] getAccessToken failed",r),[2,""];case 4:return[2]}})})},l=function(e){var t=e.dataSourceName,r=e.methodName,l=e.params,h=e.realMethodName,d=e.callFunction,f=e.envType,p=void 0===f?"prod":f,v=e.mode,g=e.cloud;return o(void 0,0,void 0,function(){var e,o,f,m,y,b,_;return i(this,function(i){switch(i.label){case 0:return e={data:{},requestId:""},[4,u(g)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,d({name:"lowcode-datasource",data:n({dataSourceName:t,methodName:r,params:l,userAgent:(S=a(),(null==S?void 0:S.navigator)?S.navigator.userAgent:"undefined"!=typeof wx&&wx.getSystemInfo?(wx.getSystemInfo({success:function(e){e&&(w=["brand","model","version","system","platform","SDKVersion","language"].map(function(t){return"".concat(t,": ").concat(e[t])}).join(", "))}}),w):void 0),referrer:c(),"x-sdk-version":"1.8.2",envType:p,mode:v},o?{access_token:o}:{})})];case 3:if(f=i.sent(),m=(null===(b=null==f?void 0:f.result)||void 0===b?void 0:b.requestId)||(null==f?void 0:f.requestId)||(null==f?void 0:f.requestID),null==f?void 0:f.result.code)throw new s("【错误】".concat(null==f?void 0:f.result.message,"\n【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(h,"\n【错误码】").concat(null==f?void 0:f.result.code,"\n【请求ID】").concat(m||"N/A"),{code:null==f?void 0:f.result.code,requestId:m});return e.data=(null===(_=null==f?void 0:f.result)||void 0===_?void 0:_.data)||{},e.requestId=m,[3,5];case 4:throw"WxCloudSDKError"===(y=i.sent()).name?y:(console.log(y),new s("【错误】".concat(y.message,"\n 【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(h,"\n 【请求ID】N/A"),{code:"UnknownError",originError:y}));case 5:return[2,e]}var w,S})})},h=function(e){var t=e.sql,r=e.params,n=e.config,s=e.callFunction,a=e.unsafe,c=void 0!==a&&a,u=e.cloud;return o(void 0,0,void 0,function(){return i(this,function(e){return[2,l({realMethodName:"$runSQL",methodName:"callWedaApi",params:{action:"RunMysqlCommand",data:{sqlTemplate:t,config:n,parameter:c?"":Object.entries(r||{}).reduce(function(e,t){var r=t[0],n=t[1];if(void 0!==n){var o="OBJECT";switch(typeof n){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(n)?"ARRAY":"OBJECT"}e.push({key:r,type:o,value:"STRING"===o?n:JSON.stringify(n)})}return e},[])||[]}},callFunction:s,mode:"sdk",cloud:u})]})})},d=function(e,t){return{$runSQL:function(r,s,a){return o(this,0,void 0,function(){return i(this,function(o){switch(o.label){case 0:return[4,h({sql:r,params:s,config:n(n({},a),{preparedStatements:!0}),callFunction:e,cloud:t})];case 1:return[2,o.sent()]}})})},$runSQLRaw:function(r,s){return o(this,0,void 0,function(){return i(this,function(o){switch(o.label){case 0:return[4,h({sql:r,params:[],config:n(n({},s),{preparedStatements:!1}),callFunction:e,cloud:t})];case 1:return[2,o.sent()]}})})}}},f={filter:{where:{}},select:{$master:!0}};function p(e){return{getUrl:function(t){return"".concat(t,"/").concat(e)},method:"post"}}var v={get:n(n({},p("get")),{defaultParams:n({},f)}),list:n(n({},p("list")),{defaultParams:n({},f)}),create:p("create"),createMany:p("createMany"),update:n(n({},p("update")),{method:"put"}),updateMany:n(n({},p("updateMany")),{method:"put"}),upsert:p("upsert"),delete:p("delete"),deleteMany:p("deleteMany")},g="Unknown error occurred",m="NotSupported",y=function(e,t,r,n){var o=d(e,null==n?void 0:n.cloud);return new Proxy({},{get:function(e,i){if("string"==typeof i)return Object.prototype.hasOwnProperty.call(o,i)?o[i]:_(r,i,t,n)}})},b=function(e,t,r,n,o){return new s("【错误】".concat(e,"\n【操作】调用 models.").concat(t,".").concat(r,"\n【错误码】").concat(n,"\n【请求ID】").concat(o),{code:n,requestId:o})},_=function(e,t,r,a){var c=new Proxy({},{get:function(c,u){if("runSQLTemplate"!==u){var l=v[u];if(!l){var h=new Error("不支持的操作: ".concat(u));throw new s(h.message||g,{originError:h,code:m,requestId:"N/A"})}return function(n){return void 0===n&&(n={}),o(void 0,0,void 0,function(){var o,a,c,h,d,f,p,v,m,y;return i(this,function(i){switch(i.label){case 0:o=l.getUrl,a=l.method,c=l.defaultParams,h=void 0===c?{}:c,d=Object.assign({},h,n),f="pre"===d.envType?"pre":"prod",p=[e,f,o(t)].join("/"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r({url:p,body:JSON.stringify(d),method:a})];case 2:if((v=i.sent()).code)throw b(null==v?void 0:v.message,t,u,null==v?void 0:v.code,null==v?void 0:v.requestId);return"get"===u&&Object.assign(v,{data:null!==(y=v.data.record)&&void 0!==y?y:v.data}),[2,v];case 3:throw m=i.sent(),new s((null==m?void 0:m.message)||g,{originError:m});case 4:return[2]}})})}}if(!(null==a?void 0:a.sqlBaseUrl)){h=new Error("不支持的操作: ".concat(u));throw new s(h.message||g,{originError:h,code:m,requestId:"N/A"})}return function(e){return o(void 0,0,void 0,function(){var o,c,l,h,d,f,p,v,m,y,_,w,S,I,T,P;return i(this,function(i){switch(i.label){case 0:o=e.params,c=e.templateName,l=e.envType,h="pre"===l?"pre":"prod",d=[a.sqlBaseUrl,h,c,"run"].join("/"),f=Object.entries(o||{}).reduce(function(e,t){var r=t[0],n=t[1];if(void 0!==n){var o="OBJECT";switch(typeof n){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(n)?"ARRAY":"OBJECT"}e.push({key:r,type:o,value:"STRING"===o?n:JSON.stringify(n)})}return e},[]),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r({url:d,body:JSON.stringify({parameter:f}),method:"POST"})];case 2:if(p=i.sent(),null===(m=null==p?void 0:p.Response)||void 0===m?void 0:m.Error)throw b(null===(_=null===(y=null==p?void 0:p.Response)||void 0===y?void 0:y.Error)||void 0===_?void 0:_.Message,t,u,null===(S=null===(w=null==p?void 0:p.Response)||void 0===w?void 0:w.Error)||void 0===S?void 0:S.Code,null===(I=null==p?void 0:p.Response)||void 0===I?void 0:I.RequestId);return[2,n(n({},null!==(T=null==p?void 0:p.Response)&&void 0!==T?T:{}),{data:null===(P=null==p?void 0:p.Response)||void 0===P?void 0:P.Data})];case 3:throw v=i.sent(),new s((null==v?void 0:v.message)||g,{originError:v});case 4:return[2]}})})}}});return c},w={create:{methodName:"wedaCreateV2"},createMany:{methodName:"wedaBatchCreateV2"},update:{methodName:"wedaUpdateV2"},upsert:{methodName:"wedaUpsertV2"},updateMany:{methodName:"wedaBatchUpdateV2"},delete:{methodName:"wedaDeleteV2"},deleteMany:{methodName:"wedaBatchDeleteV2"},get:{methodName:"wedaGetItemV2",defaultParams:{filter:{where:{}},select:{$master:!0}}},list:{methodName:"wedaGetRecordsV2",defaultParams:{filter:{where:{}},select:{$master:!0}}}},S=function(e,t){var r=d(e,t);return new Proxy({},{get:function(a,c){if("string"==typeof c)return Object.prototype.hasOwnProperty.call(r,c)?r[c]:function(e,t,r){return new Proxy({},{get:function(a,c){var u=w[c];if(!u){var h=new Error("不支持的操作: ".concat(c));throw new s(h.message||"Unknown error occurred",{originError:h,code:"NotSupported",requestId:"N/A"})}return function(s){return o(void 0,0,void 0,function(){var o,a,h,d,f;return i(this,function(i){switch(i.label){case 0:return o=n(n({},u.defaultParams||{}),s||{}),[4,l({callFunction:t,dataSourceName:e,methodName:u.methodName,realMethodName:c,params:o,envType:null==s?void 0:s.envType,cloud:r})];case 1:return a=i.sent(),h={data:{}},d=u.responseKey,h.data=d?null===(f=null==a?void 0:a.data)||void 0===f?void 0:f[d]:null==a?void 0:a.data,[2,h]}})})}}})}(c,e,t)}})},I=function(){function e(e){var t=this;this.map=new Map,e&&(e instanceof Headers?e.forEach(function(e,r){t.append(r,e)}):Array.isArray(e)?e.forEach(function(e){var r=e[0],n=e[1];t.append(r,n)}):"object"==typeof e&&Object.keys(e).forEach(function(r){t.append(r,e[r])}))}return e.prototype.append=function(e,t){var r=e.toLowerCase(),n=this.map.get(r);n?this.map.set(r,"".concat(n,", ").concat(t)):this.map.set(r,String(t))},e.prototype.delete=function(e){this.map.delete(e.toLowerCase())},e.prototype.forEach=function(e,t){var r=this;this.map.forEach(function(n,o){e.call(t,n,o,r)})},e.prototype.get=function(e){return this.map.get(e.toLowerCase())||null},e.prototype.has=function(e){return this.map.has(e.toLowerCase())},e.prototype.set=function(e,t){this.map.set(e.toLowerCase(),String(t))},e.prototype.entries=function(){return this.map.entries()},e.prototype.keys=function(){return this.map.keys()},e.prototype.values=function(){return this.map.values()},e.prototype.getSetCookie=function(){var e=[];return this.map.forEach(function(t,r){"set-cookie"===r&&e.push(t)}),e},e.prototype.toJSON=function(){var e={};return this.map.forEach(function(t,r){e[r]=t}),e},e.prototype[Symbol.iterator]=function(){return this.entries()},e}();"object"!=typeof globalThis||globalThis.Headers||(globalThis.Headers=I);var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var E,O,R=function(e){try{return!!e()}catch(e){return!0}},C=!R(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),A=C,k=Function.prototype,U=k.call,q=A&&k.bind.bind(U,U),L=A?q:function(e){return function(){return U.apply(e,arguments)}},x=L,N=x({}.toString),j=x("".slice),D=function(e){return j(N(e),8,-1)},B=R,M=D,W=Object,F=L("".split),H=B(function(){return!W("z").propertyIsEnumerable(0)})?function(e){return"String"===M(e)?F(e,""):W(e)}:W,z=function(e){return null==e},V=z,G=TypeError,K=function(e){if(V(e))throw new G("Can't call method on "+e);return e},Y=H,Q=K,J=function(e){return Y(Q(e))},$={},Z=function(e){return e&&e.Math===Math&&e},X=Z("object"==typeof globalThis&&globalThis)||Z("object"==typeof window&&window)||Z("object"==typeof self&&self)||Z("object"==typeof T&&T)||Z("object"==typeof T&&T)||function(){return this}()||Function("return this")(),ee="object"==typeof document&&document.all,te=void 0===ee&&void 0!==ee?function(e){return"function"==typeof e||e===ee}:function(e){return"function"==typeof e},re=te,ne=X.WeakMap,oe=re(ne)&&/native code/.test(String(ne)),ie=te,se=function(e){return"object"==typeof e?null!==e:ie(e)},ae=!R(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),ce={},ue=se,le=X.document,he=ue(le)&&ue(le.createElement),de=function(e){return he?le.createElement(e):{}},fe=de,pe=!ae&&!R(function(){return 7!==Object.defineProperty(fe("div"),"a",{get:function(){return 7}}).a}),ve=ae&&R(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),ge=se,me=String,ye=TypeError,be=function(e){if(ge(e))return e;throw new ye(me(e)+" is not an object")},_e=C,we=Function.prototype.call,Se=_e?we.bind(we):function(){return we.apply(we,arguments)},Ie={},Te=Ie,Pe=X,Ee=te,Oe=function(e){return Ee(e)?e:void 0},Re=function(e,t){return arguments.length<2?Oe(Te[e])||Oe(Pe[e]):Te[e]&&Te[e][t]||Pe[e]&&Pe[e][t]},Ce=L({}.isPrototypeOf),Ae=X.navigator,ke=Ae&&Ae.userAgent,Ue=X,qe=ke?String(ke):"",Le=Ue.process,xe=Ue.Deno,Ne=Le&&Le.versions||xe&&xe.version,je=Ne&&Ne.v8;je&&(O=(E=je.split("."))[0]>0&&E[0]<4?1:+(E[0]+E[1])),!O&&qe&&(!(E=qe.match(/Edge\/(\d+)/))||E[1]>=74)&&(E=qe.match(/Chrome\/(\d+)/))&&(O=+E[1]);var De=O,Be=R,Me=X.String,We=!!Object.getOwnPropertySymbols&&!Be(function(){var e=Symbol("symbol detection");return!Me(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&De&&De<41}),Fe=We&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,He=Re,ze=te,Ve=Ce,Ge=Object,Ke=Fe?function(e){return"symbol"==typeof e}:function(e){var t=He("Symbol");return ze(t)&&Ve(t.prototype,Ge(e))},Ye=String,Qe=function(e){try{return Ye(e)}catch(e){return"Object"}},Je=te,$e=Qe,Ze=TypeError,Xe=function(e){if(Je(e))return e;throw new Ze($e(e)+" is not a function")},et=Xe,tt=z,rt=function(e,t){var r=e[t];return tt(r)?void 0:et(r)},nt=Se,ot=te,it=se,st=TypeError,at={exports:{}},ct=X,ut=Object.defineProperty,lt=X,ht=function(e,t){try{ut(ct,e,{value:t,configurable:!0,writable:!0})}catch(r){ct[e]=t}return t},dt="__core-js_shared__",ft=at.exports=lt[dt]||ht(dt,{});(ft.versions||(ft.versions=[])).push({version:"3.45.0",mode:"pure",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.45.0/LICENSE",source:"https://github.com/zloirock/core-js"});var pt=at.exports,vt=pt,gt=function(e,t){return vt[e]||(vt[e]=t||{})},mt=K,yt=Object,bt=function(e){return yt(mt(e))},_t=bt,wt=L({}.hasOwnProperty),St=Object.hasOwn||function(e,t){return wt(_t(e),t)},It=L,Tt=0,Pt=Math.random(),Et=It(1.1.toString),Ot=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Et(++Tt+Pt,36)},Rt=gt,Ct=St,At=Ot,kt=We,Ut=Fe,qt=X.Symbol,Lt=Rt("wks"),xt=Ut?qt.for||qt:qt&&qt.withoutSetter||At,Nt=function(e){return Ct(Lt,e)||(Lt[e]=kt&&Ct(qt,e)?qt[e]:xt("Symbol."+e)),Lt[e]},jt=Se,Dt=se,Bt=Ke,Mt=rt,Wt=function(e,t){var r,n;if("string"===t&&ot(r=e.toString)&&!it(n=nt(r,e)))return n;if(ot(r=e.valueOf)&&!it(n=nt(r,e)))return n;if("string"!==t&&ot(r=e.toString)&&!it(n=nt(r,e)))return n;throw new st("Can't convert object to primitive value")},Ft=TypeError,Ht=Nt("toPrimitive"),zt=function(e,t){if(!Dt(e)||Bt(e))return e;var r,n=Mt(e,Ht);if(n){if(void 0===t&&(t="default"),r=jt(n,e,t),!Dt(r)||Bt(r))return r;throw new Ft("Can't convert object to primitive value")}return void 0===t&&(t="number"),Wt(e,t)},Vt=Ke,Gt=function(e){var t=zt(e,"string");return Vt(t)?t:t+""},Kt=ae,Yt=pe,Qt=ve,Jt=be,$t=Gt,Zt=TypeError,Xt=Object.defineProperty,er=Object.getOwnPropertyDescriptor,tr="enumerable",rr="configurable",nr="writable";ce.f=Kt?Qt?function(e,t,r){if(Jt(e),t=$t(t),Jt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&nr in r&&!r[nr]){var n=er(e,t);n&&n[nr]&&(e[t]=r.value,r={configurable:rr in r?r[rr]:n[rr],enumerable:tr in r?r[tr]:n[tr],writable:!1})}return Xt(e,t,r)}:Xt:function(e,t,r){if(Jt(e),t=$t(t),Jt(r),Yt)try{return Xt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Zt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var or,ir,sr,ar=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},cr=ce,ur=ar,lr=ae?function(e,t,r){return cr.f(e,t,ur(1,r))}:function(e,t,r){return e[t]=r,e},hr=Ot,dr=gt("keys"),fr=function(e){return dr[e]||(dr[e]=hr(e))},pr={},vr=oe,gr=X,mr=se,yr=lr,br=St,_r=pt,wr=fr,Sr=pr,Ir="Object already initialized",Tr=gr.TypeError,Pr=gr.WeakMap;if(vr||_r.state){var Er=_r.state||(_r.state=new Pr);Er.get=Er.get,Er.has=Er.has,Er.set=Er.set,or=function(e,t){if(Er.has(e))throw new Tr(Ir);return t.facade=e,Er.set(e,t),t},ir=function(e){return Er.get(e)||{}},sr=function(e){return Er.has(e)}}else{var Or=wr("state");Sr[Or]=!0,or=function(e,t){if(br(e,Or))throw new Tr(Ir);return t.facade=e,yr(e,Or,t),t},ir=function(e){return br(e,Or)?e[Or]:{}},sr=function(e){return br(e,Or)}}var Rr={set:or,get:ir,has:sr,enforce:function(e){return sr(e)?ir(e):or(e,{})},getterFor:function(e){return function(t){var r;if(!mr(t)||(r=ir(t)).type!==e)throw new Tr("Incompatible receiver, "+e+" required");return r}}},Cr=C,Ar=Function.prototype,kr=Ar.apply,Ur=Ar.call,qr="object"==typeof Reflect&&Reflect.apply||(Cr?Ur.bind(kr):function(){return Ur.apply(kr,arguments)}),Lr=D,xr=L,Nr=function(e){if("Function"===Lr(e))return xr(e)},jr={},Dr={},Br={}.propertyIsEnumerable,Mr=Object.getOwnPropertyDescriptor,Wr=Mr&&!Br.call({1:2},1);Dr.f=Wr?function(e){var t=Mr(this,e);return!!t&&t.enumerable}:Br;var Fr=ae,Hr=Se,zr=Dr,Vr=ar,Gr=J,Kr=Gt,Yr=St,Qr=pe,Jr=Object.getOwnPropertyDescriptor;jr.f=Fr?Jr:function(e,t){if(e=Gr(e),t=Kr(t),Qr)try{return Jr(e,t)}catch(e){}if(Yr(e,t))return Vr(!Hr(zr.f,e,t),e[t])};var $r=R,Zr=te,Xr=/#|\.prototype\./,en=function(e,t){var r=rn[tn(e)];return r===on||r!==nn&&(Zr(t)?$r(t):!!t)},tn=en.normalize=function(e){return String(e).replace(Xr,".").toLowerCase()},rn=en.data={},nn=en.NATIVE="N",on=en.POLYFILL="P",sn=en,an=Xe,cn=C,un=Nr(Nr.bind),ln=function(e,t){return an(e),void 0===t?e:cn?un(e,t):function(){return e.apply(t,arguments)}},hn=X,dn=qr,fn=Nr,pn=te,vn=jr.f,gn=sn,mn=Ie,yn=ln,bn=lr,_n=St,wn=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return dn(e,this,arguments)};return t.prototype=e.prototype,t},Sn=function(e,t){var r,n,o,i,s,a,c,u,l,h=e.target,d=e.global,f=e.stat,p=e.proto,v=d?hn:f?hn[h]:hn[h]&&hn[h].prototype,g=d?mn:mn[h]||bn(mn,h,{})[h],m=g.prototype;for(i in t)n=!(r=gn(d?i:h+(f?".":"#")+i,e.forced))&&v&&_n(v,i),a=g[i],n&&(c=e.dontCallGetSet?(l=vn(v,i))&&l.value:v[i]),s=n&&c?c:t[i],(r||p||typeof a!=typeof s)&&(u=e.bind&&n?yn(s,hn):e.wrap&&n?wn(s):p&&pn(s)?fn(s):s,(e.sham||s&&s.sham||a&&a.sham)&&bn(u,"sham",!0),bn(g,i,u),p&&(_n(mn,o=h+"Prototype")||bn(mn,o,{}),bn(mn[o],i,s),e.real&&m&&(r||!m[i])&&bn(m,i,s)))},In=ae,Tn=St,Pn=Function.prototype,En=In&&Object.getOwnPropertyDescriptor,On=Tn(Pn,"name"),Rn={EXISTS:On,PROPER:On&&"something"===function(){}.name,CONFIGURABLE:On&&(!In||In&&En(Pn,"name").configurable)},Cn={},An=Math.ceil,kn=Math.floor,Un=Math.trunc||function(e){var t=+e;return(t>0?kn:An)(t)},qn=Un,Ln=function(e){var t=+e;return t!=t||0===t?0:qn(t)},xn=Ln,Nn=Math.max,jn=Math.min,Dn=function(e,t){var r=xn(e);return r<0?Nn(r+t,0):jn(r,t)},Bn=Ln,Mn=Math.min,Wn=function(e){var t=Bn(e);return t>0?Mn(t,9007199254740991):0},Fn=function(e){return Wn(e.length)},Hn=J,zn=Dn,Vn=Fn,Gn=function(e){return function(t,r,n){var o=Hn(t),i=Vn(o);if(0===i)return!e&&-1;var s,a=zn(n,i);if(e&&r!=r){for(;i>a;)if((s=o[a++])!=s)return!0}else for(;i>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},Kn={includes:Gn(!0),indexOf:Gn(!1)},Yn=St,Qn=J,Jn=Kn.indexOf,$n=pr,Zn=L([].push),Xn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],eo=function(e,t){var r,n=Qn(e),o=0,i=[];for(r in n)!Yn($n,r)&&Yn(n,r)&&Zn(i,r);for(;t.length>o;)Yn(n,r=t[o++])&&(~Jn(i,r)||Zn(i,r));return i},to=Xn,ro=Object.keys||function(e){return eo(e,to)},no=ae,oo=ve,io=ce,so=be,ao=J,co=ro;Cn.f=no&&!oo?Object.defineProperties:function(e,t){so(e);for(var r,n=ao(t),o=co(t),i=o.length,s=0;i>s;)io.f(e,r=o[s++],n[r]);return e};var uo,lo=Re("document","documentElement"),ho=be,fo=Cn,po=Xn,vo=pr,go=lo,mo=de,yo="prototype",bo="script",_o=fr("IE_PROTO"),wo=function(){},So=function(e){return"<"+bo+">"+e+"</"+bo+">"},Io=function(e){e.write(So("")),e.close();var t=e.parentWindow.Object;return e=null,t},To=function(){try{uo=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;To="undefined"!=typeof document?document.domain&&uo?Io(uo):(t=mo("iframe"),r="java"+bo+":",t.style.display="none",go.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(So("document.F=Object")),e.close(),e.F):Io(uo);for(var n=po.length;n--;)delete To[yo][po[n]];return To()};vo[_o]=!0;var Po,Eo,Oo,Ro=Object.create||function(e,t){var r;return null!==e?(wo[yo]=ho(e),r=new wo,wo[yo]=null,r[_o]=e):r=To(),void 0===t?r:fo.f(r,t)},Co=!R(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ao=St,ko=te,Uo=bt,qo=Co,Lo=fr("IE_PROTO"),xo=Object,No=xo.prototype,jo=qo?xo.getPrototypeOf:function(e){var t=Uo(e);if(Ao(t,Lo))return t[Lo];var r=t.constructor;return ko(r)&&t instanceof r?r.prototype:t instanceof xo?No:null},Do=lr,Bo=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Do(e,t,r),e},Mo=R,Wo=te,Fo=se,Ho=Ro,zo=jo,Vo=Bo,Go=Nt("iterator"),Ko=!1;[].keys&&("next"in(Oo=[].keys())?(Eo=zo(zo(Oo)))!==Object.prototype&&(Po=Eo):Ko=!0);var Yo=!Fo(Po)||Mo(function(){var e={};return Po[Go].call(e)!==e});Wo((Po=Yo?{}:Ho(Po))[Go])||Vo(Po,Go,function(){return this});var Qo={IteratorPrototype:Po,BUGGY_SAFARI_ITERATORS:Ko},Jo={};Jo[Nt("toStringTag")]="z";var $o="[object z]"===String(Jo),Zo=$o,Xo=te,ei=D,ti=Nt("toStringTag"),ri=Object,ni="Arguments"===ei(function(){return arguments}()),oi=Zo?ei:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=ri(e),ti))?r:ni?ei(t):"Object"===(n=ei(t))&&Xo(t.callee)?"Arguments":n},ii=oi,si=$o?{}.toString:function(){return"[object "+ii(this)+"]"},ai=$o,ci=ce.f,ui=lr,li=St,hi=si,di=Nt("toStringTag"),fi=function(e,t,r,n){var o=r?e:e&&e.prototype;o&&(li(o,di)||ci(o,di,{configurable:!0,value:t}),n&&!ai&&ui(o,"toString",hi))},pi=Qo.IteratorPrototype,vi=Ro,gi=ar,mi=fi,yi=$,bi=function(){return this},_i=function(e,t,r,n){var o=t+" Iterator";return e.prototype=vi(pi,{next:gi(+!n,r)}),mi(e,o,!1,!0),yi[o]=bi,e},wi=Sn,Si=Se,Ii=Rn,Ti=_i,Pi=jo,Ei=fi,Oi=Bo,Ri=$,Ci=Qo,Ai=Ii.PROPER,ki=Ci.BUGGY_SAFARI_ITERATORS,Ui=Nt("iterator"),qi="keys",Li="values",xi="entries",Ni=function(){return this},ji=function(e,t,r,n,o,i,s){Ti(r,t,n);var a,c,u,l=function(e){if(e===o&&v)return v;if(!ki&&e&&e in f)return f[e];switch(e){case qi:case Li:case xi:return function(){return new r(this,e)}}return function(){return new r(this)}},h=t+" Iterator",d=!1,f=e.prototype,p=f[Ui]||f["@@iterator"]||o&&f[o],v=!ki&&p||l(o),g="Array"===t&&f.entries||p;if(g&&(a=Pi(g.call(new e)))!==Object.prototype&&a.next&&(Ei(a,h,!0,!0),Ri[h]=Ni),Ai&&o===Li&&p&&p.name!==Li&&(d=!0,v=function(){return Si(p,this)}),o)if(c={values:l(Li),keys:i?v:l(qi),entries:l(xi)},s)for(u in c)(ki||d||!(u in f))&&Oi(f,u,c[u]);else wi({target:t,proto:!0,forced:ki||d},c);return s&&f[Ui]!==v&&Oi(f,Ui,v,{name:o}),Ri[t]=v,c},Di=function(e,t){return{value:e,done:t}},Bi=J,Mi=$,Wi=Rr;ce.f;var Fi=ji,Hi=Di,zi="Array Iterator",Vi=Wi.set,Gi=Wi.getterFor(zi);Fi(Array,"Array",function(e,t){Vi(this,{type:zi,target:Bi(e),index:0,kind:t})},function(){var e=Gi(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,Hi(void 0,!0);switch(e.kind){case"keys":return Hi(r,!1);case"values":return Hi(t[r],!1)}return Hi([r,t[r]],!1)},"values"),Mi.Arguments=Mi.Array;var Ki=Sn,Yi=L,Qi=Dn,Ji=RangeError,$i=String.fromCharCode,Zi=String.fromCodePoint,Xi=Yi([].join);Ki({target:"String",stat:!0,arity:1,forced:!!Zi&&1!==Zi.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,o=0;n>o;){if(t=+arguments[o++],Qi(t,1114111)!==t)throw new Ji(t+" is not a valid code point");r[o]=t<65536?$i(t):$i(55296+((t-=65536)>>10),t%1024+56320)}return Xi(r,"")}});var es=X,ts=ae,rs=Object.getOwnPropertyDescriptor,ns=R,os=!0,is=Nt("iterator"),ss=!ns(function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return e.pathname="c%20d",t.forEach(function(e,r){t.delete("b"),n+=r+e}),r.delete("a",2),r.delete("b",void 0),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b")||!t.size&&os||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[is]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==n||"x"!==new URL("https://x",void 0).host}),as=ce,cs=function(e,t,r){return as.f(e,t,r)},us=Bo,ls=Ce,hs=TypeError,ds=function(e,t){if(ls(t,e))return e;throw new hs("Incorrect invocation")},fs=oi,ps=String,vs=function(e){if("Symbol"===fs(e))throw new TypeError("Cannot convert a Symbol value to a string");return ps(e)},gs=oi,ms=rt,ys=z,bs=$,_s=Nt("iterator"),ws=function(e){if(!ys(e))return ms(e,_s)||ms(e,"@@iterator")||bs[gs(e)]},Ss=Se,Is=Xe,Ts=be,Ps=Qe,Es=ws,Os=TypeError,Rs=function(e,t){var r=arguments.length<2?Es(e):t;if(Is(r))return Ts(Ss(r,e));throw new Os(Ps(e)+" is not iterable")},Cs=TypeError,As=function(e,t){if(e<t)throw new Cs("Not enough arguments");return e},ks=L([].slice),Us=ks,qs=Math.floor,Ls=function(e,t){var r=e.length;if(r<8)for(var n,o,i=1;i<r;){for(o=i,n=e[i];o&&t(e[o-1],n)>0;)e[o]=e[--o];o!==i++&&(e[o]=n)}else for(var s=qs(r/2),a=Ls(Us(e,0,s),t),c=Ls(Us(e,s),t),u=a.length,l=c.length,h=0,d=0;h<u||d<l;)e[h+d]=h<u&&d<l?t(a[h],c[d])<=0?a[h++]:c[d++]:h<u?a[h++]:c[d++];return e},xs=Sn,Ns=X,js=function(e){if(!ts)return es[e];var t=rs(es,e);return t&&t.value},Ds=Re,Bs=Se,Ms=L,Ws=ae,Fs=ss,Hs=Bo,zs=cs,Vs=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:us(e,n,t[n],r);return e},Gs=fi,Ks=_i,Ys=Rr,Qs=ds,Js=te,$s=St,Zs=ln,Xs=oi,ea=be,ta=se,ra=vs,na=Ro,oa=ar,ia=Rs,sa=ws,aa=Di,ca=As,ua=Ls,la=Nt("iterator"),ha="URLSearchParams",da=ha+"Iterator",fa=Ys.set,pa=Ys.getterFor(ha),va=Ys.getterFor(da),ga=js("fetch"),ma=js("Request"),ya=js("Headers"),ba=ma&&ma.prototype,_a=ya&&ya.prototype,wa=Ns.TypeError,Sa=Ns.encodeURIComponent,Ia=String.fromCharCode,Ta=Ds("String","fromCodePoint"),Pa=parseInt,Ea=Ms("".charAt),Oa=Ms([].join),Ra=Ms([].push),Ca=Ms("".replace),Aa=Ms([].shift),ka=Ms([].splice),Ua=Ms("".split),qa=Ms("".slice),La=Ms(/./.exec),xa=/\+/g,Na=/^[0-9a-f]+$/i,ja=function(e,t){var r=qa(e,t,t+2);return La(Na,r)?Pa(r,16):NaN},Da=function(e){for(var t=0,r=128;r>0&&0!==(e&r);r>>=1)t++;return t},Ba=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},Ma=function(e){for(var t=(e=Ca(e,xa," ")).length,r="",n=0;n<t;){var o=Ea(e,n);if("%"===o){if("%"===Ea(e,n+1)||n+3>t){r+="%",n++;continue}var i=ja(e,n+1);if(i!=i){r+=o,n++;continue}n+=2;var s=Da(i);if(0===s)o=Ia(i);else{if(1===s||s>4){r+="�",n++;continue}for(var a=[i],c=1;c<s&&!(++n+3>t||"%"!==Ea(e,n));){var u=ja(e,n+1);if(u!=u){n+=3;break}if(u>191||u<128)break;Ra(a,u),n+=2,c++}if(a.length!==s){r+="�";continue}var l=Ba(a);null===l?r+="�":o=Ta(l)}}r+=o,n++}return r},Wa=/[!'()~]|%20/g,Fa={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Ha=function(e){return Fa[e]},za=function(e){return Ca(Sa(e),Wa,Ha)},Va=Ks(function(e,t){fa(this,{type:da,target:pa(e).entries,index:0,kind:t})},ha,function(){var e=va(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,aa(void 0,!0);var n=t[r];switch(e.kind){case"keys":return aa(n.key,!1);case"values":return aa(n.value,!1)}return aa([n.key,n.value],!1)},!0),Ga=function(e){this.entries=[],this.url=null,void 0!==e&&(ta(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Ea(e,0)?qa(e,1):e:ra(e)))};Ga.prototype={type:ha,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,o,i,s,a,c=this.entries,u=sa(e);if(u)for(r=(t=ia(e,u)).next;!(n=Bs(r,t)).done;){if(i=(o=ia(ea(n.value))).next,(s=Bs(i,o)).done||(a=Bs(i,o)).done||!Bs(i,o).done)throw new wa("Expected sequence with length 2");Ra(c,{key:ra(s.value),value:ra(a.value)})}else for(var l in e)$s(e,l)&&Ra(c,{key:l,value:ra(e[l])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,o=Ua(e,"&"),i=0;i<o.length;)(t=o[i++]).length&&(r=Ua(t,"="),Ra(n,{key:Ma(Aa(r)),value:Ma(Oa(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],Ra(r,za(e.key)+"="+za(e.value));return Oa(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Ka=function(){Qs(this,Ya);var e=fa(this,new Ga(arguments.length>0?arguments[0]:void 0));Ws||(this.size=e.entries.length)},Ya=Ka.prototype;if(Vs(Ya,{append:function(e,t){var r=pa(this);ca(arguments.length,2),Ra(r.entries,{key:ra(e),value:ra(t)}),Ws||this.length++,r.updateURL()},delete:function(e){for(var t=pa(this),r=ca(arguments.length,1),n=t.entries,o=ra(e),i=r<2?void 0:arguments[1],s=void 0===i?i:ra(i),a=0;a<n.length;){var c=n[a];if(c.key!==o||void 0!==s&&c.value!==s)a++;else if(ka(n,a,1),void 0!==s)break}Ws||(this.size=n.length),t.updateURL()},get:function(e){var t=pa(this).entries;ca(arguments.length,1);for(var r=ra(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=pa(this).entries;ca(arguments.length,1);for(var r=ra(e),n=[],o=0;o<t.length;o++)t[o].key===r&&Ra(n,t[o].value);return n},has:function(e){for(var t=pa(this).entries,r=ca(arguments.length,1),n=ra(e),o=r<2?void 0:arguments[1],i=void 0===o?o:ra(o),s=0;s<t.length;){var a=t[s++];if(a.key===n&&(void 0===i||a.value===i))return!0}return!1},set:function(e,t){var r=pa(this);ca(arguments.length,1);for(var n,o=r.entries,i=!1,s=ra(e),a=ra(t),c=0;c<o.length;c++)(n=o[c]).key===s&&(i?ka(o,c--,1):(i=!0,n.value=a));i||Ra(o,{key:s,value:a}),Ws||(this.size=o.length),r.updateURL()},sort:function(){var e=pa(this);ua(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,r=pa(this).entries,n=Zs(e,arguments.length>1?arguments[1]:void 0),o=0;o<r.length;)n((t=r[o++]).value,t.key,this)},keys:function(){return new Va(this,"keys")},values:function(){return new Va(this,"values")},entries:function(){return new Va(this,"entries")}},{enumerable:!0}),Hs(Ya,la,Ya.entries,{name:"entries"}),Hs(Ya,"toString",function(){return pa(this).serialize()},{enumerable:!0}),Ws&&zs(Ya,"size",{get:function(){return pa(this).entries.length},configurable:!0,enumerable:!0}),Gs(Ka,ha),xs({global:!0,constructor:!0,forced:!Fs},{URLSearchParams:Ka}),!Fs&&Js(ya)){var Qa=Ms(_a.has),Ja=Ms(_a.set),$a=function(e){if(ta(e)){var t,r=e.body;if(Xs(r)===ha)return t=e.headers?new ya(e.headers):new ya,Qa(t,"content-type")||Ja(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),na(e,{body:oa(0,ra(r)),headers:oa(0,t)})}return e};if(Js(ga)&&xs({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return ga(e,arguments.length>1?$a(arguments[1]):{})}}),Js(ma)){var Za=function(e){return Qs(this,ba),new ma(e,arguments.length>1?$a(arguments[1]):{})};ba.constructor=Za,Za.prototype=ba,xs({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Za})}}var Xa={URLSearchParams:Ka,getState:pa},ec=L,tc=Ln,rc=vs,nc=K,oc=ec("".charAt),ic=ec("".charCodeAt),sc=ec("".slice),ac=function(e){return function(t,r){var n,o,i=rc(nc(t)),s=tc(r),a=i.length;return s<0||s>=a?e?"":void 0:(n=ic(i,s))<55296||n>56319||s+1===a||(o=ic(i,s+1))<56320||o>57343?e?oc(i,s):n:e?sc(i,s,s+2):o-56320+(n-55296<<10)+65536}},cc={codeAt:ac(!1),charAt:ac(!0)},uc=cc.charAt,lc=vs,hc=Rr,dc=ji,fc=Di,pc="String Iterator",vc=hc.set,gc=hc.getterFor(pc);dc(String,"String",function(e){vc(this,{type:pc,string:lc(e),index:0})},function(){var e,t=gc(this),r=t.string,n=t.index;return n>=r.length?fc(void 0,!0):(e=uc(r,n),t.index+=e.length,fc(e,!1))});var mc={};mc.f=Object.getOwnPropertySymbols;var yc=ae,bc=L,_c=Se,wc=R,Sc=ro,Ic=mc,Tc=Dr,Pc=bt,Ec=H,Oc=Object.assign,Rc=Object.defineProperty,Cc=bc([].concat),Ac=!Oc||wc(function(){if(yc&&1!==Oc({b:1},Oc(Rc({},"a",{enumerable:!0,get:function(){Rc(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!==Oc({},e)[r]||Sc(Oc({},t)).join("")!==n})?function(e,t){for(var r=Pc(e),n=arguments.length,o=1,i=Ic.f,s=Tc.f;n>o;)for(var a,c=Ec(arguments[o++]),u=i?Cc(Sc(c),i(c)):Sc(c),l=u.length,h=0;l>h;)a=u[h++],yc&&!_c(s,c,a)||(r[a]=c[a]);return r}:Oc,kc=Se,Uc=be,qc=rt,Lc=be,xc=function(e,t,r){var n,o;Uc(e);try{if(!(n=qc(e,"return"))){if("throw"===t)throw r;return r}n=kc(n,e)}catch(e){o=!0,n=e}if("throw"===t)throw r;if(o)throw n;return Uc(n),r},Nc=$,jc=Nt("iterator"),Dc=Array.prototype,Bc=te,Mc=pt,Wc=L(Function.toString);Bc(Mc.inspectSource)||(Mc.inspectSource=function(e){return Wc(e)});var Fc=Mc.inspectSource,Hc=L,zc=R,Vc=te,Gc=oi,Kc=Fc,Yc=function(){},Qc=Re("Reflect","construct"),Jc=/^\s*(?:class|function)\b/,$c=Hc(Jc.exec),Zc=!Jc.test(Yc),Xc=function(e){if(!Vc(e))return!1;try{return Qc(Yc,[],e),!0}catch(e){return!1}},eu=function(e){if(!Vc(e))return!1;switch(Gc(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Zc||!!$c(Jc,Kc(e))}catch(e){return!0}};eu.sham=!0;var tu,ru=!Qc||zc(function(){var e;return Xc(Xc.call)||!Xc(Object)||!Xc(function(){e=!0})||e})?eu:Xc,nu=ae,ou=ce,iu=ar,su=ln,au=Se,cu=bt,uu=function(e,t,r,n){try{return n?t(Lc(r)[0],r[1]):t(r)}catch(t){xc(e,"throw",t)}},lu=function(e){return void 0!==e&&(Nc.Array===e||Dc[jc]===e)},hu=ru,du=Fn,fu=function(e,t,r){nu?ou.f(e,t,iu(0,r)):e[t]=r},pu=Rs,vu=ws,gu=Array,mu=L,yu=2147483647,bu=/[^\0-\u007E]/,_u=/[.\u3002\uFF0E\uFF61]/g,wu="Overflow: input needs wider integers to process",Su=RangeError,Iu=mu(_u.exec),Tu=Math.floor,Pu=String.fromCharCode,Eu=mu("".charCodeAt),Ou=mu([].join),Ru=mu([].push),Cu=mu("".replace),Au=mu("".split),ku=mu("".toLowerCase),Uu=function(e){return e+22+75*(e<26)},qu=function(e,t,r){var n=0;for(e=r?Tu(e/700):e>>1,e+=Tu(e/t);e>455;)e=Tu(e/35),n+=36;return Tu(n+36*e/(e+38))},Lu=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var o=Eu(e,r++);if(o>=55296&&o<=56319&&r<n){var i=Eu(e,r++);56320==(64512&i)?Ru(t,((1023&o)<<10)+(1023&i)+65536):(Ru(t,o),r--)}else Ru(t,o)}return t}(e);var r,n,o=e.length,i=128,s=0,a=72;for(r=0;r<e.length;r++)(n=e[r])<128&&Ru(t,Pu(n));var c=t.length,u=c;for(c&&Ru(t,"-");u<o;){var l=yu;for(r=0;r<e.length;r++)(n=e[r])>=i&&n<l&&(l=n);var h=u+1;if(l-i>Tu((yu-s)/h))throw new Su(wu);for(s+=(l-i)*h,i=l,r=0;r<e.length;r++){if((n=e[r])<i&&++s>yu)throw new Su(wu);if(n===i){for(var d=s,f=36;;){var p=f<=a?1:f>=a+26?26:f-a;if(d<p)break;var v=d-p,g=36-p;Ru(t,Pu(Uu(p+v%g))),d=Tu(v/g),f+=36}Ru(t,Pu(Uu(d))),a=qu(s,h,u===c),s=0,u++}}s++,i++}return Ou(t,"")},xu=Sn,Nu=ae,ju=ss,Du=X,Bu=ln,Mu=L,Wu=Bo,Fu=cs,Hu=ds,zu=St,Vu=Ac,Gu=function(e){var t=cu(e),r=hu(this),n=arguments.length,o=n>1?arguments[1]:void 0,i=void 0!==o;i&&(o=su(o,n>2?arguments[2]:void 0));var s,a,c,u,l,h,d=vu(t),f=0;if(!d||this===gu&&lu(d))for(s=du(t),a=r?new this(s):gu(s);s>f;f++)h=i?o(t[f],f):t[f],fu(a,f,h);else for(a=r?new this:[],l=(u=pu(t,d)).next;!(c=au(l,u)).done;f++)h=i?uu(u,o,[c.value,f],!0):c.value,fu(a,f,h);return a.length=f,a},Ku=ks,Yu=cc.codeAt,Qu=function(e){var t,r,n=[],o=Au(Cu(ku(e),_u,"."),".");for(t=0;t<o.length;t++)r=o[t],Ru(n,Iu(bu,r)?"xn--"+Lu(r):r);return Ou(n,".")},Ju=vs,$u=fi,Zu=As,Xu=Xa,el=Rr,tl=el.set,rl=el.getterFor("URL"),nl=Xu.URLSearchParams,ol=Xu.getState,il=Du.URL,sl=Du.TypeError,al=Du.parseInt,cl=Math.floor,ul=Math.pow,ll=Mu("".charAt),hl=Mu(/./.exec),dl=Mu([].join),fl=Mu(1.1.toString),pl=Mu([].pop),vl=Mu([].push),gl=Mu("".replace),ml=Mu([].shift),yl=Mu("".split),bl=Mu("".slice),_l=Mu("".toLowerCase),wl=Mu([].unshift),Sl="Invalid scheme",Il="Invalid host",Tl="Invalid port",Pl=/[a-z]/i,El=/[\d+-.a-z]/i,Ol=/\d/,Rl=/^0x/i,Cl=/^[0-7]+$/,Al=/^\d+$/,kl=/^[\da-f]+$/i,Ul=/[\0\t\n\r #%/:<>?@[\\\]^|]/,ql=/[\0\t\n\r #/:<>?@[\\\]^|]/,Ll=/^[\u0000-\u0020]+/,xl=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Nl=/[\t\n\r]/g,jl=function(e){var t,r,n,o;if("number"==typeof e){for(t=[],r=0;r<4;r++)wl(t,e%256),e=cl(e/256);return dl(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,o=0,i=0;i<8;i++)0!==e[i]?(o>r&&(t=n,r=o),n=null,o=0):(null===n&&(n=i),++o);return o>r?n:t}(e),r=0;r<8;r++)o&&0===e[r]||(o&&(o=!1),n===r?(t+=r?":":"::",o=!0):(t+=fl(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Dl={},Bl=Vu({},Dl,{" ":1,'"':1,"<":1,">":1,"`":1}),Ml=Vu({},Bl,{"#":1,"?":1,"{":1,"}":1}),Wl=Vu({},Ml,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Fl=function(e,t){var r=Yu(e,0);return r>32&&r<127&&!zu(t,e)?e:encodeURIComponent(e)},Hl={ftp:21,file:null,http:80,https:443,ws:80,wss:443},zl=function(e,t){var r;return 2===e.length&&hl(Pl,ll(e,0))&&(":"===(r=ll(e,1))||!t&&"|"===r)},Vl=function(e){var t;return e.length>1&&zl(bl(e,0,2))&&(2===e.length||"/"===(t=ll(e,2))||"\\"===t||"?"===t||"#"===t)},Gl=function(e){return"."===e||"%2e"===_l(e)},Kl=function(e){return".."===(e=_l(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},Yl={},Ql={},Jl={},$l={},Zl={},Xl={},eh={},th={},rh={},nh={},oh={},ih={},sh={},ah={},ch={},uh={},lh={},hh={},dh={},fh={},ph={},vh=function(e,t,r){var n,o,i,s=Ju(e);if(t){if(o=this.parse(s))throw new sl(o);this.searchParams=null}else{if(void 0!==r&&(n=new vh(r,!0)),o=this.parse(s,null,n))throw new sl(o);(i=ol(new nl)).bindURL(this),this.searchParams=i}};vh.prototype={type:"URL",parse:function(e,t,r){var n,o,i,s,a=this,c=t||Yl,u=0,l="",h=!1,d=!1,f=!1;for(e=Ju(e),t||(a.scheme="",a.username="",a.password="",a.host=null,a.port=null,a.path=[],a.query=null,a.fragment=null,a.cannotBeABaseURL=!1,e=gl(e,Ll,""),e=gl(e,xl,"$1")),e=gl(e,Nl,""),n=Gu(e);u<=n.length;){switch(o=n[u],c){case Yl:if(!o||!hl(Pl,o)){if(t)return Sl;c=Jl;continue}l+=_l(o),c=Ql;break;case Ql:if(o&&(hl(El,o)||"+"===o||"-"===o||"."===o))l+=_l(o);else{if(":"!==o){if(t)return Sl;l="",c=Jl,u=0;continue}if(t&&(a.isSpecial()!==zu(Hl,l)||"file"===l&&(a.includesCredentials()||null!==a.port)||"file"===a.scheme&&!a.host))return;if(a.scheme=l,t)return void(a.isSpecial()&&Hl[a.scheme]===a.port&&(a.port=null));l="","file"===a.scheme?c=ah:a.isSpecial()&&r&&r.scheme===a.scheme?c=$l:a.isSpecial()?c=th:"/"===n[u+1]?(c=Zl,u++):(a.cannotBeABaseURL=!0,vl(a.path,""),c=dh)}break;case Jl:if(!r||r.cannotBeABaseURL&&"#"!==o)return Sl;if(r.cannotBeABaseURL&&"#"===o){a.scheme=r.scheme,a.path=Ku(r.path),a.query=r.query,a.fragment="",a.cannotBeABaseURL=!0,c=ph;break}c="file"===r.scheme?ah:Xl;continue;case $l:if("/"!==o||"/"!==n[u+1]){c=Xl;continue}c=rh,u++;break;case Zl:if("/"===o){c=nh;break}c=hh;continue;case Xl:if(a.scheme=r.scheme,o===tu)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Ku(r.path),a.query=r.query;else if("/"===o||"\\"===o&&a.isSpecial())c=eh;else if("?"===o)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Ku(r.path),a.query="",c=fh;else{if("#"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Ku(r.path),a.path.length--,c=hh;continue}a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Ku(r.path),a.query=r.query,a.fragment="",c=ph}break;case eh:if(!a.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,c=hh;continue}c=nh}else c=rh;break;case th:if(c=rh,"/"!==o||"/"!==ll(l,u+1))continue;u++;break;case rh:if("/"!==o&&"\\"!==o){c=nh;continue}break;case nh:if("@"===o){h&&(l="%40"+l),h=!0,i=Gu(l);for(var p=0;p<i.length;p++){var v=i[p];if(":"!==v||f){var g=Fl(v,Wl);f?a.password+=g:a.username+=g}else f=!0}l=""}else if(o===tu||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(h&&""===l)return"Invalid authority";u-=Gu(l).length+1,l="",c=oh}else l+=o;break;case oh:case ih:if(t&&"file"===a.scheme){c=uh;continue}if(":"!==o||d){if(o===tu||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(a.isSpecial()&&""===l)return Il;if(t&&""===l&&(a.includesCredentials()||null!==a.port))return;if(s=a.parseHost(l))return s;if(l="",c=lh,t)return;continue}"["===o?d=!0:"]"===o&&(d=!1),l+=o}else{if(""===l)return Il;if(s=a.parseHost(l))return s;if(l="",c=sh,t===ih)return}break;case sh:if(!hl(Ol,o)){if(o===tu||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()||t){if(""!==l){var m=al(l,10);if(m>65535)return Tl;a.port=a.isSpecial()&&m===Hl[a.scheme]?null:m,l=""}if(t)return;c=lh;continue}return Tl}l+=o;break;case ah:if(a.scheme="file","/"===o||"\\"===o)c=ch;else{if(!r||"file"!==r.scheme){c=hh;continue}switch(o){case tu:a.host=r.host,a.path=Ku(r.path),a.query=r.query;break;case"?":a.host=r.host,a.path=Ku(r.path),a.query="",c=fh;break;case"#":a.host=r.host,a.path=Ku(r.path),a.query=r.query,a.fragment="",c=ph;break;default:Vl(dl(Ku(n,u),""))||(a.host=r.host,a.path=Ku(r.path),a.shortenPath()),c=hh;continue}}break;case ch:if("/"===o||"\\"===o){c=uh;break}r&&"file"===r.scheme&&!Vl(dl(Ku(n,u),""))&&(zl(r.path[0],!0)?vl(a.path,r.path[0]):a.host=r.host),c=hh;continue;case uh:if(o===tu||"/"===o||"\\"===o||"?"===o||"#"===o){if(!t&&zl(l))c=hh;else if(""===l){if(a.host="",t)return;c=lh}else{if(s=a.parseHost(l))return s;if("localhost"===a.host&&(a.host=""),t)return;l="",c=lh}continue}l+=o;break;case lh:if(a.isSpecial()){if(c=hh,"/"!==o&&"\\"!==o)continue}else if(t||"?"!==o)if(t||"#"!==o){if(o!==tu&&(c=hh,"/"!==o))continue}else a.fragment="",c=ph;else a.query="",c=fh;break;case hh:if(o===tu||"/"===o||"\\"===o&&a.isSpecial()||!t&&("?"===o||"#"===o)){if(Kl(l)?(a.shortenPath(),"/"===o||"\\"===o&&a.isSpecial()||vl(a.path,"")):Gl(l)?"/"===o||"\\"===o&&a.isSpecial()||vl(a.path,""):("file"===a.scheme&&!a.path.length&&zl(l)&&(a.host&&(a.host=""),l=ll(l,0)+":"),vl(a.path,l)),l="","file"===a.scheme&&(o===tu||"?"===o||"#"===o))for(;a.path.length>1&&""===a.path[0];)ml(a.path);"?"===o?(a.query="",c=fh):"#"===o&&(a.fragment="",c=ph)}else l+=Fl(o,Ml);break;case dh:"?"===o?(a.query="",c=fh):"#"===o?(a.fragment="",c=ph):o!==tu&&(a.path[0]+=Fl(o,Dl));break;case fh:t||"#"!==o?o!==tu&&("'"===o&&a.isSpecial()?a.query+="%27":a.query+="#"===o?"%23":Fl(o,Dl)):(a.fragment="",c=ph);break;case ph:o!==tu&&(a.fragment+=Fl(o,Bl))}u++}},parseHost:function(e){var t,r,n;if("["===ll(e,0)){if("]"!==ll(e,e.length-1))return Il;if(t=function(e){var t,r,n,o,i,s,a,c=[0,0,0,0,0,0,0,0],u=0,l=null,h=0,d=function(){return ll(e,h)};if(":"===d()){if(":"!==ll(e,1))return;h+=2,l=++u}for(;d();){if(8===u)return;if(":"!==d()){for(t=r=0;r<4&&hl(kl,d());)t=16*t+al(d(),16),h++,r++;if("."===d()){if(0===r)return;if(h-=r,u>6)return;for(n=0;d();){if(o=null,n>0){if(!("."===d()&&n<4))return;h++}if(!hl(Ol,d()))return;for(;hl(Ol,d());){if(i=al(d(),10),null===o)o=i;else{if(0===o)return;o=10*o+i}if(o>255)return;h++}c[u]=256*c[u]+o,2!==++n&&4!==n||u++}if(4!==n)return;break}if(":"===d()){if(h++,!d())return}else if(d())return;c[u++]=t}else{if(null!==l)return;h++,l=++u}}if(null!==l)for(s=u-l,u=7;0!==u&&s>0;)a=c[u],c[u--]=c[l+s-1],c[l+--s]=a;else if(8!==u)return;return c}(bl(e,1,-1)),!t)return Il;this.host=t}else if(this.isSpecial()){if(e=Qu(e),hl(Ul,e))return Il;if(t=function(e){var t,r,n,o,i,s,a,c=yl(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""===(o=c[n]))return e;if(i=10,o.length>1&&"0"===ll(o,0)&&(i=hl(Rl,o)?16:8,o=bl(o,8===i?1:2)),""===o)s=0;else{if(!hl(10===i?Al:8===i?Cl:kl,o))return e;s=al(o,i)}vl(r,s)}for(n=0;n<t;n++)if(s=r[n],n===t-1){if(s>=ul(256,5-t))return null}else if(s>255)return null;for(a=pl(r),n=0;n<r.length;n++)a+=r[n]*ul(256,3-n);return a}(e),null===t)return Il;this.host=t}else{if(hl(ql,e))return Il;for(t="",r=Gu(e),n=0;n<r.length;n++)t+=Fl(r[n],Dl);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return zu(Hl,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&zl(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,o=e.host,i=e.port,s=e.path,a=e.query,c=e.fragment,u=t+":";return null!==o?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=jl(o),null!==i&&(u+=":"+i)):"file"===t&&(u+="//"),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+dl(s,"/"):"",null!==a&&(u+="?"+a),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw new sl(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new gh(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+jl(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Ju(e)+":",Yl)},getUsername:function(){return this.username},setUsername:function(e){var t=Gu(Ju(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Fl(t[r],Wl)}},getPassword:function(){return this.password},setPassword:function(e){var t=Gu(Ju(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Fl(t[r],Wl)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?jl(e):jl(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,oh)},getHostname:function(){var e=this.host;return null===e?"":jl(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,ih)},getPort:function(){var e=this.port;return null===e?"":Ju(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=Ju(e))?this.port=null:this.parse(e,sh))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+dl(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,lh))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=Ju(e))?this.query=null:("?"===ll(e,0)&&(e=bl(e,1)),this.query="",this.parse(e,fh)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=Ju(e))?("#"===ll(e,0)&&(e=bl(e,1)),this.fragment="",this.parse(e,ph)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var gh=function(e){var t=Hu(this,mh),r=Zu(arguments.length,1)>1?arguments[1]:void 0,n=tl(t,new vh(e,!1,r));Nu||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},mh=gh.prototype,yh=function(e,t){return{get:function(){return rl(this)[e]()},set:t&&function(e){return rl(this)[t](e)},configurable:!0,enumerable:!0}};if(Nu&&(Fu(mh,"href",yh("serialize","setHref")),Fu(mh,"origin",yh("getOrigin")),Fu(mh,"protocol",yh("getProtocol","setProtocol")),Fu(mh,"username",yh("getUsername","setUsername")),Fu(mh,"password",yh("getPassword","setPassword")),Fu(mh,"host",yh("getHost","setHost")),Fu(mh,"hostname",yh("getHostname","setHostname")),Fu(mh,"port",yh("getPort","setPort")),Fu(mh,"pathname",yh("getPathname","setPathname")),Fu(mh,"search",yh("getSearch","setSearch")),Fu(mh,"searchParams",yh("getSearchParams")),Fu(mh,"hash",yh("getHash","setHash"))),Wu(mh,"toJSON",function(){return rl(this).serialize()},{enumerable:!0}),Wu(mh,"toString",function(){return rl(this).serialize()},{enumerable:!0}),il){var bh=il.createObjectURL,_h=il.revokeObjectURL;bh&&Wu(gh,"createObjectURL",Bu(bh,il)),_h&&Wu(gh,"revokeObjectURL",Bu(_h,il))}$u(gh,"URL"),xu({global:!0,constructor:!0,forced:!ju,sham:!Nu},{URL:gh});var wh=Sn,Sh=R,Ih=As,Th=vs,Ph=ss,Eh=Re("URL"),Oh=Ph&&Sh(function(){Eh.canParse()}),Rh=Sh(function(){return 1!==Eh.canParse.length});wh({target:"URL",stat:!0,forced:!Oh||Rh},{canParse:function(e){var t=Ih(arguments.length,1),r=Th(e),n=t<2||void 0===arguments[1]?void 0:Th(arguments[1]);try{return!!new Eh(r,n)}catch(e){return!1}}});var Ch=Sn,Ah=As,kh=vs,Uh=ss,qh=Re("URL");Ch({target:"URL",stat:!0,forced:!Uh},{parse:function(e){var t=Ah(arguments.length,1),r=kh(e),n=t<2||void 0===arguments[1]?void 0:kh(arguments[1]);try{return new qh(r,n)}catch(e){return null}}});var Lh=P(Ie.URL),xh=function(e){function t(t){var r=e.call(this,t.message)||this;return r.name="PostgrestError",r.details=t.details,r.hint=t.hint,r.code=t.code,r}return r(t,e),t}(Error),Nh=function(){function e(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,e.fetch?this.fetch=e.fetch:this.fetch=fetch}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.setHeader=function(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this},e.prototype.then=function(e,t){var r=this;void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");var n=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(function(e){return o(r,0,void 0,function(){var t,r,n,o,s,a,c,u,l,h,d,f;return i(this,function(i){switch(i.label){case 0:return t=null,r=null,n=null,o=e.status,s=e.statusText,e.ok?"HEAD"===this.method?[3,2]:[4,e.text()]:[3,3];case 1:""===(u=i.sent())||(r="text/csv"===this.headers.get("Accept")||this.headers.get("Accept")&&(null===(l=this.headers.get("Accept"))||void 0===l?void 0:l.includes("application/vnd.pgrst.plan+text"))?u:JSON.parse(u)),i.label=2;case 2:return a=null===(h=this.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),c=null===(d=e.headers.get("content-range"))||void 0===d?void 0:d.split("/"),a&&c&&c.length>1&&(n=parseInt(c[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(r)&&(r.length>1?(t={code:"PGRST116",details:"Results contain ".concat(r.length," rows, application/vnd.pgrst.object+json requires 1 row"),hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,n=null,o=406,s="Not Acceptable"):r=1===r.length?r[0]:null),[3,5];case 3:return[4,e.text()];case 4:u=i.sent();try{t=JSON.parse(u),Array.isArray(t)&&404===e.status&&(r=[],t=null,o=200,s="OK")}catch(r){404===e.status&&""===u?(o=204,s="No Content"):t={message:u}}if(t&&this.isMaybeSingle&&(null===(f=null==t?void 0:t.details)||void 0===f?void 0:f.includes("0 rows"))&&(t=null,o=200,s="OK"),t&&this.shouldThrowOnError)throw new xh(t);i.label=5;case 5:return[2,{error:t,data:r,count:n,status:o,statusText:s}]}})})});return this.shouldThrowOnError||(n=n.catch(function(e){var t,r,n;return{error:{message:"".concat(null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError",": ").concat(null==e?void 0:e.message),details:"".concat(null!==(r=null==e?void 0:e.stack)&&void 0!==r?r:""),hint:"",code:"".concat(null!==(n=null==e?void 0:e.code)&&void 0!==n?n:"")},data:null,count:null,status:0,statusText:""}})),n.then(e,t)},e.prototype.returns=function(){return this},e.prototype.overrideTypes=function(){return this},e}(),jh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.select=function(e){var t=!1,r=(null!=e?e:"*").split("").map(function(e){return/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)}).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this},t.prototype.order=function(e,t){var r=void 0===t?{}:t,n=r.ascending,o=void 0===n||n,i=r.nullsFirst,s=r.foreignTable,a=r.referencedTable,c=void 0===a?s:a,u=c?"".concat(c,".order"):"order",l=this.url.searchParams.get(u);return this.url.searchParams.set(u,"".concat(l?"".concat(l,","):"").concat(e,".").concat(o?"asc":"desc").concat(void 0===i?"":i?".nullsfirst":".nullslast")),this},t.prototype.limit=function(e,t){var r=void 0===t?{}:t,n=r.foreignTable,o=r.referencedTable,i=void 0===o?n:o,s=void 0===i?"limit":"".concat(i,".limit");return this.url.searchParams.set(s,"".concat(e)),this},t.prototype.range=function(e,t,r){var n=void 0===r?{}:r,o=n.foreignTable,i=n.referencedTable,s=void 0===i?o:i,a=void 0===s?"offset":"".concat(s,".offset"),c=void 0===s?"limit":"".concat(s,".limit");return this.url.searchParams.set(a,"".concat(e)),this.url.searchParams.set(c,"".concat(t-e+1)),this},t.prototype.abortSignal=function(e){return this.signal=e,this},t.prototype.single=function(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this},t.prototype.maybeSingle=function(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this},t.prototype.csv=function(){return this.headers.set("Accept","text/csv"),this},t.prototype.geojson=function(){return this.headers.set("Accept","application/geo+json"),this},t.prototype.explain=function(e){var t,r=void 0===e?{}:e,n=r.analyze,o=void 0!==n&&n,i=r.verbose,s=void 0!==i&&i,a=r.settings,c=void 0!==a&&a,u=r.buffers,l=void 0!==u&&u,h=r.wal,d=void 0!==h&&h,f=r.format,p=void 0===f?"text":f,v=[o?"analyze":null,s?"verbose":null,c?"settings":null,l?"buffers":null,d?"wal":null].filter(Boolean).join("|"),g=null!==(t=this.headers.get("Accept"))&&void 0!==t?t:"application/json";return this.headers.set("Accept","application/vnd.pgrst.plan+".concat(p,'; for="').concat(g,'"; options=').concat(v,";")),this},t.prototype.rollback=function(){return this.headers.append("Prefer","tx=rollback"),this},t.prototype.returns=function(){return this},t.prototype.maxAffected=function(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer","max-affected=".concat(e)),this},t}(Nh),Dh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.eq=function(e,t){return this.url.searchParams.append(e,"eq.".concat(t)),this},t.prototype.neq=function(e,t){return this.url.searchParams.append(e,"neq.".concat(t)),this},t.prototype.gt=function(e,t){return this.url.searchParams.append(e,"gt.".concat(t)),this},t.prototype.gte=function(e,t){return this.url.searchParams.append(e,"gte.".concat(t)),this},t.prototype.lt=function(e,t){return this.url.searchParams.append(e,"lt.".concat(t)),this},t.prototype.lte=function(e,t){return this.url.searchParams.append(e,"lte.".concat(t)),this},t.prototype.like=function(e,t){return this.url.searchParams.append(e,"like.".concat(t)),this},t.prototype.likeAllOf=function(e,t){return this.url.searchParams.append(e,"like(all).{".concat(t.join(","),"}")),this},t.prototype.likeAnyOf=function(e,t){return this.url.searchParams.append(e,"like(any).{".concat(t.join(","),"}")),this},t.prototype.ilike=function(e,t){return this.url.searchParams.append(e,"ilike.".concat(t)),this},t.prototype.ilikeAllOf=function(e,t){return this.url.searchParams.append(e,"ilike(all).{".concat(t.join(","),"}")),this},t.prototype.ilikeAnyOf=function(e,t){return this.url.searchParams.append(e,"ilike(any).{".concat(t.join(","),"}")),this},t.prototype.is=function(e,t){return this.url.searchParams.append(e,"is.".concat(t)),this},t.prototype.in=function(e,t){var r=Array.from(new Set(t)).map(function(e){return"string"==typeof e&&new RegExp("[,()]").test(e)?'"'.concat(e,'"'):"".concat(e)}).join(",");return this.url.searchParams.append(e,"in.(".concat(r,")")),this},t.prototype.contains=function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cs.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cs.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cs.".concat(JSON.stringify(t))),this},t.prototype.containedBy=function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cd.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cd.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cd.".concat(JSON.stringify(t))),this},t.prototype.rangeGt=function(e,t){return this.url.searchParams.append(e,"sr.".concat(t)),this},t.prototype.rangeGte=function(e,t){return this.url.searchParams.append(e,"nxl.".concat(t)),this},t.prototype.rangeLt=function(e,t){return this.url.searchParams.append(e,"sl.".concat(t)),this},t.prototype.rangeLte=function(e,t){return this.url.searchParams.append(e,"nxr.".concat(t)),this},t.prototype.rangeAdjacent=function(e,t){return this.url.searchParams.append(e,"adj.".concat(t)),this},t.prototype.overlaps=function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"ov.".concat(t)):this.url.searchParams.append(e,"ov.{".concat(t.join(","),"}")),this},t.prototype.textSearch=function(e,t,r){var n=void 0===r?{}:r,o=n.config,i=n.type,s="";"plain"===i?s="pl":"phrase"===i?s="ph":"websearch"===i&&(s="w");var a=void 0===o?"":"(".concat(o,")");return this.url.searchParams.append(e,"".concat(s,"fts").concat(a,".").concat(t)),this},t.prototype.match=function(e){var t=this;return Object.entries(e).forEach(function(e){var r=e[0],n=e[1];t.url.searchParams.append(r,"eq.".concat(n))}),this},t.prototype.not=function(e,t,r){return this.url.searchParams.append(e,"not.".concat(t,".").concat(r)),this},t.prototype.or=function(e,t){var r=void 0===t?{}:t,n=r.foreignTable,o=r.referencedTable,i=void 0===o?n:o,s=i?"".concat(i,".or"):"or";return this.url.searchParams.append(s,"(".concat(e,")")),this},t.prototype.filter=function(e,t,r){return this.url.searchParams.append(e,"".concat(t,".").concat(r)),this},t}(jh),Bh=function(){function e(e,t){var r=t.headers,n=void 0===r?{}:r,o=t.schema,i=t.fetch;this.url=e,this.headers=new Headers(n),this.schema=o,this.fetch=i}return e.prototype.select=function(e,t){var r=void 0===t?{}:t,n=r.head,o=void 0!==n&&n,i=r.count,s=o?"HEAD":"GET",a=!1,c=(null!=e?e:"*").split("").map(function(e){return/\s/.test(e)&&!a?"":('"'===e&&(a=!a),e)}).join("");return this.url.searchParams.set("select",c),i&&this.headers.append("Prefer","count=".concat(i)),new Dh({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})},e.prototype.insert=function(e,t){var r,n=void 0===t?{}:t,o=n.count,i=n.defaultToNull,s=void 0===i||i;if(o&&this.headers.append("Prefer","count=".concat(o)),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){var a=e.reduce(function(e,t){return e.concat(Object.keys(t))},[]);if(a.length>0){var c=Array.from(new Set(a)).map(function(e){return'"'.concat(e,'"')});this.url.searchParams.set("columns",c.join(","))}}return new Dh({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch})},e.prototype.upsert=function(e,t){var r,n=void 0===t?{}:t,o=n.onConflict,i=n.ignoreDuplicates,s=void 0!==i&&i,a=n.count,c=n.defaultToNull,u=void 0===c||c;if(this.headers.append("Prefer","resolution=".concat(s?"ignore":"merge","-duplicates")),void 0!==o&&this.url.searchParams.set("on_conflict",o),a&&this.headers.append("Prefer","count=".concat(a)),u||this.headers.append("Prefer","missing=default"),Array.isArray(e)){var l=e.reduce(function(e,t){return e.concat(Object.keys(t))},[]);if(l.length>0){var h=Array.from(new Set(l)).map(function(e){return'"'.concat(e,'"')});this.url.searchParams.set("columns",h.join(","))}}return new Dh({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch})},e.prototype.update=function(e,t){var r,n=(void 0===t?{}:t).count;return n&&this.headers.append("Prefer","count=".concat(n)),new Dh({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch})},e.prototype.delete=function(e){var t,r=(void 0===e?{}:e).count;return r&&this.headers.append("Prefer","count=".concat(r)),new Dh({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch})},e}(),Mh=function(e){function t(t,r){var n=r.headers,o=void 0===n?{}:n,i=r.fetch;return e.call(this,t,{headers:o,schema:void 0,fetch:i})||this}return r(t,e),t}(Bh),Wh=function(){function e(e,t){var r=void 0===t?{}:t,n=r.headers,o=void 0===n?{}:n,i=r.fetch;this.url=e,this.headers=new Headers(o),this.fetch=i}return e.prototype.from=function(e){var t=new Lh("".concat(this.url,"/").concat(e));return new Mh(t,{headers:this.headers,fetch:this.fetch})},e}();function Fh(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function zh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hh(Object(r),!0).forEach(function(t){Fh(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Vh="/auth";var Gh,Kh,Yh,Qh;!function(e){e.AUTH_SIGN_UP_URL="/v1/signup",e.AUTH_TOKEN_URL="/v1/token",e.AUTH_REVOKE_URL="/v1/revoke",e.WEDA_USER_URL="/v1/plugin/weda/userinfo",e.AUTH_RESET_PASSWORD="/v1/reset",e.AUTH_GET_DEVICE_CODE="/v1/device/code",e.CHECK_USERNAME="/v1/checkUsername",e.CHECK_IF_USER_EXIST="/v1/checkIfUserExist",e.GET_PROVIDER_TYPE="/v1/mgr/provider/providerSubType",e.AUTH_SIGN_IN_URL="/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v1/signin/with/provider",e.AUTH_SIGN_IN_WITH_WECHAT_URL="/v1/signin/wechat/noauth",e.AUTH_SIGN_IN_CUSTOM="/v1/signin/custom",e.PROVIDER_TOKEN_URL="/v1/provider/token",e.PROVIDER_URI_URL="/v1/provider/uri",e.USER_ME_URL="/v1/user/me",e.AUTH_SIGNOUT_URL="/v1/user/signout",e.USER_QUERY_URL="/v1/user/query",e.USER_PRIFILE_URL="/v1/user/profile",e.USER_BASIC_EDIT_URL="/v1/user/basic/edit",e.USER_TRANS_BY_PROVIDER_URL="/v1/user/trans/by/provider",e.PROVIDER_LIST="/v1/user/provider",e.PROVIDER_BIND_URL="/v1/user/provider/bind",e.PROVIDER_UNBIND_URL="/v1/user/provider",e.CHECK_PWD_URL="/v1/user/sudo",e.SUDO_URL="/v1/user/sudo",e.BIND_CONTACT_URL="/v1/user/contact",e.AUTH_SET_PASSWORD="/v1/user/password",e.AUTHORIZE_DEVICE_URL="/v1/user/device/authorize",e.AUTHORIZE_URL="/v1/user/authorize",e.AUTHORIZE_INFO_URL="/v1/user/authorize/info",e.AUTHORIZED_DEVICES_DELETE_URL="/v1/user/authorized/devices/",e.AUTH_REVOKE_ALL_URL="/v1/user/revoke/all",e.GET_USER_BEHAVIOR_LOG="/v1/user/security/history",e.VERIFICATION_URL="/v1/verification",e.VERIFY_URL="/v1/verification/verify",e.CAPTCHA_DATA_URL="/v1/captcha/data",e.VERIFY_CAPTCHA_DATA_URL="/v1/captcha/data/verify",e.GET_CAPTCHA_URL="/v1/captcha/init",e.GET_MINIPROGRAM_QRCODE="/v1/qrcode/generate",e.GET_MINIPROGRAM_QRCODE_STATUS="/v1/qrcode/get/status"}(Gh||(Gh={})),function(e){e.AUTH_SIGN_IN_URL="/v2/signin/username",e.AUTH_TOKEN_URL="/v2/token",e.USER_ME_URL="/v2/user/me",e.VERIFY_URL="/v2/signin/verificationcode",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v2/signin/with/provider",e.AUTH_PUBLIC_KEY="/v2/signin/publichkey",e.AUTH_RESET_PASSWORD="/v2/signin/password/update"}(Kh||(Kh={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(Yh||(Yh={})),function(e){e.UNREACHABLE="unreachable",e.LOCAL="local",e.CANCELLED="cancelled",e.UNKNOWN="unknown",e.UNAUTHENTICATED="unauthenticated",e.RESOURCE_EXHAUSTED="resource_exhausted",e.FAILED_PRECONDITION="failed_precondition",e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.INVALID_PASSWORD="invalid_password",e.PASSWORD_NOT_SET="password_not_set",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked",e.INVALID_VERIFICATION_CODE="invalid_verification_code",e.TWO_FACTOR_REQUIRED="two_factor_required",e.INVALID_TWO_FACTOR="invalid_two_factor",e.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",e.UNDER_REVIEW="under_review",e.INVALID_REQUEST="invalid_request",e.UNAUTHORIZED_CLIENT="unauthorized_client",e.ACCESS_DENIED="access_denied",e.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",e.INVALID_SCOPE="invalid_scope",e.INVALID_GRANT="invalid_grant",e.SERVER_ERROR="server_error",e.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",e.INTERACTION_REQUIRED="interaction_required",e.LOGIN_REQUIRED="login_required",e.ACCOUNT_SELECTION_REQUIRED="account_selection_required",e.CONSENT_REQUIRED="consent_required",e.INVALID_REQUEST_URI="invalid_request_uri",e.INVALID_REQUEST_OBJECT="invalid_request_object",e.REQUEST_NOT_SUPPORTED="request_not_supported",e.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",e.REGISTRATION_NOT_SUPPORTED="registration_not_supported",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid"}(Qh||(Qh={}));const Jh="sign_out",$h="sign_in",Zh="credentials_error",Xh="SIGNED_OUT",ed="SIGNED_IN",td="INITIAL_SESSION",rd="PASSWORD_RECOVERY",nd="TOKEN_REFRESHED",od="USER_UPDATED",id="BIND_IDENTITY",sd="loginStateChanged",ad="authStateChanged",cd="sign_in",ud="bind_identity";var ld;function hd(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}!function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(ld||(ld={}));const dd=e=>{const t=t=>{for(const r in e)e.hasOwnProperty(r)&&(t[r]=dd(e[r]));return t},r=null==e?"NullOrUndefined":Object.prototype.toString.call(e).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(r))return e.slice();switch(r){case"Object":return t(Object.create(Object.getPrototypeOf(e)));case"Array":return t([]);case"Date":return new Date(e.valueOf());case"RegExp":return new RegExp(e.source,(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":""));default:return e}},fd=e=>{const t=e.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return t&&t[2]||""};let pd=new Map;class vd{constructor(e){this.clientId=(null==e?void 0:e.clientId)||"",pd=pd||new Map}async run(e,t){e="".concat(this.clientId,"_").concat(e);let r=pd.get(e);return r||(r=new Promise((r,n)=>{(async()=>{try{await this.runIdlePromise();const e=t();r(await e)}catch(e){n(e)}finally{pd.delete(e)}})()}),pd.set(e,r)),r}runIdlePromise(){return Promise.resolve()}}const gd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",md=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;const yd=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!md.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");let t;e+="==".slice(2-(3&e.length));let r,n,o="",i=0;for(;i<e.length;)t=gd.indexOf(e.charAt(i++))<<18|gd.indexOf(e.charAt(i++))<<12|(r=gd.indexOf(e.charAt(i++)))<<6|(n=gd.indexOf(e.charAt(i++))),o+=64===r?String.fromCharCode(t>>16&255):64===n?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o};function bd(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(yd(e).replace(/(.)/g,e=>{let t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0".concat(t)),"%".concat(t)}))}(t)}catch(e){return yd(t)}}function _d(){if("undefined"==typeof globalThis)return!1;const{wx:e}=globalThis;if(void 0===e)return!1;if(void 0===globalThis.Page)return!1;if(!e.getDeviceInfo)return!1;if(!e.getStorageSync)return!1;if(!e.setStorageSync)return!1;if(!e.connectSocket)return!1;if(!e.request)return!1;try{if(!e.getDeviceInfo())return!1;if("qq"===e.getDeviceInfo().platform)return!1}catch(e){return!1}return!0}let wd=!1;function Sd(){wd=wd||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{_d()||(wd=wd||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?Sd():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",Sd,!1))}catch(lf){}var Id,Td="undefined"!=typeof process&&void 0!==process.env&&"development"===process.env.NODE_ENV,Pd="https://support.qq.com/products/148793",Ed="INVALID_PARAMS",Od="INVALID_OPERATION",Rd="OPERATION_FAIL";!function(e){e.local="local",e.none="none",e.session="session"}(Id||(Id={}));var Cd=function(){},Ad=function(){},kd=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};function Ud(e,t){if("undefined"==typeof window)return!1;var r=decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""}function qd(e,t){console.warn("[".concat("@cloudbase/js-sdk","][").concat(e,"]:").concat(t))}function Ld(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat("@cloudbase/js-sdk","][").concat(e,"]:").concat(t)}))}function xd(e){var t,r=e.title,n=e.subtitle,o=void 0===n?"":n,i=e.content,s=void 0===i?[]:i,a=e.printTrace,c=void 0!==a&&a,u=e.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(r,o):(console.group||console.error)(r,o);for(var l=0,h=s;l<h.length;l++){var d=h[l],f=d.type,p=d.body;switch(f){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}c&&(console.trace||console.log)("stack trace:"),null===(t=console.groupEnd)||void 0===t||t.call(console)}function Nd(e){var t={},r=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){e=r[1];var n=r[2];n&&(t=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach(function(e){var r=e.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(t[n]?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o)}),t}(n))}var o=t.token,i=kd(t,["token"]);return/^data:/.test(e)&&!o?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:o?{state:i.state,token:o,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}}var jd=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Dd=this&&this.__assign||function(){return Dd=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Dd.apply(this,arguments)},Bd=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})},Md=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Wd=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return jd(t,e),t.prototype.get=function(e){return this.request(Dd(Dd({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(Dd(Dd({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(Dd(Dd({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,i=e.headers,s=void 0===i?{}:i,a={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",c=new FormData;return"post"===a?(Object.keys(t).forEach(function(e){c.append(e,t[e])}),c.append("key",n),c.append("file",r),this.request(Dd(Dd({},e),{data:c,method:a}),this.restrictedMethods.includes("upload"))):this.request(Dd(Dd({},e),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return Bd(this,void 0,void 0,function(){var t,r,n,o;return Md(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(Dd(Dd({},e),{headers:{},responseType:"blob"}))];case 1:return t=i.sent().data,r=window.URL.createObjectURL(new Blob([t])),n=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){var t;return Bd(this,void 0,void 0,function(){var r,n,o,i,s,a,c,u,l,h,d,f,p,v=this;return Md(this,function(g){switch(g.label){case 0:return r=new AbortController,n=e.url,o=e.enableAbort,i=void 0!==o&&o,s=e.stream,a=void 0!==s&&s,c=e.signal,u=e.timeout,l=e.shouldThrowOnError,h=void 0===l||l,d=null!=u?u:this.timeout,c&&(c.aborted&&r.abort(),c.addEventListener("abort",function(){return r.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(v.timeoutMsg),r.abort(new Error(v.timeoutMsg))},d)),[4,fetch(n,Dd(Dd({},e),{signal:r.signal})).then(function(e){return Bd(v,void 0,void 0,function(){var t,r,n;return Md(this,function(o){switch(o.label){case 0:return clearTimeout(f),h?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return n=(r=Promise).reject,[4,e.json()];case 2:t=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){if(clearTimeout(f),h)return Promise.reject(e)})];case 1:return p=g.sent(),[2,{data:a?p.body:(null===(t=p.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?p.json():p.text(),statusCode:p.status,header:p.headers}]}})})},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise(function(o){var i,s,a,c=e.url,u=e.headers,l=void 0===u?{}:u,h=e.data,d=e.responseType,f=e.withCredentials,p=e.body,v=e.onUploadProgress,g=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach(function(e){""===o?!n&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(r[e]))}),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)}("https:",c,"get"===n?h:{}),m=new XMLHttpRequest;m.open(n,g),d&&(m.responseType=d),Object.keys(l).forEach(function(e){m.setRequestHeader(e,l[e])}),v&&m.upload.addEventListener("progress",v),m.onreadystatechange=function(){var e={};if(4===m.readyState){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach(function(e){var t=e.split(": "),n=t.shift().toLowerCase(),o=t.join(": ");r[n]=o}),e.header=r,e.statusCode=m.status;try{e.data="blob"===d?m.response:JSON.parse(m.responseText)}catch(t){e.data="blob"===d?m.response:m.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout(function(){console.warn(r.timeoutMsg),m.abort()},r.timeout)),a=h,s="[object FormData]"===Object.prototype.toString.call(a)?h:"application/x-www-form-urlencoded"===l["content-type"]?function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach(function(r){t.push("".concat(r,"=").concat(encodeURIComponent(e[r])))}),t.join("&")}(h):p||(h?JSON.stringify(h):void 0),f&&(m.withCredentials=!0),m.send(s)})},t}(Cd);var Fd,Hd=this&&this.__assign||function(){return Hd=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Hd.apply(this,arguments)};function zd(){return{adapter:Hd({},{type:"default",root:window,reqClass:Wd,wsClass:WebSocket,localStorage:localStorage}),runtime:Fd.WEB}}!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Fd||(Fd={}));var Vd=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gd=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})},Kd=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Yd=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return Vd(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(Ad);var Qd=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:(qd(Ed,"localStorage is not supported on current platform"),new Yd(t.root));case"none":return new Yd(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(JSON.stringify({code:Rd,msg:"[".concat("@cloudbase/js-sdk","][").concat(Rd,"]setStore failed"),info:e}))}}else qd(Od,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return Gd(this,void 0,void 0,function(){var n;return Kd(this,function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}qd(Od,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return Gd(this,void 0,void 0,function(){var n;return Kd(this,function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(n=o.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,""]}})})},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):qd(Od,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return Gd(this,void 0,void 0,function(){return Kd(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})},e}(),Jd=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$d=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};var Zd=function(e,t){this.data=t||null,this.name=e},Xd=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return Jd(t,e),t}(Zd),ef=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(function(e,t){return e instanceof t}(e,Xd))return console.error(e.error),this;var r="string"==typeof e?new Zd(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,i=this.listeners[n]?$d([],this.listeners[n],!0):[];o<i.length;o++){i[o].call(this,r)}}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}(),tf=new ef,rf=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})},nf=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},of=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(of=-1!==navigator.userAgent.indexOf("Firefox"));var sf=of?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,af=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function cf(e){var t=e.mode,r=void 0===t?"async":t,n=e.customInfo,o=void 0===n?{}:n,i=e.title,s=e.messages,a=void 0===s?[]:s;return function(e,t,n){if(Td){var s=o.className||e.constructor.name,c=o.methodName||t,u=n.value,l=function(e){var t="",r=e.stack.split("\n"),n=r.findIndex(function(e){return sf.test(e)});if(-1!==n){var o=af.exec(r[n+1]||"");t=o?o[0]:""}return t}(new Error);n.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=uf({err:new Error,className:s,methodName:c,sourceLink:l});try{return u.apply(this,e)}catch(e){var n=e,o=e.message,h=e.error,d=e.error_description,f={title:i||"".concat(s,".").concat(c," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var p=JSON.parse(o);f.subtitle=o,p.code&&(r?(r.code=p.code,r.msg=p.msg):(e.code=p.code,e.message=p.msg),n=r||e,f.content=a.map(function(e){return{type:"info",body:e}}))}throw h&&d&&(f.subtitle=d,r?(r.code=h,r.msg=d):(e.code=h,e.message=d),n=r||e,f.content=a.map(function(e){return{type:"info",body:e}})),xd(f),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return rf(this,void 0,void 0,function(){var t,r,n,o,h,d,f,p;return nf(this,function(v){switch(v.label){case 0:t=uf({err:new Error,className:s,methodName:c,sourceLink:l}),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,u.apply(this,e)];case 2:return[2,v.sent()];case 3:throw r=v.sent(),n=r,o=r.message,h=r.error,d=r.error_description,f={title:i||"".concat(s,".").concat(c," failed"),content:[{type:"error",body:r}]},o&&/^\{.*\}$/.test(o)&&(p=JSON.parse(o),f.subtitle=p,p.code&&(t?(t.code=p.code,t.message=p.msg):(r.code=p.code,r.message=p.msg),n=t||r,f.content=a.map(function(e){return{type:"info",body:e}}))),h&&d&&(f.subtitle=d,t?(t.code=h,t.msg=d):(r.code=h,r.message=d),n=t||r,f.content=a.map(function(e){return{type:"info",body:e}})),xd(f),n;case 4:return[2]}})})}}}}function uf(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,s=t.stack.split("\n"),a=of?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),c=of?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),u=s.findIndex(function(e){return a.test(e)});if(-1!==u){var l=s.filter(function(e,t){return t>u});l.unshift(s[u].replace(c,"".concat(r,".").concat(n)).replace(af,o)),(i=new Error).stack="".concat(of?"@debugger":"Error","\n").concat(l.join("\n"))}return i}function lf(e){this.message=e}function hf(e){this.message=e}lf.prototype=new Error,lf.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),hf.prototype=new Error,hf.prototype.name="InvalidTokenError";const df="x-request-id",ff="x-device-id",pf="device_id",vf=async function(e,t){let r=null,n=null;try{const o=Object.assign({},t);o.method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body));const i=await fetch(e,o),s=await i.json();null!=s&&s.error?(n=s,n.error_uri=new URL(e).pathname):r=s}catch(t){n={error:Qh.UNREACHABLE,error_description:t.message,error_uri:new URL(e).pathname}}if(n)throw n;return r};const gf=new class{constructor(e){this._env=(null==e?void 0:e.env)||""}async getItem(e){return window.localStorage.getItem("".concat(e).concat(this._env))}async removeItem(e){window.localStorage.removeItem("".concat(e).concat(this._env))}async setItem(e,t){window.localStorage.setItem("".concat(e).concat(this._env),t)}getItemSync(e){return window.localStorage.getItem("".concat(e).concat(this._env))}removeItemSync(e){window.localStorage.removeItem("".concat(e).concat(this._env))}setItemSync(e,t){window.localStorage.setItem("".concat(e).concat(this._env),t)}};function mf(e){let t=!0;return null!=e&&e.expires_at&&null!=e&&e.access_token&&(t=e.expires_at<new Date),t}class yf{constructor(e){this.credentials=null,this.accessKeyCredentials=null,this.singlePromise=null,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage,this.clientId=e.clientId,this.singlePromise=new vd({clientId:this.clientId}),this.credentials=e.credentials||null}getStorageCredentialsSync(){let e=null;const t=this.storage.getItemSync(this.tokenSectionName);if(null!=t)try{var r;e=JSON.parse(t),null!==(r=e)&&void 0!==r&&r.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){this.storage.removeItem(this.tokenSectionName),e=null}return e}async setCredentials(e){if(null!=e&&e.expires_in){if(null!=e&&e.expires_at||(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30))),this.storage){const t=JSON.stringify(e);await this.storage.setItem(this.tokenSectionName,t)}this.credentials=e}else this.storage&&await this.storage.removeItem(this.tokenSectionName),this.credentials=null}setAccessKeyCredentials(e){this.accessKeyCredentials=e}async getCredentials(){return this.singlePromise.run("getCredentials",async()=>{if(mf(this.credentials)){const{credentials:e,isAccessKeyCredentials:t}=await this.getStorageCredentials();if(t)return e;this.credentials=e}return this.credentials})}async getStorageCredentials(){return this.singlePromise.run("_getStorageCredentials",async()=>{let e=null,t=!1;const r=await this.storage.getItem(this.tokenSectionName);if(r)try{var n;e=JSON.parse(r),null!==(n=e)&&void 0!==n&&n.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){await this.storage.removeItem(this.tokenSectionName),e=null}else e=this.accessKeyCredentials||null,t=!0;return{credentials:e,isAccessKeyCredentials:t}})}}class bf{constructor(e){var t;this.initializePromise=null,this.lockAcquired=!1,this.pendingInLock=[],this.singlePromise=null,e.clientSecret||(e.clientSecret=""),!e.clientId&&e.env&&(e.clientId=e.env),this.apiOrigin=e.apiOrigin,this.apiPath=e.apiPath||Vh,this.clientId=e.clientId,this.i18n=e.i18n,this.eventBus=e.eventBus,this.singlePromise=new vd({clientId:this.clientId}),this.retry=this.formatRetry(e.retry,bf.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=vf,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||gf,this.localCredentials=new yf({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage,clientId:e.clientId}),this.clientSecret=e.clientSecret,e.clientId&&(this.basicAuth="Basic ".concat(function(e){let t,r,n,o,i="",s=0;const a=(e=String(e)).length%3;for(;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");t=r<<16|n<<8|o,i+=gd.charAt(t>>18&63)+gd.charAt(t>>12&63)+gd.charAt(t>>6&63)+gd.charAt(63&t)}return a?i.slice(0,a-3)+"===".substring(a):i}("".concat(e.clientId,":").concat(this.clientSecret)))),this.wxCloud=e.wxCloud;try{_d()&&(this.useWxCloud=e.useWxCloud,void 0===this.wxCloud&&e.env&&(wx.cloud.init({env:e.env}),this.wxCloud=wx.cloud))}catch(e){}this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc,this.onCredentialsError=e.onCredentialsError,this.getInitialSession=e.getInitialSession,this.onInitialSessionObtained=e.onInitialSessionObtained,this.logDebugMessages=null!==(t=e.debug)&&void 0!==t&&t,tf.on("lang_change",e=>{var t;this.i18n=(null===(t=e.data)||void 0===t?void 0:t.i18n)||this.i18n})}setGetInitialSession(e){this.getInitialSession=e}setOnInitialSessionObtained(e){this.onInitialSessionObtained=e}async initialize(e){return this.initializePromise?await this.initializePromise:void 0!==e?(this.initializePromise=e,await this.initializePromise):(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async setCredentials(e){return await this.initializePromise,this._acquireLock(-1,async()=>this.localCredentials.setCredentials(e))}setAccessKeyCredentials(e){return this.localCredentials.setAccessKeyCredentials(e)}async getAccessToken(){await this.initializePromise;const e=await this.getCredentials();if(null!=e&&e.access_token)return Promise.resolve(e.access_token);const t={error:Qh.UNAUTHENTICATED};return Promise.reject(t)}async request(e,t){var r,n,o,i;t||(t={});const s=this.formatRetry(t.retry,this.retry);if(t.headers=zh(zh({},t.headers),{},{[null===(r=this.i18n)||void 0===r?void 0:r.LANG_HEADER_KEY]:null===(n=this.i18n)||void 0===n?void 0:n.lang}),this.headers&&(t.headers=zh(zh({},this.headers),t.headers)),t.headers[df]||(t.headers[df]=hd()),!t.headers[ff]){const e=await this.getDeviceId();t.headers[ff]=e}if(null!==(o=t)&&void 0!==o&&o.withBasicAuth&&this.basicAuth&&(t.headers.Authorization=this.basicAuth),null!==(i=t)&&void 0!==i&&i.withCredentials){const r=t.getCredentials?await t.getCredentials():await this.getCredentials();r&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(r.access_token)):t.headers.Authorization="".concat(r.token_type," ").concat(r.access_token))}else this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId));e.startsWith("/")&&(e="".concat(this.apiOrigin).concat(this.apiPath).concat(e));let a=null;const c=s+1;for(let r=0;r<c;r++){try{var u;if(a=t.useWxCloud||this.useWxCloud?await this.wxCloudCallFunction(e,t):await this.baseRequest(e,t),null!==(u=a)&&void 0!==u&&u.code)throw{error:a.code,error_description:a.message,error_uri:new URL(e).pathname};break}catch(e){if(t.withCredentials&&e&&e.error===Qh.UNAUTHENTICATED)return await this.setCredentials(null),Promise.reject(e);if(r===s||!e||"unreachable"!==e.error)return Promise.reject(e)}await this.sleep(bf.retryInterval)}return a}async wxCloudCallFunction(e,t){let r=null,n=null;try{var o;let i="";try{i=await wx.getRendererUserAgent()}catch(e){}const{result:s}=await this.wxCloud.callFunction({name:"httpOverCallFunction",data:{url:e,method:t.method,headers:zh({origin:"https://servicewechat.com","User-Agent":i},t.headers),body:t.body}});null!=s&&null!==(o=s.body)&&void 0!==o&&o.error_code?(n=null==s?void 0:s.body,n.error_uri=fd(e)):r=null==s?void 0:s.body}catch(t){n={error:Qh.UNREACHABLE,error_description:t.message,error_uri:fd(e)}}if(n)throw n;return r}async getCredentials(){return await this.initializePromise,this._acquireLock(-1,async()=>this._getCredentials())}getCredentialsSync(){return this.localCredentials.getStorageCredentialsSync()}getCredentialsAsync(){return this.getCredentials()}async getScope(){const e=await this.localCredentials.getCredentials();if(!e){var t;const e="credentials not found";return null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:e}),this.unAuthenticatedError(e)}return e.scope}async getGroups(){const e=await this.localCredentials.getCredentials();if(!e){var t;const e="credentials not found";return null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:e}),this.unAuthenticatedError(e)}return e.groups}async refreshToken(e,t){return await this.initializePromise,this._acquireLock(-1,async()=>this._refreshToken(e,t))}async _refreshToken(e,t){return this.singlePromise.run("_refreshToken",async()=>{if(!e||!e.refresh_token){var r;const e="no refresh token found in credentials";return null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:e}),this.unAuthenticatedError(e)}try{var n;const t=await this.refreshTokenFunc(e.refresh_token,e);return await this.localCredentials.setCredentials(t),null===(n=this.eventBus)||void 0===n||n.fire(ad,{event:nd}),t}catch(e){var o;if(null!=t&&t.throwError)throw e;if(e.error===Qh.INVALID_GRANT){var i;await this.localCredentials.setCredentials(null);const t=e.error_description;return null===(i=this.onCredentialsError)||void 0===i||i.call(this,{msg:t}),this.unAuthenticatedError(t)}return null===(o=this.onCredentialsError)||void 0===o||o.call(this,{msg:e.error_description}),Promise.reject(e)}})}async anonymousLogin(e){return this.singlePromise.run("_anonymousLogin",async()=>{if(this.anonymousSignInFunc){const t=await this.anonymousSignInFunc(e);e=t||await this.localCredentials.getCredentials()}else e=await this.anonymousSignIn(e);return e})}checkRetry(e){let t=null;if(("number"!=typeof e||e<bf.minRetry||e>bf.maxRetry)&&(t={error:Qh.UNREACHABLE,error_description:"wrong options param: retry"}),t)throw t;return e}formatRetry(e,t){return void 0===e?t:this.checkRetry(e)}async sleep(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}async anonymousSignIn(e){return this.singlePromise.run("_anonymous",async()=>{if(!e||"anonymous"!==e.scope)return this.unAuthenticatedError("no anonymous in credentials");try{const e=await this.request(Gh.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}});return await this.localCredentials.setCredentials(e),e}catch(e){return e.error===Qh.INVALID_GRANT?(await this.localCredentials.setCredentials(null),this.unAuthenticatedError(e.error_description)):Promise.reject(e)}})}async defaultRefreshTokenFunc(e,t){if(void 0===e||""===e){var r;const e="refresh token not found";return null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:e}),this.unAuthenticatedError(e)}let n=Gh.AUTH_TOKEN_URL;"v2"===(null==t?void 0:t.version)&&(n=Kh.AUTH_TOKEN_URL);return zh(zh({},await this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:e}})),{},{version:(null==t?void 0:t.version)||"v1"})}async getDeviceId(){if(this.deviceID)return this.deviceID;let e=await this.storage.getItem(pf);return"string"==typeof e&&e.length>=16&&e.length<=48||(e=hd(),await this.storage.setItem(pf,e)),this.deviceID=e,e}unAuthenticatedError(e){const t={error:Qh.UNAUTHENTICATED,error_description:e};return Promise.reject(t)}_debug(){if(this.logDebugMessages){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];console.log("[OAuth2Client]",...t)}}async _initialize(){try{if(!this.getInitialSession)return this._debug("#_initialize()","no getInitialSession callback set, skipping"),{error:null};this._debug("#_initialize()","calling getInitialSession callback");try{const{data:e,error:t}=await this.getInitialSession();if(null!=e&&e.session&&(this._debug("#_initialize()","session obtained from getInitialSession",e.session),await this.localCredentials.setCredentials(null==e?void 0:e.session)),this.onInitialSessionObtained){this._debug("#_initialize()","calling onInitialSessionObtained callback");try{await this.onInitialSessionObtained(e,t)}catch(e){this._debug("#_initialize()","error in onInitialSessionObtained",e)}}return t?(this._debug("#_initialize()","error from getInitialSession",t),{error:t}):{error:null}}catch(e){return this._debug("#_initialize()","exception during getInitialSession",e),{error:e instanceof Error?e:new Error(String(e))}}}catch(e){return this._debug("#_initialize()","unexpected error",e),{error:e instanceof Error?e:new Error(String(e))}}finally{this._debug("#_initialize()","end")}}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}this._debug("#_acquireLock","acquiring lock for client",this.clientId);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","releasing lock for client",this.clientId),this.lockAcquired=!1}}finally{this._debug("#_acquireLock","end")}}async _getCredentials(){let e=await this.localCredentials.getCredentials();if(!e){var t;const e="credentials not found";return null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:e}),this.unAuthenticatedError(e)}if(mf(e))if(e.refresh_token)try{e=await this._refreshToken(e)}catch(t){var r;if("anonymous"!==e.scope)return null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:t.error_description}),Promise.reject(t);e=await this.anonymousLogin(e)}else{if("anonymous"!==e.scope){var n;const e="no refresh token found in credentials";return null===(n=this.onCredentialsError)||void 0===n||n.call(this,{msg:e}),this.unAuthenticatedError(e)}e=await this.anonymousLogin(e)}return e}}bf.defaultRetry=2,bf.minRetry=0,bf.maxRetry=5,bf.retryInterval=1e3;const _f=(e,t)=>{let r;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];clearTimeout(r),r=setTimeout(()=>e.apply(null,o),t)}},wf=new ef,Sf="resolveCaptchaData",If="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:999",Tf="position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:320px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:1000",Pf="margin-bottom:15px",Ef="display:flex;align-items:center;justify-content:space-between;margin-bottom:15px",Of="width:100%;height:auto;border:1px solid #eee",Rf="padding:10px 8px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer;flex:1;white-space:nowrap;margin-left:10px",Cf="width:100%;padding:14px 16px;margin-bottom:15px;box-sizing:border-box;border:2px solid #e8ecf4;border-radius:10px;font-size:15px",Af="width:100%;padding:10px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer",kf="background:#6c757d;cursor:not-allowed",Uf=async(e,t)=>{const{captchaData:r,state:n,token:o}=Nd(e);return(e=>{let{oauthInstance:t,captchaState:r}=e;const n="captcha-image",o=async()=>{try{const e=await t.createCaptchaData({state:r.state});r=zh(zh({},r),{},{captchaData:e.data,token:e.token}),document.getElementById(n).src=e.data}catch(e){console.error("刷新图形验证码失败",e)}},i=(e,t,r)=>{const n=document.createElement(e);return t&&(n.style.cssText=t),r&&(n.textContent=r),n},s=i("div",If),a=i("div",Tf);a.appendChild(i("p",Pf,"请输入你看到的字符:"));const c=i("div",Ef),u=i("img",Of);u.id=n,u.src=r.captchaData,c.appendChild(u);const l=i("button",Rf,"刷新");l.onclick=_f(async()=>{l.textContent="加载中...",l.disabled=!0,l.style.cssText="".concat(Rf,";").concat(kf);try{await o()}finally{l.textContent="刷新",l.disabled=!1,l.style.cssText=Rf}},500),c.appendChild(l),a.appendChild(c);const h=i("input",Cf);h.type="text",h.placeholder="输入字符",h.maxLength=4,a.appendChild(h);const d=i("div","color:#dc3545;font-size:12px;margin-bottom:10px;display:none;padding:8px;background:#f8d7da;border:1px solid #f5c6cb;border-radius:4px");a.appendChild(d);const f=e=>{d.textContent=e,d.style.display="block"},p=i("button",Af,"确定");p.onclick=_f(async()=>{const e=h.value.trim();if(e){d.style.display="none",p.textContent="验证中...",p.disabled=!0,p.style.cssText="".concat(Af,";").concat(kf);try{const n=await t.verifyCaptchaData({token:r.token,key:e});wf.fire(Sf,n),console.log("图形验证码校验成功"),document.body.removeChild(s),document.body.removeChild(a)}catch(e){console.error("图形验证码校验失败",e);const t=e.error_description||"图形验证码校验失败";f(t),h.value="",h.focus(),await o()}finally{p.textContent="确定",p.disabled=!1,p.style.cssText=Af}}else f("请输入字符")},500),a.appendChild(p),document.body.appendChild(s),document.body.appendChild(a)})({oauthInstance:t,captchaState:{captchaData:r,state:n,token:o}}),new Promise(e=>{console.log("等待图形验证码校验结果..."),wf.on(Sf,t=>{e(null==t?void 0:t.data)})})};class qf{constructor(e){e.openURIWithCallback||(e.openURIWithCallback=this.getDefaultOpenURIWithCallback()),e.storage||(e.storage=gf),this.config=e,this.tokenSectionName="captcha_".concat(e.clientId||e.env)}isMatch(){var e,t;return(null===(e=this.config)||void 0===e||null===(e=e.adapter)||void 0===e||null===(t=e.isMatch)||void 0===t?void 0:t.call(e))||_d()}async request(e,t){t||(t={}),t.method||(t.method="GET");const r="".concat(t.method,":").concat(e);let n,o=e;t.withCaptcha&&(o=await this.appendCaptchaTokenToURL(e,r,!1));try{n=await this.config.request(o,t)}catch(n){return n.error===Qh.CAPTCHA_REQUIRED||n.error===Qh.CAPTCHA_INVALID?(e=await this.appendCaptchaTokenToURL(e,r,n.error===Qh.CAPTCHA_INVALID),this.config.request(e,t)):Promise.reject(n)}return n}getDefaultOpenURIWithCallback(){return e=>Uf(e,this.config.oauthInstance)}async getCaptchaToken(e,t){if(!e){const e=await this.findCaptchaToken();if(e)return e}const r=await this.config.request(Gh.CAPTCHA_DATA_URL,{method:"POST",body:{state:t,redirect_uri:""},withCredentials:!1}),n="".concat(r.data,"?state=").concat(encodeURIComponent(t),"&token=").concat(encodeURIComponent(r.token)),o=await this.config.openURIWithCallback(n);return this.saveCaptchaToken(o),o.captcha_token}async appendCaptchaTokenToURL(e,t,r){const n=await this.getCaptchaToken(r,t);return e.indexOf("?")>0?e+="&captcha_token=".concat(n):e+="?captcha_token=".concat(n),e}async saveCaptchaToken(e){e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10));const t=JSON.stringify(e);await this.config.storage.setItem(this.tokenSectionName,t)}async findCaptchaToken(){const e=await this.config.storage.getItem(this.tokenSectionName);if(null!=e)try{const t=JSON.parse(e);null!=t&&t.expires_at&&(t.expires_at=new Date(t.expires_at));return t.expires_at<new Date?null:t.captcha_token}catch(e){return await this.config.storage.removeItem(this.tokenSectionName),null}return null}}class Lf{constructor(e){if(this.params={},"string"==typeof e)this.parse(e);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.append(t,e[t])}parse(e){e.split("&").forEach(e=>{const[t,r]=e.split("=").map(decodeURIComponent);this.append(t,r)})}append(e,t){this.params[e]?this.params[e]=this.params[e].concat([t]):this.params[e]=[t]}get(e){return this.params[e]?this.params[e][0]:null}getAll(e){return this.params[e]||[]}delete(e){delete this.params[e]}has(e){return Object.prototype.hasOwnProperty.call(this.params,e)}set(e,t){this.params[e]=[t]}toString(){const e=[];for(const t in this.params)Object.prototype.hasOwnProperty.call(this.params,t)&&this.params[t].forEach(r=>{e.push("".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r)))});return e.join("&")}}class xf extends Error{constructor(e){super(e.error_description||e.message),this.__isAuthError=!0,this.name="AuthError",this.status=e.error,this.code=e.error_code}}const Nf=["provider_redirect_uri","other_params"];async function jf(e,t){const r=async()=>{try{return require("../utils/encrypt")}catch(e){try{return await Promise.resolve().then(function(){return Qp})}catch(e){return}}};try{var n;if(((null==t||null===(n=t.root)||void 0===n?void 0:n.globalThis)||globalThis).IS_MP_BUILD)return;if(!process.env.IS_MP_BUILD&&e)return r()}catch(t){if(e)return r()}}let Df=class e{static parseParamsToSearch(e){Object.keys(e).forEach(t=>{e[t]||delete e[t]});return new Lf(e).toString()}constructor(e){let{request:t}=e,r=e.credentialsClient;if(!r){const t={apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,storage:e.storage,env:e.env,baseRequest:e.baseRequest,anonymousSignInFunc:e.anonymousSignInFunc,wxCloud:e.wxCloud,onCredentialsError:e.onCredentialsError,headers:e.headers||{},i18n:e.i18n,debug:e.debug};r=new bf(t)}if(!t){const n=r.request.bind(r),o=new qf(zh({env:e.env,clientId:e.clientId,request:n,storage:e.storage,adapter:e.adapter,oauthInstance:this},e.captchaOptions));t=o.request.bind(o)}this.config={env:e.env,apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,request:t,credentialsClient:r,storage:e.storage||gf,adapter:e.adapter}}getParamsByVersion(e,t){var r;const n=dd(e),o=(null===(r={v2:Kh}[null==n?void 0:n.version])||void 0===r?void 0:r[t])||Gh[t];return n&&delete n.version,{params:n,url:o}}async signIn(e){const t=e.version||"v1",r=this.getParamsByVersion(e,"AUTH_SIGN_IN_URL");r.params.query&&delete r.params.query;const n=await this.getEncryptParams(r.params),o=await this.config.request(r.url,{method:"POST",body:n});return await this.config.credentialsClient.setCredentials(zh(zh({},o),{},{version:t})),Promise.resolve(o)}async signInAnonymously(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=await this.config.request(Gh.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:e,useWxCloud:t});return await this.config.credentialsClient.setCredentials(r),Promise.resolve(r)}async signUp(e){const t=await this.config.request(Gh.AUTH_SIGN_UP_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signOut(e){let t={};if(e){try{t=await this.config.request(Gh.AUTH_SIGNOUT_URL,{method:"POST",withCredentials:!0,body:e})}catch(e){e.error!==Qh.UNAUTHENTICATED&&console.log("sign_out_error",e)}return await this.config.credentialsClient.setCredentials(),t}const r=await this.config.credentialsClient.getAccessToken(),n=await this.config.request(Gh.AUTH_REVOKE_URL,{method:"POST",body:{token:r}});return await this.config.credentialsClient.setCredentials(),Promise.resolve(n)}async revokeAllDevices(){await this.config.request(Gh.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})}async revokeDevice(e){await this.config.request(Gh.AUTHORIZED_DEVICES_DELETE_URL+e.device_id,{method:"DELETE",withCredentials:!0})}async getVerification(e,t){let r=!1;if("CUR_USER"===e.target)r=!0;else{await this.hasLoginState()&&(r=!0)}const n=dd(e);return n.phone_number&&!/^\+\d{1,3}\s+\d+/.test(n.phone_number)&&(n.phone_number="+86 ".concat(n.phone_number)),this.config.request(Gh.VERIFICATION_URL,{method:"POST",body:n,withCaptcha:(null==t?void 0:t.withCaptcha)||!1,withCredentials:r})}async verify(e){const t=this.getParamsByVersion(e,"VERIFY_URL"),r=await this.config.request(t.url,{method:"POST",body:t.params});return"v2"===(null==e?void 0:e.version)&&await this.config.credentialsClient.setCredentials(zh(zh({},r),{},{version:"v2"})),r}async genProviderRedirectUri(t){const{provider_redirect_uri:r,other_params:n={}}=t,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,Nf);r&&!o.redirect_uri&&(o.redirect_uri=r);let i="".concat(Gh.PROVIDER_URI_URL,"?").concat(e.parseParamsToSearch(o));return Object.keys(n).forEach(e=>{const t=n[e];("sign_out_uri"!==e||(null==t?void 0:t.length)>0)&&(i+="&other_params[".concat(e,"]=").concat(encodeURIComponent(t)))}),this.config.request(i,{method:"GET"})}async grantProviderToken(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.config.request(Gh.PROVIDER_TOKEN_URL,{method:"POST",body:e,useWxCloud:t})}async patchProviderToken(e){return this.config.request(Gh.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})}async signInWithProvider(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=this.getParamsByVersion(e,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),n=await this.config.request(r.url,{method:"POST",body:r.params,useWxCloud:t});return await this.config.credentialsClient.setCredentials(zh(zh({},n),{},{version:(null==e?void 0:e.version)||"v1"})),Promise.resolve(n)}async toBindIdentity(e){const t=e.credentials||await this.config.credentialsClient.localCredentials.getCredentials();let r;try{await this.bindWithProvider({provider_token:e.provider_token},t),r={data:{type:ud,provider:e.provider},error:null}}catch(e){r={data:{type:ud},error:new xf(e)}}var n,o;e.fireEvent&&(null===(n=this.config.eventBus)||void 0===n||null===(o=n.fire)||void 0===o||o.call(n,ad,{event:id,info:r}));return r}async getInitialSession(){let e={};try{var t,r,n,o,i;if("undefined"==typeof window||"undefined"==typeof document)return{data:null,error:null};const s=new URLSearchParams(null===(t=location)||void 0===t?void 0:t.search),a=s.get("code"),c=s.get("state");if(!a||!c)return{data:null,error:null};let u=null;try{u=JSON.parse(sessionStorage.getItem(c)||"null")}catch(e){}e={type:null===(r=u)||void 0===r?void 0:r.type};const l=s.get("error"),h=s.get("error_description");if(l||h)return{data:e,error:new xf({message:h||l||"Unknown error from OAuth provider"})};const d=(null===(n=u)||void 0===n?void 0:n.provider)||s.get("provider");if(!d)return{data:e,error:new xf({message:"Provider is required for OAuth verification"})};const f=location.origin+location.pathname,{provider_token:p}=await this.grantProviderToken({provider_id:d,provider_redirect_uri:f,provider_code:a});let v,g,m=null;if(u.type===ud)v=await this.config.credentialsClient.localCredentials.getCredentials(),g=await this.toBindIdentity({provider:d,provider_token:p,credentials:v});else if(u.type===cd){g=this.getParamsByVersion({provider:d},"AUTH_SIGN_IN_WITH_PROVIDER_URL"),v=await this.config.request(g.url,{method:"POST",body:{provider_token:p}});try{m=await this.getUserInfo({credentials:v})}catch(e){console.error("get user info error",e)}g={data:zh(zh({},e),{},{session:v,user:m}),error:null}}s.delete("code"),s.delete("state"),s.delete("provider"),this.restoreUrlState(void 0===(null===(o=u)||void 0===o?void 0:o.search)?"?".concat(s.toString()):u.search,(null===(i=u)||void 0===i?void 0:i.hash)||location.hash);try{sessionStorage.removeItem(c)}catch(e){}return g}catch(t){return{data:e,error:new xf(t)}}}async signInCustom(e){const t=await this.config.request(Gh.AUTH_SIGN_IN_CUSTOM,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signInWithWechat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=await this.config.request(Gh.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async bindWithProvider(e,t){return this.config.request(Gh.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0,getCredentials:t?()=>t:void 0})}async getUserProfile(e){return this.getUserInfo(e)}async getUserInfo(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=this.getParamsByVersion(t,"USER_ME_URL");if(null!==(e=r.params)&&void 0!==e&&e.query){const e=new Lf(r.params.query);r.url+="?".concat(e.toString())}const n=await this.config.request(r.url,{method:"GET",withCredentials:!0,getCredentials:t.credentials?()=>t.credentials:void 0});return n.sub&&(n.uid=n.sub),n}async getWedaUserInfo(){return await this.config.request(Gh.WEDA_USER_URL,{method:"GET",withCredentials:!0})}async deleteMe(t){const r=this.getParamsByVersion(t,"USER_ME_URL"),n="".concat(r.url,"?").concat(e.parseParamsToSearch(r.params));return this.config.request(n,{method:"DELETE",withCredentials:!0})}async hasLoginState(){try{return await this.config.credentialsClient.getAccessToken(),!0}catch(e){return!1}}hasLoginStateSync(){return this.config.credentialsClient.getCredentialsSync()}async getLoginState(){return this.config.credentialsClient.getCredentialsAsync()}async transByProvider(e){return this.config.request(Gh.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})}async grantToken(e){const t=this.getParamsByVersion(e,"AUTH_TOKEN_URL");return this.config.request(t.url,{method:"POST",body:t.params})}async getProviders(){return this.config.request(Gh.PROVIDER_LIST,{method:"GET",withCredentials:!0})}async unbindProvider(e){return this.config.request("".concat(Gh.PROVIDER_UNBIND_URL,"/").concat(e.provider_id),{method:"DELETE",withCredentials:!0})}async checkPassword(e){return this.config.request("".concat(Gh.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:e})}async editContact(e){return this.config.request("".concat(Gh.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:e})}async setPassword(e){return this.config.request("".concat(Gh.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:e})}async updatePasswordByOld(e){const t=await this.sudo({password:e.old_password});return this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})}async sudo(e){return this.config.request("".concat(Gh.SUDO_URL),{method:"POST",withCredentials:!0,body:e})}async sendVerificationCodeToCurrentUser(e){return e.target="CUR_USER",this.config.request(Gh.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})}async changeBoundProvider(e){return this.config.request("".concat(Gh.PROVIDER_LIST,"/").concat(e.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})}async setUserProfile(e){return this.config.request(Gh.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})}async updateUserBasicInfo(e){return this.config.request(Gh.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:e})}async queryUserProfile(e){const t=new Lf(e);return this.config.request("".concat(Gh.USER_QUERY_URL,"?").concat(t.toString()),{method:"GET",withCredentials:!0})}setCustomSignFunc(e){this.getCustomSignTicketFn=e}async signInWithCustomTicket(){const e=this.getCustomSignTicketFn;if(!e)return Promise.reject({error:"failed_precondition",error_description:"please use setCustomSignFunc to set custom sign function"});const t=await e();return this.signInCustom({provider_id:"custom",ticket:t})}async resetPassword(e){return this.config.request(Gh.AUTH_RESET_PASSWORD,{method:"POST",body:e})}async authorize(e){return this.config.request(Gh.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:e})}async authorizeDevice(e){return this.config.request(Gh.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:e})}async deviceAuthorize(e){return this.config.request(Gh.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})}async authorizeInfo(t){const r="".concat(Gh.AUTHORIZE_INFO_URL,"?").concat(e.parseParamsToSearch(t));let n=!0,o=!1;return await this.hasLoginState()&&(o=!0,n=!1),this.config.request(r,{method:"GET",withBasicAuth:n,withCredentials:o})}async checkUsername(e){return this.config.request(Gh.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})}async checkIfUserExist(e){const t=new Lf(e);return this.config.request("".concat(Gh.CHECK_IF_USER_EXIST,"?").concat(t.toString()),{method:"GET"})}async loginScope(){return this.config.credentialsClient.getScope()}async loginGroups(){return this.config.credentialsClient.getGroups()}async refreshTokenForce(e){const t=await this.config.credentialsClient.getCredentials();return await this.config.credentialsClient.refreshToken(zh(zh({},t),{},{version:(null==e?void 0:e.version)||"v1"}))}async getCredentials(){return this.config.credentialsClient.getCredentials()}async getPublicKey(){return this.config.request(Kh.AUTH_PUBLIC_KEY,{method:"POST",body:{}})}async getEncryptParams(e){const{isEncrypt:t}=e;delete e.isEncrypt;const r=dd(e),n=await jf(t,this.config.adapter);if(!n)return e;let o="",i="";try{const e=await this.getPublicKey();if(o=e.public_key,i=e.public_key_thumbprint,!o||!i)throw e}catch(e){throw e}return{params:n.getEncryptInfo({publicKey:o,payload:r}),public_key_thumbprint:i}}async getProviderSubType(){return this.config.request(Gh.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})}async verifyCaptchaData(e){let{token:t,key:r}=e;return this.config.request(Gh.VERIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:t,key:r},withCredentials:!1})}async createCaptchaData(e){let{state:t,redirect_uri:r}=e;return this.config.request(Gh.CAPTCHA_DATA_URL,{method:"POST",body:{state:t,redirect_uri:r},withCredentials:!1})}async getMiniProgramCode(e){return this.config.request(Gh.GET_MINIPROGRAM_QRCODE,{method:"POST",body:e})}async getMiniProgramQrCodeStatus(e){return this.config.request(Gh.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:e})}async getUserBehaviorLog(e){const t="".concat(Gh.GET_USER_BEHAVIOR_LOG,"?").concat({LOGIN:"query[action]=USER_LOGIN",MODIFY:"ne_query[action]=USER_LOGIN"}[e.type],"&limit=").concat(e.limit).concat(e.page_token?"&page_token=".concat(e.page_token):"");return this.config.request(t,{method:"GET",withCredentials:!0})}async modifyPassword(e){let t="",r="";const n=await jf(!0,this.config.adapter);if(!n)throw new Error("do not support encrypt, a encrypt util required.");try{const e=await this.getPublicKey();if(t=e.public_key,r=e.public_key_thumbprint,!t||!r)throw e}catch(e){throw e}const o=e.password?n.getEncryptInfo({publicKey:t,payload:e.password}):"",i=n.getEncryptInfo({publicKey:t,payload:e.new_password});return this.config.request(Gh.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:{user_id:e.user_id,encrypt_password:o,encrypt_new_password:i,public_key_thumbprint:r}})}async modifyPasswordWithoutLogin(e){let t="",r="";const n=await jf(!0,this.config.adapter);if(!n)throw new Error("do not support encrypt, a encrypt util required.");try{const e=await this.getPublicKey();if(t=e.public_key,r=e.public_key_thumbprint,!t||!r)throw e}catch(e){throw e}const o=e.password?n.getEncryptInfo({publicKey:t,payload:e.password}):"",i=n.getEncryptInfo({publicKey:t,payload:e.new_password});return this.config.request(Kh.AUTH_RESET_PASSWORD,{method:"POST",body:{username:e.username,password:o,new_password:i,public_key_thumbprint:r}})}restoreUrlState(e,t){if(void 0!==e)try{const r=new URL(window.location.href);r.search=e,r.hash=t||"",window.history.replaceState(null,"",r.toString())}catch(e){}}};class Bf{constructor(e){const{apiOrigin:t,apiPath:r=Vh,clientId:n,env:o,storage:i,request:s,baseRequest:a,anonymousSignInFunc:c,wxCloud:u,adapter:l,onCredentialsError:h,headers:d,i18n:f,useWxCloud:p,eventBus:v,detectSessionInUrl:g,debug:m}=e;this.detectSessionInUrl=null!=g&&g,this.oauth2client=new bf({apiOrigin:t,apiPath:r,clientId:n,env:o,storage:i,baseRequest:a||s,anonymousSignInFunc:c,wxCloud:u,onCredentialsError:h,headers:d||{},i18n:f,useWxCloud:p,eventBus:v,debug:m}),this.authApi=new Df(zh(zh({credentialsClient:this.oauth2client},e),{},{request:s?this.oauth2client.request.bind(this.oauth2client):void 0,adapter:l})),g&&this.oauth2client.setGetInitialSession(this.authApi.getInitialSession.bind(this.authApi))}initializeSession(e){this.detectSessionInUrl?(this.oauth2client.setOnInitialSessionObtained(e),this.oauth2client.initialize()):this.oauth2client.initialize(Promise.resolve({error:null}))}}var Mf={exports:{}};!function(e){"undefined"!=typeof window&&window,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},c=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0});var u=r(3),l=r(2),h=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return o(t,e),t.prototype.post=function(e){var t=this;return new Promise(function(r,n){var o=e.url,i=e.data,s=e.headers,a=wx.request({url:u.formatUrl("https:",o),data:i,timeout:t._timeout,method:"POST",header:s,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):n(e)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("post")&&"request:fail timeout"===e.errMsg){console.warn(t._timeoutMsg);try{a.abort()}catch(e){}}}})})},t.prototype.get=function(e){var t=this;return new Promise(function(r,n){var o=e.url,i=e.body,s=e.headers,a=u.formatUrl("https:",o),c=wx.request({url:a,data:i,timeout:t._timeout,method:"GET",header:s,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):n(e)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("get")&&e.errMsg.includes("timeout")){console.warn(t._timeoutMsg);try{c.abort()}catch(e){console.warn("Error when aborting requestTask",e)}}}})})},t.prototype.upload=function(e){var t=this,r=this;return new Promise(function(n){return s(t,void 0,void 0,function(){var t,o,s,c,u,l;return a(this,function(a){return t=e.url,o=e.file,s=e.data,c=e.headers,u=e.onUploadProgress,l=wx.uploadFile({url:t,filePath:o,name:"file",formData:i({},s),header:c,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&s.success_action_status&&(t.statusCode=parseInt(s.success_action_status,10)),n(t)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{l.abort()}catch(e){}}}}),u&&l.onProgressUpdate(function(e){u(e)}),[2]})})})},t.prototype.download=function(e){var t=this,r=this;return new Promise(function(n,o){var i=e.url,s=e.headers,a=wx.downloadFile({url:u.formatUrl("https:",i),header:s,timeout:t._timeout,success:function(e){200===e.statusCode&&e.tempFilePath?n({statusCode:200,tempFilePath:e.tempFilePath}):n(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("download")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{a.abort()}catch(e){}}}})})},t.prototype.fetch=function(e){var t=e.url,r=e.body,n=e.enableAbort,o=e.headers,i=e.method,s=e.stream,a=void 0!==s&&s,c=e.signal,h=e.timeout,d=this,f=null!=h?h:this._timeout,p=null,v=new l.ReadableStream({start:function(e){p=e},cancel:function(){p=null}});return new Promise(function(e,s){a&&e({data:v});var l=wx.request({url:u.formatUrl("https:",t),data:r,timeout:f,method:i.toUpperCase(),header:o,success:function(t){var r;null===(r=p)||void 0===r||r.close(),!a&&e(t)},fail:function(e){var t;if(null===(t=p)||void 0===t||t.close(),s(e),a)throw e},complete:function(e){if(e&&e.errMsg&&f&&-1!==d._restrictedMethods.indexOf("post")&&n&&"request:fail timeout"===e.errMsg){console.warn(d._timeoutMsg);try{l.abort()}catch(e){console.warn("Error when aborting requestTask",e)}}},enableChunked:a});if(l.onChunkReceived(function(e){var t;null===(t=p)||void 0===t||t.enqueue(new Uint8Array(e.data))}),c){var h=function(){try{l.abort()}catch(e){console.warn("Error when aborting requestTask",e)}};c.aborted?h():c.addEventListener("abort",function(){return h()})}})},t}(u.AbstractSDKRequest);t.WxRequest=h,t.wxMpStorage={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}};var d=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(i({url:e},t));return{set onopen(e){r.onOpen(e)},set onmessage(e){r.onMessage(e)},set onclose(e){r.onClose(e)},set onerror(e){r.onError(e)},send:function(e){return r.send({data:e})},close:function(e,t){return r.close({code:e,reason:t})},get readyState(){return r.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}};function f(e){var t={},r=e.replace(/^[?#]/,"");return r?(r.split("&").forEach(function(e){var r=e.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(t[n]?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o)}),t):t}t.WxMpWebSocket=d,t.parseQueryString=f;var p={genAdapter:function(e){return{root:{globalThis:{}},reqClass:h,wsClass:d,captchaOptions:{openURIWithCallback:function(t){var r=e.EventBus,n={},o=t;console.log("openURIWithCallback",t);var s=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(s){o=s[1],console.log("openURIWithCallback url",o);var a=s[2];a&&(n=f(a))}console.log("openURIWithCallback queryObj",n);var u=n.token,l=c(n,["token"]);return/^data:/.test(o)&&!u?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: "+t}):u?new Promise(function(e){console.log("wait for captcha..."),r.$emit("CAPTCHA_DATA_CHANGE",i(i({},l),{token:u,url:o})),r.$once("RESOLVE_CAPTCHA_DATA",function(t){e(t)})}):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:t.wxMpStorage,primaryStorage:u.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:"":e&&e.plugin?e.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(e){return!1}return!0},runtime:"wx_mp"};t.default=p},function(e,t,r){
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).wxCloudClientSDK={})}(this,function(e){"use strict";var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}var n=function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)};function o(e,t,r,n){return new(r||(r=Promise))(function(t,o){function i(e){try{a(n.next(e))}catch(e){o(e)}}function s(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r(function(e){e(n)})).then(i,s)}a((n=n.apply(e,[])).next())})}function i(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var s=function(e){function t(t,r){var n=e.call(this,t)||this;return n.name="WxCloudSDKError",n.code=null==r?void 0:r.code,n.requestId=null==r?void 0:r.requestId,n.originError=null==r?void 0:r.originError,n}return r(t,e),t}(Error);function a(){return"undefined"!=typeof window&&window||"undefined"!=typeof globalThis&&globalThis}function u(){try{var e=a();if(!e)return;return"undefined"==typeof wx?a().location.href:e.__wxRoute}catch(e){}}var c=function(e){return o(void 0,0,void 0,function(){var t,r,n,o;return i(this,function(i){switch(i.label){case 0:if(!(null===(n=null==e?void 0:e.auth)||void 0===n?void 0:n.getSession))return[2,""];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,e.auth.getSession()];case 2:return t=i.sent().data,[2,(null===(o=t.session)||void 0===o?void 0:o.access_token)||""];case 3:return r=i.sent(),console.log("[WxCloudSDKError] getAccessToken failed",r),[2,""];case 4:return[2]}})})},l=function(e){var t=e.dataSourceName,r=e.methodName,l=e.params,h=e.realMethodName,d=e.callFunction,f=e.envType,p=void 0===f?"prod":f,v=e.mode,g=e.cloud;return o(void 0,0,void 0,function(){var e,o,f,m,y,b,_;return i(this,function(i){switch(i.label){case 0:return e={data:{},requestId:""},[4,c(g)];case 1:o=i.sent(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,d({name:"lowcode-datasource",data:n({dataSourceName:t,methodName:r,params:l,userAgent:(S=a(),(null==S?void 0:S.navigator)?S.navigator.userAgent:"undefined"!=typeof wx&&wx.getSystemInfo?(wx.getSystemInfo({success:function(e){e&&(w=["brand","model","version","system","platform","SDKVersion","language"].map(function(t){return"".concat(t,": ").concat(e[t])}).join(", "))}}),w):void 0),referrer:u(),"x-sdk-version":"1.8.4",envType:p,mode:v},o?{access_token:o}:{})})];case 3:if(f=i.sent(),m=(null===(b=null==f?void 0:f.result)||void 0===b?void 0:b.requestId)||(null==f?void 0:f.requestId)||(null==f?void 0:f.requestID),null==f?void 0:f.result.code)throw new s("【错误】".concat(null==f?void 0:f.result.message,"\n【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(h,"\n【错误码】").concat(null==f?void 0:f.result.code,"\n【请求ID】").concat(m||"N/A"),{code:null==f?void 0:f.result.code,requestId:m});return e.data=(null===(_=null==f?void 0:f.result)||void 0===_?void 0:_.data)||{},e.requestId=m,[3,5];case 4:throw"WxCloudSDKError"===(y=i.sent()).name?y:(console.log(y),new s("【错误】".concat(y.message,"\n 【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(h,"\n 【请求ID】N/A"),{code:"UnknownError",originError:y}));case 5:return[2,e]}var w,S})})},h=function(e){var t=e.sql,r=e.params,n=e.config,s=e.callFunction,a=e.unsafe,u=void 0!==a&&a,c=e.cloud;return o(void 0,0,void 0,function(){return i(this,function(e){return[2,l({realMethodName:"$runSQL",methodName:"callWedaApi",params:{action:"RunMysqlCommand",data:{sqlTemplate:t,config:n,parameter:u?"":Object.entries(r||{}).reduce(function(e,t){var r=t[0],n=t[1];if(void 0!==n){var o="OBJECT";switch(typeof n){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(n)?"ARRAY":"OBJECT"}e.push({key:r,type:o,value:"STRING"===o?n:JSON.stringify(n)})}return e},[])||[]}},callFunction:s,mode:"sdk",cloud:c})]})})},d=function(e,t){return{$runSQL:function(r,s,a){return o(this,0,void 0,function(){return i(this,function(o){switch(o.label){case 0:return[4,h({sql:r,params:s,config:n(n({},a),{preparedStatements:!0}),callFunction:e,cloud:t})];case 1:return[2,o.sent()]}})})},$runSQLRaw:function(r,s){return o(this,0,void 0,function(){return i(this,function(o){switch(o.label){case 0:return[4,h({sql:r,params:[],config:n(n({},s),{preparedStatements:!1}),callFunction:e,cloud:t})];case 1:return[2,o.sent()]}})})}}},f={filter:{where:{}},select:{$master:!0}};function p(e){return{getUrl:function(t){return"".concat(t,"/").concat(e)},method:"post"}}var v={get:n(n({},p("get")),{defaultParams:n({},f)}),list:n(n({},p("list")),{defaultParams:n({},f)}),create:p("create"),createMany:p("createMany"),update:n(n({},p("update")),{method:"put"}),updateMany:n(n({},p("updateMany")),{method:"put"}),upsert:p("upsert"),delete:p("delete"),deleteMany:p("deleteMany")},g="Unknown error occurred",m="NotSupported",y=function(e,t,r,n){var o=d(e,null==n?void 0:n.cloud);return new Proxy({},{get:function(e,i){if("string"==typeof i)return Object.prototype.hasOwnProperty.call(o,i)?o[i]:_(r,i,t,n)}})},b=function(e,t,r,n,o){return new s("【错误】".concat(e,"\n【操作】调用 models.").concat(t,".").concat(r,"\n【错误码】").concat(n,"\n【请求ID】").concat(o),{code:n,requestId:o})},_=function(e,t,r,a){var u=new Proxy({},{get:function(u,c){if("runSQLTemplate"!==c){var l=v[c];if(!l){var h=new Error("不支持的操作: ".concat(c));throw new s(h.message||g,{originError:h,code:m,requestId:"N/A"})}return function(n){return void 0===n&&(n={}),o(void 0,0,void 0,function(){var o,a,u,h,d,f,p,v,m,y;return i(this,function(i){switch(i.label){case 0:o=l.getUrl,a=l.method,u=l.defaultParams,h=void 0===u?{}:u,d=Object.assign({},h,n),f="pre"===d.envType?"pre":"prod",p=[e,f,o(t)].join("/"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r({url:p,body:JSON.stringify(d),method:a})];case 2:if((v=i.sent()).code)throw b(null==v?void 0:v.message,t,c,null==v?void 0:v.code,null==v?void 0:v.requestId);return"get"===c&&Object.assign(v,{data:null!==(y=v.data.record)&&void 0!==y?y:v.data}),[2,v];case 3:throw m=i.sent(),new s((null==m?void 0:m.message)||g,{originError:m});case 4:return[2]}})})}}if(!(null==a?void 0:a.sqlBaseUrl)){h=new Error("不支持的操作: ".concat(c));throw new s(h.message||g,{originError:h,code:m,requestId:"N/A"})}return function(e){return o(void 0,0,void 0,function(){var o,u,l,h,d,f,p,v,m,y,_,w,S,I,T,P;return i(this,function(i){switch(i.label){case 0:o=e.params,u=e.templateName,l=e.envType,h="pre"===l?"pre":"prod",d=[a.sqlBaseUrl,h,u,"run"].join("/"),f=Object.entries(o||{}).reduce(function(e,t){var r=t[0],n=t[1];if(void 0!==n){var o="OBJECT";switch(typeof n){case"boolean":o="BOOLEAN";break;case"number":o="NUMBER";break;case"string":o="STRING";break;default:o=Array.isArray(n)?"ARRAY":"OBJECT"}e.push({key:r,type:o,value:"STRING"===o?n:JSON.stringify(n)})}return e},[]),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r({url:d,body:JSON.stringify({parameter:f}),method:"POST"})];case 2:if(p=i.sent(),null===(m=null==p?void 0:p.Response)||void 0===m?void 0:m.Error)throw b(null===(_=null===(y=null==p?void 0:p.Response)||void 0===y?void 0:y.Error)||void 0===_?void 0:_.Message,t,c,null===(S=null===(w=null==p?void 0:p.Response)||void 0===w?void 0:w.Error)||void 0===S?void 0:S.Code,null===(I=null==p?void 0:p.Response)||void 0===I?void 0:I.RequestId);return[2,n(n({},null!==(T=null==p?void 0:p.Response)&&void 0!==T?T:{}),{data:null===(P=null==p?void 0:p.Response)||void 0===P?void 0:P.Data})];case 3:throw v=i.sent(),new s((null==v?void 0:v.message)||g,{originError:v});case 4:return[2]}})})}}});return u},w={create:{methodName:"wedaCreateV2"},createMany:{methodName:"wedaBatchCreateV2"},update:{methodName:"wedaUpdateV2"},upsert:{methodName:"wedaUpsertV2"},updateMany:{methodName:"wedaBatchUpdateV2"},delete:{methodName:"wedaDeleteV2"},deleteMany:{methodName:"wedaBatchDeleteV2"},get:{methodName:"wedaGetItemV2",defaultParams:{filter:{where:{}},select:{$master:!0}}},list:{methodName:"wedaGetRecordsV2",defaultParams:{filter:{where:{}},select:{$master:!0}}}},S=function(e,t){var r=d(e,t);return new Proxy({},{get:function(a,u){if("string"==typeof u)return Object.prototype.hasOwnProperty.call(r,u)?r[u]:function(e,t,r){return new Proxy({},{get:function(a,u){var c=w[u];if(!c){var h=new Error("不支持的操作: ".concat(u));throw new s(h.message||"Unknown error occurred",{originError:h,code:"NotSupported",requestId:"N/A"})}return function(s){return o(void 0,0,void 0,function(){var o,a,h,d,f;return i(this,function(i){switch(i.label){case 0:return o=n(n({},c.defaultParams||{}),s||{}),[4,l({callFunction:t,dataSourceName:e,methodName:c.methodName,realMethodName:u,params:o,envType:null==s?void 0:s.envType,cloud:r})];case 1:return a=i.sent(),h={data:{}},d=c.responseKey,h.data=d?null===(f=null==a?void 0:a.data)||void 0===f?void 0:f[d]:null==a?void 0:a.data,[2,h]}})})}}})}(u,e,t)}})},I=function(){function e(e){var t=this;this.map=new Map,e&&(e instanceof Headers?e.forEach(function(e,r){t.append(r,e)}):Array.isArray(e)?e.forEach(function(e){var r=e[0],n=e[1];t.append(r,n)}):"object"==typeof e&&Object.keys(e).forEach(function(r){t.append(r,e[r])}))}return e.prototype.append=function(e,t){var r=e.toLowerCase(),n=this.map.get(r);n?this.map.set(r,"".concat(n,", ").concat(t)):this.map.set(r,String(t))},e.prototype.delete=function(e){this.map.delete(e.toLowerCase())},e.prototype.forEach=function(e,t){var r=this;this.map.forEach(function(n,o){e.call(t,n,o,r)})},e.prototype.get=function(e){return this.map.get(e.toLowerCase())||null},e.prototype.has=function(e){return this.map.has(e.toLowerCase())},e.prototype.set=function(e,t){this.map.set(e.toLowerCase(),String(t))},e.prototype.entries=function(){return this.map.entries()},e.prototype.keys=function(){return this.map.keys()},e.prototype.values=function(){return this.map.values()},e.prototype.getSetCookie=function(){var e=[];return this.map.forEach(function(t,r){"set-cookie"===r&&e.push(t)}),e},e.prototype.toJSON=function(){var e={};return this.map.forEach(function(t,r){e[r]=t}),e},e.prototype[Symbol.iterator]=function(){return this.entries()},e}();"object"!=typeof globalThis||globalThis.Headers||(globalThis.Headers=I);var T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var E,O,R=function(e){try{return!!e()}catch(e){return!0}},C=!R(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),A=C,k=Function.prototype,U=k.call,q=A&&k.bind.bind(U,U),L=A?q:function(e){return function(){return U.apply(e,arguments)}},x=L,N=x({}.toString),j=x("".slice),D=function(e){return j(N(e),8,-1)},B=R,M=D,W=Object,F=L("".split),H=B(function(){return!W("z").propertyIsEnumerable(0)})?function(e){return"String"===M(e)?F(e,""):W(e)}:W,z=function(e){return null==e},V=z,G=TypeError,K=function(e){if(V(e))throw new G("Can't call method on "+e);return e},Y=H,Q=K,J=function(e){return Y(Q(e))},$={},Z=function(e){return e&&e.Math===Math&&e},X=Z("object"==typeof globalThis&&globalThis)||Z("object"==typeof window&&window)||Z("object"==typeof self&&self)||Z("object"==typeof T&&T)||Z("object"==typeof T&&T)||function(){return this}()||Function("return this")(),ee="object"==typeof document&&document.all,te=void 0===ee&&void 0!==ee?function(e){return"function"==typeof e||e===ee}:function(e){return"function"==typeof e},re=te,ne=X.WeakMap,oe=re(ne)&&/native code/.test(String(ne)),ie=te,se=function(e){return"object"==typeof e?null!==e:ie(e)},ae=!R(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),ue={},ce=se,le=X.document,he=ce(le)&&ce(le.createElement),de=function(e){return he?le.createElement(e):{}},fe=de,pe=!ae&&!R(function(){return 7!==Object.defineProperty(fe("div"),"a",{get:function(){return 7}}).a}),ve=ae&&R(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),ge=se,me=String,ye=TypeError,be=function(e){if(ge(e))return e;throw new ye(me(e)+" is not an object")},_e=C,we=Function.prototype.call,Se=_e?we.bind(we):function(){return we.apply(we,arguments)},Ie={},Te=Ie,Pe=X,Ee=te,Oe=function(e){return Ee(e)?e:void 0},Re=function(e,t){return arguments.length<2?Oe(Te[e])||Oe(Pe[e]):Te[e]&&Te[e][t]||Pe[e]&&Pe[e][t]},Ce=L({}.isPrototypeOf),Ae=X.navigator,ke=Ae&&Ae.userAgent,Ue=X,qe=ke?String(ke):"",Le=Ue.process,xe=Ue.Deno,Ne=Le&&Le.versions||xe&&xe.version,je=Ne&&Ne.v8;je&&(O=(E=je.split("."))[0]>0&&E[0]<4?1:+(E[0]+E[1])),!O&&qe&&(!(E=qe.match(/Edge\/(\d+)/))||E[1]>=74)&&(E=qe.match(/Chrome\/(\d+)/))&&(O=+E[1]);var De=O,Be=R,Me=X.String,We=!!Object.getOwnPropertySymbols&&!Be(function(){var e=Symbol("symbol detection");return!Me(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&De&&De<41}),Fe=We&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,He=Re,ze=te,Ve=Ce,Ge=Object,Ke=Fe?function(e){return"symbol"==typeof e}:function(e){var t=He("Symbol");return ze(t)&&Ve(t.prototype,Ge(e))},Ye=String,Qe=function(e){try{return Ye(e)}catch(e){return"Object"}},Je=te,$e=Qe,Ze=TypeError,Xe=function(e){if(Je(e))return e;throw new Ze($e(e)+" is not a function")},et=Xe,tt=z,rt=function(e,t){var r=e[t];return tt(r)?void 0:et(r)},nt=Se,ot=te,it=se,st=TypeError,at={exports:{}},ut=X,ct=Object.defineProperty,lt=X,ht=function(e,t){try{ct(ut,e,{value:t,configurable:!0,writable:!0})}catch(r){ut[e]=t}return t},dt="__core-js_shared__",ft=at.exports=lt[dt]||ht(dt,{});(ft.versions||(ft.versions=[])).push({version:"3.45.0",mode:"pure",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.45.0/LICENSE",source:"https://github.com/zloirock/core-js"});var pt=at.exports,vt=pt,gt=function(e,t){return vt[e]||(vt[e]=t||{})},mt=K,yt=Object,bt=function(e){return yt(mt(e))},_t=bt,wt=L({}.hasOwnProperty),St=Object.hasOwn||function(e,t){return wt(_t(e),t)},It=L,Tt=0,Pt=Math.random(),Et=It(1.1.toString),Ot=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Et(++Tt+Pt,36)},Rt=gt,Ct=St,At=Ot,kt=We,Ut=Fe,qt=X.Symbol,Lt=Rt("wks"),xt=Ut?qt.for||qt:qt&&qt.withoutSetter||At,Nt=function(e){return Ct(Lt,e)||(Lt[e]=kt&&Ct(qt,e)?qt[e]:xt("Symbol."+e)),Lt[e]},jt=Se,Dt=se,Bt=Ke,Mt=rt,Wt=function(e,t){var r,n;if("string"===t&&ot(r=e.toString)&&!it(n=nt(r,e)))return n;if(ot(r=e.valueOf)&&!it(n=nt(r,e)))return n;if("string"!==t&&ot(r=e.toString)&&!it(n=nt(r,e)))return n;throw new st("Can't convert object to primitive value")},Ft=TypeError,Ht=Nt("toPrimitive"),zt=function(e,t){if(!Dt(e)||Bt(e))return e;var r,n=Mt(e,Ht);if(n){if(void 0===t&&(t="default"),r=jt(n,e,t),!Dt(r)||Bt(r))return r;throw new Ft("Can't convert object to primitive value")}return void 0===t&&(t="number"),Wt(e,t)},Vt=Ke,Gt=function(e){var t=zt(e,"string");return Vt(t)?t:t+""},Kt=ae,Yt=pe,Qt=ve,Jt=be,$t=Gt,Zt=TypeError,Xt=Object.defineProperty,er=Object.getOwnPropertyDescriptor,tr="enumerable",rr="configurable",nr="writable";ue.f=Kt?Qt?function(e,t,r){if(Jt(e),t=$t(t),Jt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&nr in r&&!r[nr]){var n=er(e,t);n&&n[nr]&&(e[t]=r.value,r={configurable:rr in r?r[rr]:n[rr],enumerable:tr in r?r[tr]:n[tr],writable:!1})}return Xt(e,t,r)}:Xt:function(e,t,r){if(Jt(e),t=$t(t),Jt(r),Yt)try{return Xt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Zt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var or,ir,sr,ar=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ur=ue,cr=ar,lr=ae?function(e,t,r){return ur.f(e,t,cr(1,r))}:function(e,t,r){return e[t]=r,e},hr=Ot,dr=gt("keys"),fr=function(e){return dr[e]||(dr[e]=hr(e))},pr={},vr=oe,gr=X,mr=se,yr=lr,br=St,_r=pt,wr=fr,Sr=pr,Ir="Object already initialized",Tr=gr.TypeError,Pr=gr.WeakMap;if(vr||_r.state){var Er=_r.state||(_r.state=new Pr);Er.get=Er.get,Er.has=Er.has,Er.set=Er.set,or=function(e,t){if(Er.has(e))throw new Tr(Ir);return t.facade=e,Er.set(e,t),t},ir=function(e){return Er.get(e)||{}},sr=function(e){return Er.has(e)}}else{var Or=wr("state");Sr[Or]=!0,or=function(e,t){if(br(e,Or))throw new Tr(Ir);return t.facade=e,yr(e,Or,t),t},ir=function(e){return br(e,Or)?e[Or]:{}},sr=function(e){return br(e,Or)}}var Rr={set:or,get:ir,has:sr,enforce:function(e){return sr(e)?ir(e):or(e,{})},getterFor:function(e){return function(t){var r;if(!mr(t)||(r=ir(t)).type!==e)throw new Tr("Incompatible receiver, "+e+" required");return r}}},Cr=C,Ar=Function.prototype,kr=Ar.apply,Ur=Ar.call,qr="object"==typeof Reflect&&Reflect.apply||(Cr?Ur.bind(kr):function(){return Ur.apply(kr,arguments)}),Lr=D,xr=L,Nr=function(e){if("Function"===Lr(e))return xr(e)},jr={},Dr={},Br={}.propertyIsEnumerable,Mr=Object.getOwnPropertyDescriptor,Wr=Mr&&!Br.call({1:2},1);Dr.f=Wr?function(e){var t=Mr(this,e);return!!t&&t.enumerable}:Br;var Fr=ae,Hr=Se,zr=Dr,Vr=ar,Gr=J,Kr=Gt,Yr=St,Qr=pe,Jr=Object.getOwnPropertyDescriptor;jr.f=Fr?Jr:function(e,t){if(e=Gr(e),t=Kr(t),Qr)try{return Jr(e,t)}catch(e){}if(Yr(e,t))return Vr(!Hr(zr.f,e,t),e[t])};var $r=R,Zr=te,Xr=/#|\.prototype\./,en=function(e,t){var r=rn[tn(e)];return r===on||r!==nn&&(Zr(t)?$r(t):!!t)},tn=en.normalize=function(e){return String(e).replace(Xr,".").toLowerCase()},rn=en.data={},nn=en.NATIVE="N",on=en.POLYFILL="P",sn=en,an=Xe,un=C,cn=Nr(Nr.bind),ln=function(e,t){return an(e),void 0===t?e:un?cn(e,t):function(){return e.apply(t,arguments)}},hn=X,dn=qr,fn=Nr,pn=te,vn=jr.f,gn=sn,mn=Ie,yn=ln,bn=lr,_n=St,wn=function(e){var t=function(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return dn(e,this,arguments)};return t.prototype=e.prototype,t},Sn=function(e,t){var r,n,o,i,s,a,u,c,l,h=e.target,d=e.global,f=e.stat,p=e.proto,v=d?hn:f?hn[h]:hn[h]&&hn[h].prototype,g=d?mn:mn[h]||bn(mn,h,{})[h],m=g.prototype;for(i in t)n=!(r=gn(d?i:h+(f?".":"#")+i,e.forced))&&v&&_n(v,i),a=g[i],n&&(u=e.dontCallGetSet?(l=vn(v,i))&&l.value:v[i]),s=n&&u?u:t[i],(r||p||typeof a!=typeof s)&&(c=e.bind&&n?yn(s,hn):e.wrap&&n?wn(s):p&&pn(s)?fn(s):s,(e.sham||s&&s.sham||a&&a.sham)&&bn(c,"sham",!0),bn(g,i,c),p&&(_n(mn,o=h+"Prototype")||bn(mn,o,{}),bn(mn[o],i,s),e.real&&m&&(r||!m[i])&&bn(m,i,s)))},In=ae,Tn=St,Pn=Function.prototype,En=In&&Object.getOwnPropertyDescriptor,On=Tn(Pn,"name"),Rn={EXISTS:On,PROPER:On&&"something"===function(){}.name,CONFIGURABLE:On&&(!In||In&&En(Pn,"name").configurable)},Cn={},An=Math.ceil,kn=Math.floor,Un=Math.trunc||function(e){var t=+e;return(t>0?kn:An)(t)},qn=Un,Ln=function(e){var t=+e;return t!=t||0===t?0:qn(t)},xn=Ln,Nn=Math.max,jn=Math.min,Dn=function(e,t){var r=xn(e);return r<0?Nn(r+t,0):jn(r,t)},Bn=Ln,Mn=Math.min,Wn=function(e){var t=Bn(e);return t>0?Mn(t,9007199254740991):0},Fn=function(e){return Wn(e.length)},Hn=J,zn=Dn,Vn=Fn,Gn=function(e){return function(t,r,n){var o=Hn(t),i=Vn(o);if(0===i)return!e&&-1;var s,a=zn(n,i);if(e&&r!=r){for(;i>a;)if((s=o[a++])!=s)return!0}else for(;i>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},Kn={includes:Gn(!0),indexOf:Gn(!1)},Yn=St,Qn=J,Jn=Kn.indexOf,$n=pr,Zn=L([].push),Xn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],eo=function(e,t){var r,n=Qn(e),o=0,i=[];for(r in n)!Yn($n,r)&&Yn(n,r)&&Zn(i,r);for(;t.length>o;)Yn(n,r=t[o++])&&(~Jn(i,r)||Zn(i,r));return i},to=Xn,ro=Object.keys||function(e){return eo(e,to)},no=ae,oo=ve,io=ue,so=be,ao=J,uo=ro;Cn.f=no&&!oo?Object.defineProperties:function(e,t){so(e);for(var r,n=ao(t),o=uo(t),i=o.length,s=0;i>s;)io.f(e,r=o[s++],n[r]);return e};var co,lo=Re("document","documentElement"),ho=be,fo=Cn,po=Xn,vo=pr,go=lo,mo=de,yo="prototype",bo="script",_o=fr("IE_PROTO"),wo=function(){},So=function(e){return"<"+bo+">"+e+"</"+bo+">"},Io=function(e){e.write(So("")),e.close();var t=e.parentWindow.Object;return e=null,t},To=function(){try{co=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;To="undefined"!=typeof document?document.domain&&co?Io(co):(t=mo("iframe"),r="java"+bo+":",t.style.display="none",go.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(So("document.F=Object")),e.close(),e.F):Io(co);for(var n=po.length;n--;)delete To[yo][po[n]];return To()};vo[_o]=!0;var Po,Eo,Oo,Ro=Object.create||function(e,t){var r;return null!==e?(wo[yo]=ho(e),r=new wo,wo[yo]=null,r[_o]=e):r=To(),void 0===t?r:fo.f(r,t)},Co=!R(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Ao=St,ko=te,Uo=bt,qo=Co,Lo=fr("IE_PROTO"),xo=Object,No=xo.prototype,jo=qo?xo.getPrototypeOf:function(e){var t=Uo(e);if(Ao(t,Lo))return t[Lo];var r=t.constructor;return ko(r)&&t instanceof r?r.prototype:t instanceof xo?No:null},Do=lr,Bo=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Do(e,t,r),e},Mo=R,Wo=te,Fo=se,Ho=Ro,zo=jo,Vo=Bo,Go=Nt("iterator"),Ko=!1;[].keys&&("next"in(Oo=[].keys())?(Eo=zo(zo(Oo)))!==Object.prototype&&(Po=Eo):Ko=!0);var Yo=!Fo(Po)||Mo(function(){var e={};return Po[Go].call(e)!==e});Wo((Po=Yo?{}:Ho(Po))[Go])||Vo(Po,Go,function(){return this});var Qo={IteratorPrototype:Po,BUGGY_SAFARI_ITERATORS:Ko},Jo={};Jo[Nt("toStringTag")]="z";var $o="[object z]"===String(Jo),Zo=$o,Xo=te,ei=D,ti=Nt("toStringTag"),ri=Object,ni="Arguments"===ei(function(){return arguments}()),oi=Zo?ei:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=ri(e),ti))?r:ni?ei(t):"Object"===(n=ei(t))&&Xo(t.callee)?"Arguments":n},ii=oi,si=$o?{}.toString:function(){return"[object "+ii(this)+"]"},ai=$o,ui=ue.f,ci=lr,li=St,hi=si,di=Nt("toStringTag"),fi=function(e,t,r,n){var o=r?e:e&&e.prototype;o&&(li(o,di)||ui(o,di,{configurable:!0,value:t}),n&&!ai&&ci(o,"toString",hi))},pi=Qo.IteratorPrototype,vi=Ro,gi=ar,mi=fi,yi=$,bi=function(){return this},_i=function(e,t,r,n){var o=t+" Iterator";return e.prototype=vi(pi,{next:gi(+!n,r)}),mi(e,o,!1,!0),yi[o]=bi,e},wi=Sn,Si=Se,Ii=Rn,Ti=_i,Pi=jo,Ei=fi,Oi=Bo,Ri=$,Ci=Qo,Ai=Ii.PROPER,ki=Ci.BUGGY_SAFARI_ITERATORS,Ui=Nt("iterator"),qi="keys",Li="values",xi="entries",Ni=function(){return this},ji=function(e,t,r,n,o,i,s){Ti(r,t,n);var a,u,c,l=function(e){if(e===o&&v)return v;if(!ki&&e&&e in f)return f[e];switch(e){case qi:case Li:case xi:return function(){return new r(this,e)}}return function(){return new r(this)}},h=t+" Iterator",d=!1,f=e.prototype,p=f[Ui]||f["@@iterator"]||o&&f[o],v=!ki&&p||l(o),g="Array"===t&&f.entries||p;if(g&&(a=Pi(g.call(new e)))!==Object.prototype&&a.next&&(Ei(a,h,!0,!0),Ri[h]=Ni),Ai&&o===Li&&p&&p.name!==Li&&(d=!0,v=function(){return Si(p,this)}),o)if(u={values:l(Li),keys:i?v:l(qi),entries:l(xi)},s)for(c in u)(ki||d||!(c in f))&&Oi(f,c,u[c]);else wi({target:t,proto:!0,forced:ki||d},u);return s&&f[Ui]!==v&&Oi(f,Ui,v,{name:o}),Ri[t]=v,u},Di=function(e,t){return{value:e,done:t}},Bi=J,Mi=$,Wi=Rr;ue.f;var Fi=ji,Hi=Di,zi="Array Iterator",Vi=Wi.set,Gi=Wi.getterFor(zi);Fi(Array,"Array",function(e,t){Vi(this,{type:zi,target:Bi(e),index:0,kind:t})},function(){var e=Gi(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,Hi(void 0,!0);switch(e.kind){case"keys":return Hi(r,!1);case"values":return Hi(t[r],!1)}return Hi([r,t[r]],!1)},"values"),Mi.Arguments=Mi.Array;var Ki=Sn,Yi=L,Qi=Dn,Ji=RangeError,$i=String.fromCharCode,Zi=String.fromCodePoint,Xi=Yi([].join);Ki({target:"String",stat:!0,arity:1,forced:!!Zi&&1!==Zi.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,o=0;n>o;){if(t=+arguments[o++],Qi(t,1114111)!==t)throw new Ji(t+" is not a valid code point");r[o]=t<65536?$i(t):$i(55296+((t-=65536)>>10),t%1024+56320)}return Xi(r,"")}});var es=X,ts=ae,rs=Object.getOwnPropertyDescriptor,ns=R,os=!0,is=Nt("iterator"),ss=!ns(function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return e.pathname="c%20d",t.forEach(function(e,r){t.delete("b"),n+=r+e}),r.delete("a",2),r.delete("b",void 0),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b")||!t.size&&os||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[is]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==n||"x"!==new URL("https://x",void 0).host}),as=ue,us=function(e,t,r){return as.f(e,t,r)},cs=Bo,ls=Ce,hs=TypeError,ds=function(e,t){if(ls(t,e))return e;throw new hs("Incorrect invocation")},fs=oi,ps=String,vs=function(e){if("Symbol"===fs(e))throw new TypeError("Cannot convert a Symbol value to a string");return ps(e)},gs=oi,ms=rt,ys=z,bs=$,_s=Nt("iterator"),ws=function(e){if(!ys(e))return ms(e,_s)||ms(e,"@@iterator")||bs[gs(e)]},Ss=Se,Is=Xe,Ts=be,Ps=Qe,Es=ws,Os=TypeError,Rs=function(e,t){var r=arguments.length<2?Es(e):t;if(Is(r))return Ts(Ss(r,e));throw new Os(Ps(e)+" is not iterable")},Cs=TypeError,As=function(e,t){if(e<t)throw new Cs("Not enough arguments");return e},ks=L([].slice),Us=ks,qs=Math.floor,Ls=function(e,t){var r=e.length;if(r<8)for(var n,o,i=1;i<r;){for(o=i,n=e[i];o&&t(e[o-1],n)>0;)e[o]=e[--o];o!==i++&&(e[o]=n)}else for(var s=qs(r/2),a=Ls(Us(e,0,s),t),u=Ls(Us(e,s),t),c=a.length,l=u.length,h=0,d=0;h<c||d<l;)e[h+d]=h<c&&d<l?t(a[h],u[d])<=0?a[h++]:u[d++]:h<c?a[h++]:u[d++];return e},xs=Sn,Ns=X,js=function(e){if(!ts)return es[e];var t=rs(es,e);return t&&t.value},Ds=Re,Bs=Se,Ms=L,Ws=ae,Fs=ss,Hs=Bo,zs=us,Vs=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:cs(e,n,t[n],r);return e},Gs=fi,Ks=_i,Ys=Rr,Qs=ds,Js=te,$s=St,Zs=ln,Xs=oi,ea=be,ta=se,ra=vs,na=Ro,oa=ar,ia=Rs,sa=ws,aa=Di,ua=As,ca=Ls,la=Nt("iterator"),ha="URLSearchParams",da=ha+"Iterator",fa=Ys.set,pa=Ys.getterFor(ha),va=Ys.getterFor(da),ga=js("fetch"),ma=js("Request"),ya=js("Headers"),ba=ma&&ma.prototype,_a=ya&&ya.prototype,wa=Ns.TypeError,Sa=Ns.encodeURIComponent,Ia=String.fromCharCode,Ta=Ds("String","fromCodePoint"),Pa=parseInt,Ea=Ms("".charAt),Oa=Ms([].join),Ra=Ms([].push),Ca=Ms("".replace),Aa=Ms([].shift),ka=Ms([].splice),Ua=Ms("".split),qa=Ms("".slice),La=Ms(/./.exec),xa=/\+/g,Na=/^[0-9a-f]+$/i,ja=function(e,t){var r=qa(e,t,t+2);return La(Na,r)?Pa(r,16):NaN},Da=function(e){for(var t=0,r=128;r>0&&0!==(e&r);r>>=1)t++;return t},Ba=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},Ma=function(e){for(var t=(e=Ca(e,xa," ")).length,r="",n=0;n<t;){var o=Ea(e,n);if("%"===o){if("%"===Ea(e,n+1)||n+3>t){r+="%",n++;continue}var i=ja(e,n+1);if(i!=i){r+=o,n++;continue}n+=2;var s=Da(i);if(0===s)o=Ia(i);else{if(1===s||s>4){r+="�",n++;continue}for(var a=[i],u=1;u<s&&!(++n+3>t||"%"!==Ea(e,n));){var c=ja(e,n+1);if(c!=c){n+=3;break}if(c>191||c<128)break;Ra(a,c),n+=2,u++}if(a.length!==s){r+="�";continue}var l=Ba(a);null===l?r+="�":o=Ta(l)}}r+=o,n++}return r},Wa=/[!'()~]|%20/g,Fa={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Ha=function(e){return Fa[e]},za=function(e){return Ca(Sa(e),Wa,Ha)},Va=Ks(function(e,t){fa(this,{type:da,target:pa(e).entries,index:0,kind:t})},ha,function(){var e=va(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,aa(void 0,!0);var n=t[r];switch(e.kind){case"keys":return aa(n.key,!1);case"values":return aa(n.value,!1)}return aa([n.key,n.value],!1)},!0),Ga=function(e){this.entries=[],this.url=null,void 0!==e&&(ta(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Ea(e,0)?qa(e,1):e:ra(e)))};Ga.prototype={type:ha,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,o,i,s,a,u=this.entries,c=sa(e);if(c)for(r=(t=ia(e,c)).next;!(n=Bs(r,t)).done;){if(i=(o=ia(ea(n.value))).next,(s=Bs(i,o)).done||(a=Bs(i,o)).done||!Bs(i,o).done)throw new wa("Expected sequence with length 2");Ra(u,{key:ra(s.value),value:ra(a.value)})}else for(var l in e)$s(e,l)&&Ra(u,{key:l,value:ra(e[l])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,o=Ua(e,"&"),i=0;i<o.length;)(t=o[i++]).length&&(r=Ua(t,"="),Ra(n,{key:Ma(Aa(r)),value:Ma(Oa(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],Ra(r,za(e.key)+"="+za(e.value));return Oa(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Ka=function(){Qs(this,Ya);var e=fa(this,new Ga(arguments.length>0?arguments[0]:void 0));Ws||(this.size=e.entries.length)},Ya=Ka.prototype;if(Vs(Ya,{append:function(e,t){var r=pa(this);ua(arguments.length,2),Ra(r.entries,{key:ra(e),value:ra(t)}),Ws||this.length++,r.updateURL()},delete:function(e){for(var t=pa(this),r=ua(arguments.length,1),n=t.entries,o=ra(e),i=r<2?void 0:arguments[1],s=void 0===i?i:ra(i),a=0;a<n.length;){var u=n[a];if(u.key!==o||void 0!==s&&u.value!==s)a++;else if(ka(n,a,1),void 0!==s)break}Ws||(this.size=n.length),t.updateURL()},get:function(e){var t=pa(this).entries;ua(arguments.length,1);for(var r=ra(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=pa(this).entries;ua(arguments.length,1);for(var r=ra(e),n=[],o=0;o<t.length;o++)t[o].key===r&&Ra(n,t[o].value);return n},has:function(e){for(var t=pa(this).entries,r=ua(arguments.length,1),n=ra(e),o=r<2?void 0:arguments[1],i=void 0===o?o:ra(o),s=0;s<t.length;){var a=t[s++];if(a.key===n&&(void 0===i||a.value===i))return!0}return!1},set:function(e,t){var r=pa(this);ua(arguments.length,1);for(var n,o=r.entries,i=!1,s=ra(e),a=ra(t),u=0;u<o.length;u++)(n=o[u]).key===s&&(i?ka(o,u--,1):(i=!0,n.value=a));i||Ra(o,{key:s,value:a}),Ws||(this.size=o.length),r.updateURL()},sort:function(){var e=pa(this);ca(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,r=pa(this).entries,n=Zs(e,arguments.length>1?arguments[1]:void 0),o=0;o<r.length;)n((t=r[o++]).value,t.key,this)},keys:function(){return new Va(this,"keys")},values:function(){return new Va(this,"values")},entries:function(){return new Va(this,"entries")}},{enumerable:!0}),Hs(Ya,la,Ya.entries,{name:"entries"}),Hs(Ya,"toString",function(){return pa(this).serialize()},{enumerable:!0}),Ws&&zs(Ya,"size",{get:function(){return pa(this).entries.length},configurable:!0,enumerable:!0}),Gs(Ka,ha),xs({global:!0,constructor:!0,forced:!Fs},{URLSearchParams:Ka}),!Fs&&Js(ya)){var Qa=Ms(_a.has),Ja=Ms(_a.set),$a=function(e){if(ta(e)){var t,r=e.body;if(Xs(r)===ha)return t=e.headers?new ya(e.headers):new ya,Qa(t,"content-type")||Ja(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),na(e,{body:oa(0,ra(r)),headers:oa(0,t)})}return e};if(Js(ga)&&xs({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return ga(e,arguments.length>1?$a(arguments[1]):{})}}),Js(ma)){var Za=function(e){return Qs(this,ba),new ma(e,arguments.length>1?$a(arguments[1]):{})};ba.constructor=Za,Za.prototype=ba,xs({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Za})}}var Xa={URLSearchParams:Ka,getState:pa},eu=L,tu=Ln,ru=vs,nu=K,ou=eu("".charAt),iu=eu("".charCodeAt),su=eu("".slice),au=function(e){return function(t,r){var n,o,i=ru(nu(t)),s=tu(r),a=i.length;return s<0||s>=a?e?"":void 0:(n=iu(i,s))<55296||n>56319||s+1===a||(o=iu(i,s+1))<56320||o>57343?e?ou(i,s):n:e?su(i,s,s+2):o-56320+(n-55296<<10)+65536}},uu={codeAt:au(!1),charAt:au(!0)},cu=uu.charAt,lu=vs,hu=Rr,du=ji,fu=Di,pu="String Iterator",vu=hu.set,gu=hu.getterFor(pu);du(String,"String",function(e){vu(this,{type:pu,string:lu(e),index:0})},function(){var e,t=gu(this),r=t.string,n=t.index;return n>=r.length?fu(void 0,!0):(e=cu(r,n),t.index+=e.length,fu(e,!1))});var mu={};mu.f=Object.getOwnPropertySymbols;var yu=ae,bu=L,_u=Se,wu=R,Su=ro,Iu=mu,Tu=Dr,Pu=bt,Eu=H,Ou=Object.assign,Ru=Object.defineProperty,Cu=bu([].concat),Au=!Ou||wu(function(){if(yu&&1!==Ou({b:1},Ou(Ru({},"a",{enumerable:!0,get:function(){Ru(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!==Ou({},e)[r]||Su(Ou({},t)).join("")!==n})?function(e,t){for(var r=Pu(e),n=arguments.length,o=1,i=Iu.f,s=Tu.f;n>o;)for(var a,u=Eu(arguments[o++]),c=i?Cu(Su(u),i(u)):Su(u),l=c.length,h=0;l>h;)a=c[h++],yu&&!_u(s,u,a)||(r[a]=u[a]);return r}:Ou,ku=Se,Uu=be,qu=rt,Lu=be,xu=function(e,t,r){var n,o;Uu(e);try{if(!(n=qu(e,"return"))){if("throw"===t)throw r;return r}n=ku(n,e)}catch(e){o=!0,n=e}if("throw"===t)throw r;if(o)throw n;return Uu(n),r},Nu=$,ju=Nt("iterator"),Du=Array.prototype,Bu=te,Mu=pt,Wu=L(Function.toString);Bu(Mu.inspectSource)||(Mu.inspectSource=function(e){return Wu(e)});var Fu=Mu.inspectSource,Hu=L,zu=R,Vu=te,Gu=oi,Ku=Fu,Yu=function(){},Qu=Re("Reflect","construct"),Ju=/^\s*(?:class|function)\b/,$u=Hu(Ju.exec),Zu=!Ju.test(Yu),Xu=function(e){if(!Vu(e))return!1;try{return Qu(Yu,[],e),!0}catch(e){return!1}},ec=function(e){if(!Vu(e))return!1;switch(Gu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Zu||!!$u(Ju,Ku(e))}catch(e){return!0}};ec.sham=!0;var tc,rc=!Qu||zu(function(){var e;return Xu(Xu.call)||!Xu(Object)||!Xu(function(){e=!0})||e})?ec:Xu,nc=ae,oc=ue,ic=ar,sc=ln,ac=Se,uc=bt,cc=function(e,t,r,n){try{return n?t(Lu(r)[0],r[1]):t(r)}catch(t){xu(e,"throw",t)}},lc=function(e){return void 0!==e&&(Nu.Array===e||Du[ju]===e)},hc=rc,dc=Fn,fc=function(e,t,r){nc?oc.f(e,t,ic(0,r)):e[t]=r},pc=Rs,vc=ws,gc=Array,mc=L,yc=2147483647,bc=/[^\0-\u007E]/,_c=/[.\u3002\uFF0E\uFF61]/g,wc="Overflow: input needs wider integers to process",Sc=RangeError,Ic=mc(_c.exec),Tc=Math.floor,Pc=String.fromCharCode,Ec=mc("".charCodeAt),Oc=mc([].join),Rc=mc([].push),Cc=mc("".replace),Ac=mc("".split),kc=mc("".toLowerCase),Uc=function(e){return e+22+75*(e<26)},qc=function(e,t,r){var n=0;for(e=r?Tc(e/700):e>>1,e+=Tc(e/t);e>455;)e=Tc(e/35),n+=36;return Tc(n+36*e/(e+38))},Lc=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var o=Ec(e,r++);if(o>=55296&&o<=56319&&r<n){var i=Ec(e,r++);56320==(64512&i)?Rc(t,((1023&o)<<10)+(1023&i)+65536):(Rc(t,o),r--)}else Rc(t,o)}return t}(e);var r,n,o=e.length,i=128,s=0,a=72;for(r=0;r<e.length;r++)(n=e[r])<128&&Rc(t,Pc(n));var u=t.length,c=u;for(u&&Rc(t,"-");c<o;){var l=yc;for(r=0;r<e.length;r++)(n=e[r])>=i&&n<l&&(l=n);var h=c+1;if(l-i>Tc((yc-s)/h))throw new Sc(wc);for(s+=(l-i)*h,i=l,r=0;r<e.length;r++){if((n=e[r])<i&&++s>yc)throw new Sc(wc);if(n===i){for(var d=s,f=36;;){var p=f<=a?1:f>=a+26?26:f-a;if(d<p)break;var v=d-p,g=36-p;Rc(t,Pc(Uc(p+v%g))),d=Tc(v/g),f+=36}Rc(t,Pc(Uc(d))),a=qc(s,h,c===u),s=0,c++}}s++,i++}return Oc(t,"")},xc=Sn,Nc=ae,jc=ss,Dc=X,Bc=ln,Mc=L,Wc=Bo,Fc=us,Hc=ds,zc=St,Vc=Au,Gc=function(e){var t=uc(e),r=hc(this),n=arguments.length,o=n>1?arguments[1]:void 0,i=void 0!==o;i&&(o=sc(o,n>2?arguments[2]:void 0));var s,a,u,c,l,h,d=vc(t),f=0;if(!d||this===gc&&lc(d))for(s=dc(t),a=r?new this(s):gc(s);s>f;f++)h=i?o(t[f],f):t[f],fc(a,f,h);else for(a=r?new this:[],l=(c=pc(t,d)).next;!(u=ac(l,c)).done;f++)h=i?cc(c,o,[u.value,f],!0):u.value,fc(a,f,h);return a.length=f,a},Kc=ks,Yc=uu.codeAt,Qc=function(e){var t,r,n=[],o=Ac(Cc(kc(e),_c,"."),".");for(t=0;t<o.length;t++)r=o[t],Rc(n,Ic(bc,r)?"xn--"+Lc(r):r);return Oc(n,".")},Jc=vs,$c=fi,Zc=As,Xc=Xa,el=Rr,tl=el.set,rl=el.getterFor("URL"),nl=Xc.URLSearchParams,ol=Xc.getState,il=Dc.URL,sl=Dc.TypeError,al=Dc.parseInt,ul=Math.floor,cl=Math.pow,ll=Mc("".charAt),hl=Mc(/./.exec),dl=Mc([].join),fl=Mc(1.1.toString),pl=Mc([].pop),vl=Mc([].push),gl=Mc("".replace),ml=Mc([].shift),yl=Mc("".split),bl=Mc("".slice),_l=Mc("".toLowerCase),wl=Mc([].unshift),Sl="Invalid scheme",Il="Invalid host",Tl="Invalid port",Pl=/[a-z]/i,El=/[\d+-.a-z]/i,Ol=/\d/,Rl=/^0x/i,Cl=/^[0-7]+$/,Al=/^\d+$/,kl=/^[\da-f]+$/i,Ul=/[\0\t\n\r #%/:<>?@[\\\]^|]/,ql=/[\0\t\n\r #/:<>?@[\\\]^|]/,Ll=/^[\u0000-\u0020]+/,xl=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Nl=/[\t\n\r]/g,jl=function(e){var t,r,n,o;if("number"==typeof e){for(t=[],r=0;r<4;r++)wl(t,e%256),e=ul(e/256);return dl(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,o=0,i=0;i<8;i++)0!==e[i]?(o>r&&(t=n,r=o),n=null,o=0):(null===n&&(n=i),++o);return o>r?n:t}(e),r=0;r<8;r++)o&&0===e[r]||(o&&(o=!1),n===r?(t+=r?":":"::",o=!0):(t+=fl(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Dl={},Bl=Vc({},Dl,{" ":1,'"':1,"<":1,">":1,"`":1}),Ml=Vc({},Bl,{"#":1,"?":1,"{":1,"}":1}),Wl=Vc({},Ml,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Fl=function(e,t){var r=Yc(e,0);return r>32&&r<127&&!zc(t,e)?e:encodeURIComponent(e)},Hl={ftp:21,file:null,http:80,https:443,ws:80,wss:443},zl=function(e,t){var r;return 2===e.length&&hl(Pl,ll(e,0))&&(":"===(r=ll(e,1))||!t&&"|"===r)},Vl=function(e){var t;return e.length>1&&zl(bl(e,0,2))&&(2===e.length||"/"===(t=ll(e,2))||"\\"===t||"?"===t||"#"===t)},Gl=function(e){return"."===e||"%2e"===_l(e)},Kl=function(e){return".."===(e=_l(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},Yl={},Ql={},Jl={},$l={},Zl={},Xl={},eh={},th={},rh={},nh={},oh={},ih={},sh={},ah={},uh={},ch={},lh={},hh={},dh={},fh={},ph={},vh=function(e,t,r){var n,o,i,s=Jc(e);if(t){if(o=this.parse(s))throw new sl(o);this.searchParams=null}else{if(void 0!==r&&(n=new vh(r,!0)),o=this.parse(s,null,n))throw new sl(o);(i=ol(new nl)).bindURL(this),this.searchParams=i}};vh.prototype={type:"URL",parse:function(e,t,r){var n,o,i,s,a=this,u=t||Yl,c=0,l="",h=!1,d=!1,f=!1;for(e=Jc(e),t||(a.scheme="",a.username="",a.password="",a.host=null,a.port=null,a.path=[],a.query=null,a.fragment=null,a.cannotBeABaseURL=!1,e=gl(e,Ll,""),e=gl(e,xl,"$1")),e=gl(e,Nl,""),n=Gc(e);c<=n.length;){switch(o=n[c],u){case Yl:if(!o||!hl(Pl,o)){if(t)return Sl;u=Jl;continue}l+=_l(o),u=Ql;break;case Ql:if(o&&(hl(El,o)||"+"===o||"-"===o||"."===o))l+=_l(o);else{if(":"!==o){if(t)return Sl;l="",u=Jl,c=0;continue}if(t&&(a.isSpecial()!==zc(Hl,l)||"file"===l&&(a.includesCredentials()||null!==a.port)||"file"===a.scheme&&!a.host))return;if(a.scheme=l,t)return void(a.isSpecial()&&Hl[a.scheme]===a.port&&(a.port=null));l="","file"===a.scheme?u=ah:a.isSpecial()&&r&&r.scheme===a.scheme?u=$l:a.isSpecial()?u=th:"/"===n[c+1]?(u=Zl,c++):(a.cannotBeABaseURL=!0,vl(a.path,""),u=dh)}break;case Jl:if(!r||r.cannotBeABaseURL&&"#"!==o)return Sl;if(r.cannotBeABaseURL&&"#"===o){a.scheme=r.scheme,a.path=Kc(r.path),a.query=r.query,a.fragment="",a.cannotBeABaseURL=!0,u=ph;break}u="file"===r.scheme?ah:Xl;continue;case $l:if("/"!==o||"/"!==n[c+1]){u=Xl;continue}u=rh,c++;break;case Zl:if("/"===o){u=nh;break}u=hh;continue;case Xl:if(a.scheme=r.scheme,o===tc)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Kc(r.path),a.query=r.query;else if("/"===o||"\\"===o&&a.isSpecial())u=eh;else if("?"===o)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Kc(r.path),a.query="",u=fh;else{if("#"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Kc(r.path),a.path.length--,u=hh;continue}a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Kc(r.path),a.query=r.query,a.fragment="",u=ph}break;case eh:if(!a.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,u=hh;continue}u=nh}else u=rh;break;case th:if(u=rh,"/"!==o||"/"!==ll(l,c+1))continue;c++;break;case rh:if("/"!==o&&"\\"!==o){u=nh;continue}break;case nh:if("@"===o){h&&(l="%40"+l),h=!0,i=Gc(l);for(var p=0;p<i.length;p++){var v=i[p];if(":"!==v||f){var g=Fl(v,Wl);f?a.password+=g:a.username+=g}else f=!0}l=""}else if(o===tc||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(h&&""===l)return"Invalid authority";c-=Gc(l).length+1,l="",u=oh}else l+=o;break;case oh:case ih:if(t&&"file"===a.scheme){u=ch;continue}if(":"!==o||d){if(o===tc||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(a.isSpecial()&&""===l)return Il;if(t&&""===l&&(a.includesCredentials()||null!==a.port))return;if(s=a.parseHost(l))return s;if(l="",u=lh,t)return;continue}"["===o?d=!0:"]"===o&&(d=!1),l+=o}else{if(""===l)return Il;if(s=a.parseHost(l))return s;if(l="",u=sh,t===ih)return}break;case sh:if(!hl(Ol,o)){if(o===tc||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()||t){if(""!==l){var m=al(l,10);if(m>65535)return Tl;a.port=a.isSpecial()&&m===Hl[a.scheme]?null:m,l=""}if(t)return;u=lh;continue}return Tl}l+=o;break;case ah:if(a.scheme="file","/"===o||"\\"===o)u=uh;else{if(!r||"file"!==r.scheme){u=hh;continue}switch(o){case tc:a.host=r.host,a.path=Kc(r.path),a.query=r.query;break;case"?":a.host=r.host,a.path=Kc(r.path),a.query="",u=fh;break;case"#":a.host=r.host,a.path=Kc(r.path),a.query=r.query,a.fragment="",u=ph;break;default:Vl(dl(Kc(n,c),""))||(a.host=r.host,a.path=Kc(r.path),a.shortenPath()),u=hh;continue}}break;case uh:if("/"===o||"\\"===o){u=ch;break}r&&"file"===r.scheme&&!Vl(dl(Kc(n,c),""))&&(zl(r.path[0],!0)?vl(a.path,r.path[0]):a.host=r.host),u=hh;continue;case ch:if(o===tc||"/"===o||"\\"===o||"?"===o||"#"===o){if(!t&&zl(l))u=hh;else if(""===l){if(a.host="",t)return;u=lh}else{if(s=a.parseHost(l))return s;if("localhost"===a.host&&(a.host=""),t)return;l="",u=lh}continue}l+=o;break;case lh:if(a.isSpecial()){if(u=hh,"/"!==o&&"\\"!==o)continue}else if(t||"?"!==o)if(t||"#"!==o){if(o!==tc&&(u=hh,"/"!==o))continue}else a.fragment="",u=ph;else a.query="",u=fh;break;case hh:if(o===tc||"/"===o||"\\"===o&&a.isSpecial()||!t&&("?"===o||"#"===o)){if(Kl(l)?(a.shortenPath(),"/"===o||"\\"===o&&a.isSpecial()||vl(a.path,"")):Gl(l)?"/"===o||"\\"===o&&a.isSpecial()||vl(a.path,""):("file"===a.scheme&&!a.path.length&&zl(l)&&(a.host&&(a.host=""),l=ll(l,0)+":"),vl(a.path,l)),l="","file"===a.scheme&&(o===tc||"?"===o||"#"===o))for(;a.path.length>1&&""===a.path[0];)ml(a.path);"?"===o?(a.query="",u=fh):"#"===o&&(a.fragment="",u=ph)}else l+=Fl(o,Ml);break;case dh:"?"===o?(a.query="",u=fh):"#"===o?(a.fragment="",u=ph):o!==tc&&(a.path[0]+=Fl(o,Dl));break;case fh:t||"#"!==o?o!==tc&&("'"===o&&a.isSpecial()?a.query+="%27":a.query+="#"===o?"%23":Fl(o,Dl)):(a.fragment="",u=ph);break;case ph:o!==tc&&(a.fragment+=Fl(o,Bl))}c++}},parseHost:function(e){var t,r,n;if("["===ll(e,0)){if("]"!==ll(e,e.length-1))return Il;if(t=function(e){var t,r,n,o,i,s,a,u=[0,0,0,0,0,0,0,0],c=0,l=null,h=0,d=function(){return ll(e,h)};if(":"===d()){if(":"!==ll(e,1))return;h+=2,l=++c}for(;d();){if(8===c)return;if(":"!==d()){for(t=r=0;r<4&&hl(kl,d());)t=16*t+al(d(),16),h++,r++;if("."===d()){if(0===r)return;if(h-=r,c>6)return;for(n=0;d();){if(o=null,n>0){if(!("."===d()&&n<4))return;h++}if(!hl(Ol,d()))return;for(;hl(Ol,d());){if(i=al(d(),10),null===o)o=i;else{if(0===o)return;o=10*o+i}if(o>255)return;h++}u[c]=256*u[c]+o,2!==++n&&4!==n||c++}if(4!==n)return;break}if(":"===d()){if(h++,!d())return}else if(d())return;u[c++]=t}else{if(null!==l)return;h++,l=++c}}if(null!==l)for(s=c-l,c=7;0!==c&&s>0;)a=u[c],u[c--]=u[l+s-1],u[l+--s]=a;else if(8!==c)return;return u}(bl(e,1,-1)),!t)return Il;this.host=t}else if(this.isSpecial()){if(e=Qc(e),hl(Ul,e))return Il;if(t=function(e){var t,r,n,o,i,s,a,u=yl(e,".");if(u.length&&""===u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(r=[],n=0;n<t;n++){if(""===(o=u[n]))return e;if(i=10,o.length>1&&"0"===ll(o,0)&&(i=hl(Rl,o)?16:8,o=bl(o,8===i?1:2)),""===o)s=0;else{if(!hl(10===i?Al:8===i?Cl:kl,o))return e;s=al(o,i)}vl(r,s)}for(n=0;n<t;n++)if(s=r[n],n===t-1){if(s>=cl(256,5-t))return null}else if(s>255)return null;for(a=pl(r),n=0;n<r.length;n++)a+=r[n]*cl(256,3-n);return a}(e),null===t)return Il;this.host=t}else{if(hl(ql,e))return Il;for(t="",r=Gc(e),n=0;n<r.length;n++)t+=Fl(r[n],Dl);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return zc(Hl,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&zl(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,o=e.host,i=e.port,s=e.path,a=e.query,u=e.fragment,c=t+":";return null!==o?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=jl(o),null!==i&&(c+=":"+i)):"file"===t&&(c+="//"),c+=e.cannotBeABaseURL?s[0]:s.length?"/"+dl(s,"/"):"",null!==a&&(c+="?"+a),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw new sl(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new gh(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+jl(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Jc(e)+":",Yl)},getUsername:function(){return this.username},setUsername:function(e){var t=Gc(Jc(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Fl(t[r],Wl)}},getPassword:function(){return this.password},setPassword:function(e){var t=Gc(Jc(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Fl(t[r],Wl)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?jl(e):jl(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,oh)},getHostname:function(){var e=this.host;return null===e?"":jl(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,ih)},getPort:function(){var e=this.port;return null===e?"":Jc(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=Jc(e))?this.port=null:this.parse(e,sh))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+dl(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,lh))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=Jc(e))?this.query=null:("?"===ll(e,0)&&(e=bl(e,1)),this.query="",this.parse(e,fh)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=Jc(e))?("#"===ll(e,0)&&(e=bl(e,1)),this.fragment="",this.parse(e,ph)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var gh=function(e){var t=Hc(this,mh),r=Zc(arguments.length,1)>1?arguments[1]:void 0,n=tl(t,new vh(e,!1,r));Nc||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},mh=gh.prototype,yh=function(e,t){return{get:function(){return rl(this)[e]()},set:t&&function(e){return rl(this)[t](e)},configurable:!0,enumerable:!0}};if(Nc&&(Fc(mh,"href",yh("serialize","setHref")),Fc(mh,"origin",yh("getOrigin")),Fc(mh,"protocol",yh("getProtocol","setProtocol")),Fc(mh,"username",yh("getUsername","setUsername")),Fc(mh,"password",yh("getPassword","setPassword")),Fc(mh,"host",yh("getHost","setHost")),Fc(mh,"hostname",yh("getHostname","setHostname")),Fc(mh,"port",yh("getPort","setPort")),Fc(mh,"pathname",yh("getPathname","setPathname")),Fc(mh,"search",yh("getSearch","setSearch")),Fc(mh,"searchParams",yh("getSearchParams")),Fc(mh,"hash",yh("getHash","setHash"))),Wc(mh,"toJSON",function(){return rl(this).serialize()},{enumerable:!0}),Wc(mh,"toString",function(){return rl(this).serialize()},{enumerable:!0}),il){var bh=il.createObjectURL,_h=il.revokeObjectURL;bh&&Wc(gh,"createObjectURL",Bc(bh,il)),_h&&Wc(gh,"revokeObjectURL",Bc(_h,il))}$c(gh,"URL"),xc({global:!0,constructor:!0,forced:!jc,sham:!Nc},{URL:gh});var wh=Sn,Sh=R,Ih=As,Th=vs,Ph=ss,Eh=Re("URL"),Oh=Ph&&Sh(function(){Eh.canParse()}),Rh=Sh(function(){return 1!==Eh.canParse.length});wh({target:"URL",stat:!0,forced:!Oh||Rh},{canParse:function(e){var t=Ih(arguments.length,1),r=Th(e),n=t<2||void 0===arguments[1]?void 0:Th(arguments[1]);try{return!!new Eh(r,n)}catch(e){return!1}}});var Ch=Sn,Ah=As,kh=vs,Uh=ss,qh=Re("URL");Ch({target:"URL",stat:!0,forced:!Uh},{parse:function(e){var t=Ah(arguments.length,1),r=kh(e),n=t<2||void 0===arguments[1]?void 0:kh(arguments[1]);try{return new qh(r,n)}catch(e){return null}}});var Lh=P(Ie.URL),xh=function(e){function t(t){var r=e.call(this,t.message)||this;return r.name="PostgrestError",r.details=t.details,r.hint=t.hint,r.code=t.code,r}return r(t,e),t}(Error),Nh=function(){function e(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!==(t=e.shouldThrowOnError)&&void 0!==t&&t,this.signal=e.signal,this.isMaybeSingle=null!==(r=e.isMaybeSingle)&&void 0!==r&&r,e.fetch?this.fetch=e.fetch:this.fetch=fetch}return e.prototype.throwOnError=function(){return this.shouldThrowOnError=!0,this},e.prototype.setHeader=function(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this},e.prototype.then=function(e,t){var r=this;void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");var n=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(function(e){return o(r,0,void 0,function(){var t,r,n,o,s,a,u,c,l,h,d,f;return i(this,function(i){switch(i.label){case 0:return t=null,r=null,n=null,o=e.status,s=e.statusText,e.ok?"HEAD"===this.method?[3,2]:[4,e.text()]:[3,3];case 1:""===(c=i.sent())||(r="text/csv"===this.headers.get("Accept")||this.headers.get("Accept")&&(null===(l=this.headers.get("Accept"))||void 0===l?void 0:l.includes("application/vnd.pgrst.plan+text"))?c:JSON.parse(c)),i.label=2;case 2:return a=null===(h=this.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),u=null===(d=e.headers.get("content-range"))||void 0===d?void 0:d.split("/"),a&&u&&u.length>1&&(n=parseInt(u[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(r)&&(r.length>1?(t={code:"PGRST116",details:"Results contain ".concat(r.length," rows, application/vnd.pgrst.object+json requires 1 row"),hint:null,message:"JSON object requested, multiple (or no) rows returned"},r=null,n=null,o=406,s="Not Acceptable"):r=1===r.length?r[0]:null),[3,5];case 3:return[4,e.text()];case 4:c=i.sent();try{t=JSON.parse(c),Array.isArray(t)&&404===e.status&&(r=[],t=null,o=200,s="OK")}catch(r){404===e.status&&""===c?(o=204,s="No Content"):t={message:c}}if(t&&this.isMaybeSingle&&(null===(f=null==t?void 0:t.details)||void 0===f?void 0:f.includes("0 rows"))&&(t=null,o=200,s="OK"),t&&this.shouldThrowOnError)throw new xh(t);i.label=5;case 5:return[2,{error:t,data:r,count:n,status:o,statusText:s}]}})})});return this.shouldThrowOnError||(n=n.catch(function(e){var t,r,n;return{error:{message:"".concat(null!==(t=null==e?void 0:e.name)&&void 0!==t?t:"FetchError",": ").concat(null==e?void 0:e.message),details:"".concat(null!==(r=null==e?void 0:e.stack)&&void 0!==r?r:""),hint:"",code:"".concat(null!==(n=null==e?void 0:e.code)&&void 0!==n?n:"")},data:null,count:null,status:0,statusText:""}})),n.then(e,t)},e.prototype.returns=function(){return this},e.prototype.overrideTypes=function(){return this},e}(),jh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.select=function(e){var t=!1,r=(null!=e?e:"*").split("").map(function(e){return/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)}).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this},t.prototype.order=function(e,t){var r=void 0===t?{}:t,n=r.ascending,o=void 0===n||n,i=r.nullsFirst,s=r.foreignTable,a=r.referencedTable,u=void 0===a?s:a,c=u?"".concat(u,".order"):"order",l=this.url.searchParams.get(c);return this.url.searchParams.set(c,"".concat(l?"".concat(l,","):"").concat(e,".").concat(o?"asc":"desc").concat(void 0===i?"":i?".nullsfirst":".nullslast")),this},t.prototype.limit=function(e,t){var r=void 0===t?{}:t,n=r.foreignTable,o=r.referencedTable,i=void 0===o?n:o,s=void 0===i?"limit":"".concat(i,".limit");return this.url.searchParams.set(s,"".concat(e)),this},t.prototype.range=function(e,t,r){var n=void 0===r?{}:r,o=n.foreignTable,i=n.referencedTable,s=void 0===i?o:i,a=void 0===s?"offset":"".concat(s,".offset"),u=void 0===s?"limit":"".concat(s,".limit");return this.url.searchParams.set(a,"".concat(e)),this.url.searchParams.set(u,"".concat(t-e+1)),this},t.prototype.abortSignal=function(e){return this.signal=e,this},t.prototype.single=function(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this},t.prototype.maybeSingle=function(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this},t.prototype.csv=function(){return this.headers.set("Accept","text/csv"),this},t.prototype.geojson=function(){return this.headers.set("Accept","application/geo+json"),this},t.prototype.explain=function(e){var t,r=void 0===e?{}:e,n=r.analyze,o=void 0!==n&&n,i=r.verbose,s=void 0!==i&&i,a=r.settings,u=void 0!==a&&a,c=r.buffers,l=void 0!==c&&c,h=r.wal,d=void 0!==h&&h,f=r.format,p=void 0===f?"text":f,v=[o?"analyze":null,s?"verbose":null,u?"settings":null,l?"buffers":null,d?"wal":null].filter(Boolean).join("|"),g=null!==(t=this.headers.get("Accept"))&&void 0!==t?t:"application/json";return this.headers.set("Accept","application/vnd.pgrst.plan+".concat(p,'; for="').concat(g,'"; options=').concat(v,";")),this},t.prototype.rollback=function(){return this.headers.append("Prefer","tx=rollback"),this},t.prototype.returns=function(){return this},t.prototype.maxAffected=function(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer","max-affected=".concat(e)),this},t}(Nh),Dh=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t.prototype.eq=function(e,t){return this.url.searchParams.append(e,"eq.".concat(t)),this},t.prototype.neq=function(e,t){return this.url.searchParams.append(e,"neq.".concat(t)),this},t.prototype.gt=function(e,t){return this.url.searchParams.append(e,"gt.".concat(t)),this},t.prototype.gte=function(e,t){return this.url.searchParams.append(e,"gte.".concat(t)),this},t.prototype.lt=function(e,t){return this.url.searchParams.append(e,"lt.".concat(t)),this},t.prototype.lte=function(e,t){return this.url.searchParams.append(e,"lte.".concat(t)),this},t.prototype.like=function(e,t){return this.url.searchParams.append(e,"like.".concat(t)),this},t.prototype.likeAllOf=function(e,t){return this.url.searchParams.append(e,"like(all).{".concat(t.join(","),"}")),this},t.prototype.likeAnyOf=function(e,t){return this.url.searchParams.append(e,"like(any).{".concat(t.join(","),"}")),this},t.prototype.ilike=function(e,t){return this.url.searchParams.append(e,"ilike.".concat(t)),this},t.prototype.ilikeAllOf=function(e,t){return this.url.searchParams.append(e,"ilike(all).{".concat(t.join(","),"}")),this},t.prototype.ilikeAnyOf=function(e,t){return this.url.searchParams.append(e,"ilike(any).{".concat(t.join(","),"}")),this},t.prototype.is=function(e,t){return this.url.searchParams.append(e,"is.".concat(t)),this},t.prototype.in=function(e,t){var r=Array.from(new Set(t)).map(function(e){return"string"==typeof e&&new RegExp("[,()]").test(e)?'"'.concat(e,'"'):"".concat(e)}).join(",");return this.url.searchParams.append(e,"in.(".concat(r,")")),this},t.prototype.contains=function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cs.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cs.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cs.".concat(JSON.stringify(t))),this},t.prototype.containedBy=function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"cd.".concat(t)):Array.isArray(t)?this.url.searchParams.append(e,"cd.{".concat(t.join(","),"}")):this.url.searchParams.append(e,"cd.".concat(JSON.stringify(t))),this},t.prototype.rangeGt=function(e,t){return this.url.searchParams.append(e,"sr.".concat(t)),this},t.prototype.rangeGte=function(e,t){return this.url.searchParams.append(e,"nxl.".concat(t)),this},t.prototype.rangeLt=function(e,t){return this.url.searchParams.append(e,"sl.".concat(t)),this},t.prototype.rangeLte=function(e,t){return this.url.searchParams.append(e,"nxr.".concat(t)),this},t.prototype.rangeAdjacent=function(e,t){return this.url.searchParams.append(e,"adj.".concat(t)),this},t.prototype.overlaps=function(e,t){return"string"==typeof t?this.url.searchParams.append(e,"ov.".concat(t)):this.url.searchParams.append(e,"ov.{".concat(t.join(","),"}")),this},t.prototype.textSearch=function(e,t,r){var n=void 0===r?{}:r,o=n.config,i=n.type,s="";"plain"===i?s="pl":"phrase"===i?s="ph":"websearch"===i&&(s="w");var a=void 0===o?"":"(".concat(o,")");return this.url.searchParams.append(e,"".concat(s,"fts").concat(a,".").concat(t)),this},t.prototype.match=function(e){var t=this;return Object.entries(e).forEach(function(e){var r=e[0],n=e[1];t.url.searchParams.append(r,"eq.".concat(n))}),this},t.prototype.not=function(e,t,r){return this.url.searchParams.append(e,"not.".concat(t,".").concat(r)),this},t.prototype.or=function(e,t){var r=void 0===t?{}:t,n=r.foreignTable,o=r.referencedTable,i=void 0===o?n:o,s=i?"".concat(i,".or"):"or";return this.url.searchParams.append(s,"(".concat(e,")")),this},t.prototype.filter=function(e,t,r){return this.url.searchParams.append(e,"".concat(t,".").concat(r)),this},t}(jh),Bh=function(){function e(e,t){var r=t.headers,n=void 0===r?{}:r,o=t.schema,i=t.fetch;this.url=e,this.headers=new Headers(n),this.schema=o,this.fetch=i}return e.prototype.select=function(e,t){var r=void 0===t?{}:t,n=r.head,o=void 0!==n&&n,i=r.count,s=o?"HEAD":"GET",a=!1,u=(null!=e?e:"*").split("").map(function(e){return/\s/.test(e)&&!a?"":('"'===e&&(a=!a),e)}).join("");return this.url.searchParams.set("select",u),i&&this.headers.append("Prefer","count=".concat(i)),new Dh({method:s,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})},e.prototype.insert=function(e,t){var r,n=void 0===t?{}:t,o=n.count,i=n.defaultToNull,s=void 0===i||i;if(o&&this.headers.append("Prefer","count=".concat(o)),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){var a=e.reduce(function(e,t){return e.concat(Object.keys(t))},[]);if(a.length>0){var u=Array.from(new Set(a)).map(function(e){return'"'.concat(e,'"')});this.url.searchParams.set("columns",u.join(","))}}return new Dh({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch})},e.prototype.upsert=function(e,t){var r,n=void 0===t?{}:t,o=n.onConflict,i=n.ignoreDuplicates,s=void 0!==i&&i,a=n.count,u=n.defaultToNull,c=void 0===u||u;if(this.headers.append("Prefer","resolution=".concat(s?"ignore":"merge","-duplicates")),void 0!==o&&this.url.searchParams.set("on_conflict",o),a&&this.headers.append("Prefer","count=".concat(a)),c||this.headers.append("Prefer","missing=default"),Array.isArray(e)){var l=e.reduce(function(e,t){return e.concat(Object.keys(t))},[]);if(l.length>0){var h=Array.from(new Set(l)).map(function(e){return'"'.concat(e,'"')});this.url.searchParams.set("columns",h.join(","))}}return new Dh({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch})},e.prototype.update=function(e,t){var r,n=(void 0===t?{}:t).count;return n&&this.headers.append("Prefer","count=".concat(n)),new Dh({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!==(r=this.fetch)&&void 0!==r?r:fetch})},e.prototype.delete=function(e){var t,r=(void 0===e?{}:e).count;return r&&this.headers.append("Prefer","count=".concat(r)),new Dh({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch})},e}(),Mh=function(e){function t(t,r){var n=r.headers,o=void 0===n?{}:n,i=r.fetch;return e.call(this,t,{headers:o,schema:void 0,fetch:i})||this}return r(t,e),t}(Bh),Wh=function(){function e(e,t){var r=void 0===t?{}:t,n=r.headers,o=void 0===n?{}:n,i=r.fetch;this.url=e,this.headers=new Headers(o),this.fetch=i}return e.prototype.from=function(e){var t=new Lh("".concat(this.url,"/").concat(e));return new Mh(t,{headers:this.headers,fetch:this.fetch})},e}();function Fh(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hh(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function zh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hh(Object(r),!0).forEach(function(t){Fh(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Vh="/auth";var Gh,Kh,Yh,Qh;!function(e){e.AUTH_SIGN_UP_URL="/v1/signup",e.AUTH_TOKEN_URL="/v1/token",e.AUTH_REVOKE_URL="/v1/revoke",e.WEDA_USER_URL="/v1/plugin/weda/userinfo",e.AUTH_RESET_PASSWORD="/v1/reset",e.AUTH_GET_DEVICE_CODE="/v1/device/code",e.CHECK_USERNAME="/v1/checkUsername",e.CHECK_IF_USER_EXIST="/v1/checkIfUserExist",e.GET_PROVIDER_TYPE="/v1/mgr/provider/providerSubType",e.AUTH_SIGN_IN_URL="/v1/signin",e.AUTH_SIGN_IN_ANONYMOUSLY_URL="/v1/signin/anonymously",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v1/signin/with/provider",e.AUTH_SIGN_IN_WITH_WECHAT_URL="/v1/signin/wechat/noauth",e.AUTH_SIGN_IN_CUSTOM="/v1/signin/custom",e.PROVIDER_TOKEN_URL="/v1/provider/token",e.PROVIDER_URI_URL="/v1/provider/uri",e.USER_ME_URL="/v1/user/me",e.AUTH_SIGNOUT_URL="/v1/user/signout",e.USER_QUERY_URL="/v1/user/query",e.USER_PRIFILE_URL="/v1/user/profile",e.USER_BASIC_EDIT_URL="/v1/user/basic/edit",e.USER_TRANS_BY_PROVIDER_URL="/v1/user/trans/by/provider",e.PROVIDER_LIST="/v1/user/provider",e.PROVIDER_BIND_URL="/v1/user/provider/bind",e.PROVIDER_UNBIND_URL="/v1/user/provider",e.CHECK_PWD_URL="/v1/user/sudo",e.SUDO_URL="/v1/user/sudo",e.BIND_CONTACT_URL="/v1/user/contact",e.AUTH_SET_PASSWORD="/v1/user/password",e.AUTHORIZE_DEVICE_URL="/v1/user/device/authorize",e.AUTHORIZE_URL="/v1/user/authorize",e.AUTHORIZE_INFO_URL="/v1/user/authorize/info",e.AUTHORIZED_DEVICES_DELETE_URL="/v1/user/authorized/devices/",e.AUTH_REVOKE_ALL_URL="/v1/user/revoke/all",e.GET_USER_BEHAVIOR_LOG="/v1/user/security/history",e.VERIFICATION_URL="/v1/verification",e.VERIFY_URL="/v1/verification/verify",e.CAPTCHA_DATA_URL="/v1/captcha/data",e.VERIFY_CAPTCHA_DATA_URL="/v1/captcha/data/verify",e.GET_CAPTCHA_URL="/v1/captcha/init",e.GET_MINIPROGRAM_QRCODE="/v1/qrcode/generate",e.GET_MINIPROGRAM_QRCODE_STATUS="/v1/qrcode/get/status"}(Gh||(Gh={})),function(e){e.AUTH_SIGN_IN_URL="/v2/signin/username",e.AUTH_TOKEN_URL="/v2/token",e.USER_ME_URL="/v2/user/me",e.VERIFY_URL="/v2/signin/verificationcode",e.AUTH_SIGN_IN_WITH_PROVIDER_URL="/v2/signin/with/provider",e.AUTH_PUBLIC_KEY="/v2/signin/publichkey",e.AUTH_RESET_PASSWORD="/v2/signin/password/update"}(Kh||(Kh={})),function(e){e.REGISTER="REGISTER",e.SIGN_IN="SIGN_IN",e.PASSWORD_RESET="PASSWORD_RESET",e.EMAIL_ADDRESS_CHANGE="EMAIL_ADDRESS_CHANGE",e.PHONE_NUMBER_CHANGE="PHONE_NUMBER_CHANGE"}(Yh||(Yh={})),function(e){e.UNREACHABLE="unreachable",e.LOCAL="local",e.CANCELLED="cancelled",e.UNKNOWN="unknown",e.UNAUTHENTICATED="unauthenticated",e.RESOURCE_EXHAUSTED="resource_exhausted",e.FAILED_PRECONDITION="failed_precondition",e.INVALID_ARGUMENT="invalid_argument",e.DEADLINE_EXCEEDED="deadline_exceeded",e.NOT_FOUND="not_found",e.ALREADY_EXISTS="already_exists",e.PERMISSION_DENIED="permission_denied",e.ABORTED="aborted",e.OUT_OF_RANGE="out_of_range",e.UNIMPLEMENTED="unimplemented",e.INTERNAL="internal",e.UNAVAILABLE="unavailable",e.DATA_LOSS="data_loss",e.INVALID_PASSWORD="invalid_password",e.PASSWORD_NOT_SET="password_not_set",e.INVALID_STATUS="invalid_status",e.USER_PENDING="user_pending",e.USER_BLOCKED="user_blocked",e.INVALID_VERIFICATION_CODE="invalid_verification_code",e.TWO_FACTOR_REQUIRED="two_factor_required",e.INVALID_TWO_FACTOR="invalid_two_factor",e.INVALID_TWO_FACTOR_RECOVERY="invalid_two_factor_recovery",e.UNDER_REVIEW="under_review",e.INVALID_REQUEST="invalid_request",e.UNAUTHORIZED_CLIENT="unauthorized_client",e.ACCESS_DENIED="access_denied",e.UNSUPPORTED_RESPONSE_TYPE="unsupported_response_type",e.INVALID_SCOPE="invalid_scope",e.INVALID_GRANT="invalid_grant",e.SERVER_ERROR="server_error",e.TEMPORARILY_UNAVAILABLE="temporarily_unavailable",e.INTERACTION_REQUIRED="interaction_required",e.LOGIN_REQUIRED="login_required",e.ACCOUNT_SELECTION_REQUIRED="account_selection_required",e.CONSENT_REQUIRED="consent_required",e.INVALID_REQUEST_URI="invalid_request_uri",e.INVALID_REQUEST_OBJECT="invalid_request_object",e.REQUEST_NOT_SUPPORTED="request_not_supported",e.REQUEST_URI_NOT_SUPPORTED="request_uri_not_supported",e.REGISTRATION_NOT_SUPPORTED="registration_not_supported",e.CAPTCHA_REQUIRED="captcha_required",e.CAPTCHA_INVALID="captcha_invalid"}(Qh||(Qh={}));const Jh="sign_out",$h="sign_in",Zh="credentials_error",Xh="SIGNED_OUT",ed="SIGNED_IN",td="INITIAL_SESSION",rd="PASSWORD_RECOVERY",nd="TOKEN_REFRESHED",od="USER_UPDATED",id="BIND_IDENTITY",sd="loginStateChanged",ad="authStateChanged",ud="sign_in",cd="bind_identity";var ld;function hd(){return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}!function(e){e.CLIENT_ID="client_id",e.CLIENT_SECRET="client_secret",e.RESPONSE_TYPE="response_type",e.SCOPE="scope",e.STATE="state",e.REDIRECT_URI="redirect_uri",e.ERROR="error",e.ERROR_DESCRIPTION="error_description",e.ERROR_URI="error_uri",e.GRANT_TYPE="grant_type",e.CODE="code",e.ACCESS_TOKEN="access_token",e.TOKEN_TYPE="token_type",e.EXPIRES_IN="expires_in",e.USERNAME="username",e.PASSWORD="password",e.REFRESH_TOKEN="refresh_token"}(ld||(ld={}));const dd=e=>{const t=t=>{for(const r in e)e.hasOwnProperty(r)&&(t[r]=dd(e[r]));return t},r=null==e?"NullOrUndefined":Object.prototype.toString.call(e).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(r))return e.slice();switch(r){case"Object":return t(Object.create(Object.getPrototypeOf(e)));case"Array":return t([]);case"Date":return new Date(e.valueOf());case"RegExp":return new RegExp(e.source,(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.sticky?"y":"")+(e.unicode?"u":""));default:return e}},fd=e=>{const t=e.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return t&&t[2]||""};let pd=new Map;class vd{constructor(e){this.clientId=(null==e?void 0:e.clientId)||"",pd=pd||new Map}async run(e,t){e="".concat(this.clientId,"_").concat(e);let r=pd.get(e);return r||(r=new Promise((r,n)=>{(async()=>{try{await this.runIdlePromise();const e=t();r(await e)}catch(e){n(e)}finally{pd.delete(e)}})()}),pd.set(e,r)),r}runIdlePromise(){return Promise.resolve()}}const gd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",md=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;const yd=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!md.test(e))throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");let t;e+="==".slice(2-(3&e.length));let r,n,o="",i=0;for(;i<e.length;)t=gd.indexOf(e.charAt(i++))<<18|gd.indexOf(e.charAt(i++))<<12|(r=gd.indexOf(e.charAt(i++)))<<6|(n=gd.indexOf(e.charAt(i++))),o+=64===r?String.fromCharCode(t>>16&255):64===n?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return o};function bd(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("Illegal base64url string!")}try{return function(e){return decodeURIComponent(yd(e).replace(/(.)/g,e=>{let t=e.charCodeAt(0).toString(16).toUpperCase();return t.length<2&&(t="0".concat(t)),"%".concat(t)}))}(t)}catch(e){return yd(t)}}function _d(){if("undefined"==typeof globalThis)return!1;const{wx:e}=globalThis;if(void 0===e)return!1;if(void 0===globalThis.Page)return!1;if(!e.getDeviceInfo)return!1;if(!e.getStorageSync)return!1;if(!e.setStorageSync)return!1;if(!e.connectSocket)return!1;if(!e.request)return!1;try{if(!e.getDeviceInfo())return!1;if("qq"===e.getDeviceInfo().platform)return!1}catch(e){return!1}return!0}let wd=!1;function Sd(){wd=wd||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{_d()||(wd=wd||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?Sd():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",Sd,!1))}catch(lf){}var Id,Td="undefined"!=typeof process&&void 0!==process.env&&"development"===process.env.NODE_ENV,Pd="https://support.qq.com/products/148793",Ed="INVALID_PARAMS",Od="INVALID_OPERATION",Rd="OPERATION_FAIL";!function(e){e.local="local",e.none="none",e.session="session"}(Id||(Id={}));var Cd=function(){},Ad=function(){},kd=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};function Ud(e,t){if("undefined"==typeof window)return!1;var r=decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""}function qd(e,t){console.warn("[".concat("@cloudbase/js-sdk","][").concat(e,"]:").concat(t))}function Ld(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat("@cloudbase/js-sdk","][").concat(e,"]:").concat(t)}))}function xd(e){var t,r=e.title,n=e.subtitle,o=void 0===n?"":n,i=e.content,s=void 0===i?[]:i,a=e.printTrace,u=void 0!==a&&a,c=e.collapsed;void 0!==c&&c?(console.groupCollapsed||console.error)(r,o):(console.group||console.error)(r,o);for(var l=0,h=s;l<h.length;l++){var d=h[l],f=d.type,p=d.body;switch(f){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}u&&(console.trace||console.log)("stack trace:"),null===(t=console.groupEnd)||void 0===t||t.call(console)}function Nd(e){var t={},r=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(r){e=r[1];var n=r[2];n&&(t=function(e){e=e.replace(/^\?/,"");var t={};return e.split("&").forEach(function(e){var r=e.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(t[n]?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o)}),t}(n))}var o=t.token,i=kd(t,["token"]);return/^data:/.test(e)&&!o?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:o?{state:i.state,token:o,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}}var jd=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Dd=this&&this.__assign||function(){return Dd=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Dd.apply(this,arguments)},Bd=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},Md=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Wd=function(e){function t(t){var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=o||"请求超时",r.restrictedMethods=i||["get","post","upload","download"],r}return jd(t,e),t.prototype.get=function(e){return this.request(Dd(Dd({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(Dd(Dd({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(Dd(Dd({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,i=e.headers,s=void 0===i?{}:i,a={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===a?(Object.keys(t).forEach(function(e){u.append(e,t[e])}),u.append("key",n),u.append("file",r),this.request(Dd(Dd({},e),{data:u,method:a}),this.restrictedMethods.includes("upload"))):this.request(Dd(Dd({},e),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return Bd(this,void 0,void 0,function(){var t,r,n,o;return Md(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(Dd(Dd({},e),{headers:{},responseType:"blob"}))];case 1:return t=i.sent().data,r=window.URL.createObjectURL(new Blob([t])),n=decodeURIComponent(new URL(e.url).pathname.split("/").pop()||""),(o=document.createElement("a")).href=r,o.setAttribute("download",n),o.style.display="none",document.body.appendChild(o),o.click(),window.URL.revokeObjectURL(r),document.body.removeChild(o),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise(function(t){t({statusCode:200,tempFilePath:e.url})})]}})})},t.prototype.fetch=function(e){var t;return Bd(this,void 0,void 0,function(){var r,n,o,i,s,a,u,c,l,h,d,f,p,v=this;return Md(this,function(g){switch(g.label){case 0:return r=new AbortController,n=e.url,o=e.enableAbort,i=void 0!==o&&o,s=e.stream,a=void 0!==s&&s,u=e.signal,c=e.timeout,l=e.shouldThrowOnError,h=void 0===l||l,d=null!=c?c:this.timeout,u&&(u.aborted&&r.abort(),u.addEventListener("abort",function(){return r.abort()})),f=null,i&&d&&(f=setTimeout(function(){console.warn(v.timeoutMsg),r.abort(new Error(v.timeoutMsg))},d)),[4,fetch(n,Dd(Dd({},e),{signal:r.signal})).then(function(e){return Bd(v,void 0,void 0,function(){var t,r,n;return Md(this,function(o){switch(o.label){case 0:return clearTimeout(f),h?e.ok?(t=e,[3,3]):[3,1]:[3,4];case 1:return n=(r=Promise).reject,[4,e.json()];case 2:t=n.apply(r,[o.sent()]),o.label=3;case 3:return[2,t];case 4:return[2,e]}})})}).catch(function(e){if(clearTimeout(f),h)return Promise.reject(e)})];case 1:return p=g.sent(),[2,{data:a?p.body:(null===(t=p.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?p.json():p.text(),statusCode:p.status,header:p.headers}]}})})},t.prototype.request=function(e,t){var r=this;void 0===t&&(t=!1);var n=String(e.method).toLowerCase()||"get";return new Promise(function(o){var i,s,a,u=e.url,c=e.headers,l=void 0===c?{}:c,h=e.data,d=e.responseType,f=e.withCredentials,p=e.body,v=e.onUploadProgress,g=function(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";return Object.keys(r).forEach(function(e){""===o?!n&&(t+="?"):o+="&",o+="".concat(e,"=").concat(encodeURIComponent(r[e]))}),/^http(s)?:\/\//.test(t+=o)?t:"".concat(e).concat(t)}("https:",u,"get"===n?h:{}),m=new XMLHttpRequest;m.open(n,g),d&&(m.responseType=d),Object.keys(l).forEach(function(e){m.setRequestHeader(e,l[e])}),v&&m.upload.addEventListener("progress",v),m.onreadystatechange=function(){var e={};if(4===m.readyState){var t=m.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};t.forEach(function(e){var t=e.split(": "),n=t.shift().toLowerCase(),o=t.join(": ");r[n]=o}),e.header=r,e.statusCode=m.status;try{e.data="blob"===d?m.response:JSON.parse(m.responseText)}catch(t){e.data="blob"===d?m.response:m.responseText}clearTimeout(i),o(e)}},t&&r.timeout&&(i=setTimeout(function(){console.warn(r.timeoutMsg),m.abort()},r.timeout)),a=h,s="[object FormData]"===Object.prototype.toString.call(a)?h:"application/x-www-form-urlencoded"===l["content-type"]?function(e){void 0===e&&(e={});var t=[];return Object.keys(e).forEach(function(r){t.push("".concat(r,"=").concat(encodeURIComponent(e[r])))}),t.join("&")}(h):p||(h?JSON.stringify(h):void 0),f&&(m.withCredentials=!0),m.send(s)})},t}(Cd);var Fd,Hd=this&&this.__assign||function(){return Hd=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Hd.apply(this,arguments)};function zd(){return{adapter:Hd({},{type:"default",root:window,reqClass:Wd,wsClass:WebSocket,localStorage:localStorage}),runtime:Fd.WEB}}!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Fd||(Fd={}));var Vd=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Gd=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},Kd=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Yd=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return Vd(t,e),t.prototype.setItem=function(e,t){this.root.tcbCacheObject[e]=t},t.prototype.getItem=function(e){return this.root.tcbCacheObject[e]},t.prototype.removeItem=function(e){delete this.root.tcbCacheObject[e]},t.prototype.clear=function(){delete this.root.tcbCacheObject},t}(Ad);var Qd=function(){function e(e){this.keys={};var t=e.persistence,r=e.platformInfo,n=void 0===r?{}:r,o=e.keys,i=void 0===o?{}:o;this.platformInfo=n,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||t,this.storage=function(e,t){switch(e){case"local":default:return t.localStorage?t.localStorage:(qd(Ed,"localStorage is not supported on current platform"),new Yd(t.root));case"none":return new Yd(t.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}return Object.defineProperty(e.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),e.prototype.setStore=function(e,t,r){if("async"!==this.mode){if(this.storage)try{var n={version:r||"localCachev1",content:t};this.storage.setItem(e,JSON.stringify(n))}catch(e){throw new Error(JSON.stringify({code:Rd,msg:"[".concat("@cloudbase/js-sdk","][").concat(Rd,"]setStore failed"),info:e}))}}else qd(Od,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return Gd(this,void 0,void 0,function(){var n;return Kd(this,function(o){switch(o.label){case 0:if(!this.storage)return[2];o.label=1;case 1:return o.trys.push([1,3,,4]),n={version:r||"localCachev1",content:t},[4,this.storage.setItem(e,JSON.stringify(n))];case 2:return o.sent(),[3,4];case 3:return o.sent(),[2];case 4:return[2]}})})},e.prototype.getStore=function(e,t){var r;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return process.env.tcb_token;if(!this.storage)return""}catch(e){return""}t=t||"localCachev1";var n=this.storage.getItem(e);return n&&n.indexOf(t)>=0?JSON.parse(n).content:""}qd(Od,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return Gd(this,void 0,void 0,function(){var n;return Kd(this,function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r=process.env)||void 0===r?void 0:r.tcb_token))return[2,process.env.tcb_token];if(!this.storage)return[2,""]}catch(e){return[2,""]}return t=t||"localCachev1",[4,this.storage.getItem(e)];case 1:return(n=o.sent())&&n.indexOf(t)>=0?[2,JSON.parse(n).content]:[2,""]}})})},e.prototype.removeStore=function(e){"async"!==this.mode?this.storage.removeItem(e):qd(Od,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return Gd(this,void 0,void 0,function(){return Kd(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})},e}(),Jd=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},e(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),$d=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))};var Zd=function(e,t){this.data=t||null,this.name=e},Xd=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return Jd(t,e),t}(Zd),ef=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return function(e,t,r){r[e]=r[e]||[],r[e].push(t)}(e,t,this.listeners),this},e.prototype.off=function(e,t){return function(e,t,r){if(null==r?void 0:r[e]){var n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}(e,t,this.listeners),this},e.prototype.fire=function(e,t){if(function(e,t){return e instanceof t}(e,Xd))return console.error(e.error),this;var r="string"==typeof e?new Zd(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,i=this.listeners[n]?$d([],this.listeners[n],!0):[];o<i.length;o++){i[o].call(this,r)}}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}(),tf=new ef,rf=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},nf=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},of=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(of=-1!==navigator.userAgent.indexOf("Firefox"));var sf=of?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,af=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function uf(e){var t=e.mode,r=void 0===t?"async":t,n=e.customInfo,o=void 0===n?{}:n,i=e.title,s=e.messages,a=void 0===s?[]:s;return function(e,t,n){if(Td){var s=o.className||e.constructor.name,u=o.methodName||t,c=n.value,l=function(e){var t="",r=e.stack.split("\n"),n=r.findIndex(function(e){return sf.test(e)});if(-1!==n){var o=af.exec(r[n+1]||"");t=o?o[0]:""}return t}(new Error);n.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=cf({err:new Error,className:s,methodName:u,sourceLink:l});try{return c.apply(this,e)}catch(e){var n=e,o=e.message,h=e.error,d=e.error_description,f={title:i||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var p=JSON.parse(o);f.subtitle=o,p.code&&(r?(r.code=p.code,r.msg=p.msg):(e.code=p.code,e.message=p.msg),n=r||e,f.content=a.map(function(e){return{type:"info",body:e}}))}throw h&&d&&(f.subtitle=d,r?(r.code=h,r.msg=d):(e.code=h,e.message=d),n=r||e,f.content=a.map(function(e){return{type:"info",body:e}})),xd(f),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return rf(this,void 0,void 0,function(){var t,r,n,o,h,d,f,p;return nf(this,function(v){switch(v.label){case 0:t=cf({err:new Error,className:s,methodName:u,sourceLink:l}),v.label=1;case 1:return v.trys.push([1,3,,4]),[4,c.apply(this,e)];case 2:return[2,v.sent()];case 3:throw r=v.sent(),n=r,o=r.message,h=r.error,d=r.error_description,f={title:i||"".concat(s,".").concat(u," failed"),content:[{type:"error",body:r}]},o&&/^\{.*\}$/.test(o)&&(p=JSON.parse(o),f.subtitle=p,p.code&&(t?(t.code=p.code,t.message=p.msg):(r.code=p.code,r.message=p.msg),n=t||r,f.content=a.map(function(e){return{type:"info",body:e}}))),h&&d&&(f.subtitle=d,t?(t.code=h,t.msg=d):(r.code=h,r.message=d),n=t||r,f.content=a.map(function(e){return{type:"info",body:e}})),xd(f),n;case 4:return[2]}})})}}}}function cf(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,s=t.stack.split("\n"),a=of?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),u=of?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),c=s.findIndex(function(e){return a.test(e)});if(-1!==c){var l=s.filter(function(e,t){return t>c});l.unshift(s[c].replace(u,"".concat(r,".").concat(n)).replace(af,o)),(i=new Error).stack="".concat(of?"@debugger":"Error","\n").concat(l.join("\n"))}return i}function lf(e){this.message=e}function hf(e){this.message=e}lf.prototype=new Error,lf.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),hf.prototype=new Error,hf.prototype.name="InvalidTokenError";const df="x-request-id",ff="x-device-id",pf="device_id",vf=async function(e,t){let r=null,n=null;try{const o=Object.assign({},t);o.method||(o.method="GET"),o.body&&"string"!=typeof o.body&&(o.body=JSON.stringify(o.body));const i=await fetch(e,o),s=await i.json();null!=s&&s.error?(n=s,n.error_uri=new URL(e).pathname):r=s}catch(t){n={error:Qh.UNREACHABLE,error_description:t.message,error_uri:new URL(e).pathname}}if(n)throw n;return r};const gf=new class{constructor(e){this._env=(null==e?void 0:e.env)||""}async getItem(e){return window.localStorage.getItem("".concat(e).concat(this._env))}async removeItem(e){window.localStorage.removeItem("".concat(e).concat(this._env))}async setItem(e,t){window.localStorage.setItem("".concat(e).concat(this._env),t)}getItemSync(e){return window.localStorage.getItem("".concat(e).concat(this._env))}removeItemSync(e){window.localStorage.removeItem("".concat(e).concat(this._env))}setItemSync(e,t){window.localStorage.setItem("".concat(e).concat(this._env),t)}};function mf(e){let t=!0;return null!=e&&e.expires_at&&null!=e&&e.access_token&&(t=e.expires_at<new Date),t}class yf{constructor(e){this.credentials=null,this.accessKeyCredentials=null,this.singlePromise=null,this.tokenSectionName=e.tokenSectionName,this.storage=e.storage,this.clientId=e.clientId,this.singlePromise=new vd({clientId:this.clientId}),this.credentials=e.credentials||null}getStorageCredentialsSync(){let e=null;const t=this.storage.getItemSync(this.tokenSectionName);if(null!=t)try{var r;e=JSON.parse(t),null!==(r=e)&&void 0!==r&&r.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){this.storage.removeItem(this.tokenSectionName),e=null}return e}async setCredentials(e){if(null!=e&&e.expires_in){if(null!=e&&e.expires_at||(e.expires_at=new Date(Date.now()+1e3*(e.expires_in-30))),this.storage){const t=JSON.stringify(e);await this.storage.setItem(this.tokenSectionName,t)}this.credentials=e}else this.storage&&await this.storage.removeItem(this.tokenSectionName),this.credentials=null}setAccessKeyCredentials(e){this.accessKeyCredentials=e}async getCredentials(){return this.singlePromise.run("getCredentials",async()=>{if(mf(this.credentials)){const{credentials:e,isAccessKeyCredentials:t}=await this.getStorageCredentials();if(t)return e;this.credentials=e}return this.credentials})}async getStorageCredentials(){return this.singlePromise.run("_getStorageCredentials",async()=>{let e=null,t=!1;const r=await this.storage.getItem(this.tokenSectionName);if(r)try{var n;e=JSON.parse(r),null!==(n=e)&&void 0!==n&&n.expires_at&&(e.expires_at=new Date(e.expires_at))}catch(t){await this.storage.removeItem(this.tokenSectionName),e=null}else e=this.accessKeyCredentials||null,t=!0;return{credentials:e,isAccessKeyCredentials:t}})}}class bf{constructor(e){var t;this.initializePromise=null,this.lockAcquired=!1,this.pendingInLock=[],this.singlePromise=null,e.clientSecret||(e.clientSecret=""),!e.clientId&&e.env&&(e.clientId=e.env),this.apiOrigin=e.apiOrigin,this.apiPath=e.apiPath||Vh,this.clientId=e.clientId,this.i18n=e.i18n,this.eventBus=e.eventBus,this.singlePromise=new vd({clientId:this.clientId}),this.retry=this.formatRetry(e.retry,bf.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=vf,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||gf,this.localCredentials=new yf({tokenSectionName:"credentials_".concat(e.clientId),storage:this.storage,clientId:e.clientId}),this.clientSecret=e.clientSecret,e.clientId&&(this.basicAuth="Basic ".concat(function(e){let t,r,n,o,i="",s=0;const a=(e=String(e)).length%3;for(;s<e.length;){if((r=e.charCodeAt(s++))>255||(n=e.charCodeAt(s++))>255||(o=e.charCodeAt(s++))>255)throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");t=r<<16|n<<8|o,i+=gd.charAt(t>>18&63)+gd.charAt(t>>12&63)+gd.charAt(t>>6&63)+gd.charAt(63&t)}return a?i.slice(0,a-3)+"===".substring(a):i}("".concat(e.clientId,":").concat(this.clientSecret)))),this.wxCloud=e.wxCloud;try{_d()&&(this.useWxCloud=e.useWxCloud,void 0===this.wxCloud&&e.env&&(wx.cloud.init({env:e.env}),this.wxCloud=wx.cloud))}catch(e){}this.refreshTokenFunc=e.refreshTokenFunc||this.defaultRefreshTokenFunc,this.anonymousSignInFunc=e.anonymousSignInFunc,this.onCredentialsError=e.onCredentialsError,this.getInitialSession=e.getInitialSession,this.onInitialSessionObtained=e.onInitialSessionObtained,this.logDebugMessages=null!==(t=e.debug)&&void 0!==t&&t,tf.on("lang_change",e=>{var t;this.i18n=(null===(t=e.data)||void 0===t?void 0:t.i18n)||this.i18n})}setGetInitialSession(e){this.getInitialSession=e}setOnInitialSessionObtained(e){this.onInitialSessionObtained=e}async initialize(e){return this.initializePromise?await this.initializePromise:void 0!==e?(this.initializePromise=e,await this.initializePromise):(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async setCredentials(e){return await this.initializePromise,this._acquireLock(-1,async()=>this.localCredentials.setCredentials(e))}setAccessKeyCredentials(e){return this.localCredentials.setAccessKeyCredentials(e)}async getAccessToken(){await this.initializePromise;const e=await this.getCredentials();if(null!=e&&e.access_token)return Promise.resolve(e.access_token);const t={error:Qh.UNAUTHENTICATED};return Promise.reject(t)}async request(e,t){var r,n,o,i;t||(t={});const s=this.formatRetry(t.retry,this.retry);if(t.headers=zh(zh({},t.headers),{},{[null===(r=this.i18n)||void 0===r?void 0:r.LANG_HEADER_KEY]:null===(n=this.i18n)||void 0===n?void 0:n.lang}),this.headers&&(t.headers=zh(zh({},this.headers),t.headers)),t.headers[df]||(t.headers[df]=hd()),!t.headers[ff]){const e=await this.getDeviceId();t.headers[ff]=e}if(null!==(o=t)&&void 0!==o&&o.withBasicAuth&&this.basicAuth&&(t.headers.Authorization=this.basicAuth),null!==(i=t)&&void 0!==i&&i.withCredentials){const r=t.getCredentials?await t.getCredentials():await this.getCredentials();r&&(this.tokenInURL?(e.indexOf("?")<0&&(e+="?"),e+="access_token=".concat(r.access_token)):t.headers.Authorization="".concat(r.token_type," ").concat(r.access_token))}else this.clientId&&e.indexOf("client_id")<0&&(e+=e.indexOf("?")<0?"?":"&",e+="client_id=".concat(this.clientId));e.startsWith("/")&&(e="".concat(this.apiOrigin).concat(this.apiPath).concat(e));let a=null;const u=s+1;for(let r=0;r<u;r++){try{var c;if(a=t.useWxCloud||this.useWxCloud?await this.wxCloudCallFunction(e,t):await this.baseRequest(e,t),null!==(c=a)&&void 0!==c&&c.code)throw{error:a.code,error_description:a.message,error_uri:new URL(e).pathname};break}catch(e){if(t.withCredentials&&e&&e.error===Qh.UNAUTHENTICATED)return await this.setCredentials(null),Promise.reject(e);if(r===s||!e||"unreachable"!==e.error)return Promise.reject(e)}await this.sleep(bf.retryInterval)}return a}async wxCloudCallFunction(e,t){let r=null,n=null;try{var o;let i="";try{i=await wx.getRendererUserAgent()}catch(e){}const{result:s}=await this.wxCloud.callFunction({name:"httpOverCallFunction",data:{url:e,method:t.method,headers:zh({origin:"https://servicewechat.com","User-Agent":i},t.headers),body:t.body}});null!=s&&null!==(o=s.body)&&void 0!==o&&o.error_code?(n=null==s?void 0:s.body,n.error_uri=fd(e)):r=null==s?void 0:s.body}catch(t){n={error:Qh.UNREACHABLE,error_description:t.message,error_uri:fd(e)}}if(n)throw n;return r}async getCredentials(){return await this.initializePromise,this._acquireLock(-1,async()=>this._getCredentials())}getCredentialsSync(){return this.localCredentials.getStorageCredentialsSync()}getCredentialsAsync(){return this.getCredentials()}async getScope(){const e=await this.localCredentials.getCredentials();if(!e){var t;const e="credentials not found";return null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:e}),this.unAuthenticatedError(e)}return e.scope}async getGroups(){const e=await this.localCredentials.getCredentials();if(!e){var t;const e="credentials not found";return null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:e}),this.unAuthenticatedError(e)}return e.groups}async refreshToken(e,t){return await this.initializePromise,this._acquireLock(-1,async()=>this._refreshToken(e,t))}async _refreshToken(e,t){return this.singlePromise.run("_refreshToken",async()=>{if(!e||!e.refresh_token){var r;const e="no refresh token found in credentials";return null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:e}),this.unAuthenticatedError(e)}try{var n;const t=await this.refreshTokenFunc(e.refresh_token,e);return await this.localCredentials.setCredentials(t),null===(n=this.eventBus)||void 0===n||n.fire(ad,{event:nd}),t}catch(e){var o;if(null!=t&&t.throwError)throw e;if(e.error===Qh.INVALID_GRANT){var i;await this.localCredentials.setCredentials(null);const t=e.error_description;return null===(i=this.onCredentialsError)||void 0===i||i.call(this,{msg:t}),this.unAuthenticatedError(t)}return null===(o=this.onCredentialsError)||void 0===o||o.call(this,{msg:e.error_description}),Promise.reject(e)}})}async anonymousLogin(e){return this.singlePromise.run("_anonymousLogin",async()=>{if(this.anonymousSignInFunc){const t=await this.anonymousSignInFunc(e);e=t||await this.localCredentials.getCredentials()}else e=await this.anonymousSignIn(e);return e})}checkRetry(e){let t=null;if(("number"!=typeof e||e<bf.minRetry||e>bf.maxRetry)&&(t={error:Qh.UNREACHABLE,error_description:"wrong options param: retry"}),t)throw t;return e}formatRetry(e,t){return void 0===e?t:this.checkRetry(e)}async sleep(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}async anonymousSignIn(e){return this.singlePromise.run("_anonymous",async()=>{if(!e||"anonymous"!==e.scope)return this.unAuthenticatedError("no anonymous in credentials");try{const e=await this.request(Gh.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}});return await this.localCredentials.setCredentials(e),e}catch(e){return e.error===Qh.INVALID_GRANT?(await this.localCredentials.setCredentials(null),this.unAuthenticatedError(e.error_description)):Promise.reject(e)}})}async defaultRefreshTokenFunc(e,t){if(void 0===e||""===e){var r;const e="refresh token not found";return null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:e}),this.unAuthenticatedError(e)}let n=Gh.AUTH_TOKEN_URL;"v2"===(null==t?void 0:t.version)&&(n=Kh.AUTH_TOKEN_URL);return zh(zh({},await this.request(n,{method:"POST",body:{client_id:this.clientId,client_secret:this.clientSecret,grant_type:"refresh_token",refresh_token:e}})),{},{version:(null==t?void 0:t.version)||"v1"})}async getDeviceId(){if(this.deviceID)return this.deviceID;let e=await this.storage.getItem(pf);return"string"==typeof e&&e.length>=16&&e.length<=48||(e=hd(),await this.storage.setItem(pf,e)),this.deviceID=e,e}unAuthenticatedError(e){const t={error:Qh.UNAUTHENTICATED,error_description:e};return Promise.reject(t)}_debug(){if(this.logDebugMessages){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];console.log("[OAuth2Client]",...t)}}async _initialize(){try{if(!this.getInitialSession)return this._debug("#_initialize()","no getInitialSession callback set, skipping"),{error:null};this._debug("#_initialize()","calling getInitialSession callback");try{const{data:e,error:t}=await this.getInitialSession();if(null!=e&&e.session&&(this._debug("#_initialize()","session obtained from getInitialSession",e.session),await this.localCredentials.setCredentials(null==e?void 0:e.session)),this.onInitialSessionObtained){this._debug("#_initialize()","calling onInitialSessionObtained callback");try{await this.onInitialSessionObtained(e,t)}catch(e){this._debug("#_initialize()","error in onInitialSessionObtained",e)}}return t?(this._debug("#_initialize()","error from getInitialSession",t),{error:t}):{error:null}}catch(e){return this._debug("#_initialize()","exception during getInitialSession",e),{error:e instanceof Error?e:new Error(String(e))}}}catch(e){return this._debug("#_initialize()","unexpected error",e),{error:e instanceof Error?e:new Error(String(e))}}finally{this._debug("#_initialize()","end")}}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}this._debug("#_acquireLock","acquiring lock for client",this.clientId);try{this.lockAcquired=!0;const e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){const e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","releasing lock for client",this.clientId),this.lockAcquired=!1}}finally{this._debug("#_acquireLock","end")}}async _getCredentials(){let e=await this.localCredentials.getCredentials();if(!e){var t;const e="credentials not found";return null===(t=this.onCredentialsError)||void 0===t||t.call(this,{msg:e}),this.unAuthenticatedError(e)}if(mf(e))if(e.refresh_token)try{e=await this._refreshToken(e)}catch(t){var r;if("anonymous"!==e.scope)return null===(r=this.onCredentialsError)||void 0===r||r.call(this,{msg:t.error_description}),Promise.reject(t);e=await this.anonymousLogin(e)}else{if("anonymous"!==e.scope){var n;const e="no refresh token found in credentials";return null===(n=this.onCredentialsError)||void 0===n||n.call(this,{msg:e}),this.unAuthenticatedError(e)}e=await this.anonymousLogin(e)}return e}}bf.defaultRetry=2,bf.minRetry=0,bf.maxRetry=5,bf.retryInterval=1e3;const _f=(e,t)=>{let r;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];clearTimeout(r),r=setTimeout(()=>e.apply(null,o),t)}},wf=new ef,Sf="resolveCaptchaData",If="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:999",Tf="position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:320px;padding:20px;background:#fff;border-radius:8px;box-shadow:0 0 10px rgba(0,0,0,0.2);z-index:1000",Pf="margin-bottom:15px",Ef="display:flex;align-items:center;justify-content:space-between;margin-bottom:15px",Of="width:100%;height:auto;border:1px solid #eee",Rf="padding:10px 8px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer;flex:1;white-space:nowrap;margin-left:10px",Cf="width:100%;padding:14px 16px;margin-bottom:15px;box-sizing:border-box;border:2px solid #e8ecf4;border-radius:10px;font-size:15px",Af="width:100%;padding:10px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer",kf="background:#6c757d;cursor:not-allowed",Uf=async(e,t)=>{const{captchaData:r,state:n,token:o}=Nd(e);return(e=>{let{oauthInstance:t,captchaState:r}=e;const n="captcha-image",o=async()=>{try{const e=await t.createCaptchaData({state:r.state});r=zh(zh({},r),{},{captchaData:e.data,token:e.token}),document.getElementById(n).src=e.data}catch(e){console.error("刷新图形验证码失败",e)}},i=(e,t,r)=>{const n=document.createElement(e);return t&&(n.style.cssText=t),r&&(n.textContent=r),n},s=i("div",If),a=i("div",Tf);a.appendChild(i("p",Pf,"请输入你看到的字符:"));const u=i("div",Ef),c=i("img",Of);c.id=n,c.src=r.captchaData,u.appendChild(c);const l=i("button",Rf,"刷新");l.onclick=_f(async()=>{l.textContent="加载中...",l.disabled=!0,l.style.cssText="".concat(Rf,";").concat(kf);try{await o()}finally{l.textContent="刷新",l.disabled=!1,l.style.cssText=Rf}},500),u.appendChild(l),a.appendChild(u);const h=i("input",Cf);h.type="text",h.placeholder="输入字符",h.maxLength=4,a.appendChild(h);const d=i("div","color:#dc3545;font-size:12px;margin-bottom:10px;display:none;padding:8px;background:#f8d7da;border:1px solid #f5c6cb;border-radius:4px");a.appendChild(d);const f=e=>{d.textContent=e,d.style.display="block"},p=i("button",Af,"确定");p.onclick=_f(async()=>{const e=h.value.trim();if(e){d.style.display="none",p.textContent="验证中...",p.disabled=!0,p.style.cssText="".concat(Af,";").concat(kf);try{const n=await t.verifyCaptchaData({token:r.token,key:e});wf.fire(Sf,n),console.log("图形验证码校验成功"),document.body.removeChild(s),document.body.removeChild(a)}catch(e){console.error("图形验证码校验失败",e);const t=e.error_description||"图形验证码校验失败";f(t),h.value="",h.focus(),await o()}finally{p.textContent="确定",p.disabled=!1,p.style.cssText=Af}}else f("请输入字符")},500),a.appendChild(p),document.body.appendChild(s),document.body.appendChild(a)})({oauthInstance:t,captchaState:{captchaData:r,state:n,token:o}}),new Promise(e=>{console.log("等待图形验证码校验结果..."),wf.on(Sf,t=>{e(null==t?void 0:t.data)})})};class qf{constructor(e){e.openURIWithCallback||(e.openURIWithCallback=this.getDefaultOpenURIWithCallback()),e.storage||(e.storage=gf),this.config=e,this.tokenSectionName="captcha_".concat(e.clientId||e.env)}isMatch(){var e,t;return(null===(e=this.config)||void 0===e||null===(e=e.adapter)||void 0===e||null===(t=e.isMatch)||void 0===t?void 0:t.call(e))||_d()}async request(e,t){t||(t={}),t.method||(t.method="GET");const r="".concat(t.method,":").concat(e);let n,o=e;t.withCaptcha&&(o=await this.appendCaptchaTokenToURL(e,r,!1));try{n=await this.config.request(o,t)}catch(n){return n.error===Qh.CAPTCHA_REQUIRED||n.error===Qh.CAPTCHA_INVALID?(e=await this.appendCaptchaTokenToURL(e,r,n.error===Qh.CAPTCHA_INVALID),this.config.request(e,t)):Promise.reject(n)}return n}getDefaultOpenURIWithCallback(){return e=>Uf(e,this.config.oauthInstance)}async getCaptchaToken(e,t){if(!e){const e=await this.findCaptchaToken();if(e)return e}const r=await this.config.request(Gh.CAPTCHA_DATA_URL,{method:"POST",body:{state:t,redirect_uri:""},withCredentials:!1}),n="".concat(r.data,"?state=").concat(encodeURIComponent(t),"&token=").concat(encodeURIComponent(r.token)),o=await this.config.openURIWithCallback(n);return this.saveCaptchaToken(o),o.captcha_token}async appendCaptchaTokenToURL(e,t,r){const n=await this.getCaptchaToken(r,t);return e.indexOf("?")>0?e+="&captcha_token=".concat(n):e+="?captcha_token=".concat(n),e}async saveCaptchaToken(e){e.expires_at=new Date(Date.now()+1e3*(e.expires_in-10));const t=JSON.stringify(e);await this.config.storage.setItem(this.tokenSectionName,t)}async findCaptchaToken(){const e=await this.config.storage.getItem(this.tokenSectionName);if(null!=e)try{const t=JSON.parse(e);null!=t&&t.expires_at&&(t.expires_at=new Date(t.expires_at));return t.expires_at<new Date?null:t.captcha_token}catch(e){return await this.config.storage.removeItem(this.tokenSectionName),null}return null}}class Lf{constructor(e){if(this.params={},"string"==typeof e)this.parse(e);else if(e&&"object"==typeof e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.append(t,e[t])}parse(e){e.split("&").forEach(e=>{const[t,r]=e.split("=").map(decodeURIComponent);this.append(t,r)})}append(e,t){this.params[e]?this.params[e]=this.params[e].concat([t]):this.params[e]=[t]}get(e){return this.params[e]?this.params[e][0]:null}getAll(e){return this.params[e]||[]}delete(e){delete this.params[e]}has(e){return Object.prototype.hasOwnProperty.call(this.params,e)}set(e,t){this.params[e]=[t]}toString(){const e=[];for(const t in this.params)Object.prototype.hasOwnProperty.call(this.params,t)&&this.params[t].forEach(r=>{e.push("".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(r)))});return e.join("&")}}class xf extends Error{constructor(e){super(e.error_description||e.message),this.__isAuthError=!0,this.name="AuthError",this.status=e.error,this.code=e.error_code}}const Nf=["provider_redirect_uri","other_params"];async function jf(e,t){const r=async()=>{try{return require("../utils/encrypt")}catch(e){try{return await Promise.resolve().then(function(){return Qp})}catch(e){return}}};try{var n;if(((null==t||null===(n=t.root)||void 0===n?void 0:n.globalThis)||globalThis).IS_MP_BUILD)return;if(!process.env.IS_MP_BUILD&&e)return r()}catch(t){if(e)return r()}}let Df=class e{static parseParamsToSearch(e){Object.keys(e).forEach(t=>{e[t]||delete e[t]});return new Lf(e).toString()}constructor(e){let{request:t}=e,r=e.credentialsClient;if(!r){const t={apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,storage:e.storage,env:e.env,baseRequest:e.baseRequest,anonymousSignInFunc:e.anonymousSignInFunc,wxCloud:e.wxCloud,onCredentialsError:e.onCredentialsError,headers:e.headers||{},i18n:e.i18n,debug:e.debug};r=new bf(t)}if(!t){const n=r.request.bind(r),o=new qf(zh({env:e.env,clientId:e.clientId,request:n,storage:e.storage,adapter:e.adapter,oauthInstance:this},e.captchaOptions));t=o.request.bind(o)}this.config={env:e.env,apiOrigin:e.apiOrigin,apiPath:e.apiPath,clientId:e.clientId,request:t,credentialsClient:r,storage:e.storage||gf,adapter:e.adapter}}getParamsByVersion(e,t){var r;const n=dd(e),o=(null===(r={v2:Kh}[null==n?void 0:n.version])||void 0===r?void 0:r[t])||Gh[t];return n&&delete n.version,{params:n,url:o}}async signIn(e){const t=e.version||"v1",r=this.getParamsByVersion(e,"AUTH_SIGN_IN_URL");r.params.query&&delete r.params.query;const n=await this.getEncryptParams(r.params),o=await this.config.request(r.url,{method:"POST",body:n});return await this.config.credentialsClient.setCredentials(zh(zh({},o),{},{version:t})),Promise.resolve(o)}async signInAnonymously(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=await this.config.request(Gh.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",body:e,useWxCloud:t});return await this.config.credentialsClient.setCredentials(r),Promise.resolve(r)}async signUp(e){const t=await this.config.request(Gh.AUTH_SIGN_UP_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signOut(e){let t={};if(e){try{t=await this.config.request(Gh.AUTH_SIGNOUT_URL,{method:"POST",withCredentials:!0,body:e})}catch(e){e.error!==Qh.UNAUTHENTICATED&&console.log("sign_out_error",e)}return await this.config.credentialsClient.setCredentials(),t}const r=await this.config.credentialsClient.getAccessToken(),n=await this.config.request(Gh.AUTH_REVOKE_URL,{method:"POST",body:{token:r}});return await this.config.credentialsClient.setCredentials(),Promise.resolve(n)}async revokeAllDevices(){await this.config.request(Gh.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})}async revokeDevice(e){await this.config.request(Gh.AUTHORIZED_DEVICES_DELETE_URL+e.device_id,{method:"DELETE",withCredentials:!0})}async getVerification(e,t){let r=!1;if("CUR_USER"===e.target)r=!0;else{await this.hasLoginState()&&(r=!0)}const n=dd(e);return n.phone_number&&!/^\+\d{1,3}\s+\d+/.test(n.phone_number)&&(n.phone_number="+86 ".concat(n.phone_number)),this.config.request(Gh.VERIFICATION_URL,{method:"POST",body:n,withCaptcha:(null==t?void 0:t.withCaptcha)||!1,withCredentials:r})}async verify(e){const t=this.getParamsByVersion(e,"VERIFY_URL"),r=await this.config.request(t.url,{method:"POST",body:t.params});return"v2"===(null==e?void 0:e.version)&&await this.config.credentialsClient.setCredentials(zh(zh({},r),{},{version:"v2"})),r}async genProviderRedirectUri(t){const{provider_redirect_uri:r,other_params:n={}}=t,o=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(t,Nf);r&&!o.redirect_uri&&(o.redirect_uri=r);let i="".concat(Gh.PROVIDER_URI_URL,"?").concat(e.parseParamsToSearch(o));return Object.keys(n).forEach(e=>{const t=n[e];("sign_out_uri"!==e||(null==t?void 0:t.length)>0)&&(i+="&other_params[".concat(e,"]=").concat(encodeURIComponent(t)))}),this.config.request(i,{method:"GET"})}async grantProviderToken(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.config.request(Gh.PROVIDER_TOKEN_URL,{method:"POST",body:e,useWxCloud:t})}async patchProviderToken(e){return this.config.request(Gh.PROVIDER_TOKEN_URL,{method:"PATCH",body:e})}async signInWithProvider(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=this.getParamsByVersion(e,"AUTH_SIGN_IN_WITH_PROVIDER_URL"),n=await this.config.request(r.url,{method:"POST",body:r.params,useWxCloud:t});return await this.config.credentialsClient.setCredentials(zh(zh({},n),{},{version:(null==e?void 0:e.version)||"v1"})),Promise.resolve(n)}async toBindIdentity(e){const t=e.credentials||await this.config.credentialsClient.localCredentials.getCredentials();let r;try{await this.bindWithProvider({provider_token:e.provider_token},t),r={data:{type:cd,provider:e.provider},error:null}}catch(e){r={data:{type:cd},error:new xf(e)}}var n,o;e.fireEvent&&(null===(n=this.config.eventBus)||void 0===n||null===(o=n.fire)||void 0===o||o.call(n,ad,{event:id,info:r}));return r}async getInitialSession(){let e={};try{var t,r,n,o,i;if("undefined"==typeof window||"undefined"==typeof document)return{data:null,error:null};const s=new URLSearchParams(null===(t=location)||void 0===t?void 0:t.search),a=s.get("code"),u=s.get("state");if(!a||!u)return{data:null,error:null};let c=null;try{c=JSON.parse(sessionStorage.getItem(u)||"null")}catch(e){}e={type:null===(r=c)||void 0===r?void 0:r.type};const l=s.get("error"),h=s.get("error_description");if(l||h)return{data:e,error:new xf({message:h||l||"Unknown error from OAuth provider"})};const d=(null===(n=c)||void 0===n?void 0:n.provider)||s.get("provider");if(!d)return{data:e,error:new xf({message:"Provider is required for OAuth verification"})};const f=location.origin+location.pathname,{provider_token:p}=await this.grantProviderToken({provider_id:d,provider_redirect_uri:f,provider_code:a});let v,g,m=null;if(c.type===cd)v=await this.config.credentialsClient.localCredentials.getCredentials(),g=await this.toBindIdentity({provider:d,provider_token:p,credentials:v});else if(c.type===ud){g=this.getParamsByVersion({provider:d},"AUTH_SIGN_IN_WITH_PROVIDER_URL"),v=await this.config.request(g.url,{method:"POST",body:{provider_token:p}});try{m=await this.getUserInfo({credentials:v})}catch(e){console.error("get user info error",e)}g={data:zh(zh({},e),{},{session:v,user:m}),error:null}}s.delete("code"),s.delete("state"),s.delete("provider"),this.restoreUrlState(void 0===(null===(o=c)||void 0===o?void 0:o.search)?"?".concat(s.toString()):c.search,(null===(i=c)||void 0===i?void 0:i.hash)||location.hash);try{sessionStorage.removeItem(u)}catch(e){}return g}catch(t){return{data:e,error:new xf(t)}}}async signInCustom(e){const t=await this.config.request(Gh.AUTH_SIGN_IN_CUSTOM,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async signInWithWechat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=await this.config.request(Gh.AUTH_SIGN_IN_WITH_WECHAT_URL,{method:"POST",body:e});return await this.config.credentialsClient.setCredentials(t),Promise.resolve(t)}async bindWithProvider(e,t){return this.config.request(Gh.PROVIDER_BIND_URL,{method:"POST",body:e,withCredentials:!0,getCredentials:t?()=>t:void 0})}async getUserProfile(e){return this.getUserInfo(e)}async getUserInfo(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=this.getParamsByVersion(t,"USER_ME_URL");if(null!==(e=r.params)&&void 0!==e&&e.query){const e=new Lf(r.params.query);r.url+="?".concat(e.toString())}const n=await this.config.request(r.url,{method:"GET",withCredentials:!0,getCredentials:t.credentials?()=>t.credentials:void 0});return n.sub&&(n.uid=n.sub),n}async getWedaUserInfo(){return await this.config.request(Gh.WEDA_USER_URL,{method:"GET",withCredentials:!0})}async deleteMe(t){const r=this.getParamsByVersion(t,"USER_ME_URL"),n="".concat(r.url,"?").concat(e.parseParamsToSearch(r.params));return this.config.request(n,{method:"DELETE",withCredentials:!0})}async hasLoginState(){try{return await this.config.credentialsClient.getAccessToken(),!0}catch(e){return!1}}hasLoginStateSync(){return this.config.credentialsClient.getCredentialsSync()}async getLoginState(){return this.config.credentialsClient.getCredentialsAsync()}async transByProvider(e){return this.config.request(Gh.USER_TRANS_BY_PROVIDER_URL,{method:"PATCH",body:e,withCredentials:!0})}async grantToken(e){const t=this.getParamsByVersion(e,"AUTH_TOKEN_URL");return this.config.request(t.url,{method:"POST",body:t.params})}async getProviders(){return this.config.request(Gh.PROVIDER_LIST,{method:"GET",withCredentials:!0})}async unbindProvider(e){return this.config.request("".concat(Gh.PROVIDER_UNBIND_URL,"/").concat(e.provider_id),{method:"DELETE",withCredentials:!0})}async checkPassword(e){return this.config.request("".concat(Gh.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:e})}async editContact(e){return this.config.request("".concat(Gh.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:e})}async setPassword(e){return this.config.request("".concat(Gh.AUTH_SET_PASSWORD),{method:"PATCH",withCredentials:!0,body:e})}async updatePasswordByOld(e){const t=await this.sudo({password:e.old_password});return this.setPassword({sudo_token:t.sudo_token,new_password:e.new_password})}async sudo(e){return this.config.request("".concat(Gh.SUDO_URL),{method:"POST",withCredentials:!0,body:e})}async sendVerificationCodeToCurrentUser(e){return e.target="CUR_USER",this.config.request(Gh.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})}async changeBoundProvider(e){return this.config.request("".concat(Gh.PROVIDER_LIST,"/").concat(e.provider_id,"/trans"),{method:"POST",body:{provider_trans_token:e.trans_token},withCredentials:!0})}async setUserProfile(e){return this.config.request(Gh.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})}async updateUserBasicInfo(e){return this.config.request(Gh.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:e})}async queryUserProfile(e){const t=new Lf(e);return this.config.request("".concat(Gh.USER_QUERY_URL,"?").concat(t.toString()),{method:"GET",withCredentials:!0})}setCustomSignFunc(e){this.getCustomSignTicketFn=e}async signInWithCustomTicket(){const e=this.getCustomSignTicketFn;if(!e)return Promise.reject({error:"failed_precondition",error_description:"please use setCustomSignFunc to set custom sign function"});const t=await e();return this.signInCustom({provider_id:"custom",ticket:t})}async resetPassword(e){return this.config.request(Gh.AUTH_RESET_PASSWORD,{method:"POST",body:e})}async authorize(e){return this.config.request(Gh.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:e})}async authorizeDevice(e){return this.config.request(Gh.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:e})}async deviceAuthorize(e){return this.config.request(Gh.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})}async authorizeInfo(t){const r="".concat(Gh.AUTHORIZE_INFO_URL,"?").concat(e.parseParamsToSearch(t));let n=!0,o=!1;return await this.hasLoginState()&&(o=!0,n=!1),this.config.request(r,{method:"GET",withBasicAuth:n,withCredentials:o})}async checkUsername(e){return this.config.request(Gh.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})}async checkIfUserExist(e){const t=new Lf(e);return this.config.request("".concat(Gh.CHECK_IF_USER_EXIST,"?").concat(t.toString()),{method:"GET"})}async loginScope(){return this.config.credentialsClient.getScope()}async loginGroups(){return this.config.credentialsClient.getGroups()}async refreshTokenForce(e){const t=await this.config.credentialsClient.getCredentials();return await this.config.credentialsClient.refreshToken(zh(zh({},t),{},{version:(null==e?void 0:e.version)||"v1"}))}async getCredentials(){return this.config.credentialsClient.getCredentials()}async getPublicKey(){return this.config.request(Kh.AUTH_PUBLIC_KEY,{method:"POST",body:{}})}async getEncryptParams(e){const{isEncrypt:t}=e;delete e.isEncrypt;const r=dd(e),n=await jf(t,this.config.adapter);if(!n)return e;let o="",i="";try{const e=await this.getPublicKey();if(o=e.public_key,i=e.public_key_thumbprint,!o||!i)throw e}catch(e){throw e}return{params:n.getEncryptInfo({publicKey:o,payload:r}),public_key_thumbprint:i}}async getProviderSubType(){return this.config.request(Gh.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})}async verifyCaptchaData(e){let{token:t,key:r}=e;return this.config.request(Gh.VERIFY_CAPTCHA_DATA_URL,{method:"POST",body:{token:t,key:r},withCredentials:!1})}async createCaptchaData(e){let{state:t,redirect_uri:r}=e;return this.config.request(Gh.CAPTCHA_DATA_URL,{method:"POST",body:{state:t,redirect_uri:r},withCredentials:!1})}async getMiniProgramCode(e){return this.config.request(Gh.GET_MINIPROGRAM_QRCODE,{method:"POST",body:e})}async getMiniProgramQrCodeStatus(e){return this.config.request(Gh.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:e})}async getUserBehaviorLog(e){const t="".concat(Gh.GET_USER_BEHAVIOR_LOG,"?").concat({LOGIN:"query[action]=USER_LOGIN",MODIFY:"ne_query[action]=USER_LOGIN"}[e.type],"&limit=").concat(e.limit).concat(e.page_token?"&page_token=".concat(e.page_token):"");return this.config.request(t,{method:"GET",withCredentials:!0})}async modifyPassword(e){let t="",r="";const n=await jf(!0,this.config.adapter);if(!n)throw new Error("do not support encrypt, a encrypt util required.");try{const e=await this.getPublicKey();if(t=e.public_key,r=e.public_key_thumbprint,!t||!r)throw e}catch(e){throw e}const o=e.password?n.getEncryptInfo({publicKey:t,payload:e.password}):"",i=n.getEncryptInfo({publicKey:t,payload:e.new_password});return this.config.request(Gh.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:{user_id:e.user_id,encrypt_password:o,encrypt_new_password:i,public_key_thumbprint:r}})}async modifyPasswordWithoutLogin(e){let t="",r="";const n=await jf(!0,this.config.adapter);if(!n)throw new Error("do not support encrypt, a encrypt util required.");try{const e=await this.getPublicKey();if(t=e.public_key,r=e.public_key_thumbprint,!t||!r)throw e}catch(e){throw e}const o=e.password?n.getEncryptInfo({publicKey:t,payload:e.password}):"",i=n.getEncryptInfo({publicKey:t,payload:e.new_password});return this.config.request(Kh.AUTH_RESET_PASSWORD,{method:"POST",body:{username:e.username,password:o,new_password:i,public_key_thumbprint:r}})}restoreUrlState(e,t){if(void 0!==e)try{const r=new URL(window.location.href);r.search=e,r.hash=t||"",window.history.replaceState(null,"",r.toString())}catch(e){}}};class Bf{constructor(e){const{apiOrigin:t,apiPath:r=Vh,clientId:n,env:o,storage:i,request:s,baseRequest:a,anonymousSignInFunc:u,wxCloud:c,adapter:l,onCredentialsError:h,headers:d,i18n:f,useWxCloud:p,eventBus:v,detectSessionInUrl:g,debug:m}=e;this.detectSessionInUrl=null!=g&&g,this.oauth2client=new bf({apiOrigin:t,apiPath:r,clientId:n,env:o,storage:i,baseRequest:a||s,anonymousSignInFunc:u,wxCloud:c,onCredentialsError:h,headers:d||{},i18n:f,useWxCloud:p,eventBus:v,debug:m}),this.authApi=new Df(zh(zh({credentialsClient:this.oauth2client},e),{},{request:s?this.oauth2client.request.bind(this.oauth2client):void 0,adapter:l})),g&&this.oauth2client.setGetInitialSession(this.authApi.getInitialSession.bind(this.authApi))}initializeSession(e){this.detectSessionInUrl?(this.oauth2client.setOnInitialSessionObtained(e),this.oauth2client.initialize()):this.oauth2client.initialize(Promise.resolve({error:null}))}}var Mf={exports:{}};!function(e){"undefined"!=typeof window&&window,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){e.exports=r(1)},function(e,t,r){var n,o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=(o=s.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},u=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r};Object.defineProperty(t,"__esModule",{value:!0});var c=r(3),l=r(2),h=function(e){function t(t){void 0===t&&(t={});var r=e.call(this)||this,n=t.timeout,o=t.timeoutMsg,i=t.restrictedMethods;return r._timeout=n||0,r._timeoutMsg=o||"请求超时",r._restrictedMethods=i||["get","post","upload","download"],r}return o(t,e),t.prototype.post=function(e){var t=this;return new Promise(function(r,n){var o=e.url,i=e.data,s=e.headers,a=wx.request({url:c.formatUrl("https:",o),data:i,timeout:t._timeout,method:"POST",header:s,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):n(e)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("post")&&"request:fail timeout"===e.errMsg){console.warn(t._timeoutMsg);try{a.abort()}catch(e){}}}})})},t.prototype.get=function(e){var t=this;return new Promise(function(r,n){var o=e.url,i=e.body,s=e.headers,a=c.formatUrl("https:",o),u=wx.request({url:a,data:i,timeout:t._timeout,method:"GET",header:s,success:function(e){e.statusCode>=200&&e.statusCode<300?r({statusCode:e.statusCode,status:e.statusCode,data:e.data}):n(e)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&t._timeout&&-1!==t._restrictedMethods.indexOf("get")&&e.errMsg.includes("timeout")){console.warn(t._timeoutMsg);try{u.abort()}catch(e){console.warn("Error when aborting requestTask",e)}}}})})},t.prototype.upload=function(e){var t=this,r=this;return new Promise(function(n){return s(t,void 0,void 0,function(){var t,o,s,u,c,l;return a(this,function(a){return t=e.url,o=e.file,s=e.data,u=e.headers,c=e.onUploadProgress,l=wx.uploadFile({url:t,filePath:o,name:"file",formData:i({},s),header:u,timeout:this._timeout,success:function(e){var t={statusCode:e.statusCode,data:e.data||{}};200===e.statusCode&&s.success_action_status&&(t.statusCode=parseInt(s.success_action_status,10)),n(t)},fail:function(e){n(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("upload")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{l.abort()}catch(e){}}}}),c&&l.onProgressUpdate(function(e){c(e)}),[2]})})})},t.prototype.download=function(e){var t=this,r=this;return new Promise(function(n,o){var i=e.url,s=e.headers,a=wx.downloadFile({url:c.formatUrl("https:",i),header:s,timeout:t._timeout,success:function(e){200===e.statusCode&&e.tempFilePath?n({statusCode:200,tempFilePath:e.tempFilePath}):n(e)},fail:function(e){o(e)},complete:function(e){if(e&&e.errMsg&&r._timeout&&-1!==r._restrictedMethods.indexOf("download")&&"request:fail timeout"===e.errMsg){console.warn(r._timeoutMsg);try{a.abort()}catch(e){}}}})})},t.prototype.fetch=function(e){var t=e.url,r=e.body,n=e.enableAbort,o=e.headers,i=e.method,s=e.stream,a=void 0!==s&&s,u=e.signal,h=e.timeout,d=this,f=null!=h?h:this._timeout,p=null,v=new l.ReadableStream({start:function(e){p=e},cancel:function(){p=null}});return new Promise(function(e,s){a&&e({data:v});var l=wx.request({url:c.formatUrl("https:",t),data:r,timeout:f,method:i.toUpperCase(),header:o,success:function(t){var r;null===(r=p)||void 0===r||r.close(),!a&&e(t)},fail:function(e){var t;if(null===(t=p)||void 0===t||t.close(),s(e),a)throw e},complete:function(e){if(e&&e.errMsg&&f&&-1!==d._restrictedMethods.indexOf("post")&&n&&"request:fail timeout"===e.errMsg){console.warn(d._timeoutMsg);try{l.abort()}catch(e){console.warn("Error when aborting requestTask",e)}}},enableChunked:a});if(l.onChunkReceived(function(e){var t;null===(t=p)||void 0===t||t.enqueue(new Uint8Array(e.data))}),u){var h=function(){try{l.abort()}catch(e){console.warn("Error when aborting requestTask",e)}};u.aborted?h():u.addEventListener("abort",function(){return h()})}})},t}(c.AbstractSDKRequest);t.WxRequest=h,t.wxMpStorage={setItem:function(e,t){wx.setStorageSync(e,t)},getItem:function(e){return wx.getStorageSync(e)},removeItem:function(e){wx.removeStorageSync(e)},clear:function(){wx.clearStorageSync()}};var d=function(e,t){void 0===t&&(t={});var r=wx.connectSocket(i({url:e},t));return{set onopen(e){r.onOpen(e)},set onmessage(e){r.onMessage(e)},set onclose(e){r.onClose(e)},set onerror(e){r.onError(e)},send:function(e){return r.send({data:e})},close:function(e,t){return r.close({code:e,reason:t})},get readyState(){return r.readyState},CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3}};function f(e){var t={},r=e.replace(/^[?#]/,"");return r?(r.split("&").forEach(function(e){var r=e.split("="),n=r[0],o=r[1];n=decodeURIComponent(n),o=decodeURIComponent(o),n&&(t[n]?Array.isArray(t[n])?t[n].push(o):t[n]=[t[n],o]:t[n]=o)}),t):t}t.WxMpWebSocket=d,t.parseQueryString=f;var p={genAdapter:function(e){return{root:{globalThis:{}},reqClass:h,wsClass:d,captchaOptions:{openURIWithCallback:function(t){var r=e.EventBus,n={},o=t;console.log("openURIWithCallback",t);var s=t.match(/^(data:.*?)(\?[^#\s]*)?$/);if(s){o=s[1],console.log("openURIWithCallback url",o);var a=s[2];a&&(n=f(a))}console.log("openURIWithCallback queryObj",n);var c=n.token,l=u(n,["token"]);return/^data:/.test(o)&&!c?Promise.reject({error:"invalid_argument",error_description:"invalie captcha data: "+t}):c?new Promise(function(e){console.log("wait for captcha..."),r.$emit("CAPTCHA_DATA_CHANGE",i(i({},l),{token:c,url:o})),r.$once("RESOLVE_CAPTCHA_DATA",function(t){e(t)})}):Promise.reject({error:"unimplemented",error_description:"need to impl captcha data"})}},localStorage:t.wxMpStorage,primaryStorage:c.StorageType.local,getAppSign:function(){var e=wx.getAccountInfoSync();return"undefined"!=typeof App||"undefined"!=typeof getApp||wx.onAppHide||wx.offAppHide||wx.onAppShow||wx.offAppShow?e&&e.miniProgram?e.miniProgram.appId:"":e&&e.plugin?e.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(e){return!1}return!0},runtime:"wx_mp"};t.default=p},function(e,t,r){
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* web-streams-polyfill v4.0.0
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
* This code is released under the MIT license.
|
|
7
7
|
* SPDX-License-Identifier: MIT
|
|
8
8
|
*/
|
|
9
|
-
function n(){}function o(e){return"object"==typeof e&&null!==e||"function"==typeof e}r.r(t),r.d(t,"ByteLengthQueuingStrategy",function(){return Vr}),r.d(t,"CountQueuingStrategy",function(){return Qr}),r.d(t,"ReadableByteStreamController",function(){return Ce}),r.d(t,"ReadableStream",function(){return qr}),r.d(t,"ReadableStreamBYOBReader",function(){return ut}),r.d(t,"ReadableStreamBYOBRequest",function(){return Re}),r.d(t,"ReadableStreamDefaultController",function(){return vr}),r.d(t,"ReadableStreamDefaultReader",function(){return te}),r.d(t,"TransformStream",function(){return rn}),r.d(t,"TransformStreamDefaultController",function(){return un}),r.d(t,"WritableStream",function(){return Tt}),r.d(t,"WritableStreamDefaultController",function(){return zt}),r.d(t,"WritableStreamDefaultWriter",function(){return jt});const i=n;function s(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const a=Promise,c=Promise.resolve.bind(a),u=Promise.prototype.then,l=Promise.reject.bind(a),h=c;function d(e){return new a(e)}function f(e){return d(t=>t(e))}function p(e){return l(e)}function v(e,t,r){return u.call(e,t,r)}function g(e,t,r){v(v(e,t,r),void 0,i)}function m(e,t){g(e,t)}function y(e,t){g(e,void 0,t)}function b(e,t,r){return v(e,t,r)}function _(e){v(e,void 0,i)}let w=e=>{if("function"==typeof queueMicrotask)w=queueMicrotask;else{const e=f(void 0);w=t=>v(e,t)}return w(e)};function S(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function I(e,t,r){try{return f(S(e,t,r))}catch(e){return p(e)}}class P{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let n=r+1;const o=e._elements,i=o[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),o[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,n=r._elements;for(;!(t===n.length&&void 0===r._next||t===n.length&&(r=r._next,n=r._elements,t=0,0===n.length));)e(n[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const E=Symbol("[[AbortSteps]]"),O=Symbol("[[ErrorSteps]]"),R=Symbol("[[CancelSteps]]"),C=Symbol("[[PullSteps]]"),A=Symbol("[[ReleaseSteps]]");function k(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?x(e):"closed"===t._state?function(e){x(e),D(e)}(e):N(e,t._storedError)}function U(e,t){return Br(e._ownerReadableStream,t)}function q(e){const t=e._ownerReadableStream;"readable"===t._state?j(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){N(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[A](),t._reader=void 0,e._ownerReadableStream=void 0}function L(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function x(e){e._closedPromise=d((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function N(e,t){x(e),j(e,t)}function j(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function D(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const B=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},M=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function W(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError("".concat(t," is not an object."));var r}function F(e,t){if("function"!=typeof e)throw new TypeError("".concat(t," is not a function."))}function H(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError("".concat(t," is not an object."))}function z(e,t,r){if(void 0===e)throw new TypeError("Parameter ".concat(t," is required in '").concat(r,"'."))}function V(e,t,r){if(void 0===e)throw new TypeError("".concat(t," is required in '").concat(r,"'."))}function G(e){return Number(e)}function K(e){return 0===e?0:e}function Y(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=K(n),!B(n))throw new TypeError("".concat(t," is not a finite number"));if(n=function(e){return K(M(e))}(n),n<0||n>r)throw new TypeError("".concat(t," is outside the accepted range of 0 to ").concat(r,", inclusive"));return B(n)&&0!==n?n:0}function Q(e,t){if(!jr(e))throw new TypeError("".concat(t," is not a ReadableStream."))}function J(e){return new te(e)}function $(e,t){e._reader._readRequests.push(t)}function Z(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function X(e){return e._reader._readRequests.length}function ee(e){const t=e._reader;return void 0!==t&&!!re(t)}class te{constructor(e){if(z(e,1,"ReadableStreamDefaultReader"),Q(e,"First parameter"),Dr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");k(this,e),this._readRequests=new P}get closed(){return re(this)?this._closedPromise:p(ie("closed"))}cancel(e){return re(this)?void 0===this._ownerReadableStream?p(L("cancel")):U(this,e):p(ie("cancel"))}read(){if(!re(this))return p(ie("read"));if(void 0===this._ownerReadableStream)return p(L("read from"));let e,t;const r=d((r,n)=>{e=r,t=n});return ne(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!re(this))throw ie("releaseLock");void 0!==this._ownerReadableStream&&function(e){q(e),oe(e,new TypeError("Reader was released"))}(this)}}function re(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof te}function ne(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[C](t)}function oe(e,t){const r=e._readRequests;e._readRequests=new P,r.forEach(e=>{e._errorSteps(t)})}function ie(e){return new TypeError("ReadableStreamDefaultReader.prototype.".concat(e," can only be used on a ReadableStreamDefaultReader"))}var se,ae,ce;function ue(e){return e.slice()}function le(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(te.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(te.prototype.cancel,"cancel"),s(te.prototype.read,"read"),s(te.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(te.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let he=e=>(he="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,he(e)),de=e=>(de="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,de(e));function fe(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return le(o,0,e,t,n),o}function pe(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError("".concat(String(t)," is not a function"));return r}}function ve(e){try{const t=e.done,r=e.value;return v(h(r),e=>({done:t,value:e}))}catch(e){return p(e)}}const ge=null!==(ce=null!==(se=Symbol.asyncIterator)&&void 0!==se?se:null===(ae=Symbol.for)||void 0===ae?void 0:ae.call(Symbol,"Symbol.asyncIterator"))&&void 0!==ce?ce:"@@asyncIterator";function me(e){const t=S(e.nextMethod,e.iterator,[]);if(!o(t))throw new TypeError("The iterator.next() method must return an object");return t}class ye{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?b(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?b(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let t,r;const n=d((e,n)=>{t=e,r=n});return ne(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,w(()=>t({value:e,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,q(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,q(e),r(t)}}),n}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=U(t,e);return q(t),b(r,()=>({value:e,done:!0}))}return q(t),f({value:e,done:!0})}}const be={next(){return _e(this)?this._asyncIteratorImpl.next():p(we("next"))},return(e){return _e(this)?this._asyncIteratorImpl.return(e):p(we("return"))},[ge](){return this}};function _e(e){if(!o(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof ye}catch(e){return!1}}function we(e){return new TypeError("ReadableStreamAsyncIterator.".concat(e," can only be used on a ReadableSteamAsyncIterator"))}Object.defineProperty(be,ge,{enumerable:!1});const Se=Number.isNaN||function(e){return e!=e};function Ie(e){const t=fe(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Te(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Pe(e,t,r){if("number"!=typeof(n=r)||Se(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Ee(e){e._queue=new P,e._queueTotalSize=0}function Oe(e){return e===DataView}class Re{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ke(this))throw rt("view");return this._view}respond(e){if(!ke(this))throw rt("respond");if(z(e,1,"respond"),e=Y(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(de(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Xe(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ke(this))throw rt("respondWithNewView");if(z(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(de(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");et(this._associatedReadableByteStreamController,e)}}Object.defineProperties(Re.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),s(Re.prototype.respond,"respond"),s(Re.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Re.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ce{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Ae(this))throw nt("byobRequest");return $e(this)}get desiredSize(){if(!Ae(this))throw nt("desiredSize");return Ze(this)}close(){if(!Ae(this))throw nt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in ".concat(e," state) is not in the readable state and cannot be closed"));Ke(this)}enqueue(e){if(!Ae(this))throw nt("enqueue");if(z(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in ".concat(t," state) is not in the readable state and cannot be enqueued to"));Ye(this,e)}error(e){if(!Ae(this))throw nt("error");Qe(this,e)}[R](e){qe(this),Ee(this);const t=this._cancelAlgorithm(e);return Ge(this),t}[C](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Je(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let n;try{n=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const o={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}$(t,e),Ue(this)}[A](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new P,this._pendingPullIntos.push(e)}}}function Ae(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof Ce}function ke(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof Re}function Ue(e){(function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&!e._closeRequested&&!!e._started&&(!!(ee(t)&&X(t)>0)||!!(ct(t)&&at(t)>0)||Ze(e)>0)})(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,g(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Ue(e)),null),t=>(Qe(e,t),null))))}function qe(e){Fe(e),e._pendingPullIntos=new P}function Le(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=xe(t);"default"===t.readerType?Z(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function xe(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Ne(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function je(e,t,r,n){let o;try{o=fe(t,r,r+n)}catch(t){throw Qe(e,t),t}Ne(e,o,0,n)}function De(e,t){t.bytesFilled>0&&je(e,t.buffer,t.byteOffset,t.bytesFilled),Ve(e)}function Be(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r;let o=r,i=!1;const s=n-n%t.elementSize;s>=t.minimumFill&&(o=s-t.bytesFilled,i=!0);const a=e._queue;for(;o>0;){const r=a.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;le(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?a.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,Me(e,n,t),o-=n}return i}function Me(e,t,r){r.bytesFilled+=t}function We(e){0===e._queueTotalSize&&e._closeRequested?(Ge(e),Mr(e._controlledReadableByteStream)):Ue(e)}function Fe(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function He(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();Be(e,t)&&(Ve(e),Le(e._controlledReadableByteStream,t))}}function ze(e,t){const r=e._pendingPullIntos.peek();Fe(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Ve(e);const r=e._controlledReadableByteStream;if(ct(r))for(;at(r)>0;)Le(r,Ve(e))}(e,r):function(e,t,r){if(Me(0,t,r),"none"===r.readerType)return De(e,r),void He(e);if(r.bytesFilled<r.minimumFill)return;Ve(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;je(e,r.buffer,t-n,n)}r.bytesFilled-=n,Le(e._controlledReadableByteStream,r),He(e)}(e,t,r),Ue(e)}function Ve(e){return e._pendingPullIntos.shift()}function Ge(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Ke(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!=0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Qe(e,t),t}}Ge(e),Mr(t)}}function Ye(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(de(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const s=he(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(de(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Fe(e),t.buffer=he(t.buffer),"none"===t.readerType&&De(e,t)}ee(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Je(e,t._readRequests.shift())}}(e),0===X(r)?Ne(e,s,o,i):(e._pendingPullIntos.length>0&&Ve(e),Z(r,new Uint8Array(s,o,i),!1))):ct(r)?(Ne(e,s,o,i),He(e)):Ne(e,s,o,i),Ue(e)}function Qe(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(qe(e),Ee(e),Ge(e),Wr(r,t))}function Je(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,We(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function $e(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(Re.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function Ze(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Xe(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=he(r.buffer),ze(e,t)}function et(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const n=t.byteLength;r.buffer=he(t.buffer),ze(e,n)}function tt(e,t,r,n,o,i,s){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Ee(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=s,t._pendingPullIntos=new P,e._readableStreamController=t,g(f(r()),()=>(t._started=!0,Ue(t),null),e=>(Qe(t,e),null))}function rt(e){return new TypeError("ReadableStreamBYOBRequest.prototype.".concat(e," can only be used on a ReadableStreamBYOBRequest"))}function nt(e){return new TypeError("ReadableByteStreamController.prototype.".concat(e," can only be used on a ReadableByteStreamController"))}function ot(e,t){if("byob"!==(e="".concat(e)))throw new TypeError("".concat(t," '").concat(e,"' is not a valid enumeration value for ReadableStreamReaderMode"));return e}function it(e){return new ut(e)}function st(e,t){e._reader._readIntoRequests.push(t)}function at(e){return e._reader._readIntoRequests.length}function ct(e){const t=e._reader;return void 0!==t&&!!lt(t)}Object.defineProperties(Ce.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),s(Ce.prototype.close,"close"),s(Ce.prototype.enqueue,"enqueue"),s(Ce.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ce.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class ut{constructor(e){if(z(e,1,"ReadableStreamBYOBReader"),Q(e,"First parameter"),Dr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Ae(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");k(this,e),this._readIntoRequests=new P}get closed(){return lt(this)?this._closedPromise:p(ft("closed"))}cancel(e){return lt(this)?void 0===this._ownerReadableStream?p(L("cancel")):U(this,e):p(ft("cancel"))}read(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!lt(this))return p(ft("read"));if(!ArrayBuffer.isView(e))return p(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return p(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return p(new TypeError("view's buffer must have non-zero byteLength"));if(de(e.buffer))return p(new TypeError("view's buffer has been detached"));try{t=function(e,t){var r;return W(e,t),{min:Y(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,"".concat(t," has member 'min' that"))}}(r,"options")}catch(e){return p(e)}const n=t.min;if(0===n)return p(new TypeError("options.min must be greater than 0"));if(function(e){return Oe(e.constructor)}(e)){if(n>e.byteLength)return p(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return p(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return p(L("read from"));let o,i;const s=d((e,t)=>{o=e,i=t});return ht(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),s}releaseLock(){if(!lt(this))throw ft("releaseLock");void 0!==this._ownerReadableStream&&function(e){q(e),dt(e,new TypeError("Reader was released"))}(this)}}function lt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof ut}function ht(e,t,r,n){const o=e._ownerReadableStream;o._disturbed=!0,"errored"===o._state?n._errorSteps(o._storedError):function(e,t,r,n){const o=e._controlledReadableByteStream,i=t.constructor,s=function(e){return Oe(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:a,byteLength:c}=t,u=r*s;let l;try{l=he(t.buffer)}catch(e){return void n._errorSteps(e)}const h={buffer:l,bufferByteLength:l.byteLength,byteOffset:a,byteLength:c,bytesFilled:0,minimumFill:u,elementSize:s,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(h),void st(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(Be(e,h)){const t=xe(h);return We(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Qe(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(h),st(o,n),Ue(e)}else{const e=new i(h.buffer,h.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function dt(e,t){const r=e._readIntoRequests;e._readIntoRequests=new P,r.forEach(e=>{e._errorSteps(t)})}function ft(e){return new TypeError("ReadableStreamBYOBReader.prototype.".concat(e," can only be used on a ReadableStreamBYOBReader"))}function pt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(Se(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function vt(e){const{size:t}=e;return t||(()=>1)}function gt(e,t){W(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:G(r),size:void 0===n?void 0:mt(n,"".concat(t," has member 'size' that"))}}function mt(e,t){return F(e,t),t=>G(e(t))}function yt(e,t,r){return F(e,r),r=>I(e,t,[r])}function bt(e,t,r){return F(e,r),()=>I(e,t,[])}function _t(e,t,r){return F(e,r),r=>S(e,t,[r])}function wt(e,t,r){return F(e,r),(r,n)=>I(e,t,[r,n])}function St(e,t){if(!Ot(e))throw new TypeError("".concat(t," is not a WritableStream."))}Object.defineProperties(ut.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(ut.prototype.cancel,"cancel"),s(ut.prototype.read,"read"),s(ut.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ut.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const It="function"==typeof AbortController;class Tt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e?e=null:H(e,"First parameter");const r=gt(t,"Second parameter"),n=function(e,t){W(e,t);const r=null==e?void 0:e.abort,n=null==e?void 0:e.close,o=null==e?void 0:e.start,i=null==e?void 0:e.type,s=null==e?void 0:e.write;return{abort:void 0===r?void 0:yt(r,e,"".concat(t," has member 'abort' that")),close:void 0===n?void 0:bt(n,e,"".concat(t," has member 'close' that")),start:void 0===o?void 0:_t(o,e,"".concat(t," has member 'start' that")),write:void 0===s?void 0:wt(s,e,"".concat(t," has member 'write' that")),type:i}}(e,"First parameter");if(Et(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=vt(r);!function(e,t,r,n){const o=Object.create(zt.prototype);let i,s,a,c;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.write?e=>t.write(e,o):()=>f(void 0),a=void 0!==t.close?()=>t.close():()=>f(void 0),c=void 0!==t.abort?e=>t.abort(e):()=>f(void 0),Gt(e,o,i,s,a,c,r,n)}(this,n,pt(r,1),o)}get locked(){if(!Ot(this))throw Xt("locked");return Rt(this)}abort(e){return Ot(this)?Rt(this)?p(new TypeError("Cannot abort a stream that already has a writer")):Ct(this,e):p(Xt("abort"))}close(){return Ot(this)?Rt(this)?p(new TypeError("Cannot close a stream that already has a writer")):Lt(this)?p(new TypeError("Cannot close an already-closing stream")):At(this):p(Xt("close"))}getWriter(){if(!Ot(this))throw Xt("getWriter");return Pt(this)}}function Pt(e){return new jt(e)}function Et(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new P,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Ot(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof Tt}function Rt(e){return void 0!==e._writer}function Ct(e,t){var r;if("closed"===e._state||"errored"===e._state)return f(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const n=e._state;if("closed"===n||"errored"===n)return f(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let o=!1;"erroring"===n&&(o=!0,t=void 0);const i=d((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}});return e._pendingAbortRequest._promise=i,o||Ut(e,t),i}function At(e){const t=e._state;if("closed"===t||"errored"===t)return p(new TypeError("The stream (in ".concat(t," state) is not in the writable state and cannot be closed")));const r=d((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n}),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&hr(n),Pe(o=e._writableStreamController,Ht,0),Qt(o),r}function kt(e,t){"writable"!==e._state?qt(e):Ut(e,t)}function Ut(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&Mt(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&qt(e)}function qt(e){e._state="errored",e._writableStreamController[O]();const t=e._storedError;if(e._writeRequests.forEach(e=>{e._reject(t)}),e._writeRequests=new P,void 0===e._pendingAbortRequest)return void xt(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void xt(e);g(e._writableStreamController[E](r._reason),()=>(r._resolve(),xt(e),null),t=>(r._reject(t),xt(e),null))}function Lt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function xt(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&ir(t,e._storedError)}function Nt(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){ar(e)}(r):hr(r)),e._backpressure=t}Object.defineProperties(Tt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),s(Tt.prototype.abort,"abort"),s(Tt.prototype.close,"close"),s(Tt.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Tt.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class jt{constructor(e){if(z(e,1,"WritableStreamDefaultWriter"),St(e,"First parameter"),Rt(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!Lt(e)&&e._backpressure?ar(this):ur(this),nr(this);else if("erroring"===t)cr(this,e._storedError),nr(this);else if("closed"===t)ur(this),nr(this),sr(this);else{const t=e._storedError;cr(this,t),or(this,t)}}get closed(){return Dt(this)?this._closedPromise:p(tr("closed"))}get desiredSize(){if(!Dt(this))throw tr("desiredSize");if(void 0===this._ownerWritableStream)throw rr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Yt(t._writableStreamController)}(this)}get ready(){return Dt(this)?this._readyPromise:p(tr("ready"))}abort(e){return Dt(this)?void 0===this._ownerWritableStream?p(rr("abort")):function(e,t){return Ct(e._ownerWritableStream,t)}(this,e):p(tr("abort"))}close(){if(!Dt(this))return p(tr("close"));const e=this._ownerWritableStream;return void 0===e?p(rr("close")):Lt(e)?p(new TypeError("Cannot close an already-closing stream")):Bt(this)}releaseLock(){if(!Dt(this))throw tr("releaseLock");void 0!==this._ownerWritableStream&&Wt(this)}write(e){return Dt(this)?void 0===this._ownerWritableStream?p(rr("write to")):Ft(this,e):p(tr("write"))}}function Dt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof jt}function Bt(e){return At(e._ownerWritableStream)}function Mt(e,t){"pending"===e._readyPromiseState?lr(e,t):function(e,t){cr(e,t)}(e,t)}function Wt(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Mt(e,r),function(e,t){"pending"===e._closedPromiseState?ir(e,t):function(e,t){or(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Ft(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Jt(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return p(rr("write to"));const i=r._state;if("errored"===i)return p(r._storedError);if(Lt(r)||"closed"===i)return p(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return p(r._storedError);const s=function(e){return d((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)})}(r);return function(e,t,r){try{Pe(e,t,r)}catch(t){return void Jt(e,t)}const n=e._controlledWritableStream;Lt(n)||"writable"!==n._state||Nt(n,$t(e)),Qt(e)}(n,t,o),s}Object.defineProperties(jt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),s(jt.prototype.abort,"abort"),s(jt.prototype.close,"close"),s(jt.prototype.releaseLock,"releaseLock"),s(jt.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(jt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Ht={};class zt{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Vt(this))throw er("abortReason");return this._abortReason}get signal(){if(!Vt(this))throw er("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e){if(!Vt(this))throw er("error");"writable"===this._controlledWritableStream._state&&Zt(this,e)}[E](e){const t=this._abortAlgorithm(e);return Kt(this),t}[O](){Ee(this)}}function Vt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof zt}function Gt(e,t,r,n,o,i,s,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._abortReason=void 0,t._abortController=function(){if(It)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=s,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const c=$t(t);Nt(e,c),g(f(r()),()=>(t._started=!0,Qt(t),null),r=>(t._started=!0,kt(e,r),null))}function Kt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Yt(e){return e._strategyHWM-e._queueTotalSize}function Qt(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void qt(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===Ht?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Te(e);const r=e._closeAlgorithm();Kt(e),g(r,()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&sr(t)}(t),null),e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),kt(e,t)}(t,e),null))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),g(e._writeAlgorithm(t),()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(Te(e),!Lt(r)&&"writable"===t){const t=$t(e);Nt(r,t)}return Qt(e),null},t=>("writable"===r._state&&Kt(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,kt(e,t)}(r,t),null))}(e,r)}function Jt(e,t){"writable"===e._controlledWritableStream._state&&Zt(e,t)}function $t(e){return Yt(e)<=0}function Zt(e,t){const r=e._controlledWritableStream;Kt(e),Ut(r,t)}function Xt(e){return new TypeError("WritableStream.prototype.".concat(e," can only be used on a WritableStream"))}function er(e){return new TypeError("WritableStreamDefaultController.prototype.".concat(e," can only be used on a WritableStreamDefaultController"))}function tr(e){return new TypeError("WritableStreamDefaultWriter.prototype.".concat(e," can only be used on a WritableStreamDefaultWriter"))}function rr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function nr(e){e._closedPromise=d((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function or(e,t){nr(e),ir(e,t)}function ir(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function sr(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function ar(e){e._readyPromise=d((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function cr(e,t){ar(e),lr(e,t)}function ur(e){ar(e),hr(e)}function lr(e,t){void 0!==e._readyPromise_reject&&(_(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function hr(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(zt.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(zt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const dr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==T?T:void 0,fr=function(){const e=null==dr?void 0:dr.DOMException;return function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;if("DOMException"!==e.name)return!1;try{return new e,!0}catch(e){return!1}}(e)?e:void 0}()||function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return s(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function pr(e,t,r,o,i,s){const a=J(e),c=Pt(t);e._disturbed=!0;let u=!1,l=f(void 0);return d((h,b)=>{let w;if(void 0!==s){if(w=()=>{const r=void 0!==s.reason?s.reason:new fr("Aborted","AbortError"),n=[];o||n.push(()=>"writable"===t._state?Ct(t,r):f(void 0)),i||n.push(()=>"readable"===e._state?Br(e,r):f(void 0)),O(()=>Promise.all(n.map(e=>e())),!0,r)},s.aborted)return void w();s.addEventListener("abort",w)}var S,I,T;if(E(e,a._closedPromise,e=>(o?R(!0,e):O(()=>Ct(t,e),!0,e),null)),E(t,c._closedPromise,t=>(i?R(!0,t):O(()=>Br(e,t),!0,t),null)),S=e,I=a._closedPromise,T=()=>(r?R():O(()=>function(e){const t=e._ownerWritableStream,r=t._state;return Lt(t)||"closed"===r?f(void 0):"errored"===r?p(t._storedError):Bt(e)}(c)),null),"closed"===S._state?T():m(I,T),Lt(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");i?R(!0,t):O(()=>Br(e,t),!0,t)}function P(){const e=l;return v(l,()=>e!==l?P():void 0)}function E(e,t,r){"errored"===e._state?r(e._storedError):y(t,r)}function O(e,r,n){function o(){return g(e(),()=>C(r,n),e=>C(!0,e)),null}u||(u=!0,"writable"!==t._state||Lt(t)?o():m(P(),o))}function R(e,r){u||(u=!0,"writable"!==t._state||Lt(t)?C(e,r):m(P(),()=>C(e,r)))}function C(e,t){return Wt(c),q(a),void 0!==s&&s.removeEventListener("abort",w),e?b(t):h(void 0),null}_(d((e,t)=>{!function r(o){o?e():v(u?f(!0):v(c._readyPromise,()=>d((e,t)=>{ne(a,{_chunkSteps:t=>{l=v(Ft(c,t),void 0,n),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})),r,t)}(!1)}))})}class vr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!gr(this))throw Er("desiredSize");return Ir(this)}close(){if(!gr(this))throw Er("close");if(!Tr(this))throw new TypeError("The stream is not in a state that permits close");_r(this)}enqueue(e){if(!gr(this))throw Er("enqueue");if(!Tr(this))throw new TypeError("The stream is not in a state that permits enqueue");return wr(this,e)}error(e){if(!gr(this))throw Er("error");Sr(this,e)}[R](e){Ee(this);const t=this._cancelAlgorithm(e);return br(this),t}[C](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=Te(this);this._closeRequested&&0===this._queue.length?(br(this),Mr(t)):mr(this),e._chunkSteps(r)}else $(t,e),mr(this)}[A](){}}function gr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof vr}function mr(e){yr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,g(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,mr(e)),null),t=>(Sr(e,t),null))))}function yr(e){const t=e._controlledReadableStream;return!!Tr(e)&&!!e._started&&(!!(Dr(t)&&X(t)>0)||Ir(e)>0)}function br(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function _r(e){if(!Tr(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(br(e),Mr(t))}function wr(e,t){if(!Tr(e))return;const r=e._controlledReadableStream;if(Dr(r)&&X(r)>0)Z(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw Sr(e,t),t}try{Pe(e,t,r)}catch(t){throw Sr(e,t),t}}mr(e)}function Sr(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(Ee(e),br(e),Wr(r,t))}function Ir(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Tr(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Pr(e,t,r,n,o,i,s){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=s,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,g(f(r()),()=>(t._started=!0,mr(t),null),e=>(Sr(t,e),null))}function Er(e){return new TypeError("ReadableStreamDefaultController.prototype.".concat(e," can only be used on a ReadableStreamDefaultController"))}function Or(e){return o(t=e)&&void 0!==t.getReader?function(e){let t;return t=Lr(n,function(){let r;try{r=e.read()}catch(r){return p(r)}return b(r,e=>{if(!o(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)_r(t._readableStreamController);else{const r=e.value;wr(t._readableStreamController,r)}})},function(t){try{return f(e.cancel(t))}catch(t){return p(t)}},0),t}(e.getReader()):function(e){let t;const r=function e(t){let r=arguments.length>2?arguments[2]:void 0;if(void 0===r)if("async"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"sync")){if(void 0===(r=pe(t,ge)))return function(e){const t={next(){let t;try{t=me(e)}catch(e){return p(e)}return ve(t)},return(t){let r;try{const n=pe(e.iterator,"return");if(void 0===n)return f({done:!0,value:t});r=S(n,e.iterator,[t])}catch(e){return p(e)}return o(r)?ve(r):p(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(e(t,"sync",pe(t,Symbol.iterator)))}else r=pe(t,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const n=S(r,t,[]);if(!o(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}(e,"async");return t=Lr(n,function(){let e;try{e=me(r)}catch(e){return p(e)}return b(f(e),e=>{if(!o(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)_r(t._readableStreamController);else{const r=e.value;wr(t._readableStreamController,r)}})},function(e){const t=r.iterator;let n;try{n=pe(t,"return")}catch(e){return p(e)}return void 0===n?f(void 0):b(I(n,t,[e]),e=>{if(!o(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})},0),t}(e);var t}function Rr(e,t,r){return F(e,r),r=>I(e,t,[r])}function Cr(e,t,r){return F(e,r),r=>I(e,t,[r])}function Ar(e,t,r){return F(e,r),r=>S(e,t,[r])}function kr(e,t){if("bytes"!==(e="".concat(e)))throw new TypeError("".concat(t," '").concat(e,"' is not a valid enumeration value for ReadableStreamType"));return e}function Ur(e,t){W(e,t);const r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,o=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError("".concat(t," is not an AbortSignal."))}(i,"".concat(t," has member 'signal' that")),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(o),signal:i}}Object.defineProperties(vr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),s(vr.prototype.close,"close"),s(vr.prototype.enqueue,"enqueue"),s(vr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(vr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class qr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e?e=null:H(e,"First parameter");const r=gt(t,"Second parameter"),n=function(e,t){W(e,t);const r=e,n=null==r?void 0:r.autoAllocateChunkSize,o=null==r?void 0:r.cancel,i=null==r?void 0:r.pull,s=null==r?void 0:r.start,a=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Y(n,"".concat(t," has member 'autoAllocateChunkSize' that")),cancel:void 0===o?void 0:Rr(o,r,"".concat(t," has member 'cancel' that")),pull:void 0===i?void 0:Cr(i,r,"".concat(t," has member 'pull' that")),start:void 0===s?void 0:Ar(s,r,"".concat(t," has member 'start' that")),type:void 0===a?void 0:kr(a,"".concat(t," has member 'type' that"))}}(e,"First parameter");if(Nr(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){const n=Object.create(Ce.prototype);let o,i,s;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>f(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>f(void 0);const a=t.autoAllocateChunkSize;if(0===a)throw new TypeError("autoAllocateChunkSize must be greater than 0");tt(e,n,o,i,s,r,a)}(this,n,pt(r,0))}else{const e=vt(r);!function(e,t,r,n){const o=Object.create(vr.prototype);let i,s,a;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.pull?()=>t.pull(o):()=>f(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>f(void 0),Pr(e,o,i,s,a,r,n)}(this,n,pt(r,1),e)}}get locked(){if(!jr(this))throw Fr("locked");return Dr(this)}cancel(e){return jr(this)?Dr(this)?p(new TypeError("Cannot cancel a stream that already has a reader")):Br(this,e):p(Fr("cancel"))}getReader(e){if(!jr(this))throw Fr("getReader");return void 0===function(e,t){W(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:ot(r,"".concat(t," has member 'mode' that"))}}(e,"First parameter").mode?J(this):it(this)}pipeThrough(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!jr(this))throw Fr("pipeThrough");z(e,1,"pipeThrough");const r=function(e,t){W(e,t);const r=null==e?void 0:e.readable;V(r,"readable","ReadableWritablePair"),Q(r,"".concat(t," has member 'readable' that"));const n=null==e?void 0:e.writable;return V(n,"writable","ReadableWritablePair"),St(n,"".concat(t," has member 'writable' that")),{readable:r,writable:n}}(e,"First parameter"),n=Ur(t,"Second parameter");if(Dr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Rt(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return _(pr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!jr(this))return p(Fr("pipeTo"));if(void 0===e)return p("Parameter 1 is required in 'pipeTo'.");if(!Ot(e))return p(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));try{t=Ur(r,"Second parameter")}catch(e){return p(e)}return Dr(this)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Rt(e)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):pr(this,e,t.preventClose,t.preventAbort,t.preventCancel,t.signal)}tee(){if(!jr(this))throw Fr("tee");return ue(function(e){return Ae(e._readableStreamController)?function(e){let t,r,n,o,i,s=J(e),a=!1,c=!1,u=!1,l=!1,h=!1;const p=d(e=>{i=e});function v(e){y(e._closedPromise,t=>(e!==s||(Qe(n._readableStreamController,t),Qe(o._readableStreamController,t),l&&h||i(void 0)),null))}function g(){lt(s)&&(q(s),s=J(e),v(s)),ne(s,{_chunkSteps:t=>{w(()=>{c=!1,u=!1;const r=t;let s=t;if(!l&&!h)try{s=Ie(t)}catch(t){return Qe(n._readableStreamController,t),Qe(o._readableStreamController,t),void i(Br(e,t))}l||Ye(n._readableStreamController,r),h||Ye(o._readableStreamController,s),a=!1,c?b():u&&_()})},_closeSteps:()=>{a=!1,l||Ke(n._readableStreamController),h||Ke(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&Xe(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Xe(o._readableStreamController,0),l&&h||i(void 0)},_errorSteps:()=>{a=!1}})}function m(t,r){re(s)&&(q(s),s=it(e),v(s));const d=r?o:n,f=r?n:o;ht(s,t,1,{_chunkSteps:t=>{w(()=>{c=!1,u=!1;const n=r?h:l;if(r?l:h)n||et(d._readableStreamController,t);else{let r;try{r=Ie(t)}catch(t){return Qe(d._readableStreamController,t),Qe(f._readableStreamController,t),void i(Br(e,t))}n||et(d._readableStreamController,t),Ye(f._readableStreamController,r)}a=!1,c?b():u&&_()})},_closeSteps:e=>{a=!1;const t=r?h:l,n=r?l:h;t||Ke(d._readableStreamController),n||Ke(f._readableStreamController),void 0!==e&&(t||et(d._readableStreamController,e),!n&&f._readableStreamController._pendingPullIntos.length>0&&Xe(f._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{a=!1}})}function b(){if(a)return c=!0,f(void 0);a=!0;const e=$e(n._readableStreamController);return null===e?g():m(e._view,!1),f(void 0)}function _(){if(a)return u=!0,f(void 0);a=!0;const e=$e(o._readableStreamController);return null===e?g():m(e._view,!0),f(void 0)}function S(){}return n=xr(S,b,function(n){if(l=!0,t=n,h){const n=ue([t,r]),o=Br(e,n);i(o)}return p}),o=xr(S,_,function(n){if(h=!0,r=n,l){const n=ue([t,r]),o=Br(e,n);i(o)}return p}),v(s),[n,o]}(e):function(e){const t=J(e);let r,n,o,i,s,a=!1,c=!1,u=!1,l=!1;const h=d(e=>{s=e});function p(){return a?(c=!0,f(void 0)):(a=!0,ne(t,{_chunkSteps:e=>{w(()=>{c=!1;const t=e,r=e;u||wr(o._readableStreamController,t),l||wr(i._readableStreamController,r),a=!1,c&&p()})},_closeSteps:()=>{a=!1,u||_r(o._readableStreamController),l||_r(i._readableStreamController),u&&l||s(void 0)},_errorSteps:()=>{a=!1}}),f(void 0))}function v(){}return o=Lr(v,p,function(t){if(u=!0,r=t,l){const t=ue([r,n]),o=Br(e,t);s(o)}return h}),i=Lr(v,p,function(t){if(l=!0,n=t,u){const t=ue([r,n]),o=Br(e,t);s(o)}return h}),y(t._closedPromise,e=>(Sr(o._readableStreamController,e),Sr(i._readableStreamController,e),u&&l||s(void 0),null)),[o,i]}(e)}(this))}values(e){if(!jr(this))throw Fr("values");return function(e,t){const r=J(e),n=new ye(r,t),o=Object.create(be);return o._asyncIteratorImpl=n,o}(this,function(e){W(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[ge](e){return this.values(e)}static from(e){return Or(e)}}function Lr(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:()=>1;const i=Object.create(qr.prototype);return Nr(i),Pr(i,Object.create(vr.prototype),e,t,r,n,o),i}function xr(e,t,r){const n=Object.create(qr.prototype);return Nr(n),tt(n,Object.create(Ce.prototype),e,t,r,0,void 0),n}function Nr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function jr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof qr}function Dr(e){return void 0!==e._reader}function Br(e,t){if(e._disturbed=!0,"closed"===e._state)return f(void 0);if("errored"===e._state)return p(e._storedError);Mr(e);const r=e._reader;if(void 0!==r&<(r)){const e=r._readIntoRequests;r._readIntoRequests=new P,e.forEach(e=>{e._closeSteps(void 0)})}return b(e._readableStreamController[R](t),n)}function Mr(e){e._state="closed";const t=e._reader;if(void 0!==t&&(D(t),re(t))){const e=t._readRequests;t._readRequests=new P,e.forEach(e=>{e._closeSteps()})}}function Wr(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(j(r,t),re(r)?oe(r,t):dt(r,t))}function Fr(e){return new TypeError("ReadableStream.prototype.".concat(e," can only be used on a ReadableStream"))}function Hr(e,t){W(e,t);const r=null==e?void 0:e.highWaterMark;return V(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:G(r)}}Object.defineProperties(qr,{from:{enumerable:!0}}),Object.defineProperties(qr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),s(qr.from,"from"),s(qr.prototype.cancel,"cancel"),s(qr.prototype.getReader,"getReader"),s(qr.prototype.pipeThrough,"pipeThrough"),s(qr.prototype.pipeTo,"pipeTo"),s(qr.prototype.tee,"tee"),s(qr.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(qr.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(qr.prototype,ge,{value:qr.prototype.values,writable:!0,configurable:!0});const zr=e=>e.byteLength;s(zr,"size");class Vr{constructor(e){z(e,1,"ByteLengthQueuingStrategy"),e=Hr(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Kr(this))throw Gr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Kr(this))throw Gr("size");return zr}}function Gr(e){return new TypeError("ByteLengthQueuingStrategy.prototype.".concat(e," can only be used on a ByteLengthQueuingStrategy"))}function Kr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof Vr}Object.defineProperties(Vr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Vr.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Yr=()=>1;s(Yr,"size");class Qr{constructor(e){z(e,1,"CountQueuingStrategy"),e=Hr(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!$r(this))throw Jr("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!$r(this))throw Jr("size");return Yr}}function Jr(e){return new TypeError("CountQueuingStrategy.prototype.".concat(e," can only be used on a CountQueuingStrategy"))}function $r(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Qr}function Zr(e,t,r){return F(e,r),r=>I(e,t,[r])}function Xr(e,t,r){return F(e,r),r=>S(e,t,[r])}function en(e,t,r){return F(e,r),(r,n)=>I(e,t,[r,n])}function tn(e,t,r){return F(e,r),r=>I(e,t,[r])}Object.defineProperties(Qr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Qr.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class rn{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};void 0===e&&(e=null);const r=gt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"Second parameter"),n=gt(t,"Third parameter"),o=function(e,t){W(e,t);const r=null==e?void 0:e.cancel,n=null==e?void 0:e.flush,o=null==e?void 0:e.readableType,i=null==e?void 0:e.start,s=null==e?void 0:e.transform,a=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:tn(r,e,"".concat(t," has member 'cancel' that")),flush:void 0===n?void 0:Zr(n,e,"".concat(t," has member 'flush' that")),readableType:o,start:void 0===i?void 0:Xr(i,e,"".concat(t," has member 'start' that")),transform:void 0===s?void 0:en(s,e,"".concat(t," has member 'transform' that")),writableType:a}}(e,"First parameter");if(void 0!==o.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==o.writableType)throw new RangeError("Invalid writableType specified");const i=pt(n,0),s=vt(n),a=pt(r,1),c=vt(r);let u;!function(e,t,r,n,o,i){function s(){return t}e._writable=function(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:()=>1;const s=Object.create(Tt.prototype);return Et(s),Gt(s,Object.create(zt.prototype),e,t,r,n,o,i),s}(s,function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?b(e._backpressureChangePromise,()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return fn(r,t)}):fn(r,t)}(e,t)},function(){return function(e){const t=e._transformStreamController;if(void 0!==t._finishPromise)return t._finishPromise;const r=e._readable;t._finishPromise=d((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r});const n=t._flushAlgorithm();return hn(t),g(n,()=>("errored"===r._state?gn(t,r._storedError):(_r(r._readableStreamController),vn(t)),null),e=>(Sr(r._readableStreamController,e),gn(t,e),null)),t._finishPromise}(e)},function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._readable;r._finishPromise=d((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t});const o=r._cancelAlgorithm(t);return hn(r),g(o,()=>("errored"===n._state?gn(r,n._storedError):(Sr(n._readableStreamController,t),vn(r)),null),e=>(Sr(n._readableStreamController,e),gn(r,e),null)),r._finishPromise}(e,t)},r,n),e._readable=Lr(s,function(){return function(e){return cn(e,!1),e._backpressureChangePromise}(e)},function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._writable;r._finishPromise=d((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t});const o=r._cancelAlgorithm(t);return hn(r),g(o,()=>("errored"===n._state?gn(r,n._storedError):(Jt(n._writableStreamController,t),an(e),vn(r)),null),t=>(Jt(n._writableStreamController,t),an(e),gn(r,t),null)),r._finishPromise}(e,t)},o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,cn(e,!0),e._transformStreamController=void 0}(this,d(e=>{u=e}),a,c,i,s),function(e,t){const r=Object.create(un.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return dn(r,e),f(void 0)}catch(e){return p(e)}},o=void 0!==t.flush?()=>t.flush(r):()=>f(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>f(void 0),function(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,n,o,i)}(this,o),void 0!==o.start?u(o.start(this._transformStreamController)):u(void 0)}get readable(){if(!nn(this))throw mn("readable");return this._readable}get writable(){if(!nn(this))throw mn("writable");return this._writable}}function nn(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof rn}function on(e,t){Sr(e._readable._readableStreamController,t),sn(e,t)}function sn(e,t){hn(e._transformStreamController),Jt(e._writable._writableStreamController,t),an(e)}function an(e){e._backpressure&&cn(e,!1)}function cn(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=d(t=>{e._backpressureChangePromise_resolve=t}),e._backpressure=t}Object.defineProperties(rn.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(rn.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class un{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!ln(this))throw pn("desiredSize");return Ir(this._controlledTransformStream._readable._readableStreamController)}enqueue(e){if(!ln(this))throw pn("enqueue");dn(this,e)}error(e){if(!ln(this))throw pn("error");var t;t=e,on(this._controlledTransformStream,t)}terminate(){if(!ln(this))throw pn("terminate");!function(e){const t=e._controlledTransformStream;_r(t._readable._readableStreamController),sn(t,new TypeError("TransformStream terminated"))}(this)}}function ln(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof un}function hn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function dn(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Tr(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{wr(n,t)}catch(e){throw sn(r,e),r._readable._storedError}(function(e){return!yr(e)})(n)!==r._backpressure&&cn(r,!0)}function fn(e,t){return b(e._transformAlgorithm(t),void 0,t=>{throw on(e._controlledTransformStream,t),t})}function pn(e){return new TypeError("TransformStreamDefaultController.prototype.".concat(e," can only be used on a TransformStreamDefaultController"))}function vn(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function gn(e,t){void 0!==e._finishPromise_reject&&(_(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function mn(e){return new TypeError("TransformStream.prototype.".concat(e," can only be used on a TransformStream"))}Object.defineProperties(un.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),s(un.prototype.enqueue,"enqueue"),s(un.prototype.error,"error"),s(un.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(un.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0})},function(e,t,r){var n;r.r(t),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}r.d(t,"StorageType",function(){return n}),r.d(t,"AbstractSDKRequest",function(){return o}),r.d(t,"AbstractStorage",function(){return i}),r.d(t,"formatUrl",function(){return s})}])}(Mf);var Wf=P(Mf.exports),Ff=this&&this.__assign||function(){return Ff=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ff.apply(this,arguments)},Hf=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})},zf=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},Vf=function(){function e(e){var t,r;try{this.localStorage=(null==e?void 0:e.localStorage)||((null===(r=null===(t=null==e?void 0:e.adapter)||void 0===t?void 0:t.root)||void 0===r?void 0:r.globalThis)||globalThis).localStorage}catch(t){this.localStorage=(null==e?void 0:e.localStorage)||{}}}return e.prototype.getItem=function(e){return Hf(this,void 0,void 0,function(){return zf(this,function(t){return[2,this.localStorage.getItem(e)]})})},e.prototype.removeItem=function(e){return Hf(this,void 0,void 0,function(){return zf(this,function(t){return this.localStorage.removeItem(e),[2]})})},e.prototype.setItem=function(e,t){return Hf(this,void 0,void 0,function(){return zf(this,function(r){return this.localStorage.setItem(e,t),[2]})})},e.prototype.getItemSync=function(e){return this.localStorage.getItem(e)},e.prototype.setItemSync=function(e,t){this.localStorage.setItem(e,t)},e.prototype.removeItemSync=function(e){this.localStorage.removeItem(e)},e}(),Gf=/^[^:]+:\/\/[^/]+(\/[^?#]+)/,Kf=function(e,t){var r,n,o,i=null===(r=null==t?void 0:t.headers)||void 0===r?void 0:r["x-request-id"];return e||(e={}),((null==e?void 0:e.code)||(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code))&&(e={error:e.code||e.data.error,error_description:e.data.error_description||e.message||e.code||e.data.error_code,request_id:e.requestId,error_code:null===(o=e.data)||void 0===o?void 0:o.error_code}),(null==e?void 0:e.request_id)||(e.request_id=e.request_id||i),(null==e?void 0:e.error)?(e.error_uri=function(e){return Gf.test(e)?RegExp.$1:e}(null==t?void 0:t.url),e):(null==e?void 0:e.data)||{}};var Yf=function(e,t){var r=Ff({},e),n={};if((null==t?void 0:t.captchaOptions)&&(r.captchaOptions=t.captchaOptions),!Wf.isMatch()||e.storage&&e.baseRequest)return r;try{var o=Wf.genAdapter({}),i=o.localStorage,s=o.reqClass;if(i&&(n.storage=new Vf({localStorage:i,adapter:t})),s){var a=new s({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});n.request=function(e){return function(t,r){return Hf(this,void 0,void 0,function(){return zf(this,function(n){return[2,new Promise(function(n,o){var i=Object.assign({},r);i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body));var s=wx.request({url:t,data:i.body,timeout:e._timeout,method:i.method||"GET",header:i.headers,success:function(e){(e=Kf(e,Ff(Ff({},r),{url:t}))).error&&o(e),n(e)},fail:function(e){o({error:"unreachable",error_description:e.message})},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("request")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{s.abort()}catch(e){}}}})})]})})}}(a)}return r.captchaOptions&&(n.baseRequest=n.request,n.request=void 0),Ff(Ff({},r),n)}catch(e){console.error("adapter generate fail:",e)}return r},Qf=function(e){return e.adapter&&"default"!==e.adapter.type?function(e,t){var r=Ff({},e);try{if(!(null==e?void 0:e.storage)&&(null==t?void 0:t.localStorage)&&(r.storage=new Vf({localStorage:t.localStorage,adapter:t})),!e.captchaOptions&&(null==t?void 0:t.captchaOptions)&&(r.captchaOptions=t.captchaOptions),!e.baseRequest&&!e.request&&(null==t?void 0:t.reqClass)){var n=new t.reqClass({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});r.baseRequest=function(e,t){var r,o,i,s,a;return Hf(this,void 0,void 0,function(){var c,u,l,h;return zf(this,function(d){switch(d.label){case 0:if(c={},u=(null===(r=t.method)||void 0===r?void 0:r.toLocaleLowerCase())||"post","function"!=typeof(l=null===(i=null===(o=null==n?void 0:n[u])||void 0===o?void 0:o.bind)||void 0===i?void 0:i.call(o,n)))throw new Error("invalid 【".concat(u,"】 request method"));d.label=1;case 1:return d.trys.push([1,3,,4]),(null===(s=t.headers)||void 0===s?void 0:s["content-type"])&&!(null===(a=t.headers)||void 0===a?void 0:a["content-type"].includes("application/json"))||["string","undefined"].includes(typeof t.body)||(t.data=t.data||t.body,t.body=JSON.stringify(t.body)),[4,l(Ff({url:e},t))];case 2:return c=d.sent(),c=Kf(c,Ff(Ff({},t),{url:e})),[3,4];case 3:throw h=d.sent(),c=Ff(Ff({},null==h?void 0:h.data),h);case 4:if(null==c?void 0:c.error)throw c;return[2,c]}})})}}}catch(e){console.error("user adapter generate fail:",e)}return r}(e,e.adapter):Yf(e,e.adapter)};var Jf=this&&this.__assign||function(){return Jf=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Jf.apply(this,arguments)},$f=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},Zf=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Xf=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{c(n.next(e))}catch(e){i(e)}}function a(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((n=n.apply(e,t||[])).next())})},ep=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}},tp=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},rp=function(){return"undefined"!=typeof window&&"undefined"!=typeof document},np=function(e){return function(t){e.fire(sd,Jf(Jf({},t),{eventType:Zh}))}},op=function(){function e(e){var t=e.cache,r=e.oauthInstance;this.cache=t,this.oauthInstance=r,this.setUserInfo()}return e.prototype.checkLocalInfo=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]})})},e.prototype.checkLocalInfoAsync=function(){return Xf(this,void 0,void 0,function(){var e,t,r,n;return ep(this,function(o){switch(o.label){case 0:return e=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return e.uid=o.sent(),t=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return t.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),r=this,[4,this.getLocalUserInfoAsync("email")];case 3:return r.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),n=this,[4,this.getLocalUserInfoAsync("username")];case 4:return n.username=o.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]}})})},e.prototype.update=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(Jf({},e))];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2]}})})},e.prototype.updateUserBasicInfo=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.updateUserBasicInfo(Jf({},e))];case 1:return t.sent(),[4,this.refresh()];case 2:return t.sent(),[2]}})})},e.prototype.updatePassword=function(e,t){return this.oauthInstance.authApi.updatePasswordByOld({old_password:t,new_password:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&Ld(Ed,"username must be a string"),this.update({username:e})},e.prototype.refresh=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(e)];case 1:if("INVALID_ACCESS_TOKEN"===(t=r.sent()).code)throw this.setLocalUserInfo({}),t;return this.setLocalUserInfo(t),[2,t]}})})},e.prototype.getLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey,r=this.cache.getStore(t);return e?r[e]:r||{}},e.prototype.setLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;this.cache.setStore(t,e),this.setUserInfo()},e.prototype.getLocalUserInfoAsync=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(t)];case 1:return[2,r.sent()[e]]}})})},e.prototype.setUserInfo=function(){var e=this,t=this.cache.keys.userInfoKey,r=this.cache.getStore(t);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username","created_at"].forEach(function(t){e[t]=r[t]})},$f([cf({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"update",null),$f([cf({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[String,String]),Zf("design:returntype",void 0)],e.prototype,"updatePassword",null),$f([cf({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[String]),Zf("design:returntype",void 0)],e.prototype,"updateUsername",null),$f([cf({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"refresh",null),e}(),ip=function(){function e(e){var t=e.envId,r=e.cache,n=e.oauthInstance;t||Ld(Ed,"envId is not defined"),this.cache=r,this.oauthInstance=n,this.user=new op({cache:this.cache,oauthInstance:n})}return e.prototype.checkLocalState=function(){var e;this.oauthLoginState=null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},e.prototype.checkLocalStateAsync=function(){var e;return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.getLoginState()];case 1:return t.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return t.sent(),[2]}})})},e}(),sp=function(){function e(e){this.listeners=new Map,this.hasListenerSetUp=!1,this.config=e,this.oauthInstance=e.oauthInstance,this.cache=e.cache,this.init(),this.setAccessKey()}return e.prototype.bindPhoneNumber=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.editContact(e)]})})},e.prototype.unbindProvider=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]})})},e.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},e.prototype.verify=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.verify(e)]})})},e.prototype.getVerification=function(e,t){return Xf(this,void 0,void 0,function(){return ep(this,function(r){return[2,this.oauthInstance.authApi.getVerification(e,t)]})})},Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var e=this.hasLoginState();return e&&e.user||null}qd(Od,"current platform's storage is asynchronous, please use getCurrentUser instead")},enumerable:!1,configurable:!0}),e.prototype.getCurrentUser=function(){return Xf(this,void 0,void 0,function(){var e,t;return ep(this,function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return(e=r.sent())?(t=e.user.getLocalUserInfo(),[4,e.user.checkLocalInfoAsync()]):[3,3];case 2:return r.sent(),[2,Jf(Jf({},e.user),t)];case 3:return[2,null]}})})},e.prototype.signInAnonymouslyInWx=function(e){var t=(void 0===e?{}:e).useWxCloud;return Xf(this,void 0,void 0,function(){var e,r,n=this;return ep(this,function(o){switch(o.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,r=function(r){return Xf(n,void 0,void 0,function(){var n,o;return ep(this,function(i){switch(i.label){case 0:n=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:r,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}},t)];case 2:if((null==(n=i.sent())?void 0:n.error_code)||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.signInAnonymously({provider_token:n.provider_token},t)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[2]}})})},[4,new Promise(function(e,t){wx.login({success:function(o){return Xf(n,void 0,void 0,function(){var n;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r(o.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return n=i.sent(),t(n),[3,3];case 3:return[2]}})})},fail:function(e){var r=new Error(null==e?void 0:e.errMsg);r.code=null==e?void 0:e.errno,t(r)}})})];case 1:return o.sent(),[2,this.createLoginState(void 0,{asyncRefreshUser:!0})]}})})},e.prototype.bindOpenId=function(){return Xf(this,void 0,void 0,function(){var e,t,r=this;return ep(this,function(n){switch(n.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t=function(t){return Xf(r,void 0,void 0,function(){var r;return ep(this,function(n){switch(n.label){case 0:r=void 0,n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:t,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}})];case 2:if((null==(r=n.sent())?void 0:r.error_code)||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.bindWithProvider({provider_token:r.provider_token})];case 3:return n.sent(),[3,5];case 4:throw n.sent();case 5:return[2]}})})},[4,new Promise(function(e,n){wx.login({success:function(o){return Xf(r,void 0,void 0,function(){var r;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t(o.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return r=i.sent(),n(r),[3,3];case 3:return[2]}})})},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,n(t)}})})];case 1:return n.sent(),[2]}})})},e.prototype.signInWithUnionId=function(){return Xf(this,void 0,void 0,function(){var e=this;return ep(this,function(t){switch(t.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise(function(t,r){var n=wx.getAccountInfoSync().miniProgram;wx.login({success:function(o){return Xf(e,void 0,void 0,function(){var e,i,s,a,c;return ep(this,function(u){switch(u.label){case 0:e=null==n?void 0:n.appId,u.label=1;case 1:return u.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:o.code,provider_id:e,provider_params:{provider_code_type:"union_id",appid:null==n?void 0:n.appId}})];case 2:return i=u.sent(),(s=i.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:s})]:(r(i),[2]);case 3:return(null==(a=u.sent())?void 0:a.error_code)?(r(a),[2]):(t(!0),[3,5]);case 4:return c=u.sent(),r(c),[3,5];case 5:return[2]}})})},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})})];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}})})},e.prototype.signInWithSms=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.phoneNum,s=void 0===i?"":i,a=e.bindInfo,c=void 0===a?void 0:a;return Xf(this,void 0,void 0,function(){return ep(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:r,verificationCode:o,bindInfo:c,username:s,loginType:"sms"})]}catch(e){throw e}return[2]})})},e.prototype.signInWithEmail=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.bindInfo,s=void 0===i?void 0:i,a=e.email,c=void 0===a?"":a;return Xf(this,void 0,void 0,function(){return ep(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:r,verificationCode:o,bindInfo:s,username:c,loginType:"email"})]}catch(e){throw e}return[2]})})},e.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},e.prototype.signIn=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},e.prototype.setPassword=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.setPassword(e)]})})},e.prototype.isUsernameRegistered=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return"string"!=typeof e&&Ld(Ed,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}})})},e.prototype.hasLoginState=function(){var e;if("async"!==this.cache.mode)return(null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync())?new ip({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;qd(Od,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return Xf(this,void 0,void 0,function(){var e;return ep(this,function(t){switch(t.label){case 0:e=null,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.oauthInstance.authApi.getLoginState()];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,null];case 4:return e?[2,new ip({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}})})},e.prototype.getUserInfo=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.getCurrentUser()]})})},e.prototype.getWedaUserInfo=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]})})},e.prototype.updateUserBasicInfo=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return(t=r.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},e.prototype.bindWithProvider=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]})})},e.prototype.queryUser=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]})})},e.prototype.getAccessToken=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}})})},e.prototype.grantProviderToken=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]})})},e.prototype.patchProviderToken=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]})})},e.prototype.signInWithProvider=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},e.prototype.signInWithWechat=function(e){return void 0===e&&(e={}),Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},e.prototype.grantToken=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}})})},e.prototype.genProviderRedirectUri=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]})})},e.prototype.resetPassword=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]})})},e.prototype.deviceAuthorize=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]})})},e.prototype.sudo=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.sudo(e)]})})},e.prototype.deleteMe=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]})})},e.prototype.getProviders=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getProviders()]})})},e.prototype.loginScope=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.loginScope()]})})},e.prototype.loginGroups=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.loginGroups()]})})},e.prototype.onLoginStateChanged=function(e){var t;return Xf(this,void 0,void 0,function(){var r,n=this;return ep(this,function(o){switch(o.label){case 0:return null===(t=this.config.eventBus)||void 0===t||t.on(sd,function(t){return Xf(n,void 0,void 0,function(){var r,n,o;return ep(this,function(i){switch(i.label){case 0:return(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.eventType)===Zh?[3,2]:[4,this.getLoginState()];case 1:return n=i.sent(),[3,3];case 2:n={},i.label=3;case 3:return r=n,e.call(this,Jf(Jf({},t),r)),[2]}})})}),[4,this.getLoginState()];case 1:return r=o.sent(),e.call(this,r),[2]}})})},e.prototype.refreshTokenForce=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]})})},e.prototype.getCredentials=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getCredentials()]})})},e.prototype.setCredentials=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}})})},e.prototype.getProviderSubType=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]})})},e.prototype.createCaptchaData=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]})})},e.prototype.verifyCaptchaData=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]})})},e.prototype.getMiniProgramQrCode=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]})})},e.prototype.getMiniProgramQrCodeStatus=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]})})},e.prototype.modifyPassword=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]})})},e.prototype.modifyPasswordWithoutLogin=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.modifyPasswordWithoutLogin(e)]})})},e.prototype.getUserBehaviorLog=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]})})},e.prototype.signInWithUsername=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.username,s=void 0===i?"":i,a=e.bindInfo,c=void 0===a?void 0:a,u=e.loginType,l=void 0===u?"":u;return Xf(this,void 0,void 0,function(){var e,t,n,i,a,u,h;return ep(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:r.verification_id,verification_code:o})];case 1:if(null==(e=d.sent())?void 0:e.error_code)throw e;return t=e.verification_token,n=/^\+\d{1,3}\s+/.test(s)?s:"+86 ".concat(s),i={phone_number:n},"email"===l&&(i={email:n=s}),r.is_user?[4,this.oauthInstance.authApi.signIn({username:n,verification_token:t})]:[3,5];case 2:if(null==(a=d.sent())?void 0:a.error_code)throw a;return c?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:null==c?void 0:c.providerToken})]:[3,4];case 3:if(null==(u=d.sent())?void 0:u.error_code)throw u;d.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp(Jf(Jf({},i),{verification_token:t,provider_token:null==c?void 0:c.providerId}))];case 6:if(null==(h=d.sent())?void 0:h.error_code)throw h;d.label=7;case 7:return[2,this.createLoginState()];case 8:throw d.sent();case 9:return[2]}})})},e.prototype.createLoginState=function(e,t){var r,n;return Xf(this,void 0,void 0,function(){var o;return ep(this,function(i){switch(i.label){case 0:return[4,(o=new ip({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return i.sent(),(null==t?void 0:t.userInfo)?(o.user.setLocalUserInfo(t.userInfo),[3,5]):[3,2];case 2:return(null==t?void 0:t.asyncRefreshUser)?(o.user.refresh(e),[3,5]):[3,3];case 3:return[4,o.user.refresh(e)];case 4:i.sent(),i.label=5;case 5:return null===(r=this.config.eventBus)||void 0===r||r.fire(sd,{eventType:$h}),null===(n=this.config.eventBus)||void 0===n||n.fire(ad,{event:ed}),[2,o]}})})},e.prototype.setAccessKey=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){if(this.config.accessKey)try{this.oauthInstance.oauth2client.setAccessKeyCredentials({access_token:this.config.accessKey,token_type:"Bearer",scope:"accessKey",expires_at:new Date(+new Date+ +new Date),expires_in:+new Date+ +new Date})}catch(e){console.warn("accessKey error: ",e)}return[2]})})},e.prototype.signInAnonymously=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.oauthInstance.authApi.signInAnonymously(e)];case 1:return i.sent(),[4,this.createLoginState()];case 2:return t=i.sent(),[4,this.getSession()];case 3:return r=i.sent().data,n=(void 0===r?{}:r).session,[2,Jf(Jf({},t),{data:{user:n.user,session:n},error:null})];case 4:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 5:return[2]}})})},e.prototype.signUp=function(e){return Xf(this,void 0,void 0,function(){var t,r,n=this;return ep(this,function(o){switch(o.label){case 0:return e.phone_number||e.verification_code||e.verification_token||e.provider_token?[4,this.oauthInstance.authApi.signUp(e)]:[3,2];case 1:return o.sent(),[2,this.createLoginState()];case 2:return o.trys.push([2,4,,5]),this.validateAtLeastOne(e,[["email"],["phone"]],"You must provide either an email or phone number"),[4,this.getVerification(e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)})];case 3:return t=o.sent(),[2,{data:{verifyOtp:function(r){var o=r.token,i=r.messageId,s=void 0===i?t.verification_id:i;return Xf(n,void 0,void 0,function(){var r,n,i,a,c;return ep(this,function(u){switch(u.label){case 0:return u.trys.push([0,8,,9]),[4,this.verify({verification_id:s||t.verification_id,verification_code:o})];case 1:return r=u.sent(),t.is_user?[4,this.signIn({username:e.email||this.formatPhone(e.phone),verification_token:r.verification_token})]:[3,3];case 2:return u.sent(),[3,6];case 3:return delete(n=JSON.parse(JSON.stringify(e))).email,delete n.phone,[4,this.oauthInstance.authApi.signUp(Jf(Jf(Jf({},n),e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)}),{verification_token:r.verification_token,verification_code:o}))];case 4:return u.sent(),[4,this.createLoginState()];case 5:u.sent(),u.label=6;case 6:return[4,this.getSession()];case 7:return i=u.sent().data,[2,{data:{user:(a=(void 0===i?{}:i).session).user,session:a},error:null}];case 8:return c=u.sent(),[2,{data:{},error:new xf(c)}];case 9:return[2]}})})}},error:null}];case 4:return r=o.sent(),[2,{data:{},error:new xf(r)}];case 5:return[2]}})})},e.prototype.signOut=function(e){var t,r;return Xf(this,void 0,void 0,function(){var n,o,i;return ep(this,function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),n=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return o=s.sent(),[4,this.cache.removeStoreAsync(n)];case 2:return s.sent(),this.setAccessKey(),null===(t=this.config.eventBus)||void 0===t||t.fire(sd,{eventType:Jh}),null===(r=this.config.eventBus)||void 0===r||r.fire(ad,{event:Xh}),[2,Jf(Jf({},o),{data:{},error:null})];case 3:return i=s.sent(),[2,{data:{},error:new xf(i)}];case 4:return[2]}})})},e.prototype.onAuthStateChange=function(e){var t=this;this.hasListenerSetUp||(this.setupListeners(),this.hasListenerSetUp=!0);var r=Math.random().toString(36);return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(e),{data:{subscription:{id:r,callback:e,unsubscribe:function(){var n=t.listeners.get(r);n&&(n.delete(e),0===n.size&&t.listeners.delete(r))}}}}},e.prototype.signInWithPassword=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.validateAtLeastOne(e,[["username"],["email"],["phone"]],"You must provide either username, email, or phone"),this.validateParams(e,{password:{required:!0,message:"Password is required"}}),[4,this.signIn(Jf({username:e.username||e.email||this.formatPhone(e.phone),password:e.password},e.is_encrypt?{isEncrypt:!0,version:"v2"}:{}))];case 1:return o.sent(),[4,this.getSession()];case 2:return t=o.sent().data,[2,{data:{user:(r=(void 0===t?{}:t).session).user,session:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.signInWithIdToken=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.validateParams(e,{token:{required:!0,message:"Token is required"}}),[4,this.signInWithProvider({provider_token:e.token})];case 1:return o.sent(),[4,this.getSession()];case 2:return t=o.sent().data,[2,{data:{user:(r=(void 0===t?{}:t).session).user,session:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.signInWithOtp=function(e){return Xf(this,void 0,void 0,function(){var t,r,n=this;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.validateAtLeastOne(e,[["email"],["phone"]],"You must provide either an email or phone number"),[4,this.getVerification(e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)})];case 1:return t=o.sent(),[2,{data:{user:null,session:null,verifyOtp:function(r){var o=r.token,i=r.messageId,s=void 0===i?t.verification_id:i;return Xf(n,void 0,void 0,function(){return ep(this,function(t){return[2,this.verifyOtp({email:e.email,phone:e.phone,token:o,messageId:s})]})})}},error:null}];case 2:return r=o.sent(),[2,{data:{},error:new xf(r)}];case 3:return[2]}})})},e.prototype.verifyOAuth=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o,i,s,a,c,u;return ep(this,function(l){switch(l.label){case 0:t={},l.label=1;case 1:return l.trys.push([1,7,,8]),r=(null==e?void 0:e.code)||Ud("code"),n=(null==e?void 0:e.state)||Ud("state"),r?n?(o=function(e){try{return JSON.parse(sessionStorage.getItem(e))}catch(e){return console.error("Failed to get browser session:",e),null}}(n),t.type=null==o?void 0:o.type,(i=(null==e?void 0:e.provider)||(null==o?void 0:o.provider)||Ud("provider"))?[4,this.grantProviderToken({provider_id:i,provider_redirect_uri:location.origin+location.pathname,provider_code:r})]:[2,{data:t,error:new xf({message:"Provider is required"})}]):[2,{data:{},error:new xf({message:"State is required"})}]:[2,{data:{},error:new xf({message:"Code is required"})}];case 2:return s=l.sent().provider_token,a=void 0,o.type!==ud?[3,4]:[4,this.oauthInstance.authApi.toBindIdentity({provider_token:s,provider:i,fireEvent:!0})];case 3:return a=l.sent(),[3,6];case 4:return[4,this.signInWithIdToken({token:s})];case 5:(a=l.sent()).data=Jf(Jf({},t),a.data),l.label=6;case 6:return(c=new URLSearchParams(null===location||void 0===location?void 0:location.search)).delete("code"),c.delete("state"),function(e,t){if(void 0!==e){var r=new URL(window.location.href);r.search=e,r.hash=t||r.hash,window.history.replaceState({},"",r.href)}}(void 0===(null==o?void 0:o.search)?"?".concat(c.toString()):null==o?void 0:o.search,(null==o?void 0:o.hash)||location.hash),function(e){try{return sessionStorage.removeItem(e),!0}catch(e){return console.error("Failed to remove browser session:",e),null}}(n),[2,a];case 7:return u=l.sent(),[2,{data:t,error:new xf(u)}];case 8:return[2]}})})},e.prototype.signInWithOAuth=function(e){var t,r,n,o,i;return Xf(this,void 0,void 0,function(){var s,a,c,u,l,h,d,f,p;return ep(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:"Provider is required"}}),s=(null===(t=e.options)||void 0===t?void 0:t.redirectTo)||location.href,a=new URL(s),c=a.origin+a.pathname,u=(null===(r=e.options)||void 0===r?void 0:r.state)||"prd-".concat(e.provider,"-").concat(Math.random().toString(36).slice(2)),[4,this.genProviderRedirectUri({provider_id:e.provider,provider_redirect_uri:c,state:u})];case 1:return l=v.sent().uri,h=decodeURIComponent(l),d=h,(null===(n=e.options)||void 0===n?void 0:n.queryParams)&&(f=new URL(h),Object.entries(e.options.queryParams).forEach(function(e){var t=e[0],r=e[1];f.searchParams.set(t,r)}),d=f.toString()),function(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){console.error("Failed to save to browser session:",e)}}(u,{provider:e.provider,search:a.search,hash:a.hash,type:(null===(o=e.options)||void 0===o?void 0:o.type)||cd}),rp()&&!(null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect)&&window.location.assign(d),[2,{data:{url:d,provider:e.provider},error:null}];case 2:return p=v.sent(),[2,{data:{},error:new xf(p)}];case 3:return[2]}})})},e.prototype.signInWithSSO=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2]})})},e.prototype.signInWithWeb3=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2]})})},e.prototype.getClaims=function(){return Xf(this,void 0,void 0,function(){var e,t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getAccessToken()];case 1:return e=n.sent().accessToken,t=function(e){if("string"!=typeof e)throw new Error("Invalid token specified");try{const t=e.split(".").map((e,t)=>2===t?e:JSON.parse(bd(e)));return{claims:t[1],header:t[0],signature:t[2]}}catch(e){throw new Error("Invalid token specified: ".concat(e)?e.message:"")}}(e),[2,{data:t,error:null}];case 2:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 3:return[2]}})})},e.prototype.resetPasswordForEmail=function(e,t){return Xf(this,void 0,void 0,function(){var r,n,o,i,s,a,c=this;return ep(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),this.validateParams({emailOrPhone:e},{emailOrPhone:{required:!0,message:"Email or phone is required"}}),r=(t||{}).redirectTo,n=e.includes("@"),o=void 0,n?o={email:e}:(i=this.formatPhone(e),o={phone_number:i}),[4,this.getVerification(o)];case 1:return s=u.sent(),[2,{data:{updateUser:function(t){return Xf(c,void 0,void 0,function(){var o,i,a,c;return ep(this,function(u){switch(u.label){case 0:this.validateParams(t,{nonce:{required:!0,message:"Nonce is required"},password:{required:!0,message:"Password is required"}}),u.label=1;case 1:return u.trys.push([1,5,,6]),[4,this.verify({verification_id:s.verification_id,verification_code:t.nonce})];case 2:return o=u.sent(),[4,this.oauthInstance.authApi.resetPassword({email:n?e:void 0,phone:n?void 0:e,new_password:t.password,verification_token:o.verification_token})];case 3:return u.sent(),null===(c=this.config.eventBus)||void 0===c||c.fire(ad,{event:rd}),[4,this.signInWithPassword({email:n?e:void 0,phone:n?void 0:e,password:t.password})];case 4:return i=u.sent(),r&&rp()&&window.location.assign(r),[2,i];case 5:return a=u.sent(),[2,{data:{},error:new xf(a)}];case 6:return[2]}})})}},error:null}];case 2:return a=u.sent(),[2,{data:{},error:new xf(a)}];case 3:return[2]}})})},e.prototype.resetPasswordForOld=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.oauthInstance.authApi.updatePasswordByOld({old_password:e.old_password,new_password:e.new_password})];case 1:return o.sent(),[4,this.getSession()];case 2:return t=o.sent().data,[2,{data:{user:(r=(void 0===t?{}:t).session).user,session:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.verifyOtp=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,6,,7]),t=e.type,this.validateParams(e,{token:{required:!0,message:"Token is required"},messageId:{required:!0,message:"messageId is required"}}),["phone_change","email_change"].includes(t)?[4,this.verify({verification_id:e.messageId,verification_code:e.token})]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,this.signInWithUsername({verificationInfo:{verification_id:e.messageId,is_user:!0},verificationCode:e.token,username:e.email||this.formatPhone(e.phone)||"",loginType:e.email?"email":"phone"})];case 3:i.sent(),i.label=4;case 4:return[4,this.getSession()];case 5:return r=i.sent().data,[2,{data:{user:(n=(void 0===r?{}:r).session).user,session:n},error:null}];case 6:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 7:return[2]}})})},e.prototype.getSession=function(){return Xf(this,void 0,void 0,function(){var e,t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(e=o.sent())&&"accessKey"!==e.scope?[4,this.getUser()]:[2,{data:{session:null},error:null}];case 2:return t=o.sent().data,r=(void 0===t?{}:t).user,[2,{data:{session:Jf(Jf({},e),{user:r}),user:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.refreshSession=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o,i;return ep(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,5]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return(t=s.sent()).refresh_token=e||t.refresh_token,[4,this.oauthInstance.oauth2client.refreshToken(t)];case 2:return r=s.sent(),[4,this.getUser()];case 3:return n=s.sent().data,[2,{data:{user:o=(void 0===n?{}:n).user,session:Jf(Jf({},r),{user:o})},error:null}];case 4:return i=s.sent(),[2,{data:{},error:new xf(i)}];case 5:return[2]}})})},e.prototype.getUser=function(){return Xf(this,void 0,void 0,function(){var e,t;return ep(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),e=this.convertToUser,[4,this.getUserInfo()];case 1:return[2,{data:{user:e.apply(this,[r.sent()])},error:null}];case 2:return t=r.sent(),[2,{data:{},error:new xf(t)}];case 3:return[2]}})})},e.prototype.refreshUser=function(){return Xf(this,void 0,void 0,function(){var e,t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.currentUser.refresh()];case 1:return n.sent(),[4,this.getSession()];case 2:return e=n.sent().data,[2,{data:{user:(t=(void 0===e?{}:e).session).user,session:t},error:null}];case 3:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 4:return[2]}})})},e.prototype.updateUser=function(e){var t;return Xf(this,void 0,void 0,function(){var r,n,o,i,s,a,c,u,l,h,d,f,p=this;return ep(this,function(v){switch(v.label){case 0:if(v.trys.push([0,8,,9]),!Object.keys(e).some(function(t){return void 0!==e[t]&&null!==e[t]&&""!==e[t]}))throw new xf({message:"At least one field must be provided for update"});return r=e.email,n=e.phone,o=tp(e,["email","phone"]),s=void 0!==n,a={},(i=void 0!==r)||s?(c=void 0,i?(c={email:e.email},u="email_change"):(l=this.formatPhone(e.phone),c={phone_number:l},u="phone_change"),[4,this.getVerification(c)]):[3,4];case 1:return h=v.sent(),Object.keys(o).length>0?[4,this.updateUserBasicInfo(o)]:[3,3];case 2:v.sent(),v.label=3;case 3:return a={messageId:h.verification_id,verifyOtp:function(t){return Xf(p,void 0,void 0,function(){var r,n,o;return ep(this,function(s){switch(s.label){case 0:return s.trys.push([0,11,,12]),t.email&&e.email===t.email?[4,this.verifyOtp({type:"email_change",email:e.email,token:t.token,messageId:h.verification_id})]:[3,3];case 1:return s.sent(),[4,this.updateUserBasicInfo({email:e.email})];case 2:return s.sent(),[3,9];case 3:return t.phone&&e.phone===t.phone?[4,this.verifyOtp({type:"phone_change",phone:e.phone,token:t.token,messageId:h.verification_id})]:[3,6];case 4:return s.sent(),[4,this.updateUserBasicInfo({phone:this.formatPhone(e.phone)})];case 5:return s.sent(),[3,9];case 6:return[4,this.verifyOtp({type:u,email:i?e.email:void 0,phone:i?void 0:e.phone,token:t.token,messageId:h.verification_id})];case 7:return s.sent(),[4,this.updateUserBasicInfo(e)];case 8:s.sent(),s.label=9;case 9:return[4,this.getUser()];case 10:return r=s.sent().data.user,null===(o=this.config.eventBus)||void 0===o||o.fire(ad,{event:od}),[2,{data:{user:r},error:null}];case 11:return n=s.sent(),[2,{data:{},error:new xf(n)}];case 12:return[2]}})})}},[3,6];case 4:return[4,this.updateUserBasicInfo(e)];case 5:v.sent(),v.label=6;case 6:return[4,this.getUser()];case 7:return d=v.sent().data.user,null===(t=this.config.eventBus)||void 0===t||t.fire(ad,{event:od}),[2,{data:Jf({user:d},a),error:null}];case 8:return f=v.sent(),[2,{data:{},error:new xf(f)}];case 9:return[2]}})})},e.prototype.getUserIdentities=function(){var e;return Xf(this,void 0,void 0,function(){var t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.oauthInstance.authApi.getProviders()];case 1:return t=n.sent(),[2,{data:{identities:null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.filter(function(e){return!!e.bind})},error:null}];case 2:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 3:return[2]}})})},e.prototype.linkIdentity=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:"Provider is required"}}),[4,this.signInWithOAuth({provider:e.provider,options:{type:ud}})];case 1:return r.sent(),[2,{data:{provider:e.provider},error:null}];case 2:return t=r.sent(),[2,{data:{},error:new xf(t)}];case 3:return[2]}})})},e.prototype.unlinkIdentity=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:"Provider is required"}}),[4,this.oauthInstance.authApi.unbindProvider({provider_id:e.provider})];case 1:return r.sent(),[2,{data:{},error:null}];case 2:return t=r.sent(),[2,{data:{},error:new xf(t)}];case 3:return[2]}})})},e.prototype.reauthenticate=function(){return Xf(this,void 0,void 0,function(){var e,t,r,n,o=this;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.getUser()];case 1:return e=i.sent().data.user,this.validateAtLeastOne(e,[["email","phone"]],"You must provide either an email or phone number"),t=e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)},[4,this.getVerification(t)];case 2:return r=i.sent(),[2,{data:{updateUser:function(e){return Xf(o,void 0,void 0,function(){var n,o,i,s,a;return ep(this,function(c){switch(c.label){case 0:this.validateParams(e,{nonce:{required:!0,message:"Nonce is required"}}),c.label=1;case 1:return c.trys.push([1,9,,10]),e.password?[4,this.verify({verification_id:r.verification_id,verification_code:e.nonce})]:[3,5];case 2:return n=c.sent(),[4,this.oauthInstance.authApi.sudo({verification_token:n.verification_token})];case 3:return o=c.sent(),[4,this.oauthInstance.authApi.setPassword({new_password:e.password,sudo_token:o.sudo_token})];case 4:return c.sent(),[3,7];case 5:return[4,this.signInWithUsername(Jf(Jf({verificationInfo:r,verificationCode:e.nonce},t),{loginType:t.email?"email":"phone"}))];case 6:c.sent(),c.label=7;case 7:return[4,this.getSession()];case 8:return i=c.sent().data,[2,{data:{user:(s=(void 0===i?{}:i).session).user,session:s},error:null}];case 9:return a=c.sent(),[2,{data:{},error:new xf(a)}];case 10:return[2]}})})}},error:null}];case 3:return n=i.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.resend=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.validateAtLeastOne(e,[["email"],["phone"]],"You must provide either an email or phone number"),t="signup"===e.type?"ANY":"USER",r={target:t},"email"in e&&(r.email=e.email),"phone"in e&&(r.phone_number=this.formatPhone(e.phone)),[4,this.oauthInstance.authApi.getVerification(r)];case 1:return[2,{data:{messageId:o.sent().verification_id},error:null}];case 2:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 3:return[2]}})})},e.prototype.setSession=function(e){var t;return Xf(this,void 0,void 0,function(){var r,n,o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{access_token:{required:!0,message:"Access token is required"},refresh_token:{required:!0,message:"Refresh token is required"}}),[4,this.oauthInstance.oauth2client.refreshToken(e,{throwOnError:!0})];case 1:return i.sent(),[4,this.getSession()];case 2:return r=i.sent().data,n=(void 0===r?{}:r).session,null===(t=this.config.eventBus)||void 0===t||t.fire(ad,{event:ed}),[2,{data:{user:n.user,session:n},error:null}];case 3:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 4:return[2]}})})},e.prototype.exchangeCodeForSession=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2]})})},e.prototype.deleteUser=function(e){return Xf(this,void 0,void 0,function(){var t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),this.validateParams(e,{password:{required:!0,message:"Password is required"}}),[4,this.oauthInstance.authApi.sudo(e)];case 1:return t=n.sent().sudo_token,[4,this.oauthInstance.authApi.deleteMe({sudo_token:t})];case 2:return n.sent(),[2,{data:{},error:null}];case 3:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 4:return[2]}})})},e.prototype.toDefaultLoginPage=function(e){return void 0===e&&(e={}),Xf(this,void 0,void 0,function(){var t,r,n,o,i;return ep(this,function(s){try{return t=e.config_version||"env",r=Object.keys(e.query||{}).map(function(t){return"".concat(t,"=").concat(e.query[t])}).join("&"),Wf.isMatch()?wx.navigateTo({url:"/packages/$wd_system/pages/login/index".concat(r?"?".concat(r):"")}):(n=e.redirect_uri||window.location.href,o=new URL(n),i="".concat(o.origin,"/__auth/?app_id=").concat(e.app_id||"","&env_id=").concat(this.config.env,"&client_id=").concat(this.config.clientId||this.config.env,"&config_version=").concat(t,"&redirect_uri=").concat(encodeURIComponent(n)).concat(r?"&".concat(r):""),window.location.href=i),[2,{data:{},error:null}]}catch(e){return[2,{data:{},error:new xf(e)}]}return[2]})})},e.prototype.signInWithCustomTicket=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o;return ep(this,function(i){switch(i.label){case 0:e&&this.setCustomSignFunc(e),i.label=1;case 1:return i.trys.push([1,5,,6]),[4,this.oauthInstance.authApi.signInWithCustomTicket()];case 2:return i.sent(),[4,this.createLoginState()];case 3:return t=i.sent(),[4,this.getSession()];case 4:return r=i.sent().data,n=(void 0===r?{}:r).session,[2,Jf(Jf({},t),{data:{user:n.user,session:n},error:null})];case 5:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 6:return[2]}})})},e.prototype.signInWithOpenId=function(e){var t=(void 0===e?{}:e).useWxCloud,r=void 0===t||t;return Xf(this,void 0,void 0,function(){var e,t,n,o,i,s,a=this;return ep(this,function(c){switch(c.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");e=wx.getAccountInfoSync().miniProgram,t=function(t){return Xf(a,void 0,void 0,function(){var n,o;return ep(this,function(i){switch(i.label){case 0:n=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:t,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}},r)];case 2:if((null==(n=i.sent())?void 0:n.error_code)||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:n.provider_token},r)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(o)];case 6:return i.sent(),[2]}})})},c.label=1;case 1:return c.trys.push([1,5,,6]),[4,new Promise(function(e,r){wx.login({success:function(n){return Xf(a,void 0,void 0,function(){var o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t(n.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return o=i.sent(),r(o),[3,3];case 3:return[2]}})})},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})})];case 2:return c.sent(),[4,this.createLoginState()];case 3:return n=c.sent(),[4,this.getSession()];case 4:return o=c.sent().data,i=(void 0===o?{}:o).session,[2,Jf(Jf({},n),{data:{user:i.user,session:i},error:null})];case 5:return s=c.sent(),[2,{data:{},error:new xf(s)}];case 6:return[2]}})})},e.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,r=void 0===t?"":t;return Xf(this,void 0,void 0,function(){var e,t,n,o,i,s,a,c,u;return ep(this,function(l){switch(l.label){case 0:return Wf.isMatch()?(e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:"phone"},provider_id:e.appId},[4,wx.login()]):[2,{data:{},error:new xf({message:"wx api undefined"})}];case 1:n=l.sent().code,t.provider_code=n,l.label=2;case 2:return l.trys.push([2,6,,7]),[4,this.oauthInstance.authApi.grantProviderToken(t)];case 3:if((o=l.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.patchProviderToken({provider_token:o.provider_token,provider_id:e.appId,provider_params:{code:r,provider_code_type:"phone"}})];case 4:if((o=l.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:o.provider_token})];case 5:if(null==(i=l.sent())?void 0:i.error_code)throw i;return[3,7];case 6:return s=l.sent(),[2,{data:{},error:new xf(s)}];case 7:return[4,this.createLoginState()];case 8:return a=l.sent(),[4,this.getSession()];case 9:return c=l.sent().data,u=(void 0===c?{}:c).session,[2,Jf(Jf({},a),{data:{user:u.user,session:u},error:null})]}})})},e.prototype.formatPhone=function(e){return!/\s+/.test(e)&&/^\+\d{1,3}\d+/.test(e)?e.replace(/^(\+\d{1,2})(\d+)$/,"$1 $2"):/^\+\d{1,3}\s+/.test(e)?e:"+86 ".concat(e)},e.prototype.notifyListeners=function(e,t,r){this.listeners.forEach(function(n){n.forEach(function(n){try{n(e,t,r)}catch(e){console.error("Error in auth state change callback:",e)}})})},e.prototype.setupListeners=function(){var e,t=this;null===(e=this.config.eventBus)||void 0===e||e.on(ad,function(e){return Xf(t,void 0,void 0,function(){var t,r,n,o,i;return ep(this,function(s){switch(s.label){case 0:return t=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.event,r=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.info,[4,this.getSession()];case 1:return n=s.sent().data.session,this.notifyListeners(t,n,r),[2]}})})})},e.prototype.convertToUser=function(e){var t,r,n;if(!e)return null;var o=(null==e?void 0:e.email)||"",i=(null==e?void 0:e.phone_number)||"",s=(null==e?void 0:e.sub)||(null==e?void 0:e.uid)||"";return{id:s,aud:"authenticated",role:e.groups,email:o||"",email_confirmed_at:(null==e||e.email_verified,e.created_at),phone:i,phone_confirmed_at:i?e.created_at:void 0,confirmed_at:e.created_at,last_sign_in_at:e.last_sign_in_at,app_metadata:{provider:(null===(t=e.loginType)||void 0===t?void 0:t.toLowerCase())||"cloudbase",providers:[(null===(r=e.loginType)||void 0===r?void 0:r.toLowerCase())||"cloudbase"]},user_metadata:{name:null==e?void 0:e.name,picture:null==e?void 0:e.picture,username:null==e?void 0:e.username,gender:null==e?void 0:e.gender,locale:null==e?void 0:e.locale,uid:e.uid,nickName:e.nickName,avatarUrl:e.avatarUrl||e.picture,location:e.location,hasPassword:e.hasPassword},identities:(null===(n=null==e?void 0:e.providers)||void 0===n?void 0:n.map(function(t){return{id:t.id||"",identity_id:t.id||"",user_id:s,identity_data:{provider_id:t.id,provider_user_id:t.provider_user_id,name:t.name},provider:t.id||"cloudbase",created_at:e.created_at,updated_at:e.updated_at,last_sign_in_at:e.last_sign_in_at}}))||[],created_at:e.created_at,updated_at:e.updated_at,is_anonymous:"anonymous"===e.name}},e.prototype.validateParams=function(e,t){for(var r=0,n=Object.entries(t);r<n.length;r++){var o=n[r],i=o[0],s=o[1];if(s.required&&(void 0===(null==e?void 0:e[i])||null===(null==e?void 0:e[i])||""===(null==e?void 0:e[i])))throw new xf({message:s.message})}},e.prototype.validateAtLeastOne=function(e,t,r){if(!t.some(function(t){return t.some(function(t){return void 0!==(null==e?void 0:e[t])&&null!==(null==e?void 0:e[t])&&""!==(null==e?void 0:e[t])})}))throw new xf({message:r})},e.prototype.init=function(){var e;return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return t.sent()&&(null===(e=this.config.eventBus)||void 0===e||e.fire(ad,{event:td})),[3,3];case 2:return t.sent(),[3,3];case 3:return[2,{error:null}]}})})},$f([cf({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"bindPhoneNumber",null),$f([cf({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"unbindProvider",null),$f([cf({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",void 0)],e.prototype,"bindEmail",null),$f([cf({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"verify",null),$f([cf({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object,Object]),Zf("design:returntype",Promise)],e.prototype,"getVerification",null),$f([cf({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getCurrentUser",null),$f([cf({title:"小程序匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymouslyInWx() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"signInAnonymouslyInWx",null),$f([cf({title:"小程序绑定OpenID失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序openId静默登录"," 2 - 调用 auth().bindOpenId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"bindOpenId",null),$f([cf({title:"小程序unionId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序unionId静默登录"," 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"signInWithUnionId",null),$f([cf({title:"短信验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序短信验证码登陆"," 2 - 调用 auth().signInWithSms() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"signInWithSms",null),$f([cf({title:"邮箱验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了邮箱登陆"," 2 - 调用 auth().signInWithEmail() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"signInWithEmail",null),$f([cf({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[String]),Zf("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),$f([cf({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getLoginState",null),$f([cf({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getUserInfo",null),$f([cf({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getWedaUserInfo",null),$f([cf({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"bindWithProvider",null),$f([cf({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getProviderSubType",null),e}();function ap(e,t){var r=this,n=e.region,o=void 0===n?"ap-shanghai":n,i=e.i18n,s=e.accessKey,a=e.useWxCloud,c=(null==t?void 0:t.platform)||zd.bind(t)(),u=c.runtime,l=c.adapter,h=t||{},d=h.env,f=h.clientId,p=h.debug,v=h.cache,g=h.app,m=(t||{}).apiOrigin;m||(m="https://".concat(d,".").concat(o,".tcb-api.tencentcloudapi.com"));var y={env:d,clientId:f,i18n:i,accessKey:s,useWxCloud:a,eventBus:new ef},b=new Bf(Qf(Jf(Jf({},y),{apiOrigin:m,apiPath:(null==e?void 0:e.apiPath)||Vh,storage:null==e?void 0:e.storage,baseRequest:null==e?void 0:e.baseRequest,request:null==e?void 0:e.request,anonymousSignInFunc:null==e?void 0:e.anonymousSignInFunc,captchaOptions:null==e?void 0:e.captchaOptions,wxCloud:null==e?void 0:e.wxCloud,adapter:l,onCredentialsError:np(y.eventBus),headers:Jf({"X-SDK-Version":"@cloudbase/js-sdk/".concat(e.sdkVersion)},e.headers||{}),detectSessionInUrl:e.detectSessionInUrl,debug:p}))),_=new sp(Jf(Jf({},y),{region:o,persistence:e.persistence,debug:p,cache:v||new Qd({persistence:e.persistence,keys:{userInfoKey:"user_info_".concat(d)},platformInfo:c}),runtime:u||"web",_fromApp:g,oauthInstance:b}));return b.initializeSession(function(e,t){return Xf(r,void 0,void 0,function(){return ep(this,function(r){return e?(e.type===cd?t?y.eventBus.fire(ad,{event:ed,info:Jf(Jf({},e),{error:t})}):e.user&&_.createLoginState({},{userInfo:e.user}):e.type===ud&&y.eventBus.fire(ad,{event:id,info:Jf(Jf({},e),{error:t})}),[2]):[2]})})}),{authInstance:_,oauthInstance:b}}var cp="auth",up={name:"auth",namespace:cp,entity:function(e){var t=function(e){var t;if(this.authInstance&&!e)return this.authInstance;e=e||{region:"",persistence:"local",apiPath:Vh};var r=this.platform.adapter,n=e.persistence||r.primaryStorage;n&&n!==this.config.persistence&&this.updateConfig({persistence:n});var o=ap(Jf(Jf({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence,i18n:this.config.i18n,accessKey:this.config.accessKey,useWxCloud:this.config.useWxCloud,sdkVersion:this.version,detectSessionInUrl:null===(t=this.config.auth)||void 0===t?void 0:t.detectSessionInUrl}),{env:this.config.env,clientId:this.config.clientId,apiOrigin:this.request.getBaseEndPoint(this.config.endPointMode||"CLOUD_API"),platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),i=o.authInstance,s=o.oauthInstance;return this.oauthInstance=s,this.authInstance=i,this.authInstance},r=t.call(this,e);return Object.assign(t,r),Object.setPrototypeOf(t,Object.getPrototypeOf(r)),this[cp]=t,t}};try{cloudbase.registerComponent(up)}catch(lf){}var lp=new Map;function hp(e,t){if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var r=e.callFunction.bind(e);return e.auth=function(e,t){if(!(null==t?void 0:t.envId))throw new Error("[Auth Error]: envId is required");var r=lp.get(t.envId);if(r)return r;var n=Wf.genAdapter({}),o=ap({wxCloud:e,useWxCloud:!0},{clientId:null==t?void 0:t.envId,env:null==t?void 0:t.envId,platform:{runtime:"wx-client",adapter:n},apiOrigin:""}).authInstance;return lp.set(t.envId,o),{signInWithOpenId:o.signInWithOpenId.bind(o),updateUser:o.updateUser.bind(o),getUser:o.getUser.bind(o),getSession:o.getSession.bind(o),refreshSession:o.refreshSession.bind(o),signOut:o.signOut.bind(o)}}(e,n(n({},t),{envId:fp(e,null==t?void 0:t.envId)})),e.models=S(r,e),e.mysql=dp(e,{envId:null==t?void 0:t.envId}),e.rdb=dp(e,{envId:null==t?void 0:t.envId}),e}function dp(e,t){var r=null==t?void 0:t.envId,s=(null==t?void 0:t.mysqlBaseUrl)||pp(e,null==t?void 0:t.envId).mysql,a=null==t?void 0:t.fetch;return function(t){var c=this;return new Wh(s,{fetch:a||function(s,a){return o(c,0,void 0,function(){var o,c,l,h;return i(this,function(i){switch(i.label){case 0:return o=(null==t?void 0:t.instance)||"default",c=(null==t?void 0:t.database)||r,l={},(null==a?void 0:a.headers)instanceof Headers?a.headers.forEach(function(e,t){l[t]=e}):l=(null==a?void 0:a.headers)||{},[4,u(e)];case 1:return h=i.sent(),[2,e.callFunction({name:"httpOverCallFunction",data:{url:s.toString(),method:(null==a?void 0:a.method)||"GET",headers:n(n(n({},h?{Authorization:"Bearer ".concat(h)}:{}),l||{}),{"Content-Type":"application/json","X-Db-Instance":o,"Accept-Profile":c,"Content-Profile":c}),body:null==a?void 0:a.body}}).then(function(e){var t=null==e?void 0:e.result;return{ok:(null==t?void 0:t.statusCode)>=200&&(null==t?void 0:t.statusCode)<300,status:(null==t?void 0:t.statusCode)||200,statusText:(null==t?void 0:t.statusMessage)||"OK",json:function(){return Promise.resolve((null==t?void 0:t.body)||{})},text:function(){return Promise.resolve("string"==typeof(null==t?void 0:t.body)?t.body:JSON.stringify((null==t?void 0:t.body)||{}))},headers:new Headers((null==t?void 0:t.headers)||{})}})]}})})}})}}function fp(e,t){var r,n,o,i,s=t||(null===(n=null===(r=null==e?void 0:e.extend)||void 0===r?void 0:r.AI)||void 0===n?void 0:n.env);return"string"==typeof s&&s.trim()||(s=null===(o=null==e?void 0:e.config)||void 0===o?void 0:o.env),"string"==typeof s&&s.trim()||(s=null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.envName),"string"==typeof s&&s.trim()?s.trim():""}function pp(e,t){var r=fp(e,t);if(!r)throw new Error("Generating default gateway base url failed: env not found");return{model:"https://".concat(r,".api.tcloudbasegateway.com/v1/model"),sql:"https://".concat(r,".api.tcloudbasegateway.com/v1/sql"),mysql:"https://".concat(r,".api.tcloudbasegateway.com/v1/rdb/rest")}}var vp={init:hp,generateHTTPClient:y,generateMySQLClient:dp};let gp;if(!globalThis.IS_MP_BUILD){const Jp="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis;function $p(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Zp(e,t){return e&t}function Xp(e,t){return e|t}function ev(e,t){return e^t}function tv(e,t){return e&~t}function rv(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function nv(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var mp,yp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ov(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=yp.charAt(r>>6)+yp.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=yp.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=yp.charAt(r>>2)+yp.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function iv(e){var t,r="",n=0,o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var i=yp.indexOf(e.charAt(t));i<0||(0==n?(r+=$p(i>>2),o=3&i,n=1):1==n?(r+=$p(o<<2|i>>4),o=15&i,n=2):2==n?(r+=$p(o),r+=$p(i>>2),o=3&i,n=3):(r+=$p(o<<2|i>>4),r+=$p(15&i),n=0))}return 1==n&&(r+=$p(o<<2)),r}var bp,_p={decode:function(e){var t;if(void 0===mp){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(mp={},t=0;t<16;++t)mp[r.charAt(t)]=t;for(r=r.toLowerCase(),t=10;t<16;++t)mp[r.charAt(t)]=t;for(t=0;t<8;++t)mp[n.charAt(t)]=-1}var o=[],i=0,s=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=mp[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++s>=2?(o[o.length]=i,i=0,s=0):i<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return o}},wp={decode:function(e){var t;if(void 0===bp){var r="= \f\n\r\t \u2028\u2029";for(bp=Object.create(null),t=0;t<64;++t)bp["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(t=0;t<9;++t)bp[r.charAt(t)]=-1}var n=[],o=0,i=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if("="==s)break;if(-1!=(s=bp[s])){if(void 0===s)throw new Error("Illegal character at offset "+t);o|=s,++i>=4?(n[n.length]=o>>16,n[n.length]=o>>8&255,n[n.length]=255&o,o=0,i=0):o<<=6}}switch(i){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=o>>10;break;case 3:n[n.length]=o>>16,n[n.length]=o>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=wp.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return wp.decode(e)}},Sp=1e13;class sv{constructor(e){this.buf=[+e||0]}mulAdd(e,t){var r,n,o=this.buf,i=o.length;for(r=0;r<i;++r)(n=o[r]*e+t)<Sp?t=0:n-=(t=0|n/Sp)*Sp,o[r]=n;t>0&&(o[r]=t)}sub(e){var t,r,n=this.buf,o=n.length;for(t=0;t<o;++t)(r=n[t]-e)<0?(r+=Sp,e=1):e=0,n[t]=r;for(;0===n[n.length-1];)n.pop()}toString(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,r=t[t.length-1].toString(),n=t.length-2;n>=0;--n)r+=(Sp+t[n]).toString().substring(1);return r}valueOf(){for(var e=this.buf,t=0,r=e.length-1;r>=0;--r)t=t*Sp+e[r];return t}simplify(){var e=this.buf;return 1==e.length?e[0]:this}}var Ip,Tp=/^(\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)?)?$/,Pp=/^(\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 av(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}class cv{constructor(e,t){this.hexDigits="0123456789ABCDEF",e instanceof cv?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=t)}get(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset "+e+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]}hexByte(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)}hexDump(e,t,r){for(var n="",o=e;o<t;++o)if(n+=this.hexByte(this.get(o)),!0!==r)switch(15&o){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n}isASCII(e,t){for(var r=e;r<t;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0}parseStringISO(e,t){for(var r="",n=e;n<t;++n)r+=String.fromCharCode(this.get(n));return r}parseStringUTF(e,t){for(var r="",n=e;n<t;){var o=this.get(n++);r+=o<128?String.fromCharCode(o):o>191&&o<224?String.fromCharCode((31&o)<<6|63&this.get(n++)):String.fromCharCode((15&o)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r}parseStringBMP(e,t){for(var r,n,o="",i=e;i<t;)r=this.get(i++),n=this.get(i++),o+=String.fromCharCode(r<<8|n);return o}parseTime(e,t,r){var n=this.parseStringISO(e,t),o=(r?Tp:Pp).exec(n);return o?(r&&(o[1]=+o[1],o[1]+=+o[1]<70?2e3:1900),n=o[1]+"-"+o[2]+"-"+o[3]+" "+o[4],o[5]&&(n+=":"+o[5],o[6]&&(n+=":"+o[6],o[7]&&(n+="."+o[7]))),o[8]&&(n+=" UTC","Z"!=o[8]&&(n+=o[8],o[9]&&(n+=":"+o[9]))),n):"Unrecognized time: "+n}parseInteger(e,t){for(var r,n=this.get(e),o=n>127,i=o?255:0,s="";n==i&&++e<t;)n=this.get(e);if(0===(r=t-e))return o?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^i));)s=+s<<1,--r;s="("+r+" bit)\n"}o&&(n-=256);for(var a=new sv(n),c=e+1;c<t;++c)a.mulAdd(256,this.get(c));return s+a.toString()}parseBitString(e,t,r){for(var n=this.get(e),o="("+((t-e-1<<3)-n)+" bit)\n",i="",s=e+1;s<t;++s){for(var a=this.get(s),c=s==t-1?n:0,u=7;u>=c;--u)i+=a>>u&1?"1":"0";if(i.length>r)return o+av(i,r)}return o+i}parseOctetString(e,t,r){if(this.isASCII(e,t))return av(this.parseStringISO(e,t),r);var n=t-e,o="("+n+" byte)\n";n>(r/=2)&&(t=e+r);for(var i=e;i<t;++i)o+=this.hexByte(this.get(i));return n>r&&(o+="…"),o}parseOID(e,t,r){for(var n="",o=new sv,i=0,s=e;s<t;++s){var a=this.get(s);if(o.mulAdd(128,127&a),i+=7,!(128&a)){if(""===n)if((o=o.simplify())instanceof sv)o.sub(80),n="2."+o.toString();else{var c=o<80?o<40?0:1:2;n=c+"."+(o-40*c)}else n+="."+o.toString();if(n.length>r)return av(n,r);o=new sv,i=0}}return i>0&&(n+=".incomplete"),n}}class uv{constructor(e,t,r,n,o){if(!(n instanceof lv))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=r,this.tag=n,this.sub=o}typeName(){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()}}content(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+r,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);case 6:return this.stream.parseOID(t,t+r,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return av(this.stream.parseStringUTF(t,t+r),e);case 18:case 19:case 20:case 21:case 22:case 26:return av(this.stream.parseStringISO(t,t+r),e);case 30:return av(this.stream.parseStringBMP(t,t+r),e);case 23:case 24:return this.stream.parseTime(t,t+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var r=0,n=this.sub.length;r<n;++r)t+=this.sub[r].toPrettyString(e)}return t}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(e){var t=e.get(),r=127&t;if(r==t)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===r)return null;t=0;for(var n=0;n<r;++n)t=256*t+e.get();return t}getHexStringValue(){var e=this.toHexString(),t=2*this.header,r=2*this.length;return e.substr(t,r)}static decode(e){var t;t=e instanceof cv?e:new cv(e,0);var r=new cv(t),n=new lv(t),o=uv.decodeLength(t),i=t.pos,s=i-r.pos,a=null,c=function(){var e=[];if(null!==o){for(var r=i+o;t.pos<r;)e[e.length]=uv.decode(t);if(t.pos!=r)throw new Error("Content size is not correct for container starting at offset "+i)}else try{for(;;){var n=uv.decode(t);if(n.tag.isEOC())break;e[e.length]=n}o=i-t.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return e};if(n.tagConstructed)a=c();else if(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=t.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=c();for(var u=0;u<a.length;++u)if(a[u].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){a=null}if(null===a){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+i);t.pos=i+Math.abs(o)}return new uv(r,s,o,n,a)}}class lv{constructor(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var r=new sv;do{t=e.get(),r.mulAdd(128,127&t)}while(128&t);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var Ep=[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],Op=(1<<26)/Ep[Ep.length-1];class hv{constructor(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}toString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,i="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(o=!0,i=$p(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(o=!0),o&&(i+=$p(r));return o?i:"0"}negate(){var e=dv();return hv.ZERO.subTo(this,e),e}abs(){return this.s<0?this.negate():this}compareTo(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+bv(this[this.t-1]^this.s&this.DM)}mod(e){var t=dv();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(hv.ZERO)>0&&e.subTo(t,t),t}modPowInt(e,t){var r;return r=e<256||t.isEven()?new Cp(t):new Ap(t),this.exp(e,r)}clone(){var e=dv();return this.copyTo(e),e}intValue(){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]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var e=this.t,t=[];t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),128&r&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t}equals(e){return 0==this.compareTo(e)}min(e){return this.compareTo(e)<0?this:e}max(e){return this.compareTo(e)>0?this:e}and(e){var t=dv();return this.bitwiseTo(e,Zp,t),t}or(e){var t=dv();return this.bitwiseTo(e,Xp,t),t}xor(e){var t=dv();return this.bitwiseTo(e,ev,t),t}andNot(e){var t=dv();return this.bitwiseTo(e,tv,t),t}not(){for(var e=dv(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}shiftLeft(e){var t=dv();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}shiftRight(e){var t=dv();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}getLowestSetBit(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+rv(this[e]);return this.s<0?this.t*this.DB:-1}bitCount(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=nv(this[r]^t);return e}testBit(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)}setBit(e){return this.changeBit(e,Xp)}clearBit(e){return this.changeBit(e,tv)}flipBit(e){return this.changeBit(e,ev)}add(e){var t=dv();return this.addTo(e,t),t}subtract(e){var t=dv();return this.subTo(e,t),t}multiply(e){var t=dv();return this.multiplyTo(e,t),t}divide(e){var t=dv();return this.divRemTo(e,t,null),t}remainder(e){var t=dv();return this.divRemTo(e,null,t),t}divideAndRemainder(e){var t=dv(),r=dv();return this.divRemTo(e,t,r),[t,r]}modPow(e,t){var r,n,o=e.bitLength(),i=yv(1);if(o<=0)return i;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new Cp(t):t.isEven()?new kp(t):new Ap(t);var s=[],a=3,c=r-1,u=(1<<r)-1;if(s[1]=n.convert(this),r>1){var l=dv();for(n.sqrTo(s[1],l);a<=u;)s[a]=dv(),n.mulTo(l,s[a-2],s[a]),a+=2}var h,d,f=e.t-1,p=!0,v=dv();for(o=bv(e[f])-1;f>=0;){for(o>=c?h=e[f]>>o-c&u:(h=(e[f]&(1<<o+1)-1)<<c-o,f>0&&(h|=e[f-1]>>this.DB+o-c)),a=r;!(1&h);)h>>=1,--a;if((o-=a)<0&&(o+=this.DB,--f),p)s[h].copyTo(i),p=!1;else{for(;a>1;)n.sqrTo(i,v),n.sqrTo(v,i),a-=2;a>0?n.sqrTo(i,v):(d=i,i=v,v=d),n.mulTo(v,s[h],i)}for(;f>=0&&!(e[f]&1<<o);)n.sqrTo(i,v),d=i,i=v,v=d,--o<0&&(o=this.DB-1,--f)}return n.revert(i)}modInverse(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return hv.ZERO;for(var r=e.clone(),n=this.clone(),o=yv(1),i=yv(0),s=yv(0),a=yv(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&i.isEven()||(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(e,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(s,o),i.subTo(a,i)):(n.subTo(r,n),t&&s.subTo(o,s),a.subTo(i,a))}return 0!=n.compareTo(hv.ONE)?hv.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a}pow(e){return this.exp(e,new Rp)}gcd(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}isProbablePrime(e){var t,r=this.abs();if(1==r.t&&r[0]<=Ep[Ep.length-1]){for(t=0;t<Ep.length;++t)if(r[0]==Ep[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Ep.length;){for(var n=Ep[t],o=t+1;o<Ep.length&&n<Op;)n*=Ep[o++];for(n=r.modInt(n);t<o;)if(n%Ep[t++]==0)return!1}return r.millerRabin(e)}copyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}fromInt(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}fromString(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var s=8==r?255&+e[n]:mv(e,n);s<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==i?this[this.t++]=s:i+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this[this.t++]=s>>this.DB-i):this[this.t-1]|=s<<i,(i+=r)>=this.DB&&(i-=this.DB))}8==r&&128&+e[0]&&(this.s=-1,i>0&&(this[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&hv.ZERO.subTo(this,this)}clamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}dlShiftTo(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}drShiftTo(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}lShiftTo(e,t){for(var r=e%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(e/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)t[a+i+1]=this[a]>>n|s,s=(this[a]&o)<<r;for(a=i-1;a>=0;--a)t[a]=0;t[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()}rShiftTo(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&i)<<o,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}}subTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}multiplyTo(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t[o]=0;for(o=0;o<n.t;++o)t[o+r.t]=r.am(0,n[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&hv.ZERO.subTo(t,t)}squareTo(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}divRemTo(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=dv());var i=dv(),s=this.s,a=e.s,c=this.DB-bv(n[n.t-1]);c>0?(n.lShiftTo(c,i),o.lShiftTo(c,r)):(n.copyTo(i),o.copyTo(r));var u=i.t,l=i[u-1];if(0!=l){var h=l*(1<<this.F1)+(u>1?i[u-2]>>this.F2:0),d=this.FV/h,f=(1<<this.F1)/h,p=1<<this.F2,v=r.t,g=v-u,m=null==t?dv():t;for(i.dlShiftTo(g,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),hv.ONE.dlShiftTo(u,m),m.subTo(i,i);i.t<u;)i[i.t++]=0;for(;--g>=0;){var y=r[--v]==l?this.DM:Math.floor(r[v]*d+(r[v-1]+p)*f);if((r[v]+=i.am(0,y,r,g,0,u))<y)for(i.dlShiftTo(g,m),r.subTo(m,r);r[v]<--y;)r.subTo(m,r)}null!=t&&(r.drShiftTo(u,t),s!=a&&hv.ZERO.subTo(t,t)),r.t=u,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&hv.ZERO.subTo(r,r)}}}invDigit(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(e,t){if(e>4294967295||e<1)return hv.ONE;var r=dv(),n=dv(),o=t.convert(this),i=bv(e)-1;for(o.copyTo(r);--i>=0;)if(t.sqrTo(r,n),(e&1<<i)>0)t.mulTo(n,o,r);else{var s=r;r=n,n=s}return t.revert(r)}chunkSize(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}toRadix(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=yv(r),o=dv(),i=dv(),s="";for(this.divRemTo(n,o,i);o.signum()>0;)s=(r+i.intValue()).toString(e).substr(1)+s,o.divRemTo(n,o,i);return i.intValue().toString(e)+s}fromRadix(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,i=0,s=0,a=0;a<e.length;++a){var c=mv(e,a);c<0?"-"==e.charAt(a)&&0==this.signum()&&(o=!0):(s=t*s+c,++i>=r&&(this.dMultiply(n),this.dAddOffset(s,0),i=0,s=0))}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(s,0)),o&&hv.ZERO.subTo(this,this)}fromNumber(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(hv.ONE.shiftLeft(e-1),Xp,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(hv.ONE.shiftLeft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}}bitwiseTo(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r[n]=t(this[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r[n]=t(o,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}changeBit(e,t){var r=hv.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}addTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}dMultiply(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}multiplyLowerTo(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var o=r.t-this.t;n<o;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}multiplyUpperTo(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}modInt(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}millerRabin(e){var t=this.subtract(hv.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);(e=e+1>>1)>Ep.length&&(e=Ep.length);for(var o=dv(),i=0;i<e;++i){o.fromInt(Ep[Math.floor(Math.random()*Ep.length)]);var s=o.modPow(n,this);if(0!=s.compareTo(hv.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(hv.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0}square(){var e=dv();return this.squareTo(e),e}gcda(e,t){var r=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(r.compareTo(n)<0){var o=r;r=n,n=o}var i=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)t(r);else{i<s&&(s=i),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=()=>{(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){t(n)},0))};setTimeout(a,10)}}fromNumberAsync(e,t,r,n){if("number"==typeof t)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(hv.ONE.shiftLeft(e-1),Xp,this),this.isEven()&&this.dAddOffset(1,0);var o=this,i=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(hv.ONE.shiftLeft(e-1),o),o.isProbablePrime(t)?setTimeout(function(){n()},0):setTimeout(i,0)};setTimeout(i,0)}else{var s=[],a=7&e;s.length=1+(e>>3),t.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}}var Rp=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),Cp=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Ap=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=dv();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(hv.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=dv();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),kp=function(){function e(e){this.m=e,this.r2=dv(),this.q3=dv(),hv.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=dv();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function dv(){return new hv(null)}function fv(e,t){return new hv(e,t)}function pv(e,t,r,n,o,i){for(;--i>=0;){var s=t*this[e++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=67108863&s}return o}function vv(e,t,r,n,o,i){for(var s=32767&t,a=t>>15;--i>=0;){var c=32767&this[e],u=this[e++]>>15,l=a*c+u*s;o=((c=s*c+((32767&l)<<15)+r[n]+(1073741823&o))>>>30)+(l>>>15)+a*u+(o>>>30),r[n++]=1073741823&c}return o}function gv(e,t,r,n,o,i){for(var s=16383&t,a=t>>14;--i>=0;){var c=16383&this[e],u=this[e++]>>14,l=a*c+u*s;o=((c=s*c+((16383&l)<<14)+r[n]+o)>>28)+(l>>14)+a*u,r[n++]=268435455&c}return o}void 0!==Jp&&"Microsoft Internet Explorer"==(null==Jp?void 0:Jp.appName)?(hv.prototype.am=vv,Ip=30):"Netscape"!=(null==Jp?void 0:Jp.appName)?(hv.prototype.am=pv,Ip=26):(hv.prototype.am=gv,Ip=28),hv.prototype.DB=Ip,hv.prototype.DM=(1<<Ip)-1,hv.prototype.DV=1<<Ip;hv.prototype.FV=Math.pow(2,52),hv.prototype.F1=52-Ip,hv.prototype.F2=2*Ip-52;var Up,qp,Lp=[];for(Up="0".charCodeAt(0),qp=0;qp<=9;++qp)Lp[Up++]=qp;for(Up="a".charCodeAt(0),qp=10;qp<36;++qp)Lp[Up++]=qp;for(Up="A".charCodeAt(0),qp=10;qp<36;++qp)Lp[Up++]=qp;function mv(e,t){var r=Lp[e.charCodeAt(t)];return null==r?-1:r}function yv(e){var t=dv();return t.fromInt(e),t}function bv(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}hv.ZERO=yv(0),hv.ONE=yv(1);class _v{constructor(){this.i=0,this.j=0,this.S=[]}init(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}next(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}}var xp,Np,jp=null;if(null==jp){var Dp,Bp,Mp,Wp;jp=[],Np=0;var Fp=void 0;if(null!==(Dp=window)&&void 0!==Dp&&Dp.crypto&&null!==(Bp=window)&&void 0!==Bp&&Bp.crypto.getRandomValues){var Hp,zp=new Uint32Array(256);for(null===(Hp=window)||void 0===Hp||Hp.crypto.getRandomValues(zp),Fp=0;Fp<zp.length;++Fp)jp[Np++]=255&zp[Fp]}var Vp,Gp=function(e){var t,r,n;if(this.count=this.count||0,this.count>=256||Np>=256){if(null!==(t=window)&&void 0!==t&&t.removeEventListener)null===(n=window)||void 0===n||n.removeEventListener("mousemove",Gp,!1);else if(null!==(r=window)&&void 0!==r&&r.detachEvent){var o;null===(o=window)||void 0===o||o.detachEvent("onmousemove",Gp)}}else try{var i=e.x+e.y;jp[Np++]=255&i,this.count+=1}catch(e){}};if(null!==(Mp=window)&&void 0!==Mp&&Mp.addEventListener)null===(Vp=window)||void 0===Vp||Vp.addEventListener("mousemove",Gp,!1);else if(null!==(Wp=window)&&void 0!==Wp&&Wp.attachEvent){var Kp;null===(Kp=window)||void 0===Kp||Kp.attachEvent("onmousemove",Gp)}}function wv(){if(null==xp){for(xp=new _v;Np<256;){var e=Math.floor(65536*Math.random());jp[Np++]=255&e}for(xp.init(jp),Np=0;Np<jp.length;++Np)jp[Np]=0;Np=0}return xp.next()}class Sv{constructor(){}nextBytes(e){for(var t=0;t<e.length;++t)e[t]=wv()}}function Iv(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=e.length-1;n>=0&&t>0;){var o=e.charCodeAt(n--);o<128?r[--t]=o:o>127&&o<2048?(r[--t]=63&o|128,r[--t]=o>>6|192):(r[--t]=63&o|128,r[--t]=o>>6&63|128,r[--t]=o>>12|224)}r[--t]=0;for(var i=new Sv,s=[];t>2;){for(s[0]=0;0==s[0];)i.nextBytes(s);r[--t]=s[0]}return r[--t]=2,r[--t]=0,new hv(r)}class Tv{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(e){return e.modPowInt(this.e,this.n)}doPrivate(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}setPublic(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=fv(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")}encrypt(e){var t=Iv(e,this.n.bitLength()+7>>3);if(null==t)return null;var r=this.doPublic(t);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n}encryptLong(e){var t=this,r=(this.n.bitLength()+7>>3)-11;try{var n="";return e.length>r?(e.match(/.{1,117}/g).forEach(function(e){var r=t.encrypt(e);n+=r}),ov(n)):ov(this.encrypt(e))}catch(e){return!1}}decryptLong(e){var t=this,r=this.n.bitLength()+7>>3;e=iv(e);try{if(e.length>r){var n="";return e.match(/.{1,256}/g).forEach(function(e){var r=t.decrypt(e);n+=r}),n}return this.decrypt(e)}catch(e){return!1}}setPrivate(e,t,r){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=fv(e,16),this.e=parseInt(t,16),this.d=fv(r,16)):console.error("Invalid RSA private key")}setPrivateEx(e,t,r,n,o,i,s,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=fv(e,16),this.e=parseInt(t,16),this.d=fv(r,16),this.p=fv(n,16),this.q=fv(o,16),this.dmp1=fv(i,16),this.dmq1=fv(s,16),this.coeff=fv(a,16)):console.error("Invalid RSA private key")}generate(e,t){var r=new Sv,n=e>>1;this.e=parseInt(t,16);for(var o=new hv(t,16);;){for(;this.p=new hv(e-n,1,r),0!=this.p.subtract(hv.ONE).gcd(o).compareTo(hv.ONE)||!this.p.isProbablePrime(10););for(;this.q=new hv(n,1,r),0!=this.q.subtract(hv.ONE).gcd(o).compareTo(hv.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var i=this.p;this.p=this.q,this.q=i}var s=this.p.subtract(hv.ONE),a=this.q.subtract(hv.ONE),c=s.multiply(a);if(0==c.gcd(o).compareTo(hv.ONE)){this.n=this.p.multiply(this.q),this.d=o.modInverse(c),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(e){var t=fv(e,16),r=this.doPrivate(t);return null==r?null:Pv(r,this.n.bitLength()+7>>3)}generateAsync(e,t,r){var n=new Sv,o=e>>1;this.e=parseInt(t,16);var i=new hv(t,16),s=this,a=()=>{var t=()=>{if(s.p.compareTo(s.q)<=0){var e=s.p;s.p=s.q,s.q=e}var t=s.p.subtract(hv.ONE),n=s.q.subtract(hv.ONE),o=t.multiply(n);0==o.gcd(i).compareTo(hv.ONE)?(s.n=s.p.multiply(s.q),s.d=i.modInverse(o),s.dmp1=s.d.mod(t),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout(function(){r()},0)):setTimeout(a,0)},c=()=>{s.q=dv(),s.q.fromNumberAsync(o,1,n,function(){s.q.subtract(hv.ONE).gcda(i,function(e){0==e.compareTo(hv.ONE)&&s.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)})})},u=()=>{s.p=dv(),s.p.fromNumberAsync(e-o,1,n,function(){s.p.subtract(hv.ONE).gcda(i,function(e){0==e.compareTo(hv.ONE)&&s.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(u,0)})})};setTimeout(u,0)};setTimeout(a,0)}}function Pv(e,t){for(var r=e.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=t-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var o="";++n<r.length;){var i=255&r[n];i<128?o+=String.fromCharCode(i):i>191&&i<224?(o+=String.fromCharCode((31&i)<<6|63&r[n+1]),++n):(o+=String.fromCharCode((15&i)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return o}class Ev extends Tv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";super(),e&&("string"==typeof e?this.parseKey(e):(this.hasPrivateKeyProperty(e)||this.hasPublicKeyProperty(e))&&this.parsePropertiesFrom(e))}parseKey(e){try{var t=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?_p.decode(e):wp.unarmor(e),o=uv.decode(n);if(3===o.sub.length&&(o=o.sub[2].sub[0]),9===o.sub.length){t=o.sub[1].getHexStringValue(),this.n=fv(t,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var i=o.sub[3].getHexStringValue();this.d=fv(i,16);var s=o.sub[4].getHexStringValue();this.p=fv(s,16);var a=o.sub[5].getHexStringValue();this.q=fv(a,16);var c=o.sub[6].getHexStringValue();this.dmp1=fv(c,16);var u=o.sub[7].getHexStringValue();this.dmq1=fv(u,16);var l=o.sub[8].getHexStringValue();this.coeff=fv(l,16)}else{if(2!==o.sub.length)return!1;var h=o.sub[1].sub[0];t=h.sub[0].getHexStringValue(),this.n=fv(t,16),r=h.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(e){return!1}}hasPublicKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")}hasPrivateKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")}parsePropertiesFrom(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)}}gp=function(e){e=e||{},this.default_key_size=parseInt(e.default_key_size,10)||1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null},gp.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Ev(e)},gp.prototype.setPrivateKey=function(e){this.setKey(e)},gp.prototype.setPublicKey=function(e){this.setKey(e)},gp.prototype.decrypt=function(e){try{return this.getKey().decrypt(iv(e))}catch(e){return!1}},gp.prototype.encrypt=function(e){try{return ov(this.getKey().encrypt(e))}catch(e){return!1}},gp.prototype.encryptLong=function(e){try{for(var t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",n=0,o=/null$/g;o.test(r)&&(n++,t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",!(n>10)););return t}catch(e){return!1}},gp.prototype.getKey=function(e){if(!this.key){if(this.key=new Ev,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},gp.version="3.1.4"}var Yp=gp;var Qp=Object.freeze({__proto__:null,getEncryptInfo:function(){let{publicKey:e="",payload:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e)return"";try{const r=dd(t),n=new Yp;n.setPublicKey(e);return n.encryptLong("object"==typeof r?JSON.stringify(r):r)}catch(e){console.error("encrypt error:",e)}return""}});e.default=vp,e.generateHTTPClient=y,e.generateMySQLClient=dp,e.getAccessToken=u,e.init=hp,e.initHTTPOverCallFunction=function(e,t){var r=this;if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var s,a=e.callFunction.bind(e);try{var c=(null==t?void 0:t.baseUrl)||pp(e,null==t?void 0:t.envId).model,l=(null==t?void 0:t.sqlBaseUrl)||pp(e,null==t?void 0:t.envId).sql;s=y(a,function(t){var s=t.url,c=t.body,l=t.method,h=t.headers;return o(r,0,void 0,function(){var t,r,o;return i(this,function(i){switch(i.label){case 0:return[4,u(e)];case 1:return t=i.sent(),[4,a({name:"httpOverCallFunction",data:{url:s,method:null==l?void 0:l.toUpperCase(),headers:n(n(n({},t?{Authorization:"Bearer ".concat(t)}:{}),h||{}),{"Content-Type":"application/json"}),body:c}})];case 2:return r=i.sent(),[2,null===(o=null==r?void 0:r.result)||void 0===o?void 0:o.body]}})})},c,{sqlBaseUrl:l,cloud:e})}catch(e){console.error("init http orm client failed, try call function orm",e),s=S(a)}return e.models=s,e.mysql=dp(e,{envId:null==t?void 0:t.envId,mysqlBaseUrl:null==t?void 0:t.mysqlBaseUrl}),e},Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
|
+
function n(){}function o(e){return"object"==typeof e&&null!==e||"function"==typeof e}r.r(t),r.d(t,"ByteLengthQueuingStrategy",function(){return Vr}),r.d(t,"CountQueuingStrategy",function(){return Qr}),r.d(t,"ReadableByteStreamController",function(){return Ce}),r.d(t,"ReadableStream",function(){return qr}),r.d(t,"ReadableStreamBYOBReader",function(){return ct}),r.d(t,"ReadableStreamBYOBRequest",function(){return Re}),r.d(t,"ReadableStreamDefaultController",function(){return vr}),r.d(t,"ReadableStreamDefaultReader",function(){return te}),r.d(t,"TransformStream",function(){return rn}),r.d(t,"TransformStreamDefaultController",function(){return cn}),r.d(t,"WritableStream",function(){return Tt}),r.d(t,"WritableStreamDefaultController",function(){return zt}),r.d(t,"WritableStreamDefaultWriter",function(){return jt});const i=n;function s(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const a=Promise,u=Promise.resolve.bind(a),c=Promise.prototype.then,l=Promise.reject.bind(a),h=u;function d(e){return new a(e)}function f(e){return d(t=>t(e))}function p(e){return l(e)}function v(e,t,r){return c.call(e,t,r)}function g(e,t,r){v(v(e,t,r),void 0,i)}function m(e,t){g(e,t)}function y(e,t){g(e,void 0,t)}function b(e,t,r){return v(e,t,r)}function _(e){v(e,void 0,i)}let w=e=>{if("function"==typeof queueMicrotask)w=queueMicrotask;else{const e=f(void 0);w=t=>v(e,t)}return w(e)};function S(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function I(e,t,r){try{return f(S(e,t,r))}catch(e){return p(e)}}class P{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(e){const t=this._back;let r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size}shift(){const e=this._front;let t=e;const r=this._cursor;let n=r+1;const o=e._elements,i=o[r];return 16384===n&&(t=e._next,n=0),--this._size,this._cursor=n,e!==t&&(this._front=t),o[r]=void 0,i}forEach(e){let t=this._cursor,r=this._front,n=r._elements;for(;!(t===n.length&&void 0===r._next||t===n.length&&(r=r._next,n=r._elements,t=0,0===n.length));)e(n[t]),++t}peek(){const e=this._front,t=this._cursor;return e._elements[t]}}const E=Symbol("[[AbortSteps]]"),O=Symbol("[[ErrorSteps]]"),R=Symbol("[[CancelSteps]]"),C=Symbol("[[PullSteps]]"),A=Symbol("[[ReleaseSteps]]");function k(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?x(e):"closed"===t._state?function(e){x(e),D(e)}(e):N(e,t._storedError)}function U(e,t){return Br(e._ownerReadableStream,t)}function q(e){const t=e._ownerReadableStream;"readable"===t._state?j(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){N(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[A](),t._reader=void 0,e._ownerReadableStream=void 0}function L(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function x(e){e._closedPromise=d((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r})}function N(e,t){x(e),j(e,t)}function j(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function D(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const B=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},M=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function W(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError("".concat(t," is not an object."));var r}function F(e,t){if("function"!=typeof e)throw new TypeError("".concat(t," is not a function."))}function H(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError("".concat(t," is not an object."))}function z(e,t,r){if(void 0===e)throw new TypeError("Parameter ".concat(t," is required in '").concat(r,"'."))}function V(e,t,r){if(void 0===e)throw new TypeError("".concat(t," is required in '").concat(r,"'."))}function G(e){return Number(e)}function K(e){return 0===e?0:e}function Y(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=K(n),!B(n))throw new TypeError("".concat(t," is not a finite number"));if(n=function(e){return K(M(e))}(n),n<0||n>r)throw new TypeError("".concat(t," is outside the accepted range of 0 to ").concat(r,", inclusive"));return B(n)&&0!==n?n:0}function Q(e,t){if(!jr(e))throw new TypeError("".concat(t," is not a ReadableStream."))}function J(e){return new te(e)}function $(e,t){e._reader._readRequests.push(t)}function Z(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function X(e){return e._reader._readRequests.length}function ee(e){const t=e._reader;return void 0!==t&&!!re(t)}class te{constructor(e){if(z(e,1,"ReadableStreamDefaultReader"),Q(e,"First parameter"),Dr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");k(this,e),this._readRequests=new P}get closed(){return re(this)?this._closedPromise:p(ie("closed"))}cancel(e){return re(this)?void 0===this._ownerReadableStream?p(L("cancel")):U(this,e):p(ie("cancel"))}read(){if(!re(this))return p(ie("read"));if(void 0===this._ownerReadableStream)return p(L("read from"));let e,t;const r=d((r,n)=>{e=r,t=n});return ne(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!re(this))throw ie("releaseLock");void 0!==this._ownerReadableStream&&function(e){q(e),oe(e,new TypeError("Reader was released"))}(this)}}function re(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof te}function ne(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[C](t)}function oe(e,t){const r=e._readRequests;e._readRequests=new P,r.forEach(e=>{e._errorSteps(t)})}function ie(e){return new TypeError("ReadableStreamDefaultReader.prototype.".concat(e," can only be used on a ReadableStreamDefaultReader"))}var se,ae,ue;function ce(e){return e.slice()}function le(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(te.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(te.prototype.cancel,"cancel"),s(te.prototype.read,"read"),s(te.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(te.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let he=e=>(he="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,he(e)),de=e=>(de="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,de(e));function fe(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return le(o,0,e,t,n),o}function pe(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError("".concat(String(t)," is not a function"));return r}}function ve(e){try{const t=e.done,r=e.value;return v(h(r),e=>({done:t,value:e}))}catch(e){return p(e)}}const ge=null!==(ue=null!==(se=Symbol.asyncIterator)&&void 0!==se?se:null===(ae=Symbol.for)||void 0===ae?void 0:ae.call(Symbol,"Symbol.asyncIterator"))&&void 0!==ue?ue:"@@asyncIterator";function me(e){const t=S(e.nextMethod,e.iterator,[]);if(!o(t))throw new TypeError("The iterator.next() method must return an object");return t}class ye{constructor(e,t){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=e,this._preventCancel=t}next(){const e=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?b(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?b(this._ongoingPromise,t,t):t()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const e=this._reader;let t,r;const n=d((e,n)=>{t=e,r=n});return ne(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,w(()=>t({value:e,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,q(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,q(e),r(t)}}),n}_returnSteps(e){if(this._isFinished)return Promise.resolve({value:e,done:!0});this._isFinished=!0;const t=this._reader;if(!this._preventCancel){const r=U(t,e);return q(t),b(r,()=>({value:e,done:!0}))}return q(t),f({value:e,done:!0})}}const be={next(){return _e(this)?this._asyncIteratorImpl.next():p(we("next"))},return(e){return _e(this)?this._asyncIteratorImpl.return(e):p(we("return"))},[ge](){return this}};function _e(e){if(!o(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof ye}catch(e){return!1}}function we(e){return new TypeError("ReadableStreamAsyncIterator.".concat(e," can only be used on a ReadableSteamAsyncIterator"))}Object.defineProperty(be,ge,{enumerable:!1});const Se=Number.isNaN||function(e){return e!=e};function Ie(e){const t=fe(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Te(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Pe(e,t,r){if("number"!=typeof(n=r)||Se(n)||n<0||r===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");var n;e._queue.push({value:t,size:r}),e._queueTotalSize+=r}function Ee(e){e._queue=new P,e._queueTotalSize=0}function Oe(e){return e===DataView}class Re{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!ke(this))throw rt("view");return this._view}respond(e){if(!ke(this))throw rt("respond");if(z(e,1,"respond"),e=Y(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(de(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Xe(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!ke(this))throw rt("respondWithNewView");if(z(e,1,"respondWithNewView"),!ArrayBuffer.isView(e))throw new TypeError("You can only respond with array buffer views");if(void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(de(e.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");et(this._associatedReadableByteStreamController,e)}}Object.defineProperties(Re.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),s(Re.prototype.respond,"respond"),s(Re.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Re.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class Ce{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Ae(this))throw nt("byobRequest");return $e(this)}get desiredSize(){if(!Ae(this))throw nt("desiredSize");return Ze(this)}close(){if(!Ae(this))throw nt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const e=this._controlledReadableByteStream._state;if("readable"!==e)throw new TypeError("The stream (in ".concat(e," state) is not in the readable state and cannot be closed"));Ke(this)}enqueue(e){if(!Ae(this))throw nt("enqueue");if(z(e,1,"enqueue"),!ArrayBuffer.isView(e))throw new TypeError("chunk must be an array buffer view");if(0===e.byteLength)throw new TypeError("chunk must have non-zero byteLength");if(0===e.buffer.byteLength)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const t=this._controlledReadableByteStream._state;if("readable"!==t)throw new TypeError("The stream (in ".concat(t," state) is not in the readable state and cannot be enqueued to"));Ye(this,e)}error(e){if(!Ae(this))throw nt("error");Qe(this,e)}[R](e){qe(this),Ee(this);const t=this._cancelAlgorithm(e);return Ge(this),t}[C](e){const t=this._controlledReadableByteStream;if(this._queueTotalSize>0)return void Je(this,e);const r=this._autoAllocateChunkSize;if(void 0!==r){let n;try{n=new ArrayBuffer(r)}catch(t){return void e._errorSteps(t)}const o={buffer:n,bufferByteLength:r,byteOffset:0,byteLength:r,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(o)}$(t,e),Ue(this)}[A](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new P,this._pendingPullIntos.push(e)}}}function Ae(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof Ce}function ke(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof Re}function Ue(e){(function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&!e._closeRequested&&!!e._started&&(!!(ee(t)&&X(t)>0)||!!(ut(t)&&at(t)>0)||Ze(e)>0)})(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,g(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Ue(e)),null),t=>(Qe(e,t),null))))}function qe(e){Fe(e),e._pendingPullIntos=new P}function Le(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=xe(t);"default"===t.readerType?Z(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function xe(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Ne(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function je(e,t,r,n){let o;try{o=fe(t,r,r+n)}catch(t){throw Qe(e,t),t}Ne(e,o,0,n)}function De(e,t){t.bytesFilled>0&&je(e,t.buffer,t.byteOffset,t.bytesFilled),Ve(e)}function Be(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r;let o=r,i=!1;const s=n-n%t.elementSize;s>=t.minimumFill&&(o=s-t.bytesFilled,i=!0);const a=e._queue;for(;o>0;){const r=a.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;le(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?a.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,Me(e,n,t),o-=n}return i}function Me(e,t,r){r.bytesFilled+=t}function We(e){0===e._queueTotalSize&&e._closeRequested?(Ge(e),Mr(e._controlledReadableByteStream)):Ue(e)}function Fe(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function He(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();Be(e,t)&&(Ve(e),Le(e._controlledReadableByteStream,t))}}function ze(e,t){const r=e._pendingPullIntos.peek();Fe(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Ve(e);const r=e._controlledReadableByteStream;if(ut(r))for(;at(r)>0;)Le(r,Ve(e))}(e,r):function(e,t,r){if(Me(0,t,r),"none"===r.readerType)return De(e,r),void He(e);if(r.bytesFilled<r.minimumFill)return;Ve(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;je(e,r.buffer,t-n,n)}r.bytesFilled-=n,Le(e._controlledReadableByteStream,r),He(e)}(e,t,r),Ue(e)}function Ve(e){return e._pendingPullIntos.shift()}function Ge(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function Ke(e){const t=e._controlledReadableByteStream;if(!e._closeRequested&&"readable"===t._state)if(e._queueTotalSize>0)e._closeRequested=!0;else{if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(t.bytesFilled%t.elementSize!=0){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");throw Qe(e,t),t}}Ge(e),Mr(t)}}function Ye(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(de(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const s=he(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(de(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");Fe(e),t.buffer=he(t.buffer),"none"===t.readerType&&De(e,t)}ee(r)?(function(e){const t=e._controlledReadableByteStream._reader;for(;t._readRequests.length>0;){if(0===e._queueTotalSize)return;Je(e,t._readRequests.shift())}}(e),0===X(r)?Ne(e,s,o,i):(e._pendingPullIntos.length>0&&Ve(e),Z(r,new Uint8Array(s,o,i),!1))):ut(r)?(Ne(e,s,o,i),He(e)):Ne(e,s,o,i),Ue(e)}function Qe(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(qe(e),Ee(e),Ge(e),Wr(r,t))}function Je(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,We(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function $e(e){if(null===e._byobRequest&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),r=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),n=Object.create(Re.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function Ze(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Xe(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(0===t)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(r.bytesFilled+t>r.byteLength)throw new RangeError("bytesWritten out of range")}r.buffer=he(r.buffer),ze(e,t)}function et(e,t){const r=e._pendingPullIntos.peek();if("closed"===e._controlledReadableByteStream._state){if(0!==t.byteLength)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(0===t.byteLength)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(r.byteOffset+r.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(r.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(r.bytesFilled+t.byteLength>r.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const n=t.byteLength;r.buffer=he(t.buffer),ze(e,n)}function tt(e,t,r,n,o,i,s){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Ee(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=s,t._pendingPullIntos=new P,e._readableStreamController=t,g(f(r()),()=>(t._started=!0,Ue(t),null),e=>(Qe(t,e),null))}function rt(e){return new TypeError("ReadableStreamBYOBRequest.prototype.".concat(e," can only be used on a ReadableStreamBYOBRequest"))}function nt(e){return new TypeError("ReadableByteStreamController.prototype.".concat(e," can only be used on a ReadableByteStreamController"))}function ot(e,t){if("byob"!==(e="".concat(e)))throw new TypeError("".concat(t," '").concat(e,"' is not a valid enumeration value for ReadableStreamReaderMode"));return e}function it(e){return new ct(e)}function st(e,t){e._reader._readIntoRequests.push(t)}function at(e){return e._reader._readIntoRequests.length}function ut(e){const t=e._reader;return void 0!==t&&!!lt(t)}Object.defineProperties(Ce.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),s(Ce.prototype.close,"close"),s(Ce.prototype.enqueue,"enqueue"),s(Ce.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ce.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class ct{constructor(e){if(z(e,1,"ReadableStreamBYOBReader"),Q(e,"First parameter"),Dr(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Ae(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");k(this,e),this._readIntoRequests=new P}get closed(){return lt(this)?this._closedPromise:p(ft("closed"))}cancel(e){return lt(this)?void 0===this._ownerReadableStream?p(L("cancel")):U(this,e):p(ft("cancel"))}read(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!lt(this))return p(ft("read"));if(!ArrayBuffer.isView(e))return p(new TypeError("view must be an array buffer view"));if(0===e.byteLength)return p(new TypeError("view must have non-zero byteLength"));if(0===e.buffer.byteLength)return p(new TypeError("view's buffer must have non-zero byteLength"));if(de(e.buffer))return p(new TypeError("view's buffer has been detached"));try{t=function(e,t){var r;return W(e,t),{min:Y(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,"".concat(t," has member 'min' that"))}}(r,"options")}catch(e){return p(e)}const n=t.min;if(0===n)return p(new TypeError("options.min must be greater than 0"));if(function(e){return Oe(e.constructor)}(e)){if(n>e.byteLength)return p(new RangeError("options.min must be less than or equal to view's byteLength"))}else if(n>e.length)return p(new RangeError("options.min must be less than or equal to view's length"));if(void 0===this._ownerReadableStream)return p(L("read from"));let o,i;const s=d((e,t)=>{o=e,i=t});return ht(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),s}releaseLock(){if(!lt(this))throw ft("releaseLock");void 0!==this._ownerReadableStream&&function(e){q(e),dt(e,new TypeError("Reader was released"))}(this)}}function lt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof ct}function ht(e,t,r,n){const o=e._ownerReadableStream;o._disturbed=!0,"errored"===o._state?n._errorSteps(o._storedError):function(e,t,r,n){const o=e._controlledReadableByteStream,i=t.constructor,s=function(e){return Oe(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:a,byteLength:u}=t,c=r*s;let l;try{l=he(t.buffer)}catch(e){return void n._errorSteps(e)}const h={buffer:l,bufferByteLength:l.byteLength,byteOffset:a,byteLength:u,bytesFilled:0,minimumFill:c,elementSize:s,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(h),void st(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(Be(e,h)){const t=xe(h);return We(e),void n._chunkSteps(t)}if(e._closeRequested){const t=new TypeError("Insufficient bytes to fill elements in the given buffer");return Qe(e,t),void n._errorSteps(t)}}e._pendingPullIntos.push(h),st(o,n),Ue(e)}else{const e=new i(h.buffer,h.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function dt(e,t){const r=e._readIntoRequests;e._readIntoRequests=new P,r.forEach(e=>{e._errorSteps(t)})}function ft(e){return new TypeError("ReadableStreamBYOBReader.prototype.".concat(e," can only be used on a ReadableStreamBYOBReader"))}function pt(e,t){const{highWaterMark:r}=e;if(void 0===r)return t;if(Se(r)||r<0)throw new RangeError("Invalid highWaterMark");return r}function vt(e){const{size:t}=e;return t||(()=>1)}function gt(e,t){W(e,t);const r=null==e?void 0:e.highWaterMark,n=null==e?void 0:e.size;return{highWaterMark:void 0===r?void 0:G(r),size:void 0===n?void 0:mt(n,"".concat(t," has member 'size' that"))}}function mt(e,t){return F(e,t),t=>G(e(t))}function yt(e,t,r){return F(e,r),r=>I(e,t,[r])}function bt(e,t,r){return F(e,r),()=>I(e,t,[])}function _t(e,t,r){return F(e,r),r=>S(e,t,[r])}function wt(e,t,r){return F(e,r),(r,n)=>I(e,t,[r,n])}function St(e,t){if(!Ot(e))throw new TypeError("".concat(t," is not a WritableStream."))}Object.defineProperties(ct.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),s(ct.prototype.cancel,"cancel"),s(ct.prototype.read,"read"),s(ct.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ct.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const It="function"==typeof AbortController;class Tt{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e?e=null:H(e,"First parameter");const r=gt(t,"Second parameter"),n=function(e,t){W(e,t);const r=null==e?void 0:e.abort,n=null==e?void 0:e.close,o=null==e?void 0:e.start,i=null==e?void 0:e.type,s=null==e?void 0:e.write;return{abort:void 0===r?void 0:yt(r,e,"".concat(t," has member 'abort' that")),close:void 0===n?void 0:bt(n,e,"".concat(t," has member 'close' that")),start:void 0===o?void 0:_t(o,e,"".concat(t," has member 'start' that")),write:void 0===s?void 0:wt(s,e,"".concat(t," has member 'write' that")),type:i}}(e,"First parameter");if(Et(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=vt(r);!function(e,t,r,n){const o=Object.create(zt.prototype);let i,s,a,u;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.write?e=>t.write(e,o):()=>f(void 0),a=void 0!==t.close?()=>t.close():()=>f(void 0),u=void 0!==t.abort?e=>t.abort(e):()=>f(void 0),Gt(e,o,i,s,a,u,r,n)}(this,n,pt(r,1),o)}get locked(){if(!Ot(this))throw Xt("locked");return Rt(this)}abort(e){return Ot(this)?Rt(this)?p(new TypeError("Cannot abort a stream that already has a writer")):Ct(this,e):p(Xt("abort"))}close(){return Ot(this)?Rt(this)?p(new TypeError("Cannot close a stream that already has a writer")):Lt(this)?p(new TypeError("Cannot close an already-closing stream")):At(this):p(Xt("close"))}getWriter(){if(!Ot(this))throw Xt("getWriter");return Pt(this)}}function Pt(e){return new jt(e)}function Et(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new P,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Ot(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof Tt}function Rt(e){return void 0!==e._writer}function Ct(e,t){var r;if("closed"===e._state||"errored"===e._state)return f(void 0);e._writableStreamController._abortReason=t,null===(r=e._writableStreamController._abortController)||void 0===r||r.abort(t);const n=e._state;if("closed"===n||"errored"===n)return f(void 0);if(void 0!==e._pendingAbortRequest)return e._pendingAbortRequest._promise;let o=!1;"erroring"===n&&(o=!0,t=void 0);const i=d((r,n)=>{e._pendingAbortRequest={_promise:void 0,_resolve:r,_reject:n,_reason:t,_wasAlreadyErroring:o}});return e._pendingAbortRequest._promise=i,o||Ut(e,t),i}function At(e){const t=e._state;if("closed"===t||"errored"===t)return p(new TypeError("The stream (in ".concat(t," state) is not in the writable state and cannot be closed")));const r=d((t,r)=>{const n={_resolve:t,_reject:r};e._closeRequest=n}),n=e._writer;var o;return void 0!==n&&e._backpressure&&"writable"===t&&hr(n),Pe(o=e._writableStreamController,Ht,0),Qt(o),r}function kt(e,t){"writable"!==e._state?qt(e):Ut(e,t)}function Ut(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&Mt(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&qt(e)}function qt(e){e._state="errored",e._writableStreamController[O]();const t=e._storedError;if(e._writeRequests.forEach(e=>{e._reject(t)}),e._writeRequests=new P,void 0===e._pendingAbortRequest)return void xt(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void xt(e);g(e._writableStreamController[E](r._reason),()=>(r._resolve(),xt(e),null),t=>(r._reject(t),xt(e),null))}function Lt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function xt(e){void 0!==e._closeRequest&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;void 0!==t&&ir(t,e._storedError)}function Nt(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){ar(e)}(r):hr(r)),e._backpressure=t}Object.defineProperties(Tt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),s(Tt.prototype.abort,"abort"),s(Tt.prototype.close,"close"),s(Tt.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Tt.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class jt{constructor(e){if(z(e,1,"WritableStreamDefaultWriter"),St(e,"First parameter"),Rt(e))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=e,e._writer=this;const t=e._state;if("writable"===t)!Lt(e)&&e._backpressure?ar(this):cr(this),nr(this);else if("erroring"===t)ur(this,e._storedError),nr(this);else if("closed"===t)cr(this),nr(this),sr(this);else{const t=e._storedError;ur(this,t),or(this,t)}}get closed(){return Dt(this)?this._closedPromise:p(tr("closed"))}get desiredSize(){if(!Dt(this))throw tr("desiredSize");if(void 0===this._ownerWritableStream)throw rr("desiredSize");return function(e){const t=e._ownerWritableStream,r=t._state;return"errored"===r||"erroring"===r?null:"closed"===r?0:Yt(t._writableStreamController)}(this)}get ready(){return Dt(this)?this._readyPromise:p(tr("ready"))}abort(e){return Dt(this)?void 0===this._ownerWritableStream?p(rr("abort")):function(e,t){return Ct(e._ownerWritableStream,t)}(this,e):p(tr("abort"))}close(){if(!Dt(this))return p(tr("close"));const e=this._ownerWritableStream;return void 0===e?p(rr("close")):Lt(e)?p(new TypeError("Cannot close an already-closing stream")):Bt(this)}releaseLock(){if(!Dt(this))throw tr("releaseLock");void 0!==this._ownerWritableStream&&Wt(this)}write(e){return Dt(this)?void 0===this._ownerWritableStream?p(rr("write to")):Ft(this,e):p(tr("write"))}}function Dt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof jt}function Bt(e){return At(e._ownerWritableStream)}function Mt(e,t){"pending"===e._readyPromiseState?lr(e,t):function(e,t){ur(e,t)}(e,t)}function Wt(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Mt(e,r),function(e,t){"pending"===e._closedPromiseState?ir(e,t):function(e,t){or(e,t)}(e,t)}(e,r),t._writer=void 0,e._ownerWritableStream=void 0}function Ft(e,t){const r=e._ownerWritableStream,n=r._writableStreamController,o=function(e,t){try{return e._strategySizeAlgorithm(t)}catch(t){return Jt(e,t),1}}(n,t);if(r!==e._ownerWritableStream)return p(rr("write to"));const i=r._state;if("errored"===i)return p(r._storedError);if(Lt(r)||"closed"===i)return p(new TypeError("The stream is closing or closed and cannot be written to"));if("erroring"===i)return p(r._storedError);const s=function(e){return d((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)})}(r);return function(e,t,r){try{Pe(e,t,r)}catch(t){return void Jt(e,t)}const n=e._controlledWritableStream;Lt(n)||"writable"!==n._state||Nt(n,$t(e)),Qt(e)}(n,t,o),s}Object.defineProperties(jt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),s(jt.prototype.abort,"abort"),s(jt.prototype.close,"close"),s(jt.prototype.releaseLock,"releaseLock"),s(jt.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(jt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Ht={};class zt{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Vt(this))throw er("abortReason");return this._abortReason}get signal(){if(!Vt(this))throw er("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e){if(!Vt(this))throw er("error");"writable"===this._controlledWritableStream._state&&Zt(this,e)}[E](e){const t=this._abortAlgorithm(e);return Kt(this),t}[O](){Ee(this)}}function Vt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof zt}function Gt(e,t,r,n,o,i,s,a){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._abortReason=void 0,t._abortController=function(){if(It)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=a,t._strategyHWM=s,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const u=$t(t);Nt(e,u),g(f(r()),()=>(t._started=!0,Qt(t),null),r=>(t._started=!0,kt(e,r),null))}function Kt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Yt(e){return e._strategyHWM-e._queueTotalSize}function Qt(e){const t=e._controlledWritableStream;if(!e._started)return;if(void 0!==t._inFlightWriteRequest)return;if("erroring"===t._state)return void qt(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===Ht?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Te(e);const r=e._closeAlgorithm();Kt(e),g(r,()=>(function(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,"erroring"===e._state&&(e._storedError=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const t=e._writer;void 0!==t&&sr(t)}(t),null),e=>(function(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,void 0!==e._pendingAbortRequest&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),kt(e,t)}(t,e),null))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),g(e._writeAlgorithm(t),()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(Te(e),!Lt(r)&&"writable"===t){const t=$t(e);Nt(r,t)}return Qt(e),null},t=>("writable"===r._state&&Kt(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,kt(e,t)}(r,t),null))}(e,r)}function Jt(e,t){"writable"===e._controlledWritableStream._state&&Zt(e,t)}function $t(e){return Yt(e)<=0}function Zt(e,t){const r=e._controlledWritableStream;Kt(e),Ut(r,t)}function Xt(e){return new TypeError("WritableStream.prototype.".concat(e," can only be used on a WritableStream"))}function er(e){return new TypeError("WritableStreamDefaultController.prototype.".concat(e," can only be used on a WritableStreamDefaultController"))}function tr(e){return new TypeError("WritableStreamDefaultWriter.prototype.".concat(e," can only be used on a WritableStreamDefaultWriter"))}function rr(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function nr(e){e._closedPromise=d((t,r)=>{e._closedPromise_resolve=t,e._closedPromise_reject=r,e._closedPromiseState="pending"})}function or(e,t){nr(e),ir(e,t)}function ir(e,t){void 0!==e._closedPromise_reject&&(_(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function sr(e){void 0!==e._closedPromise_resolve&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function ar(e){e._readyPromise=d((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r}),e._readyPromiseState="pending"}function ur(e,t){ar(e),lr(e,t)}function cr(e){ar(e),hr(e)}function lr(e,t){void 0!==e._readyPromise_reject&&(_(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function hr(e){void 0!==e._readyPromise_resolve&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}Object.defineProperties(zt.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(zt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const dr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:void 0!==T?T:void 0,fr=function(){const e=null==dr?void 0:dr.DOMException;return function(e){if("function"!=typeof e&&"object"!=typeof e)return!1;if("DOMException"!==e.name)return!1;try{return new e,!0}catch(e){return!1}}(e)?e:void 0}()||function(){const e=function(e,t){this.message=e||"",this.name=t||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return s(e,"DOMException"),e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}();function pr(e,t,r,o,i,s){const a=J(e),u=Pt(t);e._disturbed=!0;let c=!1,l=f(void 0);return d((h,b)=>{let w;if(void 0!==s){if(w=()=>{const r=void 0!==s.reason?s.reason:new fr("Aborted","AbortError"),n=[];o||n.push(()=>"writable"===t._state?Ct(t,r):f(void 0)),i||n.push(()=>"readable"===e._state?Br(e,r):f(void 0)),O(()=>Promise.all(n.map(e=>e())),!0,r)},s.aborted)return void w();s.addEventListener("abort",w)}var S,I,T;if(E(e,a._closedPromise,e=>(o?R(!0,e):O(()=>Ct(t,e),!0,e),null)),E(t,u._closedPromise,t=>(i?R(!0,t):O(()=>Br(e,t),!0,t),null)),S=e,I=a._closedPromise,T=()=>(r?R():O(()=>function(e){const t=e._ownerWritableStream,r=t._state;return Lt(t)||"closed"===r?f(void 0):"errored"===r?p(t._storedError):Bt(e)}(u)),null),"closed"===S._state?T():m(I,T),Lt(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");i?R(!0,t):O(()=>Br(e,t),!0,t)}function P(){const e=l;return v(l,()=>e!==l?P():void 0)}function E(e,t,r){"errored"===e._state?r(e._storedError):y(t,r)}function O(e,r,n){function o(){return g(e(),()=>C(r,n),e=>C(!0,e)),null}c||(c=!0,"writable"!==t._state||Lt(t)?o():m(P(),o))}function R(e,r){c||(c=!0,"writable"!==t._state||Lt(t)?C(e,r):m(P(),()=>C(e,r)))}function C(e,t){return Wt(u),q(a),void 0!==s&&s.removeEventListener("abort",w),e?b(t):h(void 0),null}_(d((e,t)=>{!function r(o){o?e():v(c?f(!0):v(u._readyPromise,()=>d((e,t)=>{ne(a,{_chunkSteps:t=>{l=v(Ft(u,t),void 0,n),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})),r,t)}(!1)}))})}class vr{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!gr(this))throw Er("desiredSize");return Ir(this)}close(){if(!gr(this))throw Er("close");if(!Tr(this))throw new TypeError("The stream is not in a state that permits close");_r(this)}enqueue(e){if(!gr(this))throw Er("enqueue");if(!Tr(this))throw new TypeError("The stream is not in a state that permits enqueue");return wr(this,e)}error(e){if(!gr(this))throw Er("error");Sr(this,e)}[R](e){Ee(this);const t=this._cancelAlgorithm(e);return br(this),t}[C](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=Te(this);this._closeRequested&&0===this._queue.length?(br(this),Mr(t)):mr(this),e._chunkSteps(r)}else $(t,e),mr(this)}[A](){}}function gr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof vr}function mr(e){yr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,g(e._pullAlgorithm(),()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,mr(e)),null),t=>(Sr(e,t),null))))}function yr(e){const t=e._controlledReadableStream;return!!Tr(e)&&!!e._started&&(!!(Dr(t)&&X(t)>0)||Ir(e)>0)}function br(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function _r(e){if(!Tr(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(br(e),Mr(t))}function wr(e,t){if(!Tr(e))return;const r=e._controlledReadableStream;if(Dr(r)&&X(r)>0)Z(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw Sr(e,t),t}try{Pe(e,t,r)}catch(t){throw Sr(e,t),t}}mr(e)}function Sr(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(Ee(e),br(e),Wr(r,t))}function Ir(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Tr(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Pr(e,t,r,n,o,i,s){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=s,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,g(f(r()),()=>(t._started=!0,mr(t),null),e=>(Sr(t,e),null))}function Er(e){return new TypeError("ReadableStreamDefaultController.prototype.".concat(e," can only be used on a ReadableStreamDefaultController"))}function Or(e){return o(t=e)&&void 0!==t.getReader?function(e){let t;return t=Lr(n,function(){let r;try{r=e.read()}catch(r){return p(r)}return b(r,e=>{if(!o(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)_r(t._readableStreamController);else{const r=e.value;wr(t._readableStreamController,r)}})},function(t){try{return f(e.cancel(t))}catch(t){return p(t)}},0),t}(e.getReader()):function(e){let t;const r=function e(t){let r=arguments.length>2?arguments[2]:void 0;if(void 0===r)if("async"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"sync")){if(void 0===(r=pe(t,ge)))return function(e){const t={next(){let t;try{t=me(e)}catch(e){return p(e)}return ve(t)},return(t){let r;try{const n=pe(e.iterator,"return");if(void 0===n)return f({done:!0,value:t});r=S(n,e.iterator,[t])}catch(e){return p(e)}return o(r)?ve(r):p(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(e(t,"sync",pe(t,Symbol.iterator)))}else r=pe(t,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const n=S(r,t,[]);if(!o(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}(e,"async");return t=Lr(n,function(){let e;try{e=me(r)}catch(e){return p(e)}return b(f(e),e=>{if(!o(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)_r(t._readableStreamController);else{const r=e.value;wr(t._readableStreamController,r)}})},function(e){const t=r.iterator;let n;try{n=pe(t,"return")}catch(e){return p(e)}return void 0===n?f(void 0):b(I(n,t,[e]),e=>{if(!o(e))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object")})},0),t}(e);var t}function Rr(e,t,r){return F(e,r),r=>I(e,t,[r])}function Cr(e,t,r){return F(e,r),r=>I(e,t,[r])}function Ar(e,t,r){return F(e,r),r=>S(e,t,[r])}function kr(e,t){if("bytes"!==(e="".concat(e)))throw new TypeError("".concat(t," '").concat(e,"' is not a valid enumeration value for ReadableStreamType"));return e}function Ur(e,t){W(e,t);const r=null==e?void 0:e.preventAbort,n=null==e?void 0:e.preventCancel,o=null==e?void 0:e.preventClose,i=null==e?void 0:e.signal;return void 0!==i&&function(e,t){if(!function(e){if("object"!=typeof e||null===e)return!1;try{return"boolean"==typeof e.aborted}catch(e){return!1}}(e))throw new TypeError("".concat(t," is not an AbortSignal."))}(i,"".concat(t," has member 'signal' that")),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(o),signal:i}}Object.defineProperties(vr.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),s(vr.prototype.close,"close"),s(vr.prototype.enqueue,"enqueue"),s(vr.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(vr.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class qr{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};void 0===e?e=null:H(e,"First parameter");const r=gt(t,"Second parameter"),n=function(e,t){W(e,t);const r=e,n=null==r?void 0:r.autoAllocateChunkSize,o=null==r?void 0:r.cancel,i=null==r?void 0:r.pull,s=null==r?void 0:r.start,a=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:Y(n,"".concat(t," has member 'autoAllocateChunkSize' that")),cancel:void 0===o?void 0:Rr(o,r,"".concat(t," has member 'cancel' that")),pull:void 0===i?void 0:Cr(i,r,"".concat(t," has member 'pull' that")),start:void 0===s?void 0:Ar(s,r,"".concat(t," has member 'start' that")),type:void 0===a?void 0:kr(a,"".concat(t," has member 'type' that"))}}(e,"First parameter");if(Nr(this),"bytes"===n.type){if(void 0!==r.size)throw new RangeError("The strategy for a byte stream cannot have a size function");!function(e,t,r){const n=Object.create(Ce.prototype);let o,i,s;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>f(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>f(void 0);const a=t.autoAllocateChunkSize;if(0===a)throw new TypeError("autoAllocateChunkSize must be greater than 0");tt(e,n,o,i,s,r,a)}(this,n,pt(r,0))}else{const e=vt(r);!function(e,t,r,n){const o=Object.create(vr.prototype);let i,s,a;i=void 0!==t.start?()=>t.start(o):()=>{},s=void 0!==t.pull?()=>t.pull(o):()=>f(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>f(void 0),Pr(e,o,i,s,a,r,n)}(this,n,pt(r,1),e)}}get locked(){if(!jr(this))throw Fr("locked");return Dr(this)}cancel(e){return jr(this)?Dr(this)?p(new TypeError("Cannot cancel a stream that already has a reader")):Br(this,e):p(Fr("cancel"))}getReader(e){if(!jr(this))throw Fr("getReader");return void 0===function(e,t){W(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:ot(r,"".concat(t," has member 'mode' that"))}}(e,"First parameter").mode?J(this):it(this)}pipeThrough(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!jr(this))throw Fr("pipeThrough");z(e,1,"pipeThrough");const r=function(e,t){W(e,t);const r=null==e?void 0:e.readable;V(r,"readable","ReadableWritablePair"),Q(r,"".concat(t," has member 'readable' that"));const n=null==e?void 0:e.writable;return V(n,"writable","ReadableWritablePair"),St(n,"".concat(t," has member 'writable' that")),{readable:r,writable:n}}(e,"First parameter"),n=Ur(t,"Second parameter");if(Dr(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Rt(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return _(pr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!jr(this))return p(Fr("pipeTo"));if(void 0===e)return p("Parameter 1 is required in 'pipeTo'.");if(!Ot(e))return p(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));try{t=Ur(r,"Second parameter")}catch(e){return p(e)}return Dr(this)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Rt(e)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):pr(this,e,t.preventClose,t.preventAbort,t.preventCancel,t.signal)}tee(){if(!jr(this))throw Fr("tee");return ce(function(e){return Ae(e._readableStreamController)?function(e){let t,r,n,o,i,s=J(e),a=!1,u=!1,c=!1,l=!1,h=!1;const p=d(e=>{i=e});function v(e){y(e._closedPromise,t=>(e!==s||(Qe(n._readableStreamController,t),Qe(o._readableStreamController,t),l&&h||i(void 0)),null))}function g(){lt(s)&&(q(s),s=J(e),v(s)),ne(s,{_chunkSteps:t=>{w(()=>{u=!1,c=!1;const r=t;let s=t;if(!l&&!h)try{s=Ie(t)}catch(t){return Qe(n._readableStreamController,t),Qe(o._readableStreamController,t),void i(Br(e,t))}l||Ye(n._readableStreamController,r),h||Ye(o._readableStreamController,s),a=!1,u?b():c&&_()})},_closeSteps:()=>{a=!1,l||Ke(n._readableStreamController),h||Ke(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&Xe(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Xe(o._readableStreamController,0),l&&h||i(void 0)},_errorSteps:()=>{a=!1}})}function m(t,r){re(s)&&(q(s),s=it(e),v(s));const d=r?o:n,f=r?n:o;ht(s,t,1,{_chunkSteps:t=>{w(()=>{u=!1,c=!1;const n=r?h:l;if(r?l:h)n||et(d._readableStreamController,t);else{let r;try{r=Ie(t)}catch(t){return Qe(d._readableStreamController,t),Qe(f._readableStreamController,t),void i(Br(e,t))}n||et(d._readableStreamController,t),Ye(f._readableStreamController,r)}a=!1,u?b():c&&_()})},_closeSteps:e=>{a=!1;const t=r?h:l,n=r?l:h;t||Ke(d._readableStreamController),n||Ke(f._readableStreamController),void 0!==e&&(t||et(d._readableStreamController,e),!n&&f._readableStreamController._pendingPullIntos.length>0&&Xe(f._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{a=!1}})}function b(){if(a)return u=!0,f(void 0);a=!0;const e=$e(n._readableStreamController);return null===e?g():m(e._view,!1),f(void 0)}function _(){if(a)return c=!0,f(void 0);a=!0;const e=$e(o._readableStreamController);return null===e?g():m(e._view,!0),f(void 0)}function S(){}return n=xr(S,b,function(n){if(l=!0,t=n,h){const n=ce([t,r]),o=Br(e,n);i(o)}return p}),o=xr(S,_,function(n){if(h=!0,r=n,l){const n=ce([t,r]),o=Br(e,n);i(o)}return p}),v(s),[n,o]}(e):function(e){const t=J(e);let r,n,o,i,s,a=!1,u=!1,c=!1,l=!1;const h=d(e=>{s=e});function p(){return a?(u=!0,f(void 0)):(a=!0,ne(t,{_chunkSteps:e=>{w(()=>{u=!1;const t=e,r=e;c||wr(o._readableStreamController,t),l||wr(i._readableStreamController,r),a=!1,u&&p()})},_closeSteps:()=>{a=!1,c||_r(o._readableStreamController),l||_r(i._readableStreamController),c&&l||s(void 0)},_errorSteps:()=>{a=!1}}),f(void 0))}function v(){}return o=Lr(v,p,function(t){if(c=!0,r=t,l){const t=ce([r,n]),o=Br(e,t);s(o)}return h}),i=Lr(v,p,function(t){if(l=!0,n=t,c){const t=ce([r,n]),o=Br(e,t);s(o)}return h}),y(t._closedPromise,e=>(Sr(o._readableStreamController,e),Sr(i._readableStreamController,e),c&&l||s(void 0),null)),[o,i]}(e)}(this))}values(e){if(!jr(this))throw Fr("values");return function(e,t){const r=J(e),n=new ye(r,t),o=Object.create(be);return o._asyncIteratorImpl=n,o}(this,function(e){W(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[ge](e){return this.values(e)}static from(e){return Or(e)}}function Lr(e,t,r){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:()=>1;const i=Object.create(qr.prototype);return Nr(i),Pr(i,Object.create(vr.prototype),e,t,r,n,o),i}function xr(e,t,r){const n=Object.create(qr.prototype);return Nr(n),tt(n,Object.create(Ce.prototype),e,t,r,0,void 0),n}function Nr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function jr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof qr}function Dr(e){return void 0!==e._reader}function Br(e,t){if(e._disturbed=!0,"closed"===e._state)return f(void 0);if("errored"===e._state)return p(e._storedError);Mr(e);const r=e._reader;if(void 0!==r&<(r)){const e=r._readIntoRequests;r._readIntoRequests=new P,e.forEach(e=>{e._closeSteps(void 0)})}return b(e._readableStreamController[R](t),n)}function Mr(e){e._state="closed";const t=e._reader;if(void 0!==t&&(D(t),re(t))){const e=t._readRequests;t._readRequests=new P,e.forEach(e=>{e._closeSteps()})}}function Wr(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(j(r,t),re(r)?oe(r,t):dt(r,t))}function Fr(e){return new TypeError("ReadableStream.prototype.".concat(e," can only be used on a ReadableStream"))}function Hr(e,t){W(e,t);const r=null==e?void 0:e.highWaterMark;return V(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:G(r)}}Object.defineProperties(qr,{from:{enumerable:!0}}),Object.defineProperties(qr.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),s(qr.from,"from"),s(qr.prototype.cancel,"cancel"),s(qr.prototype.getReader,"getReader"),s(qr.prototype.pipeThrough,"pipeThrough"),s(qr.prototype.pipeTo,"pipeTo"),s(qr.prototype.tee,"tee"),s(qr.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(qr.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(qr.prototype,ge,{value:qr.prototype.values,writable:!0,configurable:!0});const zr=e=>e.byteLength;s(zr,"size");class Vr{constructor(e){z(e,1,"ByteLengthQueuingStrategy"),e=Hr(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Kr(this))throw Gr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Kr(this))throw Gr("size");return zr}}function Gr(e){return new TypeError("ByteLengthQueuingStrategy.prototype.".concat(e," can only be used on a ByteLengthQueuingStrategy"))}function Kr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof Vr}Object.defineProperties(Vr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Vr.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Yr=()=>1;s(Yr,"size");class Qr{constructor(e){z(e,1,"CountQueuingStrategy"),e=Hr(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!$r(this))throw Jr("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!$r(this))throw Jr("size");return Yr}}function Jr(e){return new TypeError("CountQueuingStrategy.prototype.".concat(e," can only be used on a CountQueuingStrategy"))}function $r(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Qr}function Zr(e,t,r){return F(e,r),r=>I(e,t,[r])}function Xr(e,t,r){return F(e,r),r=>S(e,t,[r])}function en(e,t,r){return F(e,r),(r,n)=>I(e,t,[r,n])}function tn(e,t,r){return F(e,r),r=>I(e,t,[r])}Object.defineProperties(Qr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Qr.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});class rn{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};void 0===e&&(e=null);const r=gt(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},"Second parameter"),n=gt(t,"Third parameter"),o=function(e,t){W(e,t);const r=null==e?void 0:e.cancel,n=null==e?void 0:e.flush,o=null==e?void 0:e.readableType,i=null==e?void 0:e.start,s=null==e?void 0:e.transform,a=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:tn(r,e,"".concat(t," has member 'cancel' that")),flush:void 0===n?void 0:Zr(n,e,"".concat(t," has member 'flush' that")),readableType:o,start:void 0===i?void 0:Xr(i,e,"".concat(t," has member 'start' that")),transform:void 0===s?void 0:en(s,e,"".concat(t," has member 'transform' that")),writableType:a}}(e,"First parameter");if(void 0!==o.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==o.writableType)throw new RangeError("Invalid writableType specified");const i=pt(n,0),s=vt(n),a=pt(r,1),u=vt(r);let c;!function(e,t,r,n,o,i){function s(){return t}e._writable=function(e,t,r,n){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:()=>1;const s=Object.create(Tt.prototype);return Et(s),Gt(s,Object.create(zt.prototype),e,t,r,n,o,i),s}(s,function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?b(e._backpressureChangePromise,()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return fn(r,t)}):fn(r,t)}(e,t)},function(){return function(e){const t=e._transformStreamController;if(void 0!==t._finishPromise)return t._finishPromise;const r=e._readable;t._finishPromise=d((e,r)=>{t._finishPromise_resolve=e,t._finishPromise_reject=r});const n=t._flushAlgorithm();return hn(t),g(n,()=>("errored"===r._state?gn(t,r._storedError):(_r(r._readableStreamController),vn(t)),null),e=>(Sr(r._readableStreamController,e),gn(t,e),null)),t._finishPromise}(e)},function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._readable;r._finishPromise=d((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t});const o=r._cancelAlgorithm(t);return hn(r),g(o,()=>("errored"===n._state?gn(r,n._storedError):(Sr(n._readableStreamController,t),vn(r)),null),e=>(Sr(n._readableStreamController,e),gn(r,e),null)),r._finishPromise}(e,t)},r,n),e._readable=Lr(s,function(){return function(e){return un(e,!1),e._backpressureChangePromise}(e)},function(t){return function(e,t){const r=e._transformStreamController;if(void 0!==r._finishPromise)return r._finishPromise;const n=e._writable;r._finishPromise=d((e,t)=>{r._finishPromise_resolve=e,r._finishPromise_reject=t});const o=r._cancelAlgorithm(t);return hn(r),g(o,()=>("errored"===n._state?gn(r,n._storedError):(Jt(n._writableStreamController,t),an(e),vn(r)),null),t=>(Jt(n._writableStreamController,t),an(e),gn(r,t),null)),r._finishPromise}(e,t)},o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,un(e,!0),e._transformStreamController=void 0}(this,d(e=>{c=e}),a,u,i,s),function(e,t){const r=Object.create(cn.prototype);let n,o,i;n=void 0!==t.transform?e=>t.transform(e,r):e=>{try{return dn(r,e),f(void 0)}catch(e){return p(e)}},o=void 0!==t.flush?()=>t.flush(r):()=>f(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>f(void 0),function(e,t,r,n,o){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=r,t._flushAlgorithm=n,t._cancelAlgorithm=o,t._finishPromise=void 0,t._finishPromise_resolve=void 0,t._finishPromise_reject=void 0}(e,r,n,o,i)}(this,o),void 0!==o.start?c(o.start(this._transformStreamController)):c(void 0)}get readable(){if(!nn(this))throw mn("readable");return this._readable}get writable(){if(!nn(this))throw mn("writable");return this._writable}}function nn(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")&&e instanceof rn}function on(e,t){Sr(e._readable._readableStreamController,t),sn(e,t)}function sn(e,t){hn(e._transformStreamController),Jt(e._writable._writableStreamController,t),an(e)}function an(e){e._backpressure&&un(e,!1)}function un(e,t){void 0!==e._backpressureChangePromise&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=d(t=>{e._backpressureChangePromise_resolve=t}),e._backpressure=t}Object.defineProperties(rn.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(rn.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});class cn{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!ln(this))throw pn("desiredSize");return Ir(this._controlledTransformStream._readable._readableStreamController)}enqueue(e){if(!ln(this))throw pn("enqueue");dn(this,e)}error(e){if(!ln(this))throw pn("error");var t;t=e,on(this._controlledTransformStream,t)}terminate(){if(!ln(this))throw pn("terminate");!function(e){const t=e._controlledTransformStream;_r(t._readable._readableStreamController),sn(t,new TypeError("TransformStream terminated"))}(this)}}function ln(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof cn}function hn(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0,e._cancelAlgorithm=void 0}function dn(e,t){const r=e._controlledTransformStream,n=r._readable._readableStreamController;if(!Tr(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{wr(n,t)}catch(e){throw sn(r,e),r._readable._storedError}(function(e){return!yr(e)})(n)!==r._backpressure&&un(r,!0)}function fn(e,t){return b(e._transformAlgorithm(t),void 0,t=>{throw on(e._controlledTransformStream,t),t})}function pn(e){return new TypeError("TransformStreamDefaultController.prototype.".concat(e," can only be used on a TransformStreamDefaultController"))}function vn(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function gn(e,t){void 0!==e._finishPromise_reject&&(_(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function mn(e){return new TypeError("TransformStream.prototype.".concat(e," can only be used on a TransformStream"))}Object.defineProperties(cn.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),s(cn.prototype.enqueue,"enqueue"),s(cn.prototype.error,"error"),s(cn.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(cn.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0})},function(e,t,r){var n;r.r(t),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function s(e,t,r){void 0===r&&(r={});var n=/\?/.test(t),o="";for(var i in r)""===o?!n&&(t+="?"):o+="&",o+=i+"="+encodeURIComponent(r[i]);return/^http(s)?\:\/\//.test(t+=o)?t:""+e+t}r.d(t,"StorageType",function(){return n}),r.d(t,"AbstractSDKRequest",function(){return o}),r.d(t,"AbstractStorage",function(){return i}),r.d(t,"formatUrl",function(){return s})}])}(Mf);var Wf=P(Mf.exports),Ff=this&&this.__assign||function(){return Ff=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Ff.apply(this,arguments)},Hf=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},zf=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},Vf=function(){function e(e){var t,r;try{this.localStorage=(null==e?void 0:e.localStorage)||((null===(r=null===(t=null==e?void 0:e.adapter)||void 0===t?void 0:t.root)||void 0===r?void 0:r.globalThis)||globalThis).localStorage}catch(t){this.localStorage=(null==e?void 0:e.localStorage)||{}}}return e.prototype.getItem=function(e){return Hf(this,void 0,void 0,function(){return zf(this,function(t){return[2,this.localStorage.getItem(e)]})})},e.prototype.removeItem=function(e){return Hf(this,void 0,void 0,function(){return zf(this,function(t){return this.localStorage.removeItem(e),[2]})})},e.prototype.setItem=function(e,t){return Hf(this,void 0,void 0,function(){return zf(this,function(r){return this.localStorage.setItem(e,t),[2]})})},e.prototype.getItemSync=function(e){return this.localStorage.getItem(e)},e.prototype.setItemSync=function(e,t){this.localStorage.setItem(e,t)},e.prototype.removeItemSync=function(e){this.localStorage.removeItem(e)},e}(),Gf=/^[^:]+:\/\/[^/]+(\/[^?#]+)/,Kf=function(e,t){var r,n,o,i=null===(r=null==t?void 0:t.headers)||void 0===r?void 0:r["x-request-id"];return e||(e={}),((null==e?void 0:e.code)||(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.error_code))&&(e={error:e.code||e.data.error,error_description:e.data.error_description||e.message||e.code||e.data.error_code,request_id:e.requestId,error_code:null===(o=e.data)||void 0===o?void 0:o.error_code}),(null==e?void 0:e.request_id)||(e.request_id=e.request_id||i),(null==e?void 0:e.error)?(e.error_uri=function(e){return Gf.test(e)?RegExp.$1:e}(null==t?void 0:t.url),e):(null==e?void 0:e.data)||{}};var Yf=function(e,t){var r=Ff({},e),n={};if((null==t?void 0:t.captchaOptions)&&(r.captchaOptions=t.captchaOptions),!Wf.isMatch()||e.storage&&e.baseRequest)return r;try{var o=Wf.genAdapter({}),i=o.localStorage,s=o.reqClass;if(i&&(n.storage=new Vf({localStorage:i,adapter:t})),s){var a=new s({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});n.request=function(e){return function(t,r){return Hf(this,void 0,void 0,function(){return zf(this,function(n){return[2,new Promise(function(n,o){var i=Object.assign({},r);i.body&&"string"!=typeof i.body&&(i.body=JSON.stringify(i.body));var s=wx.request({url:t,data:i.body,timeout:e._timeout,method:i.method||"GET",header:i.headers,success:function(e){(e=Kf(e,Ff(Ff({},r),{url:t}))).error&&o(e),n(e)},fail:function(e){o({error:"unreachable",error_description:e.message})},complete:function(t){if(t&&t.errMsg&&e._timeout&&-1!==e._restrictedMethods.indexOf("request")&&"request:fail timeout"===t.errMsg){console.warn(e._timeoutMsg);try{s.abort()}catch(e){}}}})})]})})}}(a)}return r.captchaOptions&&(n.baseRequest=n.request,n.request=void 0),Ff(Ff({},r),n)}catch(e){console.error("adapter generate fail:",e)}return r},Qf=function(e){return e.adapter&&"default"!==e.adapter.type?function(e,t){var r=Ff({},e);try{if(!(null==e?void 0:e.storage)&&(null==t?void 0:t.localStorage)&&(r.storage=new Vf({localStorage:t.localStorage,adapter:t})),!e.captchaOptions&&(null==t?void 0:t.captchaOptions)&&(r.captchaOptions=t.captchaOptions),!e.baseRequest&&!e.request&&(null==t?void 0:t.reqClass)){var n=new t.reqClass({timeout:1e4,restrictedMethods:["get","post","upload","download","request"]});r.baseRequest=function(e,t){var r,o,i,s,a;return Hf(this,void 0,void 0,function(){var u,c,l,h;return zf(this,function(d){switch(d.label){case 0:if(u={},c=(null===(r=t.method)||void 0===r?void 0:r.toLocaleLowerCase())||"post","function"!=typeof(l=null===(i=null===(o=null==n?void 0:n[c])||void 0===o?void 0:o.bind)||void 0===i?void 0:i.call(o,n)))throw new Error("invalid 【".concat(c,"】 request method"));d.label=1;case 1:return d.trys.push([1,3,,4]),(null===(s=t.headers)||void 0===s?void 0:s["content-type"])&&!(null===(a=t.headers)||void 0===a?void 0:a["content-type"].includes("application/json"))||["string","undefined"].includes(typeof t.body)||(t.data=t.data||t.body,t.body=JSON.stringify(t.body)),[4,l(Ff({url:e},t))];case 2:return u=d.sent(),u=Kf(u,Ff(Ff({},t),{url:e})),[3,4];case 3:throw h=d.sent(),u=Ff(Ff({},null==h?void 0:h.data),h);case 4:if(null==u?void 0:u.error)throw u;return[2,u]}})})}}}catch(e){console.error("user adapter generate fail:",e)}return r}(e,e.adapter):Yf(e,e.adapter)};var Jf=this&&this.__assign||function(){return Jf=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},Jf.apply(this,arguments)},$f=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},Zf=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},Xf=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(o,i){function s(e){try{u(n.next(e))}catch(e){i(e)}}function a(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(s,a)}u((n=n.apply(e,t||[])).next())})},ep=this&&this.__generator||function(e,t){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(o=2&a[0]?n.return:a[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,a[1])).done)return o;switch(n=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],n=0}finally{r=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}},tp=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r},rp=function(){return"undefined"!=typeof window&&"undefined"!=typeof document},np=function(e){return function(t){e.fire(sd,Jf(Jf({},t),{eventType:Zh}))}},op=function(){function e(e){var t=e.cache,r=e.oauthInstance;this.cache=t,this.oauthInstance=r,this.setUserInfo()}return e.prototype.checkLocalInfo=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return this.uid=this.getLocalUserInfo("uid"),this.gender=this.getLocalUserInfo("gender"),this.picture=this.getLocalUserInfo("picture"),this.email=this.getLocalUserInfo("email"),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),this.username=this.getLocalUserInfo("username"),this.name=this.getLocalUserInfo("name"),this.birthdate=this.getLocalUserInfo("birthdate"),this.zoneinfo=this.getLocalUserInfo("zoneinfo"),this.locale=this.getLocalUserInfo("locale"),this.sub=this.getLocalUserInfo("sub"),this.createdFrom=this.getLocalUserInfo("created_from"),this.providers=this.getLocalUserInfo("providers"),[2]})})},e.prototype.checkLocalInfoAsync=function(){return Xf(this,void 0,void 0,function(){var e,t,r,n;return ep(this,function(o){switch(o.label){case 0:return e=this,[4,this.getLocalUserInfoAsync("uid")];case 1:return e.uid=o.sent(),t=this,[4,this.getLocalUserInfoAsync("gender")];case 2:return t.gender=o.sent(),this.picture=this.getLocalUserInfo("picture"),r=this,[4,this.getLocalUserInfoAsync("email")];case 3:return r.email=o.sent(),this.emailVerified=this.getLocalUserInfo("email_verified"),this.phoneNumber=this.getLocalUserInfo("phone_number"),n=this,[4,this.getLocalUserInfoAsync("username")];case 4:return n.username=o.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]}})})},e.prototype.update=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(Jf({},e))];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2]}})})},e.prototype.updateUserBasicInfo=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.updateUserBasicInfo(Jf({},e))];case 1:return t.sent(),[4,this.refresh()];case 2:return t.sent(),[2]}})})},e.prototype.updatePassword=function(e,t){return this.oauthInstance.authApi.updatePasswordByOld({old_password:t,new_password:e})},e.prototype.updateUsername=function(e){return"string"!=typeof e&&Ld(Ed,"username must be a string"),this.update({username:e})},e.prototype.refresh=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.getUserInfo(e)];case 1:if("INVALID_ACCESS_TOKEN"===(t=r.sent()).code)throw this.setLocalUserInfo({}),t;return this.setLocalUserInfo(t),[2,t]}})})},e.prototype.getLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey,r=this.cache.getStore(t);return e?r[e]:r||{}},e.prototype.setLocalUserInfo=function(e){var t=this.cache.keys.userInfoKey;this.cache.setStore(t,e),this.setUserInfo()},e.prototype.getLocalUserInfoAsync=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return t=this.cache.keys.userInfoKey,[4,this.cache.getStoreAsync(t)];case 1:return[2,r.sent()[e]]}})})},e.prototype.setUserInfo=function(){var e=this,t=this.cache.keys.userInfoKey,r=this.cache.getStore(t);["uid","email","name","gender","picture","email_verified","phone_number","birthdate","zoneinfo","locale","sub","created_from","providers","username","created_at"].forEach(function(t){e[t]=r[t]})},$f([uf({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"update",null),$f([uf({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[String,String]),Zf("design:returntype",void 0)],e.prototype,"updatePassword",null),$f([uf({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[String]),Zf("design:returntype",void 0)],e.prototype,"updateUsername",null),$f([uf({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"refresh",null),e}(),ip=function(){function e(e){var t=e.envId,r=e.cache,n=e.oauthInstance;t||Ld(Ed,"envId is not defined"),this.cache=r,this.oauthInstance=n,this.user=new op({cache:this.cache,oauthInstance:n})}return e.prototype.checkLocalState=function(){var e;this.oauthLoginState=null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync(),this.user.checkLocalInfo()},e.prototype.checkLocalStateAsync=function(){var e;return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.getLoginState()];case 1:return t.sent(),[4,this.user.checkLocalInfoAsync()];case 2:return t.sent(),[2]}})})},e}(),sp=function(){function e(e){this.listeners=new Map,this.hasListenerSetUp=!1,this.config=e,this.oauthInstance=e.oauthInstance,this.cache=e.cache,this.init(),this.setAccessKey()}return e.prototype.bindPhoneNumber=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.editContact(e)]})})},e.prototype.unbindProvider=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.unbindProvider(e)]})})},e.prototype.bindEmail=function(e){return this.oauthInstance.authApi.editContact(e)},e.prototype.verify=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.verify(e)]})})},e.prototype.getVerification=function(e,t){return Xf(this,void 0,void 0,function(){return ep(this,function(r){return[2,this.oauthInstance.authApi.getVerification(e,t)]})})},Object.defineProperty(e.prototype,"currentUser",{get:function(){if("async"!==this.cache.mode){var e=this.hasLoginState();return e&&e.user||null}qd(Od,"current platform's storage is asynchronous, please use getCurrentUser instead")},enumerable:!1,configurable:!0}),e.prototype.getCurrentUser=function(){return Xf(this,void 0,void 0,function(){var e,t;return ep(this,function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return(e=r.sent())?(t=e.user.getLocalUserInfo(),[4,e.user.checkLocalInfoAsync()]):[3,3];case 2:return r.sent(),[2,Jf(Jf({},e.user),t)];case 3:return[2,null]}})})},e.prototype.signInAnonymouslyInWx=function(e){var t=(void 0===e?{}:e).useWxCloud;return Xf(this,void 0,void 0,function(){var e,r,n=this;return ep(this,function(o){switch(o.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,r=function(r){return Xf(n,void 0,void 0,function(){var n,o;return ep(this,function(i){switch(i.label){case 0:n=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:r,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}},t)];case 2:if((null==(n=i.sent())?void 0:n.error_code)||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.signInAnonymously({provider_token:n.provider_token},t)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[2]}})})},[4,new Promise(function(e,t){wx.login({success:function(o){return Xf(n,void 0,void 0,function(){var n;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,r(o.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return n=i.sent(),t(n),[3,3];case 3:return[2]}})})},fail:function(e){var r=new Error(null==e?void 0:e.errMsg);r.code=null==e?void 0:e.errno,t(r)}})})];case 1:return o.sent(),[2,this.createLoginState(void 0,{asyncRefreshUser:!0})]}})})},e.prototype.bindOpenId=function(){return Xf(this,void 0,void 0,function(){var e,t,r=this;return ep(this,function(n){switch(n.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t=function(t){return Xf(r,void 0,void 0,function(){var r;return ep(this,function(n){switch(n.label){case 0:r=void 0,n.label=1;case 1:return n.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:t,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}})];case 2:if((null==(r=n.sent())?void 0:r.error_code)||!r.provider_token)throw r;return[4,this.oauthInstance.authApi.bindWithProvider({provider_token:r.provider_token})];case 3:return n.sent(),[3,5];case 4:throw n.sent();case 5:return[2]}})})},[4,new Promise(function(e,n){wx.login({success:function(o){return Xf(r,void 0,void 0,function(){var r;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t(o.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return r=i.sent(),n(r),[3,3];case 3:return[2]}})})},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,n(t)}})})];case 1:return n.sent(),[2]}})})},e.prototype.signInWithUnionId=function(){return Xf(this,void 0,void 0,function(){var e=this;return ep(this,function(t){switch(t.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,new Promise(function(t,r){var n=wx.getAccountInfoSync().miniProgram;wx.login({success:function(o){return Xf(e,void 0,void 0,function(){var e,i,s,a,u;return ep(this,function(c){switch(c.label){case 0:e=null==n?void 0:n.appId,c.label=1;case 1:return c.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_code:o.code,provider_id:e,provider_params:{provider_code_type:"union_id",appid:null==n?void 0:n.appId}})];case 2:return i=c.sent(),(s=i.provider_token)?[4,this.oauthInstance.authApi.signInWithProvider({provider_id:e,provider_token:s})]:(r(i),[2]);case 3:return(null==(a=c.sent())?void 0:a.error_code)?(r(a),[2]):(t(!0),[3,5]);case 4:return u=c.sent(),r(u),[3,5];case 5:return[2]}})})},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})})];case 2:return t.sent(),[3,4];case 3:throw t.sent();case 4:return[2,this.createLoginState()]}})})},e.prototype.signInWithSms=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.phoneNum,s=void 0===i?"":i,a=e.bindInfo,u=void 0===a?void 0:a;return Xf(this,void 0,void 0,function(){return ep(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:r,verificationCode:o,bindInfo:u,username:s,loginType:"sms"})]}catch(e){throw e}return[2]})})},e.prototype.signInWithEmail=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.bindInfo,s=void 0===i?void 0:i,a=e.email,u=void 0===a?"":a;return Xf(this,void 0,void 0,function(){return ep(this,function(e){try{return[2,this.signInWithUsername({verificationInfo:r,verificationCode:o,bindInfo:s,username:u,loginType:"email"})]}catch(e){throw e}return[2]})})},e.prototype.setCustomSignFunc=function(e){this.oauthInstance.authApi.setCustomSignFunc(e)},e.prototype.signIn=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signIn(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},e.prototype.setPassword=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.setPassword(e)]})})},e.prototype.isUsernameRegistered=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return"string"!=typeof e&&Ld(Ed,"username must be a string"),[4,this.oauthInstance.authApi.checkIfUserExist({username:e})];case 1:return[2,t.sent().exist]}})})},e.prototype.hasLoginState=function(){var e;if("async"!==this.cache.mode)return(null===(e=this.oauthInstance)||void 0===e?void 0:e.authApi.hasLoginStateSync())?new ip({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;qd(Od,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return Xf(this,void 0,void 0,function(){var e;return ep(this,function(t){switch(t.label){case 0:e=null,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.oauthInstance.authApi.getLoginState()];case 2:return e=t.sent(),[3,4];case 3:return t.sent(),[2,null];case 4:return e?[2,new ip({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}})})},e.prototype.getUserInfo=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.getCurrentUser()]})})},e.prototype.getWedaUserInfo=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]})})},e.prototype.updateUserBasicInfo=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return[4,this.getLoginState()];case 1:return(t=r.sent())?[4,t.user.updateUserBasicInfo(e)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.getAuthHeader=function(){return console.error("Auth.getAuthHeader API 已废弃"),{}},e.prototype.bindWithProvider=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]})})},e.prototype.queryUser=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]})})},e.prototype.getAccessToken=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){switch(e.label){case 0:return[4,this.oauthInstance.oauth2client.getAccessToken()];case 1:return[2,{accessToken:e.sent(),env:this.config.env}]}})})},e.prototype.grantProviderToken=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]})})},e.prototype.patchProviderToken=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]})})},e.prototype.signInWithProvider=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithProvider(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},e.prototype.signInWithWechat=function(e){return void 0===e&&(e={}),Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.signInWithWechat(e)];case 1:return t.sent(),[2,this.createLoginState(e)]}})})},e.prototype.grantToken=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.grantToken(e)];case 1:return t.sent(),[2,this.createLoginState()]}})})},e.prototype.genProviderRedirectUri=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]})})},e.prototype.resetPassword=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]})})},e.prototype.deviceAuthorize=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]})})},e.prototype.sudo=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.sudo(e)]})})},e.prototype.deleteMe=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]})})},e.prototype.getProviders=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getProviders()]})})},e.prototype.loginScope=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.loginScope()]})})},e.prototype.loginGroups=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.loginGroups()]})})},e.prototype.onLoginStateChanged=function(e){var t;return Xf(this,void 0,void 0,function(){var r,n=this;return ep(this,function(o){switch(o.label){case 0:return null===(t=this.config.eventBus)||void 0===t||t.on(sd,function(t){return Xf(n,void 0,void 0,function(){var r,n,o;return ep(this,function(i){switch(i.label){case 0:return(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.eventType)===Zh?[3,2]:[4,this.getLoginState()];case 1:return n=i.sent(),[3,3];case 2:n={},i.label=3;case 3:return r=n,e.call(this,Jf(Jf({},t),r)),[2]}})})}),[4,this.getLoginState()];case 1:return r=o.sent(),e.call(this,r),[2]}})})},e.prototype.refreshTokenForce=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]})})},e.prototype.getCredentials=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getCredentials()]})})},e.prototype.setCredentials=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.oauth2client.setCredentials(e)];case 1:return t.sent(),[2]}})})},e.prototype.getProviderSubType=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]})})},e.prototype.createCaptchaData=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]})})},e.prototype.verifyCaptchaData=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]})})},e.prototype.getMiniProgramQrCode=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]})})},e.prototype.getMiniProgramQrCodeStatus=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]})})},e.prototype.modifyPassword=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]})})},e.prototype.modifyPasswordWithoutLogin=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.modifyPasswordWithoutLogin(e)]})})},e.prototype.getUserBehaviorLog=function(e){return Xf(this,void 0,void 0,function(){return ep(this,function(t){return[2,this.oauthInstance.authApi.getUserBehaviorLog(e)]})})},e.prototype.signInWithUsername=function(e){var t=e.verificationInfo,r=void 0===t?{verification_id:"",is_user:!1}:t,n=e.verificationCode,o=void 0===n?"":n,i=e.username,s=void 0===i?"":i,a=e.bindInfo,u=void 0===a?void 0:a,c=e.loginType,l=void 0===c?"":c;return Xf(this,void 0,void 0,function(){var e,t,n,i,a,c,h;return ep(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.oauthInstance.authApi.verify({verification_id:r.verification_id,verification_code:o})];case 1:if(null==(e=d.sent())?void 0:e.error_code)throw e;return t=e.verification_token,n=/^\+\d{1,3}\s+/.test(s)?s:"+86 ".concat(s),i={phone_number:n},"email"===l&&(i={email:n=s}),r.is_user?[4,this.oauthInstance.authApi.signIn({username:n,verification_token:t})]:[3,5];case 2:if(null==(a=d.sent())?void 0:a.error_code)throw a;return u?[4,this.oauthInstance.authApi.bindWithProvider({provider_token:null==u?void 0:u.providerToken})]:[3,4];case 3:if(null==(c=d.sent())?void 0:c.error_code)throw c;d.label=4;case 4:return[3,7];case 5:return[4,this.oauthInstance.authApi.signUp(Jf(Jf({},i),{verification_token:t,provider_token:null==u?void 0:u.providerId}))];case 6:if(null==(h=d.sent())?void 0:h.error_code)throw h;d.label=7;case 7:return[2,this.createLoginState()];case 8:throw d.sent();case 9:return[2]}})})},e.prototype.createLoginState=function(e,t){var r,n;return Xf(this,void 0,void 0,function(){var o;return ep(this,function(i){switch(i.label){case 0:return[4,(o=new ip({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})).checkLocalStateAsync()];case 1:return i.sent(),(null==t?void 0:t.userInfo)?(o.user.setLocalUserInfo(t.userInfo),[3,5]):[3,2];case 2:return(null==t?void 0:t.asyncRefreshUser)?(o.user.refresh(e),[3,5]):[3,3];case 3:return[4,o.user.refresh(e)];case 4:i.sent(),i.label=5;case 5:return null===(r=this.config.eventBus)||void 0===r||r.fire(sd,{eventType:$h}),null===(n=this.config.eventBus)||void 0===n||n.fire(ad,{event:ed}),[2,o]}})})},e.prototype.setAccessKey=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){if(this.config.accessKey)try{this.oauthInstance.oauth2client.setAccessKeyCredentials({access_token:this.config.accessKey,token_type:"Bearer",scope:"accessKey",expires_at:new Date(+new Date+ +new Date),expires_in:+new Date+ +new Date})}catch(e){console.warn("accessKey error: ",e)}return[2]})})},e.prototype.signInAnonymously=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.oauthInstance.authApi.signInAnonymously(e)];case 1:return i.sent(),[4,this.createLoginState()];case 2:return t=i.sent(),[4,this.getSession()];case 3:return r=i.sent().data,n=(void 0===r?{}:r).session,[2,Jf(Jf({},t),{data:{user:n.user,session:n},error:null})];case 4:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 5:return[2]}})})},e.prototype.signUp=function(e){return Xf(this,void 0,void 0,function(){var t,r,n=this;return ep(this,function(o){switch(o.label){case 0:return e.phone_number||e.verification_code||e.verification_token||e.provider_token?[4,this.oauthInstance.authApi.signUp(e)]:[3,2];case 1:return o.sent(),[2,this.createLoginState()];case 2:return o.trys.push([2,4,,5]),this.validateAtLeastOne(e,[["email"],["phone"]],"You must provide either an email or phone number"),[4,this.getVerification(e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)})];case 3:return t=o.sent(),[2,{data:{verifyOtp:function(r){var o=r.token,i=r.messageId,s=void 0===i?t.verification_id:i;return Xf(n,void 0,void 0,function(){var r,n,i,a,u;return ep(this,function(c){switch(c.label){case 0:return c.trys.push([0,8,,9]),[4,this.verify({verification_id:s||t.verification_id,verification_code:o})];case 1:return r=c.sent(),t.is_user?[4,this.signIn({username:e.email||this.formatPhone(e.phone),verification_token:r.verification_token})]:[3,3];case 2:return c.sent(),[3,6];case 3:return delete(n=JSON.parse(JSON.stringify(e))).email,delete n.phone,[4,this.oauthInstance.authApi.signUp(Jf(Jf(Jf({},n),e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)}),{verification_token:r.verification_token,verification_code:o}))];case 4:return c.sent(),[4,this.createLoginState()];case 5:c.sent(),c.label=6;case 6:return[4,this.getSession()];case 7:return i=c.sent().data,[2,{data:{user:(a=(void 0===i?{}:i).session).user,session:a},error:null}];case 8:return u=c.sent(),[2,{data:{},error:new xf(u)}];case 9:return[2]}})})}},error:null}];case 4:return r=o.sent(),[2,{data:{},error:new xf(r)}];case 5:return[2]}})})},e.prototype.signOut=function(e){var t,r;return Xf(this,void 0,void 0,function(){var n,o,i;return ep(this,function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),n=this.cache.keys.userInfoKey,[4,this.oauthInstance.authApi.signOut(e)];case 1:return o=s.sent(),[4,this.cache.removeStoreAsync(n)];case 2:return s.sent(),this.setAccessKey(),null===(t=this.config.eventBus)||void 0===t||t.fire(sd,{eventType:Jh}),null===(r=this.config.eventBus)||void 0===r||r.fire(ad,{event:Xh}),[2,Jf(Jf({},o),{data:{},error:null})];case 3:return i=s.sent(),[2,{data:{},error:new xf(i)}];case 4:return[2]}})})},e.prototype.onAuthStateChange=function(e){var t=this;this.hasListenerSetUp||(this.setupListeners(),this.hasListenerSetUp=!0);var r=Math.random().toString(36);return this.listeners.has(r)||this.listeners.set(r,new Set),this.listeners.get(r).add(e),{data:{subscription:{id:r,callback:e,unsubscribe:function(){var n=t.listeners.get(r);n&&(n.delete(e),0===n.size&&t.listeners.delete(r))}}}}},e.prototype.signInWithPassword=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.validateAtLeastOne(e,[["username"],["email"],["phone"]],"You must provide either username, email, or phone"),this.validateParams(e,{password:{required:!0,message:"Password is required"}}),[4,this.signIn(Jf({username:e.username||e.email||this.formatPhone(e.phone),password:e.password},e.is_encrypt?{isEncrypt:!0,version:"v2"}:{}))];case 1:return o.sent(),[4,this.getSession()];case 2:return t=o.sent().data,[2,{data:{user:(r=(void 0===t?{}:t).session).user,session:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.signInWithIdToken=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),this.validateParams(e,{token:{required:!0,message:"Token is required"}}),[4,this.signInWithProvider({provider_token:e.token})];case 1:return o.sent(),[4,this.getSession()];case 2:return t=o.sent().data,[2,{data:{user:(r=(void 0===t?{}:t).session).user,session:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.signInWithOtp=function(e){return Xf(this,void 0,void 0,function(){var t,r,n=this;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.validateAtLeastOne(e,[["email"],["phone"]],"You must provide either an email or phone number"),[4,this.getVerification(e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)})];case 1:return t=o.sent(),[2,{data:{user:null,session:null,verifyOtp:function(r){var o=r.token,i=r.messageId,s=void 0===i?t.verification_id:i;return Xf(n,void 0,void 0,function(){return ep(this,function(t){return[2,this.verifyOtp({email:e.email,phone:e.phone,token:o,messageId:s})]})})}},error:null}];case 2:return r=o.sent(),[2,{data:{},error:new xf(r)}];case 3:return[2]}})})},e.prototype.verifyOAuth=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o,i,s,a,u,c;return ep(this,function(l){switch(l.label){case 0:t={},l.label=1;case 1:return l.trys.push([1,7,,8]),r=(null==e?void 0:e.code)||Ud("code"),n=(null==e?void 0:e.state)||Ud("state"),r?n?(o=function(e){try{return JSON.parse(sessionStorage.getItem(e))}catch(e){return console.error("Failed to get browser session:",e),null}}(n),t.type=null==o?void 0:o.type,(i=(null==e?void 0:e.provider)||(null==o?void 0:o.provider)||Ud("provider"))?[4,this.grantProviderToken({provider_id:i,provider_redirect_uri:location.origin+location.pathname,provider_code:r})]:[2,{data:t,error:new xf({message:"Provider is required"})}]):[2,{data:{},error:new xf({message:"State is required"})}]:[2,{data:{},error:new xf({message:"Code is required"})}];case 2:return s=l.sent().provider_token,a=void 0,o.type!==cd?[3,4]:[4,this.oauthInstance.authApi.toBindIdentity({provider_token:s,provider:i,fireEvent:!0})];case 3:return a=l.sent(),[3,6];case 4:return[4,this.signInWithIdToken({token:s})];case 5:(a=l.sent()).data=Jf(Jf({},t),a.data),l.label=6;case 6:return(u=new URLSearchParams(null===location||void 0===location?void 0:location.search)).delete("code"),u.delete("state"),function(e,t){if(void 0!==e){var r=new URL(window.location.href);r.search=e,r.hash=t||r.hash,window.history.replaceState({},"",r.href)}}(void 0===(null==o?void 0:o.search)?"?".concat(u.toString()):null==o?void 0:o.search,(null==o?void 0:o.hash)||location.hash),function(e){try{return sessionStorage.removeItem(e),!0}catch(e){return console.error("Failed to remove browser session:",e),null}}(n),[2,a];case 7:return c=l.sent(),[2,{data:t,error:new xf(c)}];case 8:return[2]}})})},e.prototype.signInWithOAuth=function(e){var t,r,n,o,i;return Xf(this,void 0,void 0,function(){var s,a,u,c,l,h,d,f,p;return ep(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:"Provider is required"}}),s=(null===(t=e.options)||void 0===t?void 0:t.redirectTo)||location.href,a=new URL(s),u=a.origin+a.pathname,c=(null===(r=e.options)||void 0===r?void 0:r.state)||"prd-".concat(e.provider,"-").concat(Math.random().toString(36).slice(2)),[4,this.genProviderRedirectUri({provider_id:e.provider,provider_redirect_uri:u,state:c})];case 1:return l=v.sent().uri,h=decodeURIComponent(l),d=h,(null===(n=e.options)||void 0===n?void 0:n.queryParams)&&(f=new URL(h),Object.entries(e.options.queryParams).forEach(function(e){var t=e[0],r=e[1];f.searchParams.set(t,r)}),d=f.toString()),function(e,t){try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){console.error("Failed to save to browser session:",e)}}(c,{provider:e.provider,search:a.search,hash:a.hash,type:(null===(o=e.options)||void 0===o?void 0:o.type)||ud}),rp()&&!(null===(i=e.options)||void 0===i?void 0:i.skipBrowserRedirect)&&window.location.assign(d),[2,{data:{url:d,provider:e.provider},error:null}];case 2:return p=v.sent(),[2,{data:{},error:new xf(p)}];case 3:return[2]}})})},e.prototype.signInWithSSO=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2]})})},e.prototype.signInWithWeb3=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2]})})},e.prototype.getClaims=function(){return Xf(this,void 0,void 0,function(){var e,t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getAccessToken()];case 1:return e=n.sent().accessToken,t=function(e){if("string"!=typeof e)throw new Error("Invalid token specified");try{const t=e.split(".").map((e,t)=>2===t?e:JSON.parse(bd(e)));return{claims:t[1],header:t[0],signature:t[2]}}catch(e){throw new Error("Invalid token specified: ".concat(e)?e.message:"")}}(e),[2,{data:t,error:null}];case 2:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 3:return[2]}})})},e.prototype.resetPasswordForEmail=function(e,t){return Xf(this,void 0,void 0,function(){var r,n,o,i,s,a,u=this;return ep(this,function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),this.validateParams({emailOrPhone:e},{emailOrPhone:{required:!0,message:"Email or phone is required"}}),r=(t||{}).redirectTo,n=e.includes("@"),o=void 0,n?o={email:e}:(i=this.formatPhone(e),o={phone_number:i}),[4,this.getVerification(o)];case 1:return s=c.sent(),[2,{data:{updateUser:function(t){return Xf(u,void 0,void 0,function(){var o,i,a,u;return ep(this,function(c){switch(c.label){case 0:this.validateParams(t,{nonce:{required:!0,message:"Nonce is required"},password:{required:!0,message:"Password is required"}}),c.label=1;case 1:return c.trys.push([1,5,,6]),[4,this.verify({verification_id:s.verification_id,verification_code:t.nonce})];case 2:return o=c.sent(),[4,this.oauthInstance.authApi.resetPassword({email:n?e:void 0,phone:n?void 0:e,new_password:t.password,verification_token:o.verification_token})];case 3:return c.sent(),null===(u=this.config.eventBus)||void 0===u||u.fire(ad,{event:rd}),[4,this.signInWithPassword({email:n?e:void 0,phone:n?void 0:e,password:t.password})];case 4:return i=c.sent(),r&&rp()&&window.location.assign(r),[2,i];case 5:return a=c.sent(),[2,{data:{},error:new xf(a)}];case 6:return[2]}})})}},error:null}];case 2:return a=c.sent(),[2,{data:{},error:new xf(a)}];case 3:return[2]}})})},e.prototype.resetPasswordForOld=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.oauthInstance.authApi.updatePasswordByOld({old_password:e.old_password,new_password:e.new_password})];case 1:return o.sent(),[4,this.getSession()];case 2:return t=o.sent().data,[2,{data:{user:(r=(void 0===t?{}:t).session).user,session:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.verifyOtp=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,6,,7]),t=e.type,this.validateParams(e,{token:{required:!0,message:"Token is required"},messageId:{required:!0,message:"messageId is required"}}),["phone_change","email_change"].includes(t)?[4,this.verify({verification_id:e.messageId,verification_code:e.token})]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,this.signInWithUsername({verificationInfo:{verification_id:e.messageId,is_user:!0},verificationCode:e.token,username:e.email||this.formatPhone(e.phone)||"",loginType:e.email?"email":"phone"})];case 3:i.sent(),i.label=4;case 4:return[4,this.getSession()];case 5:return r=i.sent().data,[2,{data:{user:(n=(void 0===r?{}:r).session).user,session:n},error:null}];case 6:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 7:return[2]}})})},e.prototype.getSession=function(){return Xf(this,void 0,void 0,function(){var e,t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),[4,this.oauthInstance.oauth2client.getCredentials()];case 1:return(e=o.sent())&&"accessKey"!==e.scope?[4,this.getUser()]:[2,{data:{session:null},error:null}];case 2:return t=o.sent().data,r=(void 0===t?{}:t).user,[2,{data:{session:Jf(Jf({},e),{user:r}),user:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.refreshSession=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o,i;return ep(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,5]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return(t=s.sent()).refresh_token=e||t.refresh_token,[4,this.oauthInstance.oauth2client.refreshToken(t)];case 2:return r=s.sent(),[4,this.getUser()];case 3:return n=s.sent().data,[2,{data:{user:o=(void 0===n?{}:n).user,session:Jf(Jf({},r),{user:o})},error:null}];case 4:return i=s.sent(),[2,{data:{},error:new xf(i)}];case 5:return[2]}})})},e.prototype.getUser=function(){return Xf(this,void 0,void 0,function(){var e,t;return ep(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),e=this.convertToUser,[4,this.getUserInfo()];case 1:return[2,{data:{user:e.apply(this,[r.sent()])},error:null}];case 2:return t=r.sent(),[2,{data:{},error:new xf(t)}];case 3:return[2]}})})},e.prototype.refreshUser=function(){return Xf(this,void 0,void 0,function(){var e,t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),[4,this.currentUser.refresh()];case 1:return n.sent(),[4,this.getSession()];case 2:return e=n.sent().data,[2,{data:{user:(t=(void 0===e?{}:e).session).user,session:t},error:null}];case 3:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 4:return[2]}})})},e.prototype.updateUser=function(e){var t;return Xf(this,void 0,void 0,function(){var r,n,o,i,s,a,u,c,l,h,d,f,p=this;return ep(this,function(v){switch(v.label){case 0:if(v.trys.push([0,8,,9]),!Object.keys(e).some(function(t){return void 0!==e[t]&&null!==e[t]&&""!==e[t]}))throw new xf({message:"At least one field must be provided for update"});return r=e.email,n=e.phone,o=tp(e,["email","phone"]),s=void 0!==n,a={},(i=void 0!==r)||s?(u=void 0,i?(u={email:e.email},c="email_change"):(l=this.formatPhone(e.phone),u={phone_number:l},c="phone_change"),[4,this.getVerification(u)]):[3,4];case 1:return h=v.sent(),Object.keys(o).length>0?[4,this.updateUserBasicInfo(o)]:[3,3];case 2:v.sent(),v.label=3;case 3:return a={messageId:h.verification_id,verifyOtp:function(t){return Xf(p,void 0,void 0,function(){var r,n,o;return ep(this,function(s){switch(s.label){case 0:return s.trys.push([0,11,,12]),t.email&&e.email===t.email?[4,this.verifyOtp({type:"email_change",email:e.email,token:t.token,messageId:h.verification_id})]:[3,3];case 1:return s.sent(),[4,this.updateUserBasicInfo({email:e.email})];case 2:return s.sent(),[3,9];case 3:return t.phone&&e.phone===t.phone?[4,this.verifyOtp({type:"phone_change",phone:e.phone,token:t.token,messageId:h.verification_id})]:[3,6];case 4:return s.sent(),[4,this.updateUserBasicInfo({phone:this.formatPhone(e.phone)})];case 5:return s.sent(),[3,9];case 6:return[4,this.verifyOtp({type:c,email:i?e.email:void 0,phone:i?void 0:e.phone,token:t.token,messageId:h.verification_id})];case 7:return s.sent(),[4,this.updateUserBasicInfo(e)];case 8:s.sent(),s.label=9;case 9:return[4,this.getUser()];case 10:return r=s.sent().data.user,null===(o=this.config.eventBus)||void 0===o||o.fire(ad,{event:od}),[2,{data:{user:r},error:null}];case 11:return n=s.sent(),[2,{data:{},error:new xf(n)}];case 12:return[2]}})})}},[3,6];case 4:return[4,this.updateUserBasicInfo(e)];case 5:v.sent(),v.label=6;case 6:return[4,this.getUser()];case 7:return d=v.sent().data.user,null===(t=this.config.eventBus)||void 0===t||t.fire(ad,{event:od}),[2,{data:Jf({user:d},a),error:null}];case 8:return f=v.sent(),[2,{data:{},error:new xf(f)}];case 9:return[2]}})})},e.prototype.getUserIdentities=function(){var e;return Xf(this,void 0,void 0,function(){var t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.oauthInstance.authApi.getProviders()];case 1:return t=n.sent(),[2,{data:{identities:null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.filter(function(e){return!!e.bind})},error:null}];case 2:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 3:return[2]}})})},e.prototype.linkIdentity=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:"Provider is required"}}),[4,this.signInWithOAuth({provider:e.provider,options:{type:cd}})];case 1:return r.sent(),[2,{data:{provider:e.provider},error:null}];case 2:return t=r.sent(),[2,{data:{},error:new xf(t)}];case 3:return[2]}})})},e.prototype.unlinkIdentity=function(e){return Xf(this,void 0,void 0,function(){var t;return ep(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.validateParams(e,{provider:{required:!0,message:"Provider is required"}}),[4,this.oauthInstance.authApi.unbindProvider({provider_id:e.provider})];case 1:return r.sent(),[2,{data:{},error:null}];case 2:return t=r.sent(),[2,{data:{},error:new xf(t)}];case 3:return[2]}})})},e.prototype.reauthenticate=function(){return Xf(this,void 0,void 0,function(){var e,t,r,n,o=this;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.getUser()];case 1:return e=i.sent().data.user,this.validateAtLeastOne(e,[["email","phone"]],"You must provide either an email or phone number"),t=e.email?{email:e.email}:{phone_number:this.formatPhone(e.phone)},[4,this.getVerification(t)];case 2:return r=i.sent(),[2,{data:{updateUser:function(e){return Xf(o,void 0,void 0,function(){var n,o,i,s,a;return ep(this,function(u){switch(u.label){case 0:this.validateParams(e,{nonce:{required:!0,message:"Nonce is required"}}),u.label=1;case 1:return u.trys.push([1,9,,10]),e.password?[4,this.verify({verification_id:r.verification_id,verification_code:e.nonce})]:[3,5];case 2:return n=u.sent(),[4,this.oauthInstance.authApi.sudo({verification_token:n.verification_token})];case 3:return o=u.sent(),[4,this.oauthInstance.authApi.setPassword({new_password:e.password,sudo_token:o.sudo_token})];case 4:return u.sent(),[3,7];case 5:return[4,this.signInWithUsername(Jf(Jf({verificationInfo:r,verificationCode:e.nonce},t),{loginType:t.email?"email":"phone"}))];case 6:u.sent(),u.label=7;case 7:return[4,this.getSession()];case 8:return i=u.sent().data,[2,{data:{user:(s=(void 0===i?{}:i).session).user,session:s},error:null}];case 9:return a=u.sent(),[2,{data:{},error:new xf(a)}];case 10:return[2]}})})}},error:null}];case 3:return n=i.sent(),[2,{data:{},error:new xf(n)}];case 4:return[2]}})})},e.prototype.resend=function(e){return Xf(this,void 0,void 0,function(){var t,r,n;return ep(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.validateAtLeastOne(e,[["email"],["phone"]],"You must provide either an email or phone number"),t="signup"===e.type?"ANY":"USER",r={target:t},"email"in e&&(r.email=e.email),"phone"in e&&(r.phone_number=this.formatPhone(e.phone)),[4,this.oauthInstance.authApi.getVerification(r)];case 1:return[2,{data:{messageId:o.sent().verification_id},error:null}];case 2:return n=o.sent(),[2,{data:{},error:new xf(n)}];case 3:return[2]}})})},e.prototype.setSession=function(e){var t;return Xf(this,void 0,void 0,function(){var r,n,o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),this.validateParams(e,{access_token:{required:!0,message:"Access token is required"},refresh_token:{required:!0,message:"Refresh token is required"}}),[4,this.oauthInstance.oauth2client.refreshToken(e,{throwOnError:!0})];case 1:return i.sent(),[4,this.getSession()];case 2:return r=i.sent().data,n=(void 0===r?{}:r).session,null===(t=this.config.eventBus)||void 0===t||t.fire(ad,{event:ed}),[2,{data:{user:n.user,session:n},error:null}];case 3:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 4:return[2]}})})},e.prototype.exchangeCodeForSession=function(){return Xf(this,void 0,void 0,function(){return ep(this,function(e){return[2]})})},e.prototype.deleteUser=function(e){return Xf(this,void 0,void 0,function(){var t,r;return ep(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),this.validateParams(e,{password:{required:!0,message:"Password is required"}}),[4,this.oauthInstance.authApi.sudo(e)];case 1:return t=n.sent().sudo_token,[4,this.oauthInstance.authApi.deleteMe({sudo_token:t})];case 2:return n.sent(),[2,{data:{},error:null}];case 3:return r=n.sent(),[2,{data:{},error:new xf(r)}];case 4:return[2]}})})},e.prototype.toDefaultLoginPage=function(e){return void 0===e&&(e={}),Xf(this,void 0,void 0,function(){var t,r,n,o,i;return ep(this,function(s){try{return t=e.config_version||"env",r=Object.keys(e.query||{}).map(function(t){return"".concat(t,"=").concat(e.query[t])}).join("&"),Wf.isMatch()?wx.navigateTo({url:"/packages/$wd_system/pages/login/index".concat(r?"?".concat(r):"")}):(n=e.redirect_uri||window.location.href,o=new URL(n),i="".concat(o.origin,"/__auth/?app_id=").concat(e.app_id||"","&env_id=").concat(this.config.env,"&client_id=").concat(this.config.clientId||this.config.env,"&config_version=").concat(t,"&redirect_uri=").concat(encodeURIComponent(n)).concat(r?"&".concat(r):""),window.location.href=i),[2,{data:{},error:null}]}catch(e){return[2,{data:{},error:new xf(e)}]}return[2]})})},e.prototype.signInWithCustomTicket=function(e){return Xf(this,void 0,void 0,function(){var t,r,n,o;return ep(this,function(i){switch(i.label){case 0:e&&this.setCustomSignFunc(e),i.label=1;case 1:return i.trys.push([1,5,,6]),[4,this.oauthInstance.authApi.signInWithCustomTicket()];case 2:return i.sent(),[4,this.createLoginState()];case 3:return t=i.sent(),[4,this.getSession()];case 4:return r=i.sent().data,n=(void 0===r?{}:r).session,[2,Jf(Jf({},t),{data:{user:n.user,session:n},error:null})];case 5:return o=i.sent(),[2,{data:{},error:new xf(o)}];case 6:return[2]}})})},e.prototype.signInWithOpenId=function(e){var t=(void 0===e?{}:e).useWxCloud,r=void 0===t||t;return Xf(this,void 0,void 0,function(){var e,t,n,o,i,s,a=this;return ep(this,function(u){switch(u.label){case 0:if(!Wf.isMatch())throw Error("wx api undefined");e=wx.getAccountInfoSync().miniProgram,t=function(t){return Xf(a,void 0,void 0,function(){var n,o;return ep(this,function(i){switch(i.label){case 0:n=void 0,o=void 0,i.label=1;case 1:return i.trys.push([1,4,,5]),[4,this.oauthInstance.authApi.grantProviderToken({provider_id:null==e?void 0:e.appId,provider_code:t,provider_params:{provider_code_type:"open_id",appid:null==e?void 0:e.appId}},r)];case 2:if((null==(n=i.sent())?void 0:n.error_code)||!n.provider_token)throw n;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:n.provider_token},r)];case 3:if(null==(o=i.sent())?void 0:o.error_code)throw o;return[3,5];case 4:throw i.sent();case 5:return[4,this.oauthInstance.oauth2client.setCredentials(o)];case 6:return i.sent(),[2]}})})},u.label=1;case 1:return u.trys.push([1,5,,6]),[4,new Promise(function(e,r){wx.login({success:function(n){return Xf(a,void 0,void 0,function(){var o;return ep(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,t(n.code)];case 1:return i.sent(),e(!0),[3,3];case 2:return o=i.sent(),r(o),[3,3];case 3:return[2]}})})},fail:function(e){var t=new Error(null==e?void 0:e.errMsg);t.code=null==e?void 0:e.errno,r(t)}})})];case 2:return u.sent(),[4,this.createLoginState()];case 3:return n=u.sent(),[4,this.getSession()];case 4:return o=u.sent().data,i=(void 0===o?{}:o).session,[2,Jf(Jf({},n),{data:{user:i.user,session:i},error:null})];case 5:return s=u.sent(),[2,{data:{},error:new xf(s)}];case 6:return[2]}})})},e.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,r=void 0===t?"":t;return Xf(this,void 0,void 0,function(){var e,t,n,o,i,s,a,u,c;return ep(this,function(l){switch(l.label){case 0:return Wf.isMatch()?(e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:"phone"},provider_id:e.appId},[4,wx.login()]):[2,{data:{},error:new xf({message:"wx api undefined"})}];case 1:n=l.sent().code,t.provider_code=n,l.label=2;case 2:return l.trys.push([2,6,,7]),[4,this.oauthInstance.authApi.grantProviderToken(t)];case 3:if((o=l.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.patchProviderToken({provider_token:o.provider_token,provider_id:e.appId,provider_params:{code:r,provider_code_type:"phone"}})];case 4:if((o=l.sent()).error_code)throw o;return[4,this.oauthInstance.authApi.signInWithProvider({provider_token:o.provider_token})];case 5:if(null==(i=l.sent())?void 0:i.error_code)throw i;return[3,7];case 6:return s=l.sent(),[2,{data:{},error:new xf(s)}];case 7:return[4,this.createLoginState()];case 8:return a=l.sent(),[4,this.getSession()];case 9:return u=l.sent().data,c=(void 0===u?{}:u).session,[2,Jf(Jf({},a),{data:{user:c.user,session:c},error:null})]}})})},e.prototype.formatPhone=function(e){return!/\s+/.test(e)&&/^\+\d{1,3}\d+/.test(e)?e.replace(/^(\+\d{1,2})(\d+)$/,"$1 $2"):/^\+\d{1,3}\s+/.test(e)?e:"+86 ".concat(e)},e.prototype.notifyListeners=function(e,t,r){this.listeners.forEach(function(n){n.forEach(function(n){try{n(e,t,r)}catch(e){console.error("Error in auth state change callback:",e)}})})},e.prototype.setupListeners=function(){var e,t=this;null===(e=this.config.eventBus)||void 0===e||e.on(ad,function(e){return Xf(t,void 0,void 0,function(){var t,r,n,o,i;return ep(this,function(s){switch(s.label){case 0:return t=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.event,r=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.info,[4,this.getSession()];case 1:return n=s.sent().data.session,this.notifyListeners(t,n,r),[2]}})})})},e.prototype.convertToUser=function(e){var t,r,n;if(!e)return null;var o=(null==e?void 0:e.email)||"",i=(null==e?void 0:e.phone_number)||"",s=(null==e?void 0:e.sub)||(null==e?void 0:e.uid)||"";return{id:s,aud:"authenticated",role:e.groups,email:o||"",email_confirmed_at:(null==e||e.email_verified,e.created_at),phone:i,phone_confirmed_at:i?e.created_at:void 0,confirmed_at:e.created_at,last_sign_in_at:e.last_sign_in_at,app_metadata:{provider:(null===(t=e.loginType)||void 0===t?void 0:t.toLowerCase())||"cloudbase",providers:[(null===(r=e.loginType)||void 0===r?void 0:r.toLowerCase())||"cloudbase"]},user_metadata:{name:null==e?void 0:e.name,picture:null==e?void 0:e.picture,username:null==e?void 0:e.username,gender:null==e?void 0:e.gender,locale:null==e?void 0:e.locale,uid:e.uid,nickName:e.nickName,avatarUrl:e.avatarUrl||e.picture,location:e.location,hasPassword:e.hasPassword},identities:(null===(n=null==e?void 0:e.providers)||void 0===n?void 0:n.map(function(t){return{id:t.id||"",identity_id:t.id||"",user_id:s,identity_data:{provider_id:t.id,provider_user_id:t.provider_user_id,name:t.name},provider:t.id||"cloudbase",created_at:e.created_at,updated_at:e.updated_at,last_sign_in_at:e.last_sign_in_at}}))||[],created_at:e.created_at,updated_at:e.updated_at,is_anonymous:"anonymous"===e.name}},e.prototype.validateParams=function(e,t){for(var r=0,n=Object.entries(t);r<n.length;r++){var o=n[r],i=o[0],s=o[1];if(s.required&&(void 0===(null==e?void 0:e[i])||null===(null==e?void 0:e[i])||""===(null==e?void 0:e[i])))throw new xf({message:s.message})}},e.prototype.validateAtLeastOne=function(e,t,r){if(!t.some(function(t){return t.some(function(t){return void 0!==(null==e?void 0:e[t])&&null!==(null==e?void 0:e[t])&&""!==(null==e?void 0:e[t])})}))throw new xf({message:r})},e.prototype.init=function(){var e;return Xf(this,void 0,void 0,function(){return ep(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.oauthInstance.oauth2client.localCredentials.getCredentials()];case 1:return t.sent()&&(null===(e=this.config.eventBus)||void 0===e||e.fire(ad,{event:td})),[3,3];case 2:return t.sent(),[3,3];case 3:return[2,{error:null}]}})})},$f([uf({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"bindPhoneNumber",null),$f([uf({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"unbindProvider",null),$f([uf({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",void 0)],e.prototype,"bindEmail",null),$f([uf({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"verify",null),$f([uf({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object,Object]),Zf("design:returntype",Promise)],e.prototype,"getVerification",null),$f([uf({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getCurrentUser",null),$f([uf({title:"小程序匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymouslyInWx() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"signInAnonymouslyInWx",null),$f([uf({title:"小程序绑定OpenID失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序openId静默登录"," 2 - 调用 auth().bindOpenId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"bindOpenId",null),$f([uf({title:"小程序unionId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序unionId静默登录"," 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"signInWithUnionId",null),$f([uf({title:"短信验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序短信验证码登陆"," 2 - 调用 auth().signInWithSms() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"signInWithSms",null),$f([uf({title:"邮箱验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了邮箱登陆"," 2 - 调用 auth().signInWithEmail() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"signInWithEmail",null),$f([uf({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[String]),Zf("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),$f([uf({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getLoginState",null),$f([uf({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getUserInfo",null),$f([uf({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getWedaUserInfo",null),$f([uf({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[Object]),Zf("design:returntype",Promise)],e.prototype,"bindWithProvider",null),$f([uf({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Pd)]}),Zf("design:type",Function),Zf("design:paramtypes",[]),Zf("design:returntype",Promise)],e.prototype,"getProviderSubType",null),e}();function ap(e,t){var r=this,n=e.region,o=void 0===n?"ap-shanghai":n,i=e.i18n,s=e.accessKey,a=e.useWxCloud,u=(null==t?void 0:t.platform)||zd.bind(t)(),c=u.runtime,l=u.adapter,h=t||{},d=h.env,f=h.clientId,p=h.debug,v=h.cache,g=h.app,m=(t||{}).apiOrigin;m||(m="https://".concat(d,".").concat(o,".tcb-api.tencentcloudapi.com"));var y={env:d,clientId:f,i18n:i,accessKey:s,useWxCloud:a,eventBus:new ef},b=new Bf(Qf(Jf(Jf({},y),{apiOrigin:m,apiPath:(null==e?void 0:e.apiPath)||Vh,storage:null==e?void 0:e.storage,baseRequest:null==e?void 0:e.baseRequest,request:null==e?void 0:e.request,anonymousSignInFunc:null==e?void 0:e.anonymousSignInFunc,captchaOptions:null==e?void 0:e.captchaOptions,wxCloud:null==e?void 0:e.wxCloud,adapter:l,onCredentialsError:np(y.eventBus),headers:Jf({"X-SDK-Version":"@cloudbase/js-sdk/".concat(e.sdkVersion)},e.headers||{}),detectSessionInUrl:e.detectSessionInUrl,debug:p}))),_=new sp(Jf(Jf({},y),{region:o,persistence:e.persistence,debug:p,cache:v||new Qd({persistence:e.persistence,keys:{userInfoKey:"user_info_".concat(d)},platformInfo:u}),runtime:c||"web",_fromApp:g,oauthInstance:b}));return b.initializeSession(function(e,t){return Xf(r,void 0,void 0,function(){return ep(this,function(r){return e?(e.type===ud?t?y.eventBus.fire(ad,{event:ed,info:Jf(Jf({},e),{error:t})}):e.user&&_.createLoginState({},{userInfo:e.user}):e.type===cd&&y.eventBus.fire(ad,{event:id,info:Jf(Jf({},e),{error:t})}),[2]):[2]})})}),{authInstance:_,oauthInstance:b}}var up="auth",cp={name:"auth",namespace:up,entity:function(e){var t=function(e){var t;if(this.authInstance&&!e)return this.authInstance;e=e||{region:"",persistence:"local",apiPath:Vh};var r=this.platform.adapter,n=e.persistence||r.primaryStorage;n&&n!==this.config.persistence&&this.updateConfig({persistence:n});var o=ap(Jf(Jf({wxCloud:this.config.wxCloud,storage:this.config.storage},e),{persistence:this.config.persistence,i18n:this.config.i18n,accessKey:this.config.accessKey,useWxCloud:this.config.useWxCloud,sdkVersion:this.version,detectSessionInUrl:null===(t=this.config.auth)||void 0===t?void 0:t.detectSessionInUrl}),{env:this.config.env,clientId:this.config.clientId,apiOrigin:this.request.getBaseEndPoint(this.config.endPointMode||"CLOUD_API"),platform:this.platform,cache:this.cache,app:this,debug:this.config.debug}),i=o.authInstance,s=o.oauthInstance;return this.oauthInstance=s,this.authInstance=i,this.authInstance},r=t.call(this,e);return Object.assign(t,r),Object.setPrototypeOf(t,Object.getPrototypeOf(r)),this[up]=t,t}};try{cloudbase.registerComponent(cp)}catch(lf){}var lp=new Map;function hp(e,t){if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var r=e.callFunction.bind(e);return e.auth=function(e,t){var r,n,o;if(null==e?void 0:e.auth)return console.log("[Auth]: use cloud.auth"),e.auth;if(!(null==t?void 0:t.envId))return console.log("[Auth Error]: envId is required"),null;var i=lp.get(t.envId);if(i)return i;try{var s=(null===(r=null==t?void 0:t.adapter)||void 0===r?void 0:r.genAdapter)?t.adapter.genAdapter():null===(o=null===(n=[Wf].find(function(e){return e.isMatch()}))||void 0===n?void 0:n.genAdapter)||void 0===o?void 0:o.call(n,{}),a=ap({wxCloud:e,useWxCloud:!0},{clientId:null==t?void 0:t.envId,env:null==t?void 0:t.envId,platform:{runtime:"wx-client",adapter:s},apiOrigin:""}).authInstance;return lp.set(t.envId,a),{signInWithOpenId:a.signInWithOpenId.bind(a),updateUser:a.updateUser.bind(a),getUser:a.getUser.bind(a),getSession:a.getSession.bind(a),refreshSession:a.refreshSession.bind(a),signOut:a.signOut.bind(a)}}catch(e){return console.log("[Auth Error]:",e),null}}(e,n(n({},t),{envId:fp(e,null==t?void 0:t.envId)})),e.models=S(r,e),e.mysql=dp(e,{envId:null==t?void 0:t.envId}),e.rdb=dp(e,{envId:null==t?void 0:t.envId}),e}function dp(e,t){var r=null==t?void 0:t.envId,s=(null==t?void 0:t.mysqlBaseUrl)||pp(e,null==t?void 0:t.envId).mysql,a=null==t?void 0:t.fetch;return function(t){var u=this;return new Wh(s,{fetch:a||function(s,a){return o(u,0,void 0,function(){var o,u,l,h;return i(this,function(i){switch(i.label){case 0:return o=(null==t?void 0:t.instance)||"default",u=(null==t?void 0:t.database)||r,l={},(null==a?void 0:a.headers)instanceof Headers?a.headers.forEach(function(e,t){l[t]=e}):l=(null==a?void 0:a.headers)||{},[4,c(e)];case 1:return h=i.sent(),[2,e.callFunction({name:"httpOverCallFunction",data:{url:s.toString(),method:(null==a?void 0:a.method)||"GET",headers:n(n(n({},h?{Authorization:"Bearer ".concat(h)}:{}),l||{}),{"Content-Type":"application/json","X-Db-Instance":o,"Accept-Profile":u,"Content-Profile":u}),body:null==a?void 0:a.body}}).then(function(e){var t=null==e?void 0:e.result;return{ok:(null==t?void 0:t.statusCode)>=200&&(null==t?void 0:t.statusCode)<300,status:(null==t?void 0:t.statusCode)||200,statusText:(null==t?void 0:t.statusMessage)||"OK",json:function(){return Promise.resolve((null==t?void 0:t.body)||{})},text:function(){return Promise.resolve("string"==typeof(null==t?void 0:t.body)?t.body:JSON.stringify((null==t?void 0:t.body)||{}))},headers:new Headers((null==t?void 0:t.headers)||{})}})]}})})}})}}function fp(e,t){var r,n,o,i,s=t||(null===(n=null===(r=null==e?void 0:e.extend)||void 0===r?void 0:r.AI)||void 0===n?void 0:n.env);return"string"==typeof s&&s.trim()||(s=null===(o=null==e?void 0:e.config)||void 0===o?void 0:o.env),"string"==typeof s&&s.trim()||(s=null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.envName),"string"==typeof s&&s.trim()?s.trim():""}function pp(e,t){var r=fp(e,t);if(!r)throw new Error("Generating default gateway base url failed: env not found");return{model:"https://".concat(r,".api.tcloudbasegateway.com/v1/model"),sql:"https://".concat(r,".api.tcloudbasegateway.com/v1/sql"),mysql:"https://".concat(r,".api.tcloudbasegateway.com/v1/rdb/rest")}}var vp={init:hp,generateHTTPClient:y,generateMySQLClient:dp};let gp;if(!globalThis.IS_MP_BUILD){const Jp="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis;function $p(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Zp(e,t){return e&t}function Xp(e,t){return e|t}function ev(e,t){return e^t}function tv(e,t){return e&~t}function rv(e){if(0==e)return-1;var t=0;return 65535&e||(e>>=16,t+=16),255&e||(e>>=8,t+=8),15&e||(e>>=4,t+=4),3&e||(e>>=2,t+=2),1&e||++t,t}function nv(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var mp,yp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function ov(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=yp.charAt(r>>6)+yp.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=yp.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=yp.charAt(r>>2)+yp.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function iv(e){var t,r="",n=0,o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var i=yp.indexOf(e.charAt(t));i<0||(0==n?(r+=$p(i>>2),o=3&i,n=1):1==n?(r+=$p(o<<2|i>>4),o=15&i,n=2):2==n?(r+=$p(o),r+=$p(i>>2),o=3&i,n=3):(r+=$p(o<<2|i>>4),r+=$p(15&i),n=0))}return 1==n&&(r+=$p(o<<2)),r}var bp,_p={decode:function(e){var t;if(void 0===mp){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(mp={},t=0;t<16;++t)mp[r.charAt(t)]=t;for(r=r.toLowerCase(),t=10;t<16;++t)mp[r.charAt(t)]=t;for(t=0;t<8;++t)mp[n.charAt(t)]=-1}var o=[],i=0,s=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(-1!=(a=mp[a])){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++s>=2?(o[o.length]=i,i=0,s=0):i<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return o}},wp={decode:function(e){var t;if(void 0===bp){var r="= \f\n\r\t \u2028\u2029";for(bp=Object.create(null),t=0;t<64;++t)bp["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(t=0;t<9;++t)bp[r.charAt(t)]=-1}var n=[],o=0,i=0;for(t=0;t<e.length;++t){var s=e.charAt(t);if("="==s)break;if(-1!=(s=bp[s])){if(void 0===s)throw new Error("Illegal character at offset "+t);o|=s,++i>=4?(n[n.length]=o>>16,n[n.length]=o>>8&255,n[n.length]=255&o,o=0,i=0):o<<=6}}switch(i){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:n[n.length]=o>>10;break;case 3:n[n.length]=o>>16,n[n.length]=o>>8&255}return n},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=wp.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return wp.decode(e)}},Sp=1e13;class sv{constructor(e){this.buf=[+e||0]}mulAdd(e,t){var r,n,o=this.buf,i=o.length;for(r=0;r<i;++r)(n=o[r]*e+t)<Sp?t=0:n-=(t=0|n/Sp)*Sp,o[r]=n;t>0&&(o[r]=t)}sub(e){var t,r,n=this.buf,o=n.length;for(t=0;t<o;++t)(r=n[t]-e)<0?(r+=Sp,e=1):e=0,n[t]=r;for(;0===n[n.length-1];)n.pop()}toString(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,r=t[t.length-1].toString(),n=t.length-2;n>=0;--n)r+=(Sp+t[n]).toString().substring(1);return r}valueOf(){for(var e=this.buf,t=0,r=e.length-1;r>=0;--r)t=t*Sp+e[r];return t}simplify(){var e=this.buf;return 1==e.length?e[0]:this}}var Ip,Tp=/^(\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)?)?$/,Pp=/^(\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 av(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}class uv{constructor(e,t){this.hexDigits="0123456789ABCDEF",e instanceof uv?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=t)}get(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset "+e+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(e):this.enc[e]}hexByte(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)}hexDump(e,t,r){for(var n="",o=e;o<t;++o)if(n+=this.hexByte(this.get(o)),!0!==r)switch(15&o){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n}isASCII(e,t){for(var r=e;r<t;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0}parseStringISO(e,t){for(var r="",n=e;n<t;++n)r+=String.fromCharCode(this.get(n));return r}parseStringUTF(e,t){for(var r="",n=e;n<t;){var o=this.get(n++);r+=o<128?String.fromCharCode(o):o>191&&o<224?String.fromCharCode((31&o)<<6|63&this.get(n++)):String.fromCharCode((15&o)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r}parseStringBMP(e,t){for(var r,n,o="",i=e;i<t;)r=this.get(i++),n=this.get(i++),o+=String.fromCharCode(r<<8|n);return o}parseTime(e,t,r){var n=this.parseStringISO(e,t),o=(r?Tp:Pp).exec(n);return o?(r&&(o[1]=+o[1],o[1]+=+o[1]<70?2e3:1900),n=o[1]+"-"+o[2]+"-"+o[3]+" "+o[4],o[5]&&(n+=":"+o[5],o[6]&&(n+=":"+o[6],o[7]&&(n+="."+o[7]))),o[8]&&(n+=" UTC","Z"!=o[8]&&(n+=o[8],o[9]&&(n+=":"+o[9]))),n):"Unrecognized time: "+n}parseInteger(e,t){for(var r,n=this.get(e),o=n>127,i=o?255:0,s="";n==i&&++e<t;)n=this.get(e);if(0===(r=t-e))return o?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^i));)s=+s<<1,--r;s="("+r+" bit)\n"}o&&(n-=256);for(var a=new sv(n),u=e+1;u<t;++u)a.mulAdd(256,this.get(u));return s+a.toString()}parseBitString(e,t,r){for(var n=this.get(e),o="("+((t-e-1<<3)-n)+" bit)\n",i="",s=e+1;s<t;++s){for(var a=this.get(s),u=s==t-1?n:0,c=7;c>=u;--c)i+=a>>c&1?"1":"0";if(i.length>r)return o+av(i,r)}return o+i}parseOctetString(e,t,r){if(this.isASCII(e,t))return av(this.parseStringISO(e,t),r);var n=t-e,o="("+n+" byte)\n";n>(r/=2)&&(t=e+r);for(var i=e;i<t;++i)o+=this.hexByte(this.get(i));return n>r&&(o+="…"),o}parseOID(e,t,r){for(var n="",o=new sv,i=0,s=e;s<t;++s){var a=this.get(s);if(o.mulAdd(128,127&a),i+=7,!(128&a)){if(""===n)if((o=o.simplify())instanceof sv)o.sub(80),n="2."+o.toString();else{var u=o<80?o<40?0:1:2;n=u+"."+(o-40*u)}else n+="."+o.toString();if(n.length>r)return av(n,r);o=new sv,i=0}}return i>0&&(n+=".incomplete"),n}}class cv{constructor(e,t,r,n,o){if(!(n instanceof lv))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=r,this.tag=n,this.sub=o}typeName(){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()}}content(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+r,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+r,e);case 6:return this.stream.parseOID(t,t+r,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return av(this.stream.parseStringUTF(t,t+r),e);case 18:case 19:case 20:case 21:case 22:case 26:return av(this.stream.parseStringISO(t,t+r),e);case 30:return av(this.stream.parseStringBMP(t,t+r),e);case 23:case 24:return this.stream.parseTime(t,t+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var r=0,n=this.sub.length;r<n;++r)t+=this.sub[r].toPrettyString(e)}return t}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(e){var t=e.get(),r=127&t;if(r==t)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===r)return null;t=0;for(var n=0;n<r;++n)t=256*t+e.get();return t}getHexStringValue(){var e=this.toHexString(),t=2*this.header,r=2*this.length;return e.substr(t,r)}static decode(e){var t;t=e instanceof uv?e:new uv(e,0);var r=new uv(t),n=new lv(t),o=cv.decodeLength(t),i=t.pos,s=i-r.pos,a=null,u=function(){var e=[];if(null!==o){for(var r=i+o;t.pos<r;)e[e.length]=cv.decode(t);if(t.pos!=r)throw new Error("Content size is not correct for container starting at offset "+i)}else try{for(;;){var n=cv.decode(t);if(n.tag.isEOC())break;e[e.length]=n}o=i-t.pos}catch(e){throw new Error("Exception while decoding undefined length content: "+e)}return e};if(n.tagConstructed)a=u();else if(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=t.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(var c=0;c<a.length;++c)if(a[c].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(e){a=null}if(null===a){if(null===o)throw new Error("We can't skip over an invalid tag with undefined length at offset "+i);t.pos=i+Math.abs(o)}return new cv(r,s,o,n,a)}}class lv{constructor(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=!!(32&t),this.tagNumber=31&t,31==this.tagNumber){var r=new sv;do{t=e.get(),r.mulAdd(128,127&t)}while(128&t);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var Ep=[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],Op=(1<<26)/Ep[Ep.length-1];class hv{constructor(e,t,r){null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}toString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<<t)-1,o=!1,i="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(o=!0,i=$p(r));s>=0;)a<t?(r=(this[s]&(1<<a)-1)<<t-a,r|=this[--s]>>(a+=this.DB-t)):(r=this[s]>>(a-=t)&n,a<=0&&(a+=this.DB,--s)),r>0&&(o=!0),o&&(i+=$p(r));return o?i:"0"}negate(){var e=dv();return hv.ZERO.subTo(this,e),e}abs(){return this.s<0?this.negate():this}compareTo(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+bv(this[this.t-1]^this.s&this.DM)}mod(e){var t=dv();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(hv.ZERO)>0&&e.subTo(t,t),t}modPowInt(e,t){var r;return r=e<256||t.isEven()?new Cp(t):new Ap(t),this.exp(e,r)}clone(){var e=dv();return this.copyTo(e),e}intValue(){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]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var e=this.t,t=[];t[0]=this.s;var r,n=this.DB-e*this.DB%8,o=0;if(e-- >0)for(n<this.DB&&(r=this[e]>>n)!=(this.s&this.DM)>>n&&(t[o++]=r|this.s<<this.DB-n);e>=0;)n<8?(r=(this[e]&(1<<n)-1)<<8-n,r|=this[--e]>>(n+=this.DB-8)):(r=this[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),128&r&&(r|=-256),0==o&&(128&this.s)!=(128&r)&&++o,(o>0||r!=this.s)&&(t[o++]=r);return t}equals(e){return 0==this.compareTo(e)}min(e){return this.compareTo(e)<0?this:e}max(e){return this.compareTo(e)>0?this:e}and(e){var t=dv();return this.bitwiseTo(e,Zp,t),t}or(e){var t=dv();return this.bitwiseTo(e,Xp,t),t}xor(e){var t=dv();return this.bitwiseTo(e,ev,t),t}andNot(e){var t=dv();return this.bitwiseTo(e,tv,t),t}not(){for(var e=dv(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e}shiftLeft(e){var t=dv();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}shiftRight(e){var t=dv();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}getLowestSetBit(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+rv(this[e]);return this.s<0?this.t*this.DB:-1}bitCount(){for(var e=0,t=this.s&this.DM,r=0;r<this.t;++r)e+=nv(this[r]^t);return e}testBit(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:!!(this[t]&1<<e%this.DB)}setBit(e){return this.changeBit(e,Xp)}clearBit(e){return this.changeBit(e,tv)}flipBit(e){return this.changeBit(e,ev)}add(e){var t=dv();return this.addTo(e,t),t}subtract(e){var t=dv();return this.subTo(e,t),t}multiply(e){var t=dv();return this.multiplyTo(e,t),t}divide(e){var t=dv();return this.divRemTo(e,t,null),t}remainder(e){var t=dv();return this.divRemTo(e,null,t),t}divideAndRemainder(e){var t=dv(),r=dv();return this.divRemTo(e,t,r),[t,r]}modPow(e,t){var r,n,o=e.bitLength(),i=yv(1);if(o<=0)return i;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new Cp(t):t.isEven()?new kp(t):new Ap(t);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var l=dv();for(n.sqrTo(s[1],l);a<=c;)s[a]=dv(),n.mulTo(l,s[a-2],s[a]),a+=2}var h,d,f=e.t-1,p=!0,v=dv();for(o=bv(e[f])-1;f>=0;){for(o>=u?h=e[f]>>o-u&c:(h=(e[f]&(1<<o+1)-1)<<u-o,f>0&&(h|=e[f-1]>>this.DB+o-u)),a=r;!(1&h);)h>>=1,--a;if((o-=a)<0&&(o+=this.DB,--f),p)s[h].copyTo(i),p=!1;else{for(;a>1;)n.sqrTo(i,v),n.sqrTo(v,i),a-=2;a>0?n.sqrTo(i,v):(d=i,i=v,v=d),n.mulTo(v,s[h],i)}for(;f>=0&&!(e[f]&1<<o);)n.sqrTo(i,v),d=i,i=v,v=d,--o<0&&(o=this.DB-1,--f)}return n.revert(i)}modInverse(e){var t=e.isEven();if(this.isEven()&&t||0==e.signum())return hv.ZERO;for(var r=e.clone(),n=this.clone(),o=yv(1),i=yv(0),s=yv(0),a=yv(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),t?(o.isEven()&&i.isEven()||(o.addTo(this,o),i.subTo(e,i)),o.rShiftTo(1,o)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;n.isEven();)n.rShiftTo(1,n),t?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(e,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(e,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),t&&o.subTo(s,o),i.subTo(a,i)):(n.subTo(r,n),t&&s.subTo(o,s),a.subTo(i,a))}return 0!=n.compareTo(hv.ONE)?hv.ZERO:a.compareTo(e)>=0?a.subtract(e):a.signum()<0?(a.addTo(e,a),a.signum()<0?a.add(e):a):a}pow(e){return this.exp(e,new Rp)}gcd(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var o=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(o<i&&(i=o),i>0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r}isProbablePrime(e){var t,r=this.abs();if(1==r.t&&r[0]<=Ep[Ep.length-1]){for(t=0;t<Ep.length;++t)if(r[0]==Ep[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Ep.length;){for(var n=Ep[t],o=t+1;o<Ep.length&&n<Op;)n*=Ep[o++];for(n=r.modInt(n);t<o;)if(n%Ep[t++]==0)return!1}return r.millerRabin(e)}copyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}fromInt(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0}fromString(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,o=!1,i=0;--n>=0;){var s=8==r?255&+e[n]:mv(e,n);s<0?"-"==e.charAt(n)&&(o=!0):(o=!1,0==i?this[this.t++]=s:i+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this[this.t++]=s>>this.DB-i):this[this.t-1]|=s<<i,(i+=r)>=this.DB&&(i-=this.DB))}8==r&&128&+e[0]&&(this.s=-1,i>0&&(this[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),o&&hv.ZERO.subTo(this,this)}clamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}dlShiftTo(e,t){var r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s}drShiftTo(e,t){for(var r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s}lShiftTo(e,t){for(var r=e%this.DB,n=this.DB-r,o=(1<<n)-1,i=Math.floor(e/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)t[a+i+1]=this[a]>>n|s,s=(this[a]&o)<<r;for(a=i-1;a>=0;--a)t[a]=0;t[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()}rShiftTo(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,o=this.DB-n,i=(1<<n)-1;t[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)t[s-r-1]|=(this[s]&i)<<o,t[s-r]=this[s]>>n;n>0&&(t[this.t-r-1]|=(this.s&i)<<o),t.t=this.t-r,t.clamp()}}subTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]-e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n-=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n-=e[r],t[r++]=n&this.DM,n>>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t[r++]=this.DV+n:n>0&&(t[r++]=n),t.t=r,t.clamp()}multiplyTo(e,t){var r=this.abs(),n=e.abs(),o=r.t;for(t.t=o+n.t;--o>=0;)t[o]=0;for(o=0;o<n.t;++o)t[o+r.t]=r.am(0,n[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!=e.s&&hv.ZERO.subTo(t,t)}squareTo(e){for(var t=this.abs(),r=e.t=2*t.t;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){var n=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,n,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()}divRemTo(e,t,r){var n=e.abs();if(!(n.t<=0)){var o=this.abs();if(o.t<n.t)return null!=t&&t.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=dv());var i=dv(),s=this.s,a=e.s,u=this.DB-bv(n[n.t-1]);u>0?(n.lShiftTo(u,i),o.lShiftTo(u,r)):(n.copyTo(i),o.copyTo(r));var c=i.t,l=i[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?i[c-2]>>this.F2:0),d=this.FV/h,f=(1<<this.F1)/h,p=1<<this.F2,v=r.t,g=v-c,m=null==t?dv():t;for(i.dlShiftTo(g,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),hv.ONE.dlShiftTo(c,m),m.subTo(i,i);i.t<c;)i[i.t++]=0;for(;--g>=0;){var y=r[--v]==l?this.DM:Math.floor(r[v]*d+(r[v-1]+p)*f);if((r[v]+=i.am(0,y,r,g,0,c))<y)for(i.dlShiftTo(g,m),r.subTo(m,r);r[v]<--y;)r.subTo(m,r)}null!=t&&(r.drShiftTo(c,t),s!=a&&hv.ZERO.subTo(t,t)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&hv.ZERO.subTo(r,r)}}}invDigit(){if(this.t<1)return 0;var e=this[0];if(!(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(e,t){if(e>4294967295||e<1)return hv.ONE;var r=dv(),n=dv(),o=t.convert(this),i=bv(e)-1;for(o.copyTo(r);--i>=0;)if(t.sqrTo(r,n),(e&1<<i)>0)t.mulTo(n,o,r);else{var s=r;r=n,n=s}return t.revert(r)}chunkSize(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}toRadix(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=yv(r),o=dv(),i=dv(),s="";for(this.divRemTo(n,o,i);o.signum()>0;)s=(r+i.intValue()).toString(e).substr(1)+s,o.divRemTo(n,o,i);return i.intValue().toString(e)+s}fromRadix(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),o=!1,i=0,s=0,a=0;a<e.length;++a){var u=mv(e,a);u<0?"-"==e.charAt(a)&&0==this.signum()&&(o=!0):(s=t*s+u,++i>=r&&(this.dMultiply(n),this.dAddOffset(s,0),i=0,s=0))}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(s,0)),o&&hv.ZERO.subTo(this,this)}fromNumber(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(hv.ONE.shiftLeft(e-1),Xp,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(hv.ONE.shiftLeft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),t.nextBytes(n),o>0?n[0]&=(1<<o)-1:n[0]=0,this.fromString(n,256)}}bitwiseTo(e,t,r){var n,o,i=Math.min(e.t,this.t);for(n=0;n<i;++n)r[n]=t(this[n],e[n]);if(e.t<this.t){for(o=e.s&this.DM,n=i;n<this.t;++n)r[n]=t(this[n],o);r.t=this.t}else{for(o=this.s&this.DM,n=i;n<e.t;++n)r[n]=t(o,e[n]);r.t=e.t}r.s=t(this.s,e.s),r.clamp()}changeBit(e,t){var r=hv.ONE.shiftLeft(e);return this.bitwiseTo(r,t,r),r}addTo(e,t){for(var r=0,n=0,o=Math.min(e.t,this.t);r<o;)n+=this[r]+e[r],t[r++]=n&this.DM,n>>=this.DB;if(e.t<this.t){for(n+=e.s;r<this.t;)n+=this[r],t[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<e.t;)n+=e[r],t[r++]=n&this.DM,n>>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t[r++]=n:n<-1&&(t[r++]=this.DV+n),t.t=r,t.clamp()}dMultiply(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(e,t){if(0!=e){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=e;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}multiplyLowerTo(e,t,r){var n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var o=r.t-this.t;n<o;++n)r[n+this.t]=this.am(0,e[n],r,n,0,this.t);for(o=Math.min(e.t,t);n<o;++n)this.am(0,e[n],r,n,0,t-n);r.clamp()}multiplyUpperTo(e,t,r){--t;var n=r.t=this.t+e.t-t;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(t-this.t,0);n<e.t;++n)r[this.t+n-t]=this.am(t-n,e[n],r,0,0,this.t+n-t);r.clamp(),r.drShiftTo(1,r)}modInt(e){if(e<=0)return 0;var t=this.DV%e,r=this.s<0?e-1:0;if(this.t>0)if(0==t)r=this[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this[n])%e;return r}millerRabin(e){var t=this.subtract(hv.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);(e=e+1>>1)>Ep.length&&(e=Ep.length);for(var o=dv(),i=0;i<e;++i){o.fromInt(Ep[Math.floor(Math.random()*Ep.length)]);var s=o.modPow(n,this);if(0!=s.compareTo(hv.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(hv.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0}square(){var e=dv();return this.squareTo(e),e}gcda(e,t){var r=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(r.compareTo(n)<0){var o=r;r=n,n=o}var i=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)t(r);else{i<s&&(s=i),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=()=>{(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){t(n)},0))};setTimeout(a,10)}}fromNumberAsync(e,t,r,n){if("number"==typeof t)if(e<2)this.fromInt(1);else{this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(hv.ONE.shiftLeft(e-1),Xp,this),this.isEven()&&this.dAddOffset(1,0);var o=this,i=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(hv.ONE.shiftLeft(e-1),o),o.isProbablePrime(t)?setTimeout(function(){n()},0):setTimeout(i,0)};setTimeout(i,0)}else{var s=[],a=7&e;s.length=1+(e>>3),t.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}}var Rp=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),Cp=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),Ap=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=dv();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(hv.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=dv();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var r=32767&e[t],n=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[r=t+this.m.t]+=this.m.am(0,n,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),kp=function(){function e(e){this.m=e,this.r2=dv(),this.q3=dv(),hv.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=dv();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function dv(){return new hv(null)}function fv(e,t){return new hv(e,t)}function pv(e,t,r,n,o,i){for(;--i>=0;){var s=t*this[e++]+r[n]+o;o=Math.floor(s/67108864),r[n++]=67108863&s}return o}function vv(e,t,r,n,o,i){for(var s=32767&t,a=t>>15;--i>=0;){var u=32767&this[e],c=this[e++]>>15,l=a*u+c*s;o=((u=s*u+((32767&l)<<15)+r[n]+(1073741823&o))>>>30)+(l>>>15)+a*c+(o>>>30),r[n++]=1073741823&u}return o}function gv(e,t,r,n,o,i){for(var s=16383&t,a=t>>14;--i>=0;){var u=16383&this[e],c=this[e++]>>14,l=a*u+c*s;o=((u=s*u+((16383&l)<<14)+r[n]+o)>>28)+(l>>14)+a*c,r[n++]=268435455&u}return o}void 0!==Jp&&"Microsoft Internet Explorer"==(null==Jp?void 0:Jp.appName)?(hv.prototype.am=vv,Ip=30):"Netscape"!=(null==Jp?void 0:Jp.appName)?(hv.prototype.am=pv,Ip=26):(hv.prototype.am=gv,Ip=28),hv.prototype.DB=Ip,hv.prototype.DM=(1<<Ip)-1,hv.prototype.DV=1<<Ip;hv.prototype.FV=Math.pow(2,52),hv.prototype.F1=52-Ip,hv.prototype.F2=2*Ip-52;var Up,qp,Lp=[];for(Up="0".charCodeAt(0),qp=0;qp<=9;++qp)Lp[Up++]=qp;for(Up="a".charCodeAt(0),qp=10;qp<36;++qp)Lp[Up++]=qp;for(Up="A".charCodeAt(0),qp=10;qp<36;++qp)Lp[Up++]=qp;function mv(e,t){var r=Lp[e.charCodeAt(t)];return null==r?-1:r}function yv(e){var t=dv();return t.fromInt(e),t}function bv(e){var t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}hv.ZERO=yv(0),hv.ONE=yv(1);class _v{constructor(){this.i=0,this.j=0,this.S=[]}init(e){var t,r,n;for(t=0;t<256;++t)this.S[t]=t;for(r=0,t=0;t<256;++t)r=r+this.S[t]+e[t%e.length]&255,n=this.S[t],this.S[t]=this.S[r],this.S[r]=n;this.i=0,this.j=0}next(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]}}var xp,Np,jp=null;if(null==jp){jp=[],Np=0;var Dp,Bp,Mp=void 0;if("undefined"!=typeof window)if(null!==(Dp=window)&&void 0!==Dp&&Dp.crypto&&null!==(Bp=window)&&void 0!==Bp&&Bp.crypto.getRandomValues){var Wp,Fp=new Uint32Array(256);for(null===(Wp=window)||void 0===Wp||Wp.crypto.getRandomValues(Fp),Mp=0;Mp<Fp.length;++Mp)jp[Np++]=255&Fp[Mp]}var Hp,zp,Vp,Gp=function(e){var t,r,n;if(this.count=this.count||0,this.count>=256||Np>=256){if("undefined"!=typeof window)if(null!==(t=window)&&void 0!==t&&t.removeEventListener)null===(n=window)||void 0===n||n.removeEventListener("mousemove",Gp,!1);else if(null!==(r=window)&&void 0!==r&&r.detachEvent){var o;null===(o=window)||void 0===o||o.detachEvent("onmousemove",Gp)}}else try{var i=e.x+e.y;jp[Np++]=255&i,this.count+=1}catch(e){}};if("undefined"!=typeof window)if(null!==(Hp=window)&&void 0!==Hp&&Hp.addEventListener)null===(Vp=window)||void 0===Vp||Vp.addEventListener("mousemove",Gp,!1);else if(null!==(zp=window)&&void 0!==zp&&zp.attachEvent){var Kp;null===(Kp=window)||void 0===Kp||Kp.attachEvent("onmousemove",Gp)}}function wv(){if(null==xp){for(xp=new _v;Np<256;){var e=Math.floor(65536*Math.random());jp[Np++]=255&e}for(xp.init(jp),Np=0;Np<jp.length;++Np)jp[Np]=0;Np=0}return xp.next()}class Sv{constructor(){}nextBytes(e){for(var t=0;t<e.length;++t)e[t]=wv()}}function Iv(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=e.length-1;n>=0&&t>0;){var o=e.charCodeAt(n--);o<128?r[--t]=o:o>127&&o<2048?(r[--t]=63&o|128,r[--t]=o>>6|192):(r[--t]=63&o|128,r[--t]=o>>6&63|128,r[--t]=o>>12|224)}r[--t]=0;for(var i=new Sv,s=[];t>2;){for(s[0]=0;0==s[0];)i.nextBytes(s);r[--t]=s[0]}return r[--t]=2,r[--t]=0,new hv(r)}class Tv{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(e){return e.modPowInt(this.e,this.n)}doPrivate(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}setPublic(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=fv(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")}encrypt(e){var t=Iv(e,this.n.bitLength()+7>>3);if(null==t)return null;var r=this.doPublic(t);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n}encryptLong(e){var t=this,r=(this.n.bitLength()+7>>3)-11;try{var n="";return e.length>r?(e.match(/.{1,117}/g).forEach(function(e){var r=t.encrypt(e);n+=r}),ov(n)):ov(this.encrypt(e))}catch(e){return!1}}decryptLong(e){var t=this,r=this.n.bitLength()+7>>3;e=iv(e);try{if(e.length>r){var n="";return e.match(/.{1,256}/g).forEach(function(e){var r=t.decrypt(e);n+=r}),n}return this.decrypt(e)}catch(e){return!1}}setPrivate(e,t,r){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=fv(e,16),this.e=parseInt(t,16),this.d=fv(r,16)):console.error("Invalid RSA private key")}setPrivateEx(e,t,r,n,o,i,s,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=fv(e,16),this.e=parseInt(t,16),this.d=fv(r,16),this.p=fv(n,16),this.q=fv(o,16),this.dmp1=fv(i,16),this.dmq1=fv(s,16),this.coeff=fv(a,16)):console.error("Invalid RSA private key")}generate(e,t){var r=new Sv,n=e>>1;this.e=parseInt(t,16);for(var o=new hv(t,16);;){for(;this.p=new hv(e-n,1,r),0!=this.p.subtract(hv.ONE).gcd(o).compareTo(hv.ONE)||!this.p.isProbablePrime(10););for(;this.q=new hv(n,1,r),0!=this.q.subtract(hv.ONE).gcd(o).compareTo(hv.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var i=this.p;this.p=this.q,this.q=i}var s=this.p.subtract(hv.ONE),a=this.q.subtract(hv.ONE),u=s.multiply(a);if(0==u.gcd(o).compareTo(hv.ONE)){this.n=this.p.multiply(this.q),this.d=o.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(e){var t=fv(e,16),r=this.doPrivate(t);return null==r?null:Pv(r,this.n.bitLength()+7>>3)}generateAsync(e,t,r){var n=new Sv,o=e>>1;this.e=parseInt(t,16);var i=new hv(t,16),s=this,a=()=>{var t=()=>{if(s.p.compareTo(s.q)<=0){var e=s.p;s.p=s.q,s.q=e}var t=s.p.subtract(hv.ONE),n=s.q.subtract(hv.ONE),o=t.multiply(n);0==o.gcd(i).compareTo(hv.ONE)?(s.n=s.p.multiply(s.q),s.d=i.modInverse(o),s.dmp1=s.d.mod(t),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout(function(){r()},0)):setTimeout(a,0)},u=()=>{s.q=dv(),s.q.fromNumberAsync(o,1,n,function(){s.q.subtract(hv.ONE).gcda(i,function(e){0==e.compareTo(hv.ONE)&&s.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(u,0)})})},c=()=>{s.p=dv(),s.p.fromNumberAsync(e-o,1,n,function(){s.p.subtract(hv.ONE).gcda(i,function(e){0==e.compareTo(hv.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(a,0)}}function Pv(e,t){for(var r=e.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=t-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var o="";++n<r.length;){var i=255&r[n];i<128?o+=String.fromCharCode(i):i>191&&i<224?(o+=String.fromCharCode((31&i)<<6|63&r[n+1]),++n):(o+=String.fromCharCode((15&i)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return o}class Ev extends Tv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";super(),e&&("string"==typeof e?this.parseKey(e):(this.hasPrivateKeyProperty(e)||this.hasPublicKeyProperty(e))&&this.parsePropertiesFrom(e))}parseKey(e){try{var t=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e)?_p.decode(e):wp.unarmor(e),o=cv.decode(n);if(3===o.sub.length&&(o=o.sub[2].sub[0]),9===o.sub.length){t=o.sub[1].getHexStringValue(),this.n=fv(t,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var i=o.sub[3].getHexStringValue();this.d=fv(i,16);var s=o.sub[4].getHexStringValue();this.p=fv(s,16);var a=o.sub[5].getHexStringValue();this.q=fv(a,16);var u=o.sub[6].getHexStringValue();this.dmp1=fv(u,16);var c=o.sub[7].getHexStringValue();this.dmq1=fv(c,16);var l=o.sub[8].getHexStringValue();this.coeff=fv(l,16)}else{if(2!==o.sub.length)return!1;var h=o.sub[1].sub[0];t=h.sub[0].getHexStringValue(),this.n=fv(t,16),r=h.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(e){return!1}}hasPublicKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")}hasPrivateKeyProperty(e){return(e=e||{}).hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")}parsePropertiesFrom(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)}}gp=function(e){e=e||{},this.default_key_size=parseInt(e.default_key_size,10)||1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null},gp.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Ev(e)},gp.prototype.setPrivateKey=function(e){this.setKey(e)},gp.prototype.setPublicKey=function(e){this.setKey(e)},gp.prototype.decrypt=function(e){try{return this.getKey().decrypt(iv(e))}catch(e){return!1}},gp.prototype.encrypt=function(e){try{return ov(this.getKey().encrypt(e))}catch(e){return!1}},gp.prototype.encryptLong=function(e){try{for(var t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",n=0,o=/null$/g;o.test(r)&&(n++,t=this.getKey().encryptLong(e)||"",r=this.getKey().decryptLong(t)||"",!(n>10)););return t}catch(e){return!1}},gp.prototype.getKey=function(e){if(!this.key){if(this.key=new Ev,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},gp.version="3.1.4"}var Yp=gp;var Qp=Object.freeze({__proto__:null,getEncryptInfo:function(){let{publicKey:e="",payload:t={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e)return"";try{const r=dd(t),n=new Yp;n.setPublicKey(e);return n.encryptLong("object"==typeof r?JSON.stringify(r):r)}catch(e){console.error("encrypt error:",e)}return""}});e.default=vp,e.generateHTTPClient=y,e.generateMySQLClient=dp,e.getAccessToken=c,e.init=hp,e.initHTTPOverCallFunction=function(e,t){var r=this;if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var s,a=e.callFunction.bind(e);try{var u=(null==t?void 0:t.baseUrl)||pp(e,null==t?void 0:t.envId).model,l=(null==t?void 0:t.sqlBaseUrl)||pp(e,null==t?void 0:t.envId).sql;s=y(a,function(t){var s=t.url,u=t.body,l=t.method,h=t.headers;return o(r,0,void 0,function(){var t,r,o;return i(this,function(i){switch(i.label){case 0:return[4,c(e)];case 1:return t=i.sent(),[4,a({name:"httpOverCallFunction",data:{url:s,method:null==l?void 0:l.toUpperCase(),headers:n(n(n({},t?{Authorization:"Bearer ".concat(t)}:{}),h||{}),{"Content-Type":"application/json"}),body:u}})];case 2:return r=i.sent(),[2,null===(o=null==r?void 0:r.result)||void 0===o?void 0:o.body]}})})},u,{sqlBaseUrl:l,cloud:e})}catch(e){console.error("init http orm client failed, try call function orm",e),s=S(a)}return e.models=s,e.mysql=dp(e,{envId:null==t?void 0:t.envId,mysqlBaseUrl:null==t?void 0:t.mysqlBaseUrl}),e},Object.defineProperty(e,"__esModule",{value:!0})});
|