@cloudbase/js-sdk 3.7.0 → 3.7.2-cbf.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/app/dist/index.esm.js +1 -1
- package/app/dist/index.js +1 -1
- package/app/dist/index.js.map +1 -1
- package/app/dist/index.node.esm.js +1 -1
- package/app/dist/index.node.esm.js.map +1 -1
- package/app/dist/index.node.js +1 -1
- package/app/dist/index.node.js.map +1 -1
- package/auth/dist/index.esm.js +1 -1
- package/auth/dist/index.esm.js.map +1 -1
- package/auth/dist/index.js +1 -1
- package/auth/dist/index.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +1 -1
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm.js +1 -1
- package/dist/index.node.esm.js.map +1 -1
- package/miniprogram_dist/ai.js +2 -0
- package/miniprogram_dist/analytics.js +1 -0
- package/miniprogram_dist/apis.js +1 -0
- package/miniprogram_dist/app.js +2 -0
- package/miniprogram_dist/auth/index.d.ts +2 -0
- package/miniprogram_dist/auth/index.js +1 -1
- package/miniprogram_dist/auth.js +2 -0
- package/miniprogram_dist/cloudrun.js +1 -0
- package/miniprogram_dist/container.js +1 -0
- package/miniprogram_dist/database.js +1 -0
- package/miniprogram_dist/functions.js +1 -0
- package/miniprogram_dist/index.js +1 -1
- package/miniprogram_dist/model/index.js +1 -1
- package/miniprogram_dist/model.js +1 -0
- package/miniprogram_dist/mysql.js +1 -0
- package/miniprogram_dist/oauth/index.js +1 -1
- package/miniprogram_dist/oauth.js +2 -0
- package/miniprogram_dist/realtime.js +1 -0
- package/miniprogram_dist/storage.js +1 -0
- package/oauth/dist/index.esm.js +1 -1
- package/oauth/dist/index.esm.js.map +1 -1
- package/oauth/dist/index.js +1 -1
- package/oauth/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/types/package.json +13 -1
- package/utilities/package.json +1 -1
- package/utilities/dist/cjs/adapters/index.d.ts +0 -45
- package/utilities/dist/cjs/adapters/index.js +0 -68
- package/utilities/dist/cjs/adapters/platforms/web.d.ts +0 -20
- package/utilities/dist/cjs/adapters/platforms/web.js +0 -286
- package/utilities/dist/cjs/constants/common.d.ts +0 -6
- package/utilities/dist/cjs/constants/common.js +0 -24
- package/utilities/dist/cjs/constants/errors.d.ts +0 -8
- package/utilities/dist/cjs/constants/errors.js +0 -12
- package/utilities/dist/cjs/constants/index.d.ts +0 -3
- package/utilities/dist/cjs/constants/index.js +0 -21
- package/utilities/dist/cjs/helpers/decorators.d.ts +0 -11
- package/utilities/dist/cjs/helpers/decorators.js +0 -238
- package/utilities/dist/cjs/helpers/index.d.ts +0 -1
- package/utilities/dist/cjs/helpers/index.js +0 -18
- package/utilities/dist/cjs/index.d.ts +0 -13
- package/utilities/dist/cjs/index.js +0 -51
- package/utilities/dist/cjs/libs/abortController.d.ts +0 -9
- package/utilities/dist/cjs/libs/abortController.js +0 -25
- package/utilities/dist/cjs/libs/cache.d.ts +0 -17
- package/utilities/dist/cjs/libs/cache.js +0 -261
- package/utilities/dist/cjs/libs/events.d.ts +0 -27
- package/utilities/dist/cjs/libs/events.js +0 -108
- package/utilities/dist/cjs/libs/langEvent.d.ts +0 -3
- package/utilities/dist/cjs/libs/langEvent.js +0 -7
- package/utilities/dist/cjs/libs/util.d.ts +0 -49
- package/utilities/dist/cjs/libs/util.js +0 -282
- package/utilities/dist/esm/adapters/index.d.ts +0 -45
- package/utilities/dist/esm/adapters/index.js +0 -40
- package/utilities/dist/esm/adapters/platforms/web.d.ts +0 -20
- package/utilities/dist/esm/adapters/platforms/web.js +0 -282
- package/utilities/dist/esm/constants/common.d.ts +0 -6
- package/utilities/dist/esm/constants/common.js +0 -17
- package/utilities/dist/esm/constants/errors.d.ts +0 -8
- package/utilities/dist/esm/constants/errors.js +0 -9
- package/utilities/dist/esm/constants/index.d.ts +0 -3
- package/utilities/dist/esm/constants/index.js +0 -4
- package/utilities/dist/esm/helpers/decorators.d.ts +0 -11
- package/utilities/dist/esm/helpers/decorators.js +0 -234
- package/utilities/dist/esm/helpers/index.d.ts +0 -1
- package/utilities/dist/esm/helpers/index.js +0 -2
- package/utilities/dist/esm/index.d.ts +0 -13
- package/utilities/dist/esm/index.js +0 -14
- package/utilities/dist/esm/libs/abortController.d.ts +0 -9
- package/utilities/dist/esm/libs/abortController.js +0 -23
- package/utilities/dist/esm/libs/cache.d.ts +0 -17
- package/utilities/dist/esm/libs/cache.js +0 -258
- package/utilities/dist/esm/libs/events.d.ts +0 -27
- package/utilities/dist/esm/libs/events.js +0 -102
- package/utilities/dist/esm/libs/langEvent.d.ts +0 -3
- package/utilities/dist/esm/libs/langEvent.js +0 -4
- package/utilities/dist/esm/libs/util.d.ts +0 -49
- package/utilities/dist/esm/libs/util.js +0 -254
- package/utilities/dist/miniprogram/index.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see ai.js.LICENSE.txt */
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_ai",[],t):"object"==typeof exports?exports.cloudbase_ai=t():e.cloudbase_ai=t()}("undefined"!=typeof window?window:this,(()=>(()=>{var e={829:(e,t,r)=>{"use strict";var n;r.r(t),r.d(t,{AbstractSDKRequest:()=>o,AbstractStorage:()=>i,StorageType:()=>n,formatUrl:()=>a}),function(e){e.local="local",e.none="none",e.session="session"}(n||(n={}));var o=function(){},i=function(){};function a(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}},451:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t},s=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},l=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.AI=void 0;var u=r(737),c=a(r(305)),f=r(689),d=r(877),h=c.MODELS,p=function(){function e(e,t,r,o){var i=this;this.req=e,this.baseUrl=t,this.modelRequest=function(e){var t=e.url,r=e.data,o=e.headers,a=e.stream,u=e.timeout;return s(i,void 0,void 0,(function(){var e,i,s,c,f,d,h;return l(this,(function(l){switch(l.label){case 0:return e={"Content-Type":"application/json"},a&&Object.assign(e,{Accept:"text/event-stream"}),[4,this.req.fetch({method:"post",headers:n(n((f={},f[null===(d=this.i18n)||void 0===d?void 0:d.LANG_HEADER_KEY]=null===(h=this.i18n)||void 0===h?void 0:h.lang,f),e),o),body:JSON.stringify(r),url:this.resolveUrl(t),stream:a,timeout:u})];case 1:return i=l.sent(),s=i.data,c=i.header,[2,this.handleResponseData(s,c)]}}))}))},this.botRequest=function(e){var t=e.method,r=e.url,o=e.data,a=void 0===o?{}:o,u=e.headers,c=e.stream,f=e.timeout;return s(i,void 0,void 0,(function(){var e,o,i,s,d,h,p,b,m;return l(this,(function(l){switch(l.label){case 0:return e=this.resolveUrl(r),"get"!==t?[3,2]:(o=this.handleResponseData,[4,this.req.fetch({url:"".concat(e,"?").concat((y=a,Object.entries(y).map((function(e){var t=e[0],r=e[1];return"".concat(t,"=").concat(r)})).join("&"))),method:t,headers:u,stream:c,timeout:f})]);case 1:return[2,o.apply(this,[l.sent().data])];case 2:return i={"Content-Type":"application/json"},c&&Object.assign(i,{Accept:"text/event-stream"}),[4,this.req.fetch({url:e,body:JSON.stringify(a),headers:n(n((p={},p[null===(b=this.i18n)||void 0===b?void 0:b.LANG_HEADER_KEY]=null===(m=this.i18n)||void 0===m?void 0:m.lang,p),i),u),stream:c,method:t,timeout:f})];case 3:return s=l.sent(),d=s.data,h=s.header,[2,this.handleResponseData(d,h)]}var y}))}))},this._getBaseUrl=o,this.bot=new u.Bot(this.botRequest,this.aiBotBaseUrl),this.i18n=r,d.langEvent.bus.on(d.langEvent.LANG_CHANGE_EVENT,(function(e){var t;i.i18n=(null===(t=e.data)||void 0===t?void 0:t.i18n)||i.i18n}))}return Object.defineProperty(e.prototype,"aiBaseUrl",{get:function(){return"".concat(this._getBaseUrl?this._getBaseUrl():this.baseUrl,"/ai")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aiBotBaseUrl",{get:function(){return"".concat(this._getBaseUrl?this._getBaseUrl():this.baseUrl,"/aibot")},enumerable:!1,configurable:!0}),e.prototype.handleResponseData=function(e,t){var r,n;return s(this,void 0,void 0,(function(){var o,i,a,s,u=this;return l(this,(function(l){switch(l.label){case 0:return o="".concat(this.i18n.t("请检查调用方式,或前往云开发 AI+ 首页查看文档"),":https://tcb.cloud.tencent.com/dev#/ai"),i=function(e){if("object"==typeof e&&e&&"code"in e&&"NORMAL"!==e.code)throw new Error("".concat(u.i18n.t("AI+ 请求出错,错误码"),":").concat(e.code,",").concat(u.i18n.t("错误信息"),":").concat(e.message,"\n").concat(o,"\n").concat(JSON.stringify(e,null,2)))},"object"==typeof e&&e&&"function"!=typeof e.getReader?"then"in e?[4,e]:[3,2]:[3,4];case 1:return a=l.sent(),[3,3];case 2:a=e,l.label=3;case 3:return i(s=a),[2,e];case 4:return(null===(n=null===(r=null==t?void 0:t.get)||void 0===r?void 0:r.call(t,"content-type"))||void 0===n?void 0:n.includes("application/json"))?[4,(0,f.readableStream2JsonObject)(e)]:[3,6];case 5:s=l.sent(),i(s),l.label=6;case 6:return[2,e]}}))}))},e.prototype.createModel=function(e,t){var r,n=h[e];if(n)r=new n(this.modelRequest,this.aiBaseUrl);else{var o="string"==typeof(null==t?void 0:t.defaultModelSubUrl)?t.defaultModelSubUrl:"/chat/completions";r=new c.DefaultSimpleModel(this.modelRequest,this.aiBaseUrl,"".concat(e).concat(o))}return new c.ReactModel(r)},e.prototype.registerModel=function(e,t){null==h[e]?h[e]=t:console.warn("AI model ".concat(e," already exists!"))},e.prototype.createImageModel=function(e){return new c.DefaultImageModel(this.modelRequest,this.aiBaseUrl,e)},e.prototype.registerFunctionTool=function(e){c.toolMap.has(e.name)&&console.warn("AI function tool ".concat(e.name," already exists and will be overwritten!")),c.toolMap.set(e.name,e.fn)},e.prototype.resolveUrl=function(e){if(!this._getBaseUrl)return e;var t=this._getBaseUrl();return t!==this.baseUrl&&e.startsWith(this.baseUrl)?e.replace(this.baseUrl,t):e},e}();t.AI=p},737:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=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}),t.Bot=void 0;var s=r(689),l=function(){function e(e,t){this.baseUrl=t;var r=arguments[2];this.req="string"==typeof r?function(t){var o=t.headers,i=void 0===o?{}:o,s=a(t,["headers"]);return e(n(n({},s),{headers:n(n({},i),{Authorization:"Bearer ".concat(r)})}))}:e}return e.prototype.list=function(e,t){return this.req({method:"get",url:this.join("bots"),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.create=function(e,t){var r=e.botInfo;return this.req({method:"post",url:this.join("bots"),data:r,timeout:null==t?void 0:t.timeout})},e.prototype.get=function(e,t){var r=e.botId;return this.req({method:"get",url:this.join("bots/".concat(r)),timeout:null==t?void 0:t.timeout})},e.prototype.update=function(e,t){var r=e.botId,n=e.botInfo;return this.req({method:"PATCH",url:this.join("bots/".concat(r)),data:n,timeout:null==t?void 0:t.timeout})},e.prototype.delete=function(e,t){var r=e.botId;return this.req({method:"delete",url:this.join("bots/".concat(r)),timeout:null==t?void 0:t.timeout})},e.prototype.getChatRecords=function(e,t){return this.req({method:"get",url:this.join("bots/".concat(e.botId,"/records")),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.sendFeedback=function(e,t){var r=e.userFeedback;return this.req({method:"post",url:this.join("bots/".concat(r.botId,"/feedback")),data:r,timeout:null==t?void 0:t.timeout})},e.prototype.getFeedback=function(e,t){return this.req({method:"get",url:this.join("bots/".concat(e.botId,"/feedback")),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.uploadFiles=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/files")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.createConversation=function(e,t){var r=e.botId,n=a(e,["botId"]);return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.req({method:"post",url:this.join("bots/".concat(r,"/conversation")),data:n,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.getConversation=function(e,t){var r=e.pageSize,s=void 0===r?10:r,l=e.pageNumber,u=void 0===l?1:l,c=e.botId,f=a(e,["pageSize","pageNumber","botId"]);return o(this,void 0,void 0,(function(){var e,r;return i(this,(function(o){if(u<1)throw new Error("pageNumber must be greater than 0");return e=s*(u-1),r=s,[2,this.req({method:"get",url:this.join("bots/".concat(c,"/conversation")),data:n(n({},f),{offset:e,limit:r}),timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.deleteConversation=function(e,t){var r=e.botId,n=e.conversationId,s=a(e,["botId","conversationId"]);return o(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.req({method:"delete",url:this.join("bots/".concat(r,"/conversation/").concat(n)),data:s,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.speechToText=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/speech-to-text")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.textToSpeech=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/text-to-speech")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.getTextToSpeechResult=function(e,t){return o(this,void 0,void 0,(function(){return i(this,(function(r){return[2,this.req({method:"get",url:this.join("bots/".concat(e.botId,"/text-to-speech")),data:e,timeout:null==t?void 0:t.timeout})]}))}))},e.prototype.getRecommendQuestions=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/recommend-questions")),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.generateBot=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("generate-bot"),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.getPreview=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("preview"),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.generateImage=function(e,t){return this.req({method:"post",url:this.join("generate-image"),data:e,timeout:null==t?void 0:t.timeout})},e.prototype.sendMessage=function(e,t){return o(this,void 0,void 0,(function(){var r;return i(this,(function(n){switch(n.label){case 0:return[4,this.req({method:"post",url:this.join("bots/".concat(e.botId,"/send-message")),data:e,stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return r=n.sent(),[2,new u(r)]}}))}))},e.prototype.join=function(e){return"".concat(this.baseUrl,"/").concat(e)},e}();t.Bot=l;var u=function(){function e(e){var t=(0,s.toPolyfillReadable)(e);this._eventSourceStream=t.pipeThrough(new s.TextDecoderStream).pipeThrough((0,s.createEventSourceParserTransformStream)())}return Object.defineProperty(e.prototype,"teeedStream",{get:function(){var e=this._eventSourceStream.tee(),t=e[0],r=e[1];return this._eventSourceStream=r,t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"eventSourceStream",{get:function(){return(0,s.createAsyncIterable)(this.teeedStream)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataStream",{get:function(){return(0,s.createAsyncIterable)(this.eventSourceStream.pipeThrough(new s.TransformStream({transform:function(e,t){try{var r=JSON.parse(e.data);t.enqueue(r)}catch(r){"[DONE]"!==e.data?console.warn("Error when transforming event source data to json",r,e):t.terminate()}}})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textStream",{get:function(){return(0,s.createAsyncIterable)(this.dataStream.pipeThrough(new s.TransformStream({transform:function(e,t){var r;t.enqueue(null!==(r=null==e?void 0:e.content)&&void 0!==r?r:"")}})))},enumerable:!1,configurable:!0}),e}()},964:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createParser=void 0;var n=r(298);Object.defineProperty(t,"createParser",{enumerable:!0,get:function(){return n.createParser}})},298:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createParser=void 0,t.createParser=function(e){var t,n,o,i,a,s,l;return u(),{feed:function(e){n=n?n+e:e,t&&function(e){return r.every((function(t,r){return e.charCodeAt(r)===t}))}(n)&&(n=n.slice(r.length)),t=!1;for(var a=n.length,s=0,l=!1;s<a;){l&&("\n"===n[s]&&(s+=1),l=!1);for(var u=-1,f=i,d=void 0,h=o;u<0&&h<a;h++)":"===(d=n[h])&&f<0?f=h-s:"\r"===d?(l=!0,u=h-s):"\n"===d&&(u=h-s);if(u<0){o=a-s,i=f;break}o=0,i=-1,c(n,s,f,u),s+=u+1}s===a?n="":s>0&&(n=n.slice(s))},reset:u};function u(){t=!0,n="",o=0,i=-1,a=void 0,s=void 0,l=""}function c(t,r,n,o){if(0===o)return l.length>0&&(e({type:"event",id:a,event:s||void 0,data:l.slice(0,-1)}),l="",a=void 0),void(s=void 0);var i,u=n<0,c=t.slice(r,r+(u?o:n)),f=r+(i=u?o:" "===t[r+n+1]?n+2:n+1),d=o-i,h=t.slice(f,f+d).toString();if("data"===c)l+=h?"".concat(h,"\n"):"\n";else if("event"===c)s=h;else if("id"!==c||h.includes("\0")){if("retry"===c){var p=parseInt(h,10);Number.isNaN(p)||e({type:"reconnect-interval",value:p})}}else a=h}};var r=[239,187,191]},337:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t},s=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)},l=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},u=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},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}),t.utils=t.registerAi=t.models=t.createAI=t.createAi=t.Bot=t.AI=void 0;var f=r(451);Object.defineProperty(t,"AI",{enumerable:!0,get:function(){return f.AI}});var d=r(737);Object.defineProperty(t,"Bot",{enumerable:!0,get:function(){return d.Bot}});var h=a(r(305)),p=a(r(689));t.utils=p,h.MODELS;var b=c(h,["MODELS"]);t.models=b;function m(e){var t=e.env,r=e.baseUrl,o=e.getBaseUrl,i=e.req,a=e.getAccessToken,s=e.handleReqInstance,d=e.i18n;return new f.AI(function(){if(null==s){if(null==a)throw new Error("`getAccessToken` is required when `handleReqInstance` is not provided!");return function(e){var t=e.getAccessToken,r=e.req;return{download:r.download,post:r.post,upload:r.upload,fetch:function(e){return l(void 0,void 0,void 0,(function(){var o,i,a,s,l;return u(this,(function(u){switch(u.label){case 0:if("function"!=typeof r.fetch)throw new Error("req.fetch is not a function");return o=e.token,i=e.headers,a=void 0===i?{}:i,s=c(e,["token","headers"]),null==o?[3,1]:(l=o,[3,3]);case 1:return[4,t()];case 2:l=u.sent().accessToken,u.label=3;case 3:return[2,r.fetch(n({headers:n({Authorization:"Bearer ".concat(l)},a)},s))]}}))}))}}}({req:i,getAccessToken:a})}return s({req:i})}(),function(){if(null!=o)return o();if(null!=r)return r;if(null==t)throw new Error("`env` is required when `baseUrl` is not provided!");return"https://".concat(t,".api.tcloudbasegateway.com/v1")}(),d,o)}t.createAI=m;var y=m;t.createAi=y;var v={name:"ai",entity:{ai:function(e){var t=this,r=this.request;if(null==r.fetch)throw new Error("cloudbase.request.fetch() unimplemented!");var n=function(){var e=t.getEndPointWithKey("GATEWAY"),r=e.BASE_URL,n=e.PROTOCOL;return"".concat(n).concat(r)};return(null==e?void 0:e.baseUrl)?m({req:r,baseUrl:e.baseUrl,handleReqInstance:function(e){return e.req},i18n:this.config.i18n}):m({req:r,baseUrl:n(),getBaseUrl:n,handleReqInstance:function(e){return e.req},i18n:this.config.i18n})}}};function _(e){try{e.registerComponent(v)}catch(e){console.warn(e)}}t.registerAi=_,s(r(669),t);try{window.registerAi=_}catch(e){}},476:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ArkSimpleModel=void 0;var a=r(689);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="ark/api/v3/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.ArkSimpleModel=l},265:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DSSimpleModel=void 0;var a=r(689);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="dashscope/compatible-mode/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=Object.assign(e.delta,{role:"assistant"});return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),n(n({},e),r?{finish_reason:"tool_calls",delta:t}:{delta:t})})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.DSSimpleModel=l},102:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DeepSeekSimpleModel=void 0;var a=r(689),s=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="deepseek/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},e),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,s,l,u;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},e),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),s=(0,a.toPolyfillReadable)(o),l=(0,a.intoStandardStream)(s),u=l.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(u)]}}))}))},e}();t.DeepSeekSimpleModel=s},17:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultSimpleModel=void 0;var a=r(689),s=function(){function e(e,t,r){void 0===r&&(r=""),this.req=e,this.baseUrl=t,this.subUrl=r}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e){return o(this,void 0,Promise,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.req({url:this.url,data:n(n({},e),{stream:!1}),stream:!1})];case 1:return t=r.sent(),[2,n(n({},t),{rawResponse:t})]}}))}))},e.prototype.doStream=function(e){return o(this,void 0,Promise,(function(){var t,r,o,s,l;return i(this,(function(i){switch(i.label){case 0:return t=null,[4,this.req({url:this.url,data:n(n({},e),{stream:!0}),stream:!0})];case 1:return r=i.sent(),o=(0,a.toPolyfillReadable)(r),s=(0,a.intoStandardStream)(o),l=s.pipeThrough(new a.TransformStream({transform:function(e,r){var o=e.choices.map((function(e){var r=e.delta;return null==t&&(t=(0,a.isToolCallAssistantMessage)(r)),t?n(n({},e),{finish_reason:"tool_calls",delta:r}):e})),i=n(n({},e),{choices:o});r.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(l)]}}))}))},e}();t.DefaultSimpleModel=s},239:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanSimpleModel=void 0;var a=r(689),s=r(586),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return[4,this.req({url:this.url,headers:{"X-Tc-Action":"ChatCompletions"},data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=i.sent(),o=(0,s.titleCaseToSnakeCase)(r.Response),[2,n(n({},o),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,headers:{"X-Tc-Action":"ChatCompletions"},data:n(n({},e),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=(0,s.titleCaseToSnakeCase)(e),i=o.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),l=n(n({},o),{choices:i});t.enqueue(n(n({},l),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.HunYuanSimpleModel=l},586:function(e,t){"use strict";var r=this&&this.__assign||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)};Object.defineProperty(t,"__esModule",{value:!0}),t.titleCaseToSnakeCase=t.processInput=void 0,t.processInput=function(e){var t=e.messages,n=e.model,o=e.temperature,i=e.tool_choice,a=e.tools,s=e.top_p;return r(r({},e),{messages:(t.forEach((function(e){"tool_calls"in e&&e.tool_calls.filter((function(e){return"function"!==e.type})).forEach((function(t){return console.warn("`type` in tool_call is not 'function'",t,e)}))})),t),model:n,tools:function(){if(a)return a.forEach((function(e){"function"!==e.type&&console.warn("`type` in tool is not 'function'",e)})),a}(),top_p:s,tool_choice:i,temperature:o})},t.titleCaseToSnakeCase=function e(t){return"object"!=typeof t||null==t?t:Array.isArray(t)?t.map((function(t){return e(t)})):Object.entries(t).reduce((function(t,r){var n,o=r[0],i=r[1];return t["_"===(n=o.replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())}))).charAt(0)?n.slice(1):n]="object"==typeof i?e(i):i,t}),{})}},301:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanBetaSimpleModel=void 0;var a=r(689),s=r(586),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan-beta/openapi/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.HunYuanBetaSimpleModel=l},720:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanExpSimpleModel=void 0;var a=r(689),s=r(586),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan-exp/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e){return o(this,void 0,Promise,(function(){var t;return i(this,(function(r){switch(r.label){case 0:return[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1})];case 1:return t=r.sent(),[2,n(n({},t),{rawResponse:t})]}}))}))},e.prototype.doStream=function(e){return o(this,void 0,Promise,(function(){var t,r,o,l,u;return i(this,(function(i){switch(i.label){case 0:return t=null,[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!0}),stream:!0})];case 1:return r=i.sent(),o=(0,a.toPolyfillReadable)(r),l=(0,a.intoStandardStream)(o),u=l.pipeThrough(new a.TransformStream({transform:function(e,r){var o=e.choices.map((function(e){var r=e.delta;return null==t&&(t=(0,a.isToolCallAssistantMessage)(r)),t?n(n({},e),{finish_reason:"tool_calls",delta:r}):e})),i=n(n({},e),{choices:o});r.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(u)]}}))}))},e}();t.HunYuanExpSimpleModel=l},418:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.HunYuanOpenSimpleModel=void 0;var a=r(689),s=r(586),l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="hunyuan-open/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},(0,s.processInput)(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.HunYuanOpenSimpleModel=l},925:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.MoonshotSimpleModel=void 0;var a=r(689);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="moonshot/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o=e.choices.map((function(e){var t=e.delta;return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),r?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:o});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.MoonshotSimpleModel=l},532:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.YiSimpleModel=void 0;var a=r(689);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tools,a=e.top_p;return n(n({},e),{messages:t,model:r,tools:i,top_p:a,temperature:o})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="01-ai/v1/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r;return i(this,(function(o){switch(o.label){case 0:return[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return r=o.sent(),[2,n(n({},r),{rawResponse:r})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c;return i(this,(function(i){switch(i.label){case 0:return r=null,[4,this.req({url:this.url,data:n(n({},s(e)),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),l=(0,a.toPolyfillReadable)(o),u=(0,a.intoStandardStream)(l),c=u.pipeThrough(new a.TransformStream({transform:function(e,t){var o,i,s,l,u,c;if((null===(s=null===(i=null===(o=null==e?void 0:e.choices)||void 0===o?void 0:o[0])||void 0===i?void 0:i.delta)||void 0===s?void 0:s.content)||(null===(c=null===(u=null===(l=null==e?void 0:e.choices)||void 0===l?void 0:l[0])||void 0===u?void 0:u.delta)||void 0===c?void 0:c.tool_calls)){var f=e.choices.map((function(e){var t=Object.assign(e.delta,{role:"assistant"});return null==r&&(r=(0,a.isToolCallAssistantMessage)(t)),n(n({},e),r?{finish_reason:"tool_calls",delta:t}:{delta:t})})),d=n(n({},e),{choices:f});t.enqueue(n(n({},d),{rawResponse:e}))}}})),[2,(0,a.createAsyncIterable)(c)]}}))}))},e}();t.YiSimpleModel=l},173:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ZhiPuSimpleModel=void 0;var a=r(689);function s(e){var t=e.messages,r=e.model,o=e.temperature,i=e.tool_choice,a=e.tools,s=e.top_p;return n(n({},e),{messages:t,model:r,temperature:o,tool_choice:(i&&"auto"!==i&&console.warn("`tool_choice` is not 'auto'"),i),tools:a,top_p:s})}var l=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.subUrl="zhipu/api/paas/v4/chat/completions",null!=r&&(this.subUrl=r)}return Object.defineProperty(e.prototype,"url",{get:function(){return"".concat(this.baseUrl,"/").concat(this.subUrl)},enumerable:!1,configurable:!0}),e.prototype.doGenerate=function(e,t){return o(this,void 0,Promise,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return r=s(e),[4,this.req({url:this.url,data:n(n({},r),{stream:!1}),stream:!1,timeout:null==t?void 0:t.timeout})];case 1:return o=i.sent(),[2,n(n({},o),{rawResponse:o})]}}))}))},e.prototype.doStream=function(e,t){return o(this,void 0,Promise,(function(){var r,o,l,u,c,f;return i(this,(function(i){switch(i.label){case 0:return r=s(e),o=null,[4,this.req({url:this.url,data:n(n({},r),{stream:!0}),stream:!0,timeout:null==t?void 0:t.timeout})];case 1:return l=i.sent(),u=(0,a.toPolyfillReadable)(l),c=(0,a.intoStandardStream)(u),f=c.pipeThrough(new a.TransformStream({transform:function(e,t){var r=e.choices.map((function(e){var t=e.delta;return null==o&&(o=(0,a.isToolCallAssistantMessage)(t)),o?n(n({},e),{finish_reason:"tool_calls",delta:t}):e})),i=n(n({},e),{choices:r});t.enqueue(n(n({},i),{rawResponse:e}))}})),[2,(0,a.createAsyncIterable)(f)]}}))}))},e}();t.ZhiPuSimpleModel=l},328:function(e,t){"use strict";var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},n=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultImageModel=void 0;var o=function(){function e(e,t,r){this.req=e,this.baseUrl=t,this.provider=r,this.defaultGenerateImageSubUrl="images/ar/generations",this.generateImageSubUrlConfig={"hunyuan-image":[[/^hunyuan-image(-v[12](\..*)?)?$/,"images/generations"]]},this.generateImage=this.generateImageImpl.bind(this)}return e.prototype.generateImageImpl=function(e){return r(this,void 0,Promise,(function(){var t,r;return n(this,(function(n){switch(n.label){case 0:return t=this.defaultGenerateImageSubUrl,"object"==typeof e&&e&&"model"in e&&"string"==typeof e.model&&(r=this.getGenerateImageSubUrl(this.provider,e.model))&&(t=r),[4,this.req({url:this.getGenerateUrl(t),data:e,stream:!1})];case 1:return[2,n.sent()]}}))}))},e.prototype.getGenerateUrl=function(e){return"".concat(this.baseUrl,"/").concat(this.provider,"/").concat(e)},e.prototype.getGenerateImageSubUrl=function(e,t){var r=this.generateImageSubUrlConfig[e];if(r)for(var n=0,o=r;n<o.length;n++){var i=o[n],a=i[0],s=i[1];if(a.test(t))return s}},e}();t.DefaultImageModel=o},305:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toolMap=t.ReactModel=t.DefaultImageModel=t.DefaultSimpleModel=t.HunYuanOpenSimpleModel=t.HunYuanExpSimpleModel=t.MoonshotSimpleModel=t.YiSimpleModel=t.DSSimpleModel=t.ArkSimpleModel=t.HunYuanSimpleModel=t.HunYuanBetaSimpleModel=t.ZhiPuSimpleModel=t.MODELS=void 0;var n=r(173);Object.defineProperty(t,"ZhiPuSimpleModel",{enumerable:!0,get:function(){return n.ZhiPuSimpleModel}});var o=r(301);Object.defineProperty(t,"HunYuanBetaSimpleModel",{enumerable:!0,get:function(){return o.HunYuanBetaSimpleModel}});var i=r(239);Object.defineProperty(t,"HunYuanSimpleModel",{enumerable:!0,get:function(){return i.HunYuanSimpleModel}});var a=r(476);Object.defineProperty(t,"ArkSimpleModel",{enumerable:!0,get:function(){return a.ArkSimpleModel}});var s=r(265);Object.defineProperty(t,"DSSimpleModel",{enumerable:!0,get:function(){return s.DSSimpleModel}});var l=r(532);Object.defineProperty(t,"YiSimpleModel",{enumerable:!0,get:function(){return l.YiSimpleModel}});var u=r(925);Object.defineProperty(t,"MoonshotSimpleModel",{enumerable:!0,get:function(){return u.MoonshotSimpleModel}});var c=r(720);Object.defineProperty(t,"HunYuanExpSimpleModel",{enumerable:!0,get:function(){return c.HunYuanExpSimpleModel}});var f=r(418);Object.defineProperty(t,"HunYuanOpenSimpleModel",{enumerable:!0,get:function(){return f.HunYuanOpenSimpleModel}});var d=r(102),h=r(17);Object.defineProperty(t,"DefaultSimpleModel",{enumerable:!0,get:function(){return h.DefaultSimpleModel}});var p=r(328);Object.defineProperty(t,"DefaultImageModel",{enumerable:!0,get:function(){return p.DefaultImageModel}}),t.MODELS={hunyuan:i.HunYuanSimpleModel,"hunyuan-beta":o.HunYuanBetaSimpleModel,ark:a.ArkSimpleModel,dashscope:s.DSSimpleModel,"01-ai":l.YiSimpleModel,moonshot:u.MoonshotSimpleModel,zhipu:n.ZhiPuSimpleModel,"hunyuan-exp":c.HunYuanExpSimpleModel,"hunyuan-open":f.HunYuanOpenSimpleModel,deepseek:d.DeepSeekSimpleModel};var b=r(443);Object.defineProperty(t,"ReactModel",{enumerable:!0,get:function(){return b.ReactModel}}),Object.defineProperty(t,"toolMap",{enumerable:!0,get:function(){return b.toolMap}})},443:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},i=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},a=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},s=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,o,(t=e[r](t)).done,t.value)}))}}},l=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))};Object.defineProperty(t,"__esModule",{value:!0}),t.toolMap=t.ReactModel=void 0;var u=r(689);function c(e){var t,r=e.onStepFinish,o=e.abortSignal,i=e.maxSteps,s=e.topP,l=e.toolChoice,c=a(e,["onStepFinish","abortSignal","maxSteps","topP","toolChoice"]);if(null!=i&&i<1)throw new Error("`maxSteps` muse be greater than 0.");return[{onStepFinish:r,abortSignal:o,maxSteps:i},n(n({},c),{tools:null===(t=c.tools)||void 0===t?void 0:t.map((function(e){return"fn"in e?(0,u.functionToolToModelTool)(e):e})),top_p:null!=s?s:c.top_p,tool_choice:null!=l?l:c.tool_choice})]}var f=function(){function e(e){this.model=e}return e.prototype.generateText=function(e,t){var r,n;return o(this,void 0,Promise,(function(){var o,a,s,u,f,y,v,_,g,w,S,P,O,R,T,j,E,k,C,q,I,A=this;return i(this,(function(i){switch(i.label){case 0:return o=[],a={completion_tokens:0,prompt_tokens:0,total_tokens:0},s=c(e),u=s[0],f=u.onStepFinish,y=u.maxSteps,v=void 0===y?10:y,_=s[1],[4,(g=function(){return A.model.doGenerate(_,t)})()];case 1:w=i.sent(),S=1,w.rawResponse&&o.push(w.rawResponse),P=null,i.label=2;case 2:if(!(S<v&&null!=(P=d(w))))return[3,9];O=b(w.usage),m(a,O),i.label=3;case 3:return i.trys.push([3,7,,8]),[4,p(P)];case 4:return R=i.sent(),T=w.choices[0],[4,null==f?void 0:f({finishReason:T.finish_reason,messages:_.messages.slice(),text:T.message.content,toolCall:P,toolResult:R,stepUsage:O,totalUsage:Object.assign({},a)})];case 5:return i.sent(),h(_.messages,T.message,R),[4,g()];case 6:return(w=i.sent()).rawResponse&&o.push(w.rawResponse),S+=1,[3,8];case 7:return j=i.sent(),[2,{text:"",messages:_.messages,usage:a,error:j,rawResponses:o}];case 8:return[3,2];case 9:return E=null===(r=null==w?void 0:w.choices)||void 0===r?void 0:r[0],k=null==E?void 0:E.message,C=null!==(n=null==k?void 0:k.content)&&void 0!==n?n:"",q=k?l(l([],_.messages,!0),[k],!1):_.messages,I=b(w.usage),m(a,I),[4,null==f?void 0:f({finishReason:E.finish_reason,messages:q.slice(),text:C,toolCall:d(w),toolResult:null,stepUsage:I,totalUsage:Object.assign({},a)})];case 10:return i.sent(),[2,{text:C,messages:q,usage:a,rawResponses:o}]}}))}))},e.prototype.streamText=function(e,t){var r;return o(this,void 0,Promise,(function(){var n,a,f,d,b,y,v,_,g,w,S,P,O,R,T,j,E,k,C,q,I,A,x,M,U,W,B,L,D,N,z,F,$,G,Y,H,V=this;return i(this,(function(Q){switch(Q.label){case 0:return n={completion_tokens:0,prompt_tokens:0,total_tokens:0},a=c(e),f=a[0],d=f.onStepFinish,b=f.maxSteps,y=void 0===b?10:b,v=a[1],[4,(_=function(){return V.model.doStream(v,t)})()];case 1:g=Q.sent(),w=1,S=null,P=function(){var e=g.tee(),t=e[0],r=e[1];return g=(0,u.createAsyncIterable)(t),function(e){var t,r,n,a,l,c,f,d,h,p;return o(this,void 0,Promise,(function(){var o,b,m,y,v,_,g,w,S,P,O,R,T;return i(this,(function(i){switch(i.label){case 0:o={completion_tokens:0,prompt_tokens:0,total_tokens:0},b=(0,u.createAsyncIterable)(e),y={role:"assistant",content:"",tool_calls:[m={id:"",function:{name:"",arguments:""},type:""}]},i.label=1;case 1:i.trys.push([1,6,7,12]),v=!0,_=s(b),i.label=2;case 2:return[4,_.next()];case 3:if(g=i.sent(),t=g.done)return[3,5];a=g.value,v=!1;try{if(!(S=null==(w=a)?void 0:w.choices[0]))return[2,null];if(P=S.finish_reason,O=S.delta,"tool_calls"!==P)return[2,null];if(!O)return[3,4];if(O.content&&(y.content+=O.content),!("tool_calls"in O))return[3,4];(null==(R=null===(l=null==O?void 0:O.tool_calls)||void 0===l?void 0:l[0])?void 0:R.id)&&(m.id=R.id),(null==R?void 0:R.type)&&(m.type=R.type),(null===(c=null==R?void 0:R.function)||void 0===c?void 0:c.name)&&(m.function.name=R.function.name),(null===(f=null==R?void 0:R.function)||void 0===f?void 0:f.arguments)&&(m.function.arguments+=R.function.arguments),(null===(d=null==w?void 0:w.usage)||void 0===d?void 0:d.completion_tokens)&&(o.completion_tokens=w.usage.completion_tokens),(null===(h=null==w?void 0:w.usage)||void 0===h?void 0:h.prompt_tokens)&&(o.prompt_tokens=w.usage.prompt_tokens),(null===(p=null==w?void 0:w.usage)||void 0===p?void 0:p.total_tokens)&&(o.total_tokens=w.usage.total_tokens)}finally{v=!0}i.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return T=i.sent(),r={error:T},[3,12];case 7:return i.trys.push([7,,10,11]),v||t||!(n=_.return)?[3,9]:[4,n.call(_)];case 8:i.sent(),i.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:return[2,{message:y,usage:o}]}}))}))}(r)},Q.label=2;case 2:return(O=w<y)?[4,P()]:[3,4];case 3:O=null!=(S=Q.sent()),Q.label=4;case 4:if(!O)return[3,11];R=S.message,T=S.usage,m(n,T),j=null===(r=R.tool_calls)||void 0===r?void 0:r[0],Q.label=5;case 5:return Q.trys.push([5,9,,10]),[4,p(j)];case 6:return E=Q.sent(),[4,null==d?void 0:d({finishReason:"tool_calls",messages:v.messages.slice(),text:R.content,toolCall:j,toolResult:E,stepUsage:T,totalUsage:Object.assign({},n)})];case 7:return Q.sent(),h(v.messages,R,E),[4,_()];case 8:return g=Q.sent(),[3,10];case 9:return k=Q.sent(),C=g.tee(),q=C[0],I=C[1],[2,{messages:Promise.resolve(v.messages),dataStream:(0,u.createAsyncIterable)(q),textStream:(0,u.createAsyncIterable)(I.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof i&&t.enqueue(i)}}))),usage:Promise.resolve(n),error:k}];case 10:return[3,2];case 11:return[4,P()];case 12:return(S=Q.sent())?(A=S.message,x=S.usage,m(n,x),M=l(l([],v.messages,!0),[A],!1),d({messages:M.slice(),finishReason:"tool_call",stepUsage:x,text:A.content,toolCall:A.tool_calls[0],totalUsage:Object.assign({},n)}),U=g.tee(),W=U[0],B=U[1],[2,{messages:Promise.resolve(l(l([],v.messages,!0),[A],!1)),dataStream:(0,u.createAsyncIterable)(W),textStream:(0,u.createAsyncIterable)(B.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof i&&t.enqueue(i)}}))),usage:Promise.resolve(n)}]):(L=(0,u.createPromise)(),D=(0,u.createPromise)(),N={role:"assistant",content:""},z="",F={completion_tokens:0,prompt_tokens:0,total_tokens:0},$=g.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i,a,s,l,u,c=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof c&&(N.content+=c);var f=null===(a=null===(i=null==e?void 0:e.choices)||void 0===i?void 0:i[0])||void 0===a?void 0:a.finish_reason;f&&(z=f),(null===(s=null==e?void 0:e.usage)||void 0===s?void 0:s.completion_tokens)&&(F.completion_tokens=e.usage.completion_tokens),(null===(l=null==e?void 0:e.usage)||void 0===l?void 0:l.prompt_tokens)&&(F.prompt_tokens=e.usage.prompt_tokens),(null===(u=null==e?void 0:e.usage)||void 0===u?void 0:u.total_tokens)&&(F.total_tokens=e.usage.total_tokens),t.enqueue(e)},flush:function(){L.res(l(l([],v.messages,!0),[N],!1)),m(n,F),D.res(Object.assign({},n)),null==d||d({messages:l(l([],v.messages,!0),[N],!1),finishReason:z,text:N.content,stepUsage:F,totalUsage:Object.assign({},n)})}})),G=$.tee(),Y=G[0],H=G[1],[2,{messages:L.promise,dataStream:(0,u.createAsyncIterable)(Y),textStream:(0,u.createAsyncIterable)(H.pipeThrough(new u.TransformStream({transform:function(e,t){var r,n,o,i=null===(o=null===(n=null===(r=null==e?void 0:e.choices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.delta)||void 0===o?void 0:o.content;"string"==typeof i&&t.enqueue(i)}}))),usage:D.promise}])}}))}))},e}();function d(e){var t,r=null===(t=null==e?void 0:e.choices)||void 0===t?void 0:t[0];if(!r)return null;var n=r.finish_reason,o=r.message;return"tool_calls"!==n?null:o&&(0,u.isToolCallAssistantMessage)(o)?o.tool_calls[0]:null}function h(e,t,r){e.push(t,{role:"tool",tool_call_id:t.tool_calls[0].id,content:JSON.stringify(r)})}function p(e){return t.toolMap.get(e.function.name)(JSON.parse(e.function.arguments))}function b(e){var t,r,n;return{completion_tokens:null!==(t=null==e?void 0:e.completion_tokens)&&void 0!==t?t:0,prompt_tokens:null!==(r=null==e?void 0:e.prompt_tokens)&&void 0!==r?r:0,total_tokens:null!==(n=null==e?void 0:e.total_tokens)&&void 0!==n?n:0}}function m(e,t){e.completion_tokens+=t.completion_tokens,e.prompt_tokens+=t.prompt_tokens,e.total_tokens+=t.total_tokens}t.ReactModel=f,t.toolMap=new Map},669:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleChatModel=void 0;t.SimpleChatModel=function(){}},689:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},i=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,o){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,o,(t=e[r](t)).done,t.value)}))}}};Object.defineProperty(t,"__esModule",{value:!0}),t.functionToolToModelTool=t.isToolCallAssistantMessage=t.createPromise=t.readableStream2JsonObject=t.intoTextStream=t.intoStandardStream=t.createAsyncIterable=t.TextDecoderStream=t.toPolyfillReadable=t.createEventSourceParserTransformStream=t.TransformStream=t.ReadableStream=void 0;var a=r(993),s=r(308),l=r(964),u=r(410);t.ReadableStream=a.ReadableStream,t.TransformStream=a.TransformStream,t.createEventSourceParserTransformStream=function(){var e;return new t.TransformStream({start:function(t){e=(0,l.createParser)((function(e){"event"===e.type&&t.enqueue(e)}))},transform:function(t){e.feed(t)}})},t.toPolyfillReadable=(0,s.createReadableStreamWrapper)(t.ReadableStream);var c=function(){function e(e,r){void 0===e&&(e="utf-8"),void 0===r&&(r={});var n=this;this.transform=new t.TransformStream({transform:function(e,t){var r=n.handle.decode(new Uint8Array(e),{stream:!0});r&&t.enqueue(r)},flush:function(e){var t=n.handle.decode();t&&e.enqueue(t),e.terminate()}}),this.handle=new u.TextDecoder(e,r)}return Object.defineProperty(e.prototype,"encoding",{get:function(){return this.handle.encoding},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fatal",{get:function(){return this.handle.fatal},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ignoreBOM",{get:function(){return this.handle.ignoreBOM},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"readable",{get:function(){return this.transform.readable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"writable",{get:function(){return this.transform.writable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"TextDecoderStream"},enumerable:!1,configurable:!0}),e}();function f(e){var t=e;return t[Symbol.asyncIterator]=function(){var t=e.getReader();return{next:function(){return n(this,void 0,Promise,(function(){var e,r,n;return o(this,(function(o){switch(o.label){case 0:return[4,t.read()];case 1:return e=o.sent(),r=e.done,n=e.value,[2,r?{done:!0,value:void 0}:{done:!1,value:n}]}}))}))}}},t}function d(e){return f((0,t.toPolyfillReadable)(e).pipeThrough(new c))}t.TextDecoderStream=c,t.createAsyncIterable=f,t.intoStandardStream=function(e){return f(e.pipeThrough(new c).pipeThrough((0,t.createEventSourceParserTransformStream)()).pipeThrough(new t.TransformStream({transform:function(e,t){try{var r=JSON.parse(e.data);t.enqueue(r)}catch(r){"[DONE]"!==e.data?console.warn("Error when transforming event source data to json",r,e):t.terminate()}}})))},t.intoTextStream=d,t.readableStream2JsonObject=function(e){var t,r,a,s;return n(this,void 0,void 0,(function(){var n,l,u,c,f,h;return o(this,(function(o){switch(o.label){case 0:n=d(e),l="",o.label=1;case 1:o.trys.push([1,6,7,12]),u=!0,c=i(n),o.label=2;case 2:return[4,c.next()];case 3:if(f=o.sent(),t=f.done)return[3,5];s=f.value,u=!1;try{l+=s}finally{u=!0}o.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return h=o.sent(),r={error:h},[3,12];case 7:return o.trys.push([7,,10,11]),u||t||!(a=c.return)?[3,9]:[4,a.call(c)];case 8:o.sent(),o.label=9;case 9:return[3,11];case 10:if(r)throw r.error;return[7];case 11:return[7];case 12:return[2,JSON.parse(l)]}}))}))},t.createPromise=function(){var e,t;return{promise:new Promise((function(r,n){e=r,t=n})),res:e,rej:t}},t.isToolCallAssistantMessage=function(e){var t;return"assistant"===e.role&&"tool_calls"in e&&null!=(null===(t=e.tool_calls)||void 0===t?void 0:t[0])},t.functionToolToModelTool=function(e){return{type:"function",function:{description:e.description,name:e.name,parameters:e.parameters}}}},756:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(337),t)},563:function(e,t,r){"use strict";var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&o(t,e,r);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.useDefaultAdapter=t.useAdapters=t.RUNTIME=void 0;var s,l=a(r(92)),u=r(962);!function(e){e.WEB="web",e.WX_MP="wx_mp"}(s=t.RUNTIME||(t.RUNTIME={})),t.useAdapters=function(e,t){for(var r=0,o=(0,u.isArray)(e)?e:[e];r<o.length;r++){var i=o[r],a=i.isMatch,s=i.genAdapter,l=i.runtime;if(a())return{adapter:n({isMatch:a},s(t)),runtime:l}}},t.useDefaultAdapter=function(){return{adapter:n({},l.genAdapter()),runtime:s.WEB}}},92:function(e,t,r){"use strict";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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");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},i.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},s=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WebRequest=t.genAdapter=void 0;var l=r(829),u=r(962),c=r(464),f=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 o(t,e),t.prototype.get=function(e){return this.request(i(i({},e),{method:"get"}),this.restrictedMethods.includes("get"))},t.prototype.post=function(e){return this.request(i(i({},e),{method:"post"}),this.restrictedMethods.includes("post"))},t.prototype.put=function(e){return this.request(i(i({},e),{method:"put"}))},t.prototype.upload=function(e){var t=e.data,r=e.file,n=e.name,o=e.method,a=e.headers,s=void 0===a?{}:a,l={post:"post",put:"put"}[null==o?void 0:o.toLowerCase()]||"put",u=new FormData;return"post"===l?(Object.keys(t).forEach((function(e){u.append(e,t[e])})),u.append("key",n),u.append("file",r),this.request(i(i({},e),{data:u,method:l}),this.restrictedMethods.includes("upload"))):this.request(i(i({},e),{method:"put",headers:s,body:r}),this.restrictedMethods.includes("upload"))},t.prototype.download=function(e){return a(this,void 0,Promise,(function(){var t,r,n,o;return s(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.get(i(i({},e),{headers:{},responseType:"blob"}))];case 1:return t=a.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 a.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 a(this,void 0,Promise,(function(){var r,n,o,l,u,c,f,d,h,p,b,m,y,v=this;return s(this,(function(_){switch(_.label){case 0:return r=new AbortController,n=e.url,o=e.enableAbort,l=void 0!==o&&o,u=e.stream,c=void 0!==u&&u,f=e.signal,d=e.timeout,h=e.shouldThrowOnError,p=void 0===h||h,b=null!=d?d:this.timeout,f&&(f.aborted&&r.abort(),f.addEventListener("abort",(function(){return r.abort()}))),m=null,l&&b&&(m=setTimeout((function(){console.warn(v.timeoutMsg),r.abort(new Error(v.timeoutMsg))}),b)),[4,fetch(n,i(i({},e),{signal:r.signal})).then((function(e){return a(v,void 0,void 0,(function(){var t,r,n;return s(this,(function(o){switch(o.label){case 0:return clearTimeout(m),p?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){return clearTimeout(m),Promise.reject(e)}))];case 1:return y=_.sent(),[2,{data:c?y.body:(null===(t=y.headers.get("content-type"))||void 0===t?void 0:t.includes("application/json"))?y.json():y.text(),statusCode:y.status,header:y.headers,response:y}]}}))}))},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=e.url,a=e.headers,s=void 0===a?{}:a,l=e.data,f=e.responseType,d=e.withCredentials,h=e.body,p=e.onUploadProgress,b=(0,u.formatUrl)((0,c.getProtocol)(),i,"get"===n?l:{}),m=new XMLHttpRequest;m.open(n,b),f&&(m.responseType=f);var y,v,_=e.signal;_&&(_.aborted?m.abort():_.addEventListener("abort",(function(){return m.abort()}),{once:!0})),Object.keys(s).forEach((function(e){m.setRequestHeader(e,s[e])})),p&&m.upload.addEventListener("progress",p),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"===f?m.response:JSON.parse(m.responseText)}catch(t){e.data="blob"===f?m.response:m.responseText}clearTimeout(y),o(e)}},t&&r.timeout&&(y=setTimeout((function(){console.warn(r.timeoutMsg),m.abort()}),r.timeout)),v=(0,u.isFormData)(l)?l:"application/x-www-form-urlencoded"===s["content-type"]?(0,u.toQueryString)(l):h||(l?JSON.stringify(l):void 0),d&&(m.withCredentials=!0),m.send(v)}))},t}(l.AbstractSDKRequest);t.WebRequest=f,t.genAdapter=function(){return{type:"default",root:window,reqClass:f,wsClass:WebSocket,localStorage}}},464:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var r="@cloudbase/js-sdk";t.setSdkName=function(e){r=e},t.getSdkName=function(){return r};var n="https:";t.setProtocol=function(e){n=e},t.getProtocol=function(){return n},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},519:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},778:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(r(464),t),o(r(519),t),t.OATUH_LOGINTYPE="constants"},517:function(e,t,r){"use strict";var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},o=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.catchErrorsDecorator=void 0;var i=r(962),a=r(778),s=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(s=-1!==navigator.userAgent.indexOf("Firefox"));var l=s?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,u=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function c(e){var t=e.err,r=e.className,n=e.methodName,o=e.sourceLink;if(!o)return null;var i,a=t.stack.split("\n"),l=s?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),c=s?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),f=a.findIndex((function(e){return l.test(e)}));if(-1!==f){var d=a.filter((function(e,t){return t>f}));d.unshift(a[f].replace(c,"".concat(r,".").concat(n)).replace(u,o)),(i=new Error).stack="".concat(s?"@debugger":"Error","\n").concat(d.join("\n"))}return i}t.catchErrorsDecorator=function(e){var t=e.mode,r=void 0===t?"async":t,s=e.customInfo,f=void 0===s?{}:s,d=e.title,h=e.messages,p=void 0===h?[]:h;return function(e,t,s){if(a.IS_DEBUG_MODE){var h=f.className||e.constructor.name,b=f.methodName||t,m=s.value,y=function(){var e="",t=(new Error).stack.split("\n"),r=t.findIndex((function(e){return l.test(e)}));if(-1!==r){var n=u.exec(t[r+1]||"");e=n?n[0]:""}return e}();s.value="sync"===r?function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=c({err:new Error,className:h,methodName:b,sourceLink:y});try{return m.apply(this,e)}catch(e){var n=e,o=e.message,a=e.error,s=e.error_description,l={title:d||"".concat(h,".").concat(b," failed"),content:[{type:"error",body:e}]};if(o&&/^\{.*\}$/.test(o)){var u=JSON.parse(o);l.subtitle=o,u.code&&(r?(r.code=u.code,r.msg=u.msg):(e.code=u.code,e.message=u.msg),n=r||e,l.content=p.map((function(e){return{type:"info",body:e}})))}throw a&&s&&(l.subtitle=s,r?(r.code=a,r.msg=s):(e.code=a,e.message=s),n=r||e,l.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(l),n}}:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(this,void 0,void 0,(function(){var t,r,n,a,s,l,u,f;return o(this,(function(o){switch(o.label){case 0:t=c({err:new Error,className:h,methodName:b,sourceLink:y}),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,m.apply(this,e)];case 2:return[2,o.sent()];case 3:throw r=o.sent(),n=r,a=r.message,s=r.error,l=r.error_description,u={title:d||"".concat(h,".").concat(b," failed"),content:[{type:"error",body:r}]},a&&/^\{.*\}$/.test(a)&&(f=JSON.parse(a),u.subtitle=f,f.code&&(t?(t.code=f.code,t.message=f.msg):(r.code=f.code,r.message=f.msg),n=t||r,u.content=p.map((function(e){return{type:"info",body:e}})))),s&&l&&(u.subtitle=l,t?(t.code=s,t.msg=l):(r.code=s,r.message=l),n=t||r,u.content=p.map((function(e){return{type:"info",body:e}}))),(0,i.printGroupLog)(u),n;case 4:return[2]}}))}))}}}}},260:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(517),t)},877:function(e,t,r){"use strict";var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return o(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.langEvent=t.AbortController=t.jwt=t.helpers=t.utils=t.events=t.cache=t.adapters=t.constants=void 0;var s=i(r(778));t.constants=s;var l=i(r(563));t.adapters=l;var u=i(r(865));t.cache=u;var c=i(r(940));t.events=c;var f=i(r(991));t.langEvent=f;var d=i(r(962));t.utils=d;var h=i(r(260));t.helpers=h;var p=a(r(644));t.AbortController=p.default;var b={decode:a(r(949)).default};t.jwt=b},644:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){var e=this;this.listeners=[],this.signal={aborted:!1,addEventListener:function(t,r){"abort"===t&&e.listeners.push(r)}}}return e.prototype.abort=function(){this.signal.aborted||(this.signal.aborted=!0,this.listeners.forEach((function(e){return e()})))},e}();t.default=r},865:function(e,t,r){"use strict";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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{l(n.next(e))}catch(e){i(e)}}function s(e){try{l(n.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((n=n.apply(e,t||[])).next())}))},a=this&&this.__generator||function(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(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CloudbaseCache=void 0;var s=r(829),l=r(962),u=r(778),c=function(e){function t(t){var r=e.call(this)||this;return r.root=t,t.tcbCacheObject||(t.tcbCacheObject={}),r}return o(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}(s.AbstractStorage),f=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:((0,l.printWarn)(u.ERRORS.INVALID_PARAMS,"localStorage is not supported on current platform"),new c(t.root));case"none":return new c(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:u.ERRORS.OPERATION_FAIL,msg:"[".concat((0,u.getSdkName)(),"][").concat(u.ERRORS.OPERATION_FAIL,"]setStore failed"),info:e}))}}else(0,l.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},e.prototype.setStoreAsync=function(e,t,r){return i(this,void 0,void 0,(function(){var n;return a(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={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return{IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0}.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:""}(0,l.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},e.prototype.getStoreAsync=function(e,t){var r;return i(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:try{if("undefined"!=typeof process&&(null===(r={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===r?void 0:r.tcb_token))return[2,{IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0}.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):(0,l.printWarn)(u.ERRORS.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},e.prototype.removeStoreAsync=function(e){return i(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.storage.removeItem(e)];case 1:return t.sent(),[2]}}))}))},e}();t.CloudbaseCache=f},940:function(e,t,r){"use strict";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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=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))};Object.defineProperty(t,"__esModule",{value:!0}),t.removeEventListener=t.activateEvent=t.addEventListener=t.CloudbaseEventEmitter=t.IErrorEvent=t.CloudbaseEvent=void 0;var a=r(962),s=function(e,t){this.data=t||null,this.name=e};t.CloudbaseEvent=s;var l=function(e){function t(t,r){var n=e.call(this,"error",{error:t,data:r})||this;return n.error=t,n}return o(t,e),t}(s);t.IErrorEvent=l;var u=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((0,a.isInstanceOf)(e,l))return console.error(e.error),this;var r=(0,a.isString)(e)?new s(e,t||{}):e,n=r.name;if(this.listens(n)){r.target=this;for(var o=0,u=this.listeners[n]?i([],this.listeners[n],!0):[];o<u.length;o++)u[o].call(this,r)}return this},e.prototype.listens=function(e){return this.listeners[e]&&this.listeners[e].length>0},e}();t.CloudbaseEventEmitter=u;var c=new u;t.addEventListener=function(e,t){c.on(e,t)},t.activateEvent=function(e,t){void 0===t&&(t={}),c.fire(e,t)},t.removeEventListener=function(e,t){c.off(e,t)}},991:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LANG_CHANGE_EVENT=t.bus=void 0;var n=r(940);t.bus=new n.CloudbaseEventEmitter,t.LANG_CHANGE_EVENT="lang_change"},962:function(e,t,r){"use strict";var n=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}),t.parseCaptcha=t.parseQueryString=t.transformPhone=t.sleep=t.printGroupLog=t.throwError=t.printInfo=t.printError=t.printWarn=t.execCallback=t.createPromiseCallback=t.removeParam=t.getHash=t.getQuery=t.toQueryString=t.formatUrl=t.generateRequestId=t.genSeqId=t.isFormData=t.isInstanceOf=t.isNull=t.isPalinObject=t.isUndefined=t.isString=t.isArray=void 0;var o=r(778);t.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},t.isString=function(e){return"string"==typeof e},t.isUndefined=function(e){return void 0===e},t.isPalinObject=function(e){return"[object Object]"===Object.prototype.toString.call(e)},t.isNull=function(e){return"[object Null]"===Object.prototype.toString.call(e)},t.isInstanceOf=function(e,t){return e instanceof t},t.isFormData=function(e){return"[object FormData]"===Object.prototype.toString.call(e)},t.genSeqId=function(){return Math.random().toString(16).slice(2)},t.generateRequestId=function(){var e=(new Date).getTime(),t=(null===Date||void 0===Date?void 0:Date.now)&&1e3*Date.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var n=16*Math.random();return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),("x"===r?n:7&n|8).toString(16)}))},t.formatUrl=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)},t.toQueryString=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("&")},t.getQuery=function(e,t){if("undefined"==typeof window)return!1;var r=t||decodeURIComponent(window.location.search),n=new RegExp("(^|&)".concat(e,"=([^&]*)(&|$)")),o=r.substr(r.indexOf("?")+1).match(n);return null!=o?o[2]:""},t.getHash=function(e){if("undefined"==typeof window)return"";var t=window.location.hash.match(new RegExp("[#?&/]".concat(e,"=([^&#]*)")));return t?t[1]:""},t.removeParam=function(e,t){var r=t.split("?")[0],n=[],o=-1!==t.indexOf("?")?t.split("?")[1]:"";if(""!==o){for(var i=(n=o.split("&")).length-1;i>=0;i-=1)n[i].split("=")[0]===e&&n.splice(i,1);r="".concat(r,"?").concat(n.join("&"))}return r},t.createPromiseCallback=function(){var e={};if(!Promise){(e=function(){}).promise={};var t=function(){throw new Error('Your Node runtime does support ES6 Promises. Set "global.Promise" to your preferred implementation of promises.')};return Object.defineProperty(e.promise,"then",{get:t}),Object.defineProperty(e.promise,"catch",{get:t}),e}var r=new Promise((function(t,r){e=function(e,n){return e?r(e):t(n)}}));return e.promise=r,e},t.execCallback=function(e,t,r){if(void 0===r&&(r=null),e&&"function"==typeof e)return e(t,r);if(t)throw t;return r},t.printWarn=function(e,t){console.warn("[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t))},t.printError=function(e,t){console.error({code:e,msg:"[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t)})},t.printInfo=function(e,t){console.log("[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t))},t.throwError=function(e,t){throw new Error(JSON.stringify({code:e,msg:"[".concat((0,o.getSdkName)(),"][").concat(e,"]:").concat(t)}))},t.printGroupLog=function(e){var t,r=e.title,n=e.subtitle,o=void 0===n?"":n,i=e.content,a=void 0===i?[]:i,s=e.printTrace,l=void 0!==s&&s,u=e.collapsed;void 0!==u&&u?(console.groupCollapsed||console.error)(r,o):(console.group||console.error)(r,o);for(var c=0,f=a;c<f.length;c++){var d=f[c],h=d.type,p=d.body;switch(h){case"info":console.log(p);break;case"warn":console.warn(p);break;case"error":console.error(p)}}l&&(console.trace||console.log)("stack trace:"),null===(t=console.groupEnd)||void 0===t||t.call(console)},t.sleep=function(e){return void 0===e&&(e=0),new Promise((function(t){return setTimeout(t,e)}))},t.transformPhone=function(e){return"+86".concat(e)},t.parseQueryString=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},t.parseCaptcha=function(e){var r={},o=e.match(/^(data:.*?)(\?[^#\s]*)?$/);if(o){e=o[1];var i=o[2];i&&(r=(0,t.parseQueryString)(i))}var a=r.token,s=n(r,["token"]);return/^data:/.test(e)&&!a?{error:"invalid_argument",error_description:"invalid captcha data: ".concat(e)}:a?{state:s.state,token:a,captchaData:e}:{error:"unimplemented",error_description:"need to impl captcha data"}}},949:(e,t,r)=>{"use strict";function n(e){this.message=e}r.r(t),r.d(t,{InvalidTokenError:()=>a,default:()=>s}),n.prototype=new Error,n.prototype.name="InvalidCharacterError";var o="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new n("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,o,i=0,a=0,s="";o=t.charAt(a++);~o&&(r=i%4?64*r+o:o,i++%4)?s+=String.fromCharCode(255&r>>(-2*i&6)):0)o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(o);return s};function i(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(o(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return o(t)}}function a(e){this.message=e}a.prototype=new Error,a.prototype.name="InvalidTokenError";const s=function(e,t){if("string"!=typeof e)throw new a("Invalid token specified");var r=!0===(t=t||{}).header?0:1;try{return JSON.parse(i(e.split(".")[r]))}catch(e){throw new a("Invalid token specified: "+e.message)}}},410:function(e,t,r){var n,o;void 0===(o="function"==typeof(n=function(){"use strict";var e=void 0!==r.g?r.g:self;if(void 0!==e.TextEncoder&&void 0!==e.TextDecoder)return{TextEncoder:e.TextEncoder,TextDecoder:e.TextDecoder};var t=["utf8","utf-8","unicode-1-1-utf-8"];return{TextEncoder:function(e){if(t.indexOf(e)<0&&null!=e)throw new RangeError("Invalid encoding type. Only utf-8 is supported");this.encoding="utf-8",this.encode=function(e){if("string"!=typeof e)throw new TypeError("passed argument must be of type string");var t=unescape(encodeURIComponent(e)),r=new Uint8Array(t.length);return t.split("").forEach((function(e,t){r[t]=e.charCodeAt(0)})),r}},TextDecoder:function(e,r){if(t.indexOf(e)<0&&null!=e)throw new RangeError("Invalid encoding type. Only utf-8 is supported");if(this.encoding="utf-8",this.ignoreBOM=!1,this.fatal=void 0!==r&&"fatal"in r&&r.fatal,"boolean"!=typeof this.fatal)throw new TypeError("fatal flag must be boolean");this.decode=function(e,t){if(void 0===e)return"";if("boolean"!=typeof(void 0!==t&&"stream"in t&&t.stream))throw new TypeError("stream option must be boolean");if(ArrayBuffer.isView(e)){var r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=new Array(r.length);return r.forEach((function(e,t){n[t]=String.fromCharCode(e)})),decodeURIComponent(escape(n.join("")))}throw new TypeError("passed argument must be an array buffer view")}}}})?n.apply(t,[]):n)||(e.exports=o)},308:(e,t,r)=>{"use strict";r.r(t),r.d(t,{createReadableStreamWrapper:()=>h,createTransformStreamWrapper:()=>P,createWrappingReadableSource:()=>p,createWrappingTransformer:()=>O,createWrappingWritableSink:()=>w,createWritableStreamWrapper:()=>g});var 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)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function i(e){if(!e)throw new TypeError("Assertion failed")}function a(){}function s(e){return"object"==typeof e&&null!==e||"function"==typeof e}function l(e){if("function"!=typeof e)return!1;var t=!1;try{new e({start:function(){t=!0}})}catch(e){}return t}function u(e){return!!s(e)&&"function"==typeof e.getReader}function c(e){return!!s(e)&&"function"==typeof e.getWriter}function f(e){return!!s(e)&&!!u(e.readable)&&!!c(e.writable)}function d(e){try{return e.getReader({mode:"byob"}).releaseLock(),!0}catch(e){return!1}}function h(e){i(function(e){return!!l(e)&&!!u(new e)}(e));var t=function(e){try{return new e({type:"bytes"}),!0}catch(e){return!1}}(e);return function(r,n){var o=(void 0===n?{}:n).type;if("bytes"!==(o=b(o))||t||(o=void 0),r.constructor===e&&("bytes"!==o||d(r)))return r;if("bytes"===o){var i=p(r,{type:o});return new e(i)}return i=p(r),new e(i)}}function p(e,t){var r=(void 0===t?{}:t).type;return i(u(e)),i(!1===e.locked),"bytes"===(r=b(r))?new _(e):new y(e)}function b(e){var t=String(e);if("bytes"===t)return t;if(void 0===e)return e;throw new RangeError("Invalid type is specified")}var m=function(){function e(e){this._underlyingReader=void 0,this._readerMode=void 0,this._readableStreamController=void 0,this._pendingRead=void 0,this._underlyingStream=e,this._attachDefaultReader()}return e.prototype.start=function(e){this._readableStreamController=e},e.prototype.cancel=function(e){return i(void 0!==this._underlyingReader),this._underlyingReader.cancel(e)},e.prototype._attachDefaultReader=function(){if("default"!==this._readerMode){this._detachReader();var e=this._underlyingStream.getReader();this._readerMode="default",this._attachReader(e)}},e.prototype._attachReader=function(e){var t=this;i(void 0===this._underlyingReader),this._underlyingReader=e;var r=this._underlyingReader.closed;r&&r.then((function(){return t._finishPendingRead()})).then((function(){e===t._underlyingReader&&t._readableStreamController.close()}),(function(r){e===t._underlyingReader&&t._readableStreamController.error(r)})).catch(a)},e.prototype._detachReader=function(){void 0!==this._underlyingReader&&(this._underlyingReader.releaseLock(),this._underlyingReader=void 0,this._readerMode=void 0)},e.prototype._pullWithDefaultReader=function(){var e=this;this._attachDefaultReader();var t=this._underlyingReader.read().then((function(t){var r=e._readableStreamController;t.done?e._tryClose():r.enqueue(t.value)}));return this._setPendingRead(t),t},e.prototype._tryClose=function(){try{this._readableStreamController.close()}catch(e){}},e.prototype._setPendingRead=function(e){var t,r=this,n=function(){r._pendingRead===t&&(r._pendingRead=void 0)};this._pendingRead=t=e.then(n,n)},e.prototype._finishPendingRead=function(){var e=this;if(this._pendingRead){var t=function(){return e._finishPendingRead()};return this._pendingRead.then(t,t)}},e}(),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.pull=function(){return this._pullWithDefaultReader()},t}(m);function v(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var _=function(e){function t(t){var r=this,n=d(t);return(r=e.call(this,t)||this)._supportsByob=n,r}return o(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return"bytes"},enumerable:!1,configurable:!0}),t.prototype._attachByobReader=function(){if("byob"!==this._readerMode){i(this._supportsByob),this._detachReader();var e=this._underlyingStream.getReader({mode:"byob"});this._readerMode="byob",this._attachReader(e)}},t.prototype.pull=function(){if(this._supportsByob){var e=this._readableStreamController.byobRequest;if(e)return this._pullWithByobRequest(e)}return this._pullWithDefaultReader()},t.prototype._pullWithByobRequest=function(e){var t=this;this._attachByobReader();var r=new Uint8Array(e.view.byteLength),n=this._underlyingReader.read(r).then((function(r){var n,o,i;t._readableStreamController,r.done?(t._tryClose(),e.respond(0)):(n=r.value,o=e.view,i=v(n),v(o).set(i,0),e.respond(r.value.byteLength))}));return this._setPendingRead(n),n},t}(m);function g(e){return i(function(e){return!!l(e)&&!!c(new e)}(e)),function(t){if(t.constructor===e)return t;var r=w(t);return new e(r)}}function w(e){i(c(e)),i(!1===e.locked);var t=e.getWriter();return new S(t)}var S=function(){function e(e){var t=this;this._writableStreamController=void 0,this._pendingWrite=void 0,this._state="writable",this._storedError=void 0,this._underlyingWriter=e,this._errorPromise=new Promise((function(e,r){t._errorPromiseReject=r})),this._errorPromise.catch(a)}return e.prototype.start=function(e){var t=this;this._writableStreamController=e,this._underlyingWriter.closed.then((function(){t._state="closed"})).catch((function(e){return t._finishErroring(e)}))},e.prototype.write=function(e){var t=this,r=this._underlyingWriter;if(null===r.desiredSize)return r.ready;var n=r.write(e);n.catch((function(e){return t._finishErroring(e)})),r.ready.catch((function(e){return t._startErroring(e)}));var o=Promise.race([n,this._errorPromise]);return this._setPendingWrite(o),o},e.prototype.close=function(){var e=this;return void 0===this._pendingWrite?this._underlyingWriter.close():this._finishPendingWrite().then((function(){return e.close()}))},e.prototype.abort=function(e){if("errored"!==this._state)return this._underlyingWriter.abort(e)},e.prototype._setPendingWrite=function(e){var t,r=this,n=function(){r._pendingWrite===t&&(r._pendingWrite=void 0)};this._pendingWrite=t=e.then(n,n)},e.prototype._finishPendingWrite=function(){var e=this;if(void 0===this._pendingWrite)return Promise.resolve();var t=function(){return e._finishPendingWrite()};return this._pendingWrite.then(t,t)},e.prototype._startErroring=function(e){var t=this;if("writable"===this._state){this._state="erroring",this._storedError=e;var r=function(){return t._finishErroring(e)};void 0===this._pendingWrite?r():this._finishPendingWrite().then(r,r),this._writableStreamController.error(e)}},e.prototype._finishErroring=function(e){"writable"===this._state&&this._startErroring(e),"erroring"===this._state&&(this._state="errored",this._errorPromiseReject(this._storedError))},e}();function P(e){return i(function(e){return!!l(e)&&!!f(new e)}(e)),function(t){if(t.constructor===e)return t;var r=O(t);return new e(r)}}function O(e){i(f(e));var t=e.readable,r=e.writable;i(!1===t.locked),i(!1===r.locked);var n,o=t.getReader();try{n=r.getWriter()}catch(e){throw o.releaseLock(),e}return new R(o,n)}var R=function(){function e(e,t){var r=this;this._transformStreamController=void 0,this._onRead=function(e){if(!e.done)return r._transformStreamController.enqueue(e.value),r._reader.read().then(r._onRead)},this._onError=function(e){r._flushReject(e),r._transformStreamController.error(e),r._reader.cancel(e).catch(a),r._writer.abort(e).catch(a)},this._onTerminate=function(){r._flushResolve(),r._transformStreamController.terminate();var e=new TypeError("TransformStream terminated");r._writer.abort(e).catch(a)},this._reader=e,this._writer=t,this._flushPromise=new Promise((function(e,t){r._flushResolve=e,r._flushReject=t}))}return e.prototype.start=function(e){this._transformStreamController=e,this._reader.read().then(this._onRead).then(this._onTerminate,this._onError);var t=this._reader.closed;t&&t.then(this._onTerminate,this._onError)},e.prototype.transform=function(e){return this._writer.write(e)},e.prototype.flush=function(){var e=this;return this._writer.close().then((function(){return e._flushPromise}))},e}()},993:(e,t,r)=>{"use strict";function n(){}function o(e){return"object"==typeof e&&null!==e||"function"==typeof e}r.r(t),r.d(t,{ByteLengthQueuingStrategy:()=>Gr,CountQueuingStrategy:()=>Qr,ReadableByteStreamController:()=>ke,ReadableStream:()=>Ar,ReadableStreamBYOBReader:()=>ut,ReadableStreamBYOBRequest:()=>Ee,ReadableStreamDefaultController:()=>br,ReadableStreamDefaultReader:()=>ee,TransformStream:()=>rn,TransformStreamDefaultController:()=>un,WritableStream:()=>Ot,WritableStreamDefaultController:()=>$t,WritableStreamDefaultWriter:()=>Wt});const i=n;function a(e,t){try{Object.defineProperty(e,"name",{value:t,configurable:!0})}catch(e){}}const s=Promise,l=Promise.resolve.bind(s),u=Promise.prototype.then,c=Promise.reject.bind(s),f=l;function d(e){return new s(e)}function h(e){return d((t=>t(e)))}function p(e){return c(e)}function b(e,t,r){return u.call(e,t,r)}function m(e,t,r){b(b(e,t,r),void 0,i)}function y(e,t){m(e,t)}function v(e,t){m(e,void 0,t)}function _(e,t,r){return b(e,t,r)}function g(e){b(e,void 0,i)}let w=e=>{if("function"==typeof queueMicrotask)w=queueMicrotask;else{const e=h(void 0);w=t=>b(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 P(e,t,r){try{return h(S(e,t,r))}catch(e){return p(e)}}class O{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 R=Symbol("[[AbortSteps]]"),T=Symbol("[[ErrorSteps]]"),j=Symbol("[[CancelSteps]]"),E=Symbol("[[PullSteps]]"),k=Symbol("[[ReleaseSteps]]");function C(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?x(e):"closed"===t._state?function(e){x(e),W(e)}(e):M(e,t._storedError)}function q(e,t){return Lr(e._ownerReadableStream,t)}function I(e){const t=e._ownerReadableStream;"readable"===t._state?U(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):function(e){M(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"))}(e),t._readableStreamController[k](),t._reader=void 0,e._ownerReadableStream=void 0}function A(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 M(e,t){x(e),U(e,t)}function U(e,t){void 0!==e._closedPromise_reject&&(g(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function W(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)},L=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function D(e,t){if(void 0!==e&&"object"!=typeof(r=e)&&"function"!=typeof r)throw new TypeError(`${t} is not an object.`);var r}function N(e,t){if("function"!=typeof e)throw new TypeError(`${t} is not a function.`)}function z(e,t){if(!function(e){return"object"==typeof e&&null!==e||"function"==typeof e}(e))throw new TypeError(`${t} is not an object.`)}function F(e,t,r){if(void 0===e)throw new TypeError(`Parameter ${t} is required in '${r}'.`)}function $(e,t,r){if(void 0===e)throw new TypeError(`${t} is required in '${r}'.`)}function G(e){return Number(e)}function Y(e){return 0===e?0:e}function H(e,t){const r=Number.MAX_SAFE_INTEGER;let n=Number(e);if(n=Y(n),!B(n))throw new TypeError(`${t} is not a finite number`);if(n=function(e){return Y(L(e))}(n),n<0||n>r)throw new TypeError(`${t} is outside the accepted range of 0 to ${r}, inclusive`);return B(n)&&0!==n?n:0}function V(e,t){if(!Wr(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Q(e){return new ee(e)}function J(e,t){e._reader._readRequests.push(t)}function K(e,t,r){const n=e._reader._readRequests.shift();r?n._closeSteps():n._chunkSteps(t)}function X(e){return e._reader._readRequests.length}function Z(e){const t=e._reader;return void 0!==t&&!!te(t)}class ee{constructor(e){if(F(e,1,"ReadableStreamDefaultReader"),V(e,"First parameter"),Br(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");C(this,e),this._readRequests=new O}get closed(){return te(this)?this._closedPromise:p(oe("closed"))}cancel(e=void 0){return te(this)?void 0===this._ownerReadableStream?p(A("cancel")):q(this,e):p(oe("cancel"))}read(){if(!te(this))return p(oe("read"));if(void 0===this._ownerReadableStream)return p(A("read from"));let e,t;const r=d(((r,n)=>{e=r,t=n}));return re(this,{_chunkSteps:t=>e({value:t,done:!1}),_closeSteps:()=>e({value:void 0,done:!0}),_errorSteps:e=>t(e)}),r}releaseLock(){if(!te(this))throw oe("releaseLock");void 0!==this._ownerReadableStream&&function(e){I(e),ne(e,new TypeError("Reader was released"))}(this)}}function te(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readRequests")&&e instanceof ee}function re(e,t){const r=e._ownerReadableStream;r._disturbed=!0,"closed"===r._state?t._closeSteps():"errored"===r._state?t._errorSteps(r._storedError):r._readableStreamController[E](t)}function ne(e,t){const r=e._readRequests;e._readRequests=new O,r.forEach((e=>{e._errorSteps(t)}))}function oe(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}var ie,ae,se;function le(e){return e.slice()}function ue(e,t,r,n,o){new Uint8Array(e).set(new Uint8Array(r,n,o),t)}Object.defineProperties(ee.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),a(ee.prototype.cancel,"cancel"),a(ee.prototype.read,"read"),a(ee.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ee.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});let ce=e=>(ce="function"==typeof e.transfer?e=>e.transfer():"function"==typeof structuredClone?e=>structuredClone(e,{transfer:[e]}):e=>e,ce(e)),fe=e=>(fe="boolean"==typeof e.detached?e=>e.detached:e=>0===e.byteLength,fe(e));function de(e,t,r){if(e.slice)return e.slice(t,r);const n=r-t,o=new ArrayBuffer(n);return ue(o,0,e,t,n),o}function he(e,t){const r=e[t];if(null!=r){if("function"!=typeof r)throw new TypeError(`${String(t)} is not a function`);return r}}function pe(e){try{const t=e.done,r=e.value;return b(f(r),(e=>({done:t,value:e})))}catch(e){return p(e)}}const be=null!==(se=null!==(ie=Symbol.asyncIterator)&&void 0!==ie?ie:null===(ae=Symbol.for)||void 0===ae?void 0:ae.call(Symbol,"Symbol.asyncIterator"))&&void 0!==se?se:"@@asyncIterator";function me(e,t="sync",r){if(void 0===r)if("async"===t){if(void 0===(r=he(e,be)))return function(e){const t={next(){let t;try{t=ye(e)}catch(e){return p(e)}return pe(t)},return(t){let r;try{const n=he(e.iterator,"return");if(void 0===n)return h({done:!0,value:t});r=S(n,e.iterator,[t])}catch(e){return p(e)}return o(r)?pe(r):p(new TypeError("The iterator.return() method must return an object"))}};return{iterator:t,nextMethod:t.next,done:!1}}(me(e,"sync",he(e,Symbol.iterator)))}else r=he(e,Symbol.iterator);if(void 0===r)throw new TypeError("The object is not iterable");const n=S(r,e,[]);if(!o(n))throw new TypeError("The iterator method must return an object");return{iterator:n,nextMethod:n.next,done:!1}}function ye(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 ve{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?_(this._ongoingPromise,e,e):e(),this._ongoingPromise}return(e){const t=()=>this._returnSteps(e);return this._ongoingPromise?_(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 re(e,{_chunkSteps:e=>{this._ongoingPromise=void 0,w((()=>t({value:e,done:!1})))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,I(e),t({value:void 0,done:!0})},_errorSteps:t=>{this._ongoingPromise=void 0,this._isFinished=!0,I(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=q(t,e);return I(t),_(r,(()=>({value:e,done:!0})))}return I(t),h({value:e,done:!0})}}const _e={next(){return ge(this)?this._asyncIteratorImpl.next():p(we("next"))},return(e){return ge(this)?this._asyncIteratorImpl.return(e):p(we("return"))},[be](){return this}};function ge(e){if(!o(e))return!1;if(!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof ve}catch(e){return!1}}function we(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}Object.defineProperty(_e,be,{enumerable:!1});const Se=Number.isNaN||function(e){return e!=e};function Pe(e){const t=de(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function Oe(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function Re(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 Te(e){e._queue=new O,e._queueTotalSize=0}function je(e){return e===DataView}class Ee{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!qe(this))throw rt("view");return this._view}respond(e){if(!qe(this))throw rt("respond");if(F(e,1,"respond"),e=H(e,"First parameter"),void 0===this._associatedReadableByteStreamController)throw new TypeError("This BYOB request has been invalidated");if(fe(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");Ze(this._associatedReadableByteStreamController,e)}respondWithNewView(e){if(!qe(this))throw rt("respondWithNewView");if(F(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(fe(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(Ee.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),a(Ee.prototype.respond,"respond"),a(Ee.prototype.respondWithNewView,"respondWithNewView"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ee.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class ke{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Ce(this))throw nt("byobRequest");return Ke(this)}get desiredSize(){if(!Ce(this))throw nt("desiredSize");return Xe(this)}close(){if(!Ce(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 ${e} state) is not in the readable state and cannot be closed`);He(this)}enqueue(e){if(!Ce(this))throw nt("enqueue");if(F(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 ${t} state) is not in the readable state and cannot be enqueued to`);Ve(this,e)}error(e=void 0){if(!Ce(this))throw nt("error");Qe(this,e)}[j](e){Ae(this),Te(this);const t=this._cancelAlgorithm(e);return Ye(this),t}[E](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)}J(t,e),Ie(this)}[k](){if(this._pendingPullIntos.length>0){const e=this._pendingPullIntos.peek();e.readerType="none",this._pendingPullIntos=new O,this._pendingPullIntos.push(e)}}}function Ce(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")&&e instanceof ke}function qe(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")&&e instanceof Ee}function Ie(e){const t=function(e){const t=e._controlledReadableByteStream;return"readable"===t._state&&(!e._closeRequested&&(!!e._started&&(!!(Z(t)&&X(t)>0)||(!!(lt(t)&&st(t)>0)||Xe(e)>0))))}(e);t&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,m(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,Ie(e)),null)),(t=>(Qe(e,t),null)))))}function Ae(e){ze(e),e._pendingPullIntos=new O}function xe(e,t){let r=!1;"closed"===e._state&&(r=!0);const n=Me(t);"default"===t.readerType?K(e,n,r):function(e,t,r){const n=e._reader._readIntoRequests.shift();r?n._closeSteps(t):n._chunkSteps(t)}(e,n,r)}function Me(e){const t=e.bytesFilled,r=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/r)}function Ue(e,t,r,n){e._queue.push({buffer:t,byteOffset:r,byteLength:n}),e._queueTotalSize+=n}function We(e,t,r,n){let o;try{o=de(t,r,r+n)}catch(t){throw Qe(e,t),t}Ue(e,o,0,n)}function Be(e,t){t.bytesFilled>0&&We(e,t.buffer,t.byteOffset,t.bytesFilled),Ge(e)}function Le(e,t){const r=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),n=t.bytesFilled+r;let o=r,i=!1;const a=n-n%t.elementSize;a>=t.minimumFill&&(o=a-t.bytesFilled,i=!0);const s=e._queue;for(;o>0;){const r=s.peek(),n=Math.min(o,r.byteLength),i=t.byteOffset+t.bytesFilled;ue(t.buffer,i,r.buffer,r.byteOffset,n),r.byteLength===n?s.shift():(r.byteOffset+=n,r.byteLength-=n),e._queueTotalSize-=n,De(0,n,t),o-=n}return i}function De(e,t,r){r.bytesFilled+=t}function Ne(e){0===e._queueTotalSize&&e._closeRequested?(Ye(e),Dr(e._controlledReadableByteStream)):Ie(e)}function ze(e){null!==e._byobRequest&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function Fe(e){for(;e._pendingPullIntos.length>0;){if(0===e._queueTotalSize)return;const t=e._pendingPullIntos.peek();Le(e,t)&&(Ge(e),xe(e._controlledReadableByteStream,t))}}function $e(e,t){const r=e._pendingPullIntos.peek();ze(e),"closed"===e._controlledReadableByteStream._state?function(e,t){"none"===t.readerType&&Ge(e);const r=e._controlledReadableByteStream;if(lt(r))for(;st(r)>0;)xe(r,Ge(e))}(e,r):function(e,t,r){if(De(0,t,r),"none"===r.readerType)return Be(e,r),void Fe(e);if(r.bytesFilled<r.minimumFill)return;Ge(e);const n=r.bytesFilled%r.elementSize;if(n>0){const t=r.byteOffset+r.bytesFilled;We(e,r.buffer,t-n,n)}r.bytesFilled-=n,xe(e._controlledReadableByteStream,r),Fe(e)}(e,t,r),Ie(e)}function Ge(e){return e._pendingPullIntos.shift()}function Ye(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function He(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}}Ye(e),Dr(t)}}function Ve(e,t){const r=e._controlledReadableByteStream;if(e._closeRequested||"readable"!==r._state)return;const{buffer:n,byteOffset:o,byteLength:i}=t;if(fe(n))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");const a=ce(n);if(e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek();if(fe(t.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");ze(e),t.buffer=ce(t.buffer),"none"===t.readerType&&Be(e,t)}Z(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)?Ue(e,a,o,i):(e._pendingPullIntos.length>0&&Ge(e),K(r,new Uint8Array(a,o,i),!1))):lt(r)?(Ue(e,a,o,i),Fe(e)):Ue(e,a,o,i),Ie(e)}function Qe(e,t){const r=e._controlledReadableByteStream;"readable"===r._state&&(Ae(e),Te(e),Ye(e),Nr(r,t))}function Je(e,t){const r=e._queue.shift();e._queueTotalSize-=r.byteLength,Ne(e);const n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);t._chunkSteps(n)}function Ke(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(Ee.prototype);!function(e,t,r){e._associatedReadableByteStreamController=t,e._view=r}(n,e,r),e._byobRequest=n}return e._byobRequest}function Xe(e){const t=e._controlledReadableByteStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Ze(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=ce(r.buffer),$e(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=ce(t.buffer),$e(e,n)}function tt(e,t,r,n,o,i,a){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Te(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,t._autoAllocateChunkSize=a,t._pendingPullIntos=new O,e._readableStreamController=t,m(h(r()),(()=>(t._started=!0,Ie(t),null)),(e=>(Qe(t,e),null)))}function rt(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function nt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function ot(e,t){if("byob"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function it(e){return new ut(e)}function at(e,t){e._reader._readIntoRequests.push(t)}function st(e){return e._reader._readIntoRequests.length}function lt(e){const t=e._reader;return void 0!==t&&!!ct(t)}Object.defineProperties(ke.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),a(ke.prototype.close,"close"),a(ke.prototype.enqueue,"enqueue"),a(ke.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ke.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});class ut{constructor(e){if(F(e,1,"ReadableStreamBYOBReader"),V(e,"First parameter"),Br(e))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Ce(e._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");C(this,e),this._readIntoRequests=new O}get closed(){return ct(this)?this._closedPromise:p(ht("closed"))}cancel(e=void 0){return ct(this)?void 0===this._ownerReadableStream?p(A("cancel")):q(this,e):p(ht("cancel"))}read(e,t={}){if(!ct(this))return p(ht("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(fe(e.buffer))return p(new TypeError("view's buffer has been detached"));let r;try{r=function(e,t){var r;return D(e,t),{min:H(null!==(r=null==e?void 0:e.min)&&void 0!==r?r:1,`${t} has member 'min' that`)}}(t,"options")}catch(e){return p(e)}const n=r.min;if(0===n)return p(new TypeError("options.min must be greater than 0"));if(function(e){return je(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(A("read from"));let o,i;const a=d(((e,t)=>{o=e,i=t}));return ft(this,e,n,{_chunkSteps:e=>o({value:e,done:!1}),_closeSteps:e=>o({value:e,done:!0}),_errorSteps:e=>i(e)}),a}releaseLock(){if(!ct(this))throw ht("releaseLock");void 0!==this._ownerReadableStream&&function(e){I(e),dt(e,new TypeError("Reader was released"))}(this)}}function ct(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")&&e instanceof ut}function ft(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,a=function(e){return je(e)?1:e.BYTES_PER_ELEMENT}(i),{byteOffset:s,byteLength:l}=t,u=r*a;let c;try{c=ce(t.buffer)}catch(e){return void n._errorSteps(e)}const f={buffer:c,bufferByteLength:c.byteLength,byteOffset:s,byteLength:l,bytesFilled:0,minimumFill:u,elementSize:a,viewConstructor:i,readerType:"byob"};if(e._pendingPullIntos.length>0)return e._pendingPullIntos.push(f),void at(o,n);if("closed"!==o._state){if(e._queueTotalSize>0){if(Le(e,f)){const t=Me(f);return Ne(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(f),at(o,n),Ie(e)}else{const e=new i(f.buffer,f.byteOffset,0);n._closeSteps(e)}}(o._readableStreamController,t,r,n)}function dt(e,t){const r=e._readIntoRequests;e._readIntoRequests=new O,r.forEach((e=>{e._errorSteps(t)}))}function ht(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${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 bt(e){const{size:t}=e;return t||(()=>1)}function mt(e,t){D(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:yt(n,`${t} has member 'size' that`)}}function yt(e,t){return N(e,t),t=>G(e(t))}function vt(e,t,r){return N(e,r),r=>P(e,t,[r])}function _t(e,t,r){return N(e,r),()=>P(e,t,[])}function gt(e,t,r){return N(e,r),r=>S(e,t,[r])}function wt(e,t,r){return N(e,r),(r,n)=>P(e,t,[r,n])}function St(e,t){if(!jt(e))throw new TypeError(`${t} is not a WritableStream.`)}Object.defineProperties(ut.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),a(ut.prototype.cancel,"cancel"),a(ut.prototype.read,"read"),a(ut.prototype.releaseLock,"releaseLock"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(ut.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});const Pt="function"==typeof AbortController;class Ot{constructor(e={},t={}){void 0===e?e=null:z(e,"First parameter");const r=mt(t,"Second parameter"),n=function(e,t){D(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,a=null==e?void 0:e.write;return{abort:void 0===r?void 0:vt(r,e,`${t} has member 'abort' that`),close:void 0===n?void 0:_t(n,e,`${t} has member 'close' that`),start:void 0===o?void 0:gt(o,e,`${t} has member 'start' that`),write:void 0===a?void 0:wt(a,e,`${t} has member 'write' that`),type:i}}(e,"First parameter");if(Tt(this),void 0!==n.type)throw new RangeError("Invalid type is specified");const o=bt(r);!function(e,t,r,n){const o=Object.create($t.prototype);let i,a,s,l;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.write?e=>t.write(e,o):()=>h(void 0),s=void 0!==t.close?()=>t.close():()=>h(void 0),l=void 0!==t.abort?e=>t.abort(e):()=>h(void 0),Yt(e,o,i,a,s,l,r,n)}(this,n,pt(r,1),o)}get locked(){if(!jt(this))throw Zt("locked");return Et(this)}abort(e=void 0){return jt(this)?Et(this)?p(new TypeError("Cannot abort a stream that already has a writer")):kt(this,e):p(Zt("abort"))}close(){return jt(this)?Et(this)?p(new TypeError("Cannot close a stream that already has a writer")):xt(this)?p(new TypeError("Cannot close an already-closing stream")):Ct(this):p(Zt("close"))}getWriter(){if(!jt(this))throw Zt("getWriter");return Rt(this)}}function Rt(e){return new Wt(e)}function Tt(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new O,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function jt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")&&e instanceof Ot}function Et(e){return void 0!==e._writer}function kt(e,t){var r;if("closed"===e._state||"errored"===e._state)return h(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 h(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||It(e,t),i}function Ct(e){const t=e._state;if("closed"===t||"errored"===t)return p(new TypeError(`The stream (in ${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&&fr(n),Re(o=e._writableStreamController,Ft,0),Qt(o),r}function qt(e,t){"writable"!==e._state?At(e):It(e,t)}function It(e,t){const r=e._writableStreamController;e._state="erroring",e._storedError=t;const n=e._writer;void 0!==n&&Dt(n,t),!function(e){return void 0!==e._inFlightWriteRequest||void 0!==e._inFlightCloseRequest}(e)&&r._started&&At(e)}function At(e){e._state="errored",e._writableStreamController[T]();const t=e._storedError;if(e._writeRequests.forEach((e=>{e._reject(t)})),e._writeRequests=new O,void 0===e._pendingAbortRequest)return void Mt(e);const r=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,r._wasAlreadyErroring)return r._reject(t),void Mt(e);m(e._writableStreamController[R](r._reason),(()=>(r._resolve(),Mt(e),null)),(t=>(r._reject(t),Mt(e),null)))}function xt(e){return void 0!==e._closeRequest||void 0!==e._inFlightCloseRequest}function Mt(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 Ut(e,t){const r=e._writer;void 0!==r&&t!==e._backpressure&&(t?function(e){sr(e)}(r):fr(r)),e._backpressure=t}Object.defineProperties(Ot.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),a(Ot.prototype.abort,"abort"),a(Ot.prototype.close,"close"),a(Ot.prototype.getWriter,"getWriter"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ot.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});class Wt{constructor(e){if(F(e,1,"WritableStreamDefaultWriter"),St(e,"First parameter"),Et(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)!xt(e)&&e._backpressure?sr(this):ur(this),nr(this);else if("erroring"===t)lr(this,e._storedError),nr(this);else if("closed"===t)ur(this),nr(this),ar(this);else{const t=e._storedError;lr(this,t),or(this,t)}}get closed(){return Bt(this)?this._closedPromise:p(tr("closed"))}get desiredSize(){if(!Bt(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:Vt(t._writableStreamController)}(this)}get ready(){return Bt(this)?this._readyPromise:p(tr("ready"))}abort(e=void 0){return Bt(this)?void 0===this._ownerWritableStream?p(rr("abort")):function(e,t){return kt(e._ownerWritableStream,t)}(this,e):p(tr("abort"))}close(){if(!Bt(this))return p(tr("close"));const e=this._ownerWritableStream;return void 0===e?p(rr("close")):xt(e)?p(new TypeError("Cannot close an already-closing stream")):Lt(this)}releaseLock(){if(!Bt(this))throw tr("releaseLock");void 0!==this._ownerWritableStream&&Nt(this)}write(e=void 0){return Bt(this)?void 0===this._ownerWritableStream?p(rr("write to")):zt(this,e):p(tr("write"))}}function Bt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")&&e instanceof Wt}function Lt(e){return Ct(e._ownerWritableStream)}function Dt(e,t){"pending"===e._readyPromiseState?cr(e,t):function(e,t){lr(e,t)}(e,t)}function Nt(e){const t=e._ownerWritableStream,r=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");Dt(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 zt(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(xt(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 a=function(e){return d(((t,r)=>{const n={_resolve:t,_reject:r};e._writeRequests.push(n)}))}(r);return function(e,t,r){try{Re(e,t,r)}catch(t){return void Jt(e,t)}const n=e._controlledWritableStream;xt(n)||"writable"!==n._state||Ut(n,Kt(e)),Qt(e)}(n,t,o),a}Object.defineProperties(Wt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),a(Wt.prototype.abort,"abort"),a(Wt.prototype.close,"close"),a(Wt.prototype.releaseLock,"releaseLock"),a(Wt.prototype.write,"write"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Wt.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});const Ft={};class $t{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Gt(this))throw er("abortReason");return this._abortReason}get signal(){if(!Gt(this))throw er("signal");if(void 0===this._abortController)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(e=void 0){if(!Gt(this))throw er("error");"writable"===this._controlledWritableStream._state&&Xt(this,e)}[R](e){const t=this._abortAlgorithm(e);return Ht(this),t}[T](){Te(this)}}function Gt(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")&&e instanceof $t}function Yt(e,t,r,n,o,i,a,s){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Te(t),t._abortReason=void 0,t._abortController=function(){if(Pt)return new AbortController}(),t._started=!1,t._strategySizeAlgorithm=s,t._strategyHWM=a,t._writeAlgorithm=n,t._closeAlgorithm=o,t._abortAlgorithm=i;const l=Kt(t);Ut(e,l),m(h(r()),(()=>(t._started=!0,Qt(t),null)),(r=>(t._started=!0,qt(e,r),null)))}function Ht(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function Vt(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 At(t);if(0===e._queue.length)return;const r=e._queue.peek().value;r===Ft?function(e){const t=e._controlledWritableStream;(function(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0})(t),Oe(e);const r=e._closeAlgorithm();Ht(e),m(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&&ar(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),qt(e,t)}(t,e),null)))}(e):function(e,t){const r=e._controlledWritableStream;!function(e){e._inFlightWriteRequest=e._writeRequests.shift()}(r),m(e._writeAlgorithm(t),(()=>{!function(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}(r);const t=r._state;if(Oe(e),!xt(r)&&"writable"===t){const t=Kt(e);Ut(r,t)}return Qt(e),null}),(t=>("writable"===r._state&&Ht(e),function(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,qt(e,t)}(r,t),null)))}(e,r)}function Jt(e,t){"writable"===e._controlledWritableStream._state&&Xt(e,t)}function Kt(e){return Vt(e)<=0}function Xt(e,t){const r=e._controlledWritableStream;Ht(e),It(r,t)}function Zt(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function er(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function tr(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${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&&(g(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function ar(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 sr(e){e._readyPromise=d(((t,r)=>{e._readyPromise_resolve=t,e._readyPromise_reject=r})),e._readyPromiseState="pending"}function lr(e,t){sr(e),cr(e,t)}function ur(e){sr(e),fr(e)}function cr(e,t){void 0!==e._readyPromise_reject&&(g(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function fr(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($t.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty($t.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});const dr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0,hr=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 a(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,a){const s=Q(e),l=Rt(t);e._disturbed=!0;let u=!1,c=h(void 0);return d(((f,_)=>{let w;if(void 0!==a){if(w=()=>{const r=void 0!==a.reason?a.reason:new hr("Aborted","AbortError"),n=[];o||n.push((()=>"writable"===t._state?kt(t,r):h(void 0))),i||n.push((()=>"readable"===e._state?Lr(e,r):h(void 0))),j((()=>Promise.all(n.map((e=>e())))),!0,r)},a.aborted)return void w();a.addEventListener("abort",w)}var S,P,O;if(T(e,s._closedPromise,(e=>(o?E(!0,e):j((()=>kt(t,e)),!0,e),null))),T(t,l._closedPromise,(t=>(i?E(!0,t):j((()=>Lr(e,t)),!0,t),null))),S=e,P=s._closedPromise,O=()=>(r?E():j((()=>function(e){const t=e._ownerWritableStream,r=t._state;return xt(t)||"closed"===r?h(void 0):"errored"===r?p(t._storedError):Lt(e)}(l))),null),"closed"===S._state?O():y(P,O),xt(t)||"closed"===t._state){const t=new TypeError("the destination writable stream closed before all data could be piped to it");i?E(!0,t):j((()=>Lr(e,t)),!0,t)}function R(){const e=c;return b(c,(()=>e!==c?R():void 0))}function T(e,t,r){"errored"===e._state?r(e._storedError):v(t,r)}function j(e,r,n){function o(){return m(e(),(()=>k(r,n)),(e=>k(!0,e))),null}u||(u=!0,"writable"!==t._state||xt(t)?o():y(R(),o))}function E(e,r){u||(u=!0,"writable"!==t._state||xt(t)?k(e,r):y(R(),(()=>k(e,r))))}function k(e,t){return Nt(l),I(s),void 0!==a&&a.removeEventListener("abort",w),e?_(t):f(void 0),null}g(d(((e,t)=>{!function r(o){o?e():b(u?h(!0):b(l._readyPromise,(()=>d(((e,t)=>{re(s,{_chunkSteps:t=>{c=b(zt(l,t),void 0,n),e(!1)},_closeSteps:()=>e(!0),_errorSteps:t})})))),r,t)}(!1)})))}))}class br{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!mr(this))throw Tr("desiredSize");return Pr(this)}close(){if(!mr(this))throw Tr("close");if(!Or(this))throw new TypeError("The stream is not in a state that permits close");gr(this)}enqueue(e=void 0){if(!mr(this))throw Tr("enqueue");if(!Or(this))throw new TypeError("The stream is not in a state that permits enqueue");return wr(this,e)}error(e=void 0){if(!mr(this))throw Tr("error");Sr(this,e)}[j](e){Te(this);const t=this._cancelAlgorithm(e);return _r(this),t}[E](e){const t=this._controlledReadableStream;if(this._queue.length>0){const r=Oe(this);this._closeRequested&&0===this._queue.length?(_r(this),Dr(t)):yr(this),e._chunkSteps(r)}else J(t,e),yr(this)}[k](){}}function mr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")&&e instanceof br}function yr(e){vr(e)&&(e._pulling?e._pullAgain=!0:(e._pulling=!0,m(e._pullAlgorithm(),(()=>(e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,yr(e)),null)),(t=>(Sr(e,t),null)))))}function vr(e){const t=e._controlledReadableStream;return!!Or(e)&&!!e._started&&(!!(Br(t)&&X(t)>0)||Pr(e)>0)}function _r(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function gr(e){if(!Or(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,0===e._queue.length&&(_r(e),Dr(t))}function wr(e,t){if(!Or(e))return;const r=e._controlledReadableStream;if(Br(r)&&X(r)>0)K(r,t,!1);else{let r;try{r=e._strategySizeAlgorithm(t)}catch(t){throw Sr(e,t),t}try{Re(e,t,r)}catch(t){throw Sr(e,t),t}}yr(e)}function Sr(e,t){const r=e._controlledReadableStream;"readable"===r._state&&(Te(e),_r(e),Nr(r,t))}function Pr(e){const t=e._controlledReadableStream._state;return"errored"===t?null:"closed"===t?0:e._strategyHWM-e._queueTotalSize}function Or(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&"readable"===t}function Rr(e,t,r,n,o,i,a){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Te(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=a,t._strategyHWM=i,t._pullAlgorithm=n,t._cancelAlgorithm=o,e._readableStreamController=t,m(h(r()),(()=>(t._started=!0,yr(t),null)),(e=>(Sr(t,e),null)))}function Tr(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function jr(e){return o(t=e)&&void 0!==t.getReader?function(e){let t;return t=xr(n,(function(){let r;try{r=e.read()}catch(r){return p(r)}return _(r,(e=>{if(!o(e))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(e.done)gr(t._readableStreamController);else{const r=e.value;wr(t._readableStreamController,r)}}))}),(function(t){try{return h(e.cancel(t))}catch(t){return p(t)}}),0),t}(e.getReader()):function(e){let t;const r=me(e,"async");return t=xr(n,(function(){let e;try{e=ye(r)}catch(e){return p(e)}return _(h(e),(e=>{if(!o(e))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(e.done)gr(t._readableStreamController);else{const r=e.value;wr(t._readableStreamController,r)}}))}),(function(e){const t=r.iterator;let n;try{n=he(t,"return")}catch(e){return p(e)}return void 0===n?h(void 0):_(P(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 Er(e,t,r){return N(e,r),r=>P(e,t,[r])}function kr(e,t,r){return N(e,r),r=>P(e,t,[r])}function Cr(e,t,r){return N(e,r),r=>S(e,t,[r])}function qr(e,t){if("bytes"!=(e=`${e}`))throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function Ir(e,t){D(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(`${t} is not an AbortSignal.`)}(i,`${t} has member 'signal' that`),{preventAbort:Boolean(r),preventCancel:Boolean(n),preventClose:Boolean(o),signal:i}}Object.defineProperties(br.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),a(br.prototype.close,"close"),a(br.prototype.enqueue,"enqueue"),a(br.prototype.error,"error"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(br.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});class Ar{constructor(e={},t={}){void 0===e?e=null:z(e,"First parameter");const r=mt(t,"Second parameter"),n=function(e,t){D(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,a=null==r?void 0:r.start,s=null==r?void 0:r.type;return{autoAllocateChunkSize:void 0===n?void 0:H(n,`${t} has member 'autoAllocateChunkSize' that`),cancel:void 0===o?void 0:Er(o,r,`${t} has member 'cancel' that`),pull:void 0===i?void 0:kr(i,r,`${t} has member 'pull' that`),start:void 0===a?void 0:Cr(a,r,`${t} has member 'start' that`),type:void 0===s?void 0:qr(s,`${t} has member 'type' that`)}}(e,"First parameter");if(Ur(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(ke.prototype);let o,i,a;o=void 0!==t.start?()=>t.start(n):()=>{},i=void 0!==t.pull?()=>t.pull(n):()=>h(void 0),a=void 0!==t.cancel?e=>t.cancel(e):()=>h(void 0);const s=t.autoAllocateChunkSize;if(0===s)throw new TypeError("autoAllocateChunkSize must be greater than 0");tt(e,n,o,i,a,r,s)}(this,n,pt(r,0))}else{const e=bt(r);!function(e,t,r,n){const o=Object.create(br.prototype);let i,a,s;i=void 0!==t.start?()=>t.start(o):()=>{},a=void 0!==t.pull?()=>t.pull(o):()=>h(void 0),s=void 0!==t.cancel?e=>t.cancel(e):()=>h(void 0),Rr(e,o,i,a,s,r,n)}(this,n,pt(r,1),e)}}get locked(){if(!Wr(this))throw zr("locked");return Br(this)}cancel(e=void 0){return Wr(this)?Br(this)?p(new TypeError("Cannot cancel a stream that already has a reader")):Lr(this,e):p(zr("cancel"))}getReader(e=void 0){if(!Wr(this))throw zr("getReader");return void 0===function(e,t){D(e,t);const r=null==e?void 0:e.mode;return{mode:void 0===r?void 0:ot(r,`${t} has member 'mode' that`)}}(e,"First parameter").mode?Q(this):it(this)}pipeThrough(e,t={}){if(!Wr(this))throw zr("pipeThrough");F(e,1,"pipeThrough");const r=function(e,t){D(e,t);const r=null==e?void 0:e.readable;$(r,"readable","ReadableWritablePair"),V(r,`${t} has member 'readable' that`);const n=null==e?void 0:e.writable;return $(n,"writable","ReadableWritablePair"),St(n,`${t} has member 'writable' that`),{readable:r,writable:n}}(e,"First parameter"),n=Ir(t,"Second parameter");if(Br(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Et(r.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");return g(pr(this,r.writable,n.preventClose,n.preventAbort,n.preventCancel,n.signal)),r.readable}pipeTo(e,t={}){if(!Wr(this))return p(zr("pipeTo"));if(void 0===e)return p("Parameter 1 is required in 'pipeTo'.");if(!jt(e))return p(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let r;try{r=Ir(t,"Second parameter")}catch(e){return p(e)}return Br(this)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Et(e)?p(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):pr(this,e,r.preventClose,r.preventAbort,r.preventCancel,r.signal)}tee(){if(!Wr(this))throw zr("tee");return le(function(e){return Ce(e._readableStreamController)?function(e){let t,r,n,o,i,a=Q(e),s=!1,l=!1,u=!1,c=!1,f=!1;const p=d((e=>{i=e}));function b(e){v(e._closedPromise,(t=>(e!==a||(Qe(n._readableStreamController,t),Qe(o._readableStreamController,t),c&&f||i(void 0)),null)))}function m(){ct(a)&&(I(a),a=Q(e),b(a)),re(a,{_chunkSteps:t=>{w((()=>{l=!1,u=!1;const r=t;let a=t;if(!c&&!f)try{a=Pe(t)}catch(t){return Qe(n._readableStreamController,t),Qe(o._readableStreamController,t),void i(Lr(e,t))}c||Ve(n._readableStreamController,r),f||Ve(o._readableStreamController,a),s=!1,l?_():u&&g()}))},_closeSteps:()=>{s=!1,c||He(n._readableStreamController),f||He(o._readableStreamController),n._readableStreamController._pendingPullIntos.length>0&&Ze(n._readableStreamController,0),o._readableStreamController._pendingPullIntos.length>0&&Ze(o._readableStreamController,0),c&&f||i(void 0)},_errorSteps:()=>{s=!1}})}function y(t,r){te(a)&&(I(a),a=it(e),b(a));const d=r?o:n,h=r?n:o;ft(a,t,1,{_chunkSteps:t=>{w((()=>{l=!1,u=!1;const n=r?f:c;if(r?c:f)n||et(d._readableStreamController,t);else{let r;try{r=Pe(t)}catch(t){return Qe(d._readableStreamController,t),Qe(h._readableStreamController,t),void i(Lr(e,t))}n||et(d._readableStreamController,t),Ve(h._readableStreamController,r)}s=!1,l?_():u&&g()}))},_closeSteps:e=>{s=!1;const t=r?f:c,n=r?c:f;t||He(d._readableStreamController),n||He(h._readableStreamController),void 0!==e&&(t||et(d._readableStreamController,e),!n&&h._readableStreamController._pendingPullIntos.length>0&&Ze(h._readableStreamController,0)),t&&n||i(void 0)},_errorSteps:()=>{s=!1}})}function _(){if(s)return l=!0,h(void 0);s=!0;const e=Ke(n._readableStreamController);return null===e?m():y(e._view,!1),h(void 0)}function g(){if(s)return u=!0,h(void 0);s=!0;const e=Ke(o._readableStreamController);return null===e?m():y(e._view,!0),h(void 0)}function S(){}return n=Mr(S,_,(function(n){if(c=!0,t=n,f){const n=le([t,r]),o=Lr(e,n);i(o)}return p})),o=Mr(S,g,(function(n){if(f=!0,r=n,c){const n=le([t,r]),o=Lr(e,n);i(o)}return p})),b(a),[n,o]}(e):function(e){const t=Q(e);let r,n,o,i,a,s=!1,l=!1,u=!1,c=!1;const f=d((e=>{a=e}));function p(){return s?(l=!0,h(void 0)):(s=!0,re(t,{_chunkSteps:e=>{w((()=>{l=!1;const t=e,r=e;u||wr(o._readableStreamController,t),c||wr(i._readableStreamController,r),s=!1,l&&p()}))},_closeSteps:()=>{s=!1,u||gr(o._readableStreamController),c||gr(i._readableStreamController),u&&c||a(void 0)},_errorSteps:()=>{s=!1}}),h(void 0))}function b(){}return o=xr(b,p,(function(t){if(u=!0,r=t,c){const t=le([r,n]),o=Lr(e,t);a(o)}return f})),i=xr(b,p,(function(t){if(c=!0,n=t,u){const t=le([r,n]),o=Lr(e,t);a(o)}return f})),v(t._closedPromise,(e=>(Sr(o._readableStreamController,e),Sr(i._readableStreamController,e),u&&c||a(void 0),null))),[o,i]}(e)}(this))}values(e=void 0){if(!Wr(this))throw zr("values");return function(e,t){const r=Q(e),n=new ve(r,t),o=Object.create(_e);return o._asyncIteratorImpl=n,o}(this,function(e){D(e,"First parameter");const t=null==e?void 0:e.preventCancel;return{preventCancel:Boolean(t)}}(e).preventCancel)}[be](e){return this.values(e)}static from(e){return jr(e)}}function xr(e,t,r,n=1,o=()=>1){const i=Object.create(Ar.prototype);return Ur(i),Rr(i,Object.create(br.prototype),e,t,r,n,o),i}function Mr(e,t,r){const n=Object.create(Ar.prototype);return Ur(n),tt(n,Object.create(ke.prototype),e,t,r,0,void 0),n}function Ur(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Wr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")&&e instanceof Ar}function Br(e){return void 0!==e._reader}function Lr(e,t){if(e._disturbed=!0,"closed"===e._state)return h(void 0);if("errored"===e._state)return p(e._storedError);Dr(e);const r=e._reader;if(void 0!==r&&ct(r)){const e=r._readIntoRequests;r._readIntoRequests=new O,e.forEach((e=>{e._closeSteps(void 0)}))}return _(e._readableStreamController[j](t),n)}function Dr(e){e._state="closed";const t=e._reader;if(void 0!==t&&(W(t),te(t))){const e=t._readRequests;t._readRequests=new O,e.forEach((e=>{e._closeSteps()}))}}function Nr(e,t){e._state="errored",e._storedError=t;const r=e._reader;void 0!==r&&(U(r,t),te(r)?ne(r,t):dt(r,t))}function zr(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Fr(e,t){D(e,t);const r=null==e?void 0:e.highWaterMark;return $(r,"highWaterMark","QueuingStrategyInit"),{highWaterMark:G(r)}}Object.defineProperties(Ar,{from:{enumerable:!0}}),Object.defineProperties(Ar.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),a(Ar.from,"from"),a(Ar.prototype.cancel,"cancel"),a(Ar.prototype.getReader,"getReader"),a(Ar.prototype.pipeThrough,"pipeThrough"),a(Ar.prototype.pipeTo,"pipeTo"),a(Ar.prototype.tee,"tee"),a(Ar.prototype.values,"values"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Ar.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0}),Object.defineProperty(Ar.prototype,be,{value:Ar.prototype.values,writable:!0,configurable:!0});const $r=e=>e.byteLength;a($r,"size");class Gr{constructor(e){F(e,1,"ByteLengthQueuingStrategy"),e=Fr(e,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Hr(this))throw Yr("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!Hr(this))throw Yr("size");return $r}}function Yr(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function Hr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")&&e instanceof Gr}Object.defineProperties(Gr.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(Gr.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});const Vr=()=>1;a(Vr,"size");class Qr{constructor(e){F(e,1,"CountQueuingStrategy"),e=Fr(e,"First parameter"),this._countQueuingStrategyHighWaterMark=e.highWaterMark}get highWaterMark(){if(!Kr(this))throw Jr("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!Kr(this))throw Jr("size");return Vr}}function Jr(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function Kr(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")&&e instanceof Qr}function Xr(e,t,r){return N(e,r),r=>P(e,t,[r])}function Zr(e,t,r){return N(e,r),r=>S(e,t,[r])}function en(e,t,r){return N(e,r),(r,n)=>P(e,t,[r,n])}function tn(e,t,r){return N(e,r),r=>P(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(e={},t={},r={}){void 0===e&&(e=null);const n=mt(t,"Second parameter"),o=mt(r,"Third parameter"),i=function(e,t){D(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,a=null==e?void 0:e.transform,s=null==e?void 0:e.writableType;return{cancel:void 0===r?void 0:tn(r,e,`${t} has member 'cancel' that`),flush:void 0===n?void 0:Xr(n,e,`${t} has member 'flush' that`),readableType:o,start:void 0===i?void 0:Zr(i,e,`${t} has member 'start' that`),transform:void 0===a?void 0:en(a,e,`${t} has member 'transform' that`),writableType:s}}(e,"First parameter");if(void 0!==i.readableType)throw new RangeError("Invalid readableType specified");if(void 0!==i.writableType)throw new RangeError("Invalid writableType specified");const a=pt(o,0),s=bt(o),l=pt(n,1),u=bt(n);let c;!function(e,t,r,n,o,i){function a(){return t}e._writable=function(e,t,r,n,o=1,i=()=>1){const a=Object.create(Ot.prototype);return Tt(a),Yt(a,Object.create($t.prototype),e,t,r,n,o,i),a}(a,(function(t){return function(e,t){const r=e._transformStreamController;return e._backpressure?_(e._backpressureChangePromise,(()=>{const n=e._writable;if("erroring"===n._state)throw n._storedError;return hn(r,t)})):hn(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 fn(t),m(n,(()=>("errored"===r._state?mn(t,r._storedError):(gr(r._readableStreamController),bn(t)),null)),(e=>(Sr(r._readableStreamController,e),mn(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 fn(r),m(o,(()=>("errored"===n._state?mn(r,n._storedError):(Sr(n._readableStreamController,t),bn(r)),null)),(e=>(Sr(n._readableStreamController,e),mn(r,e),null))),r._finishPromise}(e,t)}),r,n),e._readable=xr(a,(function(){return function(e){return ln(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 fn(r),m(o,(()=>("errored"===n._state?mn(r,n._storedError):(Jt(n._writableStreamController,t),sn(e),bn(r)),null)),(t=>(Jt(n._writableStreamController,t),sn(e),mn(r,t),null))),r._finishPromise}(e,t)}),o,i),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,ln(e,!0),e._transformStreamController=void 0}(this,d((e=>{c=e})),l,u,a,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),h(void 0)}catch(e){return p(e)}},o=void 0!==t.flush?()=>t.flush(r):()=>h(void 0),i=void 0!==t.cancel?e=>t.cancel(e):()=>h(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,i),void 0!==i.start?c(i.start(this._transformStreamController)):c(void 0)}get readable(){if(!nn(this))throw yn("readable");return this._readable}get writable(){if(!nn(this))throw yn("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),an(e,t)}function an(e,t){fn(e._transformStreamController),Jt(e._writable._writableStreamController,t),sn(e)}function sn(e){e._backpressure&&ln(e,!1)}function ln(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(!cn(this))throw pn("desiredSize");return Pr(this._controlledTransformStream._readable._readableStreamController)}enqueue(e=void 0){if(!cn(this))throw pn("enqueue");dn(this,e)}error(e=void 0){if(!cn(this))throw pn("error");var t;t=e,on(this._controlledTransformStream,t)}terminate(){if(!cn(this))throw pn("terminate");!function(e){const t=e._controlledTransformStream;gr(t._readable._readableStreamController),an(t,new TypeError("TransformStream terminated"))}(this)}}function cn(e){return!!o(e)&&!!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")&&e instanceof un}function fn(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(!Or(n))throw new TypeError("Readable side is not in a state that permits enqueue");try{wr(n,t)}catch(e){throw an(r,e),r._readable._storedError}const o=function(e){return!vr(e)}(n);o!==r._backpressure&&ln(r,!0)}function hn(e,t){return _(e._transformAlgorithm(t),void 0,(t=>{throw on(e._controlledTransformStream,t),t}))}function pn(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function bn(e){void 0!==e._finishPromise_resolve&&(e._finishPromise_resolve(),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function mn(e,t){void 0!==e._finishPromise_reject&&(g(e._finishPromise),e._finishPromise_reject(t),e._finishPromise_resolve=void 0,e._finishPromise_reject=void 0)}function yn(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}Object.defineProperties(un.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),a(un.prototype.enqueue,"enqueue"),a(un.prototype.error,"error"),a(un.prototype.terminate,"terminate"),"symbol"==typeof Symbol.toStringTag&&Object.defineProperty(un.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0})}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}return r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(756)})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cloudbase_analytics",[],e):"object"==typeof exports?exports.cloudbase_analytics=e():t.cloudbase_analytics=e()}("undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var t={702:(t,e,n)=>{n.r(e),n.d(e,{registerAnalytics:()=>N});var o="@cloudbase/js-sdk";function r(){return o}var i,a={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"};!function(t){t.local="local",t.none="none",t.session="session"}(i||(i={}));function s(t,e){console.warn("[".concat(r(),"][").concat(t,"]:").concat(e))}var c,u,l=(c=function(t,e){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},c(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),p=function(){return p=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},p.apply(this,arguments)},f=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},d=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};!function(t){function e(e){var n=t.call(this)||this,o=e.timeout,r=e.timeoutMsg,i=e.restrictedMethods;return n.timeout=o||0,n.timeoutMsg=r||"请求超时",n.restrictedMethods=i||["get","post","upload","download"],n}l(e,t),e.prototype.get=function(t){return this.request(p(p({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(p(p({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(p(p({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,n=t.file,o=t.name,r=t.method,i=t.headers,a=void 0===i?{}:i,s={post:"post",put:"put"}[null==r?void 0:r.toLowerCase()]||"put",c=new FormData;return"post"===s?(Object.keys(e).forEach((function(t){c.append(t,e[t])})),c.append("key",o),c.append("file",n),this.request(p(p({},t),{data:c,method:s}),this.restrictedMethods.includes("upload"))):this.request(p(p({},t),{method:"put",headers:a,body:n}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return f(this,void 0,void 0,(function(){var e,n,o,r;return d(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.get(p(p({},t),{headers:{},responseType:"blob"}))];case 1:return e=i.sent().data,n=window.URL.createObjectURL(new Blob([e])),o=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(r=document.createElement("a")).href=n,r.setAttribute("download",o),r.style.display="none",document.body.appendChild(r),r.click(),window.URL.revokeObjectURL(n),document.body.removeChild(r),[3,3];case 2:return i.sent(),[3,3];case 3:return[2,new Promise((function(e){e({statusCode:200,tempFilePath:t.url})}))]}}))}))},e.prototype.fetch=function(t){var e;return f(this,void 0,void 0,(function(){var n,o,r,i,a,s,c,u,l,h,y,b,v,m=this;return d(this,(function(g){switch(g.label){case 0:return n=new AbortController,o=t.url,r=t.enableAbort,i=void 0!==r&&r,a=t.stream,s=void 0!==a&&a,c=t.signal,u=t.timeout,l=t.shouldThrowOnError,h=void 0===l||l,y=null!=u?u:this.timeout,c&&(c.aborted&&n.abort(),c.addEventListener("abort",(function(){return n.abort()}))),b=null,i&&y&&(b=setTimeout((function(){console.warn(m.timeoutMsg),n.abort(new Error(m.timeoutMsg))}),y)),[4,fetch(o,p(p({},t),{signal:n.signal})).then((function(t){return f(m,void 0,void 0,(function(){var e,n,o;return d(this,(function(r){switch(r.label){case 0:return clearTimeout(b),h?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return o=(n=Promise).reject,[4,t.json()];case 2:e=o.apply(n,[r.sent()]),r.label=3;case 3:return[2,e];case 4:return[2,t]}}))}))})).catch((function(t){if(clearTimeout(b),h)return Promise.reject(t)}))];case 1:return v=g.sent(),[2,{data:s?v.body:(null===(e=v.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?v.json():v.text(),statusCode:v.status,header:v.headers}]}}))}))},e.prototype.request=function(t,e){var n=this;void 0===e&&(e=!1);var o=String(t.method).toLowerCase()||"get";return new Promise((function(r){var i,a,s,c=t.url,u=t.headers,l=void 0===u?{}:u,p=t.data,f=t.responseType,d=t.withCredentials,h=t.body,y=t.onUploadProgress,b=function(t,e,n){void 0===n&&(n={});var o=/\?/.test(e),r="";return Object.keys(n).forEach((function(t){""===r?!o&&(e+="?"):r+="&",r+="".concat(t,"=").concat(encodeURIComponent(n[t]))})),/^http(s)?:\/\//.test(e+=r)?e:"".concat(t).concat(e)}("https:",c,"get"===o?p:{}),v=new XMLHttpRequest;v.open(o,b),f&&(v.responseType=f),Object.keys(l).forEach((function(t){v.setRequestHeader(t,l[t])})),y&&v.upload.addEventListener("progress",y),v.onreadystatechange=function(){var t={};if(4===v.readyState){var e=v.getAllResponseHeaders().trim().split(/[\r\n]+/),n={};e.forEach((function(t){var e=t.split(": "),o=e.shift().toLowerCase(),r=e.join(": ");n[o]=r})),t.header=n,t.statusCode=v.status;try{t.data="blob"===f?v.response:JSON.parse(v.responseText)}catch(e){t.data="blob"===f?v.response:v.responseText}clearTimeout(i),r(t)}},e&&n.timeout&&(i=setTimeout((function(){console.warn(n.timeoutMsg),v.abort()}),n.timeout)),s=p,a="[object FormData]"===Object.prototype.toString.call(s)?p:"application/x-www-form-urlencoded"===l["content-type"]?function(t){void 0===t&&(t={});var e=[];return Object.keys(t).forEach((function(n){e.push("".concat(n,"=").concat(encodeURIComponent(t[n])))})),e.join("&")}(p):h||(p?JSON.stringify(p):void 0),d&&(v.withCredentials=!0),v.send(a)}))}}((function(){})),function(t){t.WEB="web",t.WX_MP="wx_mp"}(u||(u={}));var h=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),y=function(t,e,n,o){return new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}c((o=o.apply(t,e||[])).next())}))},b=function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},v=function(t){function e(e){var n=t.call(this)||this;return n.root=e,e.tcbCacheObject||(e.tcbCacheObject={}),n}return h(e,t),e.prototype.setItem=function(t,e){this.root.tcbCacheObject[t]=e},e.prototype.getItem=function(t){return this.root.tcbCacheObject[t]},e.prototype.removeItem=function(t){delete this.root.tcbCacheObject[t]},e.prototype.clear=function(){delete this.root.tcbCacheObject},e}((function(){}));!function(){function t(t){this.keys={};var e=t.persistence,n=t.platformInfo,o=void 0===n?{}:n,r=t.keys,i=void 0===r?{}:r;this.platformInfo=o,this.storage||(this.persistenceTag=this.platformInfo.adapter.primaryStorage||e,this.storage=function(t,e){switch(t){case"local":default:return e.localStorage?e.localStorage:(s(a.INVALID_PARAMS,"localStorage is not supported on current platform"),new v(e.root));case"none":return new v(e.root)}}(this.persistenceTag,this.platformInfo.adapter),this.keys=i)}Object.defineProperty(t.prototype,"mode",{get:function(){return this.storage.mode||"sync"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"persistence",{get:function(){return this.persistenceTag},enumerable:!1,configurable:!0}),t.prototype.setStore=function(t,e,n){if("async"!==this.mode){if(this.storage)try{var o={version:n||"localCachev1",content:e};this.storage.setItem(t,JSON.stringify(o))}catch(t){throw new Error(JSON.stringify({code:a.OPERATION_FAIL,msg:"[".concat(r(),"][").concat(a.OPERATION_FAIL,"]setStore failed"),info:t}))}}else s(a.INVALID_OPERATION,"current platform's storage is asynchronous, please use setStoreAsync insteed")},t.prototype.setStoreAsync=function(t,e,n){return y(this,void 0,void 0,(function(){var o;return b(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),o={version:n||"localCachev1",content:e},[4,this.storage.setItem(t,JSON.stringify(o))];case 2:return r.sent(),[3,4];case 3:return r.sent(),[2];case 4:return[2]}}))}))},t.prototype.getStore=function(t,e){var n;if("async"!==this.mode){try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return{IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0}.tcb_token;if(!this.storage)return""}catch(t){return""}e=e||"localCachev1";var o=this.storage.getItem(t);return o&&o.indexOf(e)>=0?JSON.parse(o).content:""}s(a.INVALID_OPERATION,"current platform's storage is asynchronous, please use getStoreAsync insteed")},t.prototype.getStoreAsync=function(t,e){var n;return y(this,void 0,void 0,(function(){var o;return b(this,(function(r){switch(r.label){case 0:try{if("undefined"!=typeof process&&(null===(n={IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0})||void 0===n?void 0:n.tcb_token))return[2,{IS_MP_BUILD:!0,IS_BROWSER_BUILD:!0}.tcb_token];if(!this.storage)return[2,""]}catch(t){return[2,""]}return e=e||"localCachev1",[4,this.storage.getItem(t)];case 1:return(o=r.sent())&&o.indexOf(e)>=0?[2,JSON.parse(o).content]:[2,""]}}))}))},t.prototype.removeStore=function(t){"async"!==this.mode?this.storage.removeItem(t):s(a.INVALID_OPERATION,"current platform's storage is asynchronous, please use removeStoreAsync insteed")},t.prototype.removeStoreAsync=function(t){return y(this,void 0,void 0,(function(){return b(this,(function(e){switch(e.label){case 0:return[4,this.storage.removeItem(t)];case 1:return e.sent(),[2]}}))}))}}();var m=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),g=function(t,e){this.data=e||null,this.name=t},w=function(t){function e(e,n){var o=t.call(this,"error",{error:e,data:n})||this;return o.error=e,o}return m(e,t),e}(g),O=function(){function t(){this.listeners={}}return t.prototype.on=function(t,e){return function(t,e,n){n[t]=n[t]||[],n[t].push(e)}(t,e,this.listeners),this},t.prototype.off=function(t,e){return function(t,e,n){if(null==n?void 0:n[t]){var o=n[t].indexOf(e);-1!==o&&n[t].splice(o,1)}}(t,e,this.listeners),this},t.prototype.fire=function(t,e){if(t instanceof w)return console.error(t.error),this;var n="string"==typeof t?new g(t,e||{}):t,o=n.name;if(this.listens(o)){n.target=this;for(var r=0,i=this.listeners[o]?function(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}([],this.listeners[o],!0):[];r<i.length;r++)i[r].call(this,n)}return this},t.prototype.listens=function(t){return this.listeners[t]&&this.listeners[t].length>0},t}();function _(t){this.message=t}function I(t){this.message=t}new O,new O,"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.indexOf("Firefox"),_.prototype=new Error,_.prototype.name="InvalidCharacterError","undefined"!=typeof window&&window.atob&&window.atob.bind(window),I.prototype=new Error,I.prototype.name="InvalidTokenError";var S=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},A=a,j="analytics",R=["mall"],P=new(function(){function t(){}return t.prototype.analytics=function(t){return e=this,n=void 0,r=function(){var e,n,o;return function(t,e){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[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(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}(this,(function(r){if(!function(t){if("Object"!==Object.prototype.toString.call(t).slice(8,-1))return!1;var e=t.report_data,n=t.report_type;return!1!==R.includes(n)&&"Object"===Object.prototype.toString.call(e).slice(8,-1)&&!(void 0!==e.action_time&&!Number.isInteger(e.action_time))&&"string"==typeof e.action_type}(t))throw new Error(JSON.stringify({code:A.INVALID_PARAMS,msg:"[".concat(j,".analytics] invalid report data")}));return e=void 0===t.report_data.action_time?Math.floor(Date.now()/1e3):t.report_data.action_time,n={analytics_scene:t.report_type,analytics_data:Object.assign({},t.report_data,{action_time:e})},o={requestData:n},this.request.send("analytics.report",o),[2]}))},new((o=void 0)||(o=Promise))((function(t,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(a,s)}c((r=r.apply(e,n||[])).next())}));var e,n,o,r},function(t,e,n,o){var r,i=arguments.length,a=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(i<3?r(a):i>3?r(e,n,a):r(e,n))||a);i>3&&a&&Object.defineProperty(e,n,a)}([(e={customInfo:{className:"Cloudbase",methodName:"analytics"},title:"上报调用失败",messages:["请确认以下各项:"," 1 - 调用 analytics() 的语法或参数是否正确","如果问题依然存在,建议到官方问答社区提问或寻找帮助:".concat("https://support.qq.com/products/148793")]},e.mode,e.customInfo,e.title,e.messages,function(t,e,n){}),S("design:type",Function),S("design:paramtypes",[Object]),S("design:returntype",Promise)],t.prototype,"analytics",null),t;var e}()),E={name:j,entity:{analytics:P.analytics}};try{cloudbase.registerComponent(E)}catch(_){}function N(t){try{t.registerComponent(E)}catch(t){console.warn(t)}}}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var i=e[o]={exports:{}};return t[o](i,i.exports,n),i.exports}n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.registerAnalytics=void 0;var e=n(702);t.registerAnalytics=e.registerAnalytics})(),o})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("cloudbase_apis",[],t):"object"==typeof exports?exports.cloudbase_apis=t():e.cloudbase_apis=t()}("undefined"!=typeof window?window:this,(()=>(()=>{"use strict";var e={378:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{s(r.next(e))}catch(e){i(e)}}function c(e){try{s(r.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))},i=this&&this.__generator||function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(s){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,s])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.generateApis=t.generateCallApis=t.callApi=void 0;var a=n(794);function c(e,t){var n,c,s,u;return o(this,void 0,Promise,(function(){var o,l,f,p,d,h,v,O,b,y,_,g,P,A,E,w,R,m,T,S,j,I,N;return i(this,(function(i){switch(i.label){case 0:l=(o=e||{}).name,f=o.body,p=o.path,d=void 0===p?"":p,h=o.method,v=void 0===h?"POST":h,O=o.headers,b=void 0===O?{}:O,y=(e||{}).token,_={};try{_=JSON.parse(f)}catch(e){_=f||{}}if(!l)throw new Error(JSON.stringify({code:a.ERRORS.INVALID_PARAMS,msg:"[apis] invalid api name"}));return g="",A=(P=this).gatewayOrigin,E=P.getAccessToken,w=P.env,A?g="".concat(A,"/v1"):this.getEndPointWithKey?(R=this.getEndPointWithKey("GATEWAY"),m=R.BASE_URL,T=R.PROTOCOL,g="".concat(T).concat(m)):g="https://".concat(w,".api.tcloudbasegateway.com/v1"),S="".concat(g,"/apis/").concat(l),j=d.startsWith("/")?d:"/".concat(d),E?[4,E()]:[3,2];case 1:I=i.sent().accessToken,b.Authorization="Bearer ".concat(I),i.label=2;case 2:if(N=["GET","HEAD"].includes(null===(n=null==v?void 0:v.toUpperCase)||void 0===n?void 0:n.call(v)))try{j="".concat(j).concat(j.includes("?")?"&":"?").concat(Object.keys(_).map((function(e){return"".concat(e,"=").concat(_[e])})).join("&"))}catch(e){}return[4,this.request.fetch(r(r(r({url:"".concat(S).concat(j),method:v||"POST",headers:r({"Content-Type":"application/json; charset=utf-8"},b)},N?{}:{body:JSON.stringify(_)}),{token:(null===(c=null==y?void 0:y.trim)||void 0===c?void 0:c.call(y))||(null===(u=null===(s=b.Authorization)||void 0===s?void 0:s.replace)||void 0===u?void 0:u.call(s,/^Bearer /,""))||null}),t))];case 3:return[4,i.sent().data];case 4:return[2,i.sent()]}}))}))}t.callApi=c;var s=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH","REQUEST"];function u(e){var t=this;return new Proxy({},{get:function(n,a){if("string"!=typeof a)throw new Error("[apis] method must be string");var u=a.toLocaleUpperCase();if(!s.includes(u))throw new Error("[apis] invalid method: ".concat(a));return function(n,a){return o(t,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,c.call(this,r({name:e,method:("REQUEST"===u?n.method:u)||"POST"},n),a)];case 1:return[2,t.sent()]}}))}))}}})}t.generateCallApis=u,t.generateApis=function(e){var t=this;return Object.keys(e||{}).forEach((function(n){void 0!==e[n]&&(t[n]=e[n])})),new Proxy({},{get:function(e,n){if("string"==typeof n)return u.call(t,n)}})}},944:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.registerApis=t.generateApis=void 0;var i=n(378);Object.defineProperty(t,"generateApis",{enumerable:!0,get:function(){return i.generateApis}});var a="apis",c={name:a,IIFE:!0,entity:function(){Object.defineProperty(this.prototype,a,{get:function(){return i.generateApis.call(this)},configurable:!0,enumerable:!0})}};function s(e){try{e.registerComponent(c)}catch(e){console.warn(e)}}t.registerApis=s;try{cloudbase.registerComponent(c)}catch(e){}o(n(26),t);try{window.registerApis=s}catch(e){}},26:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},749:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),o(n(944),t)},946:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.COMMUNITY_SITE_URL=t.IS_DEBUG_MODE=t.getProtocol=t.setProtocol=t.getSdkName=t.setSdkName=void 0;var n="@cloudbase/js-sdk";t.setSdkName=function(e){n=e},t.getSdkName=function(){return n};var r="https:";t.setProtocol=function(e){r=e},t.getProtocol=function(){return r},t.IS_DEBUG_MODE=!1,t.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},205:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ERRORS=void 0,t.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},794:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.OATUH_LOGINTYPE=void 0,o(n(946),t),o(n(205),t),t.OATUH_LOGINTYPE="constants"}},t={};return function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(749)})()));
|