@cloudbase/wx-cloud-client-sdk 1.8.1 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});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)};function t(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)}var r=function(){return r=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},r.apply(this,arguments)};function n(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 o(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 i=function(e){function r(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 t(r,e),r}(Error);function s(){return"undefined"!=typeof window&&window||"undefined"!=typeof globalThis&&globalThis}function a(){try{var e=s();if(!e)return;return"undefined"==typeof wx?s().location.href:e.__wxRoute}catch(e){}}var c=function(e){return n(void 0,0,void 0,function(){var t,r,n;return o(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]}})})},u=function(e){var t=e.dataSourceName,u=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 n(void 0,0,void 0,function(){var e,n,f,m,y,b,_;return o(this,function(o){switch(o.label){case 0:return e={data:{},requestId:""},[4,c(g)];case 1:n=o.sent(),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,d({name:"lowcode-datasource",data:r({dataSourceName:t,methodName:u,params:l,userAgent:(S=s(),(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:a(),"x-sdk-version":"1.8.1",envType:p,mode:v},n?{access_token:n}:{})})];case 3:if(f=o.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 i("【错误】".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=o.sent()).name?y:(console.log(y),new i("【错误】".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})})},l=function(e){var t=e.sql,r=e.params,i=e.config,s=e.callFunction,a=e.unsafe,c=void 0!==a&&a,l=e.cloud;return n(void 0,0,void 0,function(){return o(this,function(e){return[2,u({realMethodName:"$runSQL",methodName:"callWedaApi",params:{action:"RunMysqlCommand",data:{sqlTemplate:t,config:i,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:l})]})})},h=function(e,t){return{$runSQL:function(i,s,a){return n(this,0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return[4,l({sql:i,params:s,config:r(r({},a),{preparedStatements:!0}),callFunction:e,cloud:t})];case 1:return[2,n.sent()]}})})},$runSQLRaw:function(i,s){return n(this,0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return[4,l({sql:i,params:[],config:r(r({},s),{preparedStatements:!1}),callFunction:e,cloud:t})];case 1:return[2,n.sent()]}})})}}},d={filter:{where:{}},select:{$master:!0}};function f(e){return{getUrl:function(t){return"".concat(t,"/").concat(e)},method:"post"}}var p={get:r(r({},f("get")),{defaultParams:r({},d)}),list:r(r({},f("list")),{defaultParams:r({},d)}),create:f("create"),createMany:f("createMany"),update:r(r({},f("update")),{method:"put"}),updateMany:r(r({},f("updateMany")),{method:"put"}),upsert:f("upsert"),delete:f("delete"),deleteMany:f("deleteMany")},v="Unknown error occurred",g="NotSupported",m=function(e,t,r,n){var o=h(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]:b(r,i,t,n)}})},y=function(e,t,r,n,o){return new i("【错误】".concat(e,"\n【操作】调用 models.").concat(t,".").concat(r,"\n【错误码】").concat(n,"\n【请求ID】").concat(o),{code:n,requestId:o})},b=function(e,t,s,a){var c=new Proxy({},{get:function(c,u){if("runSQLTemplate"!==u){var l=p[u];if(!l){var h=new Error("不支持的操作: ".concat(u));throw new i(h.message||v,{originError:h,code:g,requestId:"N/A"})}return function(r){return void 0===r&&(r={}),n(void 0,0,void 0,function(){var n,a,c,h,d,f,p,g,m,b;return o(this,function(o){switch(o.label){case 0:n=l.getUrl,a=l.method,c=l.defaultParams,h=void 0===c?{}:c,d=Object.assign({},h,r),f="pre"===d.envType?"pre":"prod",p=[e,f,n(t)].join("/"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,s({url:p,body:JSON.stringify(d),method:a})];case 2:if((g=o.sent()).code)throw y(null==g?void 0:g.message,t,u,null==g?void 0:g.code,null==g?void 0:g.requestId);return"get"===u&&Object.assign(g,{data:null!==(b=g.data.record)&&void 0!==b?b:g.data}),[2,g];case 3:throw m=o.sent(),new i((null==m?void 0:m.message)||v,{originError:m});case 4:return[2]}})})}}if(!(null==a?void 0:a.sqlBaseUrl)){h=new Error("不支持的操作: ".concat(u));throw new i(h.message||v,{originError:h,code:g,requestId:"N/A"})}return function(e){return n(void 0,0,void 0,function(){var n,c,l,h,d,f,p,g,m,b,_,w,S,I,T,P;return o(this,function(o){switch(o.label){case 0:n=e.params,c=e.templateName,l=e.envType,h="pre"===l?"pre":"prod",d=[a.sqlBaseUrl,h,c,"run"].join("/"),f=Object.entries(n||{}).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},[]),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,s({url:d,body:JSON.stringify({parameter:f}),method:"POST"})];case 2:if(p=o.sent(),null===(m=null==p?void 0:p.Response)||void 0===m?void 0:m.Error)throw y(null===(_=null===(b=null==p?void 0:p.Response)||void 0===b?void 0:b.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,r(r({},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 g=o.sent(),new i((null==g?void 0:g.message)||v,{originError:g});case 4:return[2]}})})}}});return c},_={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}}}},w=function(e,t){var s=h(e,t);return new Proxy({},{get:function(a,c){if("string"==typeof c)return Object.prototype.hasOwnProperty.call(s,c)?s[c]:function(e,t,s){return new Proxy({},{get:function(a,c){var l=_[c];if(!l){var h=new Error("不支持的操作: ".concat(c));throw new i(h.message||"Unknown error occurred",{originError:h,code:"NotSupported",requestId:"N/A"})}return function(i){return n(void 0,0,void 0,function(){var n,a,h,d,f;return o(this,function(o){switch(o.label){case 0:return n=r(r({},l.defaultParams||{}),i||{}),[4,u({callFunction:t,dataSourceName:e,methodName:l.methodName,realMethodName:c,params:n,envType:null==i?void 0:i.envType,cloud:s})];case 1:return a=o.sent(),h={data:{}},d=l.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)}})},S=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=S);var I="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function T(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var P,E,O=function(e){try{return!!e()}catch(e){return!0}},R=!O(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),C=R,A=Function.prototype,k=A.call,U=C&&A.bind.bind(k,k),q=C?U:function(e){return function(){return k.apply(e,arguments)}},L=q,x=L({}.toString),N=L("".slice),j=function(e){return N(x(e),8,-1)},D=O,B=j,M=Object,W=q("".split),F=D(function(){return!M("z").propertyIsEnumerable(0)})?function(e){return"String"===B(e)?W(e,""):M(e)}:M,H=function(e){return null==e},z=H,V=TypeError,G=function(e){if(z(e))throw new V("Can't call method on "+e);return e},K=F,Y=G,Q=function(e){return K(Y(e))},J={},$=function(e){return e&&e.Math===Math&&e},Z=$("object"==typeof globalThis&&globalThis)||$("object"==typeof window&&window)||$("object"==typeof self&&self)||$("object"==typeof I&&I)||$("object"==typeof I&&I)||function(){return this}()||Function("return this")(),X="object"==typeof document&&document.all,ee=void 0===X&&void 0!==X?function(e){return"function"==typeof e||e===X}:function(e){return"function"==typeof e},te=ee,re=Z.WeakMap,ne=te(re)&&/native code/.test(String(re)),oe=ee,ie=function(e){return"object"==typeof e?null!==e:oe(e)},se=!O(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),ae={},ce=ie,ue=Z.document,le=ce(ue)&&ce(ue.createElement),he=function(e){return le?ue.createElement(e):{}},de=he,fe=!se&&!O(function(){return 7!==Object.defineProperty(de("div"),"a",{get:function(){return 7}}).a}),pe=se&&O(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),ve=ie,ge=String,me=TypeError,ye=function(e){if(ve(e))return e;throw new me(ge(e)+" is not an object")},be=R,_e=Function.prototype.call,we=be?_e.bind(_e):function(){return _e.apply(_e,arguments)},Se={},Ie=Se,Te=Z,Pe=ee,Ee=function(e){return Pe(e)?e:void 0},Oe=function(e,t){return arguments.length<2?Ee(Ie[e])||Ee(Te[e]):Ie[e]&&Ie[e][t]||Te[e]&&Te[e][t]},Re=q({}.isPrototypeOf),Ce=Z.navigator,Ae=Ce&&Ce.userAgent,ke=Z,Ue=Ae?String(Ae):"",qe=ke.process,Le=ke.Deno,xe=qe&&qe.versions||Le&&Le.version,Ne=xe&&xe.v8;Ne&&(E=(P=Ne.split("."))[0]>0&&P[0]<4?1:+(P[0]+P[1])),!E&&Ue&&(!(P=Ue.match(/Edge\/(\d+)/))||P[1]>=74)&&(P=Ue.match(/Chrome\/(\d+)/))&&(E=+P[1]);var je=E,De=O,Be=Z.String,Me=!!Object.getOwnPropertySymbols&&!De(function(){var e=Symbol("symbol detection");return!Be(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&je&&je<41}),We=Me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Fe=Oe,He=ee,ze=Re,Ve=Object,Ge=We?function(e){return"symbol"==typeof e}:function(e){var t=Fe("Symbol");return He(t)&&ze(t.prototype,Ve(e))},Ke=String,Ye=function(e){try{return Ke(e)}catch(e){return"Object"}},Qe=ee,Je=Ye,$e=TypeError,Ze=function(e){if(Qe(e))return e;throw new $e(Je(e)+" is not a function")},Xe=Ze,et=H,tt=function(e,t){var r=e[t];return et(r)?void 0:Xe(r)},rt=we,nt=ee,ot=ie,it=TypeError,st={exports:{}},at=Z,ct=Object.defineProperty,ut=Z,lt=function(e,t){try{ct(at,e,{value:t,configurable:!0,writable:!0})}catch(r){at[e]=t}return t},ht="__core-js_shared__",dt=st.exports=ut[ht]||lt(ht,{});(dt.versions||(dt.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 ft=st.exports,pt=ft,vt=function(e,t){return pt[e]||(pt[e]=t||{})},gt=G,mt=Object,yt=function(e){return mt(gt(e))},bt=yt,_t=q({}.hasOwnProperty),wt=Object.hasOwn||function(e,t){return _t(bt(e),t)},St=q,It=0,Tt=Math.random(),Pt=St(1.1.toString),Et=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Pt(++It+Tt,36)},Ot=vt,Rt=wt,Ct=Et,At=Me,kt=We,Ut=Z.Symbol,qt=Ot("wks"),Lt=kt?Ut.for||Ut:Ut&&Ut.withoutSetter||Ct,xt=function(e){return Rt(qt,e)||(qt[e]=At&&Rt(Ut,e)?Ut[e]:Lt("Symbol."+e)),qt[e]},Nt=we,jt=ie,Dt=Ge,Bt=tt,Mt=function(e,t){var r,n;if("string"===t&&nt(r=e.toString)&&!ot(n=rt(r,e)))return n;if(nt(r=e.valueOf)&&!ot(n=rt(r,e)))return n;if("string"!==t&&nt(r=e.toString)&&!ot(n=rt(r,e)))return n;throw new it("Can't convert object to primitive value")},Wt=TypeError,Ft=xt("toPrimitive"),Ht=function(e,t){if(!jt(e)||Dt(e))return e;var r,n=Bt(e,Ft);if(n){if(void 0===t&&(t="default"),r=Nt(n,e,t),!jt(r)||Dt(r))return r;throw new Wt("Can't convert object to primitive value")}return void 0===t&&(t="number"),Mt(e,t)},zt=Ge,Vt=function(e){var t=Ht(e,"string");return zt(t)?t:t+""},Gt=se,Kt=fe,Yt=pe,Qt=ye,Jt=Vt,$t=TypeError,Zt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,er="enumerable",tr="configurable",rr="writable";ae.f=Gt?Yt?function(e,t,r){if(Qt(e),t=Jt(t),Qt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&rr in r&&!r[rr]){var n=Xt(e,t);n&&n[rr]&&(e[t]=r.value,r={configurable:tr in r?r[tr]:n[tr],enumerable:er in r?r[er]:n[er],writable:!1})}return Zt(e,t,r)}:Zt:function(e,t,r){if(Qt(e),t=Jt(t),Qt(r),Kt)try{return Zt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new $t("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var nr,or,ir,sr=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},ar=ae,cr=sr,ur=se?function(e,t,r){return ar.f(e,t,cr(1,r))}:function(e,t,r){return e[t]=r,e},lr=Et,hr=vt("keys"),dr=function(e){return hr[e]||(hr[e]=lr(e))},fr={},pr=ne,vr=Z,gr=ie,mr=ur,yr=wt,br=ft,_r=dr,wr=fr,Sr="Object already initialized",Ir=vr.TypeError,Tr=vr.WeakMap;if(pr||br.state){var Pr=br.state||(br.state=new Tr);Pr.get=Pr.get,Pr.has=Pr.has,Pr.set=Pr.set,nr=function(e,t){if(Pr.has(e))throw new Ir(Sr);return t.facade=e,Pr.set(e,t),t},or=function(e){return Pr.get(e)||{}},ir=function(e){return Pr.has(e)}}else{var Er=_r("state");wr[Er]=!0,nr=function(e,t){if(yr(e,Er))throw new Ir(Sr);return t.facade=e,mr(e,Er,t),t},or=function(e){return yr(e,Er)?e[Er]:{}},ir=function(e){return yr(e,Er)}}var Or={set:nr,get:or,has:ir,enforce:function(e){return ir(e)?or(e):nr(e,{})},getterFor:function(e){return function(t){var r;if(!gr(t)||(r=or(t)).type!==e)throw new Ir("Incompatible receiver, "+e+" required");return r}}},Rr=R,Cr=Function.prototype,Ar=Cr.apply,kr=Cr.call,Ur="object"==typeof Reflect&&Reflect.apply||(Rr?kr.bind(Ar):function(){return kr.apply(Ar,arguments)}),qr=j,Lr=q,xr=function(e){if("Function"===qr(e))return Lr(e)},Nr={},jr={},Dr={}.propertyIsEnumerable,Br=Object.getOwnPropertyDescriptor,Mr=Br&&!Dr.call({1:2},1);jr.f=Mr?function(e){var t=Br(this,e);return!!t&&t.enumerable}:Dr;var Wr=se,Fr=we,Hr=jr,zr=sr,Vr=Q,Gr=Vt,Kr=wt,Yr=fe,Qr=Object.getOwnPropertyDescriptor;Nr.f=Wr?Qr:function(e,t){if(e=Vr(e),t=Gr(t),Yr)try{return Qr(e,t)}catch(e){}if(Kr(e,t))return zr(!Fr(Hr.f,e,t),e[t])};var Jr=O,$r=ee,Zr=/#|\.prototype\./,Xr=function(e,t){var r=tn[en(e)];return r===nn||r!==rn&&($r(t)?Jr(t):!!t)},en=Xr.normalize=function(e){return String(e).replace(Zr,".").toLowerCase()},tn=Xr.data={},rn=Xr.NATIVE="N",nn=Xr.POLYFILL="P",on=Xr,sn=Ze,an=R,cn=xr(xr.bind),un=function(e,t){return sn(e),void 0===t?e:an?cn(e,t):function(){return e.apply(t,arguments)}},ln=Z,hn=Ur,dn=xr,fn=ee,pn=Nr.f,vn=on,gn=Se,mn=un,yn=ur,bn=wt,_n=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 hn(e,this,arguments)};return t.prototype=e.prototype,t},wn=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?ln:f?ln[h]:ln[h]&&ln[h].prototype,g=d?gn:gn[h]||yn(gn,h,{})[h],m=g.prototype;for(i in t)n=!(r=vn(d?i:h+(f?".":"#")+i,e.forced))&&v&&bn(v,i),a=g[i],n&&(c=e.dontCallGetSet?(l=pn(v,i))&&l.value:v[i]),s=n&&c?c:t[i],(r||p||typeof a!=typeof s)&&(u=e.bind&&n?mn(s,ln):e.wrap&&n?_n(s):p&&fn(s)?dn(s):s,(e.sham||s&&s.sham||a&&a.sham)&&yn(u,"sham",!0),yn(g,i,u),p&&(bn(gn,o=h+"Prototype")||yn(gn,o,{}),yn(gn[o],i,s),e.real&&m&&(r||!m[i])&&yn(m,i,s)))},Sn=se,In=wt,Tn=Function.prototype,Pn=Sn&&Object.getOwnPropertyDescriptor,En=In(Tn,"name"),On={EXISTS:En,PROPER:En&&"something"===function(){}.name,CONFIGURABLE:En&&(!Sn||Sn&&Pn(Tn,"name").configurable)},Rn={},Cn=Math.ceil,An=Math.floor,kn=Math.trunc||function(e){var t=+e;return(t>0?An:Cn)(t)},Un=kn,qn=function(e){var t=+e;return t!=t||0===t?0:Un(t)},Ln=qn,xn=Math.max,Nn=Math.min,jn=function(e,t){var r=Ln(e);return r<0?xn(r+t,0):Nn(r,t)},Dn=qn,Bn=Math.min,Mn=function(e){var t=Dn(e);return t>0?Bn(t,9007199254740991):0},Wn=function(e){return Mn(e.length)},Fn=Q,Hn=jn,zn=Wn,Vn=function(e){return function(t,r,n){var o=Fn(t),i=zn(o);if(0===i)return!e&&-1;var s,a=Hn(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}},Gn={includes:Vn(!0),indexOf:Vn(!1)},Kn=wt,Yn=Q,Qn=Gn.indexOf,Jn=fr,$n=q([].push),Zn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Xn=function(e,t){var r,n=Yn(e),o=0,i=[];for(r in n)!Kn(Jn,r)&&Kn(n,r)&&$n(i,r);for(;t.length>o;)Kn(n,r=t[o++])&&(~Qn(i,r)||$n(i,r));return i},eo=Zn,to=Object.keys||function(e){return Xn(e,eo)},ro=se,no=pe,oo=ae,io=ye,so=Q,ao=to;Rn.f=ro&&!no?Object.defineProperties:function(e,t){io(e);for(var r,n=so(t),o=ao(t),i=o.length,s=0;i>s;)oo.f(e,r=o[s++],n[r]);return e};var co,uo=Oe("document","documentElement"),lo=ye,ho=Rn,fo=Zn,po=fr,vo=uo,go=he,mo="prototype",yo="script",bo=dr("IE_PROTO"),_o=function(){},wo=function(e){return"<"+yo+">"+e+"</"+yo+">"},So=function(e){e.write(wo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Io=function(){try{co=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Io="undefined"!=typeof document?document.domain&&co?So(co):(t=go("iframe"),r="java"+yo+":",t.style.display="none",vo.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(wo("document.F=Object")),e.close(),e.F):So(co);for(var n=fo.length;n--;)delete Io[mo][fo[n]];return Io()};po[bo]=!0;var To,Po,Eo,Oo=Object.create||function(e,t){var r;return null!==e?(_o[mo]=lo(e),r=new _o,_o[mo]=null,r[bo]=e):r=Io(),void 0===t?r:ho.f(r,t)},Ro=!O(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),Co=wt,Ao=ee,ko=yt,Uo=Ro,qo=dr("IE_PROTO"),Lo=Object,xo=Lo.prototype,No=Uo?Lo.getPrototypeOf:function(e){var t=ko(e);if(Co(t,qo))return t[qo];var r=t.constructor;return Ao(r)&&t instanceof r?r.prototype:t instanceof Lo?xo:null},jo=ur,Do=function(e,t,r,n){return n&&n.enumerable?e[t]=r:jo(e,t,r),e},Bo=O,Mo=ee,Wo=ie,Fo=Oo,Ho=No,zo=Do,Vo=xt("iterator"),Go=!1;[].keys&&("next"in(Eo=[].keys())?(Po=Ho(Ho(Eo)))!==Object.prototype&&(To=Po):Go=!0);var Ko=!Wo(To)||Bo(function(){var e={};return To[Vo].call(e)!==e});Mo((To=Ko?{}:Fo(To))[Vo])||zo(To,Vo,function(){return this});var Yo={IteratorPrototype:To,BUGGY_SAFARI_ITERATORS:Go},Qo={};Qo[xt("toStringTag")]="z";var Jo="[object z]"===String(Qo),$o=Jo,Zo=ee,Xo=j,ei=xt("toStringTag"),ti=Object,ri="Arguments"===Xo(function(){return arguments}()),ni=$o?Xo: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=ti(e),ei))?r:ri?Xo(t):"Object"===(n=Xo(t))&&Zo(t.callee)?"Arguments":n},oi=ni,ii=Jo?{}.toString:function(){return"[object "+oi(this)+"]"},si=Jo,ai=ae.f,ci=ur,ui=wt,li=ii,hi=xt("toStringTag"),di=function(e,t,r,n){var o=r?e:e&&e.prototype;o&&(ui(o,hi)||ai(o,hi,{configurable:!0,value:t}),n&&!si&&ci(o,"toString",li))},fi=Yo.IteratorPrototype,pi=Oo,vi=sr,gi=di,mi=J,yi=function(){return this},bi=function(e,t,r,n){var o=t+" Iterator";return e.prototype=pi(fi,{next:vi(+!n,r)}),gi(e,o,!1,!0),mi[o]=yi,e},_i=wn,wi=we,Si=On,Ii=bi,Ti=No,Pi=di,Ei=Do,Oi=J,Ri=Yo,Ci=Si.PROPER,Ai=Ri.BUGGY_SAFARI_ITERATORS,ki=xt("iterator"),Ui="keys",qi="values",Li="entries",xi=function(){return this},Ni=function(e,t,r,n,o,i,s){Ii(r,t,n);var a,c,u,l=function(e){if(e===o&&v)return v;if(!Ai&&e&&e in f)return f[e];switch(e){case Ui:case qi:case Li:return function(){return new r(this,e)}}return function(){return new r(this)}},h=t+" Iterator",d=!1,f=e.prototype,p=f[ki]||f["@@iterator"]||o&&f[o],v=!Ai&&p||l(o),g="Array"===t&&f.entries||p;if(g&&(a=Ti(g.call(new e)))!==Object.prototype&&a.next&&(Pi(a,h,!0,!0),Oi[h]=xi),Ci&&o===qi&&p&&p.name!==qi&&(d=!0,v=function(){return wi(p,this)}),o)if(c={values:l(qi),keys:i?v:l(Ui),entries:l(Li)},s)for(u in c)(Ai||d||!(u in f))&&Ei(f,u,c[u]);else _i({target:t,proto:!0,forced:Ai||d},c);return s&&f[ki]!==v&&Ei(f,ki,v,{name:o}),Oi[t]=v,c},ji=function(e,t){return{value:e,done:t}},Di=Q,Bi=J,Mi=Or;ae.f;var Wi=Ni,Fi=ji,Hi="Array Iterator",zi=Mi.set,Vi=Mi.getterFor(Hi);Wi(Array,"Array",function(e,t){zi(this,{type:Hi,target:Di(e),index:0,kind:t})},function(){var e=Vi(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,Fi(void 0,!0);switch(e.kind){case"keys":return Fi(r,!1);case"values":return Fi(t[r],!1)}return Fi([r,t[r]],!1)},"values"),Bi.Arguments=Bi.Array;var Gi=wn,Ki=q,Yi=jn,Qi=RangeError,Ji=String.fromCharCode,$i=String.fromCodePoint,Zi=Ki([].join);Gi({target:"String",stat:!0,arity:1,forced:!!$i&&1!==$i.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,o=0;n>o;){if(t=+arguments[o++],Yi(t,1114111)!==t)throw new Qi(t+" is not a valid code point");r[o]=t<65536?Ji(t):Ji(55296+((t-=65536)>>10),t%1024+56320)}return Zi(r,"")}});var Xi=Z,es=se,ts=Object.getOwnPropertyDescriptor,rs=O,ns=!0,os=xt("iterator"),is=!rs(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&&ns||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[os]||"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}),ss=ae,as=function(e,t,r){return ss.f(e,t,r)},cs=Do,us=Re,ls=TypeError,hs=function(e,t){if(us(t,e))return e;throw new ls("Incorrect invocation")},ds=ni,fs=String,ps=function(e){if("Symbol"===ds(e))throw new TypeError("Cannot convert a Symbol value to a string");return fs(e)},vs=ni,gs=tt,ms=H,ys=J,bs=xt("iterator"),_s=function(e){if(!ms(e))return gs(e,bs)||gs(e,"@@iterator")||ys[vs(e)]},ws=we,Ss=Ze,Is=ye,Ts=Ye,Ps=_s,Es=TypeError,Os=function(e,t){var r=arguments.length<2?Ps(e):t;if(Ss(r))return Is(ws(r,e));throw new Es(Ts(e)+" is not iterable")},Rs=TypeError,Cs=function(e,t){if(e<t)throw new Rs("Not enough arguments");return e},As=q([].slice),ks=As,Us=Math.floor,qs=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=Us(r/2),a=qs(ks(e,0,s),t),c=qs(ks(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},Ls=wn,xs=Z,Ns=function(e){if(!es)return Xi[e];var t=ts(Xi,e);return t&&t.value},js=Oe,Ds=we,Bs=q,Ms=se,Ws=is,Fs=Do,Hs=as,zs=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},Vs=di,Gs=bi,Ks=Or,Ys=hs,Qs=ee,Js=wt,$s=un,Zs=ni,Xs=ye,ea=ie,ta=ps,ra=Oo,na=sr,oa=Os,ia=_s,sa=ji,aa=Cs,ca=qs,ua=xt("iterator"),la="URLSearchParams",ha=la+"Iterator",da=Ks.set,fa=Ks.getterFor(la),pa=Ks.getterFor(ha),va=Ns("fetch"),ga=Ns("Request"),ma=Ns("Headers"),ya=ga&&ga.prototype,ba=ma&&ma.prototype,_a=xs.TypeError,wa=xs.encodeURIComponent,Sa=String.fromCharCode,Ia=js("String","fromCodePoint"),Ta=parseInt,Pa=Bs("".charAt),Ea=Bs([].join),Oa=Bs([].push),Ra=Bs("".replace),Ca=Bs([].shift),Aa=Bs([].splice),ka=Bs("".split),Ua=Bs("".slice),qa=Bs(/./.exec),La=/\+/g,xa=/^[0-9a-f]+$/i,Na=function(e,t){var r=Ua(e,t,t+2);return qa(xa,r)?Ta(r,16):NaN},ja=function(e){for(var t=0,r=128;r>0&&0!==(e&r);r>>=1)t++;return t},Da=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},Ba=function(e){for(var t=(e=Ra(e,La," ")).length,r="",n=0;n<t;){var o=Pa(e,n);if("%"===o){if("%"===Pa(e,n+1)||n+3>t){r+="%",n++;continue}var i=Na(e,n+1);if(i!=i){r+=o,n++;continue}n+=2;var s=ja(i);if(0===s)o=Sa(i);else{if(1===s||s>4){r+="�",n++;continue}for(var a=[i],c=1;c<s&&!(++n+3>t||"%"!==Pa(e,n));){var u=Na(e,n+1);if(u!=u){n+=3;break}if(u>191||u<128)break;Oa(a,u),n+=2,c++}if(a.length!==s){r+="�";continue}var l=Da(a);null===l?r+="�":o=Ia(l)}}r+=o,n++}return r},Ma=/[!'()~]|%20/g,Wa={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Fa=function(e){return Wa[e]},Ha=function(e){return Ra(wa(e),Ma,Fa)},za=Gs(function(e,t){da(this,{type:ha,target:fa(e).entries,index:0,kind:t})},la,function(){var e=pa(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,sa(void 0,!0);var n=t[r];switch(e.kind){case"keys":return sa(n.key,!1);case"values":return sa(n.value,!1)}return sa([n.key,n.value],!1)},!0),Va=function(e){this.entries=[],this.url=null,void 0!==e&&(ea(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Pa(e,0)?Ua(e,1):e:ta(e)))};Va.prototype={type:la,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,o,i,s,a,c=this.entries,u=ia(e);if(u)for(r=(t=oa(e,u)).next;!(n=Ds(r,t)).done;){if(i=(o=oa(Xs(n.value))).next,(s=Ds(i,o)).done||(a=Ds(i,o)).done||!Ds(i,o).done)throw new _a("Expected sequence with length 2");Oa(c,{key:ta(s.value),value:ta(a.value)})}else for(var l in e)Js(e,l)&&Oa(c,{key:l,value:ta(e[l])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,o=ka(e,"&"),i=0;i<o.length;)(t=o[i++]).length&&(r=ka(t,"="),Oa(n,{key:Ba(Ca(r)),value:Ba(Ea(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],Oa(r,Ha(e.key)+"="+Ha(e.value));return Ea(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Ga=function(){Ys(this,Ka);var e=da(this,new Va(arguments.length>0?arguments[0]:void 0));Ms||(this.size=e.entries.length)},Ka=Ga.prototype;if(zs(Ka,{append:function(e,t){var r=fa(this);aa(arguments.length,2),Oa(r.entries,{key:ta(e),value:ta(t)}),Ms||this.length++,r.updateURL()},delete:function(e){for(var t=fa(this),r=aa(arguments.length,1),n=t.entries,o=ta(e),i=r<2?void 0:arguments[1],s=void 0===i?i:ta(i),a=0;a<n.length;){var c=n[a];if(c.key!==o||void 0!==s&&c.value!==s)a++;else if(Aa(n,a,1),void 0!==s)break}Ms||(this.size=n.length),t.updateURL()},get:function(e){var t=fa(this).entries;aa(arguments.length,1);for(var r=ta(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=fa(this).entries;aa(arguments.length,1);for(var r=ta(e),n=[],o=0;o<t.length;o++)t[o].key===r&&Oa(n,t[o].value);return n},has:function(e){for(var t=fa(this).entries,r=aa(arguments.length,1),n=ta(e),o=r<2?void 0:arguments[1],i=void 0===o?o:ta(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=fa(this);aa(arguments.length,1);for(var n,o=r.entries,i=!1,s=ta(e),a=ta(t),c=0;c<o.length;c++)(n=o[c]).key===s&&(i?Aa(o,c--,1):(i=!0,n.value=a));i||Oa(o,{key:s,value:a}),Ms||(this.size=o.length),r.updateURL()},sort:function(){var e=fa(this);ca(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,r=fa(this).entries,n=$s(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 za(this,"keys")},values:function(){return new za(this,"values")},entries:function(){return new za(this,"entries")}},{enumerable:!0}),Fs(Ka,ua,Ka.entries,{name:"entries"}),Fs(Ka,"toString",function(){return fa(this).serialize()},{enumerable:!0}),Ms&&Hs(Ka,"size",{get:function(){return fa(this).entries.length},configurable:!0,enumerable:!0}),Vs(Ga,la),Ls({global:!0,constructor:!0,forced:!Ws},{URLSearchParams:Ga}),!Ws&&Qs(ma)){var Ya=Bs(ba.has),Qa=Bs(ba.set),Ja=function(e){if(ea(e)){var t,r=e.body;if(Zs(r)===la)return t=e.headers?new ma(e.headers):new ma,Ya(t,"content-type")||Qa(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),ra(e,{body:na(0,ta(r)),headers:na(0,t)})}return e};if(Qs(va)&&Ls({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return va(e,arguments.length>1?Ja(arguments[1]):{})}}),Qs(ga)){var $a=function(e){return Ys(this,ya),new ga(e,arguments.length>1?Ja(arguments[1]):{})};ya.constructor=$a,$a.prototype=ya,Ls({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:$a})}}var Za={URLSearchParams:Ga,getState:fa},Xa=q,ec=qn,tc=ps,rc=G,nc=Xa("".charAt),oc=Xa("".charCodeAt),ic=Xa("".slice),sc=function(e){return function(t,r){var n,o,i=tc(rc(t)),s=ec(r),a=i.length;return s<0||s>=a?e?"":void 0:(n=oc(i,s))<55296||n>56319||s+1===a||(o=oc(i,s+1))<56320||o>57343?e?nc(i,s):n:e?ic(i,s,s+2):o-56320+(n-55296<<10)+65536}},ac={codeAt:sc(!1),charAt:sc(!0)},cc=ac.charAt,uc=ps,lc=Or,hc=Ni,dc=ji,fc="String Iterator",pc=lc.set,vc=lc.getterFor(fc);hc(String,"String",function(e){pc(this,{type:fc,string:uc(e),index:0})},function(){var e,t=vc(this),r=t.string,n=t.index;return n>=r.length?dc(void 0,!0):(e=cc(r,n),t.index+=e.length,dc(e,!1))});var gc={};gc.f=Object.getOwnPropertySymbols;var mc=se,yc=q,bc=we,_c=O,wc=to,Sc=gc,Ic=jr,Tc=yt,Pc=F,Ec=Object.assign,Oc=Object.defineProperty,Rc=yc([].concat),Cc=!Ec||_c(function(){if(mc&&1!==Ec({b:1},Ec(Oc({},"a",{enumerable:!0,get:function(){Oc(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!==Ec({},e)[r]||wc(Ec({},t)).join("")!==n})?function(e,t){for(var r=Tc(e),n=arguments.length,o=1,i=Sc.f,s=Ic.f;n>o;)for(var a,c=Pc(arguments[o++]),u=i?Rc(wc(c),i(c)):wc(c),l=u.length,h=0;l>h;)a=u[h++],mc&&!bc(s,c,a)||(r[a]=c[a]);return r}:Ec,Ac=we,kc=ye,Uc=tt,qc=ye,Lc=function(e,t,r){var n,o;kc(e);try{if(!(n=Uc(e,"return"))){if("throw"===t)throw r;return r}n=Ac(n,e)}catch(e){o=!0,n=e}if("throw"===t)throw r;if(o)throw n;return kc(n),r},xc=J,Nc=xt("iterator"),jc=Array.prototype,Dc=ee,Bc=ft,Mc=q(Function.toString);Dc(Bc.inspectSource)||(Bc.inspectSource=function(e){return Mc(e)});var Wc=Bc.inspectSource,Fc=q,Hc=O,zc=ee,Vc=ni,Gc=Wc,Kc=function(){},Yc=Oe("Reflect","construct"),Qc=/^\s*(?:class|function)\b/,Jc=Fc(Qc.exec),$c=!Qc.test(Kc),Zc=function(e){if(!zc(e))return!1;try{return Yc(Kc,[],e),!0}catch(e){return!1}},Xc=function(e){if(!zc(e))return!1;switch(Vc(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return $c||!!Jc(Qc,Gc(e))}catch(e){return!0}};Xc.sham=!0;var eu,tu=!Yc||Hc(function(){var e;return Zc(Zc.call)||!Zc(Object)||!Zc(function(){e=!0})||e})?Xc:Zc,ru=se,nu=ae,ou=sr,iu=un,su=we,au=yt,cu=function(e,t,r,n){try{return n?t(qc(r)[0],r[1]):t(r)}catch(t){Lc(e,"throw",t)}},uu=function(e){return void 0!==e&&(xc.Array===e||jc[Nc]===e)},lu=tu,hu=Wn,du=function(e,t,r){ru?nu.f(e,t,ou(0,r)):e[t]=r},fu=Os,pu=_s,vu=Array,gu=q,mu=2147483647,yu=/[^\0-\u007E]/,bu=/[.\u3002\uFF0E\uFF61]/g,_u="Overflow: input needs wider integers to process",wu=RangeError,Su=gu(bu.exec),Iu=Math.floor,Tu=String.fromCharCode,Pu=gu("".charCodeAt),Eu=gu([].join),Ou=gu([].push),Ru=gu("".replace),Cu=gu("".split),Au=gu("".toLowerCase),ku=function(e){return e+22+75*(e<26)},Uu=function(e,t,r){var n=0;for(e=r?Iu(e/700):e>>1,e+=Iu(e/t);e>455;)e=Iu(e/35),n+=36;return Iu(n+36*e/(e+38))},qu=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var o=Pu(e,r++);if(o>=55296&&o<=56319&&r<n){var i=Pu(e,r++);56320==(64512&i)?Ou(t,((1023&o)<<10)+(1023&i)+65536):(Ou(t,o),r--)}else Ou(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&&Ou(t,Tu(n));var c=t.length,u=c;for(c&&Ou(t,"-");u<o;){var l=mu;for(r=0;r<e.length;r++)(n=e[r])>=i&&n<l&&(l=n);var h=u+1;if(l-i>Iu((mu-s)/h))throw new wu(_u);for(s+=(l-i)*h,i=l,r=0;r<e.length;r++){if((n=e[r])<i&&++s>mu)throw new wu(_u);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;Ou(t,Tu(ku(p+v%g))),d=Iu(v/g),f+=36}Ou(t,Tu(ku(d))),a=Uu(s,h,u===c),s=0,u++}}s++,i++}return Eu(t,"")},Lu=wn,xu=se,Nu=is,ju=Z,Du=un,Bu=q,Mu=Do,Wu=as,Fu=hs,Hu=wt,zu=Cc,Vu=function(e){var t=au(e),r=lu(this),n=arguments.length,o=n>1?arguments[1]:void 0,i=void 0!==o;i&&(o=iu(o,n>2?arguments[2]:void 0));var s,a,c,u,l,h,d=pu(t),f=0;if(!d||this===vu&&uu(d))for(s=hu(t),a=r?new this(s):vu(s);s>f;f++)h=i?o(t[f],f):t[f],du(a,f,h);else for(a=r?new this:[],l=(u=fu(t,d)).next;!(c=su(l,u)).done;f++)h=i?cu(u,o,[c.value,f],!0):c.value,du(a,f,h);return a.length=f,a},Gu=As,Ku=ac.codeAt,Yu=function(e){var t,r,n=[],o=Cu(Ru(Au(e),bu,"."),".");for(t=0;t<o.length;t++)r=o[t],Ou(n,Su(yu,r)?"xn--"+qu(r):r);return Eu(n,".")},Qu=ps,Ju=di,$u=Cs,Zu=Za,Xu=Or,el=Xu.set,tl=Xu.getterFor("URL"),rl=Zu.URLSearchParams,nl=Zu.getState,ol=ju.URL,il=ju.TypeError,sl=ju.parseInt,al=Math.floor,cl=Math.pow,ul=Bu("".charAt),ll=Bu(/./.exec),hl=Bu([].join),dl=Bu(1.1.toString),fl=Bu([].pop),pl=Bu([].push),vl=Bu("".replace),gl=Bu([].shift),ml=Bu("".split),yl=Bu("".slice),bl=Bu("".toLowerCase),_l=Bu([].unshift),wl="Invalid scheme",Sl="Invalid host",Il="Invalid port",Tl=/[a-z]/i,Pl=/[\d+-.a-z]/i,El=/\d/,Ol=/^0x/i,Rl=/^[0-7]+$/,Cl=/^\d+$/,Al=/^[\da-f]+$/i,kl=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Ul=/[\0\t\n\r #/:<>?@[\\\]^|]/,ql=/^[\u0000-\u0020]+/,Ll=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,xl=/[\t\n\r]/g,Nl=function(e){var t,r,n,o;if("number"==typeof e){for(t=[],r=0;r<4;r++)_l(t,e%256),e=al(e/256);return hl(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+=dl(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},jl={},Dl=zu({},jl,{" ":1,'"':1,"<":1,">":1,"`":1}),Bl=zu({},Dl,{"#":1,"?":1,"{":1,"}":1}),Ml=zu({},Bl,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Wl=function(e,t){var r=Ku(e,0);return r>32&&r<127&&!Hu(t,e)?e:encodeURIComponent(e)},Fl={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Hl=function(e,t){var r;return 2===e.length&&ll(Tl,ul(e,0))&&(":"===(r=ul(e,1))||!t&&"|"===r)},zl=function(e){var t;return e.length>1&&Hl(yl(e,0,2))&&(2===e.length||"/"===(t=ul(e,2))||"\\"===t||"?"===t||"#"===t)},Vl=function(e){return"."===e||"%2e"===bl(e)},Gl=function(e){return".."===(e=bl(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},Kl={},Yl={},Ql={},Jl={},$l={},Zl={},Xl={},eh={},th={},rh={},nh={},oh={},ih={},sh={},ah={},ch={},uh={},lh={},hh={},dh={},fh={},ph=function(e,t,r){var n,o,i,s=Qu(e);if(t){if(o=this.parse(s))throw new il(o);this.searchParams=null}else{if(void 0!==r&&(n=new ph(r,!0)),o=this.parse(s,null,n))throw new il(o);(i=nl(new rl)).bindURL(this),this.searchParams=i}};ph.prototype={type:"URL",parse:function(e,t,r){var n,o,i,s,a=this,c=t||Kl,u=0,l="",h=!1,d=!1,f=!1;for(e=Qu(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=vl(e,ql,""),e=vl(e,Ll,"$1")),e=vl(e,xl,""),n=Vu(e);u<=n.length;){switch(o=n[u],c){case Kl:if(!o||!ll(Tl,o)){if(t)return wl;c=Ql;continue}l+=bl(o),c=Yl;break;case Yl:if(o&&(ll(Pl,o)||"+"===o||"-"===o||"."===o))l+=bl(o);else{if(":"!==o){if(t)return wl;l="",c=Ql,u=0;continue}if(t&&(a.isSpecial()!==Hu(Fl,l)||"file"===l&&(a.includesCredentials()||null!==a.port)||"file"===a.scheme&&!a.host))return;if(a.scheme=l,t)return void(a.isSpecial()&&Fl[a.scheme]===a.port&&(a.port=null));l="","file"===a.scheme?c=sh:a.isSpecial()&&r&&r.scheme===a.scheme?c=Jl:a.isSpecial()?c=eh:"/"===n[u+1]?(c=$l,u++):(a.cannotBeABaseURL=!0,pl(a.path,""),c=hh)}break;case Ql:if(!r||r.cannotBeABaseURL&&"#"!==o)return wl;if(r.cannotBeABaseURL&&"#"===o){a.scheme=r.scheme,a.path=Gu(r.path),a.query=r.query,a.fragment="",a.cannotBeABaseURL=!0,c=fh;break}c="file"===r.scheme?sh:Zl;continue;case Jl:if("/"!==o||"/"!==n[u+1]){c=Zl;continue}c=th,u++;break;case $l:if("/"===o){c=rh;break}c=lh;continue;case Zl:if(a.scheme=r.scheme,o===eu)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Gu(r.path),a.query=r.query;else if("/"===o||"\\"===o&&a.isSpecial())c=Xl;else if("?"===o)a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Gu(r.path),a.query="",c=dh;else{if("#"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Gu(r.path),a.path.length--,c=lh;continue}a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,a.path=Gu(r.path),a.query=r.query,a.fragment="",c=fh}break;case Xl:if(!a.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){a.username=r.username,a.password=r.password,a.host=r.host,a.port=r.port,c=lh;continue}c=rh}else c=th;break;case eh:if(c=th,"/"!==o||"/"!==ul(l,u+1))continue;u++;break;case th:if("/"!==o&&"\\"!==o){c=rh;continue}break;case rh:if("@"===o){h&&(l="%40"+l),h=!0,i=Vu(l);for(var p=0;p<i.length;p++){var v=i[p];if(":"!==v||f){var g=Wl(v,Ml);f?a.password+=g:a.username+=g}else f=!0}l=""}else if(o===eu||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(h&&""===l)return"Invalid authority";u-=Vu(l).length+1,l="",c=nh}else l+=o;break;case nh:case oh:if(t&&"file"===a.scheme){c=ch;continue}if(":"!==o||d){if(o===eu||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()){if(a.isSpecial()&&""===l)return Sl;if(t&&""===l&&(a.includesCredentials()||null!==a.port))return;if(s=a.parseHost(l))return s;if(l="",c=uh,t)return;continue}"["===o?d=!0:"]"===o&&(d=!1),l+=o}else{if(""===l)return Sl;if(s=a.parseHost(l))return s;if(l="",c=ih,t===oh)return}break;case ih:if(!ll(El,o)){if(o===eu||"/"===o||"?"===o||"#"===o||"\\"===o&&a.isSpecial()||t){if(""!==l){var m=sl(l,10);if(m>65535)return Il;a.port=a.isSpecial()&&m===Fl[a.scheme]?null:m,l=""}if(t)return;c=uh;continue}return Il}l+=o;break;case sh:if(a.scheme="file","/"===o||"\\"===o)c=ah;else{if(!r||"file"!==r.scheme){c=lh;continue}switch(o){case eu:a.host=r.host,a.path=Gu(r.path),a.query=r.query;break;case"?":a.host=r.host,a.path=Gu(r.path),a.query="",c=dh;break;case"#":a.host=r.host,a.path=Gu(r.path),a.query=r.query,a.fragment="",c=fh;break;default:zl(hl(Gu(n,u),""))||(a.host=r.host,a.path=Gu(r.path),a.shortenPath()),c=lh;continue}}break;case ah:if("/"===o||"\\"===o){c=ch;break}r&&"file"===r.scheme&&!zl(hl(Gu(n,u),""))&&(Hl(r.path[0],!0)?pl(a.path,r.path[0]):a.host=r.host),c=lh;continue;case ch:if(o===eu||"/"===o||"\\"===o||"?"===o||"#"===o){if(!t&&Hl(l))c=lh;else if(""===l){if(a.host="",t)return;c=uh}else{if(s=a.parseHost(l))return s;if("localhost"===a.host&&(a.host=""),t)return;l="",c=uh}continue}l+=o;break;case uh:if(a.isSpecial()){if(c=lh,"/"!==o&&"\\"!==o)continue}else if(t||"?"!==o)if(t||"#"!==o){if(o!==eu&&(c=lh,"/"!==o))continue}else a.fragment="",c=fh;else a.query="",c=dh;break;case lh:if(o===eu||"/"===o||"\\"===o&&a.isSpecial()||!t&&("?"===o||"#"===o)){if(Gl(l)?(a.shortenPath(),"/"===o||"\\"===o&&a.isSpecial()||pl(a.path,"")):Vl(l)?"/"===o||"\\"===o&&a.isSpecial()||pl(a.path,""):("file"===a.scheme&&!a.path.length&&Hl(l)&&(a.host&&(a.host=""),l=ul(l,0)+":"),pl(a.path,l)),l="","file"===a.scheme&&(o===eu||"?"===o||"#"===o))for(;a.path.length>1&&""===a.path[0];)gl(a.path);"?"===o?(a.query="",c=dh):"#"===o&&(a.fragment="",c=fh)}else l+=Wl(o,Bl);break;case hh:"?"===o?(a.query="",c=dh):"#"===o?(a.fragment="",c=fh):o!==eu&&(a.path[0]+=Wl(o,jl));break;case dh:t||"#"!==o?o!==eu&&("'"===o&&a.isSpecial()?a.query+="%27":a.query+="#"===o?"%23":Wl(o,jl)):(a.fragment="",c=fh);break;case fh:o!==eu&&(a.fragment+=Wl(o,Dl))}u++}},parseHost:function(e){var t,r,n;if("["===ul(e,0)){if("]"!==ul(e,e.length-1))return Sl;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 ul(e,h)};if(":"===d()){if(":"!==ul(e,1))return;h+=2,l=++u}for(;d();){if(8===u)return;if(":"!==d()){for(t=r=0;r<4&&ll(Al,d());)t=16*t+sl(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(!ll(El,d()))return;for(;ll(El,d());){if(i=sl(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}(yl(e,1,-1)),!t)return Sl;this.host=t}else if(this.isSpecial()){if(e=Yu(e),ll(kl,e))return Sl;if(t=function(e){var t,r,n,o,i,s,a,c=ml(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"===ul(o,0)&&(i=ll(Ol,o)?16:8,o=yl(o,8===i?1:2)),""===o)s=0;else{if(!ll(10===i?Cl:8===i?Rl:Al,o))return e;s=sl(o,i)}pl(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=fl(r),n=0;n<r.length;n++)a+=r[n]*cl(256,3-n);return a}(e),null===t)return Sl;this.host=t}else{if(ll(Ul,e))return Sl;for(t="",r=Vu(e),n=0;n<r.length;n++)t+=Wl(r[n],jl);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return Hu(Fl,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&Hl(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+=Nl(o),null!==i&&(u+=":"+i)):"file"===t&&(u+="//"),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+hl(s,"/"):"",null!==a&&(u+="?"+a),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw new il(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new vh(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+Nl(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Qu(e)+":",Kl)},getUsername:function(){return this.username},setUsername:function(e){var t=Vu(Qu(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Wl(t[r],Ml)}},getPassword:function(){return this.password},setPassword:function(e){var t=Vu(Qu(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Wl(t[r],Ml)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Nl(e):Nl(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,nh)},getHostname:function(){var e=this.host;return null===e?"":Nl(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,oh)},getPort:function(){var e=this.port;return null===e?"":Qu(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=Qu(e))?this.port=null:this.parse(e,ih))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+hl(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,uh))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=Qu(e))?this.query=null:("?"===ul(e,0)&&(e=yl(e,1)),this.query="",this.parse(e,dh)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=Qu(e))?("#"===ul(e,0)&&(e=yl(e,1)),this.fragment="",this.parse(e,fh)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var vh=function(e){var t=Fu(this,gh),r=$u(arguments.length,1)>1?arguments[1]:void 0,n=el(t,new ph(e,!1,r));xu||(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())},gh=vh.prototype,mh=function(e,t){return{get:function(){return tl(this)[e]()},set:t&&function(e){return tl(this)[t](e)},configurable:!0,enumerable:!0}};if(xu&&(Wu(gh,"href",mh("serialize","setHref")),Wu(gh,"origin",mh("getOrigin")),Wu(gh,"protocol",mh("getProtocol","setProtocol")),Wu(gh,"username",mh("getUsername","setUsername")),Wu(gh,"password",mh("getPassword","setPassword")),Wu(gh,"host",mh("getHost","setHost")),Wu(gh,"hostname",mh("getHostname","setHostname")),Wu(gh,"port",mh("getPort","setPort")),Wu(gh,"pathname",mh("getPathname","setPathname")),Wu(gh,"search",mh("getSearch","setSearch")),Wu(gh,"searchParams",mh("getSearchParams")),Wu(gh,"hash",mh("getHash","setHash"))),Mu(gh,"toJSON",function(){return tl(this).serialize()},{enumerable:!0}),Mu(gh,"toString",function(){return tl(this).serialize()},{enumerable:!0}),ol){var yh=ol.createObjectURL,bh=ol.revokeObjectURL;yh&&Mu(vh,"createObjectURL",Du(yh,ol)),bh&&Mu(vh,"revokeObjectURL",Du(bh,ol))}Ju(vh,"URL"),Lu({global:!0,constructor:!0,forced:!Nu,sham:!xu},{URL:vh});var _h=wn,wh=O,Sh=Cs,Ih=ps,Th=is,Ph=Oe("URL"),Eh=Th&&wh(function(){Ph.canParse()}),Oh=wh(function(){return 1!==Ph.canParse.length});_h({target:"URL",stat:!0,forced:!Eh||Oh},{canParse:function(e){var t=Sh(arguments.length,1),r=Ih(e),n=t<2||void 0===arguments[1]?void 0:Ih(arguments[1]);try{return!!new Ph(r,n)}catch(e){return!1}}});var Rh=wn,Ch=Cs,Ah=ps,kh=is,Uh=Oe("URL");Rh({target:"URL",stat:!0,forced:!kh},{parse:function(e){var t=Ch(arguments.length,1),r=Ah(e),n=t<2||void 0===arguments[1]?void 0:Ah(arguments[1]);try{return new Uh(r,n)}catch(e){return null}}});var qh=T(Se.URL),Lh=function(e){function r(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 t(r,e),r}(Error),xh=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 i=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(function(e){return n(r,0,void 0,function(){var t,r,n,i,s,a,c,u,l,h,d,f;return o(this,function(o){switch(o.label){case 0:return t=null,r=null,n=null,i=e.status,s=e.statusText,e.ok?"HEAD"===this.method?[3,2]:[4,e.text()]:[3,3];case 1:""===(u=o.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)),o.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,i=406,s="Not Acceptable"):r=1===r.length?r[0]:null),[3,5];case 3:return[4,e.text()];case 4:u=o.sent();try{t=JSON.parse(u),Array.isArray(t)&&404===e.status&&(r=[],t=null,i=200,s="OK")}catch(r){404===e.status&&""===u?(i=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,i=200,s="OK"),t&&this.shouldThrowOnError)throw new Lh(t);o.label=5;case 5:return[2,{error:t,data:r,count:n,status:i,statusText:s}]}})})});return this.shouldThrowOnError||(i=i.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:""}})),i.then(e,t)},e.prototype.returns=function(){return this},e.prototype.overrideTypes=function(){return this},e}(),Nh=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.prototype.eq=function(e,t){return this.url.searchParams.append(e,"eq.".concat(t)),this},r.prototype.neq=function(e,t){return this.url.searchParams.append(e,"neq.".concat(t)),this},r.prototype.gt=function(e,t){return this.url.searchParams.append(e,"gt.".concat(t)),this},r.prototype.gte=function(e,t){return this.url.searchParams.append(e,"gte.".concat(t)),this},r.prototype.lt=function(e,t){return this.url.searchParams.append(e,"lt.".concat(t)),this},r.prototype.lte=function(e,t){return this.url.searchParams.append(e,"lte.".concat(t)),this},r.prototype.like=function(e,t){return this.url.searchParams.append(e,"like.".concat(t)),this},r.prototype.likeAllOf=function(e,t){return this.url.searchParams.append(e,"like(all).{".concat(t.join(","),"}")),this},r.prototype.likeAnyOf=function(e,t){return this.url.searchParams.append(e,"like(any).{".concat(t.join(","),"}")),this},r.prototype.ilike=function(e,t){return this.url.searchParams.append(e,"ilike.".concat(t)),this},r.prototype.ilikeAllOf=function(e,t){return this.url.searchParams.append(e,"ilike(all).{".concat(t.join(","),"}")),this},r.prototype.ilikeAnyOf=function(e,t){return this.url.searchParams.append(e,"ilike(any).{".concat(t.join(","),"}")),this},r.prototype.is=function(e,t){return this.url.searchParams.append(e,"is.".concat(t)),this},r.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},r.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},r.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},r.prototype.rangeGt=function(e,t){return this.url.searchParams.append(e,"sr.".concat(t)),this},r.prototype.rangeGte=function(e,t){return this.url.searchParams.append(e,"nxl.".concat(t)),this},r.prototype.rangeLt=function(e,t){return this.url.searchParams.append(e,"sl.".concat(t)),this},r.prototype.rangeLte=function(e,t){return this.url.searchParams.append(e,"nxr.".concat(t)),this},r.prototype.rangeAdjacent=function(e,t){return this.url.searchParams.append(e,"adj.".concat(t)),this},r.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},r.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},r.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},r.prototype.not=function(e,t,r){return this.url.searchParams.append(e,"not.".concat(t,".").concat(r)),this},r.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},r.prototype.filter=function(e,t,r){return this.url.searchParams.append(e,"".concat(t,".").concat(r)),this},r}(function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.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},r.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},r.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},r.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},r.prototype.abortSignal=function(e){return this.signal=e,this},r.prototype.single=function(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this},r.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},r.prototype.csv=function(){return this.headers.set("Accept","text/csv"),this},r.prototype.geojson=function(){return this.headers.set("Accept","application/geo+json"),this},r.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},r.prototype.rollback=function(){return this.headers.append("Prefer","tx=rollback"),this},r.prototype.returns=function(){return this},r.prototype.maxAffected=function(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer","max-affected=".concat(e)),this},r}(xh)),jh=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 Nh({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 Nh({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 Nh({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 Nh({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 Nh({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch})},e}(),Dh=function(e){function r(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 t(r,e),r}(jh),Bh=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 qh("".concat(this.url,"/").concat(e));return new Dh(t,{headers:this.headers,fetch:this.fetch})},e}();function Mh(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 Wh(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 Fh(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wh(Object(r),!0).forEach(function(t){Mh(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wh(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}const Hh="/auth";var zh,Vh,Gh,Kh;!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"}(zh||(zh={})),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"}(Vh||(Vh={})),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"}(Gh||(Gh={})),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"}(Kh||(Kh={}));const Yh="sign_out",Qh="sign_in",Jh="credentials_error",$h="SIGNED_OUT",Zh="SIGNED_IN",Xh="INITIAL_SESSION",ed="PASSWORD_RECOVERY",td="TOKEN_REFRESHED",rd="USER_UPDATED",nd="BIND_IDENTITY",od="loginStateChanged",id="authStateChanged",sd="sign_in",ad="bind_identity";var cd;function ud(){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"}(cd||(cd={}));const ld=e=>{const t=t=>{for(const r in e)e.hasOwnProperty(r)&&(t[r]=ld(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}},hd=e=>{const t=e.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return t&&t[2]||""};let dd=new Map;class fd{constructor(e){this.clientId=(null==e?void 0:e.clientId)||"",dd=dd||new Map}async run(e,t){e="".concat(this.clientId,"_").concat(e);let r=dd.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{dd.delete(e)}})()}),dd.set(e,r)),r}runIdlePromise(){return Promise.resolve()}}const pd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",vd=/^(?:[A-Za-z\d+/]{4})*?(?:[A-Za-z\d+/]{2}(?:==)?|[A-Za-z\d+/]{3}=?)?$/;const gd=function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!vd.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=pd.indexOf(e.charAt(i++))<<18|pd.indexOf(e.charAt(i++))<<12|(r=pd.indexOf(e.charAt(i++)))<<6|(n=pd.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 md(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(gd(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 gd(t)}}function yd(){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 bd=!1;function _d(){bd=bd||void 0!==typeof window&&"miniprogram"===window.__wxjs_environment}try{yd()||(bd=bd||!!navigator.userAgent.match(/miniprogram/i)||"miniprogram"===window.__wxjs_environment,window&&window.WeixinJSBridge&&window.WeixinJSBridge.invoke?_d():"undefined"!=typeof document&&document.addEventListener("WeixinJSBridgeReady",_d,!1))}catch(cf){}var wd,Sd="undefined"!=typeof process&&void 0!==process.env&&"development"===process.env.NODE_ENV,Id="https://support.qq.com/products/148793",Td="INVALID_PARAMS",Pd="INVALID_OPERATION",Ed="OPERATION_FAIL";!function(e){e.local="local",e.none="none",e.session="session"}(wd||(wd={}));var Od=function(){},Rd=function(){},Cd=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 Ad(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 kd(e,t){console.warn("[".concat("@cloudbase/js-sdk","][").concat(e,"]:").concat(t))}function Ud(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat("@cloudbase/js-sdk","][").concat(e,"]:").concat(t)}))}function qd(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 Ld(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=Cd(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 xd=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)}}(),Nd=this&&this.__assign||function(){return Nd=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},Nd.apply(this,arguments)},jd=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())})},Dd=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])}}},Bd=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 xd(t,e),t.prototype.get=function(e){return this.request(Nd(Nd({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(Nd(Nd({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(Nd(Nd({},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(Nd(Nd({},e),{data:c,method:a}),this.restrictedMethods.includes("upload"))):this.request(Nd(Nd({},e),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return jd(this,void 0,void 0,function(){var t,r,n,o;return Dd(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(Nd(Nd({},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 jd(this,void 0,void 0,function(){var r,n,o,i,s,a,c,u,l,h,d,f,p,v=this;return Dd(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,Nd(Nd({},e),{signal:r.signal})).then(function(e){return jd(v,void 0,void 0,function(){var t,r,n;return Dd(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}(Od);var Md,Wd=this&&this.__assign||function(){return Wd=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},Wd.apply(this,arguments)};function Fd(){return{adapter:Wd({},{type:"default",root:window,reqClass:Bd,wsClass:WebSocket,localStorage:localStorage}),runtime:Md.WEB}}!function(e){e.WEB="web",e.WX_MP="wx_mp"}(Md||(Md={}));var Hd=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)}}(),zd=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())})},Vd=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])}}},Gd=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return Hd(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}(Rd);var Kd=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:(kd(Td,"localStorage is not supported on current platform"),new Gd(t.root));case"none":return new Gd(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:Ed,msg:"[".concat("@cloudbase/js-sdk","][").concat(Ed,"]setStore failed"),info:e}))}}else kd(Pd,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return zd(this,void 0,void 0,function(){var n;return Vd(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:""}kd(Pd,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return zd(this,void 0,void 0,function(){var n;return Vd(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):kd(Pd,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return zd(this,void 0,void 0,function(){return Vd(this,function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}})})},e}(),Yd=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)}}(),Qd=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 Jd=function(e,t){this.data=t||null,this.name=e},$d=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return Yd(t,e),t}(Jd),Zd=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,$d))return console.error(e.error),this;var r="string"==typeof e?new Jd(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,i=this.listeners[n]?Qd([],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}(),Xd=new Zd,ef=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())})},tf=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])}}},rf=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(rf=-1!==navigator.userAgent.indexOf("Firefox"));var nf=rf?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,of=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function sf(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(Sd){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 nf.test(e)});if(-1!==n){var o=of.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=af({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}})),qd(f),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ef(this,void 0,void 0,function(){var t,r,n,o,h,d,f,p;return tf(this,function(v){switch(v.label){case 0:t=af({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}})),qd(f),n;case 4:return[2]}})})}}}}function af(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=rf?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),c=rf?/^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(of,o)),(i=new Error).stack="".concat(rf?"@debugger":"Error","\n").concat(l.join("\n"))}return i}function cf(e){this.message=e}function uf(e){this.message=e}cf.prototype=new Error,cf.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),uf.prototype=new Error,uf.prototype.name="InvalidTokenError";const lf="x-request-id",hf="x-device-id",df="device_id",ff=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:Kh.UNREACHABLE,error_description:t.message,error_uri:new URL(e).pathname}}if(n)throw n;return r};const pf=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 vf(e){let t=!0;return null!=e&&e.expires_at&&null!=e&&e.access_token&&(t=e.expires_at<new Date),t}class gf{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 fd({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(vf(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 mf{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||Hh,this.clientId=e.clientId,this.i18n=e.i18n,this.eventBus=e.eventBus,this.singlePromise=new fd({clientId:this.clientId}),this.retry=this.formatRetry(e.retry,mf.defaultRetry),e.baseRequest?this.baseRequest=e.baseRequest:this.baseRequest=ff,this.tokenInURL=e.tokenInURL,this.headers=e.headers,this.storage=e.storage||pf,this.localCredentials=new gf({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+=pd.charAt(t>>18&63)+pd.charAt(t>>12&63)+pd.charAt(t>>6&63)+pd.charAt(63&t)}return a?i.slice(0,a-3)+"===".substring(a):i}("".concat(e.clientId,":").concat(this.clientSecret)))),this.wxCloud=e.wxCloud;try{yd()&&(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,Xd.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:Kh.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=Fh(Fh({},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=Fh(Fh({},this.headers),t.headers)),t.headers[lf]||(t.headers[lf]=ud()),!t.headers[hf]){const e=await this.getDeviceId();t.headers[hf]=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===Kh.UNAUTHENTICATED)return await this.setCredentials(null),Promise.reject(e);if(r===s||!e||"unreachable"!==e.error)return Promise.reject(e)}await this.sleep(mf.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:Fh({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=hd(e)):r=null==s?void 0:s.body}catch(t){n={error:Kh.UNREACHABLE,error_description:t.message,error_uri:hd(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(id,{event:td}),t}catch(e){var o;if(null!=t&&t.throwError)throw e;if(e.error===Kh.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<mf.minRetry||e>mf.maxRetry)&&(t={error:Kh.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(zh.AUTH_SIGN_IN_ANONYMOUSLY_URL,{method:"POST",withBasicAuth:!0,body:{}});return await this.localCredentials.setCredentials(e),e}catch(e){return e.error===Kh.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=zh.AUTH_TOKEN_URL;"v2"===(null==t?void 0:t.version)&&(n=Vh.AUTH_TOKEN_URL);return Fh(Fh({},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(df);return"string"==typeof e&&e.length>=16&&e.length<=48||(e=ud(),await this.storage.setItem(df,e)),this.deviceID=e,e}unAuthenticatedError(e){const t={error:Kh.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(vf(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}}mf.defaultRetry=2,mf.minRetry=0,mf.maxRetry=5,mf.retryInterval=1e3;const yf=(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)}},bf=new Zd,_f="resolveCaptchaData",wf="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:999",Sf="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",If="margin-bottom:15px",Tf="display:flex;align-items:center;justify-content:space-between;margin-bottom:15px",Pf="width:100%;height:auto;border:1px solid #eee",Ef="padding:10px 8px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer;flex:1;white-space:nowrap;margin-left:10px",Of="width:100%;padding:14px 16px;margin-bottom:15px;box-sizing:border-box;border:2px solid #e8ecf4;border-radius:10px;font-size:15px",Rf="width:100%;padding:10px;background:#007bff;color:#fff;border:none;border-radius:4px;cursor:pointer",Cf="background:#6c757d;cursor:not-allowed",Af=async(e,t)=>{const{captchaData:r,state:n,token:o}=Ld(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=Fh(Fh({},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",wf),a=i("div",Sf);a.appendChild(i("p",If,"请输入你看到的字符:"));const c=i("div",Tf),u=i("img",Pf);u.id=n,u.src=r.captchaData,c.appendChild(u);const l=i("button",Ef,"刷新");l.onclick=yf(async()=>{l.textContent="加载中...",l.disabled=!0,l.style.cssText="".concat(Ef,";").concat(Cf);try{await o()}finally{l.textContent="刷新",l.disabled=!1,l.style.cssText=Ef}},500),c.appendChild(l),a.appendChild(c);const h=i("input",Of);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",Rf,"确定");p.onclick=yf(async()=>{const e=h.value.trim();if(e){d.style.display="none",p.textContent="验证中...",p.disabled=!0,p.style.cssText="".concat(Rf,";").concat(Cf);try{const n=await t.verifyCaptchaData({token:r.token,key:e});bf.fire(_f,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=Rf}}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("等待图形验证码校验结果..."),bf.on(_f,t=>{e(null==t?void 0:t.data)})})};class kf{constructor(e){e.openURIWithCallback||(e.openURIWithCallback=this.getDefaultOpenURIWithCallback()),e.storage||(e.storage=pf),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))||yd()}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===Kh.CAPTCHA_REQUIRED||n.error===Kh.CAPTCHA_INVALID?(e=await this.appendCaptchaTokenToURL(e,r,n.error===Kh.CAPTCHA_INVALID),this.config.request(e,t)):Promise.reject(n)}return n}getDefaultOpenURIWithCallback(){return e=>Af(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(zh.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 Uf{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 qf 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 Lf=["provider_redirect_uri","other_params"];async function xf(e,t){const r=async()=>{try{return require("../utils/encrypt")}catch(e){try{return await Promise.resolve().then(function(){return Kp})}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 Nf=class e{static parseParamsToSearch(e){Object.keys(e).forEach(t=>{e[t]||delete e[t]});return new Uf(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 mf(t)}if(!t){const n=r.request.bind(r),o=new kf(Fh({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||pf,adapter:e.adapter}}getParamsByVersion(e,t){var r;const n=ld(e),o=(null===(r={v2:Vh}[null==n?void 0:n.version])||void 0===r?void 0:r[t])||zh[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(Fh(Fh({},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(zh.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(zh.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(zh.AUTH_SIGNOUT_URL,{method:"POST",withCredentials:!0,body:e})}catch(e){e.error!==Kh.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(zh.AUTH_REVOKE_URL,{method:"POST",body:{token:r}});return await this.config.credentialsClient.setCredentials(),Promise.resolve(n)}async revokeAllDevices(){await this.config.request(zh.AUTH_REVOKE_ALL_URL,{method:"DELETE",withCredentials:!0})}async revokeDevice(e){await this.config.request(zh.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=ld(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(zh.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(Fh(Fh({},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,Lf);r&&!o.redirect_uri&&(o.redirect_uri=r);let i="".concat(zh.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(zh.PROVIDER_TOKEN_URL,{method:"POST",body:e,useWxCloud:t})}async patchProviderToken(e){return this.config.request(zh.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(Fh(Fh({},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:ad,provider:e.provider},error:null}}catch(e){r={data:{type:ad},error:new qf(e)}}var n,o;e.fireEvent&&(null===(n=this.config.eventBus)||void 0===n||null===(o=n.fire)||void 0===o||o.call(n,id,{event:nd,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 qf({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 qf({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===ad)v=await this.config.credentialsClient.localCredentials.getCredentials(),g=await this.toBindIdentity({provider:d,provider_token:p,credentials:v});else if(u.type===sd){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:Fh(Fh({},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 qf(t)}}}async signInCustom(e){const t=await this.config.request(zh.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(zh.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(zh.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 Uf(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(zh.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(zh.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(zh.PROVIDER_LIST,{method:"GET",withCredentials:!0})}async unbindProvider(e){return this.config.request("".concat(zh.PROVIDER_UNBIND_URL,"/").concat(e.provider_id),{method:"DELETE",withCredentials:!0})}async checkPassword(e){return this.config.request("".concat(zh.CHECK_PWD_URL),{method:"POST",withCredentials:!0,body:e})}async editContact(e){return this.config.request("".concat(zh.BIND_CONTACT_URL),{method:"PATCH",withCredentials:!0,body:e})}async setPassword(e){return this.config.request("".concat(zh.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(zh.SUDO_URL),{method:"POST",withCredentials:!0,body:e})}async sendVerificationCodeToCurrentUser(e){return e.target="CUR_USER",this.config.request(zh.VERIFICATION_URL,{method:"POST",body:e,withCredentials:!0,withCaptcha:!0})}async changeBoundProvider(e){return this.config.request("".concat(zh.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(zh.USER_PRIFILE_URL,{method:"PATCH",body:e,withCredentials:!0})}async updateUserBasicInfo(e){return this.config.request(zh.USER_BASIC_EDIT_URL,{method:"POST",withCredentials:!0,body:e})}async queryUserProfile(e){const t=new Uf(e);return this.config.request("".concat(zh.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(zh.AUTH_RESET_PASSWORD,{method:"POST",body:e})}async authorize(e){return this.config.request(zh.AUTHORIZE_URL,{method:"POST",withCredentials:!0,body:e})}async authorizeDevice(e){return this.config.request(zh.AUTHORIZE_DEVICE_URL,{method:"POST",withCredentials:!0,body:e})}async deviceAuthorize(e){return this.config.request(zh.AUTH_GET_DEVICE_CODE,{method:"POST",body:e,withCredentials:!0})}async authorizeInfo(t){const r="".concat(zh.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(zh.CHECK_USERNAME,{method:"GET",body:e,withCredentials:!0})}async checkIfUserExist(e){const t=new Uf(e);return this.config.request("".concat(zh.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(Fh(Fh({},t),{},{version:(null==e?void 0:e.version)||"v1"}))}async getCredentials(){return this.config.credentialsClient.getCredentials()}async getPublicKey(){return this.config.request(Vh.AUTH_PUBLIC_KEY,{method:"POST",body:{}})}async getEncryptParams(e){const{isEncrypt:t}=e;delete e.isEncrypt;const r=ld(e),n=await xf(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(zh.GET_PROVIDER_TYPE,{method:"POST",body:{provider_id:"weda"}})}async verifyCaptchaData(e){let{token:t,key:r}=e;return this.config.request(zh.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(zh.CAPTCHA_DATA_URL,{method:"POST",body:{state:t,redirect_uri:r},withCredentials:!1})}async getMiniProgramCode(e){return this.config.request(zh.GET_MINIPROGRAM_QRCODE,{method:"POST",body:e})}async getMiniProgramQrCodeStatus(e){return this.config.request(zh.GET_MINIPROGRAM_QRCODE_STATUS,{method:"POST",body:e})}async getUserBehaviorLog(e){const t="".concat(zh.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 xf(!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(zh.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 xf(!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(Vh.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 jf{constructor(e){const{apiOrigin:t,apiPath:r=Hh,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 mf({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 Nf(Fh(Fh({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 Df={exports:{}};"undefined"!=typeof window&&window,Df.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){
|
|
2
|
-
/**
|
|
3
|
-
* @license
|
|
4
|
-
* web-streams-polyfill v4.0.0
|
|
5
|
-
* Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
|
|
6
|
-
* This code is released under the MIT license.
|
|
7
|
-
* SPDX-License-Identifier: MIT
|
|
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 T(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=>T(e,t,[r])}function bt(e,t,r){return F(e,r),()=>T(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)=>T(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!==I?I: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(T(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=>T(e,t,[r])}function Cr(e,t,r){return F(e,r),r=>T(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=>T(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)=>T(e,t,[r,n])}function tn(e,t,r){return F(e,r),r=>T(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})}]);var Bf=T(Df.exports),Mf=this&&this.__assign||function(){return Mf=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},Mf.apply(this,arguments)},Wf=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())})},Ff=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])}}},Hf=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 Wf(this,void 0,void 0,function(){return Ff(this,function(t){return[2,this.localStorage.getItem(e)]})})},e.prototype.removeItem=function(e){return Wf(this,void 0,void 0,function(){return Ff(this,function(t){return this.localStorage.removeItem(e),[2]})})},e.prototype.setItem=function(e,t){return Wf(this,void 0,void 0,function(){return Ff(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}(),zf=/^[^:]+:\/\/[^/]+(\/[^?#]+)/,Vf=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 zf.test(e)?RegExp.$1:e}(null==t?void 0:t.url),e):(null==e?void 0:e.data)||{}};var Gf=function(e,t){var r=Mf({},e),n={};if((null==t?void 0:t.captchaOptions)&&(r.captchaOptions=t.captchaOptions),!Bf.isMatch()||e.storage&&e.baseRequest)return r;try{var o=Bf.genAdapter({}),i=o.localStorage,s=o.reqClass;if(i&&(n.storage=new Hf({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 Wf(this,void 0,void 0,function(){return Ff(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=Vf(e,Mf(Mf({},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),Mf(Mf({},r),n)}catch(e){console.error("adapter generate fail:",e)}return r},Kf=function(e){return e.adapter&&"default"!==e.adapter.type?function(e,t){var r=Mf({},e);try{if(!(null==e?void 0:e.storage)&&(null==t?void 0:t.localStorage)&&(r.storage=new Hf({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 Wf(this,void 0,void 0,function(){var c,u,l,h;return Ff(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(Mf({url:e},t))];case 2:return c=d.sent(),c=Vf(c,Mf(Mf({},t),{url:e})),[3,4];case 3:throw h=d.sent(),c=Mf(Mf({},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):Gf(e,e.adapter)};var Yf=this&&this.__assign||function(){return Yf=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},Yf.apply(this,arguments)},Qf=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},Jf=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},$f=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])}}},Xf=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},ep=function(){return"undefined"!=typeof window&&"undefined"!=typeof document},tp=function(e){return function(t){e.fire(od,Yf(Yf({},t),{eventType:Jh}))}},rp=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 $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){var e,t,r,n;return Zf(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 $f(this,void 0,void 0,function(){var t;return Zf(this,function(r){switch(r.label){case 0:return[4,this.oauthInstance.authApi.setUserProfile(Yf({},e))];case 1:return t=r.sent(),this.setLocalUserInfo(t),[2]}})})},e.prototype.updateUserBasicInfo=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){switch(t.label){case 0:return[4,this.oauthInstance.authApi.updateUserBasicInfo(Yf({},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&&Ud(Td,"username must be a string"),this.update({username:e})},e.prototype.refresh=function(e){return $f(this,void 0,void 0,function(){var t;return Zf(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 $f(this,void 0,void 0,function(){var t;return Zf(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]})},Qf([sf({title:"更新用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.update() 的语法或参数是否正确"," 2 - 用户信息中是否包含非法值","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"update",null),Qf([sf({title:"更新密码失败",messages:["请确认以下各项:"," 1 - 调用 User.updatePassword() 的语法或参数是否正确"," 3 - 新密码中是否包含非法字符","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[String,String]),Jf("design:returntype",void 0)],e.prototype,"updatePassword",null),Qf([sf({title:"更新用户名失败",messages:["请确认以下各项:"," 1 - 调用 User.updateUsername() 的语法或参数是否正确"," 2 - 当前环境是否开通了用户名密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[String]),Jf("design:returntype",void 0)],e.prototype,"updateUsername",null),Qf([sf({title:"刷新本地用户信息失败",messages:["请确认以下各项:"," 1 - 调用 User.refresh() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"refresh",null),e}(),np=function(){function e(e){var t=e.envId,r=e.cache,n=e.oauthInstance;t||Ud(Td,"envId is not defined"),this.cache=r,this.oauthInstance=n,this.user=new rp({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 $f(this,void 0,void 0,function(){return Zf(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}(),op=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 $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.editContact(e)]})})},e.prototype.unbindProvider=function(e){return $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.verify(e)]})})},e.prototype.getVerification=function(e,t){return $f(this,void 0,void 0,function(){return Zf(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}kd(Pd,"current platform's storage is asynchronous, please use getCurrentUser instead")},enumerable:!1,configurable:!0}),e.prototype.getCurrentUser=function(){return $f(this,void 0,void 0,function(){var e,t;return Zf(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,Yf(Yf({},e.user),t)];case 3:return[2,null]}})})},e.prototype.signInAnonymouslyInWx=function(e){var t=(void 0===e?{}:e).useWxCloud;return $f(this,void 0,void 0,function(){var e,r,n=this;return Zf(this,function(o){switch(o.label){case 0:if(!Bf.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,r=function(r){return $f(n,void 0,void 0,function(){var n,o;return Zf(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 $f(n,void 0,void 0,function(){var n;return Zf(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 $f(this,void 0,void 0,function(){var e,t,r=this;return Zf(this,function(n){switch(n.label){case 0:if(!Bf.isMatch())throw Error("wx api undefined");return e=wx.getAccountInfoSync().miniProgram,t=function(t){return $f(r,void 0,void 0,function(){var r;return Zf(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 $f(r,void 0,void 0,function(){var r;return Zf(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 $f(this,void 0,void 0,function(){var e=this;return Zf(this,function(t){switch(t.label){case 0:if(!Bf.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 $f(e,void 0,void 0,function(){var e,i,s,a,c;return Zf(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 $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.setPassword(e)]})})},e.prototype.isUsernameRegistered=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){switch(t.label){case 0:return"string"!=typeof e&&Ud(Td,"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 np({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance}):null;kd(Pd,"current platform's storage is asynchronous, please use getLoginState insteed")},e.prototype.getLoginState=function(){return $f(this,void 0,void 0,function(){var e;return Zf(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 np({envId:this.config.env,cache:this.cache,oauthInstance:this.oauthInstance})]:[2,null]}})})},e.prototype.getUserInfo=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2,this.getCurrentUser()]})})},e.prototype.getWedaUserInfo=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2,this.oauthInstance.authApi.getWedaUserInfo()]})})},e.prototype.updateUserBasicInfo=function(e){return $f(this,void 0,void 0,function(){var t;return Zf(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 $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.bindWithProvider(e)]})})},e.prototype.queryUser=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.queryUserProfile(e)]})})},e.prototype.getAccessToken=function(){return $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.grantProviderToken(e)]})})},e.prototype.patchProviderToken=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.patchProviderToken(e)]})})},e.prototype.signInWithProvider=function(e){return $f(this,void 0,void 0,function(){return Zf(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={}),$f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.genProviderRedirectUri(e)]})})},e.prototype.resetPassword=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.resetPassword(e)]})})},e.prototype.deviceAuthorize=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.deviceAuthorize(e)]})})},e.prototype.sudo=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.sudo(e)]})})},e.prototype.deleteMe=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.deleteMe(e)]})})},e.prototype.getProviders=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2,this.oauthInstance.authApi.getProviders()]})})},e.prototype.loginScope=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2,this.oauthInstance.authApi.loginScope()]})})},e.prototype.loginGroups=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2,this.oauthInstance.authApi.loginGroups()]})})},e.prototype.onLoginStateChanged=function(e){var t;return $f(this,void 0,void 0,function(){var r,n=this;return Zf(this,function(o){switch(o.label){case 0:return null===(t=this.config.eventBus)||void 0===t||t.on(od,function(t){return $f(n,void 0,void 0,function(){var r,n,o;return Zf(this,function(i){switch(i.label){case 0:return(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.eventType)===Jh?[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,Yf(Yf({},t),r)),[2]}})})}),[4,this.getLoginState()];case 1:return r=o.sent(),e.call(this,r),[2]}})})},e.prototype.refreshTokenForce=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.refreshTokenForce(e)]})})},e.prototype.getCredentials=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2,this.oauthInstance.authApi.getCredentials()]})})},e.prototype.setCredentials=function(e){return $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2,this.oauthInstance.authApi.getProviderSubType()]})})},e.prototype.createCaptchaData=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.createCaptchaData(e)]})})},e.prototype.verifyCaptchaData=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.verifyCaptchaData(e)]})})},e.prototype.getMiniProgramQrCode=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramCode(e)]})})},e.prototype.getMiniProgramQrCodeStatus=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.getMiniProgramQrCodeStatus(e)]})})},e.prototype.modifyPassword=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.modifyPassword(e)]})})},e.prototype.modifyPasswordWithoutLogin=function(e){return $f(this,void 0,void 0,function(){return Zf(this,function(t){return[2,this.oauthInstance.authApi.modifyPasswordWithoutLogin(e)]})})},e.prototype.getUserBehaviorLog=function(e){return $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){var e,t,n,i,a,u,h;return Zf(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(Yf(Yf({},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 $f(this,void 0,void 0,function(){var o;return Zf(this,function(i){switch(i.label){case 0:return[4,(o=new np({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(od,{eventType:Qh}),null===(n=this.config.eventBus)||void 0===n||n.fire(id,{event:Zh}),[2,o]}})})},e.prototype.setAccessKey=function(){return $f(this,void 0,void 0,function(){return Zf(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 $f(this,void 0,void 0,function(){var t,r,n,o;return Zf(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,Yf(Yf({},t),{data:{user:n.user,session:n},error:null})];case 4:return o=i.sent(),[2,{data:{},error:new qf(o)}];case 5:return[2]}})})},e.prototype.signUp=function(e){return $f(this,void 0,void 0,function(){var t,r,n=this;return Zf(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 $f(n,void 0,void 0,function(){var r,n,i,a,c;return Zf(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(Yf(Yf(Yf({},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 qf(c)}];case 9:return[2]}})})}},error:null}];case 4:return r=o.sent(),[2,{data:{},error:new qf(r)}];case 5:return[2]}})})},e.prototype.signOut=function(e){var t,r;return $f(this,void 0,void 0,function(){var n,o,i;return Zf(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(od,{eventType:Yh}),null===(r=this.config.eventBus)||void 0===r||r.fire(id,{event:$h}),[2,Yf(Yf({},o),{data:{},error:null})];case 3:return i=s.sent(),[2,{data:{},error:new qf(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 $f(this,void 0,void 0,function(){var t,r,n;return Zf(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(Yf({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 qf(n)}];case 4:return[2]}})})},e.prototype.signInWithIdToken=function(e){return $f(this,void 0,void 0,function(){var t,r,n;return Zf(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 qf(n)}];case 4:return[2]}})})},e.prototype.signInWithOtp=function(e){return $f(this,void 0,void 0,function(){var t,r,n=this;return Zf(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 $f(n,void 0,void 0,function(){return Zf(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 qf(r)}];case 3:return[2]}})})},e.prototype.verifyOAuth=function(e){return $f(this,void 0,void 0,function(){var t,r,n,o,i,s,a,c,u;return Zf(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)||Ad("code"),n=(null==e?void 0:e.state)||Ad("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)||Ad("provider"))?[4,this.grantProviderToken({provider_id:i,provider_redirect_uri:location.origin+location.pathname,provider_code:r})]:[2,{data:t,error:new qf({message:"Provider is required"})}]):[2,{data:{},error:new qf({message:"State is required"})}]:[2,{data:{},error:new qf({message:"Code is required"})}];case 2:return s=l.sent().provider_token,a=void 0,o.type!==ad?[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=Yf(Yf({},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 qf(u)}];case 8:return[2]}})})},e.prototype.signInWithOAuth=function(e){var t,r,n,o,i;return $f(this,void 0,void 0,function(){var s,a,c,u,l,h,d,f,p;return Zf(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)||sd}),ep()&&!(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 qf(p)}];case 3:return[2]}})})},e.prototype.signInWithSSO=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2]})})},e.prototype.signInWithWeb3=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2]})})},e.prototype.getClaims=function(){return $f(this,void 0,void 0,function(){var e,t,r;return Zf(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(md(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 qf(r)}];case 3:return[2]}})})},e.prototype.resetPasswordForEmail=function(e,t){return $f(this,void 0,void 0,function(){var r,n,o,i,s,a,c=this;return Zf(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 $f(c,void 0,void 0,function(){var o,i,a,c;return Zf(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(id,{event:ed}),[4,this.signInWithPassword({email:n?e:void 0,phone:n?void 0:e,password:t.password})];case 4:return i=u.sent(),r&&ep()&&window.location.assign(r),[2,i];case 5:return a=u.sent(),[2,{data:{},error:new qf(a)}];case 6:return[2]}})})}},error:null}];case 2:return a=u.sent(),[2,{data:{},error:new qf(a)}];case 3:return[2]}})})},e.prototype.resetPasswordForOld=function(e){return $f(this,void 0,void 0,function(){var t,r,n;return Zf(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 qf(n)}];case 4:return[2]}})})},e.prototype.verifyOtp=function(e){return $f(this,void 0,void 0,function(){var t,r,n,o;return Zf(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 qf(o)}];case 7:return[2]}})})},e.prototype.getSession=function(){return $f(this,void 0,void 0,function(){var e,t,r,n;return Zf(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:Yf(Yf({},e),{user:r}),user:r},error:null}];case 3:return n=o.sent(),[2,{data:{},error:new qf(n)}];case 4:return[2]}})})},e.prototype.refreshSession=function(e){return $f(this,void 0,void 0,function(){var t,r,n,o,i;return Zf(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:Yf(Yf({},r),{user:o})},error:null}];case 4:return i=s.sent(),[2,{data:{},error:new qf(i)}];case 5:return[2]}})})},e.prototype.getUser=function(){return $f(this,void 0,void 0,function(){var e,t;return Zf(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 qf(t)}];case 3:return[2]}})})},e.prototype.refreshUser=function(){return $f(this,void 0,void 0,function(){var e,t,r;return Zf(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 qf(r)}];case 4:return[2]}})})},e.prototype.updateUser=function(e){var t;return $f(this,void 0,void 0,function(){var r,n,o,i,s,a,c,u,l,h,d,f,p=this;return Zf(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 qf({message:"At least one field must be provided for update"});return r=e.email,n=e.phone,o=Xf(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 $f(p,void 0,void 0,function(){var r,n,o;return Zf(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(id,{event:rd}),[2,{data:{user:r},error:null}];case 11:return n=s.sent(),[2,{data:{},error:new qf(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(id,{event:rd}),[2,{data:Yf({user:d},a),error:null}];case 8:return f=v.sent(),[2,{data:{},error:new qf(f)}];case 9:return[2]}})})},e.prototype.getUserIdentities=function(){var e;return $f(this,void 0,void 0,function(){var t,r;return Zf(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 qf(r)}];case 3:return[2]}})})},e.prototype.linkIdentity=function(e){return $f(this,void 0,void 0,function(){var t;return Zf(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:ad}})];case 1:return r.sent(),[2,{data:{provider:e.provider},error:null}];case 2:return t=r.sent(),[2,{data:{},error:new qf(t)}];case 3:return[2]}})})},e.prototype.unlinkIdentity=function(e){return $f(this,void 0,void 0,function(){var t;return Zf(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 qf(t)}];case 3:return[2]}})})},e.prototype.reauthenticate=function(){return $f(this,void 0,void 0,function(){var e,t,r,n,o=this;return Zf(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 $f(o,void 0,void 0,function(){var n,o,i,s,a;return Zf(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(Yf(Yf({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 qf(a)}];case 10:return[2]}})})}},error:null}];case 3:return n=i.sent(),[2,{data:{},error:new qf(n)}];case 4:return[2]}})})},e.prototype.resend=function(e){return $f(this,void 0,void 0,function(){var t,r,n;return Zf(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 qf(n)}];case 3:return[2]}})})},e.prototype.setSession=function(e){var t;return $f(this,void 0,void 0,function(){var r,n,o;return Zf(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(id,{event:Zh}),[2,{data:{user:n.user,session:n},error:null}];case 3:return o=i.sent(),[2,{data:{},error:new qf(o)}];case 4:return[2]}})})},e.prototype.exchangeCodeForSession=function(){return $f(this,void 0,void 0,function(){return Zf(this,function(e){return[2]})})},e.prototype.deleteUser=function(e){return $f(this,void 0,void 0,function(){var t,r;return Zf(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 qf(r)}];case 4:return[2]}})})},e.prototype.toDefaultLoginPage=function(e){return void 0===e&&(e={}),$f(this,void 0,void 0,function(){var t,r,n,o,i;return Zf(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("&"),Bf.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 qf(e)}]}return[2]})})},e.prototype.signInWithCustomTicket=function(e){return $f(this,void 0,void 0,function(){var t,r,n,o;return Zf(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,Yf(Yf({},t),{data:{user:n.user,session:n},error:null})];case 5:return o=i.sent(),[2,{data:{},error:new qf(o)}];case 6:return[2]}})})},e.prototype.signInWithOpenId=function(e){var t=(void 0===e?{}:e).useWxCloud,r=void 0===t||t;return $f(this,void 0,void 0,function(){var e,t,n,o,i,s,a=this;return Zf(this,function(c){switch(c.label){case 0:if(!Bf.isMatch())throw Error("wx api undefined");e=wx.getAccountInfoSync().miniProgram,t=function(t){return $f(a,void 0,void 0,function(){var n,o;return Zf(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 $f(a,void 0,void 0,function(){var o;return Zf(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,Yf(Yf({},n),{data:{user:i.user,session:i},error:null})];case 5:return s=c.sent(),[2,{data:{},error:new qf(s)}];case 6:return[2]}})})},e.prototype.signInWithPhoneAuth=function(e){var t=e.phoneCode,r=void 0===t?"":t;return $f(this,void 0,void 0,function(){var e,t,n,o,i,s,a,c,u;return Zf(this,function(l){switch(l.label){case 0:return Bf.isMatch()?(e=wx.getAccountInfoSync().miniProgram,t={provider_params:{provider_code_type:"phone"},provider_id:e.appId},[4,wx.login()]):[2,{data:{},error:new qf({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 qf(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,Yf(Yf({},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(id,function(e){return $f(t,void 0,void 0,function(){var t,r,n,o,i;return Zf(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 qf({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 qf({message:r})},e.prototype.init=function(){var e;return $f(this,void 0,void 0,function(){return Zf(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(id,{event:Xh})),[3,3];case 2:return t.sent(),[3,3];case 3:return[2,{error:null}]}})})},Qf([sf({title:"绑定手机号失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindPhoneNumber() 的语法或参数是否正确"," 2 - 当前环境是否开通了短信验证码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"bindPhoneNumber",null),Qf([sf({title:"解除三方绑定失败",messages:["请确认以下各项:"," 1 - 调用 auth().unbindProvider() 的语法或参数是否正确"," 2 - 当前账户是否已经与此登录方式解绑","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"unbindProvider",null),Qf([sf({title:"绑定邮箱地址失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindEmail() 的语法或参数是否正确"," 2 - 当前环境是否开通了邮箱密码登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",void 0)],e.prototype,"bindEmail",null),Qf([sf({title:"验证码验证失败",messages:["请确认以下各项:"," 1 - 调用 auth().verify() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"verify",null),Qf([sf({title:"获取验证码失败",messages:["请确认以下各项:"," 1 - 调用 auth().getVerification() 的语法或参数是否正确"," 2 - 当前环境是否开通了手机验证码/邮箱登录","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object,Object]),Jf("design:returntype",Promise)],e.prototype,"getVerification",null),Qf([sf({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 调用 auth().getCurrentUser() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[]),Jf("design:returntype",Promise)],e.prototype,"getCurrentUser",null),Qf([sf({title:"小程序匿名登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了匿名登录"," 2 - 调用 auth().signInAnonymouslyInWx() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"signInAnonymouslyInWx",null),Qf([sf({title:"小程序绑定OpenID失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序openId静默登录"," 2 - 调用 auth().bindOpenId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[]),Jf("design:returntype",Promise)],e.prototype,"bindOpenId",null),Qf([sf({title:"小程序unionId静默登录失败",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序unionId静默登录"," 2 - 调用 auth().signInWithUnionId() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[]),Jf("design:returntype",Promise)],e.prototype,"signInWithUnionId",null),Qf([sf({title:"短信验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了小程序短信验证码登陆"," 2 - 调用 auth().signInWithSms() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"signInWithSms",null),Qf([sf({title:"邮箱验证码登陆",messages:["请确认以下各项:"," 1 - 当前环境是否开启了邮箱登陆"," 2 - 调用 auth().signInWithEmail() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"signInWithEmail",null),Qf([sf({title:"获取用户是否被占用失败",messages:["请确认以下各项:"," 1 - 调用 auth().isUsernameRegistered() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[String]),Jf("design:returntype",Promise)],e.prototype,"isUsernameRegistered",null),Qf([sf({title:"获取本地登录态失败",messages:["请确认以下各项:"," 1 - 调用 auth().getLoginState() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[]),Jf("design:returntype",Promise)],e.prototype,"getLoginState",null),Qf([sf({title:"获取用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[]),Jf("design:returntype",Promise)],e.prototype,"getUserInfo",null),Qf([sf({title:"获取微搭插件用户信息失败",messages:["请确认以下各项:"," 1 - 是否已登录"," 2 - 调用 auth().getWedaUserInfo() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[]),Jf("design:returntype",Promise)],e.prototype,"getWedaUserInfo",null),Qf([sf({title:"绑定第三方登录方式失败",messages:["请确认以下各项:"," 1 - 调用 auth().bindWithProvider() 的语法或参数是否正确"," 2 - 此账户是否已经绑定此第三方","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[Object]),Jf("design:returntype",Promise)],e.prototype,"bindWithProvider",null),Qf([sf({title:"获取身份源类型",messages:["请确认以下各项:"," 1 - 调用 auth().getProviderSubType() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat(Id)]}),Jf("design:type",Function),Jf("design:paramtypes",[]),Jf("design:returntype",Promise)],e.prototype,"getProviderSubType",null),e}();function ip(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)||Fd.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 Zd},b=new jf(Kf(Yf(Yf({},y),{apiOrigin:m,apiPath:(null==e?void 0:e.apiPath)||Hh,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:tp(y.eventBus),headers:Yf({"X-SDK-Version":"@cloudbase/js-sdk/".concat(e.sdkVersion)},e.headers||{}),detectSessionInUrl:e.detectSessionInUrl,debug:p}))),_=new op(Yf(Yf({},y),{region:o,persistence:e.persistence,debug:p,cache:v||new Kd({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 $f(r,void 0,void 0,function(){return Zf(this,function(r){return e?(e.type===sd?t?y.eventBus.fire(id,{event:Zh,info:Yf(Yf({},e),{error:t})}):e.user&&_.createLoginState({},{userInfo:e.user}):e.type===ad&&y.eventBus.fire(id,{event:nd,info:Yf(Yf({},e),{error:t})}),[2]):[2]})})}),{authInstance:_,oauthInstance:b}}var sp="auth",ap={name:"auth",namespace:sp,entity:function(e){var t=function(e){var t;if(this.authInstance&&!e)return this.authInstance;e=e||{region:"",persistence:"local",apiPath:Hh};var r=this.platform.adapter,n=e.persistence||r.primaryStorage;n&&n!==this.config.persistence&&this.updateConfig({persistence:n});var o=ip(Yf(Yf({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[sp]=t,t}};try{cloudbase.registerComponent(ap)}catch(cf){}var cp=new Map;function up(e,t){if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var n=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=cp.get(t.envId);if(r)return r;var n=Bf.genAdapter({}),o=ip({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 cp.set(t.envId,o),{signInWithOpenId:o.signInWithOpenId.bind(o),getUser:o.getUser.bind(o),getSession:o.getSession.bind(o),refreshSession:o.refreshSession.bind(o)}}(e,r(r({},t),{envId:hp(e,null==t?void 0:t.envId)})),e.models=w(n,e),e.mysql=lp(e,{envId:null==t?void 0:t.envId}),e.rdb=lp(e,{envId:null==t?void 0:t.envId}),e}function lp(e,t){var i=null==t?void 0:t.envId,s=(null==t?void 0:t.mysqlBaseUrl)||dp(e,null==t?void 0:t.envId).mysql,a=null==t?void 0:t.fetch;return function(t){var u=this;return new Bh(s,{fetch:a||function(s,a){return n(u,0,void 0,function(){var n,u,l,h;return o(this,function(o){switch(o.label){case 0:return n=(null==t?void 0:t.instance)||"default",u=(null==t?void 0:t.database)||i,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=o.sent(),[2,e.callFunction({name:"httpOverCallFunction",data:{url:s.toString(),method:(null==a?void 0:a.method)||"GET",headers:r(r(r({},h?{Authorization:"Bearer ".concat(h)}:{}),l||{}),{"Content-Type":"application/json","X-Db-Instance":n,"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 hp(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 dp(e,t){var r=hp(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 fp={init:up,generateHTTPClient:m,generateMySQLClient:lp};let pp;if(!globalThis.IS_MP_BUILD){const Yp="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis;function Qp(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function Jp(e,t){return e&t}function $p(e,t){return e|t}function Zp(e,t){return e^t}function Xp(e,t){return e&~t}function ev(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 tv(e){for(var t=0;0!=e;)e&=e-1,++t;return t}var vp,gp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function rv(e){var t,r,n="";for(t=0;t+3<=e.length;t+=3)r=parseInt(e.substring(t,t+3),16),n+=gp.charAt(r>>6)+gp.charAt(63&r);for(t+1==e.length?(r=parseInt(e.substring(t,t+1),16),n+=gp.charAt(r<<2)):t+2==e.length&&(r=parseInt(e.substring(t,t+2),16),n+=gp.charAt(r>>2)+gp.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function nv(e){var t,r="",n=0,o=0;for(t=0;t<e.length&&"="!=e.charAt(t);++t){var i=gp.indexOf(e.charAt(t));i<0||(0==n?(r+=Qp(i>>2),o=3&i,n=1):1==n?(r+=Qp(o<<2|i>>4),o=15&i,n=2):2==n?(r+=Qp(o),r+=Qp(i>>2),o=3&i,n=3):(r+=Qp(o<<2|i>>4),r+=Qp(15&i),n=0))}return 1==n&&(r+=Qp(o<<2)),r}var mp,yp={decode:function(e){var t;if(void 0===vp){var r="0123456789ABCDEF",n=" \f\n\r\t \u2028\u2029";for(vp={},t=0;t<16;++t)vp[r.charAt(t)]=t;for(r=r.toLowerCase(),t=10;t<16;++t)vp[r.charAt(t)]=t;for(t=0;t<8;++t)vp[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=vp[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}},bp={decode:function(e){var t;if(void 0===mp){var r="= \f\n\r\t \u2028\u2029";for(mp=Object.create(null),t=0;t<64;++t)mp["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)]=t;for(t=0;t<9;++t)mp[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=mp[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=bp.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 bp.decode(e)}},_p=1e13;class ov{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)<_p?t=0:n-=(t=0|n/_p)*_p,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+=_p,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+=(_p+t[n]).toString().substring(1);return r}valueOf(){for(var e=this.buf,t=0,r=e.length-1;r>=0;--r)t=t*_p+e[r];return t}simplify(){var e=this.buf;return 1==e.length?e[0]:this}}var wp,Sp=/^(\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)?)?$/,Ip=/^(\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 iv(e,t){return e.length>t&&(e=e.substring(0,t)+"…"),e}class sv{constructor(e,t){this.hexDigits="0123456789ABCDEF",e instanceof sv?(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?Sp:Ip).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 ov(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+iv(i,r)}return o+i}parseOctetString(e,t,r){if(this.isASCII(e,t))return iv(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 ov,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 ov)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 iv(n,r);o=new ov,i=0}}return i>0&&(n+=".incomplete"),n}}class av{constructor(e,t,r,n,o){if(!(n instanceof cv))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 iv(this.stream.parseStringUTF(t,t+r),e);case 18:case 19:case 20:case 21:case 22:case 26:return iv(this.stream.parseStringISO(t,t+r),e);case 30:return iv(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 sv?e:new sv(e,0);var r=new sv(t),n=new cv(t),o=av.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]=av.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=av.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 av(r,s,o,n,a)}}class cv{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 ov;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 Tp=[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],Pp=(1<<26)/Tp[Tp.length-1];class uv{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=Qp(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+=Qp(r));return o?i:"0"}negate(){var e=lv();return uv.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)+mv(this[this.t-1]^this.s&this.DM)}mod(e){var t=lv();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(uv.ZERO)>0&&e.subTo(t,t),t}modPowInt(e,t){var r;return r=e<256||t.isEven()?new Op(t):new Rp(t),this.exp(e,r)}clone(){var e=lv();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=lv();return this.bitwiseTo(e,Jp,t),t}or(e){var t=lv();return this.bitwiseTo(e,$p,t),t}xor(e){var t=lv();return this.bitwiseTo(e,Zp,t),t}andNot(e){var t=lv();return this.bitwiseTo(e,Xp,t),t}not(){for(var e=lv(),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=lv();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}shiftRight(e){var t=lv();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+ev(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+=tv(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,$p)}clearBit(e){return this.changeBit(e,Xp)}flipBit(e){return this.changeBit(e,Zp)}add(e){var t=lv();return this.addTo(e,t),t}subtract(e){var t=lv();return this.subTo(e,t),t}multiply(e){var t=lv();return this.multiplyTo(e,t),t}divide(e){var t=lv();return this.divRemTo(e,t,null),t}remainder(e){var t=lv();return this.divRemTo(e,null,t),t}divideAndRemainder(e){var t=lv(),r=lv();return this.divRemTo(e,t,r),[t,r]}modPow(e,t){var r,n,o=e.bitLength(),i=gv(1);if(o<=0)return i;r=o<18?1:o<48?3:o<144?4:o<768?5:6,n=o<8?new Op(t):t.isEven()?new Cp(t):new Rp(t);var s=[],a=3,c=r-1,u=(1<<r)-1;if(s[1]=n.convert(this),r>1){var l=lv();for(n.sqrTo(s[1],l);a<=u;)s[a]=lv(),n.mulTo(l,s[a-2],s[a]),a+=2}var h,d,f=e.t-1,p=!0,v=lv();for(o=mv(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 uv.ZERO;for(var r=e.clone(),n=this.clone(),o=gv(1),i=gv(0),s=gv(0),a=gv(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(uv.ONE)?uv.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 Ep)}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]<=Tp[Tp.length-1]){for(t=0;t<Tp.length;++t)if(r[0]==Tp[t])return!0;return!1}if(r.isEven())return!1;for(t=1;t<Tp.length;){for(var n=Tp[t],o=t+1;o<Tp.length&&n<Pp;)n*=Tp[o++];for(n=r.modInt(n);t<o;)if(n%Tp[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]:vv(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&&uv.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&&uv.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=lv());var i=lv(),s=this.s,a=e.s,c=this.DB-mv(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?lv():t;for(i.dlShiftTo(g,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),uv.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&&uv.ZERO.subTo(t,t)),r.t=u,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&uv.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 uv.ONE;var r=lv(),n=lv(),o=t.convert(this),i=mv(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=gv(r),o=lv(),i=lv(),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=vv(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&&uv.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(uv.ONE.shiftLeft(e-1),$p,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(uv.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=uv.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(uv.ONE),r=t.getLowestSetBit();if(r<=0)return!1;var n=t.shiftRight(r);(e=e+1>>1)>Tp.length&&(e=Tp.length);for(var o=lv(),i=0;i<e;++i){o.fromInt(Tp[Math.floor(Math.random()*Tp.length)]);var s=o.modPow(n,this);if(0!=s.compareTo(uv.ONE)&&0!=s.compareTo(t)){for(var a=1;a++<r&&0!=s.compareTo(t);)if(0==(s=s.modPowInt(2,this)).compareTo(uv.ONE))return!1;if(0!=s.compareTo(t))return!1}}return!0}square(){var e=lv();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(uv.ONE.shiftLeft(e-1),$p,this),this.isEven()&&this.dAddOffset(1,0);var o=this,i=function(){o.dAddOffset(2,0),o.bitLength()>e&&o.subTo(uv.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 Ep=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}(),Op=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}(),Rp=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=lv();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(uv.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=lv();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}(),Cp=function(){function e(e){this.m=e,this.r2=lv(),this.q3=lv(),uv.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=lv();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 lv(){return new uv(null)}function hv(e,t){return new uv(e,t)}function dv(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 fv(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 pv(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!==Yp&&"Microsoft Internet Explorer"==(null==Yp?void 0:Yp.appName)?(uv.prototype.am=fv,wp=30):"Netscape"!=(null==Yp?void 0:Yp.appName)?(uv.prototype.am=dv,wp=26):(uv.prototype.am=pv,wp=28),uv.prototype.DB=wp,uv.prototype.DM=(1<<wp)-1,uv.prototype.DV=1<<wp;uv.prototype.FV=Math.pow(2,52),uv.prototype.F1=52-wp,uv.prototype.F2=2*wp-52;var Ap,kp,Up=[];for(Ap="0".charCodeAt(0),kp=0;kp<=9;++kp)Up[Ap++]=kp;for(Ap="a".charCodeAt(0),kp=10;kp<36;++kp)Up[Ap++]=kp;for(Ap="A".charCodeAt(0),kp=10;kp<36;++kp)Up[Ap++]=kp;function vv(e,t){var r=Up[e.charCodeAt(t)];return null==r?-1:r}function gv(e){var t=lv();return t.fromInt(e),t}function mv(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}uv.ZERO=gv(0),uv.ONE=gv(1);class yv{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 qp,Lp,xp=null;if(null==xp){var Np,jp,Dp,Bp;xp=[],Lp=0;var Mp=void 0;if(null!==(Np=window)&&void 0!==Np&&Np.crypto&&null!==(jp=window)&&void 0!==jp&&jp.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)xp[Lp++]=255&Fp[Mp]}var Hp,zp=function(e){var t,r,n;if(this.count=this.count||0,this.count>=256||Lp>=256){if(null!==(t=window)&&void 0!==t&&t.removeEventListener)null===(n=window)||void 0===n||n.removeEventListener("mousemove",zp,!1);else if(null!==(r=window)&&void 0!==r&&r.detachEvent){var o;null===(o=window)||void 0===o||o.detachEvent("onmousemove",zp)}}else try{var i=e.x+e.y;xp[Lp++]=255&i,this.count+=1}catch(e){}};if(null!==(Dp=window)&&void 0!==Dp&&Dp.addEventListener)null===(Hp=window)||void 0===Hp||Hp.addEventListener("mousemove",zp,!1);else if(null!==(Bp=window)&&void 0!==Bp&&Bp.attachEvent){var Vp;null===(Vp=window)||void 0===Vp||Vp.attachEvent("onmousemove",zp)}}function bv(){if(null==qp){for(qp=new yv;Lp<256;){var e=Math.floor(65536*Math.random());xp[Lp++]=255&e}for(qp.init(xp),Lp=0;Lp<xp.length;++Lp)xp[Lp]=0;Lp=0}return qp.next()}class _v{constructor(){}nextBytes(e){for(var t=0;t<e.length;++t)e[t]=bv()}}function wv(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 _v,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 uv(r)}class Sv{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=hv(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")}encrypt(e){var t=wv(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}),rv(n)):rv(this.encrypt(e))}catch(e){return!1}}decryptLong(e){var t=this,r=this.n.bitLength()+7>>3;e=nv(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=hv(e,16),this.e=parseInt(t,16),this.d=hv(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=hv(e,16),this.e=parseInt(t,16),this.d=hv(r,16),this.p=hv(n,16),this.q=hv(o,16),this.dmp1=hv(i,16),this.dmq1=hv(s,16),this.coeff=hv(a,16)):console.error("Invalid RSA private key")}generate(e,t){var r=new _v,n=e>>1;this.e=parseInt(t,16);for(var o=new uv(t,16);;){for(;this.p=new uv(e-n,1,r),0!=this.p.subtract(uv.ONE).gcd(o).compareTo(uv.ONE)||!this.p.isProbablePrime(10););for(;this.q=new uv(n,1,r),0!=this.q.subtract(uv.ONE).gcd(o).compareTo(uv.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(uv.ONE),a=this.q.subtract(uv.ONE),c=s.multiply(a);if(0==c.gcd(o).compareTo(uv.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=hv(e,16),r=this.doPrivate(t);return null==r?null:Iv(r,this.n.bitLength()+7>>3)}generateAsync(e,t,r){var n=new _v,o=e>>1;this.e=parseInt(t,16);var i=new uv(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(uv.ONE),n=s.q.subtract(uv.ONE),o=t.multiply(n);0==o.gcd(i).compareTo(uv.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=lv(),s.q.fromNumberAsync(o,1,n,function(){s.q.subtract(uv.ONE).gcda(i,function(e){0==e.compareTo(uv.ONE)&&s.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)})})},u=()=>{s.p=lv(),s.p.fromNumberAsync(e-o,1,n,function(){s.p.subtract(uv.ONE).gcda(i,function(e){0==e.compareTo(uv.ONE)&&s.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(u,0)})})};setTimeout(u,0)};setTimeout(a,0)}}function Iv(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 Tv extends Sv{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)?yp.decode(e):bp.unarmor(e),o=av.decode(n);if(3===o.sub.length&&(o=o.sub[2].sub[0]),9===o.sub.length){t=o.sub[1].getHexStringValue(),this.n=hv(t,16),r=o.sub[2].getHexStringValue(),this.e=parseInt(r,16);var i=o.sub[3].getHexStringValue();this.d=hv(i,16);var s=o.sub[4].getHexStringValue();this.p=hv(s,16);var a=o.sub[5].getHexStringValue();this.q=hv(a,16);var c=o.sub[6].getHexStringValue();this.dmp1=hv(c,16);var u=o.sub[7].getHexStringValue();this.dmq1=hv(u,16);var l=o.sub[8].getHexStringValue();this.coeff=hv(l,16)}else{if(2!==o.sub.length)return!1;var h=o.sub[1].sub[0];t=h.sub[0].getHexStringValue(),this.n=hv(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)}}pp=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},pp.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new Tv(e)},pp.prototype.setPrivateKey=function(e){this.setKey(e)},pp.prototype.setPublicKey=function(e){this.setKey(e)},pp.prototype.decrypt=function(e){try{return this.getKey().decrypt(nv(e))}catch(e){return!1}},pp.prototype.encrypt=function(e){try{return rv(this.getKey().encrypt(e))}catch(e){return!1}},pp.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}},pp.prototype.getKey=function(e){if(!this.key){if(this.key=new Tv,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},pp.version="3.1.4"}var Gp=pp;var Kp=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=ld(t),n=new Gp;n.setPublicKey(e);return n.encryptLong("object"==typeof r?JSON.stringify(r):r)}catch(e){console.error("encrypt error:",e)}return""}});exports.default=fp,exports.generateHTTPClient=m,exports.generateMySQLClient=lp,exports.getAccessToken=c,exports.init=up,exports.initHTTPOverCallFunction=function(e,t){var i=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)||dp(e,null==t?void 0:t.envId).model,l=(null==t?void 0:t.sqlBaseUrl)||dp(e,null==t?void 0:t.envId).sql;s=m(a,function(t){var s=t.url,u=t.body,l=t.method,h=t.headers;return n(i,0,void 0,function(){var t,n,i;return o(this,function(o){switch(o.label){case 0:return[4,c(e)];case 1:return t=o.sent(),[4,a({name:"httpOverCallFunction",data:{url:s,method:null==l?void 0:l.toUpperCase(),headers:r(r(r({},t?{Authorization:"Bearer ".concat(t)}:{}),h||{}),{"Content-Type":"application/json"}),body:u}})];case 2:return n=o.sent(),[2,null===(i=null==n?void 0:n.result)||void 0===i?void 0:i.body]}})})},u,{sqlBaseUrl:l,cloud:e})}catch(e){console.error("init http orm client failed, try call function orm",e),s=w(a)}return e.models=s,e.mysql=lp(e,{envId:null==t?void 0:t.envId,mysqlBaseUrl:null==t?void 0:t.mysqlBaseUrl}),e};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});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)};function t(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)}var r=function(){return r=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},r.apply(this,arguments)};function n(e,t,r,n){return new(r||(r=Promise))(function(t,o){function i(e){try{s(n.next(e))}catch(e){o(e)}}function a(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof r?n:new r(function(e){e(n)})).then(i,a)}s((n=n.apply(e,[])).next())})}function o(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)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 a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}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,s])}}}var i=function(e){function r(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 t(r,e),r}(Error);function a(){return"undefined"!=typeof window&&window||"undefined"!=typeof globalThis&&globalThis}function s(){try{var e=a();if(!e)return;return"undefined"==typeof wx?a().location.href:e.__wxRoute}catch(e){}}var u=function(e){return n(void 0,0,void 0,function(){var t,r,n,i;return o(this,function(o){switch(o.label){case 0:if(!(null===(n=null==e?void 0:e.auth)||void 0===n?void 0:n.getSession))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===(i=t.session)||void 0===i?void 0:i.access_token)||""];case 3:return r=o.sent(),console.log("[WxCloudSDKError] getAccessToken failed",r),[2,""];case 4:return[2]}})})},c=function(e){var t=e.dataSourceName,c=e.methodName,l=e.params,h=e.realMethodName,f=e.callFunction,d=e.envType,p=void 0===d?"prod":d,v=e.mode,m=e.cloud;return n(void 0,0,void 0,function(){var e,n,d,y,g,b,w;return o(this,function(o){switch(o.label){case 0:return e={data:{},requestId:""},[4,u(m)];case 1:n=o.sent(),o.label=2;case 2:return o.trys.push([2,4,,5]),[4,f({name:"lowcode-datasource",data:r({dataSourceName:t,methodName:c,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&&(P=["brand","model","version","system","platform","SDKVersion","language"].map(function(t){return"".concat(t,": ").concat(e[t])}).join(", "))}}),P):void 0),referrer:s(),"x-sdk-version":"1.8.3",envType:p,mode:v},n?{access_token:n}:{})})];case 3:if(d=o.sent(),y=(null===(b=null==d?void 0:d.result)||void 0===b?void 0:b.requestId)||(null==d?void 0:d.requestId)||(null==d?void 0:d.requestID),null==d?void 0:d.result.code)throw new i("【错误】".concat(null==d?void 0:d.result.message,"\n【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(h,"\n【错误码】").concat(null==d?void 0:d.result.code,"\n【请求ID】").concat(y||"N/A"),{code:null==d?void 0:d.result.code,requestId:y});return e.data=(null===(w=null==d?void 0:d.result)||void 0===w?void 0:w.data)||{},e.requestId=y,[3,5];case 4:throw"WxCloudSDKError"===(g=o.sent()).name?g:(console.log(g),new i("【错误】".concat(g.message,"\n 【操作】调用 models.").concat(t?"".concat(t,"."):"").concat(h,"\n 【请求ID】N/A"),{code:"UnknownError",originError:g}));case 5:return[2,e]}var P,S})})},l=function(e){var t=e.sql,r=e.params,i=e.config,a=e.callFunction,s=e.unsafe,u=void 0!==s&&s,l=e.cloud;return n(void 0,0,void 0,function(){return o(this,function(e){return[2,c({realMethodName:"$runSQL",methodName:"callWedaApi",params:{action:"RunMysqlCommand",data:{sqlTemplate:t,config:i,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:a,mode:"sdk",cloud:l})]})})},h=function(e,t){return{$runSQL:function(i,a,s){return n(this,0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return[4,l({sql:i,params:a,config:r(r({},s),{preparedStatements:!0}),callFunction:e,cloud:t})];case 1:return[2,n.sent()]}})})},$runSQLRaw:function(i,a){return n(this,0,void 0,function(){return o(this,function(n){switch(n.label){case 0:return[4,l({sql:i,params:[],config:r(r({},a),{preparedStatements:!1}),callFunction:e,cloud:t})];case 1:return[2,n.sent()]}})})}}},f={filter:{where:{}},select:{$master:!0}};function d(e){return{getUrl:function(t){return"".concat(t,"/").concat(e)},method:"post"}}var p={get:r(r({},d("get")),{defaultParams:r({},f)}),list:r(r({},d("list")),{defaultParams:r({},f)}),create:d("create"),createMany:d("createMany"),update:r(r({},d("update")),{method:"put"}),updateMany:r(r({},d("updateMany")),{method:"put"}),upsert:d("upsert"),delete:d("delete"),deleteMany:d("deleteMany")},v="Unknown error occurred",m="NotSupported",y=function(e,t,r,n){var o=h(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]:b(r,i,t,n)}})},g=function(e,t,r,n,o){return new i("【错误】".concat(e,"\n【操作】调用 models.").concat(t,".").concat(r,"\n【错误码】").concat(n,"\n【请求ID】").concat(o),{code:n,requestId:o})},b=function(e,t,a,s){var u=new Proxy({},{get:function(u,c){if("runSQLTemplate"!==c){var l=p[c];if(!l){var h=new Error("不支持的操作: ".concat(c));throw new i(h.message||v,{originError:h,code:m,requestId:"N/A"})}return function(r){return void 0===r&&(r={}),n(void 0,0,void 0,function(){var n,s,u,h,f,d,p,m,y,b;return o(this,function(o){switch(o.label){case 0:n=l.getUrl,s=l.method,u=l.defaultParams,h=void 0===u?{}:u,f=Object.assign({},h,r),d="pre"===f.envType?"pre":"prod",p=[e,d,n(t)].join("/"),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,a({url:p,body:JSON.stringify(f),method:s})];case 2:if((m=o.sent()).code)throw g(null==m?void 0:m.message,t,c,null==m?void 0:m.code,null==m?void 0:m.requestId);return"get"===c&&Object.assign(m,{data:null!==(b=m.data.record)&&void 0!==b?b:m.data}),[2,m];case 3:throw y=o.sent(),new i((null==y?void 0:y.message)||v,{originError:y});case 4:return[2]}})})}}if(!(null==s?void 0:s.sqlBaseUrl)){h=new Error("不支持的操作: ".concat(c));throw new i(h.message||v,{originError:h,code:m,requestId:"N/A"})}return function(e){return n(void 0,0,void 0,function(){var n,u,l,h,f,d,p,m,y,b,w,P,S,O,j,k;return o(this,function(o){switch(o.label){case 0:n=e.params,u=e.templateName,l=e.envType,h="pre"===l?"pre":"prod",f=[s.sqlBaseUrl,h,u,"run"].join("/"),d=Object.entries(n||{}).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},[]),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,a({url:f,body:JSON.stringify({parameter:d}),method:"POST"})];case 2:if(p=o.sent(),null===(y=null==p?void 0:p.Response)||void 0===y?void 0:y.Error)throw g(null===(w=null===(b=null==p?void 0:p.Response)||void 0===b?void 0:b.Error)||void 0===w?void 0:w.Message,t,c,null===(S=null===(P=null==p?void 0:p.Response)||void 0===P?void 0:P.Error)||void 0===S?void 0:S.Code,null===(O=null==p?void 0:p.Response)||void 0===O?void 0:O.RequestId);return[2,r(r({},null!==(j=null==p?void 0:p.Response)&&void 0!==j?j:{}),{data:null===(k=null==p?void 0:p.Response)||void 0===k?void 0:k.Data})];case 3:throw m=o.sent(),new i((null==m?void 0:m.message)||v,{originError:m});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}}}},P=function(e,t){var a=h(e,t);return new Proxy({},{get:function(s,u){if("string"==typeof u)return Object.prototype.hasOwnProperty.call(a,u)?a[u]:function(e,t,a){return new Proxy({},{get:function(s,u){var l=w[u];if(!l){var h=new Error("不支持的操作: ".concat(u));throw new i(h.message||"Unknown error occurred",{originError:h,code:"NotSupported",requestId:"N/A"})}return function(i){return n(void 0,0,void 0,function(){var n,s,h,f,d;return o(this,function(o){switch(o.label){case 0:return n=r(r({},l.defaultParams||{}),i||{}),[4,c({callFunction:t,dataSourceName:e,methodName:l.methodName,realMethodName:u,params:n,envType:null==i?void 0:i.envType,cloud:a})];case 1:return s=o.sent(),h={data:{}},f=l.responseKey,h.data=f?null===(d=null==s?void 0:s.data)||void 0===d?void 0:d[f]:null==s?void 0:s.data,[2,h]}})})}}})}(u,e,t)}})},S=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=S);var O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function j(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var k,A,E=function(e){try{return!!e()}catch(e){return!0}},T=!E(function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}),R=T,U=Function.prototype,x=U.call,q=R&&U.bind.bind(x,x),L=R?q:function(e){return function(){return x.apply(e,arguments)}},C=L,I=C({}.toString),N=C("".slice),B=function(e){return N(I(e),8,-1)},F=E,H=B,M=Object,_=L("".split),z=F(function(){return!M("z").propertyIsEnumerable(0)})?function(e){return"String"===H(e)?_(e,""):M(e)}:M,G=function(e){return null==e},D=G,J=TypeError,$=function(e){if(D(e))throw new J("Can't call method on "+e);return e},V=z,Q=$,K=function(e){return V(Q(e))},W={},Y=function(e){return e&&e.Math===Math&&e},X=Y("object"==typeof globalThis&&globalThis)||Y("object"==typeof window&&window)||Y("object"==typeof self&&self)||Y("object"==typeof O&&O)||Y("object"==typeof O&&O)||function(){return this}()||Function("return this")(),Z="object"==typeof document&&document.all,ee=void 0===Z&&void 0!==Z?function(e){return"function"==typeof e||e===Z}:function(e){return"function"==typeof e},te=ee,re=X.WeakMap,ne=te(re)&&/native code/.test(String(re)),oe=ee,ie=function(e){return"object"==typeof e?null!==e:oe(e)},ae=!E(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}),se={},ue=ie,ce=X.document,le=ue(ce)&&ue(ce.createElement),he=function(e){return le?ce.createElement(e):{}},fe=he,de=!ae&&!E(function(){return 7!==Object.defineProperty(fe("div"),"a",{get:function(){return 7}}).a}),pe=ae&&E(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype}),ve=ie,me=String,ye=TypeError,ge=function(e){if(ve(e))return e;throw new ye(me(e)+" is not an object")},be=T,we=Function.prototype.call,Pe=be?we.bind(we):function(){return we.apply(we,arguments)},Se={},Oe=Se,je=X,ke=ee,Ae=function(e){return ke(e)?e:void 0},Ee=function(e,t){return arguments.length<2?Ae(Oe[e])||Ae(je[e]):Oe[e]&&Oe[e][t]||je[e]&&je[e][t]},Te=L({}.isPrototypeOf),Re=X.navigator,Ue=Re&&Re.userAgent,xe=X,qe=Ue?String(Ue):"",Le=xe.process,Ce=xe.Deno,Ie=Le&&Le.versions||Ce&&Ce.version,Ne=Ie&&Ie.v8;Ne&&(A=(k=Ne.split("."))[0]>0&&k[0]<4?1:+(k[0]+k[1])),!A&&qe&&(!(k=qe.match(/Edge\/(\d+)/))||k[1]>=74)&&(k=qe.match(/Chrome\/(\d+)/))&&(A=+k[1]);var Be=A,Fe=E,He=X.String,Me=!!Object.getOwnPropertySymbols&&!Fe(function(){var e=Symbol("symbol detection");return!He(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Be&&Be<41}),_e=Me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ze=Ee,Ge=ee,De=Te,Je=Object,$e=_e?function(e){return"symbol"==typeof e}:function(e){var t=ze("Symbol");return Ge(t)&&De(t.prototype,Je(e))},Ve=String,Qe=function(e){try{return Ve(e)}catch(e){return"Object"}},Ke=ee,We=Qe,Ye=TypeError,Xe=function(e){if(Ke(e))return e;throw new Ye(We(e)+" is not a function")},Ze=Xe,et=G,tt=function(e,t){var r=e[t];return et(r)?void 0:Ze(r)},rt=Pe,nt=ee,ot=ie,it=TypeError,at={exports:{}},st=X,ut=Object.defineProperty,ct=X,lt=function(e,t){try{ut(st,e,{value:t,configurable:!0,writable:!0})}catch(r){st[e]=t}return t},ht="__core-js_shared__",ft=at.exports=ct[ht]||lt(ht,{});(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 dt=at.exports,pt=dt,vt=function(e,t){return pt[e]||(pt[e]=t||{})},mt=$,yt=Object,gt=function(e){return yt(mt(e))},bt=gt,wt=L({}.hasOwnProperty),Pt=Object.hasOwn||function(e,t){return wt(bt(e),t)},St=L,Ot=0,jt=Math.random(),kt=St(1.1.toString),At=function(e){return"Symbol("+(void 0===e?"":e)+")_"+kt(++Ot+jt,36)},Et=vt,Tt=Pt,Rt=At,Ut=Me,xt=_e,qt=X.Symbol,Lt=Et("wks"),Ct=xt?qt.for||qt:qt&&qt.withoutSetter||Rt,It=function(e){return Tt(Lt,e)||(Lt[e]=Ut&&Tt(qt,e)?qt[e]:Ct("Symbol."+e)),Lt[e]},Nt=Pe,Bt=ie,Ft=$e,Ht=tt,Mt=function(e,t){var r,n;if("string"===t&&nt(r=e.toString)&&!ot(n=rt(r,e)))return n;if(nt(r=e.valueOf)&&!ot(n=rt(r,e)))return n;if("string"!==t&&nt(r=e.toString)&&!ot(n=rt(r,e)))return n;throw new it("Can't convert object to primitive value")},_t=TypeError,zt=It("toPrimitive"),Gt=function(e,t){if(!Bt(e)||Ft(e))return e;var r,n=Ht(e,zt);if(n){if(void 0===t&&(t="default"),r=Nt(n,e,t),!Bt(r)||Ft(r))return r;throw new _t("Can't convert object to primitive value")}return void 0===t&&(t="number"),Mt(e,t)},Dt=$e,Jt=function(e){var t=Gt(e,"string");return Dt(t)?t:t+""},$t=ae,Vt=de,Qt=pe,Kt=ge,Wt=Jt,Yt=TypeError,Xt=Object.defineProperty,Zt=Object.getOwnPropertyDescriptor,er="enumerable",tr="configurable",rr="writable";se.f=$t?Qt?function(e,t,r){if(Kt(e),t=Wt(t),Kt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&rr in r&&!r[rr]){var n=Zt(e,t);n&&n[rr]&&(e[t]=r.value,r={configurable:tr in r?r[tr]:n[tr],enumerable:er in r?r[er]:n[er],writable:!1})}return Xt(e,t,r)}:Xt:function(e,t,r){if(Kt(e),t=Wt(t),Kt(r),Vt)try{return Xt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Yt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var nr,or,ir,ar=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},sr=se,ur=ar,cr=ae?function(e,t,r){return sr.f(e,t,ur(1,r))}:function(e,t,r){return e[t]=r,e},lr=At,hr=vt("keys"),fr=function(e){return hr[e]||(hr[e]=lr(e))},dr={},pr=ne,vr=X,mr=ie,yr=cr,gr=Pt,br=dt,wr=fr,Pr=dr,Sr="Object already initialized",Or=vr.TypeError,jr=vr.WeakMap;if(pr||br.state){var kr=br.state||(br.state=new jr);kr.get=kr.get,kr.has=kr.has,kr.set=kr.set,nr=function(e,t){if(kr.has(e))throw new Or(Sr);return t.facade=e,kr.set(e,t),t},or=function(e){return kr.get(e)||{}},ir=function(e){return kr.has(e)}}else{var Ar=wr("state");Pr[Ar]=!0,nr=function(e,t){if(gr(e,Ar))throw new Or(Sr);return t.facade=e,yr(e,Ar,t),t},or=function(e){return gr(e,Ar)?e[Ar]:{}},ir=function(e){return gr(e,Ar)}}var Er={set:nr,get:or,has:ir,enforce:function(e){return ir(e)?or(e):nr(e,{})},getterFor:function(e){return function(t){var r;if(!mr(t)||(r=or(t)).type!==e)throw new Or("Incompatible receiver, "+e+" required");return r}}},Tr=T,Rr=Function.prototype,Ur=Rr.apply,xr=Rr.call,qr="object"==typeof Reflect&&Reflect.apply||(Tr?xr.bind(Ur):function(){return xr.apply(Ur,arguments)}),Lr=B,Cr=L,Ir=function(e){if("Function"===Lr(e))return Cr(e)},Nr={},Br={},Fr={}.propertyIsEnumerable,Hr=Object.getOwnPropertyDescriptor,Mr=Hr&&!Fr.call({1:2},1);Br.f=Mr?function(e){var t=Hr(this,e);return!!t&&t.enumerable}:Fr;var _r=ae,zr=Pe,Gr=Br,Dr=ar,Jr=K,$r=Jt,Vr=Pt,Qr=de,Kr=Object.getOwnPropertyDescriptor;Nr.f=_r?Kr:function(e,t){if(e=Jr(e),t=$r(t),Qr)try{return Kr(e,t)}catch(e){}if(Vr(e,t))return Dr(!zr(Gr.f,e,t),e[t])};var Wr=E,Yr=ee,Xr=/#|\.prototype\./,Zr=function(e,t){var r=tn[en(e)];return r===nn||r!==rn&&(Yr(t)?Wr(t):!!t)},en=Zr.normalize=function(e){return String(e).replace(Xr,".").toLowerCase()},tn=Zr.data={},rn=Zr.NATIVE="N",nn=Zr.POLYFILL="P",on=Zr,an=Xe,sn=T,un=Ir(Ir.bind),cn=function(e,t){return an(e),void 0===t?e:sn?un(e,t):function(){return e.apply(t,arguments)}},ln=X,hn=qr,fn=Ir,dn=ee,pn=Nr.f,vn=on,mn=Se,yn=cn,gn=cr,bn=Pt,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 hn(e,this,arguments)};return t.prototype=e.prototype,t},Pn=function(e,t){var r,n,o,i,a,s,u,c,l,h=e.target,f=e.global,d=e.stat,p=e.proto,v=f?ln:d?ln[h]:ln[h]&&ln[h].prototype,m=f?mn:mn[h]||gn(mn,h,{})[h],y=m.prototype;for(i in t)n=!(r=vn(f?i:h+(d?".":"#")+i,e.forced))&&v&&bn(v,i),s=m[i],n&&(u=e.dontCallGetSet?(l=pn(v,i))&&l.value:v[i]),a=n&&u?u:t[i],(r||p||typeof s!=typeof a)&&(c=e.bind&&n?yn(a,ln):e.wrap&&n?wn(a):p&&dn(a)?fn(a):a,(e.sham||a&&a.sham||s&&s.sham)&&gn(c,"sham",!0),gn(m,i,c),p&&(bn(mn,o=h+"Prototype")||gn(mn,o,{}),gn(mn[o],i,a),e.real&&y&&(r||!y[i])&&gn(y,i,a)))},Sn=ae,On=Pt,jn=Function.prototype,kn=Sn&&Object.getOwnPropertyDescriptor,An=On(jn,"name"),En={EXISTS:An,PROPER:An&&"something"===function(){}.name,CONFIGURABLE:An&&(!Sn||Sn&&kn(jn,"name").configurable)},Tn={},Rn=Math.ceil,Un=Math.floor,xn=Math.trunc||function(e){var t=+e;return(t>0?Un:Rn)(t)},qn=function(e){var t=+e;return t!=t||0===t?0:xn(t)},Ln=qn,Cn=Math.max,In=Math.min,Nn=function(e,t){var r=Ln(e);return r<0?Cn(r+t,0):In(r,t)},Bn=qn,Fn=Math.min,Hn=function(e){var t=Bn(e);return t>0?Fn(t,9007199254740991):0},Mn=function(e){return Hn(e.length)},_n=K,zn=Nn,Gn=Mn,Dn=function(e){return function(t,r,n){var o=_n(t),i=Gn(o);if(0===i)return!e&&-1;var a,s=zn(n,i);if(e&&r!=r){for(;i>s;)if((a=o[s++])!=a)return!0}else for(;i>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},Jn={includes:Dn(!0),indexOf:Dn(!1)},$n=Pt,Vn=K,Qn=Jn.indexOf,Kn=dr,Wn=L([].push),Yn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Xn=function(e,t){var r,n=Vn(e),o=0,i=[];for(r in n)!$n(Kn,r)&&$n(n,r)&&Wn(i,r);for(;t.length>o;)$n(n,r=t[o++])&&(~Qn(i,r)||Wn(i,r));return i},Zn=Yn,eo=Object.keys||function(e){return Xn(e,Zn)},to=ae,ro=pe,no=se,oo=ge,io=K,ao=eo;Tn.f=to&&!ro?Object.defineProperties:function(e,t){oo(e);for(var r,n=io(t),o=ao(t),i=o.length,a=0;i>a;)no.f(e,r=o[a++],n[r]);return e};var so,uo=Ee("document","documentElement"),co=ge,lo=Tn,ho=Yn,fo=dr,po=uo,vo=he,mo="prototype",yo="script",go=fr("IE_PROTO"),bo=function(){},wo=function(e){return"<"+yo+">"+e+"</"+yo+">"},Po=function(e){e.write(wo("")),e.close();var t=e.parentWindow.Object;return e=null,t},So=function(){try{so=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;So="undefined"!=typeof document?document.domain&&so?Po(so):(t=vo("iframe"),r="java"+yo+":",t.style.display="none",po.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(wo("document.F=Object")),e.close(),e.F):Po(so);for(var n=ho.length;n--;)delete So[mo][ho[n]];return So()};fo[go]=!0;var Oo,jo,ko,Ao=Object.create||function(e,t){var r;return null!==e?(bo[mo]=co(e),r=new bo,bo[mo]=null,r[go]=e):r=So(),void 0===t?r:lo.f(r,t)},Eo=!E(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}),To=Pt,Ro=ee,Uo=gt,xo=Eo,qo=fr("IE_PROTO"),Lo=Object,Co=Lo.prototype,Io=xo?Lo.getPrototypeOf:function(e){var t=Uo(e);if(To(t,qo))return t[qo];var r=t.constructor;return Ro(r)&&t instanceof r?r.prototype:t instanceof Lo?Co:null},No=cr,Bo=function(e,t,r,n){return n&&n.enumerable?e[t]=r:No(e,t,r),e},Fo=E,Ho=ee,Mo=ie,_o=Ao,zo=Io,Go=Bo,Do=It("iterator"),Jo=!1;[].keys&&("next"in(ko=[].keys())?(jo=zo(zo(ko)))!==Object.prototype&&(Oo=jo):Jo=!0);var $o=!Mo(Oo)||Fo(function(){var e={};return Oo[Do].call(e)!==e});Ho((Oo=$o?{}:_o(Oo))[Do])||Go(Oo,Do,function(){return this});var Vo={IteratorPrototype:Oo,BUGGY_SAFARI_ITERATORS:Jo},Qo={};Qo[It("toStringTag")]="z";var Ko="[object z]"===String(Qo),Wo=Ko,Yo=ee,Xo=B,Zo=It("toStringTag"),ei=Object,ti="Arguments"===Xo(function(){return arguments}()),ri=Wo?Xo: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=ei(e),Zo))?r:ti?Xo(t):"Object"===(n=Xo(t))&&Yo(t.callee)?"Arguments":n},ni=ri,oi=Ko?{}.toString:function(){return"[object "+ni(this)+"]"},ii=Ko,ai=se.f,si=cr,ui=Pt,ci=oi,li=It("toStringTag"),hi=function(e,t,r,n){var o=r?e:e&&e.prototype;o&&(ui(o,li)||ai(o,li,{configurable:!0,value:t}),n&&!ii&&si(o,"toString",ci))},fi=Vo.IteratorPrototype,di=Ao,pi=ar,vi=hi,mi=W,yi=function(){return this},gi=function(e,t,r,n){var o=t+" Iterator";return e.prototype=di(fi,{next:pi(+!n,r)}),vi(e,o,!1,!0),mi[o]=yi,e},bi=Pn,wi=Pe,Pi=En,Si=gi,Oi=Io,ji=hi,ki=Bo,Ai=W,Ei=Vo,Ti=Pi.PROPER,Ri=Ei.BUGGY_SAFARI_ITERATORS,Ui=It("iterator"),xi="keys",qi="values",Li="entries",Ci=function(){return this},Ii=function(e,t,r,n,o,i,a){Si(r,t,n);var s,u,c,l=function(e){if(e===o&&v)return v;if(!Ri&&e&&e in d)return d[e];switch(e){case xi:case qi:case Li:return function(){return new r(this,e)}}return function(){return new r(this)}},h=t+" Iterator",f=!1,d=e.prototype,p=d[Ui]||d["@@iterator"]||o&&d[o],v=!Ri&&p||l(o),m="Array"===t&&d.entries||p;if(m&&(s=Oi(m.call(new e)))!==Object.prototype&&s.next&&(ji(s,h,!0,!0),Ai[h]=Ci),Ti&&o===qi&&p&&p.name!==qi&&(f=!0,v=function(){return wi(p,this)}),o)if(u={values:l(qi),keys:i?v:l(xi),entries:l(Li)},a)for(c in u)(Ri||f||!(c in d))&&ki(d,c,u[c]);else bi({target:t,proto:!0,forced:Ri||f},u);return a&&d[Ui]!==v&&ki(d,Ui,v,{name:o}),Ai[t]=v,u},Ni=function(e,t){return{value:e,done:t}},Bi=K,Fi=W,Hi=Er;se.f;var Mi=Ii,_i=Ni,zi="Array Iterator",Gi=Hi.set,Di=Hi.getterFor(zi);Mi(Array,"Array",function(e,t){Gi(this,{type:zi,target:Bi(e),index:0,kind:t})},function(){var e=Di(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,_i(void 0,!0);switch(e.kind){case"keys":return _i(r,!1);case"values":return _i(t[r],!1)}return _i([r,t[r]],!1)},"values"),Fi.Arguments=Fi.Array;var Ji=Pn,$i=L,Vi=Nn,Qi=RangeError,Ki=String.fromCharCode,Wi=String.fromCodePoint,Yi=$i([].join);Ji({target:"String",stat:!0,arity:1,forced:!!Wi&&1!==Wi.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,o=0;n>o;){if(t=+arguments[o++],Vi(t,1114111)!==t)throw new Qi(t+" is not a valid code point");r[o]=t<65536?Ki(t):Ki(55296+((t-=65536)>>10),t%1024+56320)}return Yi(r,"")}});var Xi=X,Zi=ae,ea=Object.getOwnPropertyDescriptor,ta=E,ra=!0,na=It("iterator"),oa=!ta(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&&ra||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[na]||"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}),ia=se,aa=function(e,t,r){return ia.f(e,t,r)},sa=Bo,ua=Te,ca=TypeError,la=function(e,t){if(ua(t,e))return e;throw new ca("Incorrect invocation")},ha=ri,fa=String,da=function(e){if("Symbol"===ha(e))throw new TypeError("Cannot convert a Symbol value to a string");return fa(e)},pa=ri,va=tt,ma=G,ya=W,ga=It("iterator"),ba=function(e){if(!ma(e))return va(e,ga)||va(e,"@@iterator")||ya[pa(e)]},wa=Pe,Pa=Xe,Sa=ge,Oa=Qe,ja=ba,ka=TypeError,Aa=function(e,t){var r=arguments.length<2?ja(e):t;if(Pa(r))return Sa(wa(r,e));throw new ka(Oa(e)+" is not iterable")},Ea=TypeError,Ta=function(e,t){if(e<t)throw new Ea("Not enough arguments");return e},Ra=L([].slice),Ua=Ra,xa=Math.floor,qa=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 a=xa(r/2),s=qa(Ua(e,0,a),t),u=qa(Ua(e,a),t),c=s.length,l=u.length,h=0,f=0;h<c||f<l;)e[h+f]=h<c&&f<l?t(s[h],u[f])<=0?s[h++]:u[f++]:h<c?s[h++]:u[f++];return e},La=Pn,Ca=X,Ia=function(e){if(!Zi)return Xi[e];var t=ea(Xi,e);return t&&t.value},Na=Ee,Ba=Pe,Fa=L,Ha=ae,Ma=oa,_a=Bo,za=aa,Ga=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:sa(e,n,t[n],r);return e},Da=hi,Ja=gi,$a=Er,Va=la,Qa=ee,Ka=Pt,Wa=cn,Ya=ri,Xa=ge,Za=ie,es=da,ts=Ao,rs=ar,ns=Aa,os=ba,is=Ni,as=Ta,ss=qa,us=It("iterator"),cs="URLSearchParams",ls=cs+"Iterator",hs=$a.set,fs=$a.getterFor(cs),ds=$a.getterFor(ls),ps=Ia("fetch"),vs=Ia("Request"),ms=Ia("Headers"),ys=vs&&vs.prototype,gs=ms&&ms.prototype,bs=Ca.TypeError,ws=Ca.encodeURIComponent,Ps=String.fromCharCode,Ss=Na("String","fromCodePoint"),Os=parseInt,js=Fa("".charAt),ks=Fa([].join),As=Fa([].push),Es=Fa("".replace),Ts=Fa([].shift),Rs=Fa([].splice),Us=Fa("".split),xs=Fa("".slice),qs=Fa(/./.exec),Ls=/\+/g,Cs=/^[0-9a-f]+$/i,Is=function(e,t){var r=xs(e,t,t+2);return qs(Cs,r)?Os(r,16):NaN},Ns=function(e){for(var t=0,r=128;r>0&&0!==(e&r);r>>=1)t++;return t},Bs=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},Fs=function(e){for(var t=(e=Es(e,Ls," ")).length,r="",n=0;n<t;){var o=js(e,n);if("%"===o){if("%"===js(e,n+1)||n+3>t){r+="%",n++;continue}var i=Is(e,n+1);if(i!=i){r+=o,n++;continue}n+=2;var a=Ns(i);if(0===a)o=Ps(i);else{if(1===a||a>4){r+="�",n++;continue}for(var s=[i],u=1;u<a&&!(++n+3>t||"%"!==js(e,n));){var c=Is(e,n+1);if(c!=c){n+=3;break}if(c>191||c<128)break;As(s,c),n+=2,u++}if(s.length!==a){r+="�";continue}var l=Bs(s);null===l?r+="�":o=Ss(l)}}r+=o,n++}return r},Hs=/[!'()~]|%20/g,Ms={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},_s=function(e){return Ms[e]},zs=function(e){return Es(ws(e),Hs,_s)},Gs=Ja(function(e,t){hs(this,{type:ls,target:fs(e).entries,index:0,kind:t})},cs,function(){var e=ds(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,is(void 0,!0);var n=t[r];switch(e.kind){case"keys":return is(n.key,!1);case"values":return is(n.value,!1)}return is([n.key,n.value],!1)},!0),Ds=function(e){this.entries=[],this.url=null,void 0!==e&&(Za(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===js(e,0)?xs(e,1):e:es(e)))};Ds.prototype={type:cs,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,o,i,a,s,u=this.entries,c=os(e);if(c)for(r=(t=ns(e,c)).next;!(n=Ba(r,t)).done;){if(i=(o=ns(Xa(n.value))).next,(a=Ba(i,o)).done||(s=Ba(i,o)).done||!Ba(i,o).done)throw new bs("Expected sequence with length 2");As(u,{key:es(a.value),value:es(s.value)})}else for(var l in e)Ka(e,l)&&As(u,{key:l,value:es(e[l])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,o=Us(e,"&"),i=0;i<o.length;)(t=o[i++]).length&&(r=Us(t,"="),As(n,{key:Fs(Ts(r)),value:Fs(ks(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],As(r,zs(e.key)+"="+zs(e.value));return ks(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Js=function(){Va(this,$s);var e=hs(this,new Ds(arguments.length>0?arguments[0]:void 0));Ha||(this.size=e.entries.length)},$s=Js.prototype;if(Ga($s,{append:function(e,t){var r=fs(this);as(arguments.length,2),As(r.entries,{key:es(e),value:es(t)}),Ha||this.length++,r.updateURL()},delete:function(e){for(var t=fs(this),r=as(arguments.length,1),n=t.entries,o=es(e),i=r<2?void 0:arguments[1],a=void 0===i?i:es(i),s=0;s<n.length;){var u=n[s];if(u.key!==o||void 0!==a&&u.value!==a)s++;else if(Rs(n,s,1),void 0!==a)break}Ha||(this.size=n.length),t.updateURL()},get:function(e){var t=fs(this).entries;as(arguments.length,1);for(var r=es(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=fs(this).entries;as(arguments.length,1);for(var r=es(e),n=[],o=0;o<t.length;o++)t[o].key===r&&As(n,t[o].value);return n},has:function(e){for(var t=fs(this).entries,r=as(arguments.length,1),n=es(e),o=r<2?void 0:arguments[1],i=void 0===o?o:es(o),a=0;a<t.length;){var s=t[a++];if(s.key===n&&(void 0===i||s.value===i))return!0}return!1},set:function(e,t){var r=fs(this);as(arguments.length,1);for(var n,o=r.entries,i=!1,a=es(e),s=es(t),u=0;u<o.length;u++)(n=o[u]).key===a&&(i?Rs(o,u--,1):(i=!0,n.value=s));i||As(o,{key:a,value:s}),Ha||(this.size=o.length),r.updateURL()},sort:function(){var e=fs(this);ss(e.entries,function(e,t){return e.key>t.key?1:-1}),e.updateURL()},forEach:function(e){for(var t,r=fs(this).entries,n=Wa(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 Gs(this,"keys")},values:function(){return new Gs(this,"values")},entries:function(){return new Gs(this,"entries")}},{enumerable:!0}),_a($s,us,$s.entries,{name:"entries"}),_a($s,"toString",function(){return fs(this).serialize()},{enumerable:!0}),Ha&&za($s,"size",{get:function(){return fs(this).entries.length},configurable:!0,enumerable:!0}),Da(Js,cs),La({global:!0,constructor:!0,forced:!Ma},{URLSearchParams:Js}),!Ma&&Qa(ms)){var Vs=Fa(gs.has),Qs=Fa(gs.set),Ks=function(e){if(Za(e)){var t,r=e.body;if(Ya(r)===cs)return t=e.headers?new ms(e.headers):new ms,Vs(t,"content-type")||Qs(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),ts(e,{body:rs(0,es(r)),headers:rs(0,t)})}return e};if(Qa(ps)&&La({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return ps(e,arguments.length>1?Ks(arguments[1]):{})}}),Qa(vs)){var Ws=function(e){return Va(this,ys),new vs(e,arguments.length>1?Ks(arguments[1]):{})};ys.constructor=Ws,Ws.prototype=ys,La({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:Ws})}}var Ys={URLSearchParams:Js,getState:fs},Xs=L,Zs=qn,eu=da,tu=$,ru=Xs("".charAt),nu=Xs("".charCodeAt),ou=Xs("".slice),iu=function(e){return function(t,r){var n,o,i=eu(tu(t)),a=Zs(r),s=i.length;return a<0||a>=s?e?"":void 0:(n=nu(i,a))<55296||n>56319||a+1===s||(o=nu(i,a+1))<56320||o>57343?e?ru(i,a):n:e?ou(i,a,a+2):o-56320+(n-55296<<10)+65536}},au={codeAt:iu(!1),charAt:iu(!0)},su=au.charAt,uu=da,cu=Er,lu=Ii,hu=Ni,fu="String Iterator",du=cu.set,pu=cu.getterFor(fu);lu(String,"String",function(e){du(this,{type:fu,string:uu(e),index:0})},function(){var e,t=pu(this),r=t.string,n=t.index;return n>=r.length?hu(void 0,!0):(e=su(r,n),t.index+=e.length,hu(e,!1))});var vu={};vu.f=Object.getOwnPropertySymbols;var mu=ae,yu=L,gu=Pe,bu=E,wu=eo,Pu=vu,Su=Br,Ou=gt,ju=z,ku=Object.assign,Au=Object.defineProperty,Eu=yu([].concat),Tu=!ku||bu(function(){if(mu&&1!==ku({b:1},ku(Au({},"a",{enumerable:!0,get:function(){Au(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!==ku({},e)[r]||wu(ku({},t)).join("")!==n})?function(e,t){for(var r=Ou(e),n=arguments.length,o=1,i=Pu.f,a=Su.f;n>o;)for(var s,u=ju(arguments[o++]),c=i?Eu(wu(u),i(u)):wu(u),l=c.length,h=0;l>h;)s=c[h++],mu&&!gu(a,u,s)||(r[s]=u[s]);return r}:ku,Ru=Pe,Uu=ge,xu=tt,qu=ge,Lu=function(e,t,r){var n,o;Uu(e);try{if(!(n=xu(e,"return"))){if("throw"===t)throw r;return r}n=Ru(n,e)}catch(e){o=!0,n=e}if("throw"===t)throw r;if(o)throw n;return Uu(n),r},Cu=W,Iu=It("iterator"),Nu=Array.prototype,Bu=ee,Fu=dt,Hu=L(Function.toString);Bu(Fu.inspectSource)||(Fu.inspectSource=function(e){return Hu(e)});var Mu=Fu.inspectSource,_u=L,zu=E,Gu=ee,Du=ri,Ju=Mu,$u=function(){},Vu=Ee("Reflect","construct"),Qu=/^\s*(?:class|function)\b/,Ku=_u(Qu.exec),Wu=!Qu.test($u),Yu=function(e){if(!Gu(e))return!1;try{return Vu($u,[],e),!0}catch(e){return!1}},Xu=function(e){if(!Gu(e))return!1;switch(Du(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Wu||!!Ku(Qu,Ju(e))}catch(e){return!0}};Xu.sham=!0;var Zu,ec=!Vu||zu(function(){var e;return Yu(Yu.call)||!Yu(Object)||!Yu(function(){e=!0})||e})?Xu:Yu,tc=ae,rc=se,nc=ar,oc=cn,ic=Pe,ac=gt,sc=function(e,t,r,n){try{return n?t(qu(r)[0],r[1]):t(r)}catch(t){Lu(e,"throw",t)}},uc=function(e){return void 0!==e&&(Cu.Array===e||Nu[Iu]===e)},cc=ec,lc=Mn,hc=function(e,t,r){tc?rc.f(e,t,nc(0,r)):e[t]=r},fc=Aa,dc=ba,pc=Array,vc=L,mc=2147483647,yc=/[^\0-\u007E]/,gc=/[.\u3002\uFF0E\uFF61]/g,bc="Overflow: input needs wider integers to process",wc=RangeError,Pc=vc(gc.exec),Sc=Math.floor,Oc=String.fromCharCode,jc=vc("".charCodeAt),kc=vc([].join),Ac=vc([].push),Ec=vc("".replace),Tc=vc("".split),Rc=vc("".toLowerCase),Uc=function(e){return e+22+75*(e<26)},xc=function(e,t,r){var n=0;for(e=r?Sc(e/700):e>>1,e+=Sc(e/t);e>455;)e=Sc(e/35),n+=36;return Sc(n+36*e/(e+38))},qc=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var o=jc(e,r++);if(o>=55296&&o<=56319&&r<n){var i=jc(e,r++);56320==(64512&i)?Ac(t,((1023&o)<<10)+(1023&i)+65536):(Ac(t,o),r--)}else Ac(t,o)}return t}(e);var r,n,o=e.length,i=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&Ac(t,Oc(n));var u=t.length,c=u;for(u&&Ac(t,"-");c<o;){var l=mc;for(r=0;r<e.length;r++)(n=e[r])>=i&&n<l&&(l=n);var h=c+1;if(l-i>Sc((mc-a)/h))throw new wc(bc);for(a+=(l-i)*h,i=l,r=0;r<e.length;r++){if((n=e[r])<i&&++a>mc)throw new wc(bc);if(n===i){for(var f=a,d=36;;){var p=d<=s?1:d>=s+26?26:d-s;if(f<p)break;var v=f-p,m=36-p;Ac(t,Oc(Uc(p+v%m))),f=Sc(v/m),d+=36}Ac(t,Oc(Uc(f))),s=xc(a,h,c===u),a=0,c++}}a++,i++}return kc(t,"")},Lc=Pn,Cc=ae,Ic=oa,Nc=X,Bc=cn,Fc=L,Hc=Bo,Mc=aa,_c=la,zc=Pt,Gc=Tu,Dc=function(e){var t=ac(e),r=cc(this),n=arguments.length,o=n>1?arguments[1]:void 0,i=void 0!==o;i&&(o=oc(o,n>2?arguments[2]:void 0));var a,s,u,c,l,h,f=dc(t),d=0;if(!f||this===pc&&uc(f))for(a=lc(t),s=r?new this(a):pc(a);a>d;d++)h=i?o(t[d],d):t[d],hc(s,d,h);else for(s=r?new this:[],l=(c=fc(t,f)).next;!(u=ic(l,c)).done;d++)h=i?sc(c,o,[u.value,d],!0):u.value,hc(s,d,h);return s.length=d,s},Jc=Ra,$c=au.codeAt,Vc=function(e){var t,r,n=[],o=Tc(Ec(Rc(e),gc,"."),".");for(t=0;t<o.length;t++)r=o[t],Ac(n,Pc(yc,r)?"xn--"+qc(r):r);return kc(n,".")},Qc=da,Kc=hi,Wc=Ta,Yc=Ys,Xc=Er,Zc=Xc.set,el=Xc.getterFor("URL"),tl=Yc.URLSearchParams,rl=Yc.getState,nl=Nc.URL,ol=Nc.TypeError,il=Nc.parseInt,al=Math.floor,sl=Math.pow,ul=Fc("".charAt),cl=Fc(/./.exec),ll=Fc([].join),hl=Fc(1.1.toString),fl=Fc([].pop),dl=Fc([].push),pl=Fc("".replace),vl=Fc([].shift),ml=Fc("".split),yl=Fc("".slice),gl=Fc("".toLowerCase),bl=Fc([].unshift),wl="Invalid scheme",Pl="Invalid host",Sl="Invalid port",Ol=/[a-z]/i,jl=/[\d+-.a-z]/i,kl=/\d/,Al=/^0x/i,El=/^[0-7]+$/,Tl=/^\d+$/,Rl=/^[\da-f]+$/i,Ul=/[\0\t\n\r #%/:<>?@[\\\]^|]/,xl=/[\0\t\n\r #/:<>?@[\\\]^|]/,ql=/^[\u0000-\u0020]+/,Ll=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,Cl=/[\t\n\r]/g,Il=function(e){var t,r,n,o;if("number"==typeof e){for(t=[],r=0;r<4;r++)bl(t,e%256),e=al(e/256);return ll(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+=hl(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Nl={},Bl=Gc({},Nl,{" ":1,'"':1,"<":1,">":1,"`":1}),Fl=Gc({},Bl,{"#":1,"?":1,"{":1,"}":1}),Hl=Gc({},Fl,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Ml=function(e,t){var r=$c(e,0);return r>32&&r<127&&!zc(t,e)?e:encodeURIComponent(e)},_l={ftp:21,file:null,http:80,https:443,ws:80,wss:443},zl=function(e,t){var r;return 2===e.length&&cl(Ol,ul(e,0))&&(":"===(r=ul(e,1))||!t&&"|"===r)},Gl=function(e){var t;return e.length>1&&zl(yl(e,0,2))&&(2===e.length||"/"===(t=ul(e,2))||"\\"===t||"?"===t||"#"===t)},Dl=function(e){return"."===e||"%2e"===gl(e)},Jl=function(e){return".."===(e=gl(e))||"%2e."===e||".%2e"===e||"%2e%2e"===e},$l={},Vl={},Ql={},Kl={},Wl={},Yl={},Xl={},Zl={},eh={},th={},rh={},nh={},oh={},ih={},ah={},sh={},uh={},ch={},lh={},hh={},fh={},dh=function(e,t,r){var n,o,i,a=Qc(e);if(t){if(o=this.parse(a))throw new ol(o);this.searchParams=null}else{if(void 0!==r&&(n=new dh(r,!0)),o=this.parse(a,null,n))throw new ol(o);(i=rl(new tl)).bindURL(this),this.searchParams=i}};dh.prototype={type:"URL",parse:function(e,t,r){var n,o,i,a,s=this,u=t||$l,c=0,l="",h=!1,f=!1,d=!1;for(e=Qc(e),t||(s.scheme="",s.username="",s.password="",s.host=null,s.port=null,s.path=[],s.query=null,s.fragment=null,s.cannotBeABaseURL=!1,e=pl(e,ql,""),e=pl(e,Ll,"$1")),e=pl(e,Cl,""),n=Dc(e);c<=n.length;){switch(o=n[c],u){case $l:if(!o||!cl(Ol,o)){if(t)return wl;u=Ql;continue}l+=gl(o),u=Vl;break;case Vl:if(o&&(cl(jl,o)||"+"===o||"-"===o||"."===o))l+=gl(o);else{if(":"!==o){if(t)return wl;l="",u=Ql,c=0;continue}if(t&&(s.isSpecial()!==zc(_l,l)||"file"===l&&(s.includesCredentials()||null!==s.port)||"file"===s.scheme&&!s.host))return;if(s.scheme=l,t)return void(s.isSpecial()&&_l[s.scheme]===s.port&&(s.port=null));l="","file"===s.scheme?u=ih:s.isSpecial()&&r&&r.scheme===s.scheme?u=Kl:s.isSpecial()?u=Zl:"/"===n[c+1]?(u=Wl,c++):(s.cannotBeABaseURL=!0,dl(s.path,""),u=lh)}break;case Ql:if(!r||r.cannotBeABaseURL&&"#"!==o)return wl;if(r.cannotBeABaseURL&&"#"===o){s.scheme=r.scheme,s.path=Jc(r.path),s.query=r.query,s.fragment="",s.cannotBeABaseURL=!0,u=fh;break}u="file"===r.scheme?ih:Yl;continue;case Kl:if("/"!==o||"/"!==n[c+1]){u=Yl;continue}u=eh,c++;break;case Wl:if("/"===o){u=th;break}u=ch;continue;case Yl:if(s.scheme=r.scheme,o===Zu)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=Jc(r.path),s.query=r.query;else if("/"===o||"\\"===o&&s.isSpecial())u=Xl;else if("?"===o)s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=Jc(r.path),s.query="",u=hh;else{if("#"!==o){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=Jc(r.path),s.path.length--,u=ch;continue}s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,s.path=Jc(r.path),s.query=r.query,s.fragment="",u=fh}break;case Xl:if(!s.isSpecial()||"/"!==o&&"\\"!==o){if("/"!==o){s.username=r.username,s.password=r.password,s.host=r.host,s.port=r.port,u=ch;continue}u=th}else u=eh;break;case Zl:if(u=eh,"/"!==o||"/"!==ul(l,c+1))continue;c++;break;case eh:if("/"!==o&&"\\"!==o){u=th;continue}break;case th:if("@"===o){h&&(l="%40"+l),h=!0,i=Dc(l);for(var p=0;p<i.length;p++){var v=i[p];if(":"!==v||d){var m=Ml(v,Hl);d?s.password+=m:s.username+=m}else d=!0}l=""}else if(o===Zu||"/"===o||"?"===o||"#"===o||"\\"===o&&s.isSpecial()){if(h&&""===l)return"Invalid authority";c-=Dc(l).length+1,l="",u=rh}else l+=o;break;case rh:case nh:if(t&&"file"===s.scheme){u=sh;continue}if(":"!==o||f){if(o===Zu||"/"===o||"?"===o||"#"===o||"\\"===o&&s.isSpecial()){if(s.isSpecial()&&""===l)return Pl;if(t&&""===l&&(s.includesCredentials()||null!==s.port))return;if(a=s.parseHost(l))return a;if(l="",u=uh,t)return;continue}"["===o?f=!0:"]"===o&&(f=!1),l+=o}else{if(""===l)return Pl;if(a=s.parseHost(l))return a;if(l="",u=oh,t===nh)return}break;case oh:if(!cl(kl,o)){if(o===Zu||"/"===o||"?"===o||"#"===o||"\\"===o&&s.isSpecial()||t){if(""!==l){var y=il(l,10);if(y>65535)return Sl;s.port=s.isSpecial()&&y===_l[s.scheme]?null:y,l=""}if(t)return;u=uh;continue}return Sl}l+=o;break;case ih:if(s.scheme="file","/"===o||"\\"===o)u=ah;else{if(!r||"file"!==r.scheme){u=ch;continue}switch(o){case Zu:s.host=r.host,s.path=Jc(r.path),s.query=r.query;break;case"?":s.host=r.host,s.path=Jc(r.path),s.query="",u=hh;break;case"#":s.host=r.host,s.path=Jc(r.path),s.query=r.query,s.fragment="",u=fh;break;default:Gl(ll(Jc(n,c),""))||(s.host=r.host,s.path=Jc(r.path),s.shortenPath()),u=ch;continue}}break;case ah:if("/"===o||"\\"===o){u=sh;break}r&&"file"===r.scheme&&!Gl(ll(Jc(n,c),""))&&(zl(r.path[0],!0)?dl(s.path,r.path[0]):s.host=r.host),u=ch;continue;case sh:if(o===Zu||"/"===o||"\\"===o||"?"===o||"#"===o){if(!t&&zl(l))u=ch;else if(""===l){if(s.host="",t)return;u=uh}else{if(a=s.parseHost(l))return a;if("localhost"===s.host&&(s.host=""),t)return;l="",u=uh}continue}l+=o;break;case uh:if(s.isSpecial()){if(u=ch,"/"!==o&&"\\"!==o)continue}else if(t||"?"!==o)if(t||"#"!==o){if(o!==Zu&&(u=ch,"/"!==o))continue}else s.fragment="",u=fh;else s.query="",u=hh;break;case ch:if(o===Zu||"/"===o||"\\"===o&&s.isSpecial()||!t&&("?"===o||"#"===o)){if(Jl(l)?(s.shortenPath(),"/"===o||"\\"===o&&s.isSpecial()||dl(s.path,"")):Dl(l)?"/"===o||"\\"===o&&s.isSpecial()||dl(s.path,""):("file"===s.scheme&&!s.path.length&&zl(l)&&(s.host&&(s.host=""),l=ul(l,0)+":"),dl(s.path,l)),l="","file"===s.scheme&&(o===Zu||"?"===o||"#"===o))for(;s.path.length>1&&""===s.path[0];)vl(s.path);"?"===o?(s.query="",u=hh):"#"===o&&(s.fragment="",u=fh)}else l+=Ml(o,Fl);break;case lh:"?"===o?(s.query="",u=hh):"#"===o?(s.fragment="",u=fh):o!==Zu&&(s.path[0]+=Ml(o,Nl));break;case hh:t||"#"!==o?o!==Zu&&("'"===o&&s.isSpecial()?s.query+="%27":s.query+="#"===o?"%23":Ml(o,Nl)):(s.fragment="",u=fh);break;case fh:o!==Zu&&(s.fragment+=Ml(o,Bl))}c++}},parseHost:function(e){var t,r,n;if("["===ul(e,0)){if("]"!==ul(e,e.length-1))return Pl;if(t=function(e){var t,r,n,o,i,a,s,u=[0,0,0,0,0,0,0,0],c=0,l=null,h=0,f=function(){return ul(e,h)};if(":"===f()){if(":"!==ul(e,1))return;h+=2,l=++c}for(;f();){if(8===c)return;if(":"!==f()){for(t=r=0;r<4&&cl(Rl,f());)t=16*t+il(f(),16),h++,r++;if("."===f()){if(0===r)return;if(h-=r,c>6)return;for(n=0;f();){if(o=null,n>0){if(!("."===f()&&n<4))return;h++}if(!cl(kl,f()))return;for(;cl(kl,f());){if(i=il(f(),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(":"===f()){if(h++,!f())return}else if(f())return;u[c++]=t}else{if(null!==l)return;h++,l=++c}}if(null!==l)for(a=c-l,c=7;0!==c&&a>0;)s=u[c],u[c--]=u[l+a-1],u[l+--a]=s;else if(8!==c)return;return u}(yl(e,1,-1)),!t)return Pl;this.host=t}else if(this.isSpecial()){if(e=Vc(e),cl(Ul,e))return Pl;if(t=function(e){var t,r,n,o,i,a,s,u=ml(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"===ul(o,0)&&(i=cl(Al,o)?16:8,o=yl(o,8===i?1:2)),""===o)a=0;else{if(!cl(10===i?Tl:8===i?El:Rl,o))return e;a=il(o,i)}dl(r,a)}for(n=0;n<t;n++)if(a=r[n],n===t-1){if(a>=sl(256,5-t))return null}else if(a>255)return null;for(s=fl(r),n=0;n<r.length;n++)s+=r[n]*sl(256,3-n);return s}(e),null===t)return Pl;this.host=t}else{if(cl(xl,e))return Pl;for(t="",r=Dc(e),n=0;n<r.length;n++)t+=Ml(r[n],Nl);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return zc(_l,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,a=e.path,s=e.query,u=e.fragment,c=t+":";return null!==o?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=Il(o),null!==i&&(c+=":"+i)):"file"===t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+ll(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw new ol(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new ph(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+Il(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Qc(e)+":",$l)},getUsername:function(){return this.username},setUsername:function(e){var t=Dc(Qc(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Ml(t[r],Hl)}},getPassword:function(){return this.password},setPassword:function(e){var t=Dc(Qc(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Ml(t[r],Hl)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?Il(e):Il(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,rh)},getHostname:function(){var e=this.host;return null===e?"":Il(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,nh)},getPort:function(){var e=this.port;return null===e?"":Qc(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=Qc(e))?this.port=null:this.parse(e,oh))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+ll(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,uh))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=Qc(e))?this.query=null:("?"===ul(e,0)&&(e=yl(e,1)),this.query="",this.parse(e,hh)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=Qc(e))?("#"===ul(e,0)&&(e=yl(e,1)),this.fragment="",this.parse(e,fh)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var ph=function(e){var t=_c(this,vh),r=Wc(arguments.length,1)>1?arguments[1]:void 0,n=Zc(t,new dh(e,!1,r));Cc||(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())},vh=ph.prototype,mh=function(e,t){return{get:function(){return el(this)[e]()},set:t&&function(e){return el(this)[t](e)},configurable:!0,enumerable:!0}};if(Cc&&(Mc(vh,"href",mh("serialize","setHref")),Mc(vh,"origin",mh("getOrigin")),Mc(vh,"protocol",mh("getProtocol","setProtocol")),Mc(vh,"username",mh("getUsername","setUsername")),Mc(vh,"password",mh("getPassword","setPassword")),Mc(vh,"host",mh("getHost","setHost")),Mc(vh,"hostname",mh("getHostname","setHostname")),Mc(vh,"port",mh("getPort","setPort")),Mc(vh,"pathname",mh("getPathname","setPathname")),Mc(vh,"search",mh("getSearch","setSearch")),Mc(vh,"searchParams",mh("getSearchParams")),Mc(vh,"hash",mh("getHash","setHash"))),Hc(vh,"toJSON",function(){return el(this).serialize()},{enumerable:!0}),Hc(vh,"toString",function(){return el(this).serialize()},{enumerable:!0}),nl){var yh=nl.createObjectURL,gh=nl.revokeObjectURL;yh&&Hc(ph,"createObjectURL",Bc(yh,nl)),gh&&Hc(ph,"revokeObjectURL",Bc(gh,nl))}Kc(ph,"URL"),Lc({global:!0,constructor:!0,forced:!Ic,sham:!Cc},{URL:ph});var bh=Pn,wh=E,Ph=Ta,Sh=da,Oh=oa,jh=Ee("URL"),kh=Oh&&wh(function(){jh.canParse()}),Ah=wh(function(){return 1!==jh.canParse.length});bh({target:"URL",stat:!0,forced:!kh||Ah},{canParse:function(e){var t=Ph(arguments.length,1),r=Sh(e),n=t<2||void 0===arguments[1]?void 0:Sh(arguments[1]);try{return!!new jh(r,n)}catch(e){return!1}}});var Eh=Pn,Th=Ta,Rh=da,Uh=oa,xh=Ee("URL");Eh({target:"URL",stat:!0,forced:!Uh},{parse:function(e){var t=Th(arguments.length,1),r=Rh(e),n=t<2||void 0===arguments[1]?void 0:Rh(arguments[1]);try{return new xh(r,n)}catch(e){return null}}});var qh=j(Se.URL),Lh=function(e){function r(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 t(r,e),r}(Error),Ch=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 i=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(function(e){return n(r,0,void 0,function(){var t,r,n,i,a,s,u,c,l,h,f,d;return o(this,function(o){switch(o.label){case 0:return t=null,r=null,n=null,i=e.status,a=e.statusText,e.ok?"HEAD"===this.method?[3,2]:[4,e.text()]:[3,3];case 1:""===(c=o.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)),o.label=2;case 2:return s=null===(h=this.headers.get("Prefer"))||void 0===h?void 0:h.match(/count=(exact|planned|estimated)/),u=null===(f=e.headers.get("content-range"))||void 0===f?void 0:f.split("/"),s&&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,i=406,a="Not Acceptable"):r=1===r.length?r[0]:null),[3,5];case 3:return[4,e.text()];case 4:c=o.sent();try{t=JSON.parse(c),Array.isArray(t)&&404===e.status&&(r=[],t=null,i=200,a="OK")}catch(r){404===e.status&&""===c?(i=204,a="No Content"):t={message:c}}if(t&&this.isMaybeSingle&&(null===(d=null==t?void 0:t.details)||void 0===d?void 0:d.includes("0 rows"))&&(t=null,i=200,a="OK"),t&&this.shouldThrowOnError)throw new Lh(t);o.label=5;case 5:return[2,{error:t,data:r,count:n,status:i,statusText:a}]}})})});return this.shouldThrowOnError||(i=i.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:""}})),i.then(e,t)},e.prototype.returns=function(){return this},e.prototype.overrideTypes=function(){return this},e}(),Ih=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.prototype.eq=function(e,t){return this.url.searchParams.append(e,"eq.".concat(t)),this},r.prototype.neq=function(e,t){return this.url.searchParams.append(e,"neq.".concat(t)),this},r.prototype.gt=function(e,t){return this.url.searchParams.append(e,"gt.".concat(t)),this},r.prototype.gte=function(e,t){return this.url.searchParams.append(e,"gte.".concat(t)),this},r.prototype.lt=function(e,t){return this.url.searchParams.append(e,"lt.".concat(t)),this},r.prototype.lte=function(e,t){return this.url.searchParams.append(e,"lte.".concat(t)),this},r.prototype.like=function(e,t){return this.url.searchParams.append(e,"like.".concat(t)),this},r.prototype.likeAllOf=function(e,t){return this.url.searchParams.append(e,"like(all).{".concat(t.join(","),"}")),this},r.prototype.likeAnyOf=function(e,t){return this.url.searchParams.append(e,"like(any).{".concat(t.join(","),"}")),this},r.prototype.ilike=function(e,t){return this.url.searchParams.append(e,"ilike.".concat(t)),this},r.prototype.ilikeAllOf=function(e,t){return this.url.searchParams.append(e,"ilike(all).{".concat(t.join(","),"}")),this},r.prototype.ilikeAnyOf=function(e,t){return this.url.searchParams.append(e,"ilike(any).{".concat(t.join(","),"}")),this},r.prototype.is=function(e,t){return this.url.searchParams.append(e,"is.".concat(t)),this},r.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},r.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},r.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},r.prototype.rangeGt=function(e,t){return this.url.searchParams.append(e,"sr.".concat(t)),this},r.prototype.rangeGte=function(e,t){return this.url.searchParams.append(e,"nxl.".concat(t)),this},r.prototype.rangeLt=function(e,t){return this.url.searchParams.append(e,"sl.".concat(t)),this},r.prototype.rangeLte=function(e,t){return this.url.searchParams.append(e,"nxr.".concat(t)),this},r.prototype.rangeAdjacent=function(e,t){return this.url.searchParams.append(e,"adj.".concat(t)),this},r.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},r.prototype.textSearch=function(e,t,r){var n=void 0===r?{}:r,o=n.config,i=n.type,a="";"plain"===i?a="pl":"phrase"===i?a="ph":"websearch"===i&&(a="w");var s=void 0===o?"":"(".concat(o,")");return this.url.searchParams.append(e,"".concat(a,"fts").concat(s,".").concat(t)),this},r.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},r.prototype.not=function(e,t,r){return this.url.searchParams.append(e,"not.".concat(t,".").concat(r)),this},r.prototype.or=function(e,t){var r=void 0===t?{}:t,n=r.foreignTable,o=r.referencedTable,i=void 0===o?n:o,a=i?"".concat(i,".or"):"or";return this.url.searchParams.append(a,"(".concat(e,")")),this},r.prototype.filter=function(e,t,r){return this.url.searchParams.append(e,"".concat(t,".").concat(r)),this},r}(function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.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},r.prototype.order=function(e,t){var r=void 0===t?{}:t,n=r.ascending,o=void 0===n||n,i=r.nullsFirst,a=r.foreignTable,s=r.referencedTable,u=void 0===s?a:s,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},r.prototype.limit=function(e,t){var r=void 0===t?{}:t,n=r.foreignTable,o=r.referencedTable,i=void 0===o?n:o,a=void 0===i?"limit":"".concat(i,".limit");return this.url.searchParams.set(a,"".concat(e)),this},r.prototype.range=function(e,t,r){var n=void 0===r?{}:r,o=n.foreignTable,i=n.referencedTable,a=void 0===i?o:i,s=void 0===a?"offset":"".concat(a,".offset"),u=void 0===a?"limit":"".concat(a,".limit");return this.url.searchParams.set(s,"".concat(e)),this.url.searchParams.set(u,"".concat(t-e+1)),this},r.prototype.abortSignal=function(e){return this.signal=e,this},r.prototype.single=function(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this},r.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},r.prototype.csv=function(){return this.headers.set("Accept","text/csv"),this},r.prototype.geojson=function(){return this.headers.set("Accept","application/geo+json"),this},r.prototype.explain=function(e){var t,r=void 0===e?{}:e,n=r.analyze,o=void 0!==n&&n,i=r.verbose,a=void 0!==i&&i,s=r.settings,u=void 0!==s&&s,c=r.buffers,l=void 0!==c&&c,h=r.wal,f=void 0!==h&&h,d=r.format,p=void 0===d?"text":d,v=[o?"analyze":null,a?"verbose":null,u?"settings":null,l?"buffers":null,f?"wal":null].filter(Boolean).join("|"),m=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(m,'"; options=').concat(v,";")),this},r.prototype.rollback=function(){return this.headers.append("Prefer","tx=rollback"),this},r.prototype.returns=function(){return this},r.prototype.maxAffected=function(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer","max-affected=".concat(e)),this},r}(Ch)),Nh=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,a=o?"HEAD":"GET",s=!1,u=(null!=e?e:"*").split("").map(function(e){return/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e)}).join("");return this.url.searchParams.set("select",u),i&&this.headers.append("Prefer","count=".concat(i)),new Ih({method:a,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,a=void 0===i||i;if(o&&this.headers.append("Prefer","count=".concat(o)),a||this.headers.append("Prefer","missing=default"),Array.isArray(e)){var s=e.reduce(function(e,t){return e.concat(Object.keys(t))},[]);if(s.length>0){var u=Array.from(new Set(s)).map(function(e){return'"'.concat(e,'"')});this.url.searchParams.set("columns",u.join(","))}}return new Ih({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,a=void 0!==i&&i,s=n.count,u=n.defaultToNull,c=void 0===u||u;if(this.headers.append("Prefer","resolution=".concat(a?"ignore":"merge","-duplicates")),void 0!==o&&this.url.searchParams.set("on_conflict",o),s&&this.headers.append("Prefer","count=".concat(s)),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 Ih({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 Ih({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 Ih({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!==(t=this.fetch)&&void 0!==t?t:fetch})},e}(),Bh=function(e){function r(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 t(r,e),r}(Nh),Fh=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 qh("".concat(this.url,"/").concat(e));return new Bh(t,{headers:this.headers,fetch:this.fetch})},e}();function Hh(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.models=P(r,e),e.mysql=Mh(e,{envId:null==t?void 0:t.envId}),e.rdb=Mh(e,{envId:null==t?void 0:t.envId}),e}function Mh(e,t){var i=null==t?void 0:t.envId,a=(null==t?void 0:t.mysqlBaseUrl)||_h(e,null==t?void 0:t.envId).mysql,s=null==t?void 0:t.fetch;return function(t){var c=this;return new Fh(a,{fetch:s||function(a,s){return n(c,0,void 0,function(){var n,c,l,h;return o(this,function(o){switch(o.label){case 0:return n=(null==t?void 0:t.instance)||"default",c=(null==t?void 0:t.database)||i,l={},(null==s?void 0:s.headers)instanceof Headers?s.headers.forEach(function(e,t){l[t]=e}):l=(null==s?void 0:s.headers)||{},[4,u(e)];case 1:return h=o.sent(),[2,e.callFunction({name:"httpOverCallFunction",data:{url:a.toString(),method:(null==s?void 0:s.method)||"GET",headers:r(r(r({},h?{Authorization:"Bearer ".concat(h)}:{}),l||{}),{"Content-Type":"application/json","X-Db-Instance":n,"Accept-Profile":c,"Content-Profile":c}),body:null==s?void 0:s.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 _h(e,t){var r=function(e,t){var r,n,o,i,a=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 a&&a.trim()||(a=null===(o=null==e?void 0:e.config)||void 0===o?void 0:o.env),"string"==typeof a&&a.trim()||(a=null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.envName),"string"==typeof a&&a.trim()?a.trim():""}(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 zh={init:Hh,generateHTTPClient:y,generateMySQLClient:Mh};exports.default=zh,exports.generateHTTPClient=y,exports.generateMySQLClient=Mh,exports.getAccessToken=u,exports.init=Hh,exports.initHTTPOverCallFunction=function(e,t){var i=this;if(!e)throw new Error("cloud is required");if(!e.callFunction)throw new Error("cloud.callFunction is required");var a,s=e.callFunction.bind(e);try{var c=(null==t?void 0:t.baseUrl)||_h(e,null==t?void 0:t.envId).model,l=(null==t?void 0:t.sqlBaseUrl)||_h(e,null==t?void 0:t.envId).sql;a=y(s,function(t){var a=t.url,c=t.body,l=t.method,h=t.headers;return n(i,0,void 0,function(){var t,n,i;return o(this,function(o){switch(o.label){case 0:return[4,u(e)];case 1:return t=o.sent(),[4,s({name:"httpOverCallFunction",data:{url:a,method:null==l?void 0:l.toUpperCase(),headers:r(r(r({},t?{Authorization:"Bearer ".concat(t)}:{}),h||{}),{"Content-Type":"application/json"}),body:c}})];case 2:return n=o.sent(),[2,null===(i=null==n?void 0:n.result)||void 0===i?void 0:i.body]}})})},c,{sqlBaseUrl:l,cloud:e})}catch(e){console.error("init http orm client failed, try call function orm",e),a=P(s)}return e.models=a,e.mysql=Mh(e,{envId:null==t?void 0:t.envId,mysqlBaseUrl:null==t?void 0:t.mysqlBaseUrl}),e};
|